From 182877f3c8979630418ba656d95626f48332f353 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Tue, 28 Oct 2025 22:09:48 -0400 Subject: [PATCH] nvk: Don't re-initialize the descriptor writer if the set matches The logic here before was wrong. In the case where the set is the same, it would avoid the flush but then re-initialize anyway, loosing the dirty information and causing us not to actually flush out all the descriptors. Fixes: 1f0fda22f7fe ("nvk: Flush descriptor set maps") (cherry picked from commit 2f6b3b6b91f25c3f9d3abdcb3fdfb7f47a0196d9) Part-of: --- .pick_status.json | 2 +- src/nouveau/vulkan/nvk_descriptor_set.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 529156e7324..0afbfbe0eb4 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -114,7 +114,7 @@ "description": "nvk: Don't re-initialize the descriptor writer if the set matches", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "1f0fda22f7fe6bec8a001c89b967888fc0399868", "notes": null diff --git a/src/nouveau/vulkan/nvk_descriptor_set.c b/src/nouveau/vulkan/nvk_descriptor_set.c index a53c3d32ce0..651aab18d9c 100644 --- a/src/nouveau/vulkan/nvk_descriptor_set.c +++ b/src/nouveau/vulkan/nvk_descriptor_set.c @@ -94,7 +94,14 @@ nvk_descriptor_writer_next_set(struct nvk_descriptor_writer *w, { const struct nvk_physical_device *pdev = w->pdev; - if (w->set != NULL && w->set != set) + /* If we're writing to the same set, keep using the original writer as-is + * so we don't do unnecessary extra flushing in the case where the client + * has a lot of writes to the same set back-to-back. + */ + if (w->set == set) + return; + + if (w->set != NULL) nvk_descriptor_writer_finish(w); nvk_descriptor_writer_init_set(pdev, w, set);