summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/iris/iris_context.h6
-rw-r--r--src/gallium/drivers/iris/iris_state.c11
2 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h
index 4465eef40dd..f539ab36196 100644
--- a/src/gallium/drivers/iris/iris_context.h
+++ b/src/gallium/drivers/iris/iris_context.h
@@ -327,6 +327,12 @@ struct iris_shader_state {
/** Bitfield of which sampler views are bound (non-null). */
uint32_t bound_sampler_views;
+
+ /** Bitfield of which shader storage buffers are bound (non-null). */
+ uint32_t bound_ssbos;
+
+ /** Bitfield of which shader storage buffers are writable. */
+ uint32_t writable_ssbos;
};
/**
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 12059fbcd3d..3c3861b7827 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -2581,12 +2581,20 @@ iris_set_shader_buffers(struct pipe_context *ctx,
gl_shader_stage stage = stage_from_pipe(p_stage);
struct iris_shader_state *shs = &ice->state.shaders[stage];
+ unsigned modified_bits = u_bit_consecutive(start_slot, count);
+
+ shs->bound_ssbos &= ~modified_bits;
+ shs->writable_ssbos &= ~modified_bits;
+ shs->writable_ssbos |= writable_bitmask << start_slot;
+
for (unsigned i = 0; i < count; i++) {
if (buffers && buffers[i].buffer) {
const struct pipe_shader_buffer *buffer = &buffers[i];
struct iris_resource *res = (void *) buffer->buffer;
pipe_resource_reference(&shs->ssbo[start_slot + i], &res->base);
+ shs->bound_ssbos |= 1 << (start_slot + i);
+
res->bind_history |= PIPE_BIND_SHADER_BUFFER;
// XXX: these are not retained forever, use a separate uploader?
@@ -3926,7 +3934,8 @@ use_ssbo(struct iris_batch *batch, struct iris_context *ice,
struct iris_state_ref *surf_state = &shs->ssbo_surface_state[i];
- iris_use_pinned_bo(batch, iris_resource_bo(shs->ssbo[i]), true);
+ iris_use_pinned_bo(batch, iris_resource_bo(shs->ssbo[i]),
+ shs->writable_ssbos & (1 << i));
iris_use_pinned_bo(batch, iris_resource_bo(surf_state->res), false);
return surf_state->offset;