Module: vkd3d Branch: master Commit: eadf0ba88e46dd7a44105f04a763116ae27ead65 URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=eadf0ba88e46dd7a44105f04...
Author: Conor McCarthy cmccarthy@codeweavers.com Date: Tue Sep 14 12:58:17 2021 +1000
vkd3d: Do not attempt to enable primitive restart for non-strip topology.
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@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
libs/vkd3d/state.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 4eccf1e..9e554b4 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -2762,6 +2762,23 @@ static enum VkPrimitiveTopology vk_topology_from_d3d12_topology(D3D12_PRIMITIVE_ } }
+static bool vk_topology_can_restart(VkPrimitiveTopology topology) +{ + switch (topology) + { + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST: + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY: + case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST: + case VK_PRIMITIVE_TOPOLOGY_POINT_LIST: + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST: + case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY: + 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) { @@ -2938,7 +2955,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);
if (ia_desc.topology == VK_PRIMITIVE_TOPOLOGY_MAX_ENUM) {