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)
{
}
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
* 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);