summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authordonkopunchstania <donkopunchstania@gmail.com>2011-04-11 01:49:32 +0000
committerdonkopunchstania <donkopunchstania@gmail.com>2011-04-11 01:49:32 +0000
commit77a4a649093f8d14574a81e0cbfc7cbc097cb39e (patch)
tree76278077cb33096b17b1c590d1c807d674a0b15b /Source/Core
parent6ca5d7c7c8230322e52bd3f08e8700c45f04d0c4 (diff)
Fix an error introduced in r7083. In the pixel shader manager the farZ and zRange of the z bias were flipped. Switched to using the viewport struct rather than a raw float array to hopefully avoid such confusion in the future. Fixes issue 4060.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7446 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderManager.cpp6
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderManager.cpp2
-rw-r--r--Source/Core/VideoCommon/Src/XFMemory.h4
3 files changed, 6 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
index d9c5b33b45..dad361591a 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
@@ -148,7 +148,7 @@ void PixelShaderManager::SetConstants()
// [5] = 16777215 * farz
//ERROR_LOG("pixel=%x,%x, bias=%x\n", bpmem.zcontrol.pixel_format, bpmem.ztex2.type, lastZBias);
- SetPSConstant4f(C_ZBIAS+1, xfregs.rawViewport[2] / 16777216.0f, xfregs.rawViewport[5] / 16777216.0f, 0, (float)(lastZBias)/16777215.0f);
+ SetPSConstant4f(C_ZBIAS+1, xfregs.viewport.farZ / 16777216.0f, xfregs.viewport.zRange / 16777216.0f, 0, (float)(lastZBias)/16777215.0f);
s_bZBiasChanged = s_bDepthRangeChanged = false;
}
@@ -245,14 +245,14 @@ void PixelShaderManager::SetConstants()
//bpmem.fogRange.Base.Center : center of the viewport in x axis. observation: bpmem.fogRange.Base.Center = realcenter + 342;
int center = ((u32)bpmem.fogRange.Base.Center) - 342;
// normalice center to make calculations easy
- float ScreenSpaceCenter = center / (2.0f * xfregs.rawViewport[0]);
+ float ScreenSpaceCenter = center / (2.0f * xfregs.viewport.wd);
ScreenSpaceCenter = (ScreenSpaceCenter * 2.0f) - 1.0f;
//bpmem.fogRange.K seems to be a table of precalculated coeficients for the adjust factor
//observations: bpmem.fogRange.K[0].LO apears to be the lowest value and bpmem.fogRange.K[4].HI the largest
// they always seems to be larger than 256 so my teory is :
// they are the coeficients from the center to th e border of the screen
// so to simplify i use the hi coeficient as K in the shader taking 256 as the scale
- SetPSConstant4f(C_FOG + 2, ScreenSpaceCenter, (float)Renderer::EFBToScaledX((int)(2.0f * xfregs.rawViewport[0])), bpmem.fogRange.K[4].HI / 256.0f,0.0f);
+ SetPSConstant4f(C_FOG + 2, ScreenSpaceCenter, (float)Renderer::EFBToScaledX((int)(2.0f * xfregs.viewport.wd)), bpmem.fogRange.K[4].HI / 256.0f,0.0f);
}
s_bFogRangeAdjustChanged = false;
}
diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
index ebb449540a..49b1f50ff9 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
@@ -299,7 +299,7 @@ void VertexShaderManager::SetConstants()
if (bViewportChanged)
{
bViewportChanged = false;
- SetVSConstant4f(C_DEPTHPARAMS,xfregs.rawViewport[5]/ 16777216.0f,xfregs.rawViewport[2]/ 16777216.0f,0.0f,0.0f);
+ SetVSConstant4f(C_DEPTHPARAMS,xfregs.viewport.farZ / 16777216.0f,xfregs.viewport.zRange / 16777216.0f,0.0f,0.0f);
// This is so implementation-dependent that we can't have it here.
UpdateViewport();
}
diff --git a/Source/Core/VideoCommon/Src/XFMemory.h b/Source/Core/VideoCommon/Src/XFMemory.h
index a45cc6af24..ee3c3b0fdc 100644
--- a/Source/Core/VideoCommon/Src/XFMemory.h
+++ b/Source/Core/VideoCommon/Src/XFMemory.h
@@ -229,7 +229,7 @@ struct Viewport
{
float wd;
float ht;
- float nearZ;
+ float zRange;
float xOrig;
float yOrig;
float farZ;
@@ -259,7 +259,7 @@ struct XFRegisters
u32 unk7; // 0x1017
u32 MatrixIndexA; // 0x1018
u32 MatrixIndexB; // 0x1019
- float rawViewport[6]; // 0x101a - 0x101f
+ Viewport viewport; // 0x101a - 0x101f
float rawProjection[7]; // 0x1020 - 0x1026
u32 unk8[24]; // 0x1027 - 0x103e
NumTexGen numTexGen; // 0x103f