diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c index 5d5b942be39..5995424840b 100644 --- a/src/gallium/drivers/freedreno/freedreno_state.c +++ b/src/gallium/drivers/freedreno/freedreno_state.c @@ -606,11 +606,36 @@ fd_bind_compute_state(struct pipe_context *pctx, void *state) in_dt ctx->dirty_shader[PIPE_SHADER_COMPUTE] |= FD_DIRTY_SHADER_PROG; } +/* TODO pipe_context::set_compute_resources() should DIAF and clover + * should be updated to use pipe_context::set_constant_buffer() and + * pipe_context::set_shader_images(). Until then just directly frob + * the UBO/image state to avoid the rest of the driver needing to + * know about this bastard api.. + */ static void fd_set_compute_resources(struct pipe_context *pctx, unsigned start, unsigned count, struct pipe_surface **prscs) in_dt { - // TODO + struct fd_context *ctx = fd_context(pctx); + struct fd_constbuf_stateobj *so = &ctx->constbuf[PIPE_SHADER_COMPUTE]; + + for (unsigned i = 0; i < count; i++) { + const uint32_t index = i + start + 1; /* UBOs start at index 1 */ + + if (!prscs) { + util_copy_constant_buffer(&so->cb[index], NULL, false); + so->enabled_mask &= ~(1 << index); + } else if (prscs[i]->format == PIPE_FORMAT_NONE) { + struct pipe_constant_buffer cb = { + .buffer = prscs[i]->texture, + }; + util_copy_constant_buffer(&so->cb[index], &cb, false); + so->enabled_mask |= (1 << index); + } else { + // TODO images + unreachable("finishme"); + } + } } /* used by clover to bind global objects, returning the bo address