From 96b01b40b87036bb09e4de863bf3c62194c19387 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:59:15 +0300 Subject: [PATCH] Fix the logic for determining if depth bias is used. --- UnleashedRecomp/gpu/video.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index 0602473b..45dad00d 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -3605,8 +3605,10 @@ static void FlushRenderStateForRenderThread() // We can reduce unnecessary calls by making common depth bias values part of the pipeline. if (g_capabilities.dynamicDepthBias && !g_vulkan) { - int32_t depthBias = g_depthBias != 0 ? COMMON_DEPTH_BIAS_VALUE : 0; - float slopeScaledDepthBias = g_slopeScaledDepthBias != 0.0f ? COMMON_SLOPE_SCALED_DEPTH_BIAS_VALUE : 0.0f; + bool useDepthBias = (g_depthBias != 0) || (g_slopeScaledDepthBias != 0.0f); + + int32_t depthBias = useDepthBias ? COMMON_DEPTH_BIAS_VALUE : 0; + float slopeScaledDepthBias = useDepthBias ? COMMON_SLOPE_SCALED_DEPTH_BIAS_VALUE : 0.0f; SetDirtyValue(g_dirtyStates.pipelineState, g_pipelineState.depthBias, depthBias); SetDirtyValue(g_dirtyStates.pipelineState, g_pipelineState.slopeScaledDepthBias, slopeScaledDepthBias);