| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 GLenum error, const char* function_name, const char* msg); | 507 GLenum error, const char* function_name, const char* msg); |
| 508 virtual void SetResizeCallback( | 508 virtual void SetResizeCallback( |
| 509 const base::Callback<void(gfx::Size)>& callback); | 509 const base::Callback<void(gfx::Size)>& callback); |
| 510 | 510 |
| 511 virtual void SetMsgCallback(const MsgCallback& callback); | 511 virtual void SetMsgCallback(const MsgCallback& callback); |
| 512 | 512 |
| 513 virtual void SetStreamTextureManager(StreamTextureManager* manager); | 513 virtual void SetStreamTextureManager(StreamTextureManager* manager); |
| 514 virtual bool GetServiceTextureId(uint32 client_texture_id, | 514 virtual bool GetServiceTextureId(uint32 client_texture_id, |
| 515 uint32* service_texture_id); | 515 uint32* service_texture_id); |
| 516 | 516 |
| 517 virtual uint32 GetGLError() OVERRIDE; |
| 518 |
| 517 // Restores the current state to the user's settings. | 519 // Restores the current state to the user's settings. |
| 518 void RestoreCurrentFramebufferBindings(); | 520 void RestoreCurrentFramebufferBindings(); |
| 519 void RestoreCurrentRenderbufferBindings(); | 521 void RestoreCurrentRenderbufferBindings(); |
| 520 void RestoreCurrentTexture2DBindings(); | 522 void RestoreCurrentTexture2DBindings(); |
| 521 | 523 |
| 522 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. | 524 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. |
| 523 void ApplyDirtyState(); | 525 void ApplyDirtyState(); |
| 524 | 526 |
| 525 // Reapply the texture parameters to the given texture. | 527 // Reapply the texture parameters to the given texture. |
| 526 void BindAndApplyTextureParameters(TextureManager::TextureInfo* info); | 528 void BindAndApplyTextureParameters(TextureManager::TextureInfo* info); |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 // Wrapper for glUseProgram | 1171 // Wrapper for glUseProgram |
| 1170 void DoUseProgram(GLuint program); | 1172 void DoUseProgram(GLuint program); |
| 1171 | 1173 |
| 1172 // Wrapper for glValidateProgram. | 1174 // Wrapper for glValidateProgram. |
| 1173 void DoValidateProgram(GLuint program_client_id); | 1175 void DoValidateProgram(GLuint program_client_id); |
| 1174 | 1176 |
| 1175 // Gets the number of values that will be returned by glGetXXX. Returns | 1177 // Gets the number of values that will be returned by glGetXXX. Returns |
| 1176 // false if pname is unknown. | 1178 // false if pname is unknown. |
| 1177 bool GetNumValuesReturnedForGLGet(GLenum pname, GLsizei* num_values); | 1179 bool GetNumValuesReturnedForGLGet(GLenum pname, GLsizei* num_values); |
| 1178 | 1180 |
| 1179 // Gets the GLError through our wrapper. | |
| 1180 GLenum GetGLError(); | |
| 1181 | |
| 1182 // Gets the GLError and stores it in our wrapper. Effectively | 1181 // Gets the GLError and stores it in our wrapper. Effectively |
| 1183 // this lets us peek at the error without losing it. | 1182 // this lets us peek at the error without losing it. |
| 1184 GLenum PeekGLError(); | 1183 GLenum PeekGLError(); |
| 1185 | 1184 |
| 1186 // Copies the real GL errors to the wrapper. This is so we can | 1185 // Copies the real GL errors to the wrapper. This is so we can |
| 1187 // make sure there are no native GL errors before calling some GL function | 1186 // make sure there are no native GL errors before calling some GL function |
| 1188 // so that on return we know any error generated was for that specific | 1187 // so that on return we know any error generated was for that specific |
| 1189 // command. | 1188 // command. |
| 1190 void CopyRealGLErrorsToWrapper(); | 1189 void CopyRealGLErrorsToWrapper(); |
| 1191 | 1190 |
| (...skipping 3842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5034 if (current_program_) { | 5033 if (current_program_) { |
| 5035 program_manager()->UnuseProgram(shader_manager(), current_program_); | 5034 program_manager()->UnuseProgram(shader_manager(), current_program_); |
| 5036 } | 5035 } |
| 5037 current_program_ = info; | 5036 current_program_ = info; |
| 5038 glUseProgram(service_id); | 5037 glUseProgram(service_id); |
| 5039 if (current_program_) { | 5038 if (current_program_) { |
| 5040 program_manager()->UseProgram(current_program_); | 5039 program_manager()->UseProgram(current_program_); |
| 5041 } | 5040 } |
| 5042 } | 5041 } |
| 5043 | 5042 |
| 5044 GLenum GLES2DecoderImpl::GetGLError() { | 5043 uint32 GLES2DecoderImpl::GetGLError() { |
| 5045 // Check the GL error first, then our wrapped error. | 5044 // Check the GL error first, then our wrapped error. |
| 5046 GLenum error = glGetError(); | 5045 GLenum error = glGetError(); |
| 5047 if (error == GL_NO_ERROR && error_bits_ != 0) { | 5046 if (error == GL_NO_ERROR && error_bits_ != 0) { |
| 5048 for (uint32 mask = 1; mask != 0; mask = mask << 1) { | 5047 for (uint32 mask = 1; mask != 0; mask = mask << 1) { |
| 5049 if ((error_bits_ & mask) != 0) { | 5048 if ((error_bits_ & mask) != 0) { |
| 5050 error = GLES2Util::GLErrorBitToGLError(mask); | 5049 error = GLES2Util::GLErrorBitToGLError(mask); |
| 5051 break; | 5050 break; |
| 5052 } | 5051 } |
| 5053 } | 5052 } |
| 5054 } | 5053 } |
| (...skipping 4129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9184 BindAndApplyTextureParameters(info); | 9183 BindAndApplyTextureParameters(info); |
| 9185 } | 9184 } |
| 9186 | 9185 |
| 9187 // Include the auto-generated part of this file. We split this because it means | 9186 // Include the auto-generated part of this file. We split this because it means |
| 9188 // we can easily edit the non-auto generated parts right here in this file | 9187 // we can easily edit the non-auto generated parts right here in this file |
| 9189 // instead of having to edit some template or the code generator. | 9188 // instead of having to edit some template or the code generator. |
| 9190 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9189 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 9191 | 9190 |
| 9192 } // namespace gles2 | 9191 } // namespace gles2 |
| 9193 } // namespace gpu | 9192 } // namespace gpu |
| OLD | NEW |