[Mesa-dev] [PATCH 1/2] radeonsi: keep track of the sampler state for texture handles
Marek Olšák
maraeo at gmail.com
Mon Jun 19 20:06:19 UTC 2017
On Mon, Jun 19, 2017 at 7:29 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Needed for updating all resident texture descriptors when
> dirty_tex_counter changes.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/gallium/drivers/radeonsi/si_descriptors.c | 12 +++++++-----
> src/gallium/drivers/radeonsi/si_pipe.h | 1 +
> 2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
> index cb9c47c0d83..fda9637409e 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -2279,7 +2279,6 @@ static uint64_t si_create_texture_handle(struct pipe_context *ctx,
> struct si_sampler_view *sview = (struct si_sampler_view *)view;
> struct si_context *sctx = (struct si_context *)ctx;
> struct si_texture_handle *tex_handle;
> - struct si_sampler_state *sstate;
> uint32_t desc_list[16];
> uint64_t handle;
>
> @@ -2290,18 +2289,19 @@ static uint64_t si_create_texture_handle(struct pipe_context *ctx,
> memset(desc_list, 0, sizeof(desc_list));
> si_init_descriptor_list(&desc_list[0], 16, 1, null_texture_descriptor);
>
> - sstate = ctx->create_sampler_state(ctx, state);
> - if (!sstate) {
> + tex_handle->sstate = ctx->create_sampler_state(ctx, state);
> + if (!tex_handle->sstate) {
> FREE(tex_handle);
> return 0;
> }
>
> - si_set_sampler_view_desc(sctx, sview, sstate, &desc_list[0]);
> - ctx->delete_sampler_state(ctx, sstate);
> + si_set_sampler_view_desc(sctx, sview, tex_handle->sstate,
> + &desc_list[0]);
>
> tex_handle->desc = si_create_bindless_descriptor(sctx, desc_list,
> sizeof(desc_list));
> if (!tex_handle->desc) {
> + ctx->delete_sampler_state(ctx, tex_handle->sstate);
> FREE(tex_handle);
> return 0;
> }
> @@ -2313,6 +2313,7 @@ static uint64_t si_create_texture_handle(struct pipe_context *ctx,
> tex_handle)) {
> pb_slab_free(&sctx->bindless_descriptor_slabs,
> &tex_handle->desc->entry);
> + ctx->delete_sampler_state(ctx, tex_handle->sstate);
> FREE(tex_handle);
> return 0;
> }
> @@ -2336,6 +2337,7 @@ static void si_delete_texture_handle(struct pipe_context *ctx, uint64_t handle)
>
> tex_handle = (struct si_texture_handle *)entry->data;
>
> + ctx->delete_sampler_state(ctx, tex_handle->sstate);
> pipe_sampler_view_reference(&tex_handle->view, NULL);
> _mesa_hash_table_remove(sctx->tex_handles, entry);
> pb_slab_free(&sctx->bindless_descriptor_slabs,
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
> index afe68a3d35d..1a607a4429d 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.h
> +++ b/src/gallium/drivers/radeonsi/si_pipe.h
> @@ -243,6 +243,7 @@ struct si_texture_handle
> {
> struct si_bindless_descriptor *desc;
> struct pipe_sampler_view *view;
> + struct si_sampler_state *sstate;
Can you declare the sampler state directly (without the pointer)? I.e.:
struct si_sampler_state sstate;
Marek
More information about the mesa-dev
mailing list