From a49333cd87d0c764167107a4c5277ae214ae657e Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 5 Jul 2022 18:59:40 +0200 Subject: [PATCH] [dxvk] Add pass to check whether a shader has spec constants Pipeline libraries cannot be used for shaders with user spec constants. --- src/dxvk/dxvk_shader.cpp | 3 +++ src/dxvk/dxvk_shader.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/dxvk/dxvk_shader.cpp b/src/dxvk/dxvk_shader.cpp index 6fa9338f..aca093b2 100644 --- a/src/dxvk/dxvk_shader.cpp +++ b/src/dxvk/dxvk_shader.cpp @@ -115,6 +115,9 @@ namespace dxvk { bindingOffsets[varId].setOffset = ins.offset() + 3; } + if (ins.arg(2) == spv::DecorationSpecId && ins.arg(3) < MaxNumSpecConstants) + m_flags.set(DxvkShaderFlag::HasSpecConstants); + if (ins.arg(2) == spv::DecorationLocation && ins.arg(3) == 1) { m_o1LocOffset = ins.offset() + 3; o1VarId = ins.arg(1); diff --git a/src/dxvk/dxvk_shader.h b/src/dxvk/dxvk_shader.h index 40e2023b..56e0f6f5 100644 --- a/src/dxvk/dxvk_shader.h +++ b/src/dxvk/dxvk_shader.h @@ -39,6 +39,7 @@ namespace dxvk { enum DxvkShaderFlag : uint64_t { HasSampleRateShading, HasTransformFeedback, + HasSpecConstants, ExportsStencilRef, ExportsViewportIndexLayerFromVertexStage, };