mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-04 08:30:27 +01:00
nine: track bound sampler count to optimize unbinds
Acked-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: <Axel Davy davyaxel0@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11865>
This commit is contained in:
parent
7a170230f1
commit
740752d232
2 changed files with 10 additions and 6 deletions
|
|
@ -1001,7 +1001,6 @@ update_textures_and_samplers(struct NineDevice9 *device)
|
|||
device->ff.ps->sampler_mask;
|
||||
|
||||
commit_samplers = FALSE;
|
||||
uint16_t prev_mask = context->bound_samplers_mask_ps;
|
||||
const uint16_t ps_mask = sampler_mask | context->enabled_samplers_mask_ps;
|
||||
context->bound_samplers_mask_ps = ps_mask;
|
||||
num_textures = util_last_bit(ps_mask) + 1;
|
||||
|
|
@ -1040,15 +1039,14 @@ update_textures_and_samplers(struct NineDevice9 *device)
|
|||
view[i] = NULL;
|
||||
|
||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, num_textures,
|
||||
/* unbind trailing based on bitcount of shifted mask */
|
||||
util_bitcount(prev_mask >> num_textures), view);
|
||||
num_textures < context->enabled_sampler_count_ps ? context->enabled_sampler_count_ps - num_textures : 0, view);
|
||||
context->enabled_sampler_count_ps = num_textures;
|
||||
|
||||
if (commit_samplers)
|
||||
cso_single_sampler_done(context->cso, PIPE_SHADER_FRAGMENT);
|
||||
|
||||
commit_samplers = FALSE;
|
||||
sampler_mask = context->programmable_vs ? context->vs->sampler_mask : 0;
|
||||
prev_mask = context->bound_samplers_mask_vs;
|
||||
const uint16_t vs_mask = sampler_mask | context->enabled_samplers_mask_vs;
|
||||
context->bound_samplers_mask_vs = vs_mask;
|
||||
num_textures = util_last_bit(vs_mask) + 1;
|
||||
|
|
@ -1085,8 +1083,8 @@ update_textures_and_samplers(struct NineDevice9 *device)
|
|||
view[i] = NULL;
|
||||
|
||||
pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, num_textures,
|
||||
/* unbind trailing based on bitcount of shifted mask */
|
||||
util_bitcount(prev_mask >> num_textures), view);
|
||||
num_textures < context->enabled_sampler_count_vs ? context->enabled_sampler_count_vs - num_textures : 0, view);
|
||||
context->enabled_sampler_count_vs = num_textures;
|
||||
|
||||
if (commit_samplers)
|
||||
cso_single_sampler_done(context->cso, PIPE_SHADER_VERTEX);
|
||||
|
|
@ -2838,6 +2836,8 @@ void nine_state_restore_non_cso(struct NineDevice9 *device)
|
|||
context->changed.vtxbuf = (1ULL << device->caps.MaxStreams) - 1;
|
||||
context->changed.ucp = TRUE;
|
||||
context->commit |= NINE_STATE_COMMIT_CONST_VS | NINE_STATE_COMMIT_CONST_PS;
|
||||
context->enabled_sampler_count_vs = 0;
|
||||
context->enabled_sampler_count_ps = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -2962,6 +2962,8 @@ nine_context_clear(struct NineDevice9 *device)
|
|||
|
||||
cso_set_samplers(cso, PIPE_SHADER_VERTEX, 0, NULL);
|
||||
cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 0, NULL);
|
||||
context->enabled_sampler_count_vs = 0;
|
||||
context->enabled_sampler_count_ps = 0;
|
||||
|
||||
pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, 0, NINE_MAX_SAMPLERS_VS, NULL);
|
||||
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, NINE_MAX_SAMPLERS_PS, NULL);
|
||||
|
|
|
|||
|
|
@ -303,6 +303,8 @@ struct nine_context {
|
|||
|
||||
uint8_t bound_samplers_mask_vs;
|
||||
uint8_t enabled_samplers_mask_vs;
|
||||
uint8_t enabled_sampler_count_vs;
|
||||
uint8_t enabled_sampler_count_ps;
|
||||
uint16_t bound_samplers_mask_ps;
|
||||
uint16_t enabled_samplers_mask_ps;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue