radv/rt: Fix updating stack_size if the shader uses scratch
authorKonstantin Seurer <konstantin.seurer@gmail.com>
Tue, 7 Mar 2023 07:28:54 +0000 (08:28 +0100)
committerMarge Bot <emma+marge@anholt.net>
Wed, 8 Mar 2023 22:17:00 +0000 (22:17 +0000)
src_vars contains the stack_size of the shader that is about to get inlined.

Fixes: 7fadee9b70c9d1d7229c7bbc9811a858297b193c ('radv/rt: only reserve stack_sizes after rt_case insertion')
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21768>

src/amd/vulkan/radv_rt_shader.c

index c60c5f9..30c35d6 100644 (file)
@@ -815,7 +815,7 @@ insert_rt_case(nir_builder *b, nir_shader *shader, struct rt_variables *vars, ni
    if (shader->info.stage == MESA_SHADER_CLOSEST_HIT || call_idx == 1)
       NIR_PASS_V(shader, lower_hit_attribs, NULL, workgroup_size);
 
-   vars->stack_size = MAX2(vars->stack_size, shader->scratch_size);
+   src_vars.stack_size = MAX2(src_vars.stack_size, shader->scratch_size);
 
    nir_push_if(b, nir_ieq_imm(b, idx, call_idx));
    nir_inline_function_impl(b, nir_shader_get_entrypoint(shader), NULL, var_remap);