From f21f097e7a831e752ab36974897b2ba57e266dfc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 10 Jan 2013 21:44:12 -0500 Subject: Redundant line of code in VertexShaderManager::Dirty() Also cleaned it up. --- .../Core/VideoCommon/Src/VertexShaderManager.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'Source/Core/VideoCommon/Src/VertexShaderManager.cpp') diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index d960710ada..84340c6b98 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; } -- cgit v1.2.3 From f69b6b595ef80acf5ce776a80b1df27033bc7fdf Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 24 Jan 2013 13:10:13 +0100 Subject: change projection_type to u32 Fix issue 5740 thx @ erwan_taf for debuging all the week --- .../Core/VideoCommon/Src/VertexShaderManager.cpp | 61 ++++++++++++---------- 1 file changed, 33 insertions(+), 28 deletions(-) (limited to 'Source/Core/VideoCommon/Src/VertexShaderManager.cpp') diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index 84340c6b98..1dce567b0d 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -350,26 +350,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; @@ -394,24 +396,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; @@ -424,7 +426,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]); @@ -442,18 +444,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; -- cgit v1.2.3