From 10bab0c182029b6b033552cc522bd3536200807d Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 9 Apr 2022 14:02:50 +0200 Subject: [PATCH] [dxso] Use new DxvkShader constructor --- src/dxso/dxso_compiler.cpp | 43 +++++++++++++++++++------------------- src/dxso/dxso_compiler.h | 13 +++++++----- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/dxso/dxso_compiler.cpp b/src/dxso/dxso_compiler.cpp index caa46f184..b68608a00 100644 --- a/src/dxso/dxso_compiler.cpp +++ b/src/dxso/dxso_compiler.cpp @@ -246,17 +246,16 @@ namespace dxvk { Rc DxsoCompiler::compileShader() { - DxvkShaderOptions shaderOptions = { }; - DxvkShaderConstData constData = { }; + DxvkShaderCreateInfo info; + info.stage = m_programInfo.shaderStage(); + info.resourceSlotCount = m_resourceSlots.size(); + info.resourceSlots = m_resourceSlots.data(); + info.inputMask = m_inputMask; + info.outputMask = m_outputMask; + info.pushConstOffset = m_pushConstOffset; + info.pushConstSize = m_pushConstOffset; - return new DxvkShader( - m_programInfo.shaderStage(), - m_resourceSlots.size(), - m_resourceSlots.data(), - m_interfaceSlots, - m_module.compile(), - shaderOptions, - std::move(constData)); + return new DxvkShader(info, m_module.compile()); } void DxsoCompiler::emitInit() { @@ -709,8 +708,8 @@ namespace dxvk { uint32_t slot = 0; uint32_t& slots = input - ? m_interfaceSlots.inputSlots - : m_interfaceSlots.outputSlots; + ? m_inputMask + : m_outputMask; uint16_t& explicits = input ? m_explicitInputs @@ -1200,8 +1199,8 @@ namespace dxvk { uint32_t slot = RegisterLinkerSlot(semantic); uint32_t& slots = input - ? m_interfaceSlots.inputSlots - : m_interfaceSlots.outputSlots; + ? m_inputMask + : m_outputMask; slots |= 1u << slot; @@ -1243,7 +1242,7 @@ namespace dxvk { m_module.constvec4f32(0.0f, 0.0f, 0.0f, 0.0f), spv::StorageClassOutput); - m_interfaceSlots.outputSlots |= 1u << idx; + m_outputMask |= 1u << idx; m_module.decorateLocation(m_ps.oColor[idx].id, idx); m_module.decorateIndex(m_ps.oColor[idx].id, 0); @@ -3596,7 +3595,7 @@ void DxsoCompiler::emitControlFlowGenericLoop( m_module.setDebugName(outputPtr, name.c_str()); - m_interfaceSlots.outputSlots |= 1u << slot; + m_outputMask |= 1u << slot; m_entryPointInterfaces.push_back(outputPtr); }; @@ -3714,20 +3713,20 @@ void DxsoCompiler::emitControlFlowGenericLoop( // No FF fog component. if (m_programInfo.type() == DxsoProgramType::PixelShader) { if (m_programInfo.majorVersion() == 3) { - m_interfaceSlots.pushConstOffset = offsetof(D3D9RenderStateInfo, alphaRef); - m_interfaceSlots.pushConstSize = sizeof(float); + m_pushConstOffset = offsetof(D3D9RenderStateInfo, alphaRef); + m_pushConstSize = sizeof(float); } else { - m_interfaceSlots.pushConstOffset = 0; - m_interfaceSlots.pushConstSize = offsetof(D3D9RenderStateInfo, pointSize); + m_pushConstOffset = 0; + m_pushConstSize = offsetof(D3D9RenderStateInfo, pointSize); } count = 5; } else { - m_interfaceSlots.pushConstOffset = offsetof(D3D9RenderStateInfo, pointSize); + m_pushConstOffset = offsetof(D3D9RenderStateInfo, pointSize); // Point scale never triggers on programmable - m_interfaceSlots.pushConstSize = sizeof(float) * 3; + m_pushConstSize = sizeof(float) * 3; count = 8; } diff --git a/src/dxso/dxso_compiler.h b/src/dxso/dxso_compiler.h index 0cacbb77f..f26732f45 100644 --- a/src/dxso/dxso_compiler.h +++ b/src/dxso/dxso_compiler.h @@ -355,7 +355,10 @@ namespace dxvk { //////////////////////////////////////////// // Inter-stage shader interface slots. Also // covers vertex input and fragment output. - DxvkInterfaceSlots m_interfaceSlots; + uint32_t m_inputMask = 0u; + uint32_t m_outputMask = 0u; + uint32_t m_pushConstOffset = 0u; + uint32_t m_pushConstSize = 0u; /////////////////////////////////// // Shader-specific data structures @@ -435,14 +438,14 @@ namespace dxvk { DxsoTextureType type); bool defineInput(uint32_t idx) { - bool alreadyDefined = m_interfaceSlots.inputSlots & 1u << idx; - m_interfaceSlots.inputSlots |= 1u << idx; + bool alreadyDefined = m_inputMask & 1u << idx; + m_inputMask |= 1u << idx; return alreadyDefined; } bool defineOutput(uint32_t idx) { - bool alreadyDefined = m_interfaceSlots.outputSlots & 1u << idx; - m_interfaceSlots.outputSlots |= 1u << idx; + bool alreadyDefined = m_outputMask & 1u << idx; + m_outputMask |= 1u << idx; return alreadyDefined; }