Mesa (main): radv: fix pre-computing viewport xform when setting new viewports

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 17 07:03:03 UTC 2021


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Fri Aug 13 12:04:42 2021 +0200

radv: fix pre-computing viewport xform when setting new viewports

viewportCount is the number of viewports in pViewports while
firstViewport is the index.

Fixes new CTS dEQP-VK.draw.depth_clamp.*_clamp_four_viewports

Fixes: a2ef92d7a58 ("radv: pre-calculate viewport transforms")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12353>

---

 src/amd/vulkan/radv_cmd_buffer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index bf621c2c3ff..7c14f6de2a0 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -4412,8 +4412,11 @@ radv_CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint3
 
    memcpy(state->dynamic.viewport.viewports + firstViewport, pViewports,
           viewportCount * sizeof(*pViewports));
-   for (unsigned i = firstViewport; i < firstViewport + viewportCount; i++)
-      radv_get_viewport_xform(&pViewports[i], state->dynamic.viewport.xform[i].scale, state->dynamic.viewport.xform[i].translate);
+   for (unsigned i = 0; i < viewportCount; i++) {
+      radv_get_viewport_xform(&pViewports[i],
+                              state->dynamic.viewport.xform[i + firstViewport].scale,
+                              state->dynamic.viewport.xform[i + firstViewport].translate);
+   }
 
    state->dirty |= RADV_CMD_DIRTY_DYNAMIC_VIEWPORT;
 }



More information about the mesa-commit mailing list