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 | |
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')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_program.c | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 23 |
2 files changed, 8 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index f40d2c33549..ffb49c35cd4 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -112,14 +112,14 @@ brw_create_nir(struct brw_context *brw, nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir)); + nir_shader *softfp64 = NULL; if ((options->lower_doubles_options & nir_lower_fp64_full_software) && nir->info.uses_64bit) { - nir_shader *fp64 = glsl_float64_funcs_to_nir(ctx, options); - ralloc_steal(ralloc_parent(nir), fp64); - exec_list_append(&nir->functions, &fp64->functions); + softfp64 = glsl_float64_funcs_to_nir(ctx, options); + ralloc_steal(ralloc_parent(nir), softfp64); } - nir = brw_preprocess_nir(brw->screen->compiler, nir); + nir = brw_preprocess_nir(brw->screen->compiler, nir, softfp64); NIR_PASS_V(nir, brw_nir_lower_image_load_store, devinfo); 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); |