summaryrefslogtreecommitdiff
path: root/src/panfrost/midgard
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2020-11-04 08:32:16 -0500
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2020-11-04 11:21:28 -0500
commitdfaa4c51fbab842ad280a199e5bce87a2bcc2fcd (patch)
treed3d5c4fb7bf686184a246016a87022ccedc6d5b1 /src/panfrost/midgard
parenta05921b9f213461b0fc6af59a2409956addad342 (diff)
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>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r--src/panfrost/midgard/midgard_compile.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index acbf296be85..8c64151fb91 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -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);