summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2020-06-29 13:18:51 +0200
committerMarge Bot <eric+marge@anholt.net>2020-07-02 17:04:46 +0000
commit7460d4863df9edee2ab51011e14a0fc17b0523db (patch)
tree33ee2a51983812910caac0e6f989dbc167c4cb91
parent12b15cbcbfad4af0faf55800e25d4d8f3280a6d8 (diff)
etnaviv: get rid of etna_compile dependency
Needed prep change to be able to move alu lowering. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Acked-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5690>
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
index 10817e4fb86..9a4b461d3b0 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
@@ -112,7 +112,7 @@ etna_alu_to_scalar_filter_cb(const nir_instr *instr, const void *data)
}
static void
-etna_lower_alu_impl(nir_function_impl *impl, struct etna_compile *c)
+etna_lower_alu_impl(nir_function_impl *impl, bool has_new_transcendentals)
{
nir_shader *shader = impl->function->shader;
@@ -132,7 +132,7 @@ etna_lower_alu_impl(nir_function_impl *impl, struct etna_compile *c)
if (alu->op == nir_op_fsin || alu->op == nir_op_fcos) {
b.cursor = nir_before_instr(instr);
- nir_ssa_def *imm = c->specs->has_new_transcendentals ?
+ nir_ssa_def *imm = has_new_transcendentals ?
nir_imm_float(&b, 1.0 / M_PI) :
nir_imm_float(&b, 2.0 / M_PI);
@@ -143,7 +143,7 @@ etna_lower_alu_impl(nir_function_impl *impl, struct etna_compile *c)
/* change transcendental ops to vec2 and insert vec1 mul for the result
* TODO: do this earlier (but it breaks with optimizations)
*/
- if (c->specs->has_new_transcendentals && (
+ if (has_new_transcendentals && (
alu->op == nir_op_fdiv || alu->op == nir_op_flog2 ||
alu->op == nir_op_fsin || alu->op == nir_op_fcos)) {
nir_ssa_def *ssa = &alu->dest.dest.ssa;
@@ -170,11 +170,11 @@ etna_lower_alu_impl(nir_function_impl *impl, struct etna_compile *c)
}
}
-static void etna_lower_alu(nir_shader *shader, struct etna_compile *c)
+static void etna_lower_alu(nir_shader *shader, bool has_new_transcendentals)
{
nir_foreach_function(function, shader) {
if (function->impl)
- etna_lower_alu_impl(function->impl, c);
+ etna_lower_alu_impl(function->impl, has_new_transcendentals);
}
}
@@ -688,7 +688,7 @@ etna_compile_shader_nir(struct etna_shader_variant *v)
NIR_PASS_V(s, nir_opt_dce);
- NIR_PASS_V(s, etna_lower_alu, c);
+ NIR_PASS_V(s, etna_lower_alu, c->specs->has_new_transcendentals);
if (DBG_ENABLED(ETNA_DBG_DUMP_SHADERS))
nir_print_shader(s, stdout);