From: Marek Olšák Date: Tue, 26 May 2020 08:36:33 +0000 (-0400) Subject: nir: don't count samplers and images in interface blocks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f8ef15c061fbb0e6da255ab06d7afd8128faee48;p=mesa.git nir: don't count samplers and images in interface blocks Acked-by: Jason Ekstrand Reviewed-by: Eric Anholt Part-of: --- diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index d1c3e6168cf..df422ea21f3 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -600,8 +600,11 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint) shader->info.last_msaa_image = -1; nir_foreach_variable(var, &shader->uniforms) { - /* Bindless textures and images don't use non-bindless slots. */ - if (var->data.bindless) + /* Bindless textures and images don't use non-bindless slots. + * Interface blocks imply inputs, outputs, UBO, or SSBO, which can only + * mean bindless. + */ + if (var->data.bindless || var->interface_type) continue; shader->info.num_textures += glsl_type_get_sampler_count(var->type); diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index ac610488814..25043acaca7 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -756,7 +756,10 @@ glsl_type_get_sampler_count(const struct glsl_type *type) glsl_type_get_sampler_count(glsl_without_array(type))); } - if (glsl_type_is_struct_or_ifc(type)) { + /* Ignore interface blocks - they can only contain bindless samplers, + * which we shouldn't count. + */ + if (glsl_type_is_struct(type)) { unsigned count = 0; for (unsigned i = 0; i < glsl_get_length(type); i++) count += glsl_type_get_sampler_count(glsl_get_struct_field(type, i)); @@ -777,7 +780,10 @@ glsl_type_get_image_count(const struct glsl_type *type) glsl_type_get_image_count(glsl_without_array(type))); } - if (glsl_type_is_struct_or_ifc(type)) { + /* Ignore interface blocks - they can only contain bindless images, + * which we shouldn't count. + */ + if (glsl_type_is_struct(type)) { unsigned count = 0; for (unsigned i = 0; i < glsl_get_length(type); i++) count += glsl_type_get_image_count(glsl_get_struct_field(type, i));