diff options
author | Ian Romanick <[email protected]> | 2012-08-10 22:28:27 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-01-11 10:57:25 -0800 |
commit | 42ed81a7c3eec215a543c47239cc30536f284ada (patch) | |
tree | 0f71500ae3bf3a99f98f2481670a88124feb399e /src/mesa/vbo | |
parent | 00d8ad81ffeda1d2a10b1ee65f4a144467d0afd1 (diff) |
mesa/es3: Add support for GL_PRIMITIVE_RESTART_FIXED_INDEX
This requires some derived state. The cut vertex used is either the
value specified by glPrimitiveRestartIndex or it's hard-coded to ~0.
The derived state gl_array_attrib::_RestartIndex captures this value.
In addition, the derived state gl_array_attrib::_PrimitiveRestart is set
whenever either gl_array_attrib::PrimitiveRestart or
gl_array_attrib::PrimitiveRestartFixedIndex is set.
v2: Use _mesa_is_gles3.
Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 16 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_primitive_restart.c | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 4b2c5298d1c..7e61f7b31fd 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -90,8 +90,8 @@ vbo_get_minmax_index(struct gl_context *ctx, GLuint *min_index, GLuint *max_index, const GLuint count) { - const GLboolean restart = ctx->Array.PrimitiveRestart; - const GLuint restartIndex = ctx->Array.RestartIndex; + const GLboolean restart = ctx->Array._PrimitiveRestart; + const GLuint restartIndex = ctx->Array._RestartIndex; const int index_size = vbo_sizeof_ib_type(ib->type); const char *indices; GLuint i; @@ -536,7 +536,7 @@ vbo_handle_primitive_restart(struct gl_context *ctx, if ((ib != NULL) && ctx->Const.PrimitiveRestartInSoftware && - ctx->Array.PrimitiveRestart) { + ctx->Array._PrimitiveRestart) { /* Handle primitive restart in software */ vbo_sw_primitive_restart(ctx, prim, nr_prims, ib); } else { @@ -572,10 +572,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; @@ -583,7 +583,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; @@ -594,10 +594,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; diff --git a/src/mesa/vbo/vbo_primitive_restart.c b/src/mesa/vbo/vbo_primitive_restart.c index 6f9d61c9bbc..a6a0149ca63 100644 --- a/src/mesa/vbo/vbo_primitive_restart.c +++ b/src/mesa/vbo/vbo_primitive_restart.c @@ -171,7 +171,7 @@ vbo_sw_primitive_restart(struct gl_context *ctx, GLuint sub_prim_num; GLuint end_index; GLuint sub_end_index; - GLuint restart_index = ctx->Array.RestartIndex; + GLuint restart_index = ctx->Array._RestartIndex; struct _mesa_prim temp_prim; struct vbo_context *vbo = vbo_context(ctx); vbo_draw_func draw_prims_func = vbo->draw_prims; |