diff options
author | Iago Toral Quiroga <[email protected]> | 2019-06-19 09:48:12 +0200 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2019-06-21 08:06:13 +0200 |
commit | eb44dcc219fe1b224a548341c51337e810942455 (patch) | |
tree | 1b682c5f0626f5083afd17c46b8af79874ebc55f /src/gallium/drivers/v3d | |
parent | 42572f2f7df91f65ac31145380cd9d170ba4b783 (diff) |
v3d: flush jobs reading from transform feedback output buffers
If we are about to write to a transform feedback buffer, we should
make sure that we flush any prior work that intended to read from
any of these buffers.
Fixes piglit test:
spec/ext_transform_feedback/immediate-reuse
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/gallium/drivers/v3d')
-rw-r--r-- | src/gallium/drivers/v3d/v3dx_draw.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index 629f35a8d7f..98f630766ca 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -180,6 +180,26 @@ v3d_predraw_check_stage_inputs(struct pipe_context *pctx, } static void +v3d_predraw_check_outputs(struct pipe_context *pctx) +{ + struct v3d_context *v3d = v3d_context(pctx); + + /* Flush jobs reading from TF buffers that we are about to write. */ + if (v3d_transform_feedback_enabled(v3d)) { + struct v3d_streamout_stateobj *so = &v3d->streamout; + + for (int i = 0; i < so->num_targets; i++) { + if (!so->targets[i]) + continue; + + const struct pipe_stream_output_target *target = + so->targets[i]; + v3d_flush_jobs_reading_resource(v3d, target->buffer); + } + } +} + +static void v3d_emit_gl_shader_state(struct v3d_context *v3d, const struct pipe_draw_info *info) { @@ -509,8 +529,8 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) return; } - /* Before setting up the draw, flush anything writing to the textures - * that we read from. + /* Before setting up the draw, flush anything writing to the resources + * that we read from or reading from resources we write to. */ for (int s = 0; s < PIPE_SHADER_COMPUTE; s++) v3d_predraw_check_stage_inputs(pctx, s); @@ -518,6 +538,8 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) if (info->indirect) v3d_flush_jobs_writing_resource(v3d, info->indirect->buffer); + v3d_predraw_check_outputs(pctx); + struct v3d_job *job = v3d_get_job_for_fbo(v3d); /* If vertex texturing depends on the output of rendering, we need to |