Skip to content

Commit

Permalink
Revert clearing rect/volume content on surface/volume locks (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSnowfall authored Jan 6, 2025
1 parent 3e293ca commit 429891b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
12 changes: 0 additions & 12 deletions source/d3d8to9_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,6 @@ HRESULT STDMETHODCALLTYPE Direct3DSurface8::GetDesc(D3DSURFACE_DESC8 *pDesc)
}
HRESULT STDMETHODCALLTYPE Direct3DSurface8::LockRect(D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags)
{
D3DSURFACE_DESC8 SurfaceDesc;

const HRESULT hr = GetDesc(&SurfaceDesc);

// D3D8 clears the contents of pLockedRect for all
// surfaces except those of type D3DRTYPE_TEXTURE
if (SUCCEEDED(hr) && pLockedRect != nullptr && SurfaceDesc.Type != D3DRTYPE_TEXTURE)
{
pLockedRect->pBits = nullptr;
pLockedRect->Pitch = 0;
}

return ProxyInterface->LockRect(pLockedRect, pRect, Flags);
}
HRESULT STDMETHODCALLTYPE Direct3DSurface8::UnlockRect()
Expand Down
8 changes: 0 additions & 8 deletions source/d3d8to9_volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ HRESULT STDMETHODCALLTYPE Direct3DVolume8::GetDesc(D3DVOLUME_DESC8 *pDesc)
}
HRESULT STDMETHODCALLTYPE Direct3DVolume8::LockBox(D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, DWORD Flags)
{
if (pLockedVolume != nullptr)
{
// D3D8 clears the contents of pLockedVolume
pLockedVolume->pBits = nullptr;
pLockedVolume->RowPitch = 0;
pLockedVolume->SlicePitch = 0;
}

return ProxyInterface->LockBox(pLockedVolume, pBox, Flags);
}
HRESULT STDMETHODCALLTYPE Direct3DVolume8::UnlockBox()
Expand Down

0 comments on commit 429891b

Please sign in to comment.