mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 12:19:12 +00:00
Ensure that ZSlopes save/restore state correctly.
Had to re-do *ShaderManager so they saved their constant arrays instead of completly rebuilding them on restore state.
This commit is contained in:
parent
128d303656
commit
e88c02dece
6 changed files with 72 additions and 80 deletions
|
@ -167,7 +167,21 @@ static void ViewportCorrectionMatrix(Matrix44& result)
|
|||
|
||||
void VertexShaderManager::Init()
|
||||
{
|
||||
Dirty();
|
||||
// Initialize state tracking variables
|
||||
nTransformMatricesChanged[0] = -1;
|
||||
nTransformMatricesChanged[1] = -1;
|
||||
nNormalMatricesChanged[0] = -1;
|
||||
nNormalMatricesChanged[1] = -1;
|
||||
nPostTransformMatricesChanged[0] = -1;
|
||||
nPostTransformMatricesChanged[1] = -1;
|
||||
nLightsChanged[0] = -1;
|
||||
nLightsChanged[1] = -1;
|
||||
nMaterialsChanged = BitSet32(0);
|
||||
bTexMatricesChanged[0] = false;
|
||||
bTexMatricesChanged[1] = false;
|
||||
bPosNormalMatrixChanged = false;
|
||||
bProjectionChanged = true;
|
||||
bViewportChanged = false;
|
||||
|
||||
memset(&xfmem, 0, sizeof(xfmem));
|
||||
memset(&constants, 0 , sizeof(constants));
|
||||
|
@ -178,6 +192,8 @@ void VertexShaderManager::Init()
|
|||
memset(g_fProjectionMatrix, 0, sizeof(g_fProjectionMatrix));
|
||||
for (int i = 0; i < 4; ++i)
|
||||
g_fProjectionMatrix[i*5] = 1.0f;
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
void VertexShaderManager::Shutdown()
|
||||
|
@ -186,26 +202,10 @@ 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;
|
||||
|
||||
bPosNormalMatrixChanged = true;
|
||||
bTexMatricesChanged[0] = true;
|
||||
bTexMatricesChanged[1] = true;
|
||||
|
||||
// This function is called after a savestate is loaded.
|
||||
// Any constants that can changed based on settings should be re-calculated
|
||||
bProjectionChanged = true;
|
||||
|
||||
nMaterialsChanged = BitSet32::AllTrue(4);
|
||||
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
|
@ -715,8 +715,19 @@ void VertexShaderManager::DoState(PointerWrap &p)
|
|||
p.Do(s_viewInvRotationMatrix);
|
||||
p.Do(s_fViewTranslationVector);
|
||||
p.Do(s_fViewRotation);
|
||||
|
||||
p.Do(nTransformMatricesChanged);
|
||||
p.Do(nNormalMatricesChanged);
|
||||
p.Do(nPostTransformMatricesChanged);
|
||||
p.Do(nLightsChanged);
|
||||
|
||||
p.Do(nMaterialsChanged);
|
||||
p.Do(bTexMatricesChanged);
|
||||
p.Do(bPosNormalMatrixChanged);
|
||||
p.Do(bProjectionChanged);
|
||||
p.Do(bViewportChanged);
|
||||
|
||||
p.Do(constants);
|
||||
p.Do(dirty);
|
||||
|
||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue