OLD | NEW |
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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 4444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4455 } | 4455 } |
4456 | 4456 |
4457 void GLES2DecoderImpl::DoLinkProgram(GLuint program) { | 4457 void GLES2DecoderImpl::DoLinkProgram(GLuint program) { |
4458 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoLinkProgram"); | 4458 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoLinkProgram"); |
4459 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( | 4459 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( |
4460 program, "glLinkProgram"); | 4460 program, "glLinkProgram"); |
4461 if (!info) { | 4461 if (!info) { |
4462 return; | 4462 return; |
4463 } | 4463 } |
4464 | 4464 |
4465 info->Link(); | 4465 if (info->Link()) { |
| 4466 if (info == current_program_.get()) { |
| 4467 program_manager()->ClearUniforms(info); |
| 4468 } |
| 4469 } |
4466 }; | 4470 }; |
4467 | 4471 |
4468 void GLES2DecoderImpl::DoTexParameterf( | 4472 void GLES2DecoderImpl::DoTexParameterf( |
4469 GLenum target, GLenum pname, GLfloat param) { | 4473 GLenum target, GLenum pname, GLfloat param) { |
4470 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 4474 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
4471 if (!info) { | 4475 if (!info) { |
4472 SetGLError(GL_INVALID_VALUE, "glTexParameterf: unknown texture"); | 4476 SetGLError(GL_INVALID_VALUE, "glTexParameterf: unknown texture"); |
4473 return; | 4477 return; |
4474 } | 4478 } |
4475 | 4479 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4769 // Program was not linked successfully. (ie, glLinkProgram) | 4773 // Program was not linked successfully. (ie, glLinkProgram) |
4770 SetGLError(GL_INVALID_OPERATION, "glUseProgram: program not linked"); | 4774 SetGLError(GL_INVALID_OPERATION, "glUseProgram: program not linked"); |
4771 return; | 4775 return; |
4772 } | 4776 } |
4773 service_id = info->service_id(); | 4777 service_id = info->service_id(); |
4774 } | 4778 } |
4775 if (current_program_) { | 4779 if (current_program_) { |
4776 program_manager()->UnuseProgram(shader_manager(), current_program_); | 4780 program_manager()->UnuseProgram(shader_manager(), current_program_); |
4777 } | 4781 } |
4778 current_program_ = info; | 4782 current_program_ = info; |
| 4783 glUseProgram(service_id); |
4779 if (current_program_) { | 4784 if (current_program_) { |
4780 program_manager()->UseProgram(current_program_); | 4785 program_manager()->UseProgram(current_program_); |
4781 } | 4786 } |
4782 glUseProgram(service_id); | |
4783 } | 4787 } |
4784 | 4788 |
4785 GLenum GLES2DecoderImpl::GetGLError() { | 4789 GLenum GLES2DecoderImpl::GetGLError() { |
4786 // Check the GL error first, then our wrapped error. | 4790 // Check the GL error first, then our wrapped error. |
4787 GLenum error = glGetError(); | 4791 GLenum error = glGetError(); |
4788 if (error == GL_NO_ERROR && error_bits_ != 0) { | 4792 if (error == GL_NO_ERROR && error_bits_ != 0) { |
4789 for (uint32 mask = 1; mask != 0; mask = mask << 1) { | 4793 for (uint32 mask = 1; mask != 0; mask = mask << 1) { |
4790 if ((error_bits_ & mask) != 0) { | 4794 if ((error_bits_ & mask) != 0) { |
4791 error = GLES2Util::GLErrorBitToGLError(mask); | 4795 error = GLES2Util::GLErrorBitToGLError(mask); |
4792 break; | 4796 break; |
(...skipping 3710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8503 } | 8507 } |
8504 } | 8508 } |
8505 | 8509 |
8506 // Include the auto-generated part of this file. We split this because it means | 8510 // Include the auto-generated part of this file. We split this because it means |
8507 // we can easily edit the non-auto generated parts right here in this file | 8511 // we can easily edit the non-auto generated parts right here in this file |
8508 // instead of having to edit some template or the code generator. | 8512 // instead of having to edit some template or the code generator. |
8509 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 8513 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
8510 | 8514 |
8511 } // namespace gles2 | 8515 } // namespace gles2 |
8512 } // namespace gpu | 8516 } // namespace gpu |
OLD | NEW |