diff options
author | Iago Toral Quiroga <itoral@igalia.com> | 2019-07-24 10:14:33 +0200 |
---|---|---|
committer | Iago Toral Quiroga <itoral@igalia.com> | 2019-07-26 08:29:41 +0200 |
commit | 1a99fc0fd022018ed056cd42f299d5ad1a02c264 (patch) | |
tree | 19e101f9fd7205420067c2b1896337ba6899f92c /src/gallium/drivers/v3d | |
parent | 47eb74ae00bd2d3b26d5154b99332af062107265 (diff) |
v3d: fix glDrawTransformFeedback{Instanced}()
This needs to take the vertex count from the provided transform
feedback buffer.
v2:
- don't take the vertex count from the underlying buffer, instead,
take it from a v3d subclass of pipe_stream_output_target (Eric).
Fixes piglit tests:
spec/ext_transform_feedback2/draw-auto
spec/ext_transform_feedback2/draw-auto instanced
Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/gallium/drivers/v3d')
-rw-r--r-- | src/gallium/drivers/v3d/v3d_context.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/v3d/v3dx_draw.c | 14 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h index 6cd46b9cb7a..5f19504dbae 100644 --- a/src/gallium/drivers/v3d/v3d_context.h +++ b/src/gallium/drivers/v3d/v3d_context.h @@ -561,6 +561,12 @@ v3d_stream_output_target(struct pipe_stream_output_target *ptarget) return (struct v3d_stream_output_target *)ptarget; } +static inline uint32_t +v3d_stream_output_target_get_vertex_count(struct pipe_stream_output_target *ptarget) +{ + return v3d_stream_output_target(ptarget)->recorded_vertex_count; +} + struct pipe_context *v3d_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags); void v3d_program_init(struct pipe_context *pctx); diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index 23c184be85d..c2b3ecd8a13 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -852,16 +852,26 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) info->indirect->offset); } } else if (info->instance_count > 1) { + struct pipe_stream_output_target *so = + info->count_from_stream_output; + uint32_t vert_count = so ? + v3d_stream_output_target_get_vertex_count(so) : + info->count; cl_emit(&job->bcl, VERTEX_ARRAY_INSTANCED_PRIMS, prim) { prim.mode = info->mode | prim_tf_enable; prim.index_of_first_vertex = info->start; prim.number_of_instances = info->instance_count; - prim.instance_length = info->count; + prim.instance_length = vert_count; } } else { + struct pipe_stream_output_target *so = + info->count_from_stream_output; + uint32_t vert_count = so ? + v3d_stream_output_target_get_vertex_count(so) : + info->count; cl_emit(&job->bcl, VERTEX_ARRAY_PRIMS, prim) { prim.mode = info->mode | prim_tf_enable; - prim.length = info->count; + prim.length = vert_count; prim.index_of_first_vertex = info->start; } } |