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

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

Issue 1827693002: Revert of Fix PRIMITIVE_RESTART_FIXED_INDEX handling in command buffer and WebGL 2.0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 8265 matching lines...) Expand 10 before | Expand all | Expand 10 after
8276 8276
8277 if (count == 0 || primcount == 0) { 8277 if (count == 0 || primcount == 0) {
8278 return error::kNoError; 8278 return error::kNoError;
8279 } 8279 }
8280 8280
8281 GLuint max_vertex_accessed; 8281 GLuint max_vertex_accessed;
8282 Buffer* element_array_buffer = 8282 Buffer* element_array_buffer =
8283 state_.vertex_attrib_manager->element_array_buffer(); 8283 state_.vertex_attrib_manager->element_array_buffer();
8284 8284
8285 if (!element_array_buffer->GetMaxValueForRange( 8285 if (!element_array_buffer->GetMaxValueForRange(
8286 offset, count, type, 8286 offset, count, type, &max_vertex_accessed)) {
8287 state_.enable_flags.primitive_restart_fixed_index,
8288 &max_vertex_accessed)) {
8289 LOCAL_SET_GL_ERROR( 8287 LOCAL_SET_GL_ERROR(
8290 GL_INVALID_OPERATION, function_name, "range out of bounds for buffer"); 8288 GL_INVALID_OPERATION, function_name, "range out of bounds for buffer");
8291 return error::kNoError; 8289 return error::kNoError;
8292 } 8290 }
8293 8291
8294 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { 8292 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) {
8295 if (!ClearUnclearedTextures()) { 8293 if (!ClearUnclearedTextures()) {
8296 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory"); 8294 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory");
8297 return error::kNoError; 8295 return error::kNoError;
8298 } 8296 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
8375 8373
8376 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM( 8374 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM(
8377 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { 8375 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) {
8378 GLuint max_vertex_accessed = 0; 8376 GLuint max_vertex_accessed = 0;
8379 Buffer* buffer = GetBuffer(buffer_id); 8377 Buffer* buffer = GetBuffer(buffer_id);
8380 if (!buffer) { 8378 if (!buffer) {
8381 // TODO(gman): Should this be a GL error or a command buffer error? 8379 // TODO(gman): Should this be a GL error or a command buffer error?
8382 LOCAL_SET_GL_ERROR( 8380 LOCAL_SET_GL_ERROR(
8383 GL_INVALID_VALUE, "GetMaxValueInBufferCHROMIUM", "unknown buffer"); 8381 GL_INVALID_VALUE, "GetMaxValueInBufferCHROMIUM", "unknown buffer");
8384 } else { 8382 } else {
8385 // The max value is used here to emulate client-side vertex
8386 // arrays, by uploading enough vertices into buffer objects to
8387 // cover the DrawElements call. Baking the primitive restart bit
8388 // into this result isn't strictly correct in all cases; the
8389 // client side code should pass down the bit and decide how to use
8390 // the result. However, the only caller makes the draw call
8391 // immediately afterward, so the state won't change between this
8392 // query and the draw call.
8393 if (!buffer->GetMaxValueForRange( 8383 if (!buffer->GetMaxValueForRange(
8394 offset, count, type, 8384 offset, count, type, &max_vertex_accessed)) {
8395 state_.enable_flags.primitive_restart_fixed_index,
8396 &max_vertex_accessed)) {
8397 // TODO(gman): Should this be a GL error or a command buffer error? 8385 // TODO(gman): Should this be a GL error or a command buffer error?
8398 LOCAL_SET_GL_ERROR( 8386 LOCAL_SET_GL_ERROR(
8399 GL_INVALID_OPERATION, 8387 GL_INVALID_OPERATION,
8400 "GetMaxValueInBufferCHROMIUM", "range out of bounds for buffer"); 8388 "GetMaxValueInBufferCHROMIUM", "range out of bounds for buffer");
8401 } 8389 }
8402 } 8390 }
8403 return max_vertex_accessed; 8391 return max_vertex_accessed;
8404 } 8392 }
8405 8393
8406 void GLES2DecoderImpl::DoShaderSource( 8394 void GLES2DecoderImpl::DoShaderSource(
(...skipping 7853 matching lines...) Expand 10 before | Expand all | Expand 10 after
16260 } 16248 }
16261 16249
16262 // Include the auto-generated part of this file. We split this because it means 16250 // Include the auto-generated part of this file. We split this because it means
16263 // we can easily edit the non-auto generated parts right here in this file 16251 // we can easily edit the non-auto generated parts right here in this file
16264 // instead of having to edit some template or the code generator. 16252 // instead of having to edit some template or the code generator.
16265 #include "base/macros.h" 16253 #include "base/macros.h"
16266 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16254 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16267 16255
16268 } // namespace gles2 16256 } // namespace gles2
16269 } // namespace gpu 16257 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698