From 7687db030369566aa31c5d22c274bcab3f4c7bee Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 6 May 2019 00:18:59 +0200 Subject: [PATCH] [dxvk] Remove extra pipeline state This can be expressed with specialization constants now. --- src/d3d11/d3d11_context.cpp | 12 ------------ src/d3d11/d3d11_context.h | 2 -- src/d3d11/d3d11_swapchain.cpp | 3 --- src/d3d11/d3d11_swapchain.h | 1 - src/dxvk/dxvk_constant_state.h | 12 ------------ src/dxvk/dxvk_context.cpp | 8 -------- src/dxvk/dxvk_context.h | 7 ------- src/dxvk/dxvk_graphics.cpp | 2 -- src/dxvk/dxvk_graphics.h | 2 -- src/dxvk/dxvk_shader.h | 8 +------- src/dxvk/dxvk_state_cache.cpp | 11 ----------- src/dxvk/dxvk_state_cache.h | 3 --- 12 files changed, 1 insertion(+), 70 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index c39d350a5..bd601b8b0 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -3121,17 +3121,6 @@ namespace dxvk { }); } - - void D3D11DeviceContext::ApplyUnusedState() { - // Initialize state that isn't exposed in D3D11 - EmitCs([] (DxvkContext* ctx) { - DxvkExtraState xs; - xs.alphaCompareOp = VK_COMPARE_OP_ALWAYS; - - ctx->setExtraState(xs); - }); - } - void D3D11DeviceContext::BindShader( DxbcProgramType ShaderStage, @@ -3577,7 +3566,6 @@ namespace dxvk { ApplyStencilRef(); ApplyRasterizerState(); ApplyViewportState(); - ApplyUnusedState(); BindDrawBuffers( m_state.id.argBuffer.ptr(), diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index 5727232e5..b7893abb3 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -679,8 +679,6 @@ namespace dxvk { void ApplyViewportState(); - void ApplyUnusedState(); - void BindShader( DxbcProgramType ShaderStage, const D3D11CommonShader* pShaderModule); diff --git a/src/d3d11/d3d11_swapchain.cpp b/src/d3d11/d3d11_swapchain.cpp index ae811d17a..e65cd090d 100644 --- a/src/d3d11/d3d11_swapchain.cpp +++ b/src/d3d11/d3d11_swapchain.cpp @@ -279,7 +279,6 @@ namespace dxvk { m_context->setMultisampleState(m_msState); m_context->setDepthStencilState(m_dsState); m_context->setLogicOpState(m_loState); - m_context->setExtraState(m_xsState); m_context->setBlendMode(0, m_blendMode); m_context->setInputAssemblyState(m_iaState); @@ -615,8 +614,6 @@ namespace dxvk { m_loState.enableLogicOp = VK_FALSE; m_loState.logicOp = VK_LOGIC_OP_NO_OP; - m_xsState.alphaCompareOp = VK_COMPARE_OP_ALWAYS; - m_blendMode.enableBlending = VK_FALSE; m_blendMode.colorSrcFactor = VK_BLEND_FACTOR_ONE; m_blendMode.colorDstFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; diff --git a/src/d3d11/d3d11_swapchain.h b/src/d3d11/d3d11_swapchain.h index 67cdbe524..75edb5260 100644 --- a/src/d3d11/d3d11_swapchain.h +++ b/src/d3d11/d3d11_swapchain.h @@ -109,7 +109,6 @@ namespace dxvk { DxvkMultisampleState m_msState; DxvkDepthStencilState m_dsState; DxvkLogicOpState m_loState; - DxvkExtraState m_xsState; DxvkBlendMode m_blendMode; D3D11Texture2D* m_backBuffer = nullptr; diff --git a/src/dxvk/dxvk_constant_state.h b/src/dxvk/dxvk_constant_state.h index b2b87d678..fa17ea63e 100644 --- a/src/dxvk/dxvk_constant_state.h +++ b/src/dxvk/dxvk_constant_state.h @@ -204,16 +204,4 @@ namespace dxvk { std::array bindings; }; - - /** - * \brief Extra state - * - * Additional state that will be passed to - * the graphics pipeline as specialization - * constants. - */ - struct DxvkExtraState { - VkCompareOp alphaCompareOp; - }; - } \ No newline at end of file diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 2504bf5a2..ebf192fbb 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -2142,14 +2142,6 @@ namespace dxvk { m_flags.set(DxvkContextFlag::GpDirtyPipelineState); } - - - void DxvkContext::setExtraState( - const DxvkExtraState& xs) { - m_state.gp.state.xsAlphaCompareOp = xs.alphaCompareOp; - - m_flags.set(DxvkContextFlag::GpDirtyPipelineState); - } void DxvkContext::setPredicate( diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h index 6bf05bac4..043007afb 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -856,13 +856,6 @@ namespace dxvk { uint32_t attachment, const DxvkBlendMode& blendMode); - /** - * \brief Sets extra pipeline state - * \param [in] xs New state object - */ - void setExtraState( - const DxvkExtraState& xs); - /** * \brief Sets predicate * diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index 254546102..d5086385a 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -192,8 +192,6 @@ namespace dxvk { // Set up some specialization constants DxvkSpecConstants specData; specData.set(uint32_t(DxvkSpecConstantId::RasterizerSampleCount), sampleCount, VK_SAMPLE_COUNT_1_BIT); - specData.set(uint32_t(DxvkSpecConstantId::AlphaTestEnable), state.xsAlphaCompareOp != VK_COMPARE_OP_ALWAYS, false); - specData.set(uint32_t(DxvkSpecConstantId::AlphaCompareOp), state.xsAlphaCompareOp, VK_COMPARE_OP_ALWAYS); for (uint32_t i = 0; i < m_layout->bindingCount(); i++) specData.set(i, state.bsBindingMask.isBound(i), true); diff --git a/src/dxvk/dxvk_graphics.h b/src/dxvk/dxvk_graphics.h index fcb82f844..5ee841c03 100644 --- a/src/dxvk/dxvk_graphics.h +++ b/src/dxvk/dxvk_graphics.h @@ -97,8 +97,6 @@ namespace dxvk { uint32_t msSampleMask; VkBool32 msEnableAlphaToCoverage; - VkCompareOp xsAlphaCompareOp; - VkBool32 dsEnableDepthTest; VkBool32 dsEnableDepthWrite; VkBool32 dsEnableDepthBoundsTest; diff --git a/src/dxvk/dxvk_shader.h b/src/dxvk/dxvk_shader.h index 2193a5f67..640d12793 100644 --- a/src/dxvk/dxvk_shader.h +++ b/src/dxvk/dxvk_shader.h @@ -30,13 +30,7 @@ namespace dxvk { // Specialization constants for pipeline state SpecConstantRangeStart = ColorComponentMappings + MaxNumRenderTargets * 4, - RasterizerSampleCount = SpecConstantRangeStart + 0, - AlphaTestEnable, - AlphaCompareOp, - - /// Lowest and highest known spec constant IDs - SpecConstantIdMin = RasterizerSampleCount, - SpecConstantIdMax = AlphaCompareOp, + RasterizerSampleCount = SpecConstantRangeStart, }; diff --git a/src/dxvk/dxvk_state_cache.cpp b/src/dxvk/dxvk_state_cache.cpp index 3a8d70730..f712c6ff1 100644 --- a/src/dxvk/dxvk_state_cache.cpp +++ b/src/dxvk/dxvk_state_cache.cpp @@ -309,7 +309,6 @@ namespace dxvk { if (readCacheEntry(ifile, entry)) { switch (curHeader.version) { case 2: convertEntryV2(entry); /* fall through */ - case 3: convertEntryV3(entry); /* fall through */ } size_t entryId = m_entries.size(); @@ -406,16 +405,6 @@ namespace dxvk { } - bool DxvkStateCache::convertEntryV3( - DxvkStateCacheEntry& entry) const { - // Semantics changed: - // v3: Unused, always set to 0 - // v4: Alpha test compare op - entry.gpState.xsAlphaCompareOp = VK_COMPARE_OP_ALWAYS; - return true; - } - - void DxvkStateCache::workerFunc() { env::setThreadName("dxvk-shader"); diff --git a/src/dxvk/dxvk_state_cache.h b/src/dxvk/dxvk_state_cache.h index c0fee1661..938f9c719 100644 --- a/src/dxvk/dxvk_state_cache.h +++ b/src/dxvk/dxvk_state_cache.h @@ -213,9 +213,6 @@ namespace dxvk { bool convertEntryV2( DxvkStateCacheEntry& entry) const; - bool convertEntryV3( - DxvkStateCacheEntry& entry) const; - void workerFunc(); void writerFunc();