From 43bdfebbff2c5557355df88816e737ef19618ed2 Mon Sep 17 00:00:00 2001 From: Friedrich Vock Date: Thu, 4 Jan 2024 14:41:18 +0100 Subject: [PATCH] radv: Fix shader replay allocation condition Cc: mesa-stable Part-of: --- src/amd/vulkan/radv_shader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 821dde34bfa..49fe3371480 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -1299,14 +1299,14 @@ radv_replay_shader_arena_block(struct radv_device *device, const struct radv_ser if (!hole->freelist.prev) continue; - if (hole->offset + hole->size < src->offset) - continue; - uint32_t hole_begin = hole->offset; uint32_t hole_end = hole->offset + hole->size; + if (hole_end < block_end) + continue; + /* If another allocated block overlaps the current replay block, allocation is impossible */ - if (block_begin > hole_begin || (hole_end < block_end && hole_end >= block_begin)) + if (hole_begin > block_begin) return NULL; union radv_shader_arena_block *block = insert_block(device, hole, block_begin - hole_begin, src->size, NULL);