From: Kenneth Graunke Date: Wed, 17 Apr 2019 06:01:41 +0000 (-0700) Subject: iris: Track bound constant buffers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00d4019676ee879622fd4dbe0234d6c44de04725;p=mesa.git iris: Track bound constant buffers This helps avoid having to iterate over [0, PIPE_MAX_CONSTANT_BUFFERS) looking to see if any resources are bound. --- diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index f539ab36196..aa2c43331bf 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -322,6 +322,9 @@ struct iris_shader_state { struct iris_sampler_state *samplers[IRIS_MAX_TEXTURE_SAMPLERS]; struct iris_sampler_view *textures[IRIS_MAX_TEXTURE_SAMPLERS]; + /** Bitfield of which constant buffers are bound (non-null). */ + uint32_t bound_cbufs; + /** Bitfield of which image views are bound (non-null). */ uint32_t bound_image_views; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 3c3861b7827..d87ef278980 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -2465,6 +2465,8 @@ iris_set_constant_buffer(struct pipe_context *ctx, struct iris_const_buffer *cbuf = &shs->constbuf[index]; if (input && input->buffer) { + shs->bound_cbufs |= 1u << index; + assert(index > 0); pipe_resource_reference(&cbuf->data.res, input->buffer); @@ -2475,6 +2477,7 @@ iris_set_constant_buffer(struct pipe_context *ctx, upload_ubo_surf_state(ice, cbuf, input->buffer_size); } else { + shs->bound_cbufs &= ~(1u << index); pipe_resource_reference(&cbuf->data.res, NULL); pipe_resource_reference(&cbuf->surface_state.res, NULL); }