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

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

Issue 1813163003: 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: Refactored and expanded unittests. 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, &max_vertex_accessed)) { 8286 offset, count, type,
8287 state_.enable_flags.primitive_restart_fixed_index,
8288 &max_vertex_accessed)) {
8287 LOCAL_SET_GL_ERROR( 8289 LOCAL_SET_GL_ERROR(
8288 GL_INVALID_OPERATION, function_name, "range out of bounds for buffer"); 8290 GL_INVALID_OPERATION, function_name, "range out of bounds for buffer");
8289 return error::kNoError; 8291 return error::kNoError;
8290 } 8292 }
8291 8293
8292 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { 8294 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) {
8293 if (!ClearUnclearedTextures()) { 8295 if (!ClearUnclearedTextures()) {
8294 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory"); 8296 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory");
8295 return error::kNoError; 8297 return error::kNoError;
8296 } 8298 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
8373 8375
8374 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM( 8376 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM(
8375 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { 8377 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) {
8376 GLuint max_vertex_accessed = 0; 8378 GLuint max_vertex_accessed = 0;
8377 Buffer* buffer = GetBuffer(buffer_id); 8379 Buffer* buffer = GetBuffer(buffer_id);
8378 if (!buffer) { 8380 if (!buffer) {
8379 // TODO(gman): Should this be a GL error or a command buffer error? 8381 // TODO(gman): Should this be a GL error or a command buffer error?
8380 LOCAL_SET_GL_ERROR( 8382 LOCAL_SET_GL_ERROR(
8381 GL_INVALID_VALUE, "GetMaxValueInBufferCHROMIUM", "unknown buffer"); 8383 GL_INVALID_VALUE, "GetMaxValueInBufferCHROMIUM", "unknown buffer");
8382 } else { 8384 } 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.
8383 if (!buffer->GetMaxValueForRange( 8393 if (!buffer->GetMaxValueForRange(
8384 offset, count, type, &max_vertex_accessed)) { 8394 offset, count, type,
8395 state_.enable_flags.primitive_restart_fixed_index,
8396 &max_vertex_accessed)) {
8385 // TODO(gman): Should this be a GL error or a command buffer error? 8397 // TODO(gman): Should this be a GL error or a command buffer error?
8386 LOCAL_SET_GL_ERROR( 8398 LOCAL_SET_GL_ERROR(
8387 GL_INVALID_OPERATION, 8399 GL_INVALID_OPERATION,
8388 "GetMaxValueInBufferCHROMIUM", "range out of bounds for buffer"); 8400 "GetMaxValueInBufferCHROMIUM", "range out of bounds for buffer");
8389 } 8401 }
8390 } 8402 }
8391 return max_vertex_accessed; 8403 return max_vertex_accessed;
8392 } 8404 }
8393 8405
8394 void GLES2DecoderImpl::DoShaderSource( 8406 void GLES2DecoderImpl::DoShaderSource(
(...skipping 7853 matching lines...) Expand 10 before | Expand all | Expand 10 after
16248 } 16260 }
16249 16261
16250 // Include the auto-generated part of this file. We split this because it means 16262 // Include the auto-generated part of this file. We split this because it means
16251 // we can easily edit the non-auto generated parts right here in this file 16263 // we can easily edit the non-auto generated parts right here in this file
16252 // instead of having to edit some template or the code generator. 16264 // instead of having to edit some template or the code generator.
16253 #include "base/macros.h" 16265 #include "base/macros.h"
16254 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16266 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16255 16267
16256 } // namespace gles2 16268 } // namespace gles2
16257 } // namespace gpu 16269 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698