Chromium Code Reviews| 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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1355 void LogMessage(const std::string& msg); | 1355 void LogMessage(const std::string& msg); |
| 1356 void RenderWarning(const std::string& msg); | 1356 void RenderWarning(const std::string& msg); |
| 1357 void PerformanceWarning(const std::string& msg); | 1357 void PerformanceWarning(const std::string& msg); |
| 1358 | 1358 |
| 1359 bool ShouldDeferDraws() { | 1359 bool ShouldDeferDraws() { |
| 1360 return !offscreen_target_frame_buffer_.get() && | 1360 return !offscreen_target_frame_buffer_.get() && |
| 1361 bound_draw_framebuffer_ == NULL && | 1361 bound_draw_framebuffer_ == NULL && |
| 1362 surface_->DeferDraws(); | 1362 surface_->DeferDraws(); |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 void ForceCompileShaderIfPending(ShaderManager::ShaderInfo* info); | |
| 1366 | |
| 1365 // Generate a member function prototype for each command in an automated and | 1367 // Generate a member function prototype for each command in an automated and |
| 1366 // typesafe way. | 1368 // typesafe way. |
| 1367 #define GLES2_CMD_OP(name) \ | 1369 #define GLES2_CMD_OP(name) \ |
| 1368 Error Handle ## name( \ | 1370 Error Handle ## name( \ |
| 1369 uint32 immediate_data_size, \ | 1371 uint32 immediate_data_size, \ |
| 1370 const gles2::name& args); \ | 1372 const gles2::name& args); \ |
| 1371 | 1373 |
| 1372 GLES2_COMMAND_LIST(GLES2_CMD_OP) | 1374 GLES2_COMMAND_LIST(GLES2_CMD_OP) |
| 1373 | 1375 |
| 1374 #undef GLES2_CMD_OP | 1376 #undef GLES2_CMD_OP |
| (...skipping 3744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5119 } | 5121 } |
| 5120 | 5122 |
| 5121 void GLES2DecoderImpl::RenderWarning(const std::string& msg) { | 5123 void GLES2DecoderImpl::RenderWarning(const std::string& msg) { |
| 5122 LogMessage(std::string("RENDER WARNING: ") + msg); | 5124 LogMessage(std::string("RENDER WARNING: ") + msg); |
| 5123 } | 5125 } |
| 5124 | 5126 |
| 5125 void GLES2DecoderImpl::PerformanceWarning(const std::string& msg) { | 5127 void GLES2DecoderImpl::PerformanceWarning(const std::string& msg) { |
| 5126 LogMessage(std::string("PERFORMANCE WARNING: ") + msg); | 5128 LogMessage(std::string("PERFORMANCE WARNING: ") + msg); |
| 5127 } | 5129 } |
| 5128 | 5130 |
| 5131 void GLES2DecoderImpl::ForceCompileShaderIfPending( | |
| 5132 ShaderManager::ShaderInfo* info) { | |
| 5133 if (info->compilation_status() == | |
| 5134 ShaderManager::ShaderInfo::PENDING_DEFERRED_COMPILE) { | |
| 5135 | |
| 5136 ShaderTranslator* translator = NULL; | |
| 5137 if (use_shader_translator_) { | |
| 5138 translator = info->shader_type() == GL_VERTEX_SHADER ? | |
| 5139 vertex_translator_.get() : fragment_translator_.get(); | |
| 5140 } | |
| 5141 // We know there will be know errors, because we only defer compilation on | |
|
greggman
2012/07/23 22:13:03
s/know errors/no errors/
dmurph
2012/07/23 22:18:58
Done.
| |
| 5142 // shaders that were previously compiled successfully. | |
| 5143 program_manager()->ForceCompileShader(info->deferred_compilation_source(), | |
| 5144 info, | |
| 5145 translator, | |
| 5146 feature_info_); | |
| 5147 } | |
| 5148 } | |
| 5149 | |
| 5129 void GLES2DecoderImpl::CopyRealGLErrorsToWrapper() { | 5150 void GLES2DecoderImpl::CopyRealGLErrorsToWrapper() { |
| 5130 GLenum error; | 5151 GLenum error; |
| 5131 while ((error = glGetError()) != GL_NO_ERROR) { | 5152 while ((error = glGetError()) != GL_NO_ERROR) { |
| 5132 SetGLError(error, "", NULL); | 5153 SetGLError(error, "", NULL); |
| 5133 } | 5154 } |
| 5134 } | 5155 } |
| 5135 | 5156 |
| 5136 void GLES2DecoderImpl::ClearRealGLErrors() { | 5157 void GLES2DecoderImpl::ClearRealGLErrors() { |
| 5137 GLenum error; | 5158 GLenum error; |
| 5138 while ((error = glGetError()) != GL_NO_ERROR) { | 5159 while ((error = glGetError()) != GL_NO_ERROR) { |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5836 case GL_SHADER_SOURCE_LENGTH: | 5857 case GL_SHADER_SOURCE_LENGTH: |
| 5837 *params = info->source() ? info->source()->size() + 1 : 0; | 5858 *params = info->source() ? info->source()->size() + 1 : 0; |
| 5838 return; | 5859 return; |
| 5839 case GL_COMPILE_STATUS: | 5860 case GL_COMPILE_STATUS: |
| 5840 *params = compile_shader_always_succeeds_ ? true : info->IsValid(); | 5861 *params = compile_shader_always_succeeds_ ? true : info->IsValid(); |
| 5841 return; | 5862 return; |
| 5842 case GL_INFO_LOG_LENGTH: | 5863 case GL_INFO_LOG_LENGTH: |
| 5843 *params = info->log_info() ? info->log_info()->size() + 1 : 0; | 5864 *params = info->log_info() ? info->log_info()->size() + 1 : 0; |
| 5844 return; | 5865 return; |
| 5845 case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: | 5866 case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: |
| 5867 ForceCompileShaderIfPending(info); | |
| 5846 *params = info->translated_source() ? | 5868 *params = info->translated_source() ? |
| 5847 info->translated_source()->size() + 1 : 0; | 5869 info->translated_source()->size() + 1 : 0; |
| 5848 return; | 5870 return; |
| 5849 default: | 5871 default: |
| 5850 break; | 5872 break; |
| 5851 } | 5873 } |
| 5852 glGetShaderiv(info->service_id(), pname, params); | 5874 glGetShaderiv(info->service_id(), pname, params); |
| 5853 } | 5875 } |
| 5854 | 5876 |
| 5855 error::Error GLES2DecoderImpl::HandleGetShaderSource( | 5877 error::Error GLES2DecoderImpl::HandleGetShaderSource( |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 5873 GLuint shader = c.shader; | 5895 GLuint shader = c.shader; |
| 5874 | 5896 |
| 5875 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 5897 uint32 bucket_id = static_cast<uint32>(c.bucket_id); |
| 5876 Bucket* bucket = CreateBucket(bucket_id); | 5898 Bucket* bucket = CreateBucket(bucket_id); |
| 5877 ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram( | 5899 ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram( |
| 5878 shader, "glTranslatedGetShaderSourceANGLE"); | 5900 shader, "glTranslatedGetShaderSourceANGLE"); |
| 5879 if (!info) { | 5901 if (!info) { |
| 5880 bucket->SetSize(0); | 5902 bucket->SetSize(0); |
| 5881 return error::kNoError; | 5903 return error::kNoError; |
| 5882 } | 5904 } |
| 5905 ForceCompileShaderIfPending(info); | |
| 5883 | 5906 |
| 5884 bucket->SetFromString(info->translated_source() ? | 5907 bucket->SetFromString(info->translated_source() ? |
| 5885 info->translated_source()->c_str() : NULL); | 5908 info->translated_source()->c_str() : NULL); |
| 5886 return error::kNoError; | 5909 return error::kNoError; |
| 5887 } | 5910 } |
| 5888 | 5911 |
| 5889 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( | 5912 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( |
| 5890 uint32 immediate_data_size, const gles2::GetProgramInfoLog& c) { | 5913 uint32 immediate_data_size, const gles2::GetProgramInfoLog& c) { |
| 5891 GLuint program = c.program; | 5914 GLuint program = c.program; |
| 5892 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 5915 uint32 bucket_id = static_cast<uint32>(c.bucket_id); |
| (...skipping 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9151 BindAndApplyTextureParameters(info); | 9174 BindAndApplyTextureParameters(info); |
| 9152 } | 9175 } |
| 9153 | 9176 |
| 9154 // Include the auto-generated part of this file. We split this because it means | 9177 // Include the auto-generated part of this file. We split this because it means |
| 9155 // we can easily edit the non-auto generated parts right here in this file | 9178 // we can easily edit the non-auto generated parts right here in this file |
| 9156 // instead of having to edit some template or the code generator. | 9179 // instead of having to edit some template or the code generator. |
| 9157 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9180 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 9158 | 9181 |
| 9159 } // namespace gles2 | 9182 } // namespace gles2 |
| 9160 } // namespace gpu | 9183 } // namespace gpu |
| OLD | NEW |