summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authoromegadox <omegadox@gmail.com>2009-03-02 13:04:50 +0000
committeromegadox <omegadox@gmail.com>2009-03-02 13:04:50 +0000
commit17814912e5bd4feb6e6572dbe34c9ee061055f2d (patch)
treecd0de2d3aa40656039e3fe9d77d4833d47c5fcb6 /Source/Core/VideoCommon
parentd419d3fc29d4fb8740f09543ce6c432c32e045e3 (diff)
Some cleanup, projection hacks remove, the projections might be correct now. ZTP Bloom works and MP1 Heat Visor works, I tested many games, and good results. Please test more and report back. Also added in fix for Issue 677.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2521 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderManager.cpp57
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderManager.h2
-rw-r--r--Source/Core/VideoCommon/Src/XFStructs.cpp2
3 files changed, 19 insertions, 42 deletions
diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
index 361e355dc2..b3e03ee338 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
@@ -69,7 +69,7 @@ void VertexShaderManager::Shutdown()
// =======================================================================================
// Syncs the shader constant buffers with xfmem
// ----------------
-void VertexShaderManager::SetConstants(bool proj_hax_1, bool proj_hax_2)
+void VertexShaderManager::SetConstants()
{
//nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256;
//nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96;
@@ -203,30 +203,17 @@ void VertexShaderManager::SetConstants(bool proj_hax_1, bool proj_hax_2)
g_fProjectionMatrix[0] = xfregs.rawProjection[0];
g_fProjectionMatrix[1] = 0.0f;
g_fProjectionMatrix[2] = xfregs.rawProjection[1];
- g_fProjectionMatrix[3] = 0;
+ g_fProjectionMatrix[3] = 0.0f;
g_fProjectionMatrix[4] = 0.0f;
g_fProjectionMatrix[5] = xfregs.rawProjection[2];
g_fProjectionMatrix[6] = xfregs.rawProjection[3];
- g_fProjectionMatrix[7] = 0;
+ g_fProjectionMatrix[7] = 0.0f;
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
-
- //---------Projection[11]---------
- // No hacks
- if ((!proj_hax_1 && !proj_hax_2) || (proj_hax_1 && proj_hax_2))
- g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]);
-
- // Before R945 Hack
- if (proj_hax_1 && !proj_hax_2)
- g_fProjectionMatrix[11] = -(1.0f - xfregs.rawProjection[5]);
-
- // R844 Hack
- if (!proj_hax_1 && proj_hax_2)
- g_fProjectionMatrix[11] = xfregs.rawProjection[5];
- //--------------------------------
+ g_fProjectionMatrix[11] = xfregs.rawProjection[5];
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
@@ -266,24 +253,10 @@ void VertexShaderManager::SetConstants(bool proj_hax_1, bool proj_hax_2)
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
g_fProjectionMatrix[10] = xfregs.rawProjection[4];
-
- //---------Projection[11]---------
- // No hacks
- if ((!proj_hax_1 && !proj_hax_2) || (proj_hax_1 && proj_hax_2))
- g_fProjectionMatrix[11] = -(-0.5f - xfregs.rawProjection[5]);
-
- // Before R945 Hack
- if (proj_hax_1 && !proj_hax_2)
- g_fProjectionMatrix[11] = -(0.0f - xfregs.rawProjection[5]);
-
- // R844 Hack
- if (!proj_hax_1 && proj_hax_2)
- g_fProjectionMatrix[11] = -xfregs.rawProjection[5];
+ g_fProjectionMatrix[11] = xfregs.rawProjection[5] + 0.1f;
- //--------------------------------
-
- g_fProjectionMatrix[12] = 0;
- g_fProjectionMatrix[13] = 0;
+ g_fProjectionMatrix[12] = 0.0f;
+ g_fProjectionMatrix[13] = 0.0f;
g_fProjectionMatrix[14] = 0.0f;
g_fProjectionMatrix[15] = 1.0f;
@@ -303,15 +276,17 @@ void VertexShaderManager::SetConstants(bool proj_hax_1, bool proj_hax_2)
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, 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]);
+
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]);
SetVSConstant4fv(C_PROJECTION, &g_fProjectionMatrix[0]);
diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.h b/Source/Core/VideoCommon/Src/VertexShaderManager.h
index 06f8a1a168..4975b87f0f 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderManager.h
+++ b/Source/Core/VideoCommon/Src/VertexShaderManager.h
@@ -28,7 +28,7 @@ public:
static void Shutdown();
// constant management
- static void SetConstants(bool proj_hax_1, bool proj_hax_2);
+ static void SetConstants();
static void SetViewport(float* _Viewport);
static void SetViewportChanged();
diff --git a/Source/Core/VideoCommon/Src/XFStructs.cpp b/Source/Core/VideoCommon/Src/XFStructs.cpp
index 7a0d07959e..9f1bffdf74 100644
--- a/Source/Core/VideoCommon/Src/XFStructs.cpp
+++ b/Source/Core/VideoCommon/Src/XFStructs.cpp
@@ -21,6 +21,7 @@
#include "CPMemory.h"
#include "NativeVertexWriter.h"
#include "VertexShaderManager.h"
+#include "PixelShaderManager.h"
// LoadXFReg 0x10
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
@@ -154,6 +155,7 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
case 0x101a:
VertexManager::Flush();
VertexShaderManager::SetViewport((float*)&pData[i]);
+ PixelShaderManager::SetViewport((float*)&pData[i]);
i += 6;
break;