summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/v3d
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2019-07-24 09:59:25 +0200
committerIago Toral Quiroga <[email protected]>2019-07-26 08:29:41 +0200
commit47eb74ae00bd2d3b26d5154b99332af062107265 (patch)
tree261c2375888cbc2803e10c418b4563012c30a5b7 /src/gallium/drivers/v3d
parent39df568ca1c62929044bce4967ad0f17eeb35d36 (diff)
v3d: subclass pipe_streamout_output_target to record TF vertices written
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/gallium/drivers/v3d')
-rw-r--r--src/gallium/drivers/v3d/v3d_context.h12
-rw-r--r--src/gallium/drivers/v3d/v3dx_draw.c5
-rw-r--r--src/gallium/drivers/v3d/v3dx_state.c16
3 files changed, 25 insertions, 8 deletions
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h
index a9162ba8b1f..6cd46b9cb7a 100644
--- a/src/gallium/drivers/v3d/v3d_context.h
+++ b/src/gallium/drivers/v3d/v3d_context.h
@@ -229,6 +229,12 @@ struct v3d_vertex_stateobj {
uint32_t defaults_offset;
};
+struct v3d_stream_output_target {
+ struct pipe_stream_output_target base;
+ /* Number of transform feedback vertices written to this target */
+ uint32_t recorded_vertex_count;
+};
+
struct v3d_streamout_stateobj {
struct pipe_stream_output_target *targets[PIPE_MAX_SO_BUFFERS];
/* Number of vertices we've written into the buffer so far. */
@@ -549,6 +555,12 @@ v3d_sampler_state(struct pipe_sampler_state *psampler)
return (struct v3d_sampler_state *)psampler;
}
+static inline struct v3d_stream_output_target *
+v3d_stream_output_target(struct pipe_stream_output_target *ptarget)
+{
+ return (struct v3d_stream_output_target *)ptarget;
+}
+
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 c78ccdef867..23c184be85d 100644
--- a/src/gallium/drivers/v3d/v3dx_draw.c
+++ b/src/gallium/drivers/v3d/v3dx_draw.c
@@ -563,6 +563,11 @@ v3d_tf_statistics_record(struct v3d_context *v3d,
/* XXX: Only count if we didn't overflow. */
v3d->tf_prims_generated += prims;
+ for (int i = 0; i < v3d->streamout.num_targets; i++) {
+ struct v3d_stream_output_target *target =
+ v3d_stream_output_target(v3d->streamout.targets[i]);
+ target->recorded_vertex_count += info->count;
+ }
}
static void
diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c
index 3be522a3fb7..1222768afdc 100644
--- a/src/gallium/drivers/v3d/v3dx_state.c
+++ b/src/gallium/drivers/v3d/v3dx_state.c
@@ -1186,20 +1186,20 @@ v3d_create_stream_output_target(struct pipe_context *pctx,
unsigned buffer_offset,
unsigned buffer_size)
{
- struct pipe_stream_output_target *target;
+ struct v3d_stream_output_target *target;
- target = CALLOC_STRUCT(pipe_stream_output_target);
+ target = CALLOC_STRUCT(v3d_stream_output_target);
if (!target)
return NULL;
- pipe_reference_init(&target->reference, 1);
- pipe_resource_reference(&target->buffer, prsc);
+ pipe_reference_init(&target->base.reference, 1);
+ pipe_resource_reference(&target->base.buffer, prsc);
- target->context = pctx;
- target->buffer_offset = buffer_offset;
- target->buffer_size = buffer_size;
+ target->base.context = pctx;
+ target->base.buffer_offset = buffer_offset;
+ target->base.buffer_size = buffer_size;
- return target;
+ return &target->base;
}
static void