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
This commit is contained in:
Rodolfo Osvaldo Bogado 2010-06-19 21:12:09 +00:00
parent 208c33f09c
commit 4ab0e4b8a0
3 changed files with 13 additions and 10 deletions

View File

@ -627,7 +627,7 @@ 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;
dst[x] = ((src[x] & 0xFF) << 24) | ((src[x] & 0xFF00)>>8) | (src2[x] << 8);
}
}

View File

@ -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_ALPHABLENDENABLE);
UpdateViewport();
SetScissorRect();
}

View File

@ -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());
// Update the view port for clearing the picture
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