From 39052dabf9596da99703203621d1ca404f5dde6c Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 25 Jan 2024 16:18:39 +1100 Subject: [PATCH] glsl: don't inline functions in glsl ir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Everthing is now in place for nir and glsl to nir to handle this stuff for us. Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/glsl_parser_extras.cpp | 4 -- src/compiler/glsl/linker.cpp | 61 ------------------------ 2 files changed, 65 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 587845a2134..d4ddaa65ff6 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -2487,10 +2487,6 @@ do_common_optimization(exec_list *ir, bool linked, } \ } while (false) - if (linked) { - OPT(do_function_inlining, ir); - OPT(do_dead_functions, ir); - } OPT(propagate_invariance, ir); OPT(do_if_simplification, ir); OPT(opt_flatten_nested_if_blocks, ir); diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index e6cb890e83c..fbb5d916b16 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2583,57 +2583,6 @@ verify_subroutine_associated_funcs(struct gl_shader_program *prog) } } -/* glsl_to_nir can only handle converting certain function paramaters - * to NIR. This visitor checks for parameters it can't currently handle. - */ -class ir_function_param_visitor : public ir_hierarchical_visitor -{ -public: - ir_function_param_visitor() - : unsupported(false) - { - } - - virtual ir_visitor_status visit_enter(ir_function_signature *ir) - { - - if (ir->is_intrinsic()) - return visit_continue; - - foreach_in_list(ir_variable, param, &ir->parameters) { - if (param->data.mode != ir_var_function_in && - param->data.mode != ir_var_const_in) - continue; - - /* SSBO and shared vars might be passed to a built-in such as an - * atomic memory function, where copying these to a temp before - * passing to the atomic function is not valid so we must replace - * these instead. Also, shader inputs for interpolateAt functions - * also need to be replaced. - * - * We have no way to handle this in NIR or the glsl to nir pass - * currently so let the GLSL IR lowering handle it. - */ - if (ir->is_builtin()) { - unsupported = true; - return visit_stop; - } - } - - return visit_continue; - } - - bool unsupported; -}; - -static bool -has_unsupported_function_param(exec_list *ir) -{ - ir_function_param_visitor visitor; - visit_list_elements(&visitor, ir); - return visitor.unsupported; -} - void link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) { @@ -2903,16 +2852,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) */ do_lower_jumps(ir, true, true, gl_options->EmitNoMainReturn, gl_options->EmitNoCont); - - /* glsl_to_nir can only handle converting certain function paramaters - * to NIR. If we find something we can't handle then we get the GLSL IR - * opts to remove it before we continue on. - * - * TODO: add missing glsl ir to nir support and remove this loop. - */ - while (has_unsupported_function_param(ir)) { - do_common_optimization(ir, true, gl_options, consts->NativeIntegers); - } } done: