aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2019-09-13 08:20:46 +0200
committerMarge Bot <[email protected]>2020-03-25 20:49:32 +0000
commit0ed053f03d936d301091dd68e96ced8dbedc83b2 (patch)
tree67b6c04340fd830aeac528ffaa539742aed3f0f9 /src
parent3340cbd398bb5a74287e794277d2423d11bbbc52 (diff)
freedreno: simplify fd_set_shader_buffers(..)
Clear the modified bits for enabled_mask and then iterate over the whole range and set the specific bit where there is a buffer. Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Rob Clark <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1963>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_state.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c
index 4c558e14f0f..dd42ef4c6e9 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.c
+++ b/src/gallium/drivers/freedreno/freedreno_state.c
@@ -128,11 +128,13 @@ fd_set_shader_buffers(struct pipe_context *pctx,
struct fd_shaderbuf_stateobj *so = &ctx->shaderbuf[shader];
const unsigned modified_bits = u_bit_consecutive(start, count);
- if (buffers) {
- for (unsigned i = 0; i < count; i++) {
- unsigned n = i + start;
- struct pipe_shader_buffer *buf = &so->sb[n];
+ so->enabled_mask &= ~modified_bits;
+
+ for (unsigned i = 0; i < count; i++) {
+ unsigned n = i + start;
+ struct pipe_shader_buffer *buf = &so->sb[n];
+ if (buffers && buffers[i].buffer) {
if ((buf->buffer == buffers[i].buffer) &&
(buf->buffer_offset == buffers[i].buffer_offset) &&
(buf->buffer_size == buffers[i].buffer_size))
@@ -142,20 +144,10 @@ fd_set_shader_buffers(struct pipe_context *pctx,
buf->buffer_size = buffers[i].buffer_size;
pipe_resource_reference(&buf->buffer, buffers[i].buffer);
- if (buf->buffer)
- so->enabled_mask |= BIT(n);
- else
- so->enabled_mask &= ~BIT(n);
- }
- } else {
- for (unsigned i = 0; i < count; i++) {
- unsigned n = i + start;
- struct pipe_shader_buffer *buf = &so->sb[n];
-
+ so->enabled_mask |= BIT(n);
+ } else {
pipe_resource_reference(&buf->buffer, NULL);
}
-
- so->enabled_mask &= ~modified_bits;
}
ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_SSBO;