From d6f4e8377701fcc10157592d7472743b7004e48c Mon Sep 17 00:00:00 2001
From: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Date: Mon, 10 Feb 2025 21:06:37 +0100
Subject: [PATCH] [dxvk] Add perf hint to avoid secondary command buffers

---
 src/dxvk/dxvk_device.cpp | 5 +++++
 src/dxvk/dxvk_device.h   | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/dxvk/dxvk_device.cpp b/src/dxvk/dxvk_device.cpp
index 31d0c1468..eed3eb3cf 100644
--- a/src/dxvk/dxvk_device.cpp
+++ b/src/dxvk/dxvk_device.cpp
@@ -446,6 +446,11 @@ namespace dxvk {
 
     applyTristate(tilerMode, m_options.tilerMode);
     hints.preferRenderPassOps = tilerMode;
+
+    // Be less aggressive on secondary command buffer usage on
+    // drivers that do not natively support them
+    hints.preferPrimaryCmdBufs = !hints.preferRenderPassOps
+      || m_adapter->matchesDriver(VK_DRIVER_ID_MESA_HONEYKRISP);
     return hints;
   }
 
diff --git a/src/dxvk/dxvk_device.h b/src/dxvk/dxvk_device.h
index e1eecc825..2ec517c2e 100644
--- a/src/dxvk/dxvk_device.h
+++ b/src/dxvk/dxvk_device.h
@@ -39,6 +39,7 @@ namespace dxvk {
     VkBool32 preferFbResolve          : 1;
     VkBool32 renderPassClearFormatBug : 1;
     VkBool32 preferRenderPassOps      : 1;
+    VkBool32 preferPrimaryCmdBufs     : 1;
   };
   
   /**