summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-04-07 18:24:44 +0200
committerNicolai Hähnle <[email protected]>2017-04-19 08:11:07 +0200
commit51deba0eb35d0d27560bb7dad24b8d39abb58be6 (patch)
tree4b0c533b06cb4c2abc720c9baba86e1d46485d58 /src/mesa/vbo
parent42d5465b9ba85b4918b9e6fb57994720e3c8a80b (diff)
vbo: fix gl_DrawID handling in glMultiDrawArrays
Fixes a bug in KHR-GL45.shader_draw_parameters_tests.ShaderMultiDrawArraysParameters. Cc: [email protected] Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r--src/mesa/vbo/vbo_exec_array.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 6858eb30b73..e5eeae44ece 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -404,7 +404,8 @@ vbo_bind_arrays(struct gl_context *ctx)
*/
static void
vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
- GLsizei count, GLuint numInstances, GLuint baseInstance)
+ GLsizei count, GLuint numInstances, GLuint baseInstance,
+ GLuint drawID)
{
struct vbo_context *vbo = vbo_context(ctx);
struct _mesa_prim prim[2];
@@ -420,6 +421,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
prim[0].mode = mode;
prim[0].num_instances = numInstances;
prim[0].base_instance = baseInstance;
+ prim[0].draw_id = drawID;
prim[0].is_indirect = 0;
prim[0].start = start;
prim[0].count = count;
@@ -572,7 +574,7 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
if (0)
check_draw_arrays_data(ctx, start, count);
- vbo_draw_arrays(ctx, mode, start, count, 1, 0);
+ vbo_draw_arrays(ctx, mode, start, count, 1, 0, 0);
if (0)
print_draw_arrays(ctx, mode, start, count);
@@ -600,7 +602,7 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
if (0)
check_draw_arrays_data(ctx, start, count);
- vbo_draw_arrays(ctx, mode, start, count, numInstances, 0);
+ vbo_draw_arrays(ctx, mode, start, count, numInstances, 0, 0);
if (0)
print_draw_arrays(ctx, mode, start, count);
@@ -630,7 +632,7 @@ vbo_exec_DrawArraysInstancedBaseInstance(GLenum mode, GLint first,
if (0)
check_draw_arrays_data(ctx, first, count);
- vbo_draw_arrays(ctx, mode, first, count, numInstances, baseInstance);
+ vbo_draw_arrays(ctx, mode, first, count, numInstances, baseInstance, 0);
if (0)
print_draw_arrays(ctx, mode, first, count);
@@ -660,7 +662,14 @@ vbo_exec_MultiDrawArrays(GLenum mode, const GLint *first,
if (0)
check_draw_arrays_data(ctx, first[i], count[i]);
- vbo_draw_arrays(ctx, mode, first[i], count[i], 1, 0);
+ /* The GL_ARB_shader_draw_parameters spec adds the following after the
+ * pseudo-code describing glMultiDrawArrays:
+ *
+ * "The index of the draw (<i> in the above pseudo-code) may be
+ * read by a vertex shader as <gl_DrawIDARB>, as described in
+ * Section 11.1.3.9."
+ */
+ vbo_draw_arrays(ctx, mode, first[i], count[i], 1, 0, i);
if (0)
print_draw_arrays(ctx, mode, first[i], count[i]);
@@ -1262,7 +1271,7 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
!_mesa_all_varyings_in_vbos(ctx->Array.VAO))) {
GLsizei n =
ctx->Driver.GetTransformFeedbackVertexCount(ctx, obj, stream);
- vbo_draw_arrays(ctx, mode, 0, n, numInstances, 0);
+ vbo_draw_arrays(ctx, mode, 0, n, numInstances, 0, 0);
return;
}