This makes slightly more sense than the last commit.

This commit is contained in:
Henrik Rydgard 2015-08-29 20:38:19 +02:00
parent 7b0a31ade5
commit 488c62e534
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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