Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1625573003: On ES or Core profile, we should be able to disable vertex attrib 0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call 2686 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call
2687 DoBindVertexArrayOES(0); 2687 DoBindVertexArrayOES(0);
2688 2688
2689 query_manager_.reset(new QueryManager(this, feature_info_.get())); 2689 query_manager_.reset(new QueryManager(this, feature_info_.get()));
2690 2690
2691 image_manager_.reset(new ImageManager); 2691 image_manager_.reset(new ImageManager);
2692 2692
2693 util_.set_num_compressed_texture_formats( 2693 util_.set_num_compressed_texture_formats(
2694 validators_->compressed_texture_format.GetValues().size()); 2694 validators_->compressed_texture_format.GetValues().size());
2695 2695
2696 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { 2696 if (!feature_info_->gl_version_info().BehavesLikeGLES()) {
2697 // We have to enable vertex array 0 on OpenGL or it won't render. Note that 2697 // We have to enable vertex array 0 on GL with compatibility profile or it
2698 // OpenGL ES 2.0 does not have this issue. 2698 // won't render. Note that ES or GL with core profile does not have this
2699 // issue.
2699 glEnableVertexAttribArray(0); 2700 glEnableVertexAttribArray(0);
2700 } 2701 }
2701 glGenBuffersARB(1, &attrib_0_buffer_id_); 2702 glGenBuffersARB(1, &attrib_0_buffer_id_);
2702 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); 2703 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_);
2703 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); 2704 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL);
2704 glBindBuffer(GL_ARRAY_BUFFER, 0); 2705 glBindBuffer(GL_ARRAY_BUFFER, 0);
2705 glGenBuffersARB(1, &fixed_attrib_buffer_id_); 2706 glGenBuffersARB(1, &fixed_attrib_buffer_id_);
2706 2707
2707 state_.texture_units.resize(group_->max_texture_units()); 2708 state_.texture_units.resize(group_->max_texture_units());
2708 state_.sampler_units.resize(group_->max_texture_units()); 2709 state_.sampler_units.resize(group_->max_texture_units());
(...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after
4924 glBindSampler(unit, sampler->service_id()); 4925 glBindSampler(unit, sampler->service_id());
4925 } else { 4926 } else {
4926 glBindSampler(unit, 0); 4927 glBindSampler(unit, 0);
4927 } 4928 }
4928 4929
4929 state_.sampler_units[unit] = sampler; 4930 state_.sampler_units[unit] = sampler;
4930 } 4931 }
4931 4932
4932 void GLES2DecoderImpl::DoDisableVertexAttribArray(GLuint index) { 4933 void GLES2DecoderImpl::DoDisableVertexAttribArray(GLuint index) {
4933 if (state_.vertex_attrib_manager->Enable(index, false)) { 4934 if (state_.vertex_attrib_manager->Enable(index, false)) {
4934 if (index != 0 || 4935 if (index != 0 || feature_info_->gl_version_info().BehavesLikeGLES()) {
4935 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) {
4936 glDisableVertexAttribArray(index); 4936 glDisableVertexAttribArray(index);
4937 } 4937 }
4938 } else { 4938 } else {
4939 LOCAL_SET_GL_ERROR( 4939 LOCAL_SET_GL_ERROR(
4940 GL_INVALID_VALUE, 4940 GL_INVALID_VALUE,
4941 "glDisableVertexAttribArray", "index out of range"); 4941 "glDisableVertexAttribArray", "index out of range");
4942 } 4942 }
4943 } 4943 }
4944 4944
4945 void GLES2DecoderImpl::DoDiscardFramebufferEXT(GLenum target, 4945 void GLES2DecoderImpl::DoDiscardFramebufferEXT(GLenum target,
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after
7853 // extension is available 7853 // extension is available
7854 DCHECK(attrib->divisor() == 0 || 7854 DCHECK(attrib->divisor() == 0 ||
7855 feature_info_->feature_flags().angle_instanced_arrays); 7855 feature_info_->feature_flags().angle_instanced_arrays);
7856 7856
7857 if (feature_info_->feature_flags().angle_instanced_arrays) 7857 if (feature_info_->feature_flags().angle_instanced_arrays)
7858 glVertexAttribDivisorANGLE(attrib_index, attrib->divisor()); 7858 glVertexAttribDivisorANGLE(attrib_index, attrib->divisor());
7859 glBindBuffer( 7859 glBindBuffer(
7860 GL_ARRAY_BUFFER, state_.bound_array_buffer.get() ? 7860 GL_ARRAY_BUFFER, state_.bound_array_buffer.get() ?
7861 state_.bound_array_buffer->service_id() : 0); 7861 state_.bound_array_buffer->service_id() : 0);
7862 7862
7863 // Never touch vertex attribute 0's state (in particular, never 7863 // Never touch vertex attribute 0's state (in particular, never disable it)
7864 // disable it) when running on desktop GL because it will never be 7864 // when running on desktop GL with compatibility profile because it will
7865 // re-enabled. 7865 // never be re-enabled.
7866 if (attrib_index != 0 || 7866 if (attrib_index != 0 || feature_info_->gl_version_info().BehavesLikeGLES()) {
7867 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) {
7868 if (attrib->enabled()) { 7867 if (attrib->enabled()) {
7869 glEnableVertexAttribArray(attrib_index); 7868 glEnableVertexAttribArray(attrib_index);
7870 } else { 7869 } else {
7871 glDisableVertexAttribArray(attrib_index); 7870 glDisableVertexAttribArray(attrib_index);
7872 } 7871 }
7873 } 7872 }
7874 } 7873 }
7875 7874
7876 bool GLES2DecoderImpl::SimulateFixedAttribs( 7875 bool GLES2DecoderImpl::SimulateFixedAttribs(
7877 const char* function_name, 7876 const char* function_name,
7878 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { 7877 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) {
7879 DCHECK(simulated); 7878 DCHECK(simulated);
7880 *simulated = false; 7879 *simulated = false;
7881 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) 7880 if (feature_info_->gl_version_info().BehavesLikeGLES())
7882 return true; 7881 return true;
7883 7882
7884 if (!state_.vertex_attrib_manager->HaveFixedAttribs()) { 7883 if (!state_.vertex_attrib_manager->HaveFixedAttribs()) {
7885 return true; 7884 return true;
7886 } 7885 }
7887 7886
7888 LOCAL_PERFORMANCE_WARNING( 7887 LOCAL_PERFORMANCE_WARNING(
7889 "GL_FIXED attributes have a signficant performance penalty"); 7888 "GL_FIXED attributes have a signficant performance penalty");
7890 7889
7891 // NOTE: we could be smart and try to check if a buffer is used 7890 // NOTE: we could be smart and try to check if a buffer is used
(...skipping 7721 matching lines...) Expand 10 before | Expand all | Expand 10 after
15613 } 15612 }
15614 15613
15615 // Include the auto-generated part of this file. We split this because it means 15614 // Include the auto-generated part of this file. We split this because it means
15616 // we can easily edit the non-auto generated parts right here in this file 15615 // we can easily edit the non-auto generated parts right here in this file
15617 // instead of having to edit some template or the code generator. 15616 // instead of having to edit some template or the code generator.
15618 #include "base/macros.h" 15617 #include "base/macros.h"
15619 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15618 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15620 15619
15621 } // namespace gles2 15620 } // namespace gles2
15622 } // namespace gpu 15621 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_state.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698