mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 22:50:08 +01:00
pan/mdg: Deduplicate nir_find_variable_with_driver_location
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7446>
This commit is contained in:
parent
a05921b9f2
commit
dfaa4c51fb
1 changed files with 4 additions and 15 deletions
|
|
@ -210,17 +210,6 @@ midgard_nir_lower_fdot2(nir_shader *shader)
|
|||
NULL);
|
||||
}
|
||||
|
||||
static const nir_variable *
|
||||
search_var(nir_shader *nir, nir_variable_mode mode, unsigned driver_loc)
|
||||
{
|
||||
nir_foreach_variable_with_modes(var, nir, mode) {
|
||||
if (var->data.driver_location == driver_loc)
|
||||
return var;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Midgard can write all of color, depth and stencil in a single writeout
|
||||
* operation, so we merge depth/stencil stores with color stores.
|
||||
* If there are no color stores, we add a write to the "depth RT".
|
||||
|
|
@ -284,7 +273,7 @@ midgard_nir_lower_zs_store(nir_shader *nir)
|
|||
if (intr->intrinsic != nir_intrinsic_store_output)
|
||||
continue;
|
||||
|
||||
const nir_variable *var = search_var(nir, nir_var_shader_out, nir_intrinsic_base(intr));
|
||||
const nir_variable *var = nir_find_variable_with_driver_location(nir, nir_var_shader_out, nir_intrinsic_base(intr));
|
||||
assert(var);
|
||||
|
||||
if (var->data.location != FRAG_RESULT_COLOR &&
|
||||
|
|
@ -423,7 +412,7 @@ midgard_nir_reorder_writeout(nir_shader *nir)
|
|||
if (intr->intrinsic != nir_intrinsic_store_output)
|
||||
continue;
|
||||
|
||||
const nir_variable *var = search_var(nir, nir_var_shader_out, nir_intrinsic_base(intr));
|
||||
const nir_variable *var = nir_find_variable_with_driver_location(nir, nir_var_shader_out, nir_intrinsic_base(intr));
|
||||
|
||||
if (var->data.index) {
|
||||
if (!last_writeout)
|
||||
|
|
@ -1678,7 +1667,7 @@ output_load_rt_addr(compiler_context *ctx, nir_intrinsic_instr *instr)
|
|||
return ctx->blend_rt;
|
||||
|
||||
const nir_variable *var;
|
||||
var = search_var(ctx->nir, nir_var_shader_out, nir_intrinsic_base(instr));
|
||||
var = nir_find_variable_with_driver_location(ctx->nir, nir_var_shader_out, nir_intrinsic_base(instr));
|
||||
assert(var);
|
||||
|
||||
unsigned loc = var->data.location;
|
||||
|
|
@ -1884,7 +1873,7 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
|
|||
nir_intrinsic_store_combined_output_pan;
|
||||
|
||||
const nir_variable *var;
|
||||
var = search_var(ctx->nir, nir_var_shader_out,
|
||||
var = nir_find_variable_with_driver_location(ctx->nir, nir_var_shader_out,
|
||||
nir_intrinsic_base(instr));
|
||||
assert(var);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue