From 0adf64f08545706b863319a7df2de419fd7fcb39 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 8 Aug 2022 02:33:37 +0200 Subject: [PATCH] [dxvk] Add flat shading parameter to rasterizer state --- src/d3d11/d3d11_context.cpp | 1 + src/d3d11/d3d11_rasterizer.cpp | 1 + src/d3d9/d3d9_device.cpp | 4 +--- src/dxvk/dxvk_constant_state.h | 1 + src/dxvk/dxvk_swapchain_blitter.cpp | 1 + src/dxvk/hud/dxvk_hud.cpp | 1 + 6 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 62313593..340017a4 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -4991,6 +4991,7 @@ namespace dxvk { pRsState->depthBiasEnable = VK_FALSE; pRsState->conservativeMode = VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT; pRsState->sampleCount = 0; + pRsState->flatShading = VK_FALSE; } diff --git a/src/d3d11/d3d11_rasterizer.cpp b/src/d3d11/d3d11_rasterizer.cpp index 8d8ba1c2..169ce3b5 100644 --- a/src/d3d11/d3d11_rasterizer.cpp +++ b/src/d3d11/d3d11_rasterizer.cpp @@ -37,6 +37,7 @@ namespace dxvk { m_state.depthClipEnable = desc.DepthClipEnable; m_state.conservativeMode = DecodeConservativeRasterizationMode(desc.ConservativeRaster); m_state.sampleCount = VkSampleCountFlags(desc.ForcedSampleCount); + m_state.flatShading = VK_FALSE; m_depthBias.depthBiasConstant = float(desc.DepthBias); m_depthBias.depthBiasSlope = desc.SlopeScaledDepthBias; diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 74a8e5b0..4bc5e738 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -5715,14 +5715,12 @@ namespace dxvk { auto& rs = m_state.renderStates; - DxvkRasterizerState state; + DxvkRasterizerState state = { }; state.cullMode = DecodeCullMode(D3DCULL(rs[D3DRS_CULLMODE])); state.depthBiasEnable = IsDepthBiasEnabled(); state.depthClipEnable = true; state.frontFace = VK_FRONT_FACE_CLOCKWISE; state.polygonMode = DecodeFillMode(D3DFILLMODE(rs[D3DRS_FILLMODE])); - state.conservativeMode = VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT; - state.sampleCount = 0; EmitCs([ cState = state diff --git a/src/dxvk/dxvk_constant_state.h b/src/dxvk/dxvk_constant_state.h index 222c6ee5..46d3d2af 100644 --- a/src/dxvk/dxvk_constant_state.h +++ b/src/dxvk/dxvk_constant_state.h @@ -105,6 +105,7 @@ namespace dxvk { VkBool32 depthBiasEnable; VkConservativeRasterizationModeEXT conservativeMode; VkSampleCountFlags sampleCount; + VkBool32 flatShading; }; diff --git a/src/dxvk/dxvk_swapchain_blitter.cpp b/src/dxvk/dxvk_swapchain_blitter.cpp index 591cce3a..29b413f6 100644 --- a/src/dxvk/dxvk_swapchain_blitter.cpp +++ b/src/dxvk/dxvk_swapchain_blitter.cpp @@ -124,6 +124,7 @@ namespace dxvk { rsState.depthBiasEnable = VK_FALSE; rsState.conservativeMode = VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT; rsState.sampleCount = VK_SAMPLE_COUNT_1_BIT; + rsState.flatShading = VK_FALSE; ctx->setRasterizerState(rsState); DxvkMultisampleState msState; diff --git a/src/dxvk/hud/dxvk_hud.cpp b/src/dxvk/hud/dxvk_hud.cpp index 935760c0..5a1af3c3 100644 --- a/src/dxvk/hud/dxvk_hud.cpp +++ b/src/dxvk/hud/dxvk_hud.cpp @@ -22,6 +22,7 @@ namespace dxvk::hud { m_rsState.depthBiasEnable = VK_FALSE; m_rsState.conservativeMode = VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT; m_rsState.sampleCount = VK_SAMPLE_COUNT_1_BIT; + m_rsState.flatShading = VK_FALSE; m_blendMode.enableBlending = VK_TRUE; m_blendMode.colorSrcFactor = VK_BLEND_FACTOR_ONE;