Module: Mesa Branch: main Commit: e075769a5357d11cd89f22313aabcbef0ce5a691 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e075769a5357d11cd89f22313aabcbef0ce5a691
Author: Marek Olšák <[email protected]> Date: Thu Jul 21 09:31:38 2022 -0400 nir: add shader_info::uses_resource_info_query for txs, levels, samples, etc. AMD will use this to execute a lowering pass conditionally. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17693> --- src/compiler/nir/nir_gather_info.c | 15 +++++++++++++++ src/compiler/shader_info.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index c19fe07a1bd..d1086d86d3e 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -836,6 +836,14 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, default: if (nir_intrinsic_writes_external_memory(instr)) shader->info.writes_memory = true; + + if (instr->intrinsic == nir_intrinsic_image_size || + instr->intrinsic == nir_intrinsic_image_samples || + instr->intrinsic == nir_intrinsic_image_deref_size || + instr->intrinsic == nir_intrinsic_image_deref_samples || + instr->intrinsic == nir_intrinsic_bindless_image_size || + instr->intrinsic == nir_intrinsic_bindless_image_samples) + shader->info.uses_resource_info_query = true; break; } } @@ -851,6 +859,11 @@ gather_tex_info(nir_tex_instr *instr, nir_shader *shader) case nir_texop_tg4: shader->info.uses_texture_gather = true; break; + case nir_texop_txs: + case nir_texop_query_levels: + case nir_texop_texture_samples: + shader->info.uses_resource_info_query = true; + break; default: break; } @@ -962,6 +975,8 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint) shader->info.patch_inputs_read_indirectly = 0; shader->info.patch_outputs_accessed_indirectly = 0; + shader->info.uses_resource_info_query = false; + if (shader->info.stage == MESA_SHADER_VERTEX) { shader->info.vs.double_inputs = 0; } diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index 9229c301689..b8c0e8f2aa9 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -254,6 +254,9 @@ typedef struct shader_info { /* Whether or not this shader ever uses textureGather() */ bool uses_texture_gather:1; + /* Whether texture size, levels, or samples is queried. */ + bool uses_resource_info_query:1; + /** * True if this shader uses the fddx/fddy opcodes. *
