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

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

Issue 10812002: Bug fixes for getTranslatedShader (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: last fixes Created 8 years, 5 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/program_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 void LogMessage(const std::string& msg); 1354 void LogMessage(const std::string& msg);
1355 void RenderWarning(const std::string& msg); 1355 void RenderWarning(const std::string& msg);
1356 void PerformanceWarning(const std::string& msg); 1356 void PerformanceWarning(const std::string& msg);
1357 1357
1358 bool ShouldDeferDraws() { 1358 bool ShouldDeferDraws() {
1359 return !offscreen_target_frame_buffer_.get() && 1359 return !offscreen_target_frame_buffer_.get() &&
1360 bound_draw_framebuffer_ == NULL && 1360 bound_draw_framebuffer_ == NULL &&
1361 surface_->DeferDraws(); 1361 surface_->DeferDraws();
1362 } 1362 }
1363 1363
1364 void ForceCompileShaderIfPending(ShaderManager::ShaderInfo* info);
1365
1364 // Generate a member function prototype for each command in an automated and 1366 // Generate a member function prototype for each command in an automated and
1365 // typesafe way. 1367 // typesafe way.
1366 #define GLES2_CMD_OP(name) \ 1368 #define GLES2_CMD_OP(name) \
1367 Error Handle ## name( \ 1369 Error Handle ## name( \
1368 uint32 immediate_data_size, \ 1370 uint32 immediate_data_size, \
1369 const gles2::name& args); \ 1371 const gles2::name& args); \
1370 1372
1371 GLES2_COMMAND_LIST(GLES2_CMD_OP) 1373 GLES2_COMMAND_LIST(GLES2_CMD_OP)
1372 1374
1373 #undef GLES2_CMD_OP 1375 #undef GLES2_CMD_OP
(...skipping 3744 matching lines...) Expand 10 before | Expand all | Expand 10 after
5118 } 5120 }
5119 5121
5120 void GLES2DecoderImpl::RenderWarning(const std::string& msg) { 5122 void GLES2DecoderImpl::RenderWarning(const std::string& msg) {
5121 LogMessage(std::string("RENDER WARNING: ") + msg); 5123 LogMessage(std::string("RENDER WARNING: ") + msg);
5122 } 5124 }
5123 5125
5124 void GLES2DecoderImpl::PerformanceWarning(const std::string& msg) { 5126 void GLES2DecoderImpl::PerformanceWarning(const std::string& msg) {
5125 LogMessage(std::string("PERFORMANCE WARNING: ") + msg); 5127 LogMessage(std::string("PERFORMANCE WARNING: ") + msg);
5126 } 5128 }
5127 5129
5130 void GLES2DecoderImpl::ForceCompileShaderIfPending(
5131 ShaderManager::ShaderInfo* info) {
5132 if (info->compilation_status() ==
5133 ShaderManager::ShaderInfo::PENDING_DEFERRED_COMPILE) {
5134
5135 ShaderTranslator* translator = NULL;
5136 if (use_shader_translator_) {
5137 translator = info->shader_type() == GL_VERTEX_SHADER ?
5138 vertex_translator_.get() : fragment_translator_.get();
5139 }
5140 // We know there will be no errors, because we only defer compilation on
5141 // shaders that were previously compiled successfully.
5142 program_manager()->ForceCompileShader(info->deferred_compilation_source(),
5143 info,
5144 translator,
5145 feature_info_);
5146 }
5147 }
5148
5128 void GLES2DecoderImpl::CopyRealGLErrorsToWrapper() { 5149 void GLES2DecoderImpl::CopyRealGLErrorsToWrapper() {
5129 GLenum error; 5150 GLenum error;
5130 while ((error = glGetError()) != GL_NO_ERROR) { 5151 while ((error = glGetError()) != GL_NO_ERROR) {
5131 SetGLError(error, "", NULL); 5152 SetGLError(error, "", NULL);
5132 } 5153 }
5133 } 5154 }
5134 5155
5135 void GLES2DecoderImpl::ClearRealGLErrors() { 5156 void GLES2DecoderImpl::ClearRealGLErrors() {
5136 GLenum error; 5157 GLenum error;
5137 while ((error = glGetError()) != GL_NO_ERROR) { 5158 while ((error = glGetError()) != GL_NO_ERROR) {
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
5841 case GL_SHADER_SOURCE_LENGTH: 5862 case GL_SHADER_SOURCE_LENGTH:
5842 *params = info->source() ? info->source()->size() + 1 : 0; 5863 *params = info->source() ? info->source()->size() + 1 : 0;
5843 return; 5864 return;
5844 case GL_COMPILE_STATUS: 5865 case GL_COMPILE_STATUS:
5845 *params = compile_shader_always_succeeds_ ? true : info->IsValid(); 5866 *params = compile_shader_always_succeeds_ ? true : info->IsValid();
5846 return; 5867 return;
5847 case GL_INFO_LOG_LENGTH: 5868 case GL_INFO_LOG_LENGTH:
5848 *params = info->log_info() ? info->log_info()->size() + 1 : 0; 5869 *params = info->log_info() ? info->log_info()->size() + 1 : 0;
5849 return; 5870 return;
5850 case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: 5871 case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE:
5872 ForceCompileShaderIfPending(info);
5851 *params = info->translated_source() ? 5873 *params = info->translated_source() ?
5852 info->translated_source()->size() + 1 : 0; 5874 info->translated_source()->size() + 1 : 0;
5853 return; 5875 return;
5854 default: 5876 default:
5855 break; 5877 break;
5856 } 5878 }
5857 glGetShaderiv(info->service_id(), pname, params); 5879 glGetShaderiv(info->service_id(), pname, params);
5858 } 5880 }
5859 5881
5860 error::Error GLES2DecoderImpl::HandleGetShaderSource( 5882 error::Error GLES2DecoderImpl::HandleGetShaderSource(
(...skipping 17 matching lines...) Expand all
5878 GLuint shader = c.shader; 5900 GLuint shader = c.shader;
5879 5901
5880 uint32 bucket_id = static_cast<uint32>(c.bucket_id); 5902 uint32 bucket_id = static_cast<uint32>(c.bucket_id);
5881 Bucket* bucket = CreateBucket(bucket_id); 5903 Bucket* bucket = CreateBucket(bucket_id);
5882 ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram( 5904 ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram(
5883 shader, "glTranslatedGetShaderSourceANGLE"); 5905 shader, "glTranslatedGetShaderSourceANGLE");
5884 if (!info) { 5906 if (!info) {
5885 bucket->SetSize(0); 5907 bucket->SetSize(0);
5886 return error::kNoError; 5908 return error::kNoError;
5887 } 5909 }
5910 ForceCompileShaderIfPending(info);
5888 5911
5889 bucket->SetFromString(info->translated_source() ? 5912 bucket->SetFromString(info->translated_source() ?
5890 info->translated_source()->c_str() : NULL); 5913 info->translated_source()->c_str() : NULL);
5891 return error::kNoError; 5914 return error::kNoError;
5892 } 5915 }
5893 5916
5894 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( 5917 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog(
5895 uint32 immediate_data_size, const gles2::GetProgramInfoLog& c) { 5918 uint32 immediate_data_size, const gles2::GetProgramInfoLog& c) {
5896 GLuint program = c.program; 5919 GLuint program = c.program;
5897 uint32 bucket_id = static_cast<uint32>(c.bucket_id); 5920 uint32 bucket_id = static_cast<uint32>(c.bucket_id);
(...skipping 3263 matching lines...) Expand 10 before | Expand all | Expand 10 after
9161 BindAndApplyTextureParameters(info); 9184 BindAndApplyTextureParameters(info);
9162 } 9185 }
9163 9186
9164 // Include the auto-generated part of this file. We split this because it means 9187 // Include the auto-generated part of this file. We split this because it means
9165 // we can easily edit the non-auto generated parts right here in this file 9188 // we can easily edit the non-auto generated parts right here in this file
9166 // instead of having to edit some template or the code generator. 9189 // instead of having to edit some template or the code generator.
9167 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 9190 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
9168 9191
9169 } // namespace gles2 9192 } // namespace gles2
9170 } // namespace gpu 9193 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/program_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698