D3D: More reset fixes
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4282 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c71f76834e
commit
20922cf3f0
|
@ -47,19 +47,24 @@ static u32 s_texturemask = 0;
|
||||||
|
|
||||||
void PixelShaderManager::Init()
|
void PixelShaderManager::Init()
|
||||||
{
|
{
|
||||||
s_nColorsChanged[0] = s_nColorsChanged[1] = 15;
|
|
||||||
s_nTexDimsChanged = true;
|
|
||||||
s_nIndTexScaleChanged = true;
|
|
||||||
s_nIndTexMtxChanged = 15;
|
|
||||||
s_bAlphaChanged = s_bZBiasChanged = s_bZTextureTypeChanged = s_bDepthRangeChanged = true;
|
|
||||||
s_bFogColorChanged = s_bFogParamChanged = true;
|
|
||||||
memset(lastRGBAfull, 0, sizeof(lastRGBAfull));
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
lastCustomTexScale[i][0] = lastCustomTexScale[i][1] = 1.0f;
|
lastCustomTexScale[i][0] = lastCustomTexScale[i][1] = 1.0f;
|
||||||
lastAlpha = 0;
|
lastAlpha = 0;
|
||||||
memset(lastTexDims, 0, sizeof(lastTexDims));
|
memset(lastTexDims, 0, sizeof(lastTexDims));
|
||||||
lastZBias = 0;
|
lastZBias = 0;
|
||||||
s_texturemask = 0;
|
s_texturemask = 0;
|
||||||
|
memset(lastRGBAfull, 0, sizeof(lastRGBAfull));
|
||||||
|
Dirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PixelShaderManager::Dirty()
|
||||||
|
{
|
||||||
|
s_nColorsChanged[0] = s_nColorsChanged[1] = 15;
|
||||||
|
s_nTexDimsChanged = true;
|
||||||
|
s_nIndTexScaleChanged = true;
|
||||||
|
s_nIndTexMtxChanged = 15;
|
||||||
|
s_bAlphaChanged = s_bZBiasChanged = s_bZTextureTypeChanged = s_bDepthRangeChanged = true;
|
||||||
|
s_bFogColorChanged = s_bFogParamChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelShaderManager::Shutdown()
|
void PixelShaderManager::Shutdown()
|
||||||
|
|
|
@ -31,6 +31,7 @@ class PixelShaderManager
|
||||||
static void SetPSTextureDims(int texid);
|
static void SetPSTextureDims(int texid);
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void Init();
|
||||||
|
static void Dirty();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
|
||||||
static void SetConstants(); // sets pixel shader constants
|
static void SetConstants(); // sets pixel shader constants
|
||||||
|
|
|
@ -58,13 +58,7 @@ void UpdateViewport();
|
||||||
|
|
||||||
void VertexShaderManager::Init()
|
void VertexShaderManager::Init()
|
||||||
{
|
{
|
||||||
nTransformMatricesChanged[0] = nTransformMatricesChanged[1] = -1;
|
Dirty();
|
||||||
nNormalMatricesChanged[0] = nNormalMatricesChanged[1] = -1;
|
|
||||||
nPostTransformMatricesChanged[0] = nPostTransformMatricesChanged[1] = -1;
|
|
||||||
nLightsChanged[0] = nLightsChanged[1] = -1;
|
|
||||||
bTexMatricesChanged[0] = bTexMatricesChanged[1] = false;
|
|
||||||
bPosNormalMatrixChanged = bProjectionChanged = bViewportChanged = false;
|
|
||||||
nMaterialsChanged = 0;
|
|
||||||
|
|
||||||
memset(&xfregs, 0, sizeof(xfregs));
|
memset(&xfregs, 0, sizeof(xfregs));
|
||||||
memset(xfmem, 0, sizeof(xfmem));
|
memset(xfmem, 0, sizeof(xfmem));
|
||||||
|
@ -75,22 +69,24 @@ void VertexShaderManager::Init()
|
||||||
void VertexShaderManager::Shutdown()
|
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] = bTexMatricesChanged[1] = true;
|
||||||
|
bProjectionChanged = true;
|
||||||
|
bPosNormalMatrixChanged = bTexMatricesChanged[0] = bTexMatricesChanged[1] = true;
|
||||||
|
nMaterialsChanged = 15;
|
||||||
|
}
|
||||||
|
|
||||||
// Syncs the shader constant buffers with xfmem
|
// Syncs the shader constant buffers with xfmem
|
||||||
// TODO: A cleaner way to control the matricies without making a mess in the parameters field
|
// TODO: A cleaner way to control the matricies without making a mess in the parameters field
|
||||||
void VertexShaderManager::SetConstants()
|
void VertexShaderManager::SetConstants()
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO: Is this still needed?
|
|
||||||
//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;
|
|
||||||
//bProjectionChanged = true;
|
|
||||||
//bPosNormalMatrixChanged = bTexMatricesChanged[0] = bTexMatricesChanged[1] = true;
|
|
||||||
//nMaterialsChanged = 15;
|
|
||||||
|
|
||||||
if (nTransformMatricesChanged[0] >= 0)
|
if (nTransformMatricesChanged[0] >= 0)
|
||||||
{
|
{
|
||||||
int startn = nTransformMatricesChanged[0] / 4;
|
int startn = nTransformMatricesChanged[0] / 4;
|
||||||
|
@ -487,7 +483,7 @@ void VertexShaderManager::TranslateView(float x, float y)
|
||||||
|
|
||||||
Matrix33::Multiply(s_viewInvRotationMatrix, vector, result);
|
Matrix33::Multiply(s_viewInvRotationMatrix, vector, result);
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
s_fViewTranslationVector[i] += result[i];
|
s_fViewTranslationVector[i] += result[i];
|
||||||
|
|
||||||
bProjectionChanged = true;
|
bProjectionChanged = true;
|
||||||
|
|
|
@ -25,6 +25,7 @@ class VertexShaderManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void Init();
|
||||||
|
static void Dirty();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
|
||||||
// constant management
|
// constant management
|
||||||
|
|
|
@ -69,8 +69,8 @@ void SetupDeviceObjects()
|
||||||
VertexLoaderManager::Init();
|
VertexLoaderManager::Init();
|
||||||
FBManager::Create();
|
FBManager::Create();
|
||||||
|
|
||||||
VertexShaderManager::Init();
|
VertexShaderManager::Dirty();
|
||||||
PixelShaderManager::Init();
|
PixelShaderManager::Dirty();
|
||||||
|
|
||||||
// Tex and shader caches will recreate themselves over time.
|
// Tex and shader caches will recreate themselves over time.
|
||||||
}
|
}
|
||||||
|
@ -78,9 +78,6 @@ void SetupDeviceObjects()
|
||||||
// Kill off all POOL_DEFAULT device objects.
|
// Kill off all POOL_DEFAULT device objects.
|
||||||
void TeardownDeviceObjects()
|
void TeardownDeviceObjects()
|
||||||
{
|
{
|
||||||
VertexShaderManager::Shutdown();
|
|
||||||
PixelShaderManager::Shutdown();
|
|
||||||
|
|
||||||
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
||||||
D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface());
|
D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface());
|
||||||
FBManager::Destroy();
|
FBManager::Destroy();
|
||||||
|
|
Loading…
Reference in New Issue