From 9527fbe596e2ace276c158f67a900c29aad6cdd0 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 24 Jun 2022 06:15:03 -0700 Subject: [PATCH] dzn: Fix CmdPushConstants() The original offset value is overwritten in our first for(i: num_states) iteration, messing up the compute push constant update if stageFlags applies to both compute and graphics. Reviewed-by: Jesse Natalie Part-of: --- src/microsoft/vulkan/dzn_cmd_buffer.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/microsoft/vulkan/dzn_cmd_buffer.c b/src/microsoft/vulkan/dzn_cmd_buffer.c index 1eaebb2ddb5..2171dfbabf9 100644 --- a/src/microsoft/vulkan/dzn_cmd_buffer.c +++ b/src/microsoft/vulkan/dzn_cmd_buffer.c @@ -3815,16 +3815,9 @@ dzn_CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, for (uint32_t i = 0; i < num_states; i++) { memcpy(((char *)states[i]->values) + offset, pValues, size); - - uint32_t current_offset = states[i]->offset; - uint32_t current_end = states[i]->end; - uint32_t end = offset + size; - if (current_end != 0) { - offset = MIN2(current_offset, offset); - end = MAX2(current_end, end); - } - states[i]->offset = offset; - states[i]->end = end; + states[i]->offset = + states[i]->end > 0 ? MIN2(states[i]->offset, offset) : offset; + states[i]->end = MAX2(states[i]->end, offset + size); } }