Mesa (master): vbo: Ignore PRIMITIVE_RESTART_FIXED_INDEX for glDrawArrays() .
Kenneth Graunke
kwg at kemper.freedesktop.org
Wed May 29 21:20:55 UTC 2013
Module: Mesa
Branch: master
Commit: 37f278000c7a1a6d15eeeed4e52cdea3063c0a0f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=37f278000c7a1a6d15eeeed4e52cdea3063c0a0f
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Sat May 25 08:19:40 2013 -0700
vbo: Ignore PRIMITIVE_RESTART_FIXED_INDEX for glDrawArrays().
The derived _PrimitiveRestart enable flag combines the PrimitiveRestart
and PrimitiveRestartFixedIndex enable flags. However, DrawArrays is not
supposed to do FixedIndex restart:
>From the OpenGL 4.3 Core specification, section 10.3.5 (page 302):
"If PRIMITIVE_RESTART_FIXED_INDEX is enabled, primitive restart is not
performed for array elements transferred by any drawing command not
taking a type parameter, including all of the *Draw* commands other
than *DrawElements*."
The OpenGL ES 3.0 specification agrees by omission:
"When DrawElements, DrawElementsInstanced, or DrawRangeElements
transfers a set of generic attribute array elements to the GL..."
Notably, DrawArrays is not included in the list of draw calls that
take PRIMITIVE_RESTART_FIXED_INDEX into consideration.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/vbo/vbo_exec_array.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index cf766af..cadb203 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -577,10 +577,10 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
prim[0].base_instance = baseInstance;
/* Implement the primitive restart index */
- if (ctx->Array._PrimitiveRestart && ctx->Array._RestartIndex < count) {
+ if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) {
GLuint primCount = 0;
- if (ctx->Array._RestartIndex == start) {
+ if (ctx->Array.RestartIndex == start) {
/* special case: RestartIndex at beginning */
if (count > 1) {
prim[0].start = start + 1;
@@ -588,7 +588,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
primCount = 1;
}
}
- else if (ctx->Array._RestartIndex == start + count - 1) {
+ else if (ctx->Array.RestartIndex == start + count - 1) {
/* special case: RestartIndex at end */
if (count > 1) {
prim[0].start = start;
@@ -599,10 +599,10 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
else {
/* general case: RestartIndex in middle, split into two prims */
prim[0].start = start;
- prim[0].count = ctx->Array._RestartIndex - start;
+ prim[0].count = ctx->Array.RestartIndex - start;
prim[1] = prim[0];
- prim[1].start = ctx->Array._RestartIndex + 1;
+ prim[1].start = ctx->Array.RestartIndex + 1;
prim[1].count = count - prim[1].start;
primCount = 2;
More information about the mesa-commit
mailing list