[PATCH vkd3d] vkd3d: Do not attempt to enable primitive restart for non-strip topology.

Conor McCarthy cmccarthy at codeweavers.com
Thu Aug 26 22:16:38 CDT 2021


Prevents a validation failure if a d3d12 strip cut value is supplied.
Based on a vkd3d-proton patch by Hans-Kristian Arntzen.

Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
---
 libs/vkd3d/state.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index cccd2ac0..12d11d48 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2901,6 +2901,21 @@ static enum VkPrimitiveTopology vk_topology_from_d3d12_topology(D3D12_PRIMITIVE_
     }
 }
 
+static bool vk_topology_can_restart(VkPrimitiveTopology topology)
+{
+    switch (topology)
+    {
+        case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
+        case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
+        case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
+        case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
+            return false;
+
+        default:
+            return true;
+    }
+}
+
 static VkPipeline d3d12_pipeline_state_find_compiled_pipeline(const struct d3d12_pipeline_state *state,
         const struct vkd3d_pipeline_key *key, VkRenderPass *vk_render_pass)
 {
@@ -3077,7 +3092,8 @@ VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_sta
     ia_desc.pNext = NULL;
     ia_desc.flags = 0;
     ia_desc.topology = vk_topology_from_d3d12_topology(topology);
-    ia_desc.primitiveRestartEnable = !!graphics->index_buffer_strip_cut_value;
+    ia_desc.primitiveRestartEnable = graphics->index_buffer_strip_cut_value
+            && vk_topology_can_restart(ia_desc.topology);
 
     tessellation_info.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
     tessellation_info.pNext = NULL;
-- 
2.32.0




More information about the wine-devel mailing list