diff options
author | Jason Ekstrand <[email protected]> | 2019-03-04 15:55:19 -0600 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-03-06 17:24:57 +0000 |
commit | e02959f442ed6546fb632a153ffc32848968038f (patch) | |
tree | 7704af3591371b6f8a83765e1cc598c1e1c4e25a /src/mesa/state_tracker | |
parent | f25ca337b40f1d5846ac146f00fba77b1610be37 (diff) |
nir/lower_doubles: Inline functions directly in lower_doubles
Instead of trusting the caller to already have created a softfp64
function shader and added all its functions to our shader, we simply
take the softfp64 shader as an argument and do the function inlining
ouselves. This means that there's no more nasty functions lying around
that the caller needs to worry about cleaning up.
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index d62a89ec5b1..3d01b91f425 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -379,11 +379,11 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog, } nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir)); + nir_shader *softfp64 = NULL; if (nir->info.uses_64bit && (options->lower_doubles_options & nir_lower_fp64_full_software) != 0) { - nir_shader *fp64 = glsl_float64_funcs_to_nir(st->ctx, options); - ralloc_steal(ralloc_parent(nir), fp64); - exec_list_append(&nir->functions, &fp64->functions); + softfp64 = glsl_float64_funcs_to_nir(st->ctx, options); + ralloc_steal(ralloc_parent(nir), softfp64); } nir_variable_mode mask = @@ -424,26 +424,11 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog, } if (options->lower_doubles_options) { NIR_PASS(progress, nir, nir_lower_doubles, - options->lower_doubles_options); + softfp64, options->lower_doubles_options); } NIR_PASS(progress, nir, nir_opt_algebraic); lowered_64bit_ops |= progress; } while (progress); - - if (lowered_64bit_ops) { - NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp); - NIR_PASS_V(nir, nir_lower_returns); - NIR_PASS_V(nir, nir_inline_functions); - NIR_PASS_V(nir, nir_opt_deref); - } - - const nir_function *entry_point = nir_shader_get_entrypoint(nir)->function; - foreach_list_typed_safe(nir_function, func, node, &nir->functions) { - if (func != entry_point) { - exec_node_remove(&func->node); - } - } - assert(exec_list_length(&nir->functions) == 1); } st_nir_opts(nir, is_scalar); |