mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-23 18:10:36 +02:00
anv: use nir_shader_instructions_pass in anv_nir_lower_ycbcr_textures
No functional changes. Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13189>
This commit is contained in:
parent
8c592e386a
commit
6e0c38567f
1 changed files with 15 additions and 33 deletions
|
|
@ -199,10 +199,17 @@ swizzle_channel(struct isl_swizzle swizzle, unsigned channel)
|
|||
}
|
||||
|
||||
static bool
|
||||
try_lower_tex_ycbcr(const struct anv_pipeline_layout *layout,
|
||||
nir_builder *builder,
|
||||
nir_tex_instr *tex)
|
||||
anv_nir_lower_ycbcr_textures_instr(nir_builder *builder,
|
||||
nir_instr *instr,
|
||||
void *cb_data)
|
||||
{
|
||||
const struct anv_pipeline_layout *layout = cb_data;
|
||||
|
||||
if (instr->type != nir_instr_type_tex)
|
||||
return false;
|
||||
|
||||
nir_tex_instr *tex = nir_instr_as_tex(instr);
|
||||
|
||||
int deref_src_idx = nir_tex_instr_src_index(tex, nir_tex_src_texture_deref);
|
||||
assert(deref_src_idx >= 0);
|
||||
nir_deref_instr *deref = nir_src_as_deref(tex->src[deref_src_idx].src);
|
||||
|
|
@ -334,34 +341,9 @@ bool
|
|||
anv_nir_lower_ycbcr_textures(nir_shader *shader,
|
||||
const struct anv_pipeline_layout *layout)
|
||||
{
|
||||
bool progress = false;
|
||||
|
||||
nir_foreach_function(function, shader) {
|
||||
if (!function->impl)
|
||||
continue;
|
||||
|
||||
bool function_progress = false;
|
||||
nir_builder builder;
|
||||
nir_builder_init(&builder, function->impl);
|
||||
|
||||
nir_foreach_block(block, function->impl) {
|
||||
nir_foreach_instr_safe(instr, block) {
|
||||
if (instr->type != nir_instr_type_tex)
|
||||
continue;
|
||||
|
||||
nir_tex_instr *tex = nir_instr_as_tex(instr);
|
||||
function_progress |= try_lower_tex_ycbcr(layout, &builder, tex);
|
||||
}
|
||||
}
|
||||
|
||||
if (function_progress) {
|
||||
nir_metadata_preserve(function->impl,
|
||||
nir_metadata_block_index |
|
||||
nir_metadata_dominance);
|
||||
}
|
||||
|
||||
progress |= function_progress;
|
||||
}
|
||||
|
||||
return progress;
|
||||
return nir_shader_instructions_pass(shader,
|
||||
anv_nir_lower_ycbcr_textures_instr,
|
||||
nir_metadata_block_index |
|
||||
nir_metadata_dominance,
|
||||
(void *)layout);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue