diff options
-rw-r--r-- | src/compiler/glsl/glsl_parser_extras.cpp | 6 | ||||
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 3 | ||||
-rw-r--r-- | src/compiler/glsl/ir_optimization.h | 3 | ||||
-rw-r--r-- | src/compiler/glsl/linker.cpp | 3 | ||||
-rw-r--r-- | src/compiler/glsl/opt_dead_code.cpp | 14 | ||||
-rw-r--r-- | src/compiler/glsl/standalone.cpp | 1 | ||||
-rw-r--r-- | src/compiler/glsl/test_optpass.cpp | 4 |
7 files changed, 11 insertions, 23 deletions
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index c2561c76efb..e579cf54462 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -2112,8 +2112,7 @@ opt_shader_and_create_symbol_table(const struct gl_constants *consts, * * Run it just once, since NIR will do the real optimization. */ - do_common_optimization(shader->ir, false, false, options, - consts->NativeIntegers); + do_common_optimization(shader->ir, false, options, consts->NativeIntegers); validate_ir_tree(shader->ir); @@ -2360,7 +2359,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, */ bool do_common_optimization(exec_list *ir, bool linked, - bool uniform_locations_assigned, const struct gl_shader_compiler_options *options, bool native_integers) { @@ -2398,7 +2396,7 @@ do_common_optimization(exec_list *ir, bool linked, OPT(opt_flip_matrices, ir); if (linked) - OPT(do_dead_code, ir, uniform_locations_assigned); + OPT(do_dead_code, ir); else OPT(do_dead_code_unlinked, ir); OPT(do_dead_code_local, ir); diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 165b827110f..985dce85847 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -212,8 +212,7 @@ glsl_to_nir(const struct gl_constants *consts, * TODO: add missing glsl ir to nir support and remove this loop. */ while (has_unsupported_function_param(sh->ir)) { - do_common_optimization(sh->ir, true, true, gl_options, - consts->NativeIntegers); + do_common_optimization(sh->ir, true, gl_options, consts->NativeIntegers); } nir_shader *shader = nir_shader_create(NULL, stage, options, diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h index 0c627d12fac..9dbcb37389b 100644 --- a/src/compiler/glsl/ir_optimization.h +++ b/src/compiler/glsl/ir_optimization.h @@ -79,7 +79,6 @@ enum lower_packing_builtins_op { }; bool do_common_optimization(exec_list *ir, bool linked, - bool uniform_locations_assigned, const struct gl_shader_compiler_options *options, bool native_integers); @@ -94,7 +93,7 @@ bool do_constant_variable(exec_list *instructions); bool do_constant_variable_unlinked(exec_list *instructions); bool do_copy_propagation_elements(exec_list *instructions); bool do_constant_propagation(exec_list *instructions); -bool do_dead_code(exec_list *instructions, bool uniform_locations_assigned); +bool do_dead_code(exec_list *instructions); bool do_dead_code_local(exec_list *instructions); bool do_dead_code_unlinked(exec_list *instructions); bool do_dead_functions(exec_list *instructions); diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 55023a23394..8d9bb3763c9 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -3566,8 +3566,7 @@ linker_optimisation_loop(const struct gl_constants *consts, exec_list *ir, unsigned stage) { /* Run it just once, since NIR will do the real optimizaiton. */ - do_common_optimization(ir, true, false, - &consts->ShaderCompilerOptions[stage], + do_common_optimization(ir, true, &consts->ShaderCompilerOptions[stage], consts->NativeIntegers); } diff --git a/src/compiler/glsl/opt_dead_code.cpp b/src/compiler/glsl/opt_dead_code.cpp index 3e571fc7dd0..a44fe10b9d0 100644 --- a/src/compiler/glsl/opt_dead_code.cpp +++ b/src/compiler/glsl/opt_dead_code.cpp @@ -43,7 +43,7 @@ static bool debug = false; * for usage on an unlinked instruction stream. */ bool -do_dead_code(exec_list *instructions, bool uniform_locations_assigned) +do_dead_code(exec_list *instructions) { ir_variable_refcount_visitor v; bool progress = false; @@ -122,12 +122,11 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned) */ /* uniform initializers are precious, and could get used by another - * stage. Also, once uniform locations have been assigned, the - * declaration cannot be deleted. + * stage. */ if (entry->var->data.mode == ir_var_uniform || entry->var->data.mode == ir_var_shader_storage) { - if (uniform_locations_assigned || entry->var->constant_initializer) + if (entry->var->constant_initializer) continue; /* Section 2.11.6 (Uniform Variables) of the OpenGL ES 3.0.3 spec @@ -188,12 +187,7 @@ do_dead_code_unlinked(exec_list *instructions) ir_function *f = ir->as_function(); if (f) { foreach_in_list(ir_function_signature, sig, &f->signatures) { - /* The setting of the uniform_locations_assigned flag here is - * irrelevent. If there is a uniform declaration encountered - * inside the body of the function, something has already gone - * terribly, terribly wrong. - */ - if (do_dead_code(&sig->body, false)) + if (do_dead_code(&sig->body)) progress = true; } } diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp index 91131d567bc..d79151c1f56 100644 --- a/src/compiler/glsl/standalone.cpp +++ b/src/compiler/glsl/standalone.cpp @@ -546,7 +546,6 @@ standalone_compile_shader(const struct standalone_options *_options, progress = do_common_optimization(ir, false, - false, compiler_options, true) && progress; diff --git a/src/compiler/glsl/test_optpass.cpp b/src/compiler/glsl/test_optpass.cpp index 0575484c868..bb894a03a49 100644 --- a/src/compiler/glsl/test_optpass.cpp +++ b/src/compiler/glsl/test_optpass.cpp @@ -63,7 +63,7 @@ do_optimization(struct exec_list *ir, const char *optimization, int int_3; if (sscanf(optimization, "do_common_optimization ( %d ) ", &int_0) == 1) { - return do_common_optimization(ir, int_0 != 0, false, options, true); + return do_common_optimization(ir, int_0 != 0, options, true); } else if (strcmp(optimization, "do_algebraic") == 0) { return do_algebraic(ir, true, options); } else if (strcmp(optimization, "do_constant_folding") == 0) { @@ -77,7 +77,7 @@ do_optimization(struct exec_list *ir, const char *optimization, } else if (strcmp(optimization, "do_constant_propagation") == 0) { return do_constant_propagation(ir); } else if (strcmp(optimization, "do_dead_code") == 0) { - return do_dead_code(ir, false); + return do_dead_code(ir); } else if (strcmp(optimization, "do_dead_code_local") == 0) { return do_dead_code_local(ir); } else if (strcmp(optimization, "do_dead_code_unlinked") == 0) { |