From b2911516de5ca632debc87bac2fc9a48f8d03f04 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 30 Dec 2012 01:42:33 -0600 Subject: [PATCH 1/3] Disable the warning about va_list being mangled differently now. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e5a86650063..b025de11ef97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,7 +102,7 @@ if(NOT MSVC) endif(NOT MSVC) # gcc uses some optimizations which might break stuff without this flag -add_definitions(-fno-strict-aliasing -fno-exceptions) +add_definitions(-fno-strict-aliasing -fno-exceptions -Wno-psabi) include(CheckCXXCompilerFlag) From 49ed752126a2656e208eb9ca9902ebe9b06ad6c9 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 30 Dec 2012 02:12:31 -0600 Subject: [PATCH 2/3] This line in SWRenderer has been wrong ever since the beginning. --- Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp index e148906692ae..3a5e28f68f91 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp @@ -148,7 +148,7 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height) glTexParameteri(TEX2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); GLfloat u_max = (GLfloat)width; - GLfloat v_max = (GLfloat)glHeight; + GLfloat v_max = (GLfloat)height; static const GLfloat verts[4][2] = { { -1, -1}, // Left top From e5d5365bacb0fb9b579a0f51902990547c15fec7 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 30 Dec 2012 02:34:14 -0600 Subject: [PATCH 3/3] Fix the last few warnings in Dolphin on my system. --- .../VideoCommon/Src/PixelShaderManager.cpp | 18 ++++++++++++++++-- .../VideoCommon/Src/VertexShaderManager.cpp | 18 ++++++++++++++++-- .../Plugin_VideoSoftware/Src/SWRenderer.cpp | 6 +++--- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index f195cd805bde..258ec0441358 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -302,8 +302,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)) { @@ -317,6 +316,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 12445f283ad7..d960710adaad 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -251,8 +251,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)) { @@ -266,6 +265,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/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp index 3a5e28f68f91..d2f77cd2567b 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp @@ -146,9 +146,6 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height) glTexImage2D(TEX2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture); glTexParameteri(TEX2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(TEX2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - GLfloat u_max = (GLfloat)width; - GLfloat v_max = (GLfloat)height; static const GLfloat verts[4][2] = { { -1, -1}, // Left top @@ -158,6 +155,9 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height) }; //Texture rectangle uses pixel coordinates #ifndef USE_GLES + GLfloat u_max = (GLfloat)width; + GLfloat v_max = (GLfloat)height; + static const GLfloat texverts[4][2] = { {0, v_max}, {0, 0},