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

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: rebase 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 7146 matching lines...) Expand 10 before | Expand all | Expand 10 after
7157 state_.viewport_height = std::min(height, viewport_max_height_); 7157 state_.viewport_height = std::min(height, viewport_max_height_);
7158 glViewport(x, y, width, height); 7158 glViewport(x, y, width, height);
7159 } 7159 }
7160 7160
7161 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( 7161 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE(
7162 uint32 immediate_data_size, const cmds::VertexAttribDivisorANGLE& c) { 7162 uint32 immediate_data_size, const cmds::VertexAttribDivisorANGLE& c) {
7163 if (!features().angle_instanced_arrays) { 7163 if (!features().angle_instanced_arrays) {
7164 LOCAL_SET_GL_ERROR( 7164 LOCAL_SET_GL_ERROR(
7165 GL_INVALID_OPERATION, 7165 GL_INVALID_OPERATION,
7166 "glVertexAttribDivisorANGLE", "function not available"); 7166 "glVertexAttribDivisorANGLE", "function not available");
7167 return error::kNoError;
7167 } 7168 }
7168 GLuint index = c.index; 7169 GLuint index = c.index;
7169 GLuint divisor = c.divisor; 7170 GLuint divisor = c.divisor;
7170 if (index >= group_->max_vertex_attribs()) { 7171 if (index >= group_->max_vertex_attribs()) {
7171 LOCAL_SET_GL_ERROR( 7172 LOCAL_SET_GL_ERROR(
7172 GL_INVALID_VALUE, 7173 GL_INVALID_VALUE,
7173 "glVertexAttribDivisorANGLE", "index out of range"); 7174 "glVertexAttribDivisorANGLE", "index out of range");
7174 return error::kNoError; 7175 return error::kNoError;
7175 } 7176 }
7176 7177
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
8382 if (!texture_ref) { 8383 if (!texture_ref) {
8383 LOCAL_SET_GL_ERROR( 8384 LOCAL_SET_GL_ERROR(
8384 GL_INVALID_OPERATION, 8385 GL_INVALID_OPERATION,
8385 "glCopyTexImage2D", "unknown texture for target"); 8386 "glCopyTexImage2D", "unknown texture for target");
8386 return; 8387 return;
8387 } 8388 }
8388 Texture* texture = texture_ref->texture(); 8389 Texture* texture = texture_ref->texture();
8389 if (texture->IsImmutable()) { 8390 if (texture->IsImmutable()) {
8390 LOCAL_SET_GL_ERROR( 8391 LOCAL_SET_GL_ERROR(
8391 GL_INVALID_OPERATION, "glCopyTexImage2D", "texture is immutable"); 8392 GL_INVALID_OPERATION, "glCopyTexImage2D", "texture is immutable");
8393 return;
8392 } 8394 }
8393 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || 8395 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) ||
8394 border != 0) { 8396 border != 0) {
8395 LOCAL_SET_GL_ERROR( 8397 LOCAL_SET_GL_ERROR(
8396 GL_INVALID_VALUE, "glCopyTexImage2D", "dimensions out of range"); 8398 GL_INVALID_VALUE, "glCopyTexImage2D", "dimensions out of range");
8397 return; 8399 return;
8398 } 8400 }
8399 if (!texture_manager()->ValidateFormatAndTypeCombination( 8401 if (!texture_manager()->ValidateFormatAndTypeCombination(
8400 state_.GetErrorState(), "glCopyTexImage2D", internal_format, 8402 state_.GetErrorState(), "glCopyTexImage2D", internal_format,
8401 GL_UNSIGNED_BYTE)) { 8403 GL_UNSIGNED_BYTE)) {
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
9441 reset_status_ = reset_status; 9443 reset_status_ = reset_status;
9442 current_decoder_error_ = error::kLostContext; 9444 current_decoder_error_ = error::kLostContext;
9443 } 9445 }
9444 9446
9445 error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM( 9447 error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM(
9446 uint32 immediate_data_size, const cmds::LoseContextCHROMIUM& c) { 9448 uint32 immediate_data_size, const cmds::LoseContextCHROMIUM& c) {
9447 GLenum current = static_cast<GLenum>(c.current); 9449 GLenum current = static_cast<GLenum>(c.current);
9448 GLenum other = static_cast<GLenum>(c.other); 9450 GLenum other = static_cast<GLenum>(c.other);
9449 if (!validators_->reset_status.IsValid(current)) { 9451 if (!validators_->reset_status.IsValid(current)) {
9450 LOCAL_SET_GL_ERROR_INVALID_ENUM( 9452 LOCAL_SET_GL_ERROR_INVALID_ENUM(
9451 "glLoseContextCHROMIUM", current, "current"); 9453 "glLoseContextCHROMIUM", current, "current");
piman 2014/05/21 17:00:35 return here too?
9452 } 9454 }
9453 if (!validators_->reset_status.IsValid(other)) { 9455 if (!validators_->reset_status.IsValid(other)) {
9454 LOCAL_SET_GL_ERROR_INVALID_ENUM("glLoseContextCHROMIUM", other, "other"); 9456 LOCAL_SET_GL_ERROR_INVALID_ENUM("glLoseContextCHROMIUM", other, "other");
piman 2014/05/21 17:00:35 And here?
9455 } 9457 }
9456 group_->LoseContexts(other); 9458 group_->LoseContexts(other);
9457 reset_status_ = current; 9459 reset_status_ = current;
9458 current_decoder_error_ = error::kLostContext; 9460 current_decoder_error_ = error::kLostContext;
9459 return error::kLostContext; 9461 return error::kLostContext;
9460 } 9462 }
9461 9463
9462 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( 9464 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM(
9463 uint32 immediate_data_size, const cmds::InsertSyncPointCHROMIUM& c) { 9465 uint32 immediate_data_size, const cmds::InsertSyncPointCHROMIUM& c) {
9464 return error::kUnknownCommand; 9466 return error::kUnknownCommand;
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
10767 } 10769 }
10768 } 10770 }
10769 10771
10770 // Include the auto-generated part of this file. We split this because it means 10772 // Include the auto-generated part of this file. We split this because it means
10771 // we can easily edit the non-auto generated parts right here in this file 10773 // we can easily edit the non-auto generated parts right here in this file
10772 // instead of having to edit some template or the code generator. 10774 // instead of having to edit some template or the code generator.
10773 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10775 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10774 10776
10775 } // namespace gles2 10777 } // namespace gles2
10776 } // namespace gpu 10778 } // 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