Skip to content

Commit

Permalink
[d3d8] Adjust surface and texture clearing with D3DFMT_UNKNOWN
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSnowfall committed Oct 14, 2024
1 parent d04229f commit b1e9609
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/d3d8/d3d8_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ namespace dxvk {
D3DFORMAT Format,
D3DPOOL Pool,
IDirect3DTexture8** ppTexture) {
if (unlikely(Format == D3DFMT_UNKNOWN))
return D3DERR_INVALIDCALL;

InitReturnPtr(ppTexture);

if (unlikely(ppTexture == nullptr))
Expand Down Expand Up @@ -341,6 +344,9 @@ namespace dxvk {
D3DFORMAT Format,
D3DPOOL Pool,
IDirect3DVolumeTexture8** ppVolumeTexture) {
if (unlikely(Format == D3DFMT_UNKNOWN))
return D3DERR_INVALIDCALL;

InitReturnPtr(ppVolumeTexture);

if (unlikely(ppVolumeTexture == nullptr))
Expand Down Expand Up @@ -368,6 +374,9 @@ namespace dxvk {
D3DFORMAT Format,
D3DPOOL Pool,
IDirect3DCubeTexture8** ppCubeTexture) {
if (unlikely(Format == D3DFMT_UNKNOWN))
return D3DERR_INVALIDCALL;

InitReturnPtr(ppCubeTexture);

if (unlikely(ppCubeTexture == nullptr))
Expand Down Expand Up @@ -441,6 +450,9 @@ namespace dxvk {
D3DMULTISAMPLE_TYPE MultiSample,
BOOL Lockable,
IDirect3DSurface8** ppSurface) {
if (unlikely(Format == D3DFMT_UNKNOWN))
return D3DERR_INVALIDCALL;

InitReturnPtr(ppSurface);

if (unlikely(ppSurface == nullptr))
Expand Down Expand Up @@ -469,6 +481,9 @@ namespace dxvk {
D3DFORMAT Format,
D3DMULTISAMPLE_TYPE MultiSample,
IDirect3DSurface8** ppSurface) {
if (unlikely(Format == D3DFMT_UNKNOWN))
return D3DERR_INVALIDCALL;

InitReturnPtr(ppSurface);

if (unlikely(ppSurface == nullptr))
Expand Down Expand Up @@ -496,8 +511,13 @@ namespace dxvk {
UINT Height,
D3DFORMAT Format,
IDirect3DSurface8** ppSurface) {
// Only CreateImageSurface clears the content of ppSurface
// before checking if Format is equal to D3DFMT_UNKNOWN.
InitReturnPtr(ppSurface);

if (unlikely(Format == D3DFMT_UNKNOWN))
return D3DERR_INVALIDCALL;

if (unlikely(ppSurface == nullptr))
return D3DERR_INVALIDCALL;

Expand Down

0 comments on commit b1e9609

Please sign in to comment.