diff options
| author | Nolan Check <Nolan.Check@gmail.com> | 2011-05-12 02:14:45 +0000 |
|---|---|---|
| committer | Nolan Check <Nolan.Check@gmail.com> | 2011-05-12 02:14:45 +0000 |
| commit | 80247835020092c598fcee519f77e7d581b4d146 (patch) | |
| tree | c147fd97251c19f401fddda32900974a3fdbf407 /Source/Core/VideoCommon/Src/VertexShaderManager.cpp | |
| parent | 8cb2443c2fe22196c26d6e15608273dbc9e6551f (diff) | |
Don't resize render target to handle out-of-bounds viewports. Instead, adjust the projection matrix.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7538 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/VertexShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexShaderManager.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index 49b1f50ff9..a18829fde2 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -43,12 +43,13 @@ static int nNormalMatricesChanged[2]; // min,max static int nPostTransformMatricesChanged[2]; // min,max static int nLightsChanged[2]; // min,max +static Matrix44 s_viewportCorrection; static Matrix33 s_viewRotationMatrix; static Matrix33 s_viewInvRotationMatrix; static float s_fViewTranslationVector[3]; static float s_fViewRotation[2]; -void UpdateViewport(); +void UpdateViewport(Matrix44& vpCorrection); inline void SetVSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4) { @@ -301,7 +302,8 @@ void VertexShaderManager::SetConstants() bViewportChanged = false; 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(); + UpdateViewport(s_viewportCorrection); + bProjectionChanged = true; } if (bProjectionChanged) @@ -421,12 +423,18 @@ void VertexShaderManager::SetConstants() Matrix44::Multiply(mtxB, mtxA, viewMtx); // view = rotation x translation Matrix44::Set(mtxB, g_fProjectionMatrix); Matrix44::Multiply(mtxB, viewMtx, mtxA); // mtxA = projection x view + Matrix44::Multiply(s_viewportCorrection, mtxA, mtxB); // mtxB = viewportCorrection x mtxA - SetMultiVSConstant4fv(C_PROJECTION, 4, &mtxA.data[0]); + SetMultiVSConstant4fv(C_PROJECTION, 4, mtxB.data); } else { - SetMultiVSConstant4fv(C_PROJECTION, 4, &g_fProjectionMatrix[0]); + Matrix44 projMtx; + Matrix44::Set(projMtx, g_fProjectionMatrix); + + Matrix44 correctedMtx; + Matrix44::Multiply(s_viewportCorrection, projMtx, correctedMtx); + SetMultiVSConstant4fv(C_PROJECTION, 4, correctedMtx.data); } } } |
