| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 GLenum type, | 843 GLenum type, |
| 844 const void * data); | 844 const void * data); |
| 845 | 845 |
| 846 // Creates a ProgramInfo for the given program. | 846 // Creates a ProgramInfo for the given program. |
| 847 void CreateProgramInfo(GLuint client_id, GLuint service_id) { | 847 void CreateProgramInfo(GLuint client_id, GLuint service_id) { |
| 848 program_manager()->CreateProgramInfo(client_id, service_id); | 848 program_manager()->CreateProgramInfo(client_id, service_id); |
| 849 } | 849 } |
| 850 | 850 |
| 851 // Gets the program info for the given program. Returns NULL if none exists. | 851 // Gets the program info for the given program. Returns NULL if none exists. |
| 852 ProgramManager::ProgramInfo* GetProgramInfo(GLuint client_id) { | 852 ProgramManager::ProgramInfo* GetProgramInfo(GLuint client_id) { |
| 853 ProgramManager::ProgramInfo* info = | 853 return program_manager()->GetProgramInfo(client_id); |
| 854 program_manager()->GetProgramInfo(client_id); | |
| 855 return (info && !info->IsDeleted()) ? info : NULL; | |
| 856 } | 854 } |
| 857 | 855 |
| 858 // Gets the program info for the given program. If it's not a program | 856 // Gets the program info for the given program. If it's not a program |
| 859 // generates a GL error. Returns NULL if not program. | 857 // generates a GL error. Returns NULL if not program. |
| 860 ProgramManager::ProgramInfo* GetProgramInfoNotShader( | 858 ProgramManager::ProgramInfo* GetProgramInfoNotShader( |
| 861 GLuint client_id, const char* function_name) { | 859 GLuint client_id, const char* function_name) { |
| 862 ProgramManager::ProgramInfo* info = GetProgramInfo(client_id); | 860 ProgramManager::ProgramInfo* info = GetProgramInfo(client_id); |
| 863 if (!info) { | 861 if (!info) { |
| 864 if (GetShaderInfo(client_id)) { | 862 if (GetShaderInfo(client_id)) { |
| 865 SetGLError(GL_INVALID_OPERATION, | 863 SetGLError(GL_INVALID_OPERATION, |
| 866 (std::string(function_name) + | 864 (std::string(function_name) + |
| 867 ": shader passed for program").c_str()); | 865 ": shader passed for program").c_str()); |
| 868 } else { | 866 } else { |
| 869 SetGLError(GL_INVALID_VALUE, | 867 SetGLError(GL_INVALID_VALUE, |
| 870 (std::string(function_name) + ": unknown program").c_str()); | 868 (std::string(function_name) + ": unknown program").c_str()); |
| 871 } | 869 } |
| 872 } | 870 } |
| 873 return info; | 871 return info; |
| 874 } | 872 } |
| 875 | 873 |
| 876 | 874 |
| 877 // Deletes the program info for the given program. | |
| 878 void RemoveProgramInfo(GLuint client_id) { | |
| 879 program_manager()->RemoveProgramInfo(client_id); | |
| 880 } | |
| 881 | |
| 882 // Creates a ShaderInfo for the given shader. | 875 // Creates a ShaderInfo for the given shader. |
| 883 void CreateShaderInfo(GLuint client_id, | 876 void CreateShaderInfo(GLuint client_id, |
| 884 GLuint service_id, | 877 GLuint service_id, |
| 885 GLenum shader_type) { | 878 GLenum shader_type) { |
| 886 shader_manager()->CreateShaderInfo(client_id, service_id, shader_type); | 879 shader_manager()->CreateShaderInfo(client_id, service_id, shader_type); |
| 887 } | 880 } |
| 888 | 881 |
| 889 // Gets the shader info for the given shader. Returns NULL if none exists. | 882 // Gets the shader info for the given shader. Returns NULL if none exists. |
| 890 ShaderManager::ShaderInfo* GetShaderInfo(GLuint client_id) { | 883 ShaderManager::ShaderInfo* GetShaderInfo(GLuint client_id) { |
| 891 ShaderManager::ShaderInfo* info = | 884 return shader_manager()->GetShaderInfo(client_id); |
| 892 shader_manager()->GetShaderInfo(client_id); | |
| 893 return (info && !info->IsDeleted()) ? info : NULL; | |
| 894 } | 885 } |
| 895 | 886 |
| 896 // Gets the shader info for the given shader. If it's not a shader generates a | 887 // Gets the shader info for the given shader. If it's not a shader generates a |
| 897 // GL error. Returns NULL if not shader. | 888 // GL error. Returns NULL if not shader. |
| 898 ShaderManager::ShaderInfo* GetShaderInfoNotProgram( | 889 ShaderManager::ShaderInfo* GetShaderInfoNotProgram( |
| 899 GLuint client_id, const char* function_name) { | 890 GLuint client_id, const char* function_name) { |
| 900 ShaderManager::ShaderInfo* info = GetShaderInfo(client_id); | 891 ShaderManager::ShaderInfo* info = GetShaderInfo(client_id); |
| 901 if (!info) { | 892 if (!info) { |
| 902 if (GetProgramInfo(client_id)) { | 893 if (GetProgramInfo(client_id)) { |
| 903 SetGLError( | 894 SetGLError( |
| 904 GL_INVALID_OPERATION, | 895 GL_INVALID_OPERATION, |
| 905 (std::string(function_name) + | 896 (std::string(function_name) + |
| 906 ": program passed for shader").c_str()); | 897 ": program passed for shader").c_str()); |
| 907 } else { | 898 } else { |
| 908 SetGLError(GL_INVALID_VALUE, | 899 SetGLError(GL_INVALID_VALUE, |
| 909 (std::string(function_name) + ": unknown shader").c_str()); | 900 (std::string(function_name) + ": unknown shader").c_str()); |
| 910 } | 901 } |
| 911 } | 902 } |
| 912 return info; | 903 return info; |
| 913 } | 904 } |
| 914 | 905 |
| 915 // Deletes the shader info for the given shader. | |
| 916 void RemoveShaderInfo(GLuint client_id) { | |
| 917 shader_manager()->RemoveShaderInfo(client_id); | |
| 918 } | |
| 919 | |
| 920 // Creates a buffer info for the given buffer. | 906 // Creates a buffer info for the given buffer. |
| 921 void CreateBufferInfo(GLuint client_id, GLuint service_id) { | 907 void CreateBufferInfo(GLuint client_id, GLuint service_id) { |
| 922 return buffer_manager()->CreateBufferInfo(client_id, service_id); | 908 return buffer_manager()->CreateBufferInfo(client_id, service_id); |
| 923 } | 909 } |
| 924 | 910 |
| 925 // Gets the buffer info for the given buffer. | 911 // Gets the buffer info for the given buffer. |
| 926 BufferManager::BufferInfo* GetBufferInfo(GLuint client_id) { | 912 BufferManager::BufferInfo* GetBufferInfo(GLuint client_id) { |
| 927 BufferManager::BufferInfo* info = | 913 BufferManager::BufferInfo* info = |
| 928 buffer_manager()->GetBufferInfo(client_id); | 914 buffer_manager()->GetBufferInfo(client_id); |
| 929 return (info && !info->IsDeleted()) ? info : NULL; | 915 return (info && !info->IsDeleted()) ? info : NULL; |
| (...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 return false; | 2453 return false; |
| 2468 } | 2454 } |
| 2469 | 2455 |
| 2470 void GLES2DecoderImpl::Destroy() { | 2456 void GLES2DecoderImpl::Destroy() { |
| 2471 bool have_context = context_.get() && MakeCurrent(); | 2457 bool have_context = context_.get() && MakeCurrent(); |
| 2472 | 2458 |
| 2473 if (group_.get()) | 2459 if (group_.get()) |
| 2474 group_->set_have_context(have_context); | 2460 group_->set_have_context(have_context); |
| 2475 | 2461 |
| 2476 if (have_context) { | 2462 if (have_context) { |
| 2463 if (current_program_) { |
| 2464 program_manager()->UnuseProgram(shader_manager(), current_program_); |
| 2465 current_program_ = NULL; |
| 2466 } |
| 2467 |
| 2477 if (attrib_0_buffer_id_) { | 2468 if (attrib_0_buffer_id_) { |
| 2478 glDeleteBuffersARB(1, &attrib_0_buffer_id_); | 2469 glDeleteBuffersARB(1, &attrib_0_buffer_id_); |
| 2479 } | 2470 } |
| 2480 if (fixed_attrib_buffer_id_) { | 2471 if (fixed_attrib_buffer_id_) { |
| 2481 glDeleteBuffersARB(1, &fixed_attrib_buffer_id_); | 2472 glDeleteBuffersARB(1, &fixed_attrib_buffer_id_); |
| 2482 } | 2473 } |
| 2483 | 2474 |
| 2484 // Remove the saved frame buffer mapping from the parent decoder. The | 2475 // Remove the saved frame buffer mapping from the parent decoder. The |
| 2485 // parent pointer is a weak pointer so it will be null if the parent has | 2476 // parent pointer is a weak pointer so it will be null if the parent has |
| 2486 // already been destroyed. | 2477 // already been destroyed. |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3150 glBindAttribLocation(info->service_id(), index, name_str.c_str()); | 3141 glBindAttribLocation(info->service_id(), index, name_str.c_str()); |
| 3151 return error::kNoError; | 3142 return error::kNoError; |
| 3152 } | 3143 } |
| 3153 | 3144 |
| 3154 error::Error GLES2DecoderImpl::HandleDeleteShader( | 3145 error::Error GLES2DecoderImpl::HandleDeleteShader( |
| 3155 uint32 immediate_data_size, const gles2::DeleteShader& c) { | 3146 uint32 immediate_data_size, const gles2::DeleteShader& c) { |
| 3156 GLuint client_id = c.shader; | 3147 GLuint client_id = c.shader; |
| 3157 if (client_id) { | 3148 if (client_id) { |
| 3158 ShaderManager::ShaderInfo* info = GetShaderInfo(client_id); | 3149 ShaderManager::ShaderInfo* info = GetShaderInfo(client_id); |
| 3159 if (info) { | 3150 if (info) { |
| 3160 glDeleteShader(info->service_id()); | 3151 if (!info->IsDeleted()) { |
| 3161 RemoveShaderInfo(client_id); | 3152 glDeleteShader(info->service_id()); |
| 3153 shader_manager()->MarkAsDeleted(info); |
| 3154 } |
| 3162 } else { | 3155 } else { |
| 3163 SetGLError(GL_INVALID_VALUE, "glDeleteShader: unknown shader"); | 3156 SetGLError(GL_INVALID_VALUE, "glDeleteShader: unknown shader"); |
| 3164 } | 3157 } |
| 3165 } | 3158 } |
| 3166 return error::kNoError; | 3159 return error::kNoError; |
| 3167 } | 3160 } |
| 3168 | 3161 |
| 3169 error::Error GLES2DecoderImpl::HandleDeleteProgram( | 3162 error::Error GLES2DecoderImpl::HandleDeleteProgram( |
| 3170 uint32 immediate_data_size, const gles2::DeleteProgram& c) { | 3163 uint32 immediate_data_size, const gles2::DeleteProgram& c) { |
| 3171 GLuint client_id = c.program; | 3164 GLuint client_id = c.program; |
| 3172 if (client_id) { | 3165 if (client_id) { |
| 3173 ProgramManager::ProgramInfo* info = GetProgramInfo(client_id); | 3166 ProgramManager::ProgramInfo* info = GetProgramInfo(client_id); |
| 3174 if (info) { | 3167 if (info) { |
| 3175 glDeleteProgram(info->service_id()); | 3168 if (!info->IsDeleted()) { |
| 3176 RemoveProgramInfo(client_id); | 3169 glDeleteProgram(info->service_id()); |
| 3170 program_manager()->MarkAsDeleted(shader_manager(), info); |
| 3171 } |
| 3177 } else { | 3172 } else { |
| 3178 SetGLError(GL_INVALID_VALUE, "glDeleteProgram: unknown program"); | 3173 SetGLError(GL_INVALID_VALUE, "glDeleteProgram: unknown program"); |
| 3179 } | 3174 } |
| 3180 } | 3175 } |
| 3181 return error::kNoError; | 3176 return error::kNoError; |
| 3182 } | 3177 } |
| 3183 | 3178 |
| 3184 void GLES2DecoderImpl::DoDeleteSharedIdsCHROMIUM( | 3179 void GLES2DecoderImpl::DoDeleteSharedIdsCHROMIUM( |
| 3185 GLuint namespace_id, GLsizei n, const GLuint* ids) { | 3180 GLuint namespace_id, GLsizei n, const GLuint* ids) { |
| 3186 IdAllocator* id_allocator = group_->GetIdAllocator(namespace_id); | 3181 IdAllocator* id_allocator = group_->GetIdAllocator(namespace_id); |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3688 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 3683 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
| 3689 if (!info) { | 3684 if (!info) { |
| 3690 SetGLError(GL_INVALID_VALUE, "glTexParameteriv: unknown texture"); | 3685 SetGLError(GL_INVALID_VALUE, "glTexParameteriv: unknown texture"); |
| 3691 } else { | 3686 } else { |
| 3692 texture_manager()->SetParameter(feature_info_, info, pname, *params); | 3687 texture_manager()->SetParameter(feature_info_, info, pname, *params); |
| 3693 glTexParameteriv(target, pname, params); | 3688 glTexParameteriv(target, pname, params); |
| 3694 } | 3689 } |
| 3695 } | 3690 } |
| 3696 | 3691 |
| 3697 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) { | 3692 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) { |
| 3698 if (!current_program_ || current_program_->IsDeleted()) { | 3693 if (!current_program_) { |
| 3699 // The program does not exist. | 3694 // The program does not exist. |
| 3700 SetGLError(GL_INVALID_OPERATION, | 3695 SetGLError(GL_INVALID_OPERATION, |
| 3701 (std::string(function_name) + ": no program in use").c_str()); | 3696 (std::string(function_name) + ": no program in use").c_str()); |
| 3702 return false; | 3697 return false; |
| 3703 } | 3698 } |
| 3704 if (!current_program_->IsValid()) { | 3699 if (!current_program_->InUse()) { |
| 3705 SetGLError(GL_INVALID_OPERATION, | 3700 SetGLError(GL_INVALID_OPERATION, |
| 3706 (std::string(function_name) + ": program not linked").c_str()); | 3701 (std::string(function_name) + ": program not linked").c_str()); |
| 3707 return false; | 3702 return false; |
| 3708 } | 3703 } |
| 3709 return true; | 3704 return true; |
| 3710 } | 3705 } |
| 3711 | 3706 |
| 3712 bool GLES2DecoderImpl::CheckCurrentProgramForUniform( | 3707 bool GLES2DecoderImpl::CheckCurrentProgramForUniform( |
| 3713 GLint location, const char* function_name) { | 3708 GLint location, const char* function_name) { |
| 3714 if (!CheckCurrentProgram(function_name)) { | 3709 if (!CheckCurrentProgram(function_name)) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3827 if (!info) { | 3822 if (!info) { |
| 3828 return; | 3823 return; |
| 3829 } | 3824 } |
| 3830 if (!info->IsValid()) { | 3825 if (!info->IsValid()) { |
| 3831 // Program was not linked successfully. (ie, glLinkProgram) | 3826 // Program was not linked successfully. (ie, glLinkProgram) |
| 3832 SetGLError(GL_INVALID_OPERATION, "glUseProgram: program not linked"); | 3827 SetGLError(GL_INVALID_OPERATION, "glUseProgram: program not linked"); |
| 3833 return; | 3828 return; |
| 3834 } | 3829 } |
| 3835 service_id = info->service_id(); | 3830 service_id = info->service_id(); |
| 3836 } | 3831 } |
| 3832 if (current_program_) { |
| 3833 program_manager()->UnuseProgram(shader_manager(), current_program_); |
| 3834 } |
| 3837 current_program_ = info; | 3835 current_program_ = info; |
| 3836 if (current_program_) { |
| 3837 program_manager()->UseProgram(current_program_); |
| 3838 } |
| 3838 glUseProgram(service_id); | 3839 glUseProgram(service_id); |
| 3839 } | 3840 } |
| 3840 | 3841 |
| 3841 GLenum GLES2DecoderImpl::GetGLError() { | 3842 GLenum GLES2DecoderImpl::GetGLError() { |
| 3842 // Check the GL error first, then our wrapped error. | 3843 // Check the GL error first, then our wrapped error. |
| 3843 GLenum error = glGetError(); | 3844 GLenum error = glGetError(); |
| 3844 if (error == GL_NO_ERROR && error_bits_ != 0) { | 3845 if (error == GL_NO_ERROR && error_bits_ != 0) { |
| 3845 for (uint32 mask = 1; mask != 0; mask = mask << 1) { | 3846 for (uint32 mask = 1; mask != 0; mask = mask << 1) { |
| 3846 if ((error_bits_ & mask) != 0) { | 3847 if ((error_bits_ & mask) != 0) { |
| 3847 error = GLES2Util::GLErrorBitToGLError(mask); | 3848 error = GLES2Util::GLErrorBitToGLError(mask); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3874 | 3875 |
| 3875 void GLES2DecoderImpl::ClearRealGLErrors() { | 3876 void GLES2DecoderImpl::ClearRealGLErrors() { |
| 3876 GLenum error; | 3877 GLenum error; |
| 3877 while ((error = glGetError()) != GL_NO_ERROR) { | 3878 while ((error = glGetError()) != GL_NO_ERROR) { |
| 3878 NOTREACHED() << "GL error " << error << " was unhandled."; | 3879 NOTREACHED() << "GL error " << error << " was unhandled."; |
| 3879 } | 3880 } |
| 3880 } | 3881 } |
| 3881 | 3882 |
| 3882 bool GLES2DecoderImpl::SetBlackTextureForNonRenderableTextures() { | 3883 bool GLES2DecoderImpl::SetBlackTextureForNonRenderableTextures() { |
| 3883 DCHECK(current_program_); | 3884 DCHECK(current_program_); |
| 3884 DCHECK(!current_program_->IsDeleted()); | |
| 3885 // Only check if there are some unrenderable textures. | 3885 // Only check if there are some unrenderable textures. |
| 3886 if (!texture_manager()->HaveUnrenderableTextures()) { | 3886 if (!texture_manager()->HaveUnrenderableTextures()) { |
| 3887 return false; | 3887 return false; |
| 3888 } | 3888 } |
| 3889 bool textures_set = false; | 3889 bool textures_set = false; |
| 3890 const ProgramManager::ProgramInfo::SamplerIndices& sampler_indices = | 3890 const ProgramManager::ProgramInfo::SamplerIndices& sampler_indices = |
| 3891 current_program_->sampler_indices(); | 3891 current_program_->sampler_indices(); |
| 3892 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { | 3892 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { |
| 3893 const ProgramManager::ProgramInfo::UniformInfo* uniform_info = | 3893 const ProgramManager::ProgramInfo::UniformInfo* uniform_info = |
| 3894 current_program_->GetUniformInfo(sampler_indices[ii]); | 3894 current_program_->GetUniformInfo(sampler_indices[ii]); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3911 } | 3911 } |
| 3912 } | 3912 } |
| 3913 // else: should this be an error? | 3913 // else: should this be an error? |
| 3914 } | 3914 } |
| 3915 } | 3915 } |
| 3916 return textures_set; | 3916 return textures_set; |
| 3917 } | 3917 } |
| 3918 | 3918 |
| 3919 void GLES2DecoderImpl::RestoreStateForNonRenderableTextures() { | 3919 void GLES2DecoderImpl::RestoreStateForNonRenderableTextures() { |
| 3920 DCHECK(current_program_); | 3920 DCHECK(current_program_); |
| 3921 DCHECK(!current_program_->IsDeleted()); | |
| 3922 const ProgramManager::ProgramInfo::SamplerIndices& sampler_indices = | 3921 const ProgramManager::ProgramInfo::SamplerIndices& sampler_indices = |
| 3923 current_program_->sampler_indices(); | 3922 current_program_->sampler_indices(); |
| 3924 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { | 3923 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { |
| 3925 const ProgramManager::ProgramInfo::UniformInfo* uniform_info = | 3924 const ProgramManager::ProgramInfo::UniformInfo* uniform_info = |
| 3926 current_program_->GetUniformInfo(sampler_indices[ii]); | 3925 current_program_->GetUniformInfo(sampler_indices[ii]); |
| 3927 DCHECK(uniform_info); | 3926 DCHECK(uniform_info); |
| 3928 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { | 3927 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { |
| 3929 GLuint texture_unit_index = uniform_info->texture_units[jj]; | 3928 GLuint texture_unit_index = uniform_info->texture_units[jj]; |
| 3930 if (texture_unit_index < group_->max_texture_units()) { | 3929 if (texture_unit_index < group_->max_texture_units()) { |
| 3931 TextureUnit& texture_unit = texture_units_[texture_unit_index]; | 3930 TextureUnit& texture_unit = texture_units_[texture_unit_index]; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3947 } | 3946 } |
| 3948 // Set the active texture back to whatever the user had it as. | 3947 // Set the active texture back to whatever the user had it as. |
| 3949 glActiveTexture(GL_TEXTURE0 + active_texture_unit_); | 3948 glActiveTexture(GL_TEXTURE0 + active_texture_unit_); |
| 3950 } | 3949 } |
| 3951 | 3950 |
| 3952 bool GLES2DecoderImpl::IsDrawValid(GLuint max_vertex_accessed) { | 3951 bool GLES2DecoderImpl::IsDrawValid(GLuint max_vertex_accessed) { |
| 3953 // NOTE: We specifically do not check current_program->IsValid() because | 3952 // NOTE: We specifically do not check current_program->IsValid() because |
| 3954 // it could never be invalid since glUseProgram would have failed. While | 3953 // it could never be invalid since glUseProgram would have failed. While |
| 3955 // glLinkProgram could later mark the program as invalid the previous | 3954 // glLinkProgram could later mark the program as invalid the previous |
| 3956 // valid program will still function if it is still the current program. | 3955 // valid program will still function if it is still the current program. |
| 3957 if (!current_program_ || current_program_->IsDeleted()) { | 3956 if (!current_program_) { |
| 3958 // The program does not exist. | 3957 // The program does not exist. |
| 3959 // But GL says no ERROR. | 3958 // But GL says no ERROR. |
| 3960 return false; | 3959 return false; |
| 3961 } | 3960 } |
| 3962 // Validate all attribs currently enabled. If they are used by the current | 3961 // Validate all attribs currently enabled. If they are used by the current |
| 3963 // program then check that they have enough elements to handle the draw call. | 3962 // program then check that they have enough elements to handle the draw call. |
| 3964 // If they are not used by the current program check that they have a buffer | 3963 // If they are not used by the current program check that they have a buffer |
| 3965 // assigned. | 3964 // assigned. |
| 3966 const VertexAttribManager::VertexAttribInfoList& infos = | 3965 const VertexAttribManager::VertexAttribInfoList& infos = |
| 3967 vertex_attrib_manager_.GetEnabledVertexAttribInfos(); | 3966 vertex_attrib_manager_.GetEnabledVertexAttribInfos(); |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4411 ProgramManager::ProgramInfo* program_info = GetProgramInfoNotShader( | 4410 ProgramManager::ProgramInfo* program_info = GetProgramInfoNotShader( |
| 4412 program_client_id, "glAttachShader"); | 4411 program_client_id, "glAttachShader"); |
| 4413 if (!program_info) { | 4412 if (!program_info) { |
| 4414 return; | 4413 return; |
| 4415 } | 4414 } |
| 4416 ShaderManager::ShaderInfo* shader_info = GetShaderInfoNotProgram( | 4415 ShaderManager::ShaderInfo* shader_info = GetShaderInfoNotProgram( |
| 4417 shader_client_id, "glAttachShader"); | 4416 shader_client_id, "glAttachShader"); |
| 4418 if (!shader_info) { | 4417 if (!shader_info) { |
| 4419 return; | 4418 return; |
| 4420 } | 4419 } |
| 4421 if (!program_info->AttachShader(shader_info)) { | 4420 if (!program_info->AttachShader(shader_manager(), shader_info)) { |
| 4422 SetGLError(GL_INVALID_OPERATION, | 4421 SetGLError(GL_INVALID_OPERATION, |
| 4423 "glAttachShader: can not attach more than" | 4422 "glAttachShader: can not attach more than" |
| 4424 " one shader of the same type."); | 4423 " one shader of the same type."); |
| 4425 return; | 4424 return; |
| 4426 } | 4425 } |
| 4427 glAttachShader(program_info->service_id(), shader_info->service_id()); | 4426 glAttachShader(program_info->service_id(), shader_info->service_id()); |
| 4428 } | 4427 } |
| 4429 | 4428 |
| 4430 void GLES2DecoderImpl::DoDetachShader( | 4429 void GLES2DecoderImpl::DoDetachShader( |
| 4431 GLuint program_client_id, GLint shader_client_id) { | 4430 GLuint program_client_id, GLint shader_client_id) { |
| 4432 ProgramManager::ProgramInfo* program_info = GetProgramInfoNotShader( | 4431 ProgramManager::ProgramInfo* program_info = GetProgramInfoNotShader( |
| 4433 program_client_id, "glDetachShader"); | 4432 program_client_id, "glDetachShader"); |
| 4434 if (!program_info) { | 4433 if (!program_info) { |
| 4435 return; | 4434 return; |
| 4436 } | 4435 } |
| 4437 ShaderManager::ShaderInfo* shader_info = GetShaderInfoNotProgram( | 4436 ShaderManager::ShaderInfo* shader_info = GetShaderInfoNotProgram( |
| 4438 shader_client_id, "glDetachShader"); | 4437 shader_client_id, "glDetachShader"); |
| 4439 if (!shader_info) { | 4438 if (!shader_info) { |
| 4440 return; | 4439 return; |
| 4441 } | 4440 } |
| 4442 program_info->DetachShader(shader_info); | |
| 4443 glDetachShader(program_info->service_id(), shader_info->service_id()); | 4441 glDetachShader(program_info->service_id(), shader_info->service_id()); |
| 4442 program_info->DetachShader(shader_manager(), shader_info); |
| 4444 } | 4443 } |
| 4445 | 4444 |
| 4446 void GLES2DecoderImpl::DoValidateProgram(GLuint program_client_id) { | 4445 void GLES2DecoderImpl::DoValidateProgram(GLuint program_client_id) { |
| 4447 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( | 4446 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( |
| 4448 program_client_id, "glValidateProgram"); | 4447 program_client_id, "glValidateProgram"); |
| 4449 if (!info) { | 4448 if (!info) { |
| 4450 return; | 4449 return; |
| 4451 } | 4450 } |
| 4452 if (!info->CanLink()) { | 4451 if (!info->CanLink()) { |
| 4453 info->set_log_info("Missing Shader"); | 4452 info->set_log_info("Missing Shader"); |
| (...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5995 return error::kNoError; | 5994 return error::kNoError; |
| 5996 } | 5995 } |
| 5997 | 5996 |
| 5998 // Include the auto-generated part of this file. We split this because it means | 5997 // Include the auto-generated part of this file. We split this because it means |
| 5999 // we can easily edit the non-auto generated parts right here in this file | 5998 // we can easily edit the non-auto generated parts right here in this file |
| 6000 // instead of having to edit some template or the code generator. | 5999 // instead of having to edit some template or the code generator. |
| 6001 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 6000 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 6002 | 6001 |
| 6003 } // namespace gles2 | 6002 } // namespace gles2 |
| 6004 } // namespace gpu | 6003 } // namespace gpu |
| OLD | NEW |