summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2013-01-24 16:58:28 +0100
committerdegasus <wickmarkus@web.de>2013-01-24 16:58:28 +0100
commite0ffdda26e5fb34b2f0d59d5d45b0deda9c90c19 (patch)
tree8e289ea93c97fe7430ae501200b60327f572c7e2 /Source/Core/VideoCommon/Src/VertexShaderManager.cpp
parentd5748ebaef93cd601ae6ab5e12f39dd201593ad0 (diff)
parentd60cc373d1b389215eb63c4e20fe24e902680c7a (diff)
Merge branch 'immediate-removal' into GLSL-master
Conflicts: Source/Core/VideoCommon/Src/PixelShaderGen.cpp Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp immediate-removal is a new created branch seperated from master but reverted the revert of immediate-removal so we get less conflicts by merging
Diffstat (limited to 'Source/Core/VideoCommon/Src/VertexShaderManager.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderManager.cpp83
1 files changed, 49 insertions, 34 deletions
diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
index f21ae396e9..b3a7db8af2 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
@@ -169,14 +169,24 @@ void VertexShaderManager::Shutdown()
void VertexShaderManager::Dirty()
{
- nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256;
- nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96;
- nPostTransformMatricesChanged[0] = 0; nPostTransformMatricesChanged[1] = 256;
- nLightsChanged[0] = 0; nLightsChanged[1] = 0x80;
+ nTransformMatricesChanged[0] = 0;
+ nTransformMatricesChanged[1] = 256;
+
+ nNormalMatricesChanged[0] = 0;
+ nNormalMatricesChanged[1] = 96;
+
+ nPostTransformMatricesChanged[0] = 0;
+ nPostTransformMatricesChanged[1] = 256;
+
+ nLightsChanged[0] = 0;
+ nLightsChanged[1] = 0x80;
+
bPosNormalMatrixChanged = true;
- bTexMatricesChanged[0] = bTexMatricesChanged[1] = true;
+ bTexMatricesChanged[0] = true;
+ bTexMatricesChanged[1] = true;
+
bProjectionChanged = true;
- bPosNormalMatrixChanged = bTexMatricesChanged[0] = bTexMatricesChanged[1] = true;
+
nMaterialsChanged = 15;
}
@@ -342,26 +352,28 @@ void VertexShaderManager::SetConstants()
if (bProjectionChanged)
{
bProjectionChanged = false;
+
+ float *rawProjection = xfregs.projection.rawProjection;
- if (xfregs.rawProjection[6] == 0)
+ switch(xfregs.projection.type)
{
- // Perspective
+ case GX_PERSPECTIVE:
- g_fProjectionMatrix[0] = xfregs.rawProjection[0] * g_ActiveConfig.fAspectRatioHackW;
+ g_fProjectionMatrix[0] = rawProjection[0] * g_ActiveConfig.fAspectRatioHackW;
g_fProjectionMatrix[1] = 0.0f;
- g_fProjectionMatrix[2] = xfregs.rawProjection[1];
+ g_fProjectionMatrix[2] = rawProjection[1];
g_fProjectionMatrix[3] = 0.0f;
g_fProjectionMatrix[4] = 0.0f;
- g_fProjectionMatrix[5] = xfregs.rawProjection[2] * g_ActiveConfig.fAspectRatioHackH;
- g_fProjectionMatrix[6] = xfregs.rawProjection[3];
+ g_fProjectionMatrix[5] = rawProjection[2] * g_ActiveConfig.fAspectRatioHackH;
+ g_fProjectionMatrix[6] = rawProjection[3];
g_fProjectionMatrix[7] = 0.0f;
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
- g_fProjectionMatrix[10] = xfregs.rawProjection[4];
+ g_fProjectionMatrix[10] = rawProjection[4];
- g_fProjectionMatrix[11] = xfregs.rawProjection[5];
+ g_fProjectionMatrix[11] = rawProjection[5];
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
@@ -386,24 +398,24 @@ void VertexShaderManager::SetConstants()
SETSTAT_FT(stats.gproj_13, g_fProjectionMatrix[13]);
SETSTAT_FT(stats.gproj_14, g_fProjectionMatrix[14]);
SETSTAT_FT(stats.gproj_15, g_fProjectionMatrix[15]);
- }
- else
- {
- // Orthographic Projection
- g_fProjectionMatrix[0] = xfregs.rawProjection[0];
+ break;
+
+ case GX_ORTHOGRAPHIC:
+
+ g_fProjectionMatrix[0] = rawProjection[0];
g_fProjectionMatrix[1] = 0.0f;
g_fProjectionMatrix[2] = 0.0f;
- g_fProjectionMatrix[3] = xfregs.rawProjection[1];
+ g_fProjectionMatrix[3] = rawProjection[1];
g_fProjectionMatrix[4] = 0.0f;
- g_fProjectionMatrix[5] = xfregs.rawProjection[2];
+ g_fProjectionMatrix[5] = rawProjection[2];
g_fProjectionMatrix[6] = 0.0f;
- g_fProjectionMatrix[7] = xfregs.rawProjection[3];
+ g_fProjectionMatrix[7] = rawProjection[3];
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
- g_fProjectionMatrix[10] = (g_ProjHack1.value + xfregs.rawProjection[4]) * ((g_ProjHack1.sign == 0) ? 1.0f : g_ProjHack1.sign);
- g_fProjectionMatrix[11] = (g_ProjHack2.value + xfregs.rawProjection[5]) * ((g_ProjHack2.sign == 0) ? 1.0f : g_ProjHack2.sign);
+ g_fProjectionMatrix[10] = (g_ProjHack1.value + rawProjection[4]) * ((g_ProjHack1.sign == 0) ? 1.0f : g_ProjHack1.sign);
+ g_fProjectionMatrix[11] = (g_ProjHack2.value + rawProjection[5]) * ((g_ProjHack2.sign == 0) ? 1.0f : g_ProjHack2.sign);
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
@@ -416,7 +428,7 @@ void VertexShaderManager::SetConstants()
*/
g_fProjectionMatrix[14] = 0.0f;
- g_fProjectionMatrix[15] = (g_ProjHack3 && xfregs.rawProjection[0] == 2.0f ? 0.0f : 1.0f); //causes either the efb copy or bloom layer not to show if proj hack enabled
+ g_fProjectionMatrix[15] = (g_ProjHack3 && rawProjection[0] == 2.0f ? 0.0f : 1.0f); //causes either the efb copy or bloom layer not to show if proj hack enabled
SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);
@@ -434,18 +446,21 @@ void VertexShaderManager::SetConstants()
SETSTAT_FT(stats.g2proj_13, g_fProjectionMatrix[13]);
SETSTAT_FT(stats.g2proj_14, g_fProjectionMatrix[14]);
SETSTAT_FT(stats.g2proj_15, g_fProjectionMatrix[15]);
- SETSTAT_FT(stats.proj_0, xfregs.rawProjection[0]);
- SETSTAT_FT(stats.proj_1, xfregs.rawProjection[1]);
- SETSTAT_FT(stats.proj_2, xfregs.rawProjection[2]);
- SETSTAT_FT(stats.proj_3, xfregs.rawProjection[3]);
- SETSTAT_FT(stats.proj_4, xfregs.rawProjection[4]);
- SETSTAT_FT(stats.proj_5, xfregs.rawProjection[5]);
- SETSTAT_FT(stats.proj_6, xfregs.rawProjection[6]);
+ SETSTAT_FT(stats.proj_0, rawProjection[0]);
+ SETSTAT_FT(stats.proj_1, rawProjection[1]);
+ SETSTAT_FT(stats.proj_2, rawProjection[2]);
+ SETSTAT_FT(stats.proj_3, rawProjection[3]);
+ SETSTAT_FT(stats.proj_4, rawProjection[4]);
+ SETSTAT_FT(stats.proj_5, rawProjection[5]);
+ break;
+
+ default:
+ ERROR_LOG(VIDEO, "unknown projection type: %d", xfregs.projection.type);
}
- PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]);
+ PRIM_LOG("Projection: %f %f %f %f %f %f\n", rawProjection[0], rawProjection[1], rawProjection[2], rawProjection[3], rawProjection[4], rawProjection[5]);
- if ((g_ActiveConfig.bFreeLook || g_ActiveConfig.bAnaglyphStereo ) && xfregs.rawProjection[6] == 0)
+ if ((g_ActiveConfig.bFreeLook || g_ActiveConfig.bAnaglyphStereo ) && xfregs.projection.type == GX_PERSPECTIVE)
{
Matrix44 mtxA;
Matrix44 mtxB;