summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2013-01-09 11:00:26 +0100
committerdegasus <wickmarkus@web.de>2013-01-09 11:00:26 +0100
commitbff02b3b7348c36d54acd7823ddeef66ec996350 (patch)
tree597a6453c11c56c857990607cbeadc2edc00452d /Source/Core/VideoCommon
parentb7906b49c98ffaf29a5c9e25cfbabec16b7f4a8d (diff)
parent84debc17d530dc3324c06a971d61fadf1cedf1e4 (diff)
Merge branch 'arb_framebuffer' into GLSL-master
Conflicts: Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp Source/Plugins/Plugin_VideoOGL/Src/Render.cpp Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderManager.cpp18
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderManager.cpp18
-rw-r--r--Source/Core/VideoCommon/Src/VideoCommon.h19
3 files changed, 40 insertions, 15 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
index e56f646c15..78129bf56b 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
@@ -304,8 +304,7 @@ void PixelShaderManager::SetConstants()
float GC_ALIGNED16(material[4]);
float NormalizationCoef = 1 / 255.0f;
- // TODO: This code is wrong. i goes out of range for xfregs.ambColor.
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 2; ++i)
{
if (nMaterialsChanged & (1 << i))
{
@@ -319,6 +318,21 @@ void PixelShaderManager::SetConstants()
SetPSConstant4fv(C_PMATERIALS + i, material);
}
}
+
+ for (int i = 0; i < 2; ++i)
+ {
+ if (nMaterialsChanged & (1 << (i + 2)))
+ {
+ u32 data = *(xfregs.matColor + i);
+
+ material[0] = ((data >> 24) & 0xFF) * NormalizationCoef;
+ material[1] = ((data >> 16) & 0xFF) * NormalizationCoef;
+ material[2] = ((data >> 8) & 0xFF) * NormalizationCoef;
+ material[3] = ( data & 0xFF) * NormalizationCoef;
+
+ SetPSConstant4fv(C_PMATERIALS + i + 2, material);
+ }
+ }
nMaterialsChanged = 0;
}
diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
index 5beaefb631..0297ae125d 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
@@ -253,8 +253,7 @@ void VertexShaderManager::SetConstants()
float GC_ALIGNED16(material[4]);
float NormalizationCoef = 1 / 255.0f;
- // TODO: This code is wrong. i goes out of range for xfregs.ambColor.
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 2; ++i)
{
if (nMaterialsChanged & (1 << i))
{
@@ -268,6 +267,21 @@ void VertexShaderManager::SetConstants()
SetVSConstant4fv(C_MATERIALS + i, material);
}
}
+
+ for (int i = 0; i < 2; ++i)
+ {
+ if (nMaterialsChanged & (1 << (i + 2)))
+ {
+ u32 data = *(xfregs.matColor + i);
+
+ material[0] = ((data >> 24) & 0xFF) * NormalizationCoef;
+ material[1] = ((data >> 16) & 0xFF) * NormalizationCoef;
+ material[2] = ((data >> 8) & 0xFF) * NormalizationCoef;
+ material[3] = ( data & 0xFF) * NormalizationCoef;
+
+ SetVSConstant4fv(C_MATERIALS + i + 2, material);
+ }
+ }
nMaterialsChanged = 0;
}
diff --git a/Source/Core/VideoCommon/Src/VideoCommon.h b/Source/Core/VideoCommon/Src/VideoCommon.h
index 7031a296e2..a1b72c9284 100644
--- a/Source/Core/VideoCommon/Src/VideoCommon.h
+++ b/Source/Core/VideoCommon/Src/VideoCommon.h
@@ -44,17 +44,14 @@ enum
EFB_HEIGHT = 528,
};
-enum
-{
- // XFB width is decided by EFB copy operation. The VI can do horizontal
- // scaling (TODO: emulate).
- MAX_XFB_WIDTH = EFB_WIDTH,
-
- // Although EFB height is 528, 574-line XFB's can be created either with
- // vertical scaling by the EFB copy operation or copying to multiple XFB's
- // that are next to each other in memory (TODO: handle that situation).
- MAX_XFB_HEIGHT = 574
-};
+// XFB width is decided by EFB copy operation. The VI can do horizontal
+// scaling (TODO: emulate).
+const u32 MAX_XFB_WIDTH = EFB_WIDTH;
+
+// Although EFB height is 528, 574-line XFB's can be created either with
+// vertical scaling by the EFB copy operation or copying to multiple XFB's
+// that are next to each other in memory (TODO: handle that situation).
+const u32 MAX_XFB_HEIGHT = 574;
// Logging
// ----------