1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-13 19:29:14 +01:00

[d3d8/9] Clear pLockedRect/Box contents universally on lock

This commit is contained in:
WinterSnowfall 2024-12-22 23:16:37 +02:00 committed by Philip Rebohle
parent 9a244e8951
commit 28a08cae6d
2 changed files with 10 additions and 10 deletions

View File

@ -124,17 +124,19 @@ namespace dxvk {
return D3DERR_INVALIDCALL;
D3DBOX box;
auto& desc = *(m_texture->Desc());
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
// LockRect clears any existing content present in pLockedRect,
// for surfaces in D3DPOOL_DEFAULT. D3D8 additionally clears the content
// for non-D3DPOOL_DEFAULT surfaces if their type is not D3DRTYPE_TEXTURE.
if (desc.Pool == D3DPOOL_DEFAULT
|| (m_texture->Device()->IsD3D8Compatible() && type != D3DRTYPE_TEXTURE)) {
pLockedRect->pBits = nullptr;
pLockedRect->Pitch = 0;
}
if (unlikely(pRect != nullptr)) {
auto& desc = *(m_texture->Desc());
D3D9_FORMAT_BLOCK_SIZE blockSize = GetFormatAlignedBlockSize(desc.Format);
bool isBlockAlignedFormat = blockSize.Width > 0 && blockSize.Height > 0;

View File

@ -102,12 +102,10 @@ namespace dxvk {
if (unlikely(pLockedBox == nullptr))
return D3DERR_INVALIDCALL;
if (m_texture->Device()->IsD3D8Compatible()) {
// D3D8 LockBox clears any existing content present in pLockedBox
pLockedBox->pBits = nullptr;
pLockedBox->RowPitch = 0;
pLockedBox->SlicePitch = 0;
}
// LockBox clears any existing content present in pLockedBox
pLockedBox->pBits = nullptr;
pLockedBox->RowPitch = 0;
pLockedBox->SlicePitch = 0;
if (unlikely(pBox != nullptr)) {
auto& desc = *(m_texture->Desc());