freedreno: implement set_compute_state()

This interface should really go away, but for now just implement it
to directly update constant state (ie. what clover *should* be doing
instead)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13300>
This commit is contained in:
Rob Clark
2018-05-01 16:03:58 -04:00
committed by Marge Bot
parent 1e9f27f37f
commit f5bbf77be8
@@ -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