radv: use nir_shader_instructions_pass in radv_nir_lower_ycbcr_textures
Changes: - nir_metadata_preserve(..., nir_metadata_all) is called when pass doesn't make progress Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12282>
This commit is contained in:
committed by
Marge Bot
parent
a54d996463
commit
0337f449a6
@@ -300,35 +300,22 @@ try_lower_tex_ycbcr(const struct radv_pipeline_layout *layout, nir_builder *buil
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
radv_nir_lower_ycbcr_textures_instr(nir_builder *b, nir_instr *instr, void *layout)
|
||||
{
|
||||
if (instr->type != nir_instr_type_tex)
|
||||
return false;
|
||||
|
||||
nir_tex_instr *tex = nir_instr_as_tex(instr);
|
||||
return try_lower_tex_ycbcr(layout, b, tex);
|
||||
}
|
||||
|
||||
bool
|
||||
radv_nir_lower_ycbcr_textures(nir_shader *shader, const struct radv_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,
|
||||
radv_nir_lower_ycbcr_textures_instr,
|
||||
nir_metadata_block_index |
|
||||
nir_metadata_dominance,
|
||||
(void *)layout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user