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

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

Issue 2950423002: Remove WebGL2 constraint that requires draw*Instanced() calls to fail when no vertex attrib has zer… (Closed)
Patch Set: one more entry Created 3 years, 6 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 | « content/test/gpu/gpu_tests/webgl2_conformance_expectations.py ('k') | no next file » | 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/vertex_attrib_manager.h" 5 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <list> 9 #include <list>
10 10
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 if (buffer->IsClientSideArray()) { 265 if (buffer->IsClientSideArray()) {
266 // Don't disable attrib 0 since it's special. 266 // Don't disable attrib 0 since it's special.
267 if (attrib->index() > 0) { 267 if (attrib->index() > 0) {
268 glDisableVertexAttribArray(attrib->index()); 268 glDisableVertexAttribArray(attrib->index());
269 } 269 }
270 } 270 }
271 } 271 }
272 } 272 }
273 } 273 }
274 274
275 // Instanced drawing needs at least one enabled attribute with divisor zero. 275 // Due to D3D9 limitation, in ES2/WebGL1, instanced drawing needs at least
276 // one enabled attribute with divisor zero. This does not apply to D3D11,
277 // therefore, it also does not apply to ES3/WebGL2.
276 // Non-instanced drawing is fine with having no attributes at all, but if 278 // Non-instanced drawing is fine with having no attributes at all, but if
277 // there are attributes, at least one should have divisor zero. 279 // there are attributes, at least one should have divisor zero.
278 // (See ANGLE_instanced_arrays spec) 280 // (See ANGLE_instanced_arrays spec)
279 if (!divisor0 && (instanced || have_enabled_active_attribs)) { 281 if (feature_info->IsWebGL1OrES2Context() && !divisor0 &&
282 (instanced || have_enabled_active_attribs)) {
280 ERRORSTATE_SET_GL_ERROR( 283 ERRORSTATE_SET_GL_ERROR(
281 error_state, GL_INVALID_OPERATION, function_name, 284 error_state, GL_INVALID_OPERATION, function_name,
282 "attempt to draw with all attributes having non-zero divisors"); 285 "attempt to draw with all attributes having non-zero divisors");
283 return false; 286 return false;
284 } 287 }
285 288
286 if (current_buffer_id != kInitialBufferId) { 289 if (current_buffer_id != kInitialBufferId) {
287 // Restore the buffer binding. 290 // Restore the buffer binding.
288 decoder->RestoreBufferBindings(); 291 decoder->RestoreBufferBindings();
289 } 292 }
290 293
291 return true; 294 return true;
292 } 295 }
293 296
294 } // namespace gles2 297 } // namespace gles2
295 } // namespace gpu 298 } // namespace gpu
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/webgl2_conformance_expectations.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698