Skip to content

Commit

Permalink
Fix some zbuffer issues and add failover for D32
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Sep 28, 2024
1 parent 8cd9ee1 commit d287f46
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 7212
#define BUILD_NUMBER 7213
9 changes: 6 additions & 3 deletions ddraw/IDirectDrawTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ void ConvertSurfaceDesc(DDSURFACEDESC2 &Desc2, DDSURFACEDESC &Desc)
Desc2.dwFlags |= DDSD_PIXELFORMAT;
Desc2.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
Desc2.ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
Desc2.ddpfPixelFormat.dwZBufferBitDepth = Desc.dwZBufferBitDepth;
Desc2.ddpfPixelFormat.dwZBitMask = (Desc2.ddpfPixelFormat.dwZBufferBitDepth == 32) ? 0xFFFFFFFF :
Desc2.ddpfPixelFormat.dwZBufferBitDepth = Desc.dwZBufferBitDepth;
Desc2.ddpfPixelFormat.dwZBitMask =
(Desc2.ddpfPixelFormat.dwZBufferBitDepth == 32) ? 0xFFFFFFFF :
(Desc2.ddpfPixelFormat.dwZBufferBitDepth == 24) ? 0xFFFFFF00 :
(Desc2.ddpfPixelFormat.dwZBufferBitDepth == 16) ? 0xFFFF : 0;
Desc2.dwRefreshRate = 0; // Union with dwZBufferBitDepth
}
Expand Down Expand Up @@ -299,7 +301,7 @@ void ConvertCaps(DDCAPS &Caps7, D3DCAPS9 &Caps9)
// Z-buffer bit depths
if (Caps7.dwCaps & DDCAPS_ZBLTS)
{
Caps7.dwZBufferBitDepths = DDBD_8 | DDBD_16 | DDBD_24 | DDBD_32;
Caps7.dwZBufferBitDepths = DDBD_16 | DDBD_24 | DDBD_32;
}

// Overlay settings
Expand Down Expand Up @@ -738,6 +740,7 @@ D3DFORMAT GetFailoverFormat(D3DFORMAT Format)
{ D3DFMT_X4R4G4B4, D3DFMT_A4R4G4B4 },
{ D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8 },
{ D3DFMT_X8B8G8R8, D3DFMT_A8B8G8R8 },
{ D3DFMT_D32, D3DFMT_D24S8 },
{ D3DFMT_D16_LOCKABLE, D3DFMT_D16 }
};

Expand Down
2 changes: 1 addition & 1 deletion ddraw/IDirectDrawX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ HRESULT m_IDirectDrawX::CreateSurface2(LPDDSURFACEDESC2 lpDDSurfaceDesc2, LPDIRE
SetPixelDisplayFormat((D3DFORMAT)Config.DdrawOverrideStencilFormat, Desc2.ddpfPixelFormat);
}

Logging::Log() << __FUNCTION__ << " Found Stencil surface: " << GetDisplayFormat(Desc2.ddpfPixelFormat);
Logging::Log() << __FUNCTION__ << " Found depth stencil surface: " << GetDisplayFormat(Desc2.ddpfPixelFormat);
}

// Get present parameters
Expand Down

0 comments on commit d287f46

Please sign in to comment.