summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/v3d/v3d_context.h3
-rw-r--r--src/gallium/drivers/v3d/v3dx_draw.c18
2 files changed, 16 insertions, 5 deletions
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h
index d62dd229ef2..4db422b5755 100644
--- a/src/gallium/drivers/v3d/v3d_context.h
+++ b/src/gallium/drivers/v3d/v3d_context.h
@@ -459,6 +459,9 @@ struct v3d_blend_state {
fprintf(stderr, __VA_ARGS__); \
} while (0)
+#define foreach_bit(b, mask) \
+ for (uint32_t _m = (mask), b; _m && ({(b) = u_bit_scan(&_m); 1;});)
+
static inline struct v3d_context *
v3d_context(struct pipe_context *pcontext)
{
diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c
index 519aa9157d5..ca0a1ab39c2 100644
--- a/src/gallium/drivers/v3d/v3dx_draw.c
+++ b/src/gallium/drivers/v3d/v3dx_draw.c
@@ -119,18 +119,26 @@ v3d_start_draw(struct v3d_context *v3d)
}
static void
-v3d_predraw_check_textures(struct pipe_context *pctx,
- struct v3d_texture_stateobj *stage_tex)
+v3d_predraw_check_stage_inputs(struct pipe_context *pctx,
+ enum pipe_shader_type s)
{
struct v3d_context *v3d = v3d_context(pctx);
- for (int i = 0; i < stage_tex->num_textures; i++) {
- struct pipe_sampler_view *view = stage_tex->textures[i];
+ /* Flush writes to textures we're sampling. */
+ for (int i = 0; i < v3d->tex[s].num_textures; i++) {
+ struct pipe_sampler_view *view = v3d->tex[s].textures[i];
if (!view)
continue;
v3d_flush_jobs_writing_resource(v3d, view->texture);
}
+
+ /* Flush writes to UBOs. */
+ foreach_bit(i, v3d->constbuf[s].enabled_mask) {
+ struct pipe_constant_buffer *cb = &v3d->constbuf[s].cb[i];
+ if (cb->buffer)
+ v3d_flush_jobs_writing_resource(v3d, cb->buffer);
+ }
}
static void
@@ -436,7 +444,7 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
* that we read from.
*/
for (int s = 0; s < PIPE_SHADER_TYPES; s++)
- v3d_predraw_check_textures(pctx, &v3d->tex[s]);
+ v3d_predraw_check_stage_inputs(pctx, s);
struct v3d_job *job = v3d_get_job_for_fbo(v3d);