From 7789fd53ff0eec5697957a1b12758ed7f167727a Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 8 Aug 2022 03:51:10 +0200 Subject: [PATCH] [d3d9] Use new flat shading state for fixed-function pipelines --- src/d3d9/d3d9_device.cpp | 5 +---- src/d3d9/d3d9_fixed_function.cpp | 6 ++++-- src/d3d9/d3d9_fixed_function.h | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 8b15b82c..85c96faa 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -2098,9 +2098,7 @@ namespace dxvk { break; case D3DRS_SHADEMODE: - m_flags.set( - D3D9DeviceFlag::DirtyFFPixelShader, - D3D9DeviceFlag::DirtyRasterizerState); + m_flags.set(D3D9DeviceFlag::DirtyRasterizerState); break; case D3DRS_TWEENFACTOR: @@ -6653,7 +6651,6 @@ namespace dxvk { } stage0.GlobalSpecularEnable = m_state.renderStates[D3DRS_SPECULARENABLE]; - stage0.GlobalFlatShade = m_state.renderStates[D3DRS_SHADEMODE] == D3DSHADE_FLAT; // The last stage *always* writes to current. if (idx >= 1) diff --git a/src/d3d9/d3d9_fixed_function.cpp b/src/d3d9/d3d9_fixed_function.cpp index 45e26ab9..a2c2e41f 100644 --- a/src/d3d9/d3d9_fixed_function.cpp +++ b/src/d3d9/d3d9_fixed_function.cpp @@ -627,6 +627,7 @@ namespace dxvk { uint32_t m_inputMask = 0u; uint32_t m_outputMask = 0u; + uint32_t m_flatShadingMask = 0u; uint32_t m_pushConstOffset = 0u; uint32_t m_pushConstSize = 0u; @@ -737,6 +738,7 @@ namespace dxvk { info.bindings = m_bindings.data(); info.inputMask = m_inputMask; info.outputMask = m_outputMask; + info.flatShadingInputs = m_flatShadingMask; info.pushConstOffset = m_pushConstOffset; info.pushConstSize = m_pushConstSize; @@ -788,8 +790,8 @@ namespace dxvk { bool diffuseOrSpec = semantic == DxsoSemantic{ DxsoUsage::Color, 0 } || semantic == DxsoSemantic{ DxsoUsage::Color, 1 }; - if (diffuseOrSpec && m_fsKey.Stages[0].Contents.GlobalFlatShade) - m_module.decorate(ptr, spv::DecorationFlat); + if (diffuseOrSpec) + m_flatShadingMask |= 1u << slot; std::string name = str::format(input ? "in_" : "out_", semantic.usage, semantic.usageIndex); m_module.setDebugName(ptr, name.c_str()); diff --git a/src/d3d9/d3d9_fixed_function.h b/src/d3d9/d3d9_fixed_function.h index c6007791..8880f851 100644 --- a/src/d3d9/d3d9_fixed_function.h +++ b/src/d3d9/d3d9_fixed_function.h @@ -159,7 +159,6 @@ namespace dxvk { // Included in here, read from Stage 0 for packing reasons // Affects all stages. uint32_t GlobalSpecularEnable : 1; - uint32_t GlobalFlatShade : 1; } Contents; uint32_t Primitive[2];