From: Timothy Arceri Date: Mon, 12 Dec 2022 02:06:54 +0000 (+1100) Subject: glsl: fix function inlining for images X-Git-Tag: upstream/23.3.3~15640 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e9b8dc7f8a25c1d0ff7e8f93ea7603b08f62d36;p=platform%2Fupstream%2Fmesa.git glsl: fix function inlining for images Here we skip replacing parameters with their actual values for images as glsl_to_nir() expects them to be copied to temps first. Tree grafting has a similiar rule to avoid this happening also. Fixes: 8d10a6835f32 ("glsl: dont create temps for builtin function inputs") Tested-by: Martin Roukala Reviewed-by: Emma Anholt Part-of: --- diff --git a/src/compiler/glsl/opt_function_inlining.cpp b/src/compiler/glsl/opt_function_inlining.cpp index 44a18cf..56ac90c 100644 --- a/src/compiler/glsl/opt_function_inlining.cpp +++ b/src/compiler/glsl/opt_function_inlining.cpp @@ -140,6 +140,12 @@ should_replace_variable(ir_variable *sig_param, ir_rvalue *param, sig_param->data.mode != ir_var_const_in) return false; + /* Some places in glsl_to_nir() expect images to always be copied to a temp + * first. + */ + if (sig_param->type->without_array()->is_image() && !param->is_dereference()) + return false; + /* 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,