[d3d9] Disable locking non-dynamic default textures

This commit is contained in:
Robin Kertels 2022-10-24 20:40:58 +02:00 committed by Joshie
parent d771f7cf8f
commit 9c22a58543
2 changed files with 14 additions and 0 deletions

View File

@ -4239,6 +4239,15 @@ namespace dxvk {
auto& desc = *(pResource->Desc());
// MSDN:
// Textures placed in the D3DPOOL_DEFAULT pool cannot be locked
// unless they are dynamic textures or they are private, FOURCC, driver formats.
// Also note that - unlike textures - swap chain back buffers, render targets [..] can be locked
if (unlikely(desc.Pool == D3DPOOL_DEFAULT
&& !(desc.Usage & (D3DUSAGE_DYNAMIC | D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL))
&& !IsFourCCFormat(desc.Format)))
return D3DERR_INVALIDCALL;
auto& formatMapping = pResource->GetFormatMapping();
const DxvkFormatInfo* formatInfo = formatMapping.IsValid()

View File

@ -219,4 +219,9 @@ namespace dxvk {
bool m_d32supportFinal;
};
inline bool IsFourCCFormat(D3D9Format format) {
// BINARYBUFFER is the largest non-fourcc format
return format > D3D9Format::BINARYBUFFER;
}
}