From: Emma Anholt Date: Tue, 17 Aug 2021 20:40:57 +0000 (-0700) Subject: freedreno/ir3: Only lower cube image sizes once. X-Git-Tag: upstream/22.3.5~19101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=513920ba827e64c95ddb684da6ec285786cf0853;p=platform%2Fupstream%2Fmesa.git freedreno/ir3: Only lower cube image sizes once. shader variants can cause ir3_nir_finalize() to run more than once, which would make us keep dividing the size by 6. Fixes: a48fc88571f9 ("freedreno/a6xx: Apply the cube image size lowering to GL, too.") Part-of: --- diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index 670750e..fdc38b9 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -352,11 +352,6 @@ ir3_finalize_nir(struct ir3_compiler *compiler, nir_shader *s) .lower_tg4_offsets = true, }; - nir_lower_image_options lower_image_opts = { - .lower_cube_size = true, - }; - NIR_PASS_V(s, nir_lower_image, &lower_image_opts); - if (compiler->gen >= 4) { /* a4xx seems to have *no* sam.p */ tex_options.lower_txp = ~0; /* lower all txp */ @@ -477,6 +472,11 @@ ir3_nir_lower_subgroup_id_cs(nir_shader *shader) lower_subgroup_id, NULL); } +static const nir_lower_idiv_options idiv_options = { + .imprecise_32bit_lowering = true, + .allow_fp16 = true, +}; + /** * Late passes that need to be done after pscreen->finalize_nir() */ @@ -525,10 +525,16 @@ ir3_nir_post_finalize(struct ir3_compiler *compiler, nir_shader *s) } /* we cannot ensure that ir3_finalize_nir() is only called once, so - * we also need to do trig workarounds here: + * we also need to do any run-once workarounds here: */ OPT_V(s, ir3_nir_apply_trig_workarounds); + nir_lower_image_options lower_image_opts = { + .lower_cube_size = true, + }; + NIR_PASS_V(s, nir_lower_image, &lower_image_opts); + NIR_PASS_V(s, nir_lower_idiv, &idiv_options); /* idiv generated by cube lowering */ + ir3_optimize_loop(compiler, s); }