diff --git a/GPU/Directx9/ShaderManagerDX9.cpp b/GPU/Directx9/ShaderManagerDX9.cpp index 8874b325c5..0ee849b940 100644 --- a/GPU/Directx9/ShaderManagerDX9.cpp +++ b/GPU/Directx9/ShaderManagerDX9.cpp @@ -485,10 +485,10 @@ void ShaderManagerDX9::VSUpdateUniforms(int dirtyUniforms) { // Adjust for D3D projection matrix. We got squashed up to only 0-1, so we multiply // the scale factor by 2, and add an offset. - // Given the way we do the rounding, the offset is probably mostly irrelevant as we cancel + // Given the way we do the rounding, the integer part of the offset is probably mostly irrelevant as we cancel // it afterwards anyway. viewZScale *= 2.0f; - viewZCenter -= 32768.0f; + viewZCenter -= 32767.5f; float viewZInvScale; if (viewZScale != 0.0) { viewZInvScale = 1.0f / viewZScale; diff --git a/GPU/Directx9/StateMappingDX9.cpp b/GPU/Directx9/StateMappingDX9.cpp index f67f05d694..e671a2df8b 100644 --- a/GPU/Directx9/StateMappingDX9.cpp +++ b/GPU/Directx9/StateMappingDX9.cpp @@ -749,8 +749,8 @@ void TransformDrawEngineDX9::ApplyDrawState(int prim) { // That variable is only check for sign later so the multiplication by 2 isn't really necessary. // It's unclear why we need this Z offset of 1 to match OpenGL, but this checks out in multiple games. - float depthRangeMin = zCenter - fabsf(zScale) - 1.0f/65535.0f; - float depthRangeMax = zCenter + fabsf(zScale) - 1.0f/65535.0f; + float depthRangeMin = zCenter - fabsf(zScale) - 0.5f/65535.0f; + float depthRangeMax = zCenter + fabsf(zScale) - 0.5f/65535.0f; gstate_c.vpDepth = zScale * 2; // D3D doesn't like viewports partially outside the target, so we