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

Author: Faith Ekstrand <faith.ekstr...@collabora.com>
Date:   Mon Jan  8 12:00:13 2024 -0600

nvk: Set a minimum of one patch control point

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27049>

---

 src/nouveau/vulkan/nvk_cmd_draw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/nouveau/vulkan/nvk_cmd_draw.c 
b/src/nouveau/vulkan/nvk_cmd_draw.c
index 4ef277c982f..f0b2df87922 100644
--- a/src/nouveau/vulkan/nvk_cmd_draw.c
+++ b/src/nouveau/vulkan/nvk_cmd_draw.c
@@ -1030,7 +1030,10 @@ nvk_flush_ts_state(struct nvk_cmd_buffer *cmd)
    struct nv_push *p = nvk_cmd_buffer_push(cmd, 4);
 
    if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_TS_PATCH_CONTROL_POINTS)) {
-      P_IMMD(p, NV9097, SET_PATCH, dyn->ts.patch_control_points);
+      /* The hardware gets grumpy if we set this to 0 so make sure we set it
+       * to at least 1 in case it's dirty but uninitialized.
+       */
+      P_IMMD(p, NV9097, SET_PATCH, MAX2(1, dyn->ts.patch_control_points));
    }
 
    if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_TS_DOMAIN_ORIGIN)) {

Reply via email to