| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 3517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3528 DoGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, | 3528 DoGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, |
| 3529 &caps.max_vertex_texture_image_units, 1); | 3529 &caps.max_vertex_texture_image_units, 1); |
| 3530 DoGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &caps.max_vertex_uniform_vectors, | 3530 DoGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &caps.max_vertex_uniform_vectors, |
| 3531 1); | 3531 1); |
| 3532 DoGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, | 3532 DoGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, |
| 3533 &caps.num_compressed_texture_formats, 1); | 3533 &caps.num_compressed_texture_formats, 1); |
| 3534 DoGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &caps.num_shader_binary_formats, | 3534 DoGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &caps.num_shader_binary_formats, |
| 3535 1); | 3535 1); |
| 3536 DoGetIntegerv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, | 3536 DoGetIntegerv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, |
| 3537 &caps.bind_generates_resource_chromium, 1); | 3537 &caps.bind_generates_resource_chromium, 1); |
| 3538 if (feature_info_->IsWebGL2OrES3Context()) { | 3538 if (unsafe_es3_apis_enabled()) { |
| 3539 // TODO(zmo): Note that some parameter values could be more than 32-bit, | 3539 // TODO(zmo): Note that some parameter values could be more than 32-bit, |
| 3540 // but for now we clamp them to 32-bit max. | 3540 // but for now we clamp them to 32-bit max. |
| 3541 DoGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &caps.max_3d_texture_size, 1); | 3541 DoGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &caps.max_3d_texture_size, 1); |
| 3542 DoGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &caps.max_array_texture_layers, | 3542 DoGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &caps.max_array_texture_layers, |
| 3543 1); | 3543 1); |
| 3544 DoGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &caps.max_color_attachments, 1); | 3544 DoGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &caps.max_color_attachments, 1); |
| 3545 DoGetInteger64v(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, | 3545 DoGetInteger64v(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, |
| 3546 &caps.max_combined_fragment_uniform_components, 1); | 3546 &caps.max_combined_fragment_uniform_components, 1); |
| 3547 DoGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, | 3547 DoGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, |
| 3548 &caps.max_combined_uniform_blocks, 1); | 3548 &caps.max_combined_uniform_blocks, 1); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3590 DoGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, | 3590 DoGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, |
| 3591 &caps.num_program_binary_formats, 1); | 3591 &caps.num_program_binary_formats, 1); |
| 3592 DoGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, | 3592 DoGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, |
| 3593 &caps.uniform_buffer_offset_alignment, 1); | 3593 &caps.uniform_buffer_offset_alignment, 1); |
| 3594 // TODO(zmo): once we switch to MANGLE, we should query version numbers. | 3594 // TODO(zmo): once we switch to MANGLE, we should query version numbers. |
| 3595 caps.major_version = 3; | 3595 caps.major_version = 3; |
| 3596 caps.minor_version = 0; | 3596 caps.minor_version = 0; |
| 3597 } | 3597 } |
| 3598 if (feature_info_->feature_flags().multisampled_render_to_texture || | 3598 if (feature_info_->feature_flags().multisampled_render_to_texture || |
| 3599 feature_info_->feature_flags().chromium_framebuffer_multisample || | 3599 feature_info_->feature_flags().chromium_framebuffer_multisample || |
| 3600 feature_info_->IsWebGL2OrES3Context()) { | 3600 unsafe_es3_apis_enabled()) { |
| 3601 DoGetIntegerv(GL_MAX_SAMPLES, &caps.max_samples, 1); | 3601 DoGetIntegerv(GL_MAX_SAMPLES, &caps.max_samples, 1); |
| 3602 } | 3602 } |
| 3603 | 3603 |
| 3604 caps.egl_image_external = | 3604 caps.egl_image_external = |
| 3605 feature_info_->feature_flags().oes_egl_image_external; | 3605 feature_info_->feature_flags().oes_egl_image_external; |
| 3606 caps.texture_format_astc = | 3606 caps.texture_format_astc = |
| 3607 feature_info_->feature_flags().ext_texture_format_astc; | 3607 feature_info_->feature_flags().ext_texture_format_astc; |
| 3608 caps.texture_format_atc = | 3608 caps.texture_format_atc = |
| 3609 feature_info_->feature_flags().ext_texture_format_atc; | 3609 feature_info_->feature_flags().ext_texture_format_atc; |
| 3610 caps.texture_format_bgra8888 = | 3610 caps.texture_format_bgra8888 = |
| (...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6216 } | 6216 } |
| 6217 return true; | 6217 return true; |
| 6218 case GL_MAX_VERTEX_UNIFORM_VECTORS: | 6218 case GL_MAX_VERTEX_UNIFORM_VECTORS: |
| 6219 *num_written = 1; | 6219 *num_written = 1; |
| 6220 if (params) { | 6220 if (params) { |
| 6221 *params = group_->max_vertex_uniform_vectors(); | 6221 *params = group_->max_vertex_uniform_vectors(); |
| 6222 } | 6222 } |
| 6223 return true; | 6223 return true; |
| 6224 } | 6224 } |
| 6225 } | 6225 } |
| 6226 if (feature_info_->IsWebGL2OrES3Context()) { | 6226 if (unsafe_es3_apis_enabled()) { |
| 6227 switch (pname) { | 6227 switch (pname) { |
| 6228 case GL_MAX_VARYING_COMPONENTS: { | 6228 case GL_MAX_VARYING_COMPONENTS: { |
| 6229 if (gl_version_info().is_es) { | 6229 if (gl_version_info().is_es) { |
| 6230 // We can just delegate this query to the driver. | 6230 // We can just delegate this query to the driver. |
| 6231 *num_written = 1; | 6231 *num_written = 1; |
| 6232 break; | 6232 break; |
| 6233 } | 6233 } |
| 6234 | 6234 |
| 6235 // GL_MAX_VARYING_COMPONENTS is deprecated in the desktop | 6235 // GL_MAX_VARYING_COMPONENTS is deprecated in the desktop |
| 6236 // OpenGL core profile, so for simplicity, just compute it | 6236 // OpenGL core profile, so for simplicity, just compute it |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6808 DoGetIntegerv(pname, values.get(), params_size); | 6808 DoGetIntegerv(pname, values.get(), params_size); |
| 6809 for (GLsizei ii = 0; ii < params_size; ++ii) { | 6809 for (GLsizei ii = 0; ii < params_size; ++ii) { |
| 6810 params[ii] = static_cast<GLfloat>(values[ii]); | 6810 params[ii] = static_cast<GLfloat>(values[ii]); |
| 6811 } | 6811 } |
| 6812 } | 6812 } |
| 6813 | 6813 |
| 6814 void GLES2DecoderImpl::DoGetInteger64v(GLenum pname, | 6814 void GLES2DecoderImpl::DoGetInteger64v(GLenum pname, |
| 6815 GLint64* params, | 6815 GLint64* params, |
| 6816 GLsizei params_size) { | 6816 GLsizei params_size) { |
| 6817 DCHECK(params); | 6817 DCHECK(params); |
| 6818 if (feature_info_->IsWebGL2OrES3Context()) { | 6818 if (unsafe_es3_apis_enabled()) { |
| 6819 switch (pname) { | 6819 switch (pname) { |
| 6820 case GL_MAX_ELEMENT_INDEX: { | 6820 case GL_MAX_ELEMENT_INDEX: { |
| 6821 DCHECK_EQ(params_size, 1); | 6821 DCHECK_EQ(params_size, 1); |
| 6822 if (gl_version_info().IsAtLeastGLES(3, 0) || | 6822 if (gl_version_info().IsAtLeastGLES(3, 0) || |
| 6823 gl_version_info().IsAtLeastGL(4, 3)) { | 6823 gl_version_info().IsAtLeastGL(4, 3)) { |
| 6824 glGetInteger64v(GL_MAX_ELEMENT_INDEX, params); | 6824 glGetInteger64v(GL_MAX_ELEMENT_INDEX, params); |
| 6825 } else { | 6825 } else { |
| 6826 // Assume that desktop GL implementations can generally support | 6826 // Assume that desktop GL implementations can generally support |
| 6827 // 32-bit indices. | 6827 // 32-bit indices. |
| 6828 if (params) { | 6828 if (params) { |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7690 | 7690 |
| 7691 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( | 7691 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( |
| 7692 GLenum target, | 7692 GLenum target, |
| 7693 GLenum attachment, | 7693 GLenum attachment, |
| 7694 GLenum pname, | 7694 GLenum pname, |
| 7695 GLint* params, | 7695 GLint* params, |
| 7696 GLsizei params_size) { | 7696 GLsizei params_size) { |
| 7697 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv"; | 7697 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv"; |
| 7698 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); | 7698 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); |
| 7699 if (!framebuffer) { | 7699 if (!framebuffer) { |
| 7700 if (!feature_info_->IsWebGL2OrES3Context()) { | 7700 if (!unsafe_es3_apis_enabled()) { |
| 7701 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 7701 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 7702 "no framebuffer bound"); | 7702 "no framebuffer bound"); |
| 7703 return; | 7703 return; |
| 7704 } | 7704 } |
| 7705 if (!validators_->backbuffer_attachment.IsValid(attachment)) { | 7705 if (!validators_->backbuffer_attachment.IsValid(attachment)) { |
| 7706 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 7706 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 7707 "invalid attachment for backbuffer"); | 7707 "invalid attachment for backbuffer"); |
| 7708 return; | 7708 return; |
| 7709 } | 7709 } |
| 7710 switch (pname) { | 7710 switch (pname) { |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9030 } | 9030 } |
| 9031 glUniform4uiv(real_location, count, const_cast<const GLuint*>(value)); | 9031 glUniform4uiv(real_location, count, const_cast<const GLuint*>(value)); |
| 9032 } | 9032 } |
| 9033 | 9033 |
| 9034 void GLES2DecoderImpl::DoUniformMatrix2fv(GLint fake_location, | 9034 void GLES2DecoderImpl::DoUniformMatrix2fv(GLint fake_location, |
| 9035 GLsizei count, | 9035 GLsizei count, |
| 9036 GLboolean transpose, | 9036 GLboolean transpose, |
| 9037 const volatile GLfloat* value) { | 9037 const volatile GLfloat* value) { |
| 9038 GLenum type = 0; | 9038 GLenum type = 0; |
| 9039 GLint real_location = -1; | 9039 GLint real_location = -1; |
| 9040 if (transpose && !feature_info_->IsWebGL2OrES3Context()) { | 9040 if (transpose && !unsafe_es3_apis_enabled()) { |
| 9041 LOCAL_SET_GL_ERROR( | 9041 LOCAL_SET_GL_ERROR( |
| 9042 GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose not FALSE"); | 9042 GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose not FALSE"); |
| 9043 return; | 9043 return; |
| 9044 } | 9044 } |
| 9045 if (!PrepForSetUniformByLocation(fake_location, | 9045 if (!PrepForSetUniformByLocation(fake_location, |
| 9046 "glUniformMatrix2fv", | 9046 "glUniformMatrix2fv", |
| 9047 Program::kUniformMatrix2f, | 9047 Program::kUniformMatrix2f, |
| 9048 &real_location, | 9048 &real_location, |
| 9049 &type, | 9049 &type, |
| 9050 &count)) { | 9050 &count)) { |
| 9051 return; | 9051 return; |
| 9052 } | 9052 } |
| 9053 glUniformMatrix2fv(real_location, count, transpose, | 9053 glUniformMatrix2fv(real_location, count, transpose, |
| 9054 const_cast<const GLfloat*>(value)); | 9054 const_cast<const GLfloat*>(value)); |
| 9055 } | 9055 } |
| 9056 | 9056 |
| 9057 void GLES2DecoderImpl::DoUniformMatrix3fv(GLint fake_location, | 9057 void GLES2DecoderImpl::DoUniformMatrix3fv(GLint fake_location, |
| 9058 GLsizei count, | 9058 GLsizei count, |
| 9059 GLboolean transpose, | 9059 GLboolean transpose, |
| 9060 const volatile GLfloat* value) { | 9060 const volatile GLfloat* value) { |
| 9061 GLenum type = 0; | 9061 GLenum type = 0; |
| 9062 GLint real_location = -1; | 9062 GLint real_location = -1; |
| 9063 if (transpose && !feature_info_->IsWebGL2OrES3Context()) { | 9063 if (transpose && !unsafe_es3_apis_enabled()) { |
| 9064 LOCAL_SET_GL_ERROR( | 9064 LOCAL_SET_GL_ERROR( |
| 9065 GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose not FALSE"); | 9065 GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose not FALSE"); |
| 9066 return; | 9066 return; |
| 9067 } | 9067 } |
| 9068 if (!PrepForSetUniformByLocation(fake_location, | 9068 if (!PrepForSetUniformByLocation(fake_location, |
| 9069 "glUniformMatrix3fv", | 9069 "glUniformMatrix3fv", |
| 9070 Program::kUniformMatrix3f, | 9070 Program::kUniformMatrix3f, |
| 9071 &real_location, | 9071 &real_location, |
| 9072 &type, | 9072 &type, |
| 9073 &count)) { | 9073 &count)) { |
| 9074 return; | 9074 return; |
| 9075 } | 9075 } |
| 9076 glUniformMatrix3fv(real_location, count, transpose, | 9076 glUniformMatrix3fv(real_location, count, transpose, |
| 9077 const_cast<const GLfloat*>(value)); | 9077 const_cast<const GLfloat*>(value)); |
| 9078 } | 9078 } |
| 9079 | 9079 |
| 9080 void GLES2DecoderImpl::DoUniformMatrix4fv(GLint fake_location, | 9080 void GLES2DecoderImpl::DoUniformMatrix4fv(GLint fake_location, |
| 9081 GLsizei count, | 9081 GLsizei count, |
| 9082 GLboolean transpose, | 9082 GLboolean transpose, |
| 9083 const volatile GLfloat* value) { | 9083 const volatile GLfloat* value) { |
| 9084 GLenum type = 0; | 9084 GLenum type = 0; |
| 9085 GLint real_location = -1; | 9085 GLint real_location = -1; |
| 9086 if (transpose && !feature_info_->IsWebGL2OrES3Context()) { | 9086 if (transpose && !unsafe_es3_apis_enabled()) { |
| 9087 LOCAL_SET_GL_ERROR( | 9087 LOCAL_SET_GL_ERROR( |
| 9088 GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose not FALSE"); | 9088 GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose not FALSE"); |
| 9089 return; | 9089 return; |
| 9090 } | 9090 } |
| 9091 if (!PrepForSetUniformByLocation(fake_location, | 9091 if (!PrepForSetUniformByLocation(fake_location, |
| 9092 "glUniformMatrix4fv", | 9092 "glUniformMatrix4fv", |
| 9093 Program::kUniformMatrix4f, | 9093 Program::kUniformMatrix4f, |
| 9094 &real_location, | 9094 &real_location, |
| 9095 &type, | 9095 &type, |
| 9096 &count)) { | 9096 &count)) { |
| (...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10696 if (SetVertexAttribValue("glVertexAttribI4uiv", index, t)) { | 10696 if (SetVertexAttribValue("glVertexAttribI4uiv", index, t)) { |
| 10697 state_.SetGenericVertexAttribBaseType( | 10697 state_.SetGenericVertexAttribBaseType( |
| 10698 index, SHADER_VARIABLE_UINT); | 10698 index, SHADER_VARIABLE_UINT); |
| 10699 glVertexAttribI4uiv(index, t); | 10699 glVertexAttribI4uiv(index, t); |
| 10700 } | 10700 } |
| 10701 } | 10701 } |
| 10702 | 10702 |
| 10703 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer( | 10703 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer( |
| 10704 uint32_t immediate_data_size, | 10704 uint32_t immediate_data_size, |
| 10705 const volatile void* cmd_data) { | 10705 const volatile void* cmd_data) { |
| 10706 if (!feature_info_->IsWebGL2OrES3Context()) | 10706 if (!unsafe_es3_apis_enabled()) |
| 10707 return error::kUnknownCommand; | 10707 return error::kUnknownCommand; |
| 10708 const volatile gles2::cmds::VertexAttribIPointer& c = | 10708 const volatile gles2::cmds::VertexAttribIPointer& c = |
| 10709 *static_cast<const volatile gles2::cmds::VertexAttribIPointer*>(cmd_data); | 10709 *static_cast<const volatile gles2::cmds::VertexAttribIPointer*>(cmd_data); |
| 10710 GLuint indx = c.indx; | 10710 GLuint indx = c.indx; |
| 10711 GLint size = c.size; | 10711 GLint size = c.size; |
| 10712 GLenum type = c.type; | 10712 GLenum type = c.type; |
| 10713 GLsizei stride = c.stride; | 10713 GLsizei stride = c.stride; |
| 10714 GLsizei offset = c.offset; | 10714 GLsizei offset = c.offset; |
| 10715 | 10715 |
| 10716 if (!state_.bound_array_buffer.get() || | 10716 if (!state_.bound_array_buffer.get() || |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11756 if (!bucket->GetAsString(&name_str)) { | 11756 if (!bucket->GetAsString(&name_str)) { |
| 11757 return error::kInvalidArguments; | 11757 return error::kInvalidArguments; |
| 11758 } | 11758 } |
| 11759 return GetAttribLocationHelper( | 11759 return GetAttribLocationHelper( |
| 11760 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 11760 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
| 11761 } | 11761 } |
| 11762 | 11762 |
| 11763 error::Error GLES2DecoderImpl::HandleGetBufferSubDataAsyncCHROMIUM( | 11763 error::Error GLES2DecoderImpl::HandleGetBufferSubDataAsyncCHROMIUM( |
| 11764 uint32_t immediate_data_size, | 11764 uint32_t immediate_data_size, |
| 11765 const volatile void* cmd_data) { | 11765 const volatile void* cmd_data) { |
| 11766 if (!feature_info_->IsWebGL2OrES3Context()) { | 11766 if (!unsafe_es3_apis_enabled()) { |
| 11767 return error::kUnknownCommand; | 11767 return error::kUnknownCommand; |
| 11768 } | 11768 } |
| 11769 const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM& c = | 11769 const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM& c = |
| 11770 *static_cast<const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM*>( | 11770 *static_cast<const volatile gles2::cmds::GetBufferSubDataAsyncCHROMIUM*>( |
| 11771 cmd_data); | 11771 cmd_data); |
| 11772 GLenum target = static_cast<GLenum>(c.target); | 11772 GLenum target = static_cast<GLenum>(c.target); |
| 11773 GLintptr offset = static_cast<GLintptr>(c.offset); | 11773 GLintptr offset = static_cast<GLintptr>(c.offset); |
| 11774 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 11774 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
| 11775 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); | 11775 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); |
| 11776 | 11776 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11858 if (!bucket->GetAsString(&name_str)) { | 11858 if (!bucket->GetAsString(&name_str)) { |
| 11859 return error::kInvalidArguments; | 11859 return error::kInvalidArguments; |
| 11860 } | 11860 } |
| 11861 return GetUniformLocationHelper( | 11861 return GetUniformLocationHelper( |
| 11862 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 11862 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
| 11863 } | 11863 } |
| 11864 | 11864 |
| 11865 error::Error GLES2DecoderImpl::HandleGetUniformIndices( | 11865 error::Error GLES2DecoderImpl::HandleGetUniformIndices( |
| 11866 uint32_t immediate_data_size, | 11866 uint32_t immediate_data_size, |
| 11867 const volatile void* cmd_data) { | 11867 const volatile void* cmd_data) { |
| 11868 if (!feature_info_->IsWebGL2OrES3Context()) | 11868 if (!unsafe_es3_apis_enabled()) |
| 11869 return error::kUnknownCommand; | 11869 return error::kUnknownCommand; |
| 11870 const volatile gles2::cmds::GetUniformIndices& c = | 11870 const volatile gles2::cmds::GetUniformIndices& c = |
| 11871 *static_cast<const volatile gles2::cmds::GetUniformIndices*>(cmd_data); | 11871 *static_cast<const volatile gles2::cmds::GetUniformIndices*>(cmd_data); |
| 11872 Bucket* bucket = GetBucket(c.names_bucket_id); | 11872 Bucket* bucket = GetBucket(c.names_bucket_id); |
| 11873 if (!bucket) { | 11873 if (!bucket) { |
| 11874 return error::kInvalidArguments; | 11874 return error::kInvalidArguments; |
| 11875 } | 11875 } |
| 11876 GLsizei count = 0; | 11876 GLsizei count = 0; |
| 11877 std::vector<char*> names; | 11877 std::vector<char*> names; |
| 11878 std::vector<GLint> len; | 11878 std::vector<GLint> len; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11939 return error::kNoError; | 11939 return error::kNoError; |
| 11940 } | 11940 } |
| 11941 | 11941 |
| 11942 *location = program->GetFragDataLocation(name_str); | 11942 *location = program->GetFragDataLocation(name_str); |
| 11943 return error::kNoError; | 11943 return error::kNoError; |
| 11944 } | 11944 } |
| 11945 | 11945 |
| 11946 error::Error GLES2DecoderImpl::HandleGetFragDataLocation( | 11946 error::Error GLES2DecoderImpl::HandleGetFragDataLocation( |
| 11947 uint32_t immediate_data_size, | 11947 uint32_t immediate_data_size, |
| 11948 const volatile void* cmd_data) { | 11948 const volatile void* cmd_data) { |
| 11949 if (!feature_info_->IsWebGL2OrES3Context()) | 11949 if (!unsafe_es3_apis_enabled()) |
| 11950 return error::kUnknownCommand; | 11950 return error::kUnknownCommand; |
| 11951 const volatile gles2::cmds::GetFragDataLocation& c = | 11951 const volatile gles2::cmds::GetFragDataLocation& c = |
| 11952 *static_cast<const volatile gles2::cmds::GetFragDataLocation*>(cmd_data); | 11952 *static_cast<const volatile gles2::cmds::GetFragDataLocation*>(cmd_data); |
| 11953 Bucket* bucket = GetBucket(c.name_bucket_id); | 11953 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 11954 if (!bucket) { | 11954 if (!bucket) { |
| 11955 return error::kInvalidArguments; | 11955 return error::kInvalidArguments; |
| 11956 } | 11956 } |
| 11957 std::string name_str; | 11957 std::string name_str; |
| 11958 if (!bucket->GetAsString(&name_str)) { | 11958 if (!bucket->GetAsString(&name_str)) { |
| 11959 return error::kInvalidArguments; | 11959 return error::kInvalidArguments; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12007 if (!bucket->GetAsString(&name_str)) { | 12007 if (!bucket->GetAsString(&name_str)) { |
| 12008 return error::kInvalidArguments; | 12008 return error::kInvalidArguments; |
| 12009 } | 12009 } |
| 12010 return GetFragDataIndexHelper(c.program, c.index_shm_id, c.index_shm_offset, | 12010 return GetFragDataIndexHelper(c.program, c.index_shm_id, c.index_shm_offset, |
| 12011 name_str); | 12011 name_str); |
| 12012 } | 12012 } |
| 12013 | 12013 |
| 12014 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex( | 12014 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex( |
| 12015 uint32_t immediate_data_size, | 12015 uint32_t immediate_data_size, |
| 12016 const volatile void* cmd_data) { | 12016 const volatile void* cmd_data) { |
| 12017 if (!feature_info_->IsWebGL2OrES3Context()) | 12017 if (!unsafe_es3_apis_enabled()) |
| 12018 return error::kUnknownCommand; | 12018 return error::kUnknownCommand; |
| 12019 const volatile gles2::cmds::GetUniformBlockIndex& c = | 12019 const volatile gles2::cmds::GetUniformBlockIndex& c = |
| 12020 *static_cast<const volatile gles2::cmds::GetUniformBlockIndex*>(cmd_data); | 12020 *static_cast<const volatile gles2::cmds::GetUniformBlockIndex*>(cmd_data); |
| 12021 Bucket* bucket = GetBucket(c.name_bucket_id); | 12021 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 12022 if (!bucket) { | 12022 if (!bucket) { |
| 12023 return error::kInvalidArguments; | 12023 return error::kInvalidArguments; |
| 12024 } | 12024 } |
| 12025 std::string name_str; | 12025 std::string name_str; |
| 12026 if (!bucket->GetAsString(&name_str)) { | 12026 if (!bucket->GetAsString(&name_str)) { |
| 12027 return error::kInvalidArguments; | 12027 return error::kInvalidArguments; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 12051 GLenum name = static_cast<GLenum>(c.name); | 12051 GLenum name = static_cast<GLenum>(c.name); |
| 12052 if (!validators_->string_type.IsValid(name)) { | 12052 if (!validators_->string_type.IsValid(name)) { |
| 12053 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); | 12053 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); |
| 12054 return error::kNoError; | 12054 return error::kNoError; |
| 12055 } | 12055 } |
| 12056 | 12056 |
| 12057 const char* str = nullptr; | 12057 const char* str = nullptr; |
| 12058 std::string extensions; | 12058 std::string extensions; |
| 12059 switch (name) { | 12059 switch (name) { |
| 12060 case GL_VERSION: | 12060 case GL_VERSION: |
| 12061 if (feature_info_->IsWebGL2OrES3Context()) | 12061 if (unsafe_es3_apis_enabled()) |
| 12062 str = "OpenGL ES 3.0 Chromium"; | 12062 str = "OpenGL ES 3.0 Chromium"; |
| 12063 else | 12063 else |
| 12064 str = "OpenGL ES 2.0 Chromium"; | 12064 str = "OpenGL ES 2.0 Chromium"; |
| 12065 break; | 12065 break; |
| 12066 case GL_SHADING_LANGUAGE_VERSION: | 12066 case GL_SHADING_LANGUAGE_VERSION: |
| 12067 if (feature_info_->IsWebGL2OrES3Context()) | 12067 if (unsafe_es3_apis_enabled()) |
| 12068 str = "OpenGL ES GLSL ES 3.0 Chromium"; | 12068 str = "OpenGL ES GLSL ES 3.0 Chromium"; |
| 12069 else | 12069 else |
| 12070 str = "OpenGL ES GLSL ES 1.0 Chromium"; | 12070 str = "OpenGL ES GLSL ES 1.0 Chromium"; |
| 12071 break; | 12071 break; |
| 12072 case GL_RENDERER: | 12072 case GL_RENDERER: |
| 12073 case GL_VENDOR: | 12073 case GL_VENDOR: |
| 12074 // Return the unmasked VENDOR/RENDERER string for WebGL contexts. | 12074 // Return the unmasked VENDOR/RENDERER string for WebGL contexts. |
| 12075 // They are used by WEBGL_debug_renderer_info. | 12075 // They are used by WEBGL_debug_renderer_info. |
| 12076 if (!feature_info_->IsWebGLContext()) | 12076 if (!feature_info_->IsWebGLContext()) |
| 12077 str = "Chromium"; | 12077 str = "Chromium"; |
| (...skipping 6682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18760 } | 18760 } |
| 18761 | 18761 |
| 18762 // Include the auto-generated part of this file. We split this because it means | 18762 // Include the auto-generated part of this file. We split this because it means |
| 18763 // we can easily edit the non-auto generated parts right here in this file | 18763 // we can easily edit the non-auto generated parts right here in this file |
| 18764 // instead of having to edit some template or the code generator. | 18764 // instead of having to edit some template or the code generator. |
| 18765 #include "base/macros.h" | 18765 #include "base/macros.h" |
| 18766 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18766 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 18767 | 18767 |
| 18768 } // namespace gles2 | 18768 } // namespace gles2 |
| 18769 } // namespace gpu | 18769 } // namespace gpu |
| OLD | NEW |