lima: Convert to use nir_shader_intrinsics_pass
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35130>
This commit is contained in:
committed by
Marge Bot
parent
52d028e06c
commit
ac042d1178
@@ -63,7 +63,7 @@ bool ppir_compile_nir(struct lima_fs_compiled_shader *prog, struct nir_shader *n
|
||||
struct util_debug_callback *debug);
|
||||
struct ra_regs *ppir_regalloc_init(void *mem_ctx);
|
||||
|
||||
void lima_nir_lower_uniform_to_scalar(nir_shader *shader);
|
||||
bool lima_nir_lower_uniform_to_scalar(nir_shader *shader);
|
||||
bool lima_nir_scale_trig(nir_shader *shader);
|
||||
bool lima_nir_lower_ftrunc(nir_shader *shader);
|
||||
bool lima_nir_lower_fdot(nir_shader *shader);
|
||||
|
||||
@@ -26,9 +26,12 @@
|
||||
#include "nir_builder.h"
|
||||
#include "lima_ir.h"
|
||||
|
||||
static void
|
||||
lower_load_uniform_to_scalar(nir_builder *b, nir_intrinsic_instr *intr)
|
||||
static bool
|
||||
lower_load_uniform_to_scalar(nir_builder *b, nir_intrinsic_instr *intr, void *unused)
|
||||
{
|
||||
if (intr->intrinsic != nir_intrinsic_load_uniform)
|
||||
return false;
|
||||
|
||||
b->cursor = nir_before_instr(&intr->instr);
|
||||
|
||||
nir_def *loads[4];
|
||||
@@ -52,26 +55,15 @@ lower_load_uniform_to_scalar(nir_builder *b, nir_intrinsic_instr *intr)
|
||||
}
|
||||
|
||||
nir_def_replace(&intr->def, nir_vec(b, loads, intr->num_components));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
lima_nir_lower_uniform_to_scalar(nir_shader *shader)
|
||||
{
|
||||
nir_foreach_function_impl(impl, shader) {
|
||||
nir_builder b = nir_builder_create(impl);
|
||||
|
||||
nir_foreach_block(block, impl) {
|
||||
nir_foreach_instr_safe(instr, block) {
|
||||
if (instr->type != nir_instr_type_intrinsic)
|
||||
continue;
|
||||
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
||||
|
||||
if (intr->intrinsic != nir_intrinsic_load_uniform)
|
||||
continue;
|
||||
|
||||
lower_load_uniform_to_scalar(&b, intr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nir_shader_intrinsics_pass(shader,
|
||||
lower_load_uniform_to_scalar,
|
||||
nir_metadata_control_flow,
|
||||
NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user