Module: Mesa Branch: main Commit: 5bf6f6fed12560cb3081d0a535baf057b0ea918a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5bf6f6fed12560cb3081d0a535baf057b0ea918a
Author: Samuel Pitoiset <[email protected]> Date: Fri Mar 24 17:45:47 2023 +0100 radv/rt: bind the pipeline stack when it's not dynamic This overwrites the rt_stack_size cmdbuf state when a new rt pipeline with a static stack size is bound. Signed-off-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22126> --- src/amd/vulkan/radv_cmd_buffer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index aaa4fbe17f9..b2f8519067b 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -6395,6 +6395,10 @@ radv_CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipeline cmd_buffer->state.rt_pipeline = rt_pipeline; cmd_buffer->push_constant_stages |= RADV_RT_STAGE_BITS; + + /* Bind the stack size when it's not dynamic. */ + if (rt_pipeline->stack_size != -1u) + cmd_buffer->state.rt_stack_size = rt_pipeline->stack_size; break; } case VK_PIPELINE_BIND_POINT_GRAPHICS: { @@ -10001,12 +10005,9 @@ radv_trace_rays(struct radv_cmd_buffer *cmd_buffer, const VkTraceRaysIndirectCom uint32_t scratch_bytes_per_wave = pipeline->base.scratch_bytes_per_wave; const struct radv_shader *compute_shader = pipeline->base.shaders[MESA_SHADER_COMPUTE]; uint32_t wave_size = compute_shader->info.wave_size; - uint32_t stack_size = cmd_buffer->state.rt_pipeline->stack_size; - if (stack_size == -1u) - stack_size = cmd_buffer->state.rt_stack_size; /* dynamic stack size */ /* The hardware register is specified as a multiple of 256 DWORDS. */ - scratch_bytes_per_wave += align(stack_size * wave_size, 1024); + scratch_bytes_per_wave += align(cmd_buffer->state.rt_stack_size * wave_size, 1024); cmd_buffer->compute_scratch_size_per_wave_needed = MAX2(cmd_buffer->compute_scratch_size_per_wave_needed, scratch_bytes_per_wave);
