From 4d9c09b5e7faf980de0e215d235475663ace3657 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 6 Aug 2022 02:09:55 +0200 Subject: [PATCH] [dxvk] Don't use pipeline libraries for VS that doesn't export position --- src/dxvk/dxvk_shader.cpp | 10 ++++++++++ src/dxvk/dxvk_shader.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/dxvk/dxvk_shader.cpp b/src/dxvk/dxvk_shader.cpp index dc25c61b..b2ef37e3 100644 --- a/src/dxvk/dxvk_shader.cpp +++ b/src/dxvk/dxvk_shader.cpp @@ -89,6 +89,11 @@ namespace dxvk { varIds.push_back(varId); } + if (ins.arg(2) == spv::DecorationBuiltIn) { + if (ins.arg(3) == spv::BuiltInPosition) + m_flags.set(DxvkShaderFlag::ExportsPosition); + } + if (ins.arg(2) == spv::DecorationDescriptorSet) { uint32_t varId = ins.arg(1); bindingOffsets.resize(std::max(bindingOffsets.size(), size_t(varId + 1))); @@ -190,6 +195,11 @@ namespace dxvk { && m_info.stage != VK_SHADER_STAGE_COMPUTE_BIT) return false; + // Standalone vertex shaders must export vertex position + if (m_info.stage == VK_SHADER_STAGE_VERTEX_BIT + && !m_flags.test(DxvkShaderFlag::ExportsPosition)) + return false; + // Ignore shaders that have user-defined spec constants // and no selector to read their contents from elsewhere return !m_specConstantMask || (m_specConstantMask & (1u << MaxNumSpecConstants)); diff --git a/src/dxvk/dxvk_shader.h b/src/dxvk/dxvk_shader.h index e0eec2e0..0a628054 100644 --- a/src/dxvk/dxvk_shader.h +++ b/src/dxvk/dxvk_shader.h @@ -27,6 +27,7 @@ namespace dxvk { enum DxvkShaderFlag : uint64_t { HasSampleRateShading, HasTransformFeedback, + ExportsPosition, ExportsStencilRef, ExportsViewportIndexLayerFromVertexStage, };