Skip to content

Commit

Permalink
Merge branch 'master' into wii-usb
Browse files Browse the repository at this point in the history
  • Loading branch information
Parlane committed Dec 30, 2012
2 parents 35466fb + e5d5365 commit 29f91ee
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -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)

Expand Down
18 changes: 16 additions & 2 deletions Source/Core/VideoCommon/Src/PixelShaderManager.cpp
Expand Up @@ -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))
{
Expand All @@ -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;
}
Expand Down
18 changes: 16 additions & 2 deletions Source/Core/VideoCommon/Src/VertexShaderManager.cpp
Expand Up @@ -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))
{
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp
Expand Up @@ -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)glHeight;

static const GLfloat verts[4][2] = {
{ -1, -1}, // Left top
Expand All @@ -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},
Expand Down

0 comments on commit 29f91ee

Please sign in to comment.