GFX: New GlobalControl system - cleaner way to control hacks and for possible control over other parts of the video code (video debugger control).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3982 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
32d213a823
commit
5ac7105b66
|
@ -0,0 +1,136 @@
|
|||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "GlobalControl.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
// Control Variables
|
||||
static bool g_ProjHack0;
|
||||
static ProjectionHack g_ProjHack1;
|
||||
static ProjectionHack g_ProjHack2;
|
||||
static bool g_FreeLook;
|
||||
} // Namespace
|
||||
|
||||
|
||||
void Projection_SetHack0(bool value)
|
||||
{
|
||||
g_ProjHack0 = value;
|
||||
}
|
||||
|
||||
void Projection_SetHack1(ProjectionHack value)
|
||||
{
|
||||
g_ProjHack1 = value;
|
||||
}
|
||||
|
||||
void Projection_SetHack2(ProjectionHack value)
|
||||
{
|
||||
g_ProjHack2 = value;
|
||||
}
|
||||
|
||||
void Projection_SetFreeLook(bool enabled)
|
||||
{
|
||||
g_FreeLook = enabled;
|
||||
}
|
||||
|
||||
bool Projection_GetHack0()
|
||||
{
|
||||
return g_ProjHack0;
|
||||
}
|
||||
|
||||
ProjectionHack Projection_GetHack1()
|
||||
{
|
||||
return g_ProjHack1;
|
||||
}
|
||||
|
||||
ProjectionHack Projection_GetHack2()
|
||||
{
|
||||
return g_ProjHack2;
|
||||
}
|
||||
|
||||
bool Projection_GetFreeLook()
|
||||
{
|
||||
return g_FreeLook;
|
||||
}
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "GlobalControl.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
// Control Variables
|
||||
static bool g_ProjHack0;
|
||||
static ProjectionHack g_ProjHack1;
|
||||
static ProjectionHack g_ProjHack2;
|
||||
static bool g_FreeLook;
|
||||
} // Namespace
|
||||
|
||||
|
||||
void Projection_SetHack0(bool value)
|
||||
{
|
||||
g_ProjHack0 = value;
|
||||
}
|
||||
|
||||
void Projection_SetHack1(ProjectionHack value)
|
||||
{
|
||||
g_ProjHack1 = value;
|
||||
}
|
||||
|
||||
void Projection_SetHack2(ProjectionHack value)
|
||||
{
|
||||
g_ProjHack2 = value;
|
||||
}
|
||||
|
||||
void Projection_SetFreeLook(bool enabled)
|
||||
{
|
||||
g_FreeLook = enabled;
|
||||
}
|
||||
|
||||
bool Projection_GetHack0()
|
||||
{
|
||||
return g_ProjHack0;
|
||||
}
|
||||
|
||||
ProjectionHack Projection_GetHack1()
|
||||
{
|
||||
return g_ProjHack1;
|
||||
}
|
||||
|
||||
ProjectionHack Projection_GetHack2()
|
||||
{
|
||||
return g_ProjHack2;
|
||||
}
|
||||
|
||||
bool Projection_GetFreeLook()
|
||||
{
|
||||
return g_FreeLook;
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
Purpose: This is used to control parts of the video code such as hacks
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
struct ProjectionHack
|
||||
{
|
||||
bool enabled;
|
||||
float value;
|
||||
|
||||
ProjectionHack()
|
||||
{
|
||||
}
|
||||
|
||||
ProjectionHack(bool enabled, float value)
|
||||
{
|
||||
ProjectionHack::enabled = enabled;
|
||||
ProjectionHack::value = value;
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------
|
||||
Projection Control
|
||||
------------------- */
|
||||
void Projection_SetHack0(bool value);
|
||||
void Projection_SetHack1(ProjectionHack value);
|
||||
void Projection_SetHack2(ProjectionHack value);
|
||||
void Projection_SetFreeLook(bool enabled);
|
||||
|
||||
bool Projection_GetHack0();
|
||||
ProjectionHack Projection_GetHack1();
|
||||
ProjectionHack Projection_GetHack2();
|
||||
bool Projection_GetFreeLook();
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
Purpose: This is used to control parts of the video code such as hacks
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
struct ProjectionHack
|
||||
{
|
||||
bool enabled;
|
||||
float value;
|
||||
|
||||
ProjectionHack()
|
||||
{
|
||||
}
|
||||
|
||||
ProjectionHack(bool enabled, float value)
|
||||
{
|
||||
ProjectionHack::enabled = enabled;
|
||||
ProjectionHack::value = value;
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------
|
||||
Projection Control
|
||||
------------------- */
|
||||
void Projection_SetHack0(bool value);
|
||||
void Projection_SetHack1(ProjectionHack value);
|
||||
void Projection_SetHack2(ProjectionHack value);
|
||||
void Projection_SetFreeLook(bool enabled);
|
||||
|
||||
bool Projection_GetHack0();
|
||||
ProjectionHack Projection_GetHack1();
|
||||
ProjectionHack Projection_GetHack2();
|
||||
bool Projection_GetFreeLook();
|
|
@ -3,6 +3,7 @@
|
|||
Import('env')
|
||||
|
||||
files = [
|
||||
'GlobalControl.cpp',
|
||||
'BPMemory.cpp',
|
||||
'CPMemory.cpp',
|
||||
'XFMemory.cpp',
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "CPMemory.h"
|
||||
#include "XFMemory.h"
|
||||
#include "VideoCommon.h"
|
||||
#include "GlobalControl.h"
|
||||
|
||||
// Temporary ugly declaration.
|
||||
namespace VertexManager
|
||||
|
@ -75,7 +76,7 @@ void VertexShaderManager::Shutdown()
|
|||
}
|
||||
// Syncs the shader constant buffers with xfmem
|
||||
// TODO: A cleaner way to control the matricies without making a mess in the parameters field
|
||||
void VertexShaderManager::SetConstants(bool proj_hax_1,bool Hack_hack1 ,float Hack_value1 ,bool Hack_hack2 ,float Hack_value2 ,bool freeLook)
|
||||
void VertexShaderManager::SetConstants()
|
||||
{
|
||||
|
||||
// TODO: Is this still needed?
|
||||
|
@ -268,6 +269,11 @@ void VertexShaderManager::SetConstants(bool proj_hax_1,bool Hack_hack1 ,float Ha
|
|||
}
|
||||
else
|
||||
{
|
||||
// Get the hacks
|
||||
ProjectionHack hack1 = Projection_GetHack1();
|
||||
ProjectionHack hack2 = Projection_GetHack2();
|
||||
bool hack0 = Projection_GetHack0();
|
||||
|
||||
// Orthographic Projection
|
||||
g_fProjectionMatrix[0] = xfregs.rawProjection[0];
|
||||
g_fProjectionMatrix[1] = 0.0f;
|
||||
|
@ -281,8 +287,8 @@ void VertexShaderManager::SetConstants(bool proj_hax_1,bool Hack_hack1 ,float Ha
|
|||
|
||||
g_fProjectionMatrix[8] = 0.0f;
|
||||
g_fProjectionMatrix[9] = 0.0f;
|
||||
g_fProjectionMatrix[10] = (Hack_hack1 ? -(Hack_value1 + xfregs.rawProjection[4]) : xfregs.rawProjection[4]);
|
||||
g_fProjectionMatrix[11] = (Hack_hack2 ? -(Hack_value2 + xfregs.rawProjection[5]) : xfregs.rawProjection[5]) + (proj_hax_1 ? 0.1f : 0.0f);
|
||||
g_fProjectionMatrix[10] = (hack1.enabled ? -(hack1.value + xfregs.rawProjection[4]) : xfregs.rawProjection[4]);
|
||||
g_fProjectionMatrix[11] = (hack2.enabled ? -(hack2.value + xfregs.rawProjection[5]) : xfregs.rawProjection[5]) + (hack0 ? 0.1f : 0.0f);
|
||||
|
||||
g_fProjectionMatrix[12] = 0.0f;
|
||||
g_fProjectionMatrix[13] = 0.0f;
|
||||
|
@ -316,7 +322,7 @@ void VertexShaderManager::SetConstants(bool proj_hax_1,bool Hack_hack1 ,float Ha
|
|||
|
||||
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]);
|
||||
|
||||
if (freeLook)
|
||||
if (Projection_GetFreeLook())
|
||||
{
|
||||
Matrix44 mtxA;
|
||||
Matrix44 mtxB;
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
static void Shutdown();
|
||||
|
||||
// constant management
|
||||
static void SetConstants(bool proj_hax_1,bool Hack_hack1, float Hack_value1, bool Hack_hack2, float Hack_value2, bool freeLook);
|
||||
static void SetConstants();
|
||||
|
||||
static void SetViewport(float* _Viewport);
|
||||
static void SetViewportChanged();
|
||||
|
|
|
@ -673,6 +673,14 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\Src\GlobalControl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\GlobalControl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\memcpy_amd.cpp"
|
||||
>
|
||||
|
|
|
@ -235,7 +235,7 @@ void Flush()
|
|||
if (numVertices)
|
||||
{
|
||||
// set global constants
|
||||
VertexShaderManager::SetConstants(false, false, 0, false, 0, false);
|
||||
VertexShaderManager::SetConstants();
|
||||
PixelShaderManager::SetConstants();
|
||||
|
||||
PixelShaderCache::SetShader();
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "../TextureMngr.h"
|
||||
#include "VertexShaderManager.h"
|
||||
#include "../PostProcessing.h"
|
||||
#include "GlobalControl.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(GFXConfigDialogOGL,wxDialog)
|
||||
EVT_CLOSE(GFXConfigDialogOGL::OnClose)
|
||||
|
@ -700,6 +701,7 @@ void GFXConfigDialogOGL::AdvancedSettingsChanged(wxCommandEvent& event)
|
|||
break;
|
||||
case ID_FREELOOK:
|
||||
g_Config.bFreeLook = m_FreeLook->IsChecked();
|
||||
Projection_SetFreeLook(g_Config.bFreeLook);
|
||||
break;
|
||||
case ID_TEXTUREPATH:
|
||||
break;
|
||||
|
@ -835,5 +837,10 @@ void Config::UpdateProjectionHack()
|
|||
g_Config.bProjHack1 = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the projections hacks
|
||||
Projection_SetHack0(g_Config.bProjHack1);
|
||||
Projection_SetHack1(ProjectionHack(g_Config.bPhackvalue1 == 0 ? false : true, g_Config.fhackvalue1));
|
||||
Projection_SetHack2(ProjectionHack(g_Config.bPhackvalue2 == 0 ? false : true, g_Config.fhackvalue2));
|
||||
}
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ void Flush()
|
|||
VERTEXSHADER* vs = VertexShaderCache::GetShader(g_nativeVertexFmt->m_components);
|
||||
|
||||
// set global constants
|
||||
VertexShaderManager::SetConstants(g_Config.bProjHack1,g_Config.bPhackvalue1, g_Config.fhackvalue1, g_Config.bPhackvalue2, g_Config.fhackvalue2, g_Config.bFreeLook);
|
||||
VertexShaderManager::SetConstants();
|
||||
PixelShaderManager::SetConstants();
|
||||
|
||||
// finally bind
|
||||
|
|
Loading…
Reference in New Issue