radv: fix hashing graphics pipeline when no stages are compiled
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

It's possible with GPL.

This fixes a NULL pointer dereference with updated pipeline binaries
tests in VKCTS.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36999>
This commit is contained in:
Samuel Pitoiset 2025-08-26 08:05:32 +02:00 committed by Marge Bot
parent b9f060438f
commit 944e26eae7

View file

@ -3016,14 +3016,16 @@ radv_graphics_pipeline_hash(const struct radv_device *device, const struct radv_
_mesa_sha1_update(&ctx, &gfx_state->key.gfx_state, sizeof(gfx_state->key.gfx_state));
for (unsigned s = 0; s < MESA_VULKAN_SHADER_STAGES; s++) {
const struct radv_shader_stage *stage = &gfx_state->stages[s];
if (gfx_state->stages) {
for (unsigned s = 0; s < MESA_VULKAN_SHADER_STAGES; s++) {
const struct radv_shader_stage *stage = &gfx_state->stages[s];
if (stage->stage == MESA_SHADER_NONE)
continue;
if (stage->stage == MESA_SHADER_NONE)
continue;
_mesa_sha1_update(&ctx, stage->shader_sha1, sizeof(stage->shader_sha1));
_mesa_sha1_update(&ctx, &stage->key, sizeof(stage->key));
_mesa_sha1_update(&ctx, stage->shader_sha1, sizeof(stage->shader_sha1));
_mesa_sha1_update(&ctx, &stage->key, sizeof(stage->key));
}
}
_mesa_sha1_final(&ctx, hash);