summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/v3d/v3dx_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/v3d/v3dx_draw.c')
-rw-r--r--src/gallium/drivers/v3d/v3dx_draw.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c
index ae9026a6fae..503475f6832 100644
--- a/src/gallium/drivers/v3d/v3dx_draw.c
+++ b/src/gallium/drivers/v3d/v3dx_draw.c
@@ -1131,7 +1131,9 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
prim_tf_enable = (V3D_PRIM_POINTS_TF - V3D_PRIM_POINTS);
#endif
- if (!v3d->prog.gs)
+ v3d->prim_restart = info->primitive_restart;
+
+ if (!v3d->prog.gs && !v3d->prim_restart)
v3d_update_primitives_generated_counter(v3d, info, &draws[0]);
uint32_t hw_prim_type = v3d_hw_prim_type(info->mode);
@@ -1258,10 +1260,16 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
/* Increment the TF offsets by how many verts we wrote. XXX: This
* needs some clamping to the buffer size.
+ *
+ * If primitive restart is enabled or we have a geometry shader, we
+ * update it later, when we can query the device to know how many
+ * vertices were written.
*/
- for (int i = 0; i < v3d->streamout.num_targets; i++)
- v3d_stream_output_target(v3d->streamout.targets[i])->offset +=
- u_stream_outputs_for_vertices(info->mode, draws[0].count);
+ if (!v3d->prog.gs && !v3d->prim_restart) {
+ for (int i = 0; i < v3d->streamout.num_targets; i++)
+ v3d_stream_output_target(v3d->streamout.targets[i])->offset +=
+ u_stream_outputs_for_vertices(info->mode, draws[0].count);
+ }
if (v3d->zsa && job->zsbuf && v3d->zsa->base.depth_enabled) {
struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture);