From 9573c389de145bca2a676060070d99f040ae2d35 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 12 Feb 2025 13:00:25 +0100 Subject: [PATCH] [dxvk] Don't create GPL pipeline if we need to patch the vertex shader Works around a game bug in Kingdom Come Deliverance and silences a validation error. --- src/dxvk/dxvk_graphics.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index ec6b2147b..7a8ed26a0 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -1176,6 +1176,17 @@ namespace dxvk { && !state.rs.depthClipEnable()) return false; + // If the vertex shader uses any input locations not provided by + // the input layout, we need to patch the shader. + uint32_t vsInputMask = m_shaders.vs->info().inputMask; + uint32_t ilAttributeMask = 0u; + + for (uint32_t i = 0; i < state.il.attributeCount(); i++) + ilAttributeMask |= 1u << state.ilAttributes[i].location(); + + if ((vsInputMask & ilAttributeMask) != vsInputMask) + return false; + if (m_shaders.tcs != nullptr) { // If tessellation shaders are present, the input patch // vertex count must match the shader's definition.