diff options
author | Marek Olšák <marek.olsak@amd.com> | 2021-06-06 02:23:31 -0400 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-08-20 15:04:20 +0000 |
commit | bb89cf4bf396c84b0aadb6251a083214e6055600 (patch) | |
tree | 1a633322a1ae21277540a745b18464586f6fedd8 /src/gallium/drivers/nouveau/nv50/nv50_state.c | |
parent | 556c10c02c0aa8032aef53090671e22500e25745 (diff) |
gallium: add take_ownership into set_sampler_views to skip reference counting
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12334>
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50/nv50_state.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_state.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index 0eafe86d387..3ad9e41fdbb 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -661,7 +661,7 @@ nv50_sampler_view_destroy(struct pipe_context *pipe, static inline void nv50_stage_set_sampler_views(struct nv50_context *nv50, int s, - unsigned nr, + unsigned nr, bool take_ownership, struct pipe_sampler_view **views) { unsigned i; @@ -684,7 +684,12 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s, nv50->textures_coherent[s] &= ~(1 << i); } - pipe_sampler_view_reference(&nv50->textures[s][i], view); + if (take_ownership) { + pipe_sampler_view_reference(&nv50->textures[s][i], NULL); + nv50->textures[s][i] = view; + } else { + pipe_sampler_view_reference(&nv50->textures[s][i], view); + } } assert(nv50->num_textures[s] <= PIPE_MAX_SAMPLERS); @@ -704,13 +709,14 @@ static void nv50_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned nr, unsigned unbind_num_trailing_slots, + bool take_ownership, struct pipe_sampler_view **views) { struct nv50_context *nv50 = nv50_context(pipe); unsigned s = nv50_context_shader_stage(shader); assert(start == 0); - nv50_stage_set_sampler_views(nv50, s, nr, views); + nv50_stage_set_sampler_views(nv50, s, nr, take_ownership, views); if (unlikely(s == NV50_SHADER_STAGE_COMPUTE)) { nouveau_bufctx_reset(nv50->bufctx_cp, NV50_BIND_CP_TEXTURES); |