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 <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17233>
This commit is contained in:
Boris Brezillon 2022-06-24 06:15:03 -07:00 committed by Marge Bot
parent 5aeefe8d75
commit 9527fbe596
1 changed files with 3 additions and 10 deletions

View File

@ -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);
}
}