Mesa (main): dzn: Fix CmdPushConstants()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 24 16:43:58 UTC 2022


Module: Mesa
Branch: main
Commit: 9527fbe596e2ace276c158f67a900c29aad6cdd0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9527fbe596e2ace276c158f67a900c29aad6cdd0

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Fri Jun 24 06:15:03 2022 -0700

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 at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17233>

---

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



More information about the mesa-commit mailing list