glsl: don't inline functions in glsl ir
Everthing is now in place for nir and glsl to nir to handle this stuff for us. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27108>
This commit is contained in:
@@ -2487,10 +2487,6 @@ do_common_optimization(exec_list *ir, bool linked,
|
|||||||
} \
|
} \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
if (linked) {
|
|
||||||
OPT(do_function_inlining, ir);
|
|
||||||
OPT(do_dead_functions, ir);
|
|
||||||
}
|
|
||||||
OPT(propagate_invariance, ir);
|
OPT(propagate_invariance, ir);
|
||||||
OPT(do_if_simplification, ir);
|
OPT(do_if_simplification, ir);
|
||||||
OPT(opt_flatten_nested_if_blocks, ir);
|
OPT(opt_flatten_nested_if_blocks, ir);
|
||||||
|
@@ -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
|
void
|
||||||
link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
|
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,
|
do_lower_jumps(ir, true, true, gl_options->EmitNoMainReturn,
|
||||||
gl_options->EmitNoCont);
|
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:
|
done:
|
||||||
|
Reference in New Issue
Block a user