Module: Mesa Branch: main Commit: e693e5e59501f0c88911539754c4cd68cb025319 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e693e5e59501f0c88911539754c4cd68cb025319
Author: Karol Herbst <[email protected]> Date: Thu May 5 11:45:28 2022 +0200 ntt: make use of new samplers_used field Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Emma Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16435> --- src/gallium/auxiliary/nir/nir_to_tgsi_info.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c index 07c256daac3..80db4e5e193 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c +++ b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c @@ -778,31 +778,20 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir, info->indirect_files |= 1 << TGSI_FILE_OUTPUT; } - uint32_t sampler_mask = 0; - nir_foreach_uniform_variable(var, nir) { - uint32_t sampler_count = glsl_type_get_sampler_count(var->type) + - glsl_type_get_texture_count(var->type); - sampler_mask |= ((1ull << sampler_count) - 1) << var->data.binding; - } - uint32_t image_mask = 0; - nir_foreach_image_variable(var, nir) { - uint32_t image_count = glsl_type_get_image_count(var->type); - image_mask |= ((1ull << image_count) - 1) << var->data.binding; - } info->num_outputs = num_outputs; info->const_file_max[0] = nir->num_uniforms - 1; info->const_buffers_declared = u_bit_consecutive(1, nir->info.num_ubos); if (nir->num_uniforms > 0) info->const_buffers_declared |= 1; - info->images_declared = image_mask; - info->samplers_declared = sampler_mask; + info->images_declared = nir->info.images_used[0]; + info->samplers_declared = nir->info.textures_used[0]; - info->file_max[TGSI_FILE_SAMPLER] = util_last_bit(info->samplers_declared) - 1; + info->file_max[TGSI_FILE_SAMPLER] = BITSET_LAST_BIT(nir->info.samplers_used) - 1; info->file_max[TGSI_FILE_SAMPLER_VIEW] = BITSET_LAST_BIT(nir->info.textures_used) - 1; - info->file_mask[TGSI_FILE_SAMPLER] = info->samplers_declared; + info->file_mask[TGSI_FILE_SAMPLER] = nir->info.samplers_used[0]; info->file_mask[TGSI_FILE_SAMPLER_VIEW] = nir->info.textures_used[0]; - info->file_max[TGSI_FILE_IMAGE] = util_last_bit(info->images_declared) - 1; + info->file_max[TGSI_FILE_IMAGE] = BITSET_LAST_BIT(nir->info.images_used) - 1; info->file_mask[TGSI_FILE_IMAGE] = info->images_declared; info->num_written_clipdistance = nir->info.clip_distance_array_size;
