radv: zero-allocate graphics shader stages

This can prevent issues with unitialized memory. RT and compute
stages are already zero-initialized.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39483>
This commit is contained in:
Samuel Pitoiset 2026-04-09 13:46:04 +02:00 committed by Marge Bot
parent 0b016f4bff
commit afd736bfd7

View file

@ -3032,7 +3032,7 @@ radv_generate_graphics_pipeline_state(struct radv_device *device, const VkGraphi
if (gfx_state->compilation_required) {
gfx_state->key = radv_generate_graphics_pipeline_key(device, pCreateInfo, &gfx_state->vk, needed_lib_flags);
gfx_state->stages = malloc(sizeof(struct radv_shader_stage) * MESA_VULKAN_SHADER_STAGES);
gfx_state->stages = calloc(MESA_VULKAN_SHADER_STAGES, sizeof(struct radv_shader_stage));
if (!gfx_state->stages) {
result = VK_ERROR_OUT_OF_HOST_MEMORY;
goto fail;
@ -3040,9 +3040,6 @@ radv_generate_graphics_pipeline_state(struct radv_device *device, const VkGraphi
for (unsigned i = 0; i < MESA_VULKAN_SHADER_STAGES; i++) {
gfx_state->stages[i].stage = MESA_SHADER_NONE;
gfx_state->stages[i].nir = NULL;
gfx_state->stages[i].gs_copy_shader = NULL;
gfx_state->stages[i].spirv.size = 0;
gfx_state->stages[i].next_stage = MESA_SHADER_NONE;
}