summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorRodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com>2010-06-19 21:12:09 +0000
committerRodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com>2010-06-19 21:12:09 +0000
commit4ab0e4b8a06f9261d858bbd637780cc7ff1a527d (patch)
tree5c4cd5e617c611ea6d61b0f0a1ca26a5b62bab2b /Source
parent208c33f09c6e2ea3810cf89e84aac86bf2496b37 (diff)
fix for rbga8 decoding that causes problems in nsmbw
fix for screen clearing in opengl and d3d git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5749 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoCommon/Src/TextureDecoder.cpp6
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/Render.cpp4
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.cpp13
3 files changed, 13 insertions, 10 deletions
diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp
index e8dc98b21d..91cf47b7f9 100644
--- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp
+++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp
@@ -626,9 +626,9 @@ inline void decodebytesARGB8_4(u32 *dst, const u16 *src, const u16 *src2)
inline void decodebytesARGB8_4ToRgba(u32 *dst, const u16 *src, const u16 *src2)
{
- for (int x = 0; x < 4; x++) {
- dst[x] = (src2[x] << 8) | src[x] >> 8 | (src[x] & 0xF) << 24;
- }
+ for (int x = 0; x < 4; x++) {
+ dst[x] = ((src[x] & 0xFF) << 24) | ((src[x] & 0xFF00)>>8) | (src2[x] << 8);
+ }
}
inline u32 makecol(int r, int g, int b, int a)
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
index b67add58ae..a4ffddbfa0 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
@@ -914,11 +914,13 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
sirc.right = targetRc.right;
sirc.bottom = targetRc.bottom;
D3D::dev->SetScissorRect(&sirc);
+ D3D::ChangeRenderState(D3DRS_ALPHABLENDENABLE, false);
if (zEnable)
D3D::ChangeRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
D3D::drawClearQuad(color ,(z & 0xFFFFFF) / float(0xFFFFFF),PixelShaderCache::GetClearProgram(),VertexShaderCache::GetClearVertexShader());
if (zEnable)
- D3D::RefreshRenderState(D3DRS_ZFUNC);
+ D3D::RefreshRenderState(D3DRS_ZFUNC);
+ D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE);
UpdateViewport();
SetScissorRect();
}
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index 34c5a5acca..900a314531 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -787,13 +787,15 @@ bool Renderer::SetScissorRect()
void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z)
{
+
// Update the view port for clearing the picture
- glViewport(0, 0, Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
-
TargetRectangle targetRc = Renderer::ConvertEFBRectangle(rc);
+ glViewport(targetRc.left, targetRc.bottom, targetRc.GetWidth(), targetRc.GetHeight());
+ glScissor(targetRc.left, targetRc.bottom, targetRc.GetWidth(), targetRc.GetHeight());
+
// Always set the scissor in case it was set by the game and has not been reset
- glScissor(targetRc.left, targetRc.bottom, targetRc.GetWidth(), targetRc.GetHeight());
+
VertexShaderManager::SetViewportChanged();
@@ -805,7 +807,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
((color >> 16) & 0xFF) / 255.0f,
((color >> 8) & 0xFF) / 255.0f,
(color & 0xFF) / 255.0f,
- (alphaEnable ? ((color >> 24) & 0xFF) / 255.0f : 1.0f)
+ ((color >> 24) & 0xFF) / 255.0f
);
}
if (zEnable)
@@ -1242,8 +1244,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
// Renderer::SetZBufferRender();
// SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, GetTargetWidth(), GetTargetHeight());
XFBWrited = false;
- g_VideoInitialize.pCopiedToXFB(true);
-
+ g_VideoInitialize.pCopiedToXFB(XFBWrited);
}
// Create On-Screen-Messages