st/mesa: call nir_lower_flrp only once per shader

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
Marek Olšák
2019-10-25 00:15:37 -04:00
parent 7d00218aed
commit 4b4b383f38
2 changed files with 21 additions and 15 deletions

View File

@@ -162,6 +162,9 @@ typedef struct shader_info {
/** Was this shader linked with any transform feedback varyings? */
bool has_transform_feedback_varyings;
/* Whether flrp has been lowered. */
bool flrp_lowered;
/* SPV_KHR_float_controls: execution mode for floating point ops */
unsigned float_controls_execution_mode;

View File

@@ -244,10 +244,6 @@ void
st_nir_opts(nir_shader *nir)
{
bool progress;
unsigned lower_flrp =
(nir->options->lower_flrp16 ? 16 : 0) |
(nir->options->lower_flrp32 ? 32 : 0) |
(nir->options->lower_flrp64 ? 64 : 0);
do {
progress = false;
@@ -290,7 +286,13 @@ st_nir_opts(nir_shader *nir)
NIR_PASS(progress, nir, nir_opt_algebraic);
NIR_PASS(progress, nir, nir_opt_constant_folding);
if (lower_flrp != 0) {
if (!nir->info.flrp_lowered) {
unsigned lower_flrp =
(nir->options->lower_flrp16 ? 16 : 0) |
(nir->options->lower_flrp32 ? 32 : 0) |
(nir->options->lower_flrp64 ? 64 : 0);
if (lower_flrp) {
bool lower_flrp_progress = false;
NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp,
@@ -302,11 +304,12 @@ st_nir_opts(nir_shader *nir)
nir_opt_constant_folding);
progress = true;
}
}
/* Nothing should rematerialize any flrps, so we only need to do this
* lowering once.
*/
lower_flrp = 0;
nir->info.flrp_lowered = true;
}
NIR_PASS(progress, nir, nir_opt_undef);