Remove a baffling depth offset I don't quite get

This commit is contained in:
Henrik Rydgård committed 2023-02-11 14:41:25 +01:00
1 parent 241f8e75bc
commit 99e6fd62f7
2 files changed
+2 -5

No files matched your search

+1 -3
View File
@@ -254,9 +254,7 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView
float halfActualZRange = gstate_c.vpDepthScale != 0.0f ? vpZScale / gstate_c.vpDepthScale : 0.0f;
float minz = -((gstate_c.vpZOffset * halfActualZRange) - vpZCenter) - halfActualZRange;
float viewZScale = halfActualZRange * 2.0f;
// Account for the half pixel offset.
float halfDepthPixel = (DepthSliceFactor(gstate_c.UseFlags()) / 256.0f) * 0.5f;
float viewZCenter = minz + halfDepthPixel;
float viewZCenter = minz;
ub->depthRange[0] = viewZScale;
ub->depthRange[1] = viewZCenter;
+1 -2
View File
@@ -465,8 +465,7 @@ void ShaderManagerDX9::VSUpdateUniforms(u64 dirtyUniforms) {
float halfActualZRange = gstate_c.vpDepthScale != 0.0f ? vpZScale / gstate_c.vpDepthScale : 0.0f;
float minz = -((gstate_c.vpZOffset * halfActualZRange) - vpZCenter) - halfActualZRange;
float viewZScale = halfActualZRange * 2.0f;
// Account for the half pixel offset.
float viewZCenter = minz + (DepthSliceFactor(gstate_c.UseFlags()) / 256.0f) * 0.5f;
float viewZCenter = minz;
float reverseScale = 2.0f * (1.0f / gstate_c.vpDepthScale);
float reverseTranslate = gstate_c.vpZOffset * 0.5f + 0.5f;