OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1304 bool use_shader_translator_; | 1304 bool use_shader_translator_; |
1305 scoped_ptr<ShaderTranslator> vertex_translator_; | 1305 scoped_ptr<ShaderTranslator> vertex_translator_; |
1306 scoped_ptr<ShaderTranslator> fragment_translator_; | 1306 scoped_ptr<ShaderTranslator> fragment_translator_; |
1307 | 1307 |
1308 DisallowedExtensions disallowed_extensions_; | 1308 DisallowedExtensions disallowed_extensions_; |
1309 | 1309 |
1310 // Cached from ContextGroup | 1310 // Cached from ContextGroup |
1311 const Validators* validators_; | 1311 const Validators* validators_; |
1312 FeatureInfo* feature_info_; | 1312 FeatureInfo* feature_info_; |
1313 | 1313 |
1314 // Per GLES2DecoderImpl instance set of validators, which are used if | |
1315 // a more constrained set of extensions is required for this particular | |
1316 // context, wrt the shared ContextGroup. | |
1317 scoped_ptr<FeatureInfo> local_feature_info_; | |
1318 | |
1319 // Get the set of validators to use for API parameter verification. | |
1320 const Validators* validators() const { | |
1321 if (local_feature_info_.get()) | |
1322 return local_feature_info_->validators(); | |
1323 return validators_; | |
1324 } | |
1325 | |
1314 // This indicates all the following texSubImage2D calls that are part of the | 1326 // This indicates all the following texSubImage2D calls that are part of the |
1315 // failed texImage2D call should be ignored. | 1327 // failed texImage2D call should be ignored. |
1316 bool tex_image_2d_failed_; | 1328 bool tex_image_2d_failed_; |
1317 | 1329 |
1318 int frame_number_; | 1330 int frame_number_; |
1319 | 1331 |
1320 bool has_arb_robustness_; | 1332 bool has_arb_robustness_; |
1321 GLenum reset_status_; | 1333 GLenum reset_status_; |
1322 | 1334 |
1323 bool needs_mac_nvidia_driver_workaround_; | 1335 bool needs_mac_nvidia_driver_workaround_; |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1729 // Take ownership of the GLContext. | 1741 // Take ownership of the GLContext. |
1730 context_ = context; | 1742 context_ = context; |
1731 | 1743 |
1732 if (!MakeCurrent()) { | 1744 if (!MakeCurrent()) { |
1733 LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because " | 1745 LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because " |
1734 << "MakeCurrent failed."; | 1746 << "MakeCurrent failed."; |
1735 Destroy(); | 1747 Destroy(); |
1736 return false; | 1748 return false; |
1737 } | 1749 } |
1738 | 1750 |
1739 if (!group_->Initialize(disallowed_extensions, allowed_extensions)) { | 1751 // Initialization for a constrained set of extensions constructs a local |
1752 // set of validators, that override those of the sharing group. | |
1753 if (0 == strcmp(allowed_extensions, "*")) { | |
Ken Russell (switch to Gerrit)
2011/09/15 23:57:27
Shouldn't this comparison be "0 != strcmp(...)"? W
Jeff Timanus
2011/09/16 15:00:17
Yes!
Done.
| |
1754 local_feature_info_.reset(new FeatureInfo()); | |
1755 if (!local_feature_info_->Initialize(allowed_extensions)) { | |
1756 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because local " | |
1757 << "FeatureInfo overrides failed to initialize."; | |
1758 Destroy(); | |
1759 return false; | |
1760 } | |
1761 } | |
1762 | |
1763 // The shared group should always be initialized with all extensions. | |
1764 // This ensures that all contexts will have access to all of the exentsions | |
1765 // they may need. | |
1766 if (!group_->Initialize(disallowed_extensions, "*")) { | |
1740 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " | 1767 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " |
1741 << "failed to initialize."; | 1768 << "failed to initialize."; |
1742 Destroy(); | 1769 Destroy(); |
1743 return false; | 1770 return false; |
1744 } | 1771 } |
1745 | 1772 |
1746 CHECK_GL_ERROR(); | 1773 CHECK_GL_ERROR(); |
1747 disallowed_extensions_ = disallowed_extensions; | 1774 disallowed_extensions_ = disallowed_extensions; |
1748 | 1775 |
1749 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); | 1776 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); |
1750 | 1777 |
1751 util_.set_num_compressed_texture_formats( | 1778 util_.set_num_compressed_texture_formats( |
1752 validators_->compressed_texture_format.GetValues().size()); | 1779 validators()->compressed_texture_format.GetValues().size()); |
1753 | 1780 |
1754 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 1781 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
1755 // We have to enable vertex array 0 on OpenGL or it won't render. Note that | 1782 // We have to enable vertex array 0 on OpenGL or it won't render. Note that |
1756 // OpenGL ES 2.0 does not have this issue. | 1783 // OpenGL ES 2.0 does not have this issue. |
1757 glEnableVertexAttribArray(0); | 1784 glEnableVertexAttribArray(0); |
1758 } | 1785 } |
1759 glGenBuffersARB(1, &attrib_0_buffer_id_); | 1786 glGenBuffersARB(1, &attrib_0_buffer_id_); |
1760 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); | 1787 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); |
1761 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); | 1788 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); |
1762 glBindBuffer(GL_ARRAY_BUFFER, 0); | 1789 glBindBuffer(GL_ARRAY_BUFFER, 0); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1944 | 1971 |
1945 if (!InitializeShaderTranslator()) { | 1972 if (!InitializeShaderTranslator()) { |
1946 return false; | 1973 return false; |
1947 } | 1974 } |
1948 | 1975 |
1949 return true; | 1976 return true; |
1950 } | 1977 } |
1951 | 1978 |
1952 void GLES2DecoderImpl::UpdateCapabilities() { | 1979 void GLES2DecoderImpl::UpdateCapabilities() { |
1953 util_.set_num_compressed_texture_formats( | 1980 util_.set_num_compressed_texture_formats( |
1954 validators_->compressed_texture_format.GetValues().size()); | 1981 validators()->compressed_texture_format.GetValues().size()); |
1955 util_.set_num_shader_binary_formats( | 1982 util_.set_num_shader_binary_formats( |
1956 validators_->shader_binary_format.GetValues().size()); | 1983 validators()->shader_binary_format.GetValues().size()); |
1957 } | 1984 } |
1958 | 1985 |
1959 bool GLES2DecoderImpl::InitializeShaderTranslator() { | 1986 bool GLES2DecoderImpl::InitializeShaderTranslator() { |
1960 // Re-check the state of use_shader_translator_ each time this is called. | 1987 // Re-check the state of use_shader_translator_ each time this is called. |
1961 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && | 1988 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && |
1962 feature_info_->feature_flags().chromium_webglsl && | 1989 feature_info_->feature_flags().chromium_webglsl && |
1963 !use_shader_translator_) { | 1990 !use_shader_translator_) { |
1964 use_shader_translator_ = true; | 1991 use_shader_translator_ = true; |
1965 } | 1992 } |
1966 if (!use_shader_translator_) { | 1993 if (!use_shader_translator_) { |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2998 return true; | 3025 return true; |
2999 case GL_STENCIL_BITS: | 3026 case GL_STENCIL_BITS: |
3000 *num_written = 1; | 3027 *num_written = 1; |
3001 if (params) { | 3028 if (params) { |
3002 GLint v = 0; | 3029 GLint v = 0; |
3003 glGetIntegerv(GL_STENCIL_BITS, &v); | 3030 glGetIntegerv(GL_STENCIL_BITS, &v); |
3004 params[0] = BoundFramebufferHasStencilAttachment() ? v : 0; | 3031 params[0] = BoundFramebufferHasStencilAttachment() ? v : 0; |
3005 } | 3032 } |
3006 return true; | 3033 return true; |
3007 case GL_COMPRESSED_TEXTURE_FORMATS: | 3034 case GL_COMPRESSED_TEXTURE_FORMATS: |
3008 *num_written = validators_->compressed_texture_format.GetValues().size(); | 3035 *num_written = validators()->compressed_texture_format.GetValues().size(); |
3009 if (params) { | 3036 if (params) { |
3010 for (GLint ii = 0; ii < *num_written; ++ii) { | 3037 for (GLint ii = 0; ii < *num_written; ++ii) { |
3011 params[ii] = validators_->compressed_texture_format.GetValues()[ii]; | 3038 params[ii] = validators()->compressed_texture_format.GetValues()[ii]; |
3012 } | 3039 } |
3013 } | 3040 } |
3014 return true; | 3041 return true; |
3015 case GL_NUM_COMPRESSED_TEXTURE_FORMATS: | 3042 case GL_NUM_COMPRESSED_TEXTURE_FORMATS: |
3016 *num_written = 1; | 3043 *num_written = 1; |
3017 if (params) { | 3044 if (params) { |
3018 *params = validators_->compressed_texture_format.GetValues().size(); | 3045 *params = validators()->compressed_texture_format.GetValues().size(); |
3019 } | 3046 } |
3020 return true; | 3047 return true; |
3021 case GL_NUM_SHADER_BINARY_FORMATS: | 3048 case GL_NUM_SHADER_BINARY_FORMATS: |
3022 *num_written = 1; | 3049 *num_written = 1; |
3023 if (params) { | 3050 if (params) { |
3024 *params = validators_->shader_binary_format.GetValues().size(); | 3051 *params = validators()->shader_binary_format.GetValues().size(); |
3025 } | 3052 } |
3026 return true; | 3053 return true; |
3027 case GL_SHADER_BINARY_FORMATS: | 3054 case GL_SHADER_BINARY_FORMATS: |
3028 *num_written = validators_->shader_binary_format.GetValues().size(); | 3055 *num_written = validators()->shader_binary_format.GetValues().size(); |
3029 if (params) { | 3056 if (params) { |
3030 for (GLint ii = 0; ii < *num_written; ++ii) { | 3057 for (GLint ii = 0; ii < *num_written; ++ii) { |
3031 params[ii] = validators_->shader_binary_format.GetValues()[ii]; | 3058 params[ii] = validators()->shader_binary_format.GetValues()[ii]; |
3032 } | 3059 } |
3033 } | 3060 } |
3034 return true; | 3061 return true; |
3035 case GL_SHADER_COMPILER: | 3062 case GL_SHADER_COMPILER: |
3036 *num_written = 1; | 3063 *num_written = 1; |
3037 if (params) { | 3064 if (params) { |
3038 *params = GL_TRUE; | 3065 *params = GL_TRUE; |
3039 } | 3066 } |
3040 return true; | 3067 return true; |
3041 case GL_ARRAY_BUFFER_BINDING: | 3068 case GL_ARRAY_BUFFER_BINDING: |
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4392 // settings and passing GL_FIXED to it will not work. | 4419 // settings and passing GL_FIXED to it will not work. |
4393 glBindBuffer(GL_ARRAY_BUFFER, | 4420 glBindBuffer(GL_ARRAY_BUFFER, |
4394 bound_array_buffer_ ? bound_array_buffer_->service_id() : 0); | 4421 bound_array_buffer_ ? bound_array_buffer_->service_id() : 0); |
4395 } | 4422 } |
4396 | 4423 |
4397 error::Error GLES2DecoderImpl::HandleDrawArrays( | 4424 error::Error GLES2DecoderImpl::HandleDrawArrays( |
4398 uint32 immediate_data_size, const gles2::DrawArrays& c) { | 4425 uint32 immediate_data_size, const gles2::DrawArrays& c) { |
4399 GLenum mode = static_cast<GLenum>(c.mode); | 4426 GLenum mode = static_cast<GLenum>(c.mode); |
4400 GLint first = static_cast<GLint>(c.first); | 4427 GLint first = static_cast<GLint>(c.first); |
4401 GLsizei count = static_cast<GLsizei>(c.count); | 4428 GLsizei count = static_cast<GLsizei>(c.count); |
4402 if (!validators_->draw_mode.IsValid(mode)) { | 4429 if (!validators()->draw_mode.IsValid(mode)) { |
4403 SetGLError(GL_INVALID_ENUM, "glDrawArrays: mode GL_INVALID_ENUM"); | 4430 SetGLError(GL_INVALID_ENUM, "glDrawArrays: mode GL_INVALID_ENUM"); |
4404 return error::kNoError; | 4431 return error::kNoError; |
4405 } | 4432 } |
4406 if (count < 0) { | 4433 if (count < 0) { |
4407 SetGLError(GL_INVALID_VALUE, "glDrawArrays: count < 0"); | 4434 SetGLError(GL_INVALID_VALUE, "glDrawArrays: count < 0"); |
4408 return error::kNoError; | 4435 return error::kNoError; |
4409 } | 4436 } |
4410 if (!CheckFramebufferComplete("glDrawArrays")) { | 4437 if (!CheckFramebufferComplete("glDrawArrays")) { |
4411 return error::kNoError; | 4438 return error::kNoError; |
4412 } | 4439 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4461 GLenum type = c.type; | 4488 GLenum type = c.type; |
4462 int32 offset = c.index_offset; | 4489 int32 offset = c.index_offset; |
4463 if (count < 0) { | 4490 if (count < 0) { |
4464 SetGLError(GL_INVALID_VALUE, "glDrawElements: count < 0"); | 4491 SetGLError(GL_INVALID_VALUE, "glDrawElements: count < 0"); |
4465 return error::kNoError; | 4492 return error::kNoError; |
4466 } | 4493 } |
4467 if (offset < 0) { | 4494 if (offset < 0) { |
4468 SetGLError(GL_INVALID_VALUE, "glDrawElements: offset < 0"); | 4495 SetGLError(GL_INVALID_VALUE, "glDrawElements: offset < 0"); |
4469 return error::kNoError; | 4496 return error::kNoError; |
4470 } | 4497 } |
4471 if (!validators_->draw_mode.IsValid(mode)) { | 4498 if (!validators()->draw_mode.IsValid(mode)) { |
4472 SetGLError(GL_INVALID_ENUM, "glDrawElements: mode GL_INVALID_ENUM"); | 4499 SetGLError(GL_INVALID_ENUM, "glDrawElements: mode GL_INVALID_ENUM"); |
4473 return error::kNoError; | 4500 return error::kNoError; |
4474 } | 4501 } |
4475 if (!validators_->index_type.IsValid(type)) { | 4502 if (!validators()->index_type.IsValid(type)) { |
4476 SetGLError(GL_INVALID_ENUM, "glDrawElements: type GL_INVALID_ENUM"); | 4503 SetGLError(GL_INVALID_ENUM, "glDrawElements: type GL_INVALID_ENUM"); |
4477 return error::kNoError; | 4504 return error::kNoError; |
4478 } | 4505 } |
4479 | 4506 |
4480 if (!CheckFramebufferComplete("glDrawElements")) { | 4507 if (!CheckFramebufferComplete("glDrawElements")) { |
4481 return error::kNoError; | 4508 return error::kNoError; |
4482 } | 4509 } |
4483 | 4510 |
4484 if (count == 0) { | 4511 if (count == 0) { |
4485 return error::kNoError; | 4512 return error::kNoError; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5013 return error::kNoError; | 5040 return error::kNoError; |
5014 } | 5041 } |
5015 | 5042 |
5016 GLuint indx = c.indx; | 5043 GLuint indx = c.indx; |
5017 GLint size = c.size; | 5044 GLint size = c.size; |
5018 GLenum type = c.type; | 5045 GLenum type = c.type; |
5019 GLboolean normalized = c.normalized; | 5046 GLboolean normalized = c.normalized; |
5020 GLsizei stride = c.stride; | 5047 GLsizei stride = c.stride; |
5021 GLsizei offset = c.offset; | 5048 GLsizei offset = c.offset; |
5022 const void* ptr = reinterpret_cast<const void*>(offset); | 5049 const void* ptr = reinterpret_cast<const void*>(offset); |
5023 if (!validators_->vertex_attrib_type.IsValid(type)) { | 5050 if (!validators()->vertex_attrib_type.IsValid(type)) { |
5024 SetGLError(GL_INVALID_ENUM, | 5051 SetGLError(GL_INVALID_ENUM, |
5025 "glVertexAttribPointer: type GL_INVALID_ENUM"); | 5052 "glVertexAttribPointer: type GL_INVALID_ENUM"); |
5026 return error::kNoError; | 5053 return error::kNoError; |
5027 } | 5054 } |
5028 if (!validators_->vertex_attrib_size.IsValid(size)) { | 5055 if (!validators()->vertex_attrib_size.IsValid(size)) { |
5029 SetGLError(GL_INVALID_VALUE, | 5056 SetGLError(GL_INVALID_VALUE, |
5030 "glVertexAttribPointer: size GL_INVALID_VALUE"); | 5057 "glVertexAttribPointer: size GL_INVALID_VALUE"); |
5031 return error::kNoError; | 5058 return error::kNoError; |
5032 } | 5059 } |
5033 if (indx >= group_->max_vertex_attribs()) { | 5060 if (indx >= group_->max_vertex_attribs()) { |
5034 SetGLError(GL_INVALID_VALUE, "glVertexAttribPointer: index out of range"); | 5061 SetGLError(GL_INVALID_VALUE, "glVertexAttribPointer: index out of range"); |
5035 return error::kNoError; | 5062 return error::kNoError; |
5036 } | 5063 } |
5037 if (stride < 0) { | 5064 if (stride < 0) { |
5038 SetGLError(GL_INVALID_VALUE, | 5065 SetGLError(GL_INVALID_VALUE, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5095 return error::kOutOfBounds; | 5122 return error::kOutOfBounds; |
5096 } | 5123 } |
5097 void* pixels = GetSharedMemoryAs<void*>( | 5124 void* pixels = GetSharedMemoryAs<void*>( |
5098 c.pixels_shm_id, c.pixels_shm_offset, pixels_size); | 5125 c.pixels_shm_id, c.pixels_shm_offset, pixels_size); |
5099 Result* result = GetSharedMemoryAs<Result*>( | 5126 Result* result = GetSharedMemoryAs<Result*>( |
5100 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 5127 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
5101 if (!pixels || !result) { | 5128 if (!pixels || !result) { |
5102 return error::kOutOfBounds; | 5129 return error::kOutOfBounds; |
5103 } | 5130 } |
5104 | 5131 |
5105 if (!validators_->read_pixel_format.IsValid(format)) { | 5132 if (!validators()->read_pixel_format.IsValid(format)) { |
5106 SetGLError(GL_INVALID_ENUM, "glReadPixels: format GL_INVALID_ENUM"); | 5133 SetGLError(GL_INVALID_ENUM, "glReadPixels: format GL_INVALID_ENUM"); |
5107 return error::kNoError; | 5134 return error::kNoError; |
5108 } | 5135 } |
5109 if (!validators_->pixel_type.IsValid(type)) { | 5136 if (!validators()->pixel_type.IsValid(type)) { |
5110 SetGLError(GL_INVALID_ENUM, "glReadPixels: type GL_INVALID_ENUM"); | 5137 SetGLError(GL_INVALID_ENUM, "glReadPixels: type GL_INVALID_ENUM"); |
5111 return error::kNoError; | 5138 return error::kNoError; |
5112 } | 5139 } |
5113 if (width == 0 || height == 0) { | 5140 if (width == 0 || height == 0) { |
5114 return error::kNoError; | 5141 return error::kNoError; |
5115 } | 5142 } |
5116 | 5143 |
5117 CopyRealGLErrorsToWrapper(); | 5144 CopyRealGLErrorsToWrapper(); |
5118 | 5145 |
5119 ScopedResolvedFrameBufferBinder binder(this, false, true); | 5146 ScopedResolvedFrameBufferBinder binder(this, false, true); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5231 } | 5258 } |
5232 } | 5259 } |
5233 | 5260 |
5234 return error::kNoError; | 5261 return error::kNoError; |
5235 } | 5262 } |
5236 | 5263 |
5237 error::Error GLES2DecoderImpl::HandlePixelStorei( | 5264 error::Error GLES2DecoderImpl::HandlePixelStorei( |
5238 uint32 immediate_data_size, const gles2::PixelStorei& c) { | 5265 uint32 immediate_data_size, const gles2::PixelStorei& c) { |
5239 GLenum pname = c.pname; | 5266 GLenum pname = c.pname; |
5240 GLenum param = c.param; | 5267 GLenum param = c.param; |
5241 if (!validators_->pixel_store.IsValid(pname)) { | 5268 if (!validators()->pixel_store.IsValid(pname)) { |
5242 SetGLError(GL_INVALID_ENUM, "glPixelStorei: pname GL_INVALID_ENUM"); | 5269 SetGLError(GL_INVALID_ENUM, "glPixelStorei: pname GL_INVALID_ENUM"); |
5243 return error::kNoError; | 5270 return error::kNoError; |
5244 } | 5271 } |
5245 if (!validators_->pixel_store_alignment.IsValid(param)) { | 5272 if (!validators()->pixel_store_alignment.IsValid(param)) { |
5246 SetGLError(GL_INVALID_VALUE, "glPixelSTore: param GL_INVALID_VALUE"); | 5273 SetGLError(GL_INVALID_VALUE, "glPixelSTore: param GL_INVALID_VALUE"); |
5247 return error::kNoError; | 5274 return error::kNoError; |
5248 } | 5275 } |
5249 glPixelStorei(pname, param); | 5276 glPixelStorei(pname, param); |
5250 switch (pname) { | 5277 switch (pname) { |
5251 case GL_PACK_ALIGNMENT: | 5278 case GL_PACK_ALIGNMENT: |
5252 pack_alignment_ = param; | 5279 pack_alignment_ = param; |
5253 break; | 5280 break; |
5254 case GL_UNPACK_ALIGNMENT: | 5281 case GL_UNPACK_ALIGNMENT: |
5255 unpack_alignment_ = param; | 5282 unpack_alignment_ = param; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5391 if (!bucket->GetAsString(&name_str)) { | 5418 if (!bucket->GetAsString(&name_str)) { |
5392 return error::kInvalidArguments; | 5419 return error::kInvalidArguments; |
5393 } | 5420 } |
5394 return GetUniformLocationHelper( | 5421 return GetUniformLocationHelper( |
5395 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 5422 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
5396 } | 5423 } |
5397 | 5424 |
5398 error::Error GLES2DecoderImpl::HandleGetString( | 5425 error::Error GLES2DecoderImpl::HandleGetString( |
5399 uint32 immediate_data_size, const gles2::GetString& c) { | 5426 uint32 immediate_data_size, const gles2::GetString& c) { |
5400 GLenum name = static_cast<GLenum>(c.name); | 5427 GLenum name = static_cast<GLenum>(c.name); |
5401 if (!validators_->string_type.IsValid(name)) { | 5428 if (!validators()->string_type.IsValid(name)) { |
5402 SetGLError(GL_INVALID_ENUM, "glGetString: name GL_INVALID_ENUM"); | 5429 SetGLError(GL_INVALID_ENUM, "glGetString: name GL_INVALID_ENUM"); |
5403 return error::kNoError; | 5430 return error::kNoError; |
5404 } | 5431 } |
5405 const char* gl_str = reinterpret_cast<const char*>(glGetString(name)); | 5432 const char* gl_str = reinterpret_cast<const char*>(glGetString(name)); |
5406 const char* str = NULL; | 5433 const char* str = NULL; |
5407 switch (name) { | 5434 switch (name) { |
5408 case GL_VERSION: | 5435 case GL_VERSION: |
5409 str = "OpenGL ES 2.0 Chromium"; | 5436 str = "OpenGL ES 2.0 Chromium"; |
5410 break; | 5437 break; |
5411 case GL_SHADING_LANGUAGE_VERSION: | 5438 case GL_SHADING_LANGUAGE_VERSION: |
5412 str = "OpenGL ES GLSL ES 1.0 Chromium"; | 5439 str = "OpenGL ES GLSL ES 1.0 Chromium"; |
5413 break; | 5440 break; |
5414 case GL_EXTENSIONS: | 5441 case GL_EXTENSIONS: |
5415 str = feature_info_->extensions().c_str(); | 5442 str = feature_info_->extensions().c_str(); |
5416 break; | 5443 break; |
5417 default: | 5444 default: |
5418 str = gl_str; | 5445 str = gl_str; |
5419 break; | 5446 break; |
5420 } | 5447 } |
5421 Bucket* bucket = CreateBucket(c.bucket_id); | 5448 Bucket* bucket = CreateBucket(c.bucket_id); |
5422 bucket->SetFromString(str); | 5449 bucket->SetFromString(str); |
5423 return error::kNoError; | 5450 return error::kNoError; |
5424 } | 5451 } |
5425 | 5452 |
5426 void GLES2DecoderImpl::DoBufferData( | 5453 void GLES2DecoderImpl::DoBufferData( |
5427 GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage) { | 5454 GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage) { |
5428 if (!validators_->buffer_target.IsValid(target)) { | 5455 if (!validators()->buffer_target.IsValid(target)) { |
5429 SetGLError(GL_INVALID_ENUM, "glBufferData: target GL_INVALID_ENUM"); | 5456 SetGLError(GL_INVALID_ENUM, "glBufferData: target GL_INVALID_ENUM"); |
5430 return; | 5457 return; |
5431 } | 5458 } |
5432 if (!validators_->buffer_usage.IsValid(usage)) { | 5459 if (!validators()->buffer_usage.IsValid(usage)) { |
5433 SetGLError(GL_INVALID_ENUM, "glBufferData: usage GL_INVALID_ENUM"); | 5460 SetGLError(GL_INVALID_ENUM, "glBufferData: usage GL_INVALID_ENUM"); |
5434 return; | 5461 return; |
5435 } | 5462 } |
5436 if (size < 0) { | 5463 if (size < 0) { |
5437 SetGLError(GL_INVALID_VALUE, "glBufferData: size < 0"); | 5464 SetGLError(GL_INVALID_VALUE, "glBufferData: size < 0"); |
5438 return; | 5465 return; |
5439 } | 5466 } |
5440 BufferManager::BufferInfo* info = GetBufferInfoForTarget(target); | 5467 BufferManager::BufferInfo* info = GetBufferInfoForTarget(target); |
5441 if (!info) { | 5468 if (!info) { |
5442 SetGLError(GL_INVALID_VALUE, "glBufferData: unknown buffer"); | 5469 SetGLError(GL_INVALID_VALUE, "glBufferData: unknown buffer"); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5520 error::Error GLES2DecoderImpl::DoCompressedTexImage2D( | 5547 error::Error GLES2DecoderImpl::DoCompressedTexImage2D( |
5521 GLenum target, | 5548 GLenum target, |
5522 GLint level, | 5549 GLint level, |
5523 GLenum internal_format, | 5550 GLenum internal_format, |
5524 GLsizei width, | 5551 GLsizei width, |
5525 GLsizei height, | 5552 GLsizei height, |
5526 GLint border, | 5553 GLint border, |
5527 GLsizei image_size, | 5554 GLsizei image_size, |
5528 const void* data) { | 5555 const void* data) { |
5529 // TODO(gman): Validate image_size is correct for width, height and format. | 5556 // TODO(gman): Validate image_size is correct for width, height and format. |
5530 if (!validators_->texture_target.IsValid(target)) { | 5557 if (!validators()->texture_target.IsValid(target)) { |
5531 SetGLError(GL_INVALID_ENUM, | 5558 SetGLError(GL_INVALID_ENUM, |
5532 "glCompressedTexImage2D: target GL_INVALID_ENUM"); | 5559 "glCompressedTexImage2D: target GL_INVALID_ENUM"); |
5533 return error::kNoError; | 5560 return error::kNoError; |
5534 } | 5561 } |
5535 if (!validators_->compressed_texture_format.IsValid( | 5562 if (!validators()->compressed_texture_format.IsValid( |
5536 internal_format)) { | 5563 internal_format)) { |
5537 SetGLError(GL_INVALID_ENUM, | 5564 SetGLError(GL_INVALID_ENUM, |
5538 "glCompressedTexImage2D: internal_format GL_INVALID_ENUM"); | 5565 "glCompressedTexImage2D: internal_format GL_INVALID_ENUM"); |
5539 return error::kNoError; | 5566 return error::kNoError; |
5540 } | 5567 } |
5541 if (!texture_manager()->ValidForTarget( | 5568 if (!texture_manager()->ValidForTarget( |
5542 feature_info_, target, level, width, height, 1) || | 5569 feature_info_, target, level, width, height, 1) || |
5543 border != 0) { | 5570 border != 0) { |
5544 SetGLError(GL_INVALID_VALUE, | 5571 SetGLError(GL_INVALID_VALUE, |
5545 "glCompressedTexImage2D: dimensions out of range"); | 5572 "glCompressedTexImage2D: dimensions out of range"); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5631 GLint level = static_cast<GLint>(c.level); | 5658 GLint level = static_cast<GLint>(c.level); |
5632 GLint xoffset = static_cast<GLint>(c.xoffset); | 5659 GLint xoffset = static_cast<GLint>(c.xoffset); |
5633 GLint yoffset = static_cast<GLint>(c.yoffset); | 5660 GLint yoffset = static_cast<GLint>(c.yoffset); |
5634 GLsizei width = static_cast<GLsizei>(c.width); | 5661 GLsizei width = static_cast<GLsizei>(c.width); |
5635 GLsizei height = static_cast<GLsizei>(c.height); | 5662 GLsizei height = static_cast<GLsizei>(c.height); |
5636 GLenum format = static_cast<GLenum>(c.format); | 5663 GLenum format = static_cast<GLenum>(c.format); |
5637 Bucket* bucket = GetBucket(c.bucket_id); | 5664 Bucket* bucket = GetBucket(c.bucket_id); |
5638 uint32 data_size = bucket->size(); | 5665 uint32 data_size = bucket->size(); |
5639 GLsizei imageSize = data_size; | 5666 GLsizei imageSize = data_size; |
5640 const void* data = bucket->GetData(0, data_size); | 5667 const void* data = bucket->GetData(0, data_size); |
5641 if (!validators_->texture_target.IsValid(target)) { | 5668 if (!validators()->texture_target.IsValid(target)) { |
5642 SetGLError( | 5669 SetGLError( |
5643 GL_INVALID_ENUM, "glCompressedTexSubImage2D: target GL_INVALID_ENUM"); | 5670 GL_INVALID_ENUM, "glCompressedTexSubImage2D: target GL_INVALID_ENUM"); |
5644 return error::kNoError; | 5671 return error::kNoError; |
5645 } | 5672 } |
5646 if (!validators_->compressed_texture_format.IsValid(format)) { | 5673 if (!validators()->compressed_texture_format.IsValid(format)) { |
5647 SetGLError(GL_INVALID_ENUM, | 5674 SetGLError(GL_INVALID_ENUM, |
5648 "glCompressedTexSubImage2D: format GL_INVALID_ENUM"); | 5675 "glCompressedTexSubImage2D: format GL_INVALID_ENUM"); |
5649 return error::kNoError; | 5676 return error::kNoError; |
5650 } | 5677 } |
5651 if (width < 0) { | 5678 if (width < 0) { |
5652 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D: width < 0"); | 5679 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D: width < 0"); |
5653 return error::kNoError; | 5680 return error::kNoError; |
5654 } | 5681 } |
5655 if (height < 0) { | 5682 if (height < 0) { |
5656 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D: height < 0"); | 5683 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D: height < 0"); |
(...skipping 12 matching lines...) Expand all Loading... | |
5669 GLenum target, | 5696 GLenum target, |
5670 GLint level, | 5697 GLint level, |
5671 GLenum internal_format, | 5698 GLenum internal_format, |
5672 GLsizei width, | 5699 GLsizei width, |
5673 GLsizei height, | 5700 GLsizei height, |
5674 GLint border, | 5701 GLint border, |
5675 GLenum format, | 5702 GLenum format, |
5676 GLenum type, | 5703 GLenum type, |
5677 const void* pixels, | 5704 const void* pixels, |
5678 uint32 pixels_size) { | 5705 uint32 pixels_size) { |
5679 if (!validators_->texture_target.IsValid(target)) { | 5706 if (!validators()->texture_target.IsValid(target)) { |
5680 SetGLError(GL_INVALID_ENUM, "glTexImage2D: target GL_INVALID_ENUM"); | 5707 SetGLError(GL_INVALID_ENUM, "glTexImage2D: target GL_INVALID_ENUM"); |
5681 return error::kNoError; | 5708 return error::kNoError; |
5682 } | 5709 } |
5683 if (!validators_->texture_format.IsValid(internal_format)) { | 5710 if (!validators()->texture_format.IsValid(internal_format)) { |
5684 SetGLError(GL_INVALID_ENUM, | 5711 SetGLError(GL_INVALID_ENUM, |
5685 "glTexImage2D: internal_format GL_INVALID_ENUM"); | 5712 "glTexImage2D: internal_format GL_INVALID_ENUM"); |
5686 return error::kNoError; | 5713 return error::kNoError; |
5687 } | 5714 } |
5688 if (!validators_->texture_format.IsValid(format)) { | 5715 if (!validators()->texture_format.IsValid(format)) { |
5689 SetGLError(GL_INVALID_ENUM, "glTexImage2D: format GL_INVALID_ENUM"); | 5716 SetGLError(GL_INVALID_ENUM, "glTexImage2D: format GL_INVALID_ENUM"); |
5690 return error::kNoError; | 5717 return error::kNoError; |
5691 } | 5718 } |
5692 if (!validators_->pixel_type.IsValid(type)) { | 5719 if (!validators()->pixel_type.IsValid(type)) { |
5693 SetGLError(GL_INVALID_ENUM, "glTexImage2D: type GL_INVALID_ENUM"); | 5720 SetGLError(GL_INVALID_ENUM, "glTexImage2D: type GL_INVALID_ENUM"); |
5694 return error::kNoError; | 5721 return error::kNoError; |
5695 } | 5722 } |
5696 if (format != internal_format) { | 5723 if (format != internal_format) { |
5697 SetGLError(GL_INVALID_OPERATION, "glTexImage2D: format != internalFormat"); | 5724 SetGLError(GL_INVALID_OPERATION, "glTexImage2D: format != internalFormat"); |
5698 return error::kNoError; | 5725 return error::kNoError; |
5699 } | 5726 } |
5700 if (!texture_manager()->ValidForTarget( | 5727 if (!texture_manager()->ValidForTarget( |
5701 feature_info_, target, level, width, height, 1) || | 5728 feature_info_, target, level, width, height, 1) || |
5702 border != 0) { | 5729 border != 0) { |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6103 GLsizei height = static_cast<GLsizei>(c.height); | 6130 GLsizei height = static_cast<GLsizei>(c.height); |
6104 GLenum format = static_cast<GLenum>(c.format); | 6131 GLenum format = static_cast<GLenum>(c.format); |
6105 GLenum type = static_cast<GLenum>(c.type); | 6132 GLenum type = static_cast<GLenum>(c.type); |
6106 uint32 data_size; | 6133 uint32 data_size; |
6107 if (!GLES2Util::ComputeImageDataSize( | 6134 if (!GLES2Util::ComputeImageDataSize( |
6108 width, height, format, type, unpack_alignment_, &data_size)) { | 6135 width, height, format, type, unpack_alignment_, &data_size)) { |
6109 return error::kOutOfBounds; | 6136 return error::kOutOfBounds; |
6110 } | 6137 } |
6111 const void* pixels = GetSharedMemoryAs<const void*>( | 6138 const void* pixels = GetSharedMemoryAs<const void*>( |
6112 c.pixels_shm_id, c.pixels_shm_offset, data_size); | 6139 c.pixels_shm_id, c.pixels_shm_offset, data_size); |
6113 if (!validators_->texture_target.IsValid(target)) { | 6140 if (!validators()->texture_target.IsValid(target)) { |
6114 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); | 6141 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); |
6115 return error::kNoError; | 6142 return error::kNoError; |
6116 } | 6143 } |
6117 if (width < 0) { | 6144 if (width < 0) { |
6118 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); | 6145 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); |
6119 return error::kNoError; | 6146 return error::kNoError; |
6120 } | 6147 } |
6121 if (height < 0) { | 6148 if (height < 0) { |
6122 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: height < 0"); | 6149 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: height < 0"); |
6123 return error::kNoError; | 6150 return error::kNoError; |
6124 } | 6151 } |
6125 if (!validators_->texture_format.IsValid(format)) { | 6152 if (!validators()->texture_format.IsValid(format)) { |
6126 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: format GL_INVALID_ENUM"); | 6153 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: format GL_INVALID_ENUM"); |
6127 return error::kNoError; | 6154 return error::kNoError; |
6128 } | 6155 } |
6129 if (!validators_->pixel_type.IsValid(type)) { | 6156 if (!validators()->pixel_type.IsValid(type)) { |
6130 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: type GL_INVALID_ENUM"); | 6157 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: type GL_INVALID_ENUM"); |
6131 return error::kNoError; | 6158 return error::kNoError; |
6132 } | 6159 } |
6133 if (pixels == NULL) { | 6160 if (pixels == NULL) { |
6134 return error::kOutOfBounds; | 6161 return error::kOutOfBounds; |
6135 } | 6162 } |
6136 DoTexSubImage2D( | 6163 DoTexSubImage2D( |
6137 target, level, xoffset, yoffset, width, height, format, type, pixels); | 6164 target, level, xoffset, yoffset, width, height, format, type, pixels); |
6138 return error::kNoError; | 6165 return error::kNoError; |
6139 } | 6166 } |
(...skipping 12 matching lines...) Expand all Loading... | |
6152 GLsizei height = static_cast<GLsizei>(c.height); | 6179 GLsizei height = static_cast<GLsizei>(c.height); |
6153 GLenum format = static_cast<GLenum>(c.format); | 6180 GLenum format = static_cast<GLenum>(c.format); |
6154 GLenum type = static_cast<GLenum>(c.type); | 6181 GLenum type = static_cast<GLenum>(c.type); |
6155 uint32 data_size; | 6182 uint32 data_size; |
6156 if (!GLES2Util::ComputeImageDataSize( | 6183 if (!GLES2Util::ComputeImageDataSize( |
6157 width, height, format, type, unpack_alignment_, &data_size)) { | 6184 width, height, format, type, unpack_alignment_, &data_size)) { |
6158 return error::kOutOfBounds; | 6185 return error::kOutOfBounds; |
6159 } | 6186 } |
6160 const void* pixels = GetImmediateDataAs<const void*>( | 6187 const void* pixels = GetImmediateDataAs<const void*>( |
6161 c, data_size, immediate_data_size); | 6188 c, data_size, immediate_data_size); |
6162 if (!validators_->texture_target.IsValid(target)) { | 6189 if (!validators()->texture_target.IsValid(target)) { |
6163 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); | 6190 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); |
6164 return error::kNoError; | 6191 return error::kNoError; |
6165 } | 6192 } |
6166 if (width < 0) { | 6193 if (width < 0) { |
6167 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); | 6194 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); |
6168 return error::kNoError; | 6195 return error::kNoError; |
6169 } | 6196 } |
6170 if (height < 0) { | 6197 if (height < 0) { |
6171 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: height < 0"); | 6198 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: height < 0"); |
6172 return error::kNoError; | 6199 return error::kNoError; |
6173 } | 6200 } |
6174 if (!validators_->texture_format.IsValid(format)) { | 6201 if (!validators()->texture_format.IsValid(format)) { |
6175 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: format GL_INVALID_ENUM"); | 6202 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: format GL_INVALID_ENUM"); |
6176 return error::kNoError; | 6203 return error::kNoError; |
6177 } | 6204 } |
6178 if (!validators_->pixel_type.IsValid(type)) { | 6205 if (!validators()->pixel_type.IsValid(type)) { |
6179 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: type GL_INVALID_ENUM"); | 6206 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: type GL_INVALID_ENUM"); |
6180 return error::kNoError; | 6207 return error::kNoError; |
6181 } | 6208 } |
6182 if (pixels == NULL) { | 6209 if (pixels == NULL) { |
6183 return error::kOutOfBounds; | 6210 return error::kOutOfBounds; |
6184 } | 6211 } |
6185 DoTexSubImage2D( | 6212 DoTexSubImage2D( |
6186 target, level, xoffset, yoffset, width, height, format, type, pixels); | 6213 target, level, xoffset, yoffset, width, height, format, type, pixels); |
6187 return error::kNoError; | 6214 return error::kNoError; |
6188 } | 6215 } |
6189 | 6216 |
6190 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( | 6217 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( |
6191 uint32 immediate_data_size, const gles2::GetVertexAttribPointerv& c) { | 6218 uint32 immediate_data_size, const gles2::GetVertexAttribPointerv& c) { |
6192 GLuint index = static_cast<GLuint>(c.index); | 6219 GLuint index = static_cast<GLuint>(c.index); |
6193 GLenum pname = static_cast<GLenum>(c.pname); | 6220 GLenum pname = static_cast<GLenum>(c.pname); |
6194 typedef gles2::GetVertexAttribPointerv::Result Result; | 6221 typedef gles2::GetVertexAttribPointerv::Result Result; |
6195 Result* result = GetSharedMemoryAs<Result*>( | 6222 Result* result = GetSharedMemoryAs<Result*>( |
6196 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); | 6223 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); |
6197 if (!result) { | 6224 if (!result) { |
6198 return error::kOutOfBounds; | 6225 return error::kOutOfBounds; |
6199 } | 6226 } |
6200 // Check that the client initialized the result. | 6227 // Check that the client initialized the result. |
6201 if (result->size != 0) { | 6228 if (result->size != 0) { |
6202 return error::kInvalidArguments; | 6229 return error::kInvalidArguments; |
6203 } | 6230 } |
6204 if (!validators_->vertex_pointer.IsValid(pname)) { | 6231 if (!validators()->vertex_pointer.IsValid(pname)) { |
6205 SetGLError(GL_INVALID_ENUM, | 6232 SetGLError(GL_INVALID_ENUM, |
6206 "glGetVertexAttribPointerv: pname GL_INVALID_ENUM"); | 6233 "glGetVertexAttribPointerv: pname GL_INVALID_ENUM"); |
6207 return error::kNoError; | 6234 return error::kNoError; |
6208 } | 6235 } |
6209 if (index >= group_->max_vertex_attribs()) { | 6236 if (index >= group_->max_vertex_attribs()) { |
6210 SetGLError(GL_INVALID_VALUE, | 6237 SetGLError(GL_INVALID_VALUE, |
6211 "glGetVertexAttribPointerv: index out of range."); | 6238 "glGetVertexAttribPointerv: index out of range."); |
6212 return error::kNoError; | 6239 return error::kNoError; |
6213 } | 6240 } |
6214 result->SetNumResults(1); | 6241 result->SetNumResults(1); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6327 typedef gles2::GetShaderPrecisionFormat::Result Result; | 6354 typedef gles2::GetShaderPrecisionFormat::Result Result; |
6328 Result* result = GetSharedMemoryAs<Result*>( | 6355 Result* result = GetSharedMemoryAs<Result*>( |
6329 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 6356 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
6330 if (!result) { | 6357 if (!result) { |
6331 return error::kOutOfBounds; | 6358 return error::kOutOfBounds; |
6332 } | 6359 } |
6333 // Check that the client initialized the result. | 6360 // Check that the client initialized the result. |
6334 if (result->success != 0) { | 6361 if (result->success != 0) { |
6335 return error::kInvalidArguments; | 6362 return error::kInvalidArguments; |
6336 } | 6363 } |
6337 if (!validators_->shader_type.IsValid(shader_type)) { | 6364 if (!validators()->shader_type.IsValid(shader_type)) { |
6338 SetGLError(GL_INVALID_ENUM, | 6365 SetGLError(GL_INVALID_ENUM, |
6339 "glGetShaderPrecisionFormat: shader_type GL_INVALID_ENUM"); | 6366 "glGetShaderPrecisionFormat: shader_type GL_INVALID_ENUM"); |
6340 return error::kNoError; | 6367 return error::kNoError; |
6341 } | 6368 } |
6342 if (!validators_->shader_precision.IsValid(precision_type)) { | 6369 if (!validators()->shader_precision.IsValid(precision_type)) { |
6343 SetGLError(GL_INVALID_ENUM, | 6370 SetGLError(GL_INVALID_ENUM, |
6344 "glGetShaderPrecisionFormat: precision_type GL_INVALID_ENUM"); | 6371 "glGetShaderPrecisionFormat: precision_type GL_INVALID_ENUM"); |
6345 return error::kNoError; | 6372 return error::kNoError; |
6346 } | 6373 } |
6347 | 6374 |
6348 result->success = 1; // true | 6375 result->success = 1; // true |
6349 switch (precision_type) { | 6376 switch (precision_type) { |
6350 case GL_LOW_INT: | 6377 case GL_LOW_INT: |
6351 case GL_MEDIUM_INT: | 6378 case GL_MEDIUM_INT: |
6352 case GL_HIGH_INT: | 6379 case GL_HIGH_INT: |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6640 if (!bucket->GetAsString(&feature_str)) { | 6667 if (!bucket->GetAsString(&feature_str)) { |
6641 return error::kInvalidArguments; | 6668 return error::kInvalidArguments; |
6642 } | 6669 } |
6643 | 6670 |
6644 // TODO(gman): make this some kind of table to function pointer thingy. | 6671 // TODO(gman): make this some kind of table to function pointer thingy. |
6645 if (feature_str.compare("pepper3d_allow_buffers_on_multiple_targets") == 0) { | 6672 if (feature_str.compare("pepper3d_allow_buffers_on_multiple_targets") == 0) { |
6646 buffer_manager()->set_allow_buffers_on_multiple_targets(true); | 6673 buffer_manager()->set_allow_buffers_on_multiple_targets(true); |
6647 } else if (feature_str.compare("pepper3d_support_fixed_attribs") == 0) { | 6674 } else if (feature_str.compare("pepper3d_support_fixed_attribs") == 0) { |
6648 buffer_manager()->set_allow_buffers_on_multiple_targets(true); | 6675 buffer_manager()->set_allow_buffers_on_multiple_targets(true); |
6649 // TODO(gman): decide how to remove the need for this const_cast. | 6676 // TODO(gman): decide how to remove the need for this const_cast. |
6650 // I could make validators_ non const but that seems bad as this is the only | 6677 // I could make validators() non const but that seems bad as this is the onl y |
6651 // place it is needed. I could make some special friend class of validators | 6678 // place it is needed. I could make some special friend class of validators |
6652 // just to allow this to set them. That seems silly. I could refactor this | 6679 // just to allow this to set them. That seems silly. I could refactor this |
6653 // code to use the extension mechanism or the initialization attributes to | 6680 // code to use the extension mechanism or the initialization attributes to |
6654 // turn this feature on. Given that the only real point of this is to make | 6681 // turn this feature on. Given that the only real point of this is to make |
6655 // the conformance tests pass and given that there is lots of real work that | 6682 // the conformance tests pass and given that there is lots of real work that |
6656 // needs to be done it seems like refactoring for one to one of those | 6683 // needs to be done it seems like refactoring for one to one of those |
6657 // methods is a very low priority. | 6684 // methods is a very low priority. |
6658 const_cast<Validators*>(validators_)->vertex_attrib_type.AddValue(GL_FIXED); | 6685 const_cast<Validators*>(validators())->vertex_attrib_type.AddValue( |
6686 GL_FIXED); | |
6659 } else { | 6687 } else { |
6660 return error::kNoError; | 6688 return error::kNoError; |
6661 } | 6689 } |
6662 | 6690 |
6663 *result = 1; // true. | 6691 *result = 1; // true. |
6664 return error::kNoError; | 6692 return error::kNoError; |
6665 } | 6693 } |
6666 | 6694 |
6667 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( | 6695 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( |
6668 uint32 immediate_data_size, | 6696 uint32 immediate_data_size, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6828 return false; | 6856 return false; |
6829 } | 6857 } |
6830 | 6858 |
6831 // Include the auto-generated part of this file. We split this because it means | 6859 // Include the auto-generated part of this file. We split this because it means |
6832 // we can easily edit the non-auto generated parts right here in this file | 6860 // we can easily edit the non-auto generated parts right here in this file |
6833 // instead of having to edit some template or the code generator. | 6861 // instead of having to edit some template or the code generator. |
6834 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 6862 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
6835 | 6863 |
6836 } // namespace gles2 | 6864 } // namespace gles2 |
6837 } // namespace gpu | 6865 } // namespace gpu |
OLD | NEW |