From afd736bfd7f93ae62d0112ce84321b2f3b3a7eff Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 9 Apr 2026 13:46:04 +0200 Subject: [PATCH] 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 Part-of: --- src/amd/vulkan/radv_pipeline_graphics.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 2e15c3b702b..cdbc0777ef2 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -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; }