From e4dae74865bc929167dcaa2df5c6fa1eccb473f6 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 23 Feb 2018 12:55:23 +0100 Subject: [PATCH] [dxvk] Validate tessellation state for graphics pipeline This should help with freezes as long as Tessellation is not properly implemented. --- src/d3d11/d3d11_device.cpp | 5 +++++ src/dxgi/dxgi_presenter.cpp | 1 + src/dxvk/dxvk_graphics.cpp | 5 +++++ src/dxvk/hud/dxvk_hud_text.cpp | 1 + 4 files changed, 12 insertions(+) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index a4e70812..b07a0509 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -807,6 +807,11 @@ namespace dxvk { } } + std::sort(bindings.begin(), bindings.end(), + [] (const DxvkVertexBinding& a, const DxvkVertexBinding& b) { + return a.binding < b.binding; + }); + // Create the actual input layout object // if the application requests it. if (ppInputLayout != nullptr) { diff --git a/src/dxgi/dxgi_presenter.cpp b/src/dxgi/dxgi_presenter.cpp index d8515807..003e8eb2 100644 --- a/src/dxgi/dxgi_presenter.cpp +++ b/src/dxgi/dxgi_presenter.cpp @@ -50,6 +50,7 @@ namespace dxvk { DxvkInputAssemblyState iaState; iaState.primitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; iaState.primitiveRestart = VK_FALSE; + iaState.patchVertexCount = 0; m_context->setInputAssemblyState(iaState); m_context->setInputLayout( diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index 7c07db99..b5586bb1 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -247,6 +247,11 @@ namespace dxvk { if (tsInfo.patchControlPoints == 0) info.pTessellationState = nullptr; + if ((tsInfo.patchControlPoints != 0) && (m_tcs == nullptr || m_tes == nullptr)) { + Logger::err("DxvkGraphicsPipeline: Cannot use tessellation patches without tessellation shaders"); + return VK_NULL_HANDLE; + } + VkPipeline pipeline = VK_NULL_HANDLE; if (m_vkd->vkCreateGraphicsPipelines(m_vkd->device(), m_cache->handle(), 1, &info, nullptr, &pipeline) != VK_SUCCESS) { diff --git a/src/dxvk/hud/dxvk_hud_text.cpp b/src/dxvk/hud/dxvk_hud_text.cpp index e44a9433..60155829 100644 --- a/src/dxvk/hud/dxvk_hud_text.cpp +++ b/src/dxvk/hud/dxvk_hud_text.cpp @@ -31,6 +31,7 @@ namespace dxvk::hud { DxvkInputAssemblyState iaState; iaState.primitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; iaState.primitiveRestart = VK_FALSE; + iaState.patchVertexCount = 0; context->setInputAssemblyState(iaState); const std::array ilAttributes = {{