Skip to content

Commit

Permalink
Additional checks for copying depth stencil
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Nov 8, 2024
1 parent 19898f6 commit 0f0628c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 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 7312
#define BUILD_NUMBER 7313
11 changes: 10 additions & 1 deletion ddraw/IDirectDrawSurfaceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6525,6 +6525,8 @@ HRESULT m_IDirectDrawSurfaceX::CopySurface(m_IDirectDrawSurfaceX* pSourceSurface
(pSourceSurface->surface.Type == surface.Type || (pSourceSurface->surface.Type == D3DTYPE_OFFPLAINSURFACE && surface.Type == D3DTYPE_RENDERTARGET)) &&
(!IsStretchRect || (this != pSourceSurface && !ISDXTEX(SrcFormat) && !ISDXTEX(DestFormat) && surface.Type == D3DTYPE_RENDERTARGET)) &&
(surface.Type != D3DTYPE_DEPTHSTENCIL || !ddrawParent->IsInScene()) &&
(surface.Type != D3DTYPE_DEPTHSTENCIL || (surface.Type == D3DTYPE_DEPTHSTENCIL &&
!SrcRect.left && SrcRect.left == SrcRect.top && SrcRect.top == DestRect.left && DestRect.left == DestRect.top && DestRect.top)) &&
(surface.Type != D3DTYPE_TEXTURE) &&
(!pSourceSurface->IsPalette() && !IsPalette()) &&
!IsMirrorLeftRight && !IsMirrorUpDown && !IsColorKey)
Expand All @@ -6534,7 +6536,14 @@ HRESULT m_IDirectDrawSurfaceX::CopySurface(m_IDirectDrawSurfaceX* pSourceSurface

if (pSourceSurfaceD9 && pDestSurfaceD9)
{
hr = (*d3d9Device)->StretchRect(pSourceSurfaceD9, &SrcRect, pDestSurfaceD9, &DestRect, Filter);
if (surface.Type == D3DTYPE_DEPTHSTENCIL)
{
hr = (*d3d9Device)->StretchRect(pSourceSurfaceD9, nullptr, pDestSurfaceD9, nullptr, D3DTEXF_NONE);
}
else
{
hr = (*d3d9Device)->StretchRect(pSourceSurfaceD9, &SrcRect, pDestSurfaceD9, &DestRect, Filter);
}

if (FAILED(hr))
{
Expand Down

0 comments on commit 0f0628c

Please sign in to comment.