summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-10-15 16:49:06 -0400
committerMarek Olšák <[email protected]>2019-10-17 20:31:37 -0400
commitdd4d791821736015e02886e1af4f3159aa316ff2 (patch)
treefb06fcdc59493326e7ac33f3af3f901073c2ef51 /src/mesa
parent7908e82f60fbe40d66fb10d9085afe6802a85b33 (diff)
st/mesa: lower doubles for NIR after linking
This allows dropping 1 call to st_nir_opts, because shaders are always optimized after linking. Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index f7e42646c80..c0b63ac36f8 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -336,8 +336,6 @@ st_nir_preprocess(struct st_context *st, struct gl_program *prog,
const nir_shader_compiler_options *options =
st->ctx->Const.ShaderCompilerOptions[prog->info.stage].NirOptions;
assert(options);
- bool lower_64bit =
- options->lower_int64_options || options->lower_doubles_options;
nir_shader *nir = prog->nir;
/* Set the next shader stage hint for VS and TES. */
@@ -400,24 +398,6 @@ st_nir_preprocess(struct st_context *st, struct gl_program *prog,
NIR_PASS_V(nir, gl_nir_lower_buffers, shader_program);
/* Do a round of constant folding to clean up address calculations */
NIR_PASS_V(nir, nir_opt_constant_folding);
-
- if (lower_64bit) {
- /* Clean up the IR before 64-bit lowering. */
- st_nir_opts(nir);
-
- bool lowered_64bit_ops = false;
- if (options->lower_doubles_options) {
- NIR_PASS(lowered_64bit_ops, nir, nir_lower_doubles,
- st->ctx->SoftFP64, options->lower_doubles_options);
- }
- if (options->lower_int64_options) {
- NIR_PASS(lowered_64bit_ops, nir, nir_lower_int64,
- options->lower_int64_options);
- }
-
- if (lowered_64bit_ops)
- st_nir_opts(nir);
- }
}
/* Second third of converting glsl_to_nir. This creates uniforms, gathers
@@ -486,6 +466,23 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
NIR_PASS_V(nir, gl_nir_lower_atomics, shader_program, true);
NIR_PASS_V(nir, nir_opt_intrinsics);
+ /* Lower 64-bit ops. */
+ if (nir->options->lower_int64_options ||
+ nir->options->lower_doubles_options) {
+ bool lowered_64bit_ops = false;
+ if (nir->options->lower_doubles_options) {
+ NIR_PASS(lowered_64bit_ops, nir, nir_lower_doubles,
+ st->ctx->SoftFP64, nir->options->lower_doubles_options);
+ }
+ if (nir->options->lower_int64_options) {
+ NIR_PASS(lowered_64bit_ops, nir, nir_lower_int64,
+ nir->options->lower_int64_options);
+ }
+
+ if (lowered_64bit_ops)
+ st_nir_opts(nir);
+ }
+
nir_variable_mode mask = nir_var_function_temp;
nir_remove_dead_variables(nir, mask);