mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Fix a typo in BPFunctions causing a PanicAlert in SW:RS2.
Really minor bugfix in DX9. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7285 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c569b33829
commit
e8a1c04abf
@ -140,6 +140,15 @@ void ClearScreen(const BPCmd &bp, const EFBRectangle &rc)
|
||||
void OnPixelFormatChange(const BPCmd &bp)
|
||||
{
|
||||
int convtype = -1;
|
||||
u32 current_format = Renderer::GetPrevPixelFormat();
|
||||
u32 new_format = bpmem.zcontrol.pixel_format;
|
||||
u32 old_format = current_format & 0x3;
|
||||
|
||||
// Check for Z compression format change
|
||||
// When using 16bit Z, the game may enable a special compression format which we need to handle
|
||||
// If we don't, Z values will be completely screwed up, currently only Star Wars:RS2 uses that.
|
||||
//if (new_format == PIXELFMT_RGB565_Z16 && bpmem.zcontrol.zformat != (current_format >> 2))
|
||||
// VertexShaderManager::SetZformatChanged();
|
||||
|
||||
/*
|
||||
* When changing the EFB format, the pixel data won't get converted to the new format but stays the same.
|
||||
@ -150,14 +159,12 @@ void OnPixelFormatChange(const BPCmd &bp)
|
||||
!g_ActiveConfig.backend_info.bSupportsFormatReinterpretation)
|
||||
return;
|
||||
|
||||
unsigned int new_format = bpmem.zcontrol.pixel_format;
|
||||
unsigned int old_format = Renderer::GetPrevPixelFormat();
|
||||
|
||||
// no need to reinterpret pixel data in these cases
|
||||
// no need to reinterpret pixel data in that cases
|
||||
if (new_format == old_format || old_format == (unsigned int)-1)
|
||||
goto skip;
|
||||
|
||||
switch (old_format)
|
||||
// Check for pixel format changes
|
||||
switch (old_format & 0x3)
|
||||
{
|
||||
case PIXELFMT_RGB8_Z24:
|
||||
case PIXELFMT_Z24:
|
||||
@ -183,21 +190,26 @@ void OnPixelFormatChange(const BPCmd &bp)
|
||||
if (new_format == PIXELFMT_RGB8_Z24 ||
|
||||
new_format == PIXELFMT_Z24)
|
||||
convtype = 4;
|
||||
else if (new_format == PIXELFMT_RGB565_Z16)
|
||||
else if (new_format == PIXELFMT_RGBA6_Z24)
|
||||
convtype = 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (convtype == -1)
|
||||
{
|
||||
PanicAlert("Unhandled EFB format change: %d to %d\n", old_format, new_format);
|
||||
ERROR_LOG(VIDEO, "Unhandled EFB format change: %d to %d\n", old_format & 0x3, new_format);
|
||||
goto skip;
|
||||
}
|
||||
|
||||
g_renderer->ReinterpretPixelData(convtype);
|
||||
|
||||
skip:
|
||||
Renderer::StorePixelFormat(new_format);
|
||||
DEBUG_LOG(VIDEO, "pixelfmt: pixel=%d, zc=%d", new_format, bpmem.zcontrol.zformat);
|
||||
|
||||
Renderer::StorePixelFormat(new_format | (bpmem.zcontrol.zformat << 2));
|
||||
}
|
||||
|
||||
bool GetConfig(const int &type)
|
||||
|
@ -757,13 +757,23 @@ union ConstantAlpha
|
||||
#define PIXELFMT_V8 6
|
||||
#define PIXELFMT_YUV420 7
|
||||
|
||||
#define ZC_LINEAR 0
|
||||
#define ZC_NEAR 1
|
||||
#define ZC_MID 2
|
||||
#define ZC_FAR 3
|
||||
// It seems these Z formats aren't supported/were removed ?
|
||||
#define ZC_INV_LINEAR 4
|
||||
#define ZC_INV_NEAR 5
|
||||
#define ZC_INV_MID 6
|
||||
#define ZC_INV_FAR 7
|
||||
|
||||
union PE_CONTROL
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 pixel_format : 3; // PIXELFMT_X
|
||||
u32 zformat : 3; // 0 - linear, 1 - near, 2 - mid, 3 - far
|
||||
u32 zcomploc : 1; // 1: before tex stage
|
||||
u32 pixel_format : 3; // PIXELFMT_X
|
||||
u32 zformat : 3; // Z Compression for 16bit Z format
|
||||
u32 zcomploc : 1; // 1: before tex stage
|
||||
u32 unused : 17;
|
||||
u32 rid : 8;
|
||||
};
|
||||
|
@ -1322,10 +1322,11 @@ void Renderer::RestoreAPIState()
|
||||
D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
|
||||
UpdateViewport();
|
||||
SetScissorRect();
|
||||
if (bpmem.zmode.testenable)
|
||||
if (bpmem.zmode.testenable) {
|
||||
D3D::SetRenderState(D3DRS_ZENABLE, TRUE);
|
||||
if (bpmem.zmode.updateenable)
|
||||
D3D::SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
|
||||
if (bpmem.zmode.updateenable)
|
||||
D3D::SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
|
||||
}
|
||||
SetColorMask();
|
||||
SetLogicOpMode();
|
||||
SetGenerationMode();
|
||||
@ -1348,7 +1349,7 @@ void Renderer::SetDepthMode()
|
||||
{
|
||||
// if the test is disabled write is disabled too
|
||||
D3D::SetRenderState(D3DRS_ZENABLE, FALSE);
|
||||
D3D::SetRenderState(D3DRS_ZWRITEENABLE, FALSE); // ??
|
||||
D3D::SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user