mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-11-29 01:24:11 +01:00
[d3d9] Adjust pLockedRect/pLockedBox clearing and return behavior
This commit is contained in:
parent
63d9affdcb
commit
a0d48cd2a2
@ -124,9 +124,16 @@ namespace dxvk {
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
D3DBOX box;
|
||||
D3DRESOURCETYPE type = m_texture->GetType();
|
||||
|
||||
if (m_texture->Device()->IsD3D8Compatible() && type != D3DRTYPE_TEXTURE) {
|
||||
// D3D8 LockRect clears any existing content present in
|
||||
// pLockedRect for anything beside D3DRTYPE_TEXTURE surfaces
|
||||
pLockedRect->pBits = nullptr;
|
||||
pLockedRect->Pitch = 0;
|
||||
}
|
||||
|
||||
if (unlikely(pRect != nullptr)) {
|
||||
D3DRESOURCETYPE type = m_texture->GetType();
|
||||
auto& desc = *(m_texture->Desc());
|
||||
D3D9_FORMAT_BLOCK_SIZE blockSize = GetFormatBlockSize(desc.Format);
|
||||
|
||||
@ -168,6 +175,8 @@ namespace dxvk {
|
||||
pRect != nullptr ? &box : nullptr,
|
||||
Flags);
|
||||
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
pLockedRect->pBits = lockedBox.pBits;
|
||||
pLockedRect->Pitch = lockedBox.RowPitch;
|
||||
|
||||
|
@ -97,12 +97,29 @@ namespace dxvk {
|
||||
if (unlikely(pLockedBox == nullptr))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
return m_parent->LockImage(
|
||||
if (m_texture->Device()->IsD3D8Compatible()) {
|
||||
// D3D8 LockBox clears any existing content present in pLockedBox
|
||||
pLockedBox->pBits = nullptr;
|
||||
pLockedBox->RowPitch = 0;
|
||||
pLockedBox->SlicePitch = 0;
|
||||
}
|
||||
|
||||
D3DLOCKED_BOX lockedBox;
|
||||
|
||||
HRESULT hr = m_parent->LockImage(
|
||||
m_texture,
|
||||
m_face, m_mipLevel,
|
||||
pLockedBox,
|
||||
&lockedBox,
|
||||
pBox,
|
||||
Flags);
|
||||
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
pLockedBox->pBits = lockedBox.pBits;
|
||||
pLockedBox->RowPitch = lockedBox.RowPitch;
|
||||
pLockedBox->SlicePitch = lockedBox.SlicePitch;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user