[Mesa-dev] [PATCH] mesa/draw_indirect: fix index bounds
Christoph Bumiller
e0425955 at student.tuwien.ac.at
Fri Apr 5 06:09:16 PDT 2013
(Will be merged into the original patches.)
Calculating the actual limits is impossible, and softpipe drops
vertices that lie outside the specified range.
---
src/gallium/auxiliary/util/u_draw.c | 4 ++++
src/mesa/state_tracker/st_draw.c | 3 +++
src/mesa/vbo/vbo_exec_array.c | 8 ++++----
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_draw.c b/src/gallium/auxiliary/util/u_draw.c
index b9f8fcd..d13ccd4 100644
--- a/src/gallium/auxiliary/util/u_draw.c
+++ b/src/gallium/auxiliary/util/u_draw.c
@@ -161,6 +161,10 @@ util_draw_indirect(struct pipe_context *pipe,
info.index_bias = info_in->indexed ? params[3] : 0;
info.start_instance = info_in->indexed ? params[4] : params[3];
info.indirect = NULL;
+ if (!info_in->indexed) {
+ info.min_index = info.start;
+ info.max_index = info.start + info.count - 1;
+ }
pipe_buffer_unmap(pipe, transfer);
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index a07f8be..64470f7 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -273,6 +273,9 @@ st_draw_vbo(struct gl_context *ctx,
info.instance_count = prims[i].num_instances;
info.index_bias = prims[i].basevertex;
if (!ib) {
+ /* NOTE: For indirect drawing, max_index correctly evaluates to ~0,
+ * since start and count will be 0.
+ */
info.min_index = info.start;
info.max_index = info.start + info.count - 1;
}
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 75fda00..ba70b5b 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -1382,7 +1382,7 @@ vbo_validated_drawarraysindirect(struct gl_context *ctx,
check_buffers_are_unmapped(exec->array.inputs);
vbo->draw_prims(ctx, prim, 1,
- NULL, GL_TRUE, 0, 0,
+ NULL, GL_TRUE, 0, ~0,
NULL,
ctx->DrawIndirectBuffer);
@@ -1422,7 +1422,7 @@ vbo_validated_multidrawarraysindirect(struct gl_context *ctx,
check_buffers_are_unmapped(exec->array.inputs);
vbo->draw_prims(ctx, prim, primcount,
- NULL, GL_TRUE, 0, 0,
+ NULL, GL_TRUE, 0, ~0,
NULL,
ctx->DrawIndirectBuffer);
@@ -1458,7 +1458,7 @@ vbo_validated_drawelementsindirect(struct gl_context *ctx,
check_buffers_are_unmapped(exec->array.inputs);
vbo->draw_prims(ctx, prim, 1,
- &ib, GL_TRUE, 0, 0,
+ &ib, GL_TRUE, 0, ~0,
NULL,
ctx->DrawIndirectBuffer);
@@ -1507,7 +1507,7 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx,
check_buffers_are_unmapped(exec->array.inputs);
vbo->draw_prims(ctx, prim, primcount,
- &ib, GL_TRUE, 0, 0,
+ &ib, GL_TRUE, 0, ~0,
NULL,
ctx->DrawIndirectBuffer);
--
1.7.3.4
More information about the mesa-dev
mailing list