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

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

Issue 2471853002: remove 'unsafe' from ES3 apis in gpu process (Closed)
Patch Set: forgot to save file Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 return false; 471 return false;
472 } 472 }
473 473
474 uint32_t GLES2Decoder::GetAndClearBackbufferClearBitsForTest() { 474 uint32_t GLES2Decoder::GetAndClearBackbufferClearBitsForTest() {
475 return 0; 475 return 0;
476 } 476 }
477 477
478 GLES2Decoder::GLES2Decoder() 478 GLES2Decoder::GLES2Decoder()
479 : initialized_(false), 479 : initialized_(false),
480 debug_(false), 480 debug_(false),
481 log_commands_(false), 481 log_commands_(false) {
482 unsafe_es3_apis_enabled_(false) {
483 } 482 }
484 483
485 GLES2Decoder::~GLES2Decoder() { 484 GLES2Decoder::~GLES2Decoder() {
486 } 485 }
487 486
488 void GLES2Decoder::BeginDecoding() {} 487 void GLES2Decoder::BeginDecoding() {}
489 488
490 void GLES2Decoder::EndDecoding() {} 489 void GLES2Decoder::EndDecoding() {}
491 490
492 error::Error GLES2Decoder::DoCommand(unsigned int command, 491 error::Error GLES2Decoder::DoCommand(unsigned int command,
(...skipping 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after
3088 transform_feedback_manager_.reset(new TransformFeedbackManager( 3087 transform_feedback_manager_.reset(new TransformFeedbackManager(
3089 group_->max_transform_feedback_separate_attribs(), needs_emulation)); 3088 group_->max_transform_feedback_separate_attribs(), needs_emulation));
3090 3089
3091 if (feature_info_->IsWebGL2OrES3Context()) { 3090 if (feature_info_->IsWebGL2OrES3Context()) {
3092 if (!feature_info_->IsES3Capable()) { 3091 if (!feature_info_->IsES3Capable()) {
3093 LOG(ERROR) << "ES3 is blacklisted/disabled/unsupported by driver."; 3092 LOG(ERROR) << "ES3 is blacklisted/disabled/unsupported by driver.";
3094 Destroy(true); 3093 Destroy(true);
3095 return false; 3094 return false;
3096 } 3095 }
3097 feature_info_->EnableES3Validators(); 3096 feature_info_->EnableES3Validators();
3098 set_unsafe_es3_apis_enabled(true);
3099 3097
3100 frag_depth_explicitly_enabled_ = true; 3098 frag_depth_explicitly_enabled_ = true;
3101 draw_buffers_explicitly_enabled_ = true; 3099 draw_buffers_explicitly_enabled_ = true;
3102 // TODO(zmo): Look into shader_texture_lod_explicitly_enabled_ situation. 3100 // TODO(zmo): Look into shader_texture_lod_explicitly_enabled_ situation.
3103 3101
3104 // Create a fake default transform feedback and bind to it. 3102 // Create a fake default transform feedback and bind to it.
3105 GLuint default_transform_feedback = 0; 3103 GLuint default_transform_feedback = 0;
3106 glGenTransformFeedbacks(1, &default_transform_feedback); 3104 glGenTransformFeedbacks(1, &default_transform_feedback);
3107 state_.default_transform_feedback = 3105 state_.default_transform_feedback =
3108 transform_feedback_manager_->CreateTransformFeedback( 3106 transform_feedback_manager_->CreateTransformFeedback(
(...skipping 4470 matching lines...) Expand 10 before | Expand all | Expand 10 after
7579 GLenum texture_target = texture_ref->texture()->target(); 7577 GLenum texture_target = texture_ref->texture()->target();
7580 if (texture_target != GLES2Util::GLFaceTargetToTextureTarget(textarget)) { 7578 if (texture_target != GLES2Util::GLFaceTargetToTextureTarget(textarget)) {
7581 LOCAL_SET_GL_ERROR( 7579 LOCAL_SET_GL_ERROR(
7582 GL_INVALID_OPERATION, 7580 GL_INVALID_OPERATION,
7583 name, "Attachment textarget doesn't match texture target"); 7581 name, "Attachment textarget doesn't match texture target");
7584 return; 7582 return;
7585 } 7583 }
7586 service_id = texture_ref->service_id(); 7584 service_id = texture_ref->service_id();
7587 } 7585 }
7588 7586
7589 if ((level > 0 && !feature_info_->IsES3Enabled()) || 7587 if ((level > 0 && !feature_info_->IsWebGL2OrES3Context()) ||
7590 !texture_manager()->ValidForTarget(textarget, level, 0, 0, 1)) { 7588 !texture_manager()->ValidForTarget(textarget, level, 0, 0, 1)) {
7591 LOCAL_SET_GL_ERROR( 7589 LOCAL_SET_GL_ERROR(
7592 GL_INVALID_VALUE, 7590 GL_INVALID_VALUE,
7593 name, "level out of range"); 7591 name, "level out of range");
7594 return; 7592 return;
7595 } 7593 }
7596 7594
7597 if (texture_ref) 7595 if (texture_ref)
7598 DoCopyTexImageIfNeeded(texture_ref->texture(), textarget); 7596 DoCopyTexImageIfNeeded(texture_ref->texture(), textarget);
7599 7597
(...skipping 4570 matching lines...) Expand 10 before | Expand all | Expand 10 after
12170 int level, 12168 int level,
12171 unsigned format, 12169 unsigned format,
12172 unsigned type, 12170 unsigned type,
12173 int xoffset, 12171 int xoffset,
12174 int yoffset, 12172 int yoffset,
12175 int width, 12173 int width,
12176 int height) { 12174 int height) {
12177 DCHECK(target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY); 12175 DCHECK(target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY);
12178 uint32_t channels = GLES2Util::GetChannelsForFormat(format); 12176 uint32_t channels = GLES2Util::GetChannelsForFormat(format);
12179 if ((feature_info_->feature_flags().angle_depth_texture || 12177 if ((feature_info_->feature_flags().angle_depth_texture ||
12180 feature_info_->IsES3Enabled()) 12178 feature_info_->IsWebGL2OrES3Context())
12181 && (channels & GLES2Util::kDepth) != 0) { 12179 && (channels & GLES2Util::kDepth) != 0) {
12182 // It's a depth format and ANGLE doesn't allow texImage2D or texSubImage2D 12180 // It's a depth format and ANGLE doesn't allow texImage2D or texSubImage2D
12183 // on depth formats. 12181 // on depth formats.
12184 GLuint fb = 0; 12182 GLuint fb = 0;
12185 glGenFramebuffersEXT(1, &fb); 12183 glGenFramebuffersEXT(1, &fb);
12186 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb); 12184 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb);
12187 12185
12188 glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT, 12186 glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT,
12189 target, texture->service_id(), level); 12187 target, texture->service_id(), level);
12190 bool have_stencil = (channels & GLES2Util::kStencil) != 0; 12188 bool have_stencil = (channels & GLES2Util::kStencil) != 0;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
12275 unsigned target, 12273 unsigned target,
12276 int level, 12274 int level,
12277 unsigned format, 12275 unsigned format,
12278 int width, 12276 int width,
12279 int height) { 12277 int height) {
12280 DCHECK(target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY); 12278 DCHECK(target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY);
12281 // This code path can only be called if the texture was originally 12279 // This code path can only be called if the texture was originally
12282 // allocated via TexStorage2D. Note that TexStorage2D is exposed 12280 // allocated via TexStorage2D. Note that TexStorage2D is exposed
12283 // internally for ES 2.0 contexts, but compressed texture support is 12281 // internally for ES 2.0 contexts, but compressed texture support is
12284 // not part of that exposure. 12282 // not part of that exposure.
12285 DCHECK(feature_info_->IsES3Enabled()); 12283 DCHECK(feature_info_->IsWebGL2OrES3Context());
12286 12284
12287 GLsizei bytes_required = 0; 12285 GLsizei bytes_required = 0;
12288 if (!GetCompressedTexSizeInBytes( 12286 if (!GetCompressedTexSizeInBytes(
12289 "ClearCompressedTextureLevel", width, height, 1, format, 12287 "ClearCompressedTextureLevel", width, height, 1, format,
12290 &bytes_required)) { 12288 &bytes_required)) {
12291 return false; 12289 return false;
12292 } 12290 }
12293 12291
12294 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearCompressedTextureLevel", 12292 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearCompressedTextureLevel",
12295 "bytes_required", bytes_required); 12293 "bytes_required", bytes_required);
(...skipping 23 matching lines...) Expand all
12319 12317
12320 bool GLES2DecoderImpl::ClearLevel3D(Texture* texture, 12318 bool GLES2DecoderImpl::ClearLevel3D(Texture* texture,
12321 unsigned target, 12319 unsigned target,
12322 int level, 12320 int level,
12323 unsigned format, 12321 unsigned format,
12324 unsigned type, 12322 unsigned type,
12325 int width, 12323 int width,
12326 int height, 12324 int height,
12327 int depth) { 12325 int depth) {
12328 DCHECK(target == GL_TEXTURE_3D || target == GL_TEXTURE_2D_ARRAY); 12326 DCHECK(target == GL_TEXTURE_3D || target == GL_TEXTURE_2D_ARRAY);
12329 DCHECK(feature_info_->IsES3Enabled()); 12327 DCHECK(feature_info_->IsWebGL2OrES3Context());
12330 if (width == 0 || height == 0 || depth == 0) 12328 if (width == 0 || height == 0 || depth == 0)
12331 return true; 12329 return true;
12332 12330
12333 uint32_t size; 12331 uint32_t size;
12334 uint32_t padded_row_size; 12332 uint32_t padded_row_size;
12335 uint32_t padding; 12333 uint32_t padding;
12336 // Here we use unpack buffer to upload zeros into the texture, one layer 12334 // Here we use unpack buffer to upload zeros into the texture, one layer
12337 // at a time. 12335 // at a time.
12338 // We only take into consideration UNPACK_ALIGNMENT, and clear other unpack 12336 // We only take into consideration UNPACK_ALIGNMENT, and clear other unpack
12339 // parameters if necessary before TexSubImage3D calls. 12337 // parameters if necessary before TexSubImage3D calls.
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
13077 } 13075 }
13078 data = GetSharedMemoryAs<const void*>( 13076 data = GetSharedMemoryAs<const void*>(
13079 data_shm_id, data_shm_offset, image_size); 13077 data_shm_id, data_shm_offset, image_size);
13080 } 13078 }
13081 return DoCompressedTexImage(target, level, internal_format, width, height, 1, 13079 return DoCompressedTexImage(target, level, internal_format, width, height, 1,
13082 border, image_size, data, ContextState::k2D); 13080 border, image_size, data, ContextState::k2D);
13083 } 13081 }
13084 13082
13085 error::Error GLES2DecoderImpl::HandleCompressedTexImage3DBucket( 13083 error::Error GLES2DecoderImpl::HandleCompressedTexImage3DBucket(
13086 uint32_t immediate_data_size, const volatile void* cmd_data) { 13084 uint32_t immediate_data_size, const volatile void* cmd_data) {
13087 if (!unsafe_es3_apis_enabled()) 13085 if (!feature_info_->IsWebGL2OrES3Context())
13088 return error::kUnknownCommand; 13086 return error::kUnknownCommand;
13089 const volatile gles2::cmds::CompressedTexImage3DBucket& c = 13087 const volatile gles2::cmds::CompressedTexImage3DBucket& c =
13090 *static_cast<const volatile gles2::cmds::CompressedTexImage3DBucket*>( 13088 *static_cast<const volatile gles2::cmds::CompressedTexImage3DBucket*>(
13091 cmd_data); 13089 cmd_data);
13092 GLenum target = static_cast<GLenum>(c.target); 13090 GLenum target = static_cast<GLenum>(c.target);
13093 GLint level = static_cast<GLint>(c.level); 13091 GLint level = static_cast<GLint>(c.level);
13094 GLenum internal_format = static_cast<GLenum>(c.internalformat); 13092 GLenum internal_format = static_cast<GLenum>(c.internalformat);
13095 GLsizei width = static_cast<GLsizei>(c.width); 13093 GLsizei width = static_cast<GLsizei>(c.width);
13096 GLsizei height = static_cast<GLsizei>(c.height); 13094 GLsizei height = static_cast<GLsizei>(c.height);
13097 GLsizei depth = static_cast<GLsizei>(c.depth); 13095 GLsizei depth = static_cast<GLsizei>(c.depth);
13098 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); 13096 GLuint bucket_id = static_cast<GLuint>(c.bucket_id);
13099 GLint border = static_cast<GLint>(c.border); 13097 GLint border = static_cast<GLint>(c.border);
13100 13098
13101 if (state_.bound_pixel_unpack_buffer.get()) { 13099 if (state_.bound_pixel_unpack_buffer.get()) {
13102 return error::kInvalidArguments; 13100 return error::kInvalidArguments;
13103 } 13101 }
13104 Bucket* bucket = GetBucket(bucket_id); 13102 Bucket* bucket = GetBucket(bucket_id);
13105 if (!bucket) 13103 if (!bucket)
13106 return error::kInvalidArguments; 13104 return error::kInvalidArguments;
13107 uint32_t image_size = bucket->size(); 13105 uint32_t image_size = bucket->size();
13108 const void* data = bucket->GetData(0, image_size); 13106 const void* data = bucket->GetData(0, image_size);
13109 DCHECK(data || !image_size); 13107 DCHECK(data || !image_size);
13110 return DoCompressedTexImage(target, level, internal_format, width, height, 13108 return DoCompressedTexImage(target, level, internal_format, width, height,
13111 depth, border, image_size, data, 13109 depth, border, image_size, data,
13112 ContextState::k3D); 13110 ContextState::k3D);
13113 } 13111 }
13114 13112
13115 error::Error GLES2DecoderImpl::HandleCompressedTexImage3D( 13113 error::Error GLES2DecoderImpl::HandleCompressedTexImage3D(
13116 uint32_t immediate_data_size, const volatile void* cmd_data) { 13114 uint32_t immediate_data_size, const volatile void* cmd_data) {
13117 if (!unsafe_es3_apis_enabled()) 13115 if (!feature_info_->IsWebGL2OrES3Context())
13118 return error::kUnknownCommand; 13116 return error::kUnknownCommand;
13119 const volatile gles2::cmds::CompressedTexImage3D& c = 13117 const volatile gles2::cmds::CompressedTexImage3D& c =
13120 *static_cast<const volatile gles2::cmds::CompressedTexImage3D*>(cmd_data); 13118 *static_cast<const volatile gles2::cmds::CompressedTexImage3D*>(cmd_data);
13121 GLenum target = static_cast<GLenum>(c.target); 13119 GLenum target = static_cast<GLenum>(c.target);
13122 GLint level = static_cast<GLint>(c.level); 13120 GLint level = static_cast<GLint>(c.level);
13123 GLenum internal_format = static_cast<GLenum>(c.internalformat); 13121 GLenum internal_format = static_cast<GLenum>(c.internalformat);
13124 GLsizei width = static_cast<GLsizei>(c.width); 13122 GLsizei width = static_cast<GLsizei>(c.width);
13125 GLsizei height = static_cast<GLsizei>(c.height); 13123 GLsizei height = static_cast<GLsizei>(c.height);
13126 GLsizei depth = static_cast<GLsizei>(c.depth); 13124 GLsizei depth = static_cast<GLsizei>(c.depth);
13127 GLint border = static_cast<GLint>(c.border); 13125 GLint border = static_cast<GLint>(c.border);
(...skipping 14 matching lines...) Expand all
13142 data = GetSharedMemoryAs<const void*>( 13140 data = GetSharedMemoryAs<const void*>(
13143 data_shm_id, data_shm_offset, image_size); 13141 data_shm_id, data_shm_offset, image_size);
13144 } 13142 }
13145 return DoCompressedTexImage(target, level, internal_format, width, height, 13143 return DoCompressedTexImage(target, level, internal_format, width, height,
13146 depth, border, image_size, data, 13144 depth, border, image_size, data,
13147 ContextState::k3D); 13145 ContextState::k3D);
13148 } 13146 }
13149 13147
13150 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage3DBucket( 13148 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage3DBucket(
13151 uint32_t immediate_data_size, const volatile void* cmd_data) { 13149 uint32_t immediate_data_size, const volatile void* cmd_data) {
13152 if (!unsafe_es3_apis_enabled()) 13150 if (!feature_info_->IsWebGL2OrES3Context())
13153 return error::kUnknownCommand; 13151 return error::kUnknownCommand;
13154 const volatile gles2::cmds::CompressedTexSubImage3DBucket& c = 13152 const volatile gles2::cmds::CompressedTexSubImage3DBucket& c =
13155 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3DBucket*>( 13153 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3DBucket*>(
13156 cmd_data); 13154 cmd_data);
13157 GLenum target = static_cast<GLenum>(c.target); 13155 GLenum target = static_cast<GLenum>(c.target);
13158 GLint level = static_cast<GLint>(c.level); 13156 GLint level = static_cast<GLint>(c.level);
13159 GLint xoffset = static_cast<GLint>(c.xoffset); 13157 GLint xoffset = static_cast<GLint>(c.xoffset);
13160 GLint yoffset = static_cast<GLint>(c.yoffset); 13158 GLint yoffset = static_cast<GLint>(c.yoffset);
13161 GLint zoffset = static_cast<GLint>(c.zoffset); 13159 GLint zoffset = static_cast<GLint>(c.zoffset);
13162 GLsizei width = static_cast<GLsizei>(c.width); 13160 GLsizei width = static_cast<GLsizei>(c.width);
(...skipping 11 matching lines...) Expand all
13174 uint32_t image_size = bucket->size(); 13172 uint32_t image_size = bucket->size();
13175 const void* data = bucket->GetData(0, image_size); 13173 const void* data = bucket->GetData(0, image_size);
13176 DCHECK(data || !image_size); 13174 DCHECK(data || !image_size);
13177 return DoCompressedTexSubImage(target, level, xoffset, yoffset, zoffset, 13175 return DoCompressedTexSubImage(target, level, xoffset, yoffset, zoffset,
13178 width, height, depth, format, image_size, 13176 width, height, depth, format, image_size,
13179 data, ContextState::k3D); 13177 data, ContextState::k3D);
13180 } 13178 }
13181 13179
13182 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage3D( 13180 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage3D(
13183 uint32_t immediate_data_size, const volatile void* cmd_data) { 13181 uint32_t immediate_data_size, const volatile void* cmd_data) {
13184 if (!unsafe_es3_apis_enabled()) 13182 if (!feature_info_->IsWebGL2OrES3Context())
13185 return error::kUnknownCommand; 13183 return error::kUnknownCommand;
13186 const volatile gles2::cmds::CompressedTexSubImage3D& c = 13184 const volatile gles2::cmds::CompressedTexSubImage3D& c =
13187 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3D*>( 13185 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3D*>(
13188 cmd_data); 13186 cmd_data);
13189 GLenum target = static_cast<GLenum>(c.target); 13187 GLenum target = static_cast<GLenum>(c.target);
13190 GLint level = static_cast<GLint>(c.level); 13188 GLint level = static_cast<GLint>(c.level);
13191 GLint xoffset = static_cast<GLint>(c.xoffset); 13189 GLint xoffset = static_cast<GLint>(c.xoffset);
13192 GLint yoffset = static_cast<GLint>(c.yoffset); 13190 GLint yoffset = static_cast<GLint>(c.yoffset);
13193 GLint zoffset = static_cast<GLint>(c.zoffset); 13191 GLint zoffset = static_cast<GLint>(c.zoffset);
13194 GLsizei width = static_cast<GLsizei>(c.width); 13192 GLsizei width = static_cast<GLsizei>(c.width);
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
13704 } 13702 }
13705 // Check we have compatible formats. 13703 // Check we have compatible formats.
13706 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); 13704 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format);
13707 uint32_t channels_needed = GLES2Util::GetChannelsForFormat(internal_format); 13705 uint32_t channels_needed = GLES2Util::GetChannelsForFormat(internal_format);
13708 if (!channels_needed || 13706 if (!channels_needed ||
13709 (channels_needed & channels_exist) != channels_needed) { 13707 (channels_needed & channels_exist) != channels_needed) {
13710 LOCAL_SET_GL_ERROR( 13708 LOCAL_SET_GL_ERROR(
13711 GL_INVALID_OPERATION, func_name, "incompatible format"); 13709 GL_INVALID_OPERATION, func_name, "incompatible format");
13712 return false; 13710 return false;
13713 } 13711 }
13714 if (feature_info_->IsES3Enabled()) { 13712 if (feature_info_->IsWebGL2OrES3Context()) {
13715 GLint color_encoding = GetColorEncodingFromInternalFormat(read_format); 13713 GLint color_encoding = GetColorEncodingFromInternalFormat(read_format);
13716 if (color_encoding != GetColorEncodingFromInternalFormat(internal_format) || 13714 if (color_encoding != GetColorEncodingFromInternalFormat(internal_format) ||
13717 GLES2Util::IsFloatFormat(internal_format) || 13715 GLES2Util::IsFloatFormat(internal_format) ||
13718 (GLES2Util::IsSignedIntegerFormat(internal_format) != 13716 (GLES2Util::IsSignedIntegerFormat(internal_format) !=
13719 GLES2Util::IsSignedIntegerFormat(read_format)) || 13717 GLES2Util::IsSignedIntegerFormat(read_format)) ||
13720 (GLES2Util::IsUnsignedIntegerFormat(internal_format) != 13718 (GLES2Util::IsUnsignedIntegerFormat(internal_format) !=
13721 GLES2Util::IsUnsignedIntegerFormat(read_format))) { 13719 GLES2Util::IsUnsignedIntegerFormat(read_format))) {
13722 LOCAL_SET_GL_ERROR( 13720 LOCAL_SET_GL_ERROR(
13723 GL_INVALID_OPERATION, func_name, "incompatible format"); 13721 GL_INVALID_OPERATION, func_name, "incompatible format");
13724 return false; 13722 return false;
13725 } 13723 }
13726 } 13724 }
13727 if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { 13725 if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) {
13728 LOCAL_SET_GL_ERROR( 13726 LOCAL_SET_GL_ERROR(
13729 GL_INVALID_OPERATION, 13727 GL_INVALID_OPERATION,
13730 func_name, "can not be used with depth or stencil textures"); 13728 func_name, "can not be used with depth or stencil textures");
13731 return false; 13729 return false;
13732 } 13730 }
13733 if (feature_info_->IsES3Enabled()) { 13731 if (feature_info_->IsWebGL2OrES3Context()) {
13734 if (GLES2Util::IsSizedColorFormat(internal_format)) { 13732 if (GLES2Util::IsSizedColorFormat(internal_format)) {
13735 int sr, sg, sb, sa; 13733 int sr, sg, sb, sa;
13736 GLES2Util::GetColorFormatComponentSizes( 13734 GLES2Util::GetColorFormatComponentSizes(
13737 read_format, read_type, &sr, &sg, &sb, &sa); 13735 read_format, read_type, &sr, &sg, &sb, &sa);
13738 DCHECK(sr > 0 || sg > 0 || sb > 0 || sa > 0); 13736 DCHECK(sr > 0 || sg > 0 || sb > 0 || sa > 0);
13739 int dr, dg, db, da; 13737 int dr, dg, db, da;
13740 GLES2Util::GetColorFormatComponentSizes( 13738 GLES2Util::GetColorFormatComponentSizes(
13741 internal_format, 0, &dr, &dg, &db, &da); 13739 internal_format, 0, &dr, &dg, &db, &da);
13742 DCHECK(dr > 0 || dg > 0 || db > 0 || da > 0); 13740 DCHECK(dr > 0 || dg > 0 || db > 0 || da > 0);
13743 if ((dr > 0 && sr != dr) || 13741 if ((dr > 0 && sr != dr) ||
(...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after
15649 break; 15647 break;
15650 case GL_TIME_ELAPSED: 15648 case GL_TIME_ELAPSED:
15651 if (!query_manager_->GPUTimingAvailable()) { 15649 if (!query_manager_->GPUTimingAvailable()) {
15652 LOCAL_SET_GL_ERROR( 15650 LOCAL_SET_GL_ERROR(
15653 GL_INVALID_OPERATION, "glBeginQueryEXT", 15651 GL_INVALID_OPERATION, "glBeginQueryEXT",
15654 "not enabled for timing queries"); 15652 "not enabled for timing queries");
15655 return error::kNoError; 15653 return error::kNoError;
15656 } 15654 }
15657 break; 15655 break;
15658 case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 15656 case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
15659 if (feature_info_->IsES3Enabled()) { 15657 if (feature_info_->IsWebGL2OrES3Context()) {
15660 break; 15658 break;
15661 } 15659 }
15662 // Fall through. 15660 // Fall through.
15663 default: 15661 default:
15664 LOCAL_SET_GL_ERROR( 15662 LOCAL_SET_GL_ERROR(
15665 GL_INVALID_ENUM, "glBeginQueryEXT", 15663 GL_INVALID_ENUM, "glBeginQueryEXT",
15666 "unknown query target"); 15664 "unknown query target");
15667 return error::kNoError; 15665 return error::kNoError;
15668 } 15666 }
15669 15667
(...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after
18783 } 18781 }
18784 18782
18785 // Include the auto-generated part of this file. We split this because it means 18783 // Include the auto-generated part of this file. We split this because it means
18786 // we can easily edit the non-auto generated parts right here in this file 18784 // we can easily edit the non-auto generated parts right here in this file
18787 // instead of having to edit some template or the code generator. 18785 // instead of having to edit some template or the code generator.
18788 #include "base/macros.h" 18786 #include "base/macros.h"
18789 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 18787 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
18790 18788
18791 } // namespace gles2 18789 } // namespace gles2
18792 } // namespace gpu 18790 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698