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 <cmath> | 10 #include <cmath> |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1263 // Creates a vertex attrib manager for the given vertex array. | 1263 // Creates a vertex attrib manager for the given vertex array. |
1264 scoped_refptr<VertexAttribManager> CreateVertexAttribManager( | 1264 scoped_refptr<VertexAttribManager> CreateVertexAttribManager( |
1265 GLuint client_id, | 1265 GLuint client_id, |
1266 GLuint service_id, | 1266 GLuint service_id, |
1267 bool client_visible) { | 1267 bool client_visible) { |
1268 return vertex_array_manager()->CreateVertexAttribManager( | 1268 return vertex_array_manager()->CreateVertexAttribManager( |
1269 client_id, service_id, group_->max_vertex_attribs(), client_visible); | 1269 client_id, service_id, group_->max_vertex_attribs(), client_visible); |
1270 } | 1270 } |
1271 | 1271 |
1272 void DoBindAttribLocation(GLuint client_id, GLuint index, const char* name); | 1272 void DoBindAttribLocation(GLuint client_id, GLuint index, const char* name); |
1273 | |
1274 error::Error DoBindFragDataLocation(GLuint program_id, | |
1275 GLuint colorName, | |
1276 const char* name); | |
1277 | |
1278 error::Error DoBindFragDataLocationIndexed(GLuint program_id, | |
1279 GLuint colorName, | |
1280 GLuint index, | |
1281 const char* name); | |
1282 | |
1273 void DoBindUniformLocationCHROMIUM( | 1283 void DoBindUniformLocationCHROMIUM( |
1274 GLuint client_id, GLint location, const char* name); | 1284 GLuint client_id, GLint location, const char* name); |
1275 | 1285 |
1276 error::Error GetAttribLocationHelper( | 1286 error::Error GetAttribLocationHelper( |
1277 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 1287 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, |
1278 const std::string& name_str); | 1288 const std::string& name_str); |
1279 | 1289 |
1280 error::Error GetUniformLocationHelper( | 1290 error::Error GetUniformLocationHelper( |
1281 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 1291 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, |
1282 const std::string& name_str); | 1292 const std::string& name_str); |
1283 | 1293 |
1284 error::Error GetFragDataLocationHelper( | 1294 error::Error GetFragDataLocationHelper( |
1285 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 1295 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, |
1286 const std::string& name_str); | 1296 const std::string& name_str); |
1287 | 1297 |
1298 error::Error GetFragDataIndexHelper(GLuint program_id, | |
1299 uint32 index_shm_id, | |
1300 uint32 index_shm_offset, | |
1301 const std::string& name_str); | |
1302 | |
1288 // Wrapper for glShaderSource. | 1303 // Wrapper for glShaderSource. |
1289 void DoShaderSource( | 1304 void DoShaderSource( |
1290 GLuint client_id, GLsizei count, const char** data, const GLint* length); | 1305 GLuint client_id, GLsizei count, const char** data, const GLint* length); |
1291 | 1306 |
1292 // Wrapper for glTransformFeedbackVaryings. | 1307 // Wrapper for glTransformFeedbackVaryings. |
1293 void DoTransformFeedbackVaryings( | 1308 void DoTransformFeedbackVaryings( |
1294 GLuint client_program_id, GLsizei count, const char* const* varyings, | 1309 GLuint client_program_id, GLsizei count, const char* const* varyings, |
1295 GLenum buffer_mode); | 1310 GLenum buffer_mode); |
1296 | 1311 |
1297 // Clear any textures used by the current program. | 1312 // Clear any textures used by the current program. |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3240 resources.MaxVaryingVectors = group_->max_varying_vectors(); | 3255 resources.MaxVaryingVectors = group_->max_varying_vectors(); |
3241 resources.MaxVertexTextureImageUnits = | 3256 resources.MaxVertexTextureImageUnits = |
3242 group_->max_vertex_texture_image_units(); | 3257 group_->max_vertex_texture_image_units(); |
3243 resources.MaxCombinedTextureImageUnits = group_->max_texture_units(); | 3258 resources.MaxCombinedTextureImageUnits = group_->max_texture_units(); |
3244 resources.MaxTextureImageUnits = group_->max_texture_image_units(); | 3259 resources.MaxTextureImageUnits = group_->max_texture_image_units(); |
3245 resources.MaxFragmentUniformVectors = | 3260 resources.MaxFragmentUniformVectors = |
3246 group_->max_fragment_uniform_vectors(); | 3261 group_->max_fragment_uniform_vectors(); |
3247 resources.MaxDrawBuffers = group_->max_draw_buffers(); | 3262 resources.MaxDrawBuffers = group_->max_draw_buffers(); |
3248 resources.MaxExpressionComplexity = 256; | 3263 resources.MaxExpressionComplexity = 256; |
3249 resources.MaxCallStackDepth = 256; | 3264 resources.MaxCallStackDepth = 256; |
3265 resources.MaxDualSourceDrawBuffers = group_->max_dual_source_draw_buffers(); | |
3250 | 3266 |
3251 GLint range[2] = { 0, 0 }; | 3267 GLint range[2] = { 0, 0 }; |
3252 GLint precision = 0; | 3268 GLint precision = 0; |
3253 GetShaderPrecisionFormatImpl(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT, | 3269 GetShaderPrecisionFormatImpl(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT, |
3254 range, &precision); | 3270 range, &precision); |
3255 resources.FragmentPrecisionHigh = | 3271 resources.FragmentPrecisionHigh = |
3256 PrecisionMeetsSpecForHighpFloat(range[0], range[1], precision); | 3272 PrecisionMeetsSpecForHighpFloat(range[0], range[1], precision); |
3257 | 3273 |
3258 if (IsWebGLContext()) { | 3274 if (IsWebGLContext()) { |
3259 resources.OES_standard_derivatives = derivatives_explicitly_enabled_; | 3275 resources.OES_standard_derivatives = derivatives_explicitly_enabled_; |
(...skipping 12 matching lines...) Expand all Loading... | |
3272 resources.OES_EGL_image_external = | 3288 resources.OES_EGL_image_external = |
3273 features().oes_egl_image_external ? 1 : 0; | 3289 features().oes_egl_image_external ? 1 : 0; |
3274 resources.EXT_draw_buffers = | 3290 resources.EXT_draw_buffers = |
3275 features().ext_draw_buffers ? 1 : 0; | 3291 features().ext_draw_buffers ? 1 : 0; |
3276 resources.EXT_frag_depth = | 3292 resources.EXT_frag_depth = |
3277 features().ext_frag_depth ? 1 : 0; | 3293 features().ext_frag_depth ? 1 : 0; |
3278 resources.EXT_shader_texture_lod = | 3294 resources.EXT_shader_texture_lod = |
3279 features().ext_shader_texture_lod ? 1 : 0; | 3295 features().ext_shader_texture_lod ? 1 : 0; |
3280 resources.NV_draw_buffers = | 3296 resources.NV_draw_buffers = |
3281 features().nv_draw_buffers ? 1 : 0; | 3297 features().nv_draw_buffers ? 1 : 0; |
3298 resources.EXT_blend_func_extended = | |
3299 features().ext_blend_func_extended ? 1 : 0; | |
3282 } | 3300 } |
3283 | 3301 |
3284 ShShaderSpec shader_spec; | 3302 ShShaderSpec shader_spec; |
3285 switch (context_type_) { | 3303 switch (context_type_) { |
3286 case CONTEXT_TYPE_WEBGL1: | 3304 case CONTEXT_TYPE_WEBGL1: |
3287 shader_spec = SH_WEBGL_SPEC; | 3305 shader_spec = SH_WEBGL_SPEC; |
3288 break; | 3306 break; |
3289 case CONTEXT_TYPE_WEBGL2: | 3307 case CONTEXT_TYPE_WEBGL2: |
3290 shader_spec = SH_WEBGL2_SPEC; | 3308 shader_spec = SH_WEBGL2_SPEC; |
3291 break; | 3309 break; |
(...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5442 *params = 0; | 5460 *params = 0; |
5443 } | 5461 } |
5444 } | 5462 } |
5445 return true; | 5463 return true; |
5446 case GL_BIND_GENERATES_RESOURCE_CHROMIUM: | 5464 case GL_BIND_GENERATES_RESOURCE_CHROMIUM: |
5447 *num_written = 1; | 5465 *num_written = 1; |
5448 if (params) { | 5466 if (params) { |
5449 params[0] = group_->bind_generates_resource() ? 1 : 0; | 5467 params[0] = group_->bind_generates_resource() ? 1 : 0; |
5450 } | 5468 } |
5451 return true; | 5469 return true; |
5470 case GL_MAX_DUAL_SOURCE_DRAW_BUFFERS: | |
5471 *num_written = 1; | |
5472 if (params) { | |
5473 params[0] = group_->max_dual_source_draw_buffers(); | |
5474 } | |
5475 return true; | |
5452 default: | 5476 default: |
5453 if (pname >= GL_DRAW_BUFFER0_ARB && | 5477 if (pname >= GL_DRAW_BUFFER0_ARB && |
5454 pname < GL_DRAW_BUFFER0_ARB + group_->max_draw_buffers()) { | 5478 pname < GL_DRAW_BUFFER0_ARB + group_->max_draw_buffers()) { |
5455 *num_written = 1; | 5479 *num_written = 1; |
5456 if (params) { | 5480 if (params) { |
5457 Framebuffer* framebuffer = | 5481 Framebuffer* framebuffer = |
5458 GetFramebufferInfoForTarget(GL_FRAMEBUFFER); | 5482 GetFramebufferInfoForTarget(GL_FRAMEBUFFER); |
5459 if (framebuffer) { | 5483 if (framebuffer) { |
5460 params[0] = framebuffer->GetDrawBuffer(pname); | 5484 params[0] = framebuffer->GetDrawBuffer(pname); |
5461 } else { // backbuffer | 5485 } else { // backbuffer |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5622 return error::kInvalidArguments; | 5646 return error::kInvalidArguments; |
5623 } | 5647 } |
5624 std::string name_str; | 5648 std::string name_str; |
5625 if (!bucket->GetAsString(&name_str)) { | 5649 if (!bucket->GetAsString(&name_str)) { |
5626 return error::kInvalidArguments; | 5650 return error::kInvalidArguments; |
5627 } | 5651 } |
5628 DoBindAttribLocation(program, index, name_str.c_str()); | 5652 DoBindAttribLocation(program, index, name_str.c_str()); |
5629 return error::kNoError; | 5653 return error::kNoError; |
5630 } | 5654 } |
5631 | 5655 |
5656 error::Error GLES2DecoderImpl::DoBindFragDataLocation(GLuint program_id, | |
5657 GLuint colorName, | |
5658 const char* name) { | |
5659 if (!unsafe_es3_apis_enabled()) | |
Zhenyao Mo
2015/08/31 21:12:30
No need for this as the extension can be applied t
Kimmo Kinnunen
2015/09/24 13:16:27
No, these functions are not specified in ext_bfe f
| |
5660 return error::kUnknownCommand; | |
5661 | |
5662 const char kFunctionName[] = "glBindFragDataLocationEXT"; | |
5663 if (!StringIsValidForGLES(name)) { | |
5664 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "Invalid character"); | |
5665 return error::kNoError; | |
5666 } | |
5667 if (ProgramManager::IsInvalidPrefix(name, strlen(name))) { | |
5668 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "reserved prefix"); | |
5669 return error::kNoError; | |
5670 } | |
5671 if (colorName >= group_->max_draw_buffers()) { | |
5672 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | |
5673 "colorName out of range"); | |
5674 return error::kNoError; | |
5675 } | |
5676 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); | |
5677 if (!program) { | |
5678 return error::kNoError; | |
5679 } | |
5680 DCHECK(!IsWebGLContext()); | |
5681 // Note: the name is passed directly, since names are never hashed for | |
5682 // non-WebGL context. Also the | |
5683 // potential built-in names can not be controlled by the client, since they | |
5684 // will be overridden if | |
5685 // used. | |
5686 glBindFragDataLocation(program->service_id(), colorName, name); | |
5687 return error::kNoError; | |
5688 } | |
5689 error::Error GLES2DecoderImpl::HandleBindFragDataLocationEXTBucket( | |
5690 uint32 immediate_data_size, | |
5691 const void* cmd_data) { | |
5692 const gles2::cmds::BindFragDataLocationEXTBucket& c = | |
5693 *static_cast<const gles2::cmds::BindFragDataLocationEXTBucket*>(cmd_data); | |
5694 GLuint program = static_cast<GLuint>(c.program); | |
5695 GLuint colorNumber = static_cast<GLint>(c.colorNumber); | |
5696 Bucket* bucket = GetBucket(c.name_bucket_id); | |
5697 if (!bucket || bucket->size() == 0) { | |
5698 return error::kInvalidArguments; | |
5699 } | |
5700 std::string name_str; | |
5701 if (!bucket->GetAsString(&name_str)) { | |
5702 return error::kInvalidArguments; | |
5703 } | |
5704 return DoBindFragDataLocation(program, colorNumber, name_str.c_str()); | |
5705 } | |
5706 | |
5707 error::Error GLES2DecoderImpl::DoBindFragDataLocationIndexed(GLuint program_id, | |
5708 GLuint colorName, | |
5709 GLuint index, | |
5710 const char* name) { | |
5711 if (!unsafe_es3_apis_enabled()) | |
Zhenyao Mo
2015/08/31 21:12:30
No need for this.
Kimmo Kinnunen
2015/09/24 13:16:27
Not specified for ES2.
For this usecase, ES2 versi
| |
5712 return error::kUnknownCommand; | |
5713 | |
5714 const char kFunctionName[] = "glBindFragDataLocationIndexEXT"; | |
5715 if (!StringIsValidForGLES(name)) { | |
5716 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "Invalid character"); | |
5717 return error::kNoError; | |
5718 } | |
5719 if (ProgramManager::IsInvalidPrefix(name, strlen(name))) { | |
5720 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "reserved prefix"); | |
5721 return error::kNoError; | |
5722 } | |
5723 if ((index == 0 && colorName >= group_->max_draw_buffers()) || | |
5724 (index == 1 && colorName >= group_->max_dual_source_draw_buffers())) { | |
Zhenyao Mo
2015/08/31 21:12:30
I think it should be index >= 1 instead of index =
Kimmo Kinnunen
2015/09/24 13:16:27
Nope. In the extension, it says index must be 0 or
| |
5725 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | |
5726 "colorName out of range for the color index"); | |
5727 return error::kNoError; | |
5728 } | |
5729 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); | |
5730 if (!program) { | |
5731 return error::kNoError; | |
5732 } | |
5733 DCHECK(!IsWebGLContext()); | |
5734 // Note: the name is passed directly, since names are never hashed for | |
5735 // non-WebGL context. Also the | |
5736 // potential built-in names can not be controlled by the client, since they | |
5737 // will be overridden if | |
5738 // used. | |
5739 glBindFragDataLocationIndexed(program->service_id(), colorName, index, name); | |
5740 return error::kNoError; | |
5741 } | |
5742 | |
5743 error::Error GLES2DecoderImpl::HandleBindFragDataLocationIndexedEXTBucket( | |
5744 uint32 immediate_data_size, | |
5745 const void* cmd_data) { | |
5746 const gles2::cmds::BindFragDataLocationIndexedEXTBucket& c = | |
5747 *static_cast<const gles2::cmds::BindFragDataLocationIndexedEXTBucket*>( | |
5748 cmd_data); | |
5749 GLuint program = static_cast<GLuint>(c.program); | |
5750 GLuint colorNumber = static_cast<GLint>(c.colorNumber); | |
5751 GLuint index = static_cast<GLint>(c.index); | |
5752 Bucket* bucket = GetBucket(c.name_bucket_id); | |
5753 if (!bucket || bucket->size() == 0) { | |
5754 return error::kInvalidArguments; | |
5755 } | |
5756 std::string name_str; | |
5757 if (!bucket->GetAsString(&name_str)) { | |
5758 return error::kInvalidArguments; | |
5759 } | |
5760 return DoBindFragDataLocationIndexed(program, colorNumber, index, | |
5761 name_str.c_str()); | |
5762 } | |
5763 | |
5632 void GLES2DecoderImpl::DoBindUniformLocationCHROMIUM( | 5764 void GLES2DecoderImpl::DoBindUniformLocationCHROMIUM( |
5633 GLuint program_id, GLint location, const char* name) { | 5765 GLuint program_id, GLint location, const char* name) { |
5634 if (!StringIsValidForGLES(name)) { | 5766 if (!StringIsValidForGLES(name)) { |
5635 LOCAL_SET_GL_ERROR( | 5767 LOCAL_SET_GL_ERROR( |
5636 GL_INVALID_VALUE, | 5768 GL_INVALID_VALUE, |
5637 "glBindUniformLocationCHROMIUM", "Invalid character"); | 5769 "glBindUniformLocationCHROMIUM", "Invalid character"); |
5638 return; | 5770 return; |
5639 } | 5771 } |
5640 if (ProgramManager::IsInvalidPrefix(name, strlen(name))) { | 5772 if (ProgramManager::IsInvalidPrefix(name, strlen(name))) { |
5641 LOCAL_SET_GL_ERROR( | 5773 LOCAL_SET_GL_ERROR( |
(...skipping 3533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9175 result->SetNumResults(count); | 9307 result->SetNumResults(count); |
9176 } else { | 9308 } else { |
9177 LOCAL_SET_GL_ERROR(error, "GetUniformIndices", ""); | 9309 LOCAL_SET_GL_ERROR(error, "GetUniformIndices", ""); |
9178 } | 9310 } |
9179 return error::kNoError; | 9311 return error::kNoError; |
9180 } | 9312 } |
9181 | 9313 |
9182 error::Error GLES2DecoderImpl::GetFragDataLocationHelper( | 9314 error::Error GLES2DecoderImpl::GetFragDataLocationHelper( |
9183 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 9315 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, |
9184 const std::string& name_str) { | 9316 const std::string& name_str) { |
9317 const char kFunctionName[] = "glGetFragDataLocation"; | |
9185 GLint* location = GetSharedMemoryAs<GLint*>( | 9318 GLint* location = GetSharedMemoryAs<GLint*>( |
9186 location_shm_id, location_shm_offset, sizeof(GLint)); | 9319 location_shm_id, location_shm_offset, sizeof(GLint)); |
9187 if (!location) { | 9320 if (!location) { |
9188 return error::kOutOfBounds; | 9321 return error::kOutOfBounds; |
9189 } | 9322 } |
9190 // Require the client to init this incase the context is lost and we are no | 9323 // Require the client to init this incase the context is lost and we are no |
9191 // longer executing commands. | 9324 // longer executing commands. |
9192 if (*location != -1) { | 9325 if (*location != -1) { |
9193 return error::kGenericError; | 9326 return error::kGenericError; |
9194 } | 9327 } |
9195 Program* program = GetProgramInfoNotShader( | 9328 Program* program = GetProgramInfoNotShader(client_id, kFunctionName); |
9196 client_id, "glGetFragDataLocation"); | |
9197 if (!program) { | 9329 if (!program) { |
9198 return error::kNoError; | 9330 return error::kNoError; |
9199 } | 9331 } |
9200 *location = glGetFragDataLocation(program->service_id(), name_str.c_str()); | 9332 if (!program->IsValid()) { |
9333 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | |
9334 "program not linked"); | |
9335 return error::kNoError; | |
9336 } | |
9337 | |
9338 *location = program->GetFragDataLocation(name_str); | |
9201 return error::kNoError; | 9339 return error::kNoError; |
9202 } | 9340 } |
9203 | 9341 |
9204 error::Error GLES2DecoderImpl::HandleGetFragDataLocation( | 9342 error::Error GLES2DecoderImpl::HandleGetFragDataLocation( |
9205 uint32 immediate_data_size, | 9343 uint32 immediate_data_size, |
9206 const void* cmd_data) { | 9344 const void* cmd_data) { |
9207 if (!unsafe_es3_apis_enabled()) | 9345 if (!unsafe_es3_apis_enabled()) |
9208 return error::kUnknownCommand; | 9346 return error::kUnknownCommand; |
9209 const gles2::cmds::GetFragDataLocation& c = | 9347 const gles2::cmds::GetFragDataLocation& c = |
9210 *static_cast<const gles2::cmds::GetFragDataLocation*>(cmd_data); | 9348 *static_cast<const gles2::cmds::GetFragDataLocation*>(cmd_data); |
9211 Bucket* bucket = GetBucket(c.name_bucket_id); | 9349 Bucket* bucket = GetBucket(c.name_bucket_id); |
9212 if (!bucket) { | 9350 if (!bucket) { |
9213 return error::kInvalidArguments; | 9351 return error::kInvalidArguments; |
9214 } | 9352 } |
9215 std::string name_str; | 9353 std::string name_str; |
9216 if (!bucket->GetAsString(&name_str)) { | 9354 if (!bucket->GetAsString(&name_str)) { |
9217 return error::kInvalidArguments; | 9355 return error::kInvalidArguments; |
9218 } | 9356 } |
9219 return GetFragDataLocationHelper( | 9357 return GetFragDataLocationHelper( |
9220 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 9358 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
9221 } | 9359 } |
9222 | 9360 |
9361 error::Error GLES2DecoderImpl::GetFragDataIndexHelper( | |
9362 GLuint program_id, | |
9363 uint32 index_shm_id, | |
9364 uint32 index_shm_offset, | |
9365 const std::string& name_str) { | |
9366 const char kFunctionName[] = "glGetFragDataIndexEXT"; | |
9367 GLint* index = | |
9368 GetSharedMemoryAs<GLint*>(index_shm_id, index_shm_offset, sizeof(GLint)); | |
9369 if (!index) { | |
9370 return error::kOutOfBounds; | |
9371 } | |
9372 // Require the client to init this incase the context is lost and we are no | |
9373 // longer executing commands. | |
9374 if (*index != -1) { | |
9375 return error::kGenericError; | |
9376 } | |
9377 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); | |
9378 if (!program) { | |
9379 return error::kNoError; | |
9380 } | |
9381 if (!program->IsValid()) { | |
9382 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | |
9383 "program not linked"); | |
9384 return error::kNoError; | |
9385 } | |
9386 | |
9387 *index = program->GetFragDataIndex(name_str); | |
9388 return error::kNoError; | |
9389 } | |
9390 | |
9391 error::Error GLES2DecoderImpl::HandleGetFragDataIndexEXT( | |
9392 uint32 immediate_data_size, | |
9393 const void* cmd_data) { | |
9394 if (!unsafe_es3_apis_enabled()) | |
9395 return error::kUnknownCommand; | |
9396 const gles2::cmds::GetFragDataIndexEXT& c = | |
9397 *static_cast<const gles2::cmds::GetFragDataIndexEXT*>(cmd_data); | |
9398 Bucket* bucket = GetBucket(c.name_bucket_id); | |
9399 if (!bucket) { | |
9400 return error::kInvalidArguments; | |
9401 } | |
9402 std::string name_str; | |
9403 if (!bucket->GetAsString(&name_str)) { | |
9404 return error::kInvalidArguments; | |
9405 } | |
9406 return GetFragDataIndexHelper(c.program, c.index_shm_id, c.index_shm_offset, | |
9407 | |
Zhenyao Mo
2015/08/31 21:12:30
nit: remove the empty line.
Kimmo Kinnunen
2015/09/24 13:16:27
Done.
| |
9408 name_str); | |
9409 } | |
9410 | |
9223 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex( | 9411 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex( |
9224 uint32 immediate_data_size, const void* cmd_data) { | 9412 uint32 immediate_data_size, const void* cmd_data) { |
9225 if (!unsafe_es3_apis_enabled()) | 9413 if (!unsafe_es3_apis_enabled()) |
9226 return error::kUnknownCommand; | 9414 return error::kUnknownCommand; |
9227 const gles2::cmds::GetUniformBlockIndex& c = | 9415 const gles2::cmds::GetUniformBlockIndex& c = |
9228 *static_cast<const gles2::cmds::GetUniformBlockIndex*>(cmd_data); | 9416 *static_cast<const gles2::cmds::GetUniformBlockIndex*>(cmd_data); |
9229 Bucket* bucket = GetBucket(c.name_bucket_id); | 9417 Bucket* bucket = GetBucket(c.name_bucket_id); |
9230 if (!bucket) { | 9418 if (!bucket) { |
9231 return error::kInvalidArguments; | 9419 return error::kInvalidArguments; |
9232 } | 9420 } |
(...skipping 6311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15544 return error::kNoError; | 15732 return error::kNoError; |
15545 } | 15733 } |
15546 | 15734 |
15547 // Include the auto-generated part of this file. We split this because it means | 15735 // Include the auto-generated part of this file. We split this because it means |
15548 // we can easily edit the non-auto generated parts right here in this file | 15736 // we can easily edit the non-auto generated parts right here in this file |
15549 // instead of having to edit some template or the code generator. | 15737 // instead of having to edit some template or the code generator. |
15550 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15738 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15551 | 15739 |
15552 } // namespace gles2 | 15740 } // namespace gles2 |
15553 } // namespace gpu | 15741 } // namespace gpu |
OLD | NEW |