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 <jason.ekstrand@collabora.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17693>
This commit is contained in:
Marek Olšák 2022-07-21 09:31:38 -04:00 committed by Marge Bot
parent 3098000e71
commit e075769a53
2 changed files with 18 additions and 0 deletions

View file

@ -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;
}

View file

@ -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.
*