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

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

Issue 285703005: Return early after errors in glVertexAttribDivisor and glCopyTexImage2D implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 7179 matching lines...) Expand 10 before | Expand all | Expand 10 after
7190 state_.viewport_height = std::min(height, viewport_max_height_); 7190 state_.viewport_height = std::min(height, viewport_max_height_);
7191 glViewport(x, y, width, height); 7191 glViewport(x, y, width, height);
7192 } 7192 }
7193 7193
7194 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( 7194 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE(
7195 uint32 immediate_data_size, const cmds::VertexAttribDivisorANGLE& c) { 7195 uint32 immediate_data_size, const cmds::VertexAttribDivisorANGLE& c) {
7196 if (!features().angle_instanced_arrays) { 7196 if (!features().angle_instanced_arrays) {
7197 LOCAL_SET_GL_ERROR( 7197 LOCAL_SET_GL_ERROR(
7198 GL_INVALID_OPERATION, 7198 GL_INVALID_OPERATION,
7199 "glVertexAttribDivisorANGLE", "function not available"); 7199 "glVertexAttribDivisorANGLE", "function not available");
7200 return error::kNoError;
7200 } 7201 }
7201 GLuint index = c.index; 7202 GLuint index = c.index;
7202 GLuint divisor = c.divisor; 7203 GLuint divisor = c.divisor;
7203 if (index >= group_->max_vertex_attribs()) { 7204 if (index >= group_->max_vertex_attribs()) {
7204 LOCAL_SET_GL_ERROR( 7205 LOCAL_SET_GL_ERROR(
7205 GL_INVALID_VALUE, 7206 GL_INVALID_VALUE,
7206 "glVertexAttribDivisorANGLE", "index out of range"); 7207 "glVertexAttribDivisorANGLE", "index out of range");
7207 return error::kNoError; 7208 return error::kNoError;
7208 } 7209 }
7209 7210
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
8414 if (!texture_ref) { 8415 if (!texture_ref) {
8415 LOCAL_SET_GL_ERROR( 8416 LOCAL_SET_GL_ERROR(
8416 GL_INVALID_OPERATION, 8417 GL_INVALID_OPERATION,
8417 "glCopyTexImage2D", "unknown texture for target"); 8418 "glCopyTexImage2D", "unknown texture for target");
8418 return; 8419 return;
8419 } 8420 }
8420 Texture* texture = texture_ref->texture(); 8421 Texture* texture = texture_ref->texture();
8421 if (texture->IsImmutable()) { 8422 if (texture->IsImmutable()) {
8422 LOCAL_SET_GL_ERROR( 8423 LOCAL_SET_GL_ERROR(
8423 GL_INVALID_OPERATION, "glCopyTexImage2D", "texture is immutable"); 8424 GL_INVALID_OPERATION, "glCopyTexImage2D", "texture is immutable");
8425 return;
8424 } 8426 }
8425 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || 8427 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) ||
8426 border != 0) { 8428 border != 0) {
8427 LOCAL_SET_GL_ERROR( 8429 LOCAL_SET_GL_ERROR(
8428 GL_INVALID_VALUE, "glCopyTexImage2D", "dimensions out of range"); 8430 GL_INVALID_VALUE, "glCopyTexImage2D", "dimensions out of range");
8429 return; 8431 return;
8430 } 8432 }
8431 if (!texture_manager()->ValidateFormatAndTypeCombination( 8433 if (!texture_manager()->ValidateFormatAndTypeCombination(
8432 state_.GetErrorState(), "glCopyTexImage2D", internal_format, 8434 state_.GetErrorState(), "glCopyTexImage2D", internal_format,
8433 GL_UNSIGNED_BYTE)) { 8435 GL_UNSIGNED_BYTE)) {
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
9472 reset_status_ = reset_status; 9474 reset_status_ = reset_status;
9473 current_decoder_error_ = error::kLostContext; 9475 current_decoder_error_ = error::kLostContext;
9474 } 9476 }
9475 9477
9476 error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM( 9478 error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM(
9477 uint32 immediate_data_size, const cmds::LoseContextCHROMIUM& c) { 9479 uint32 immediate_data_size, const cmds::LoseContextCHROMIUM& c) {
9478 GLenum current = static_cast<GLenum>(c.current); 9480 GLenum current = static_cast<GLenum>(c.current);
9479 GLenum other = static_cast<GLenum>(c.other); 9481 GLenum other = static_cast<GLenum>(c.other);
9480 if (!validators_->reset_status.IsValid(current)) { 9482 if (!validators_->reset_status.IsValid(current)) {
9481 LOCAL_SET_GL_ERROR_INVALID_ENUM( 9483 LOCAL_SET_GL_ERROR_INVALID_ENUM(
9482 "glLoseContextCHROMIUM", current, "current"); 9484 "glLoseContextCHROMIUM", current, "current");
vmiura 2014/05/21 04:56:57 Here too.
Kimmo Kinnunen 2014/05/21 07:15:41 There seems to be a bug wrt lose context error sta
9483 } 9485 }
9484 if (!validators_->reset_status.IsValid(other)) { 9486 if (!validators_->reset_status.IsValid(other)) {
9485 LOCAL_SET_GL_ERROR_INVALID_ENUM("glLoseContextCHROMIUM", other, "other"); 9487 LOCAL_SET_GL_ERROR_INVALID_ENUM("glLoseContextCHROMIUM", other, "other");
vmiura 2014/05/21 04:56:57 Here too.
9486 } 9488 }
9487 group_->LoseContexts(other); 9489 group_->LoseContexts(other);
9488 reset_status_ = current; 9490 reset_status_ = current;
9489 current_decoder_error_ = error::kLostContext; 9491 current_decoder_error_ = error::kLostContext;
9490 return error::kLostContext; 9492 return error::kLostContext;
9491 } 9493 }
9492 9494
9493 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( 9495 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM(
9494 uint32 immediate_data_size, const cmds::InsertSyncPointCHROMIUM& c) { 9496 uint32 immediate_data_size, const cmds::InsertSyncPointCHROMIUM& c) {
9495 return error::kUnknownCommand; 9497 return error::kUnknownCommand;
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
10797 } 10799 }
10798 } 10800 }
10799 10801
10800 // Include the auto-generated part of this file. We split this because it means 10802 // Include the auto-generated part of this file. We split this because it means
10801 // we can easily edit the non-auto generated parts right here in this file 10803 // we can easily edit the non-auto generated parts right here in this file
10802 // instead of having to edit some template or the code generator. 10804 // instead of having to edit some template or the code generator.
10803 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10805 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10804 10806
10805 } // namespace gles2 10807 } // namespace gles2
10806 } // namespace gpu 10808 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698