[d3d9] Fix Wine test failures in StretchRect

This commit is contained in:
Robin Kertels 2024-03-06 23:39:08 +01:00
parent 133f0794bc
commit 27cc907279
No known key found for this signature in database
GPG Key ID: 3824904F14D40757
1 changed files with 38 additions and 0 deletions

View File

@ -1143,6 +1143,9 @@ namespace dxvk {
if (unlikely((srcSubresource.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) && m_flags.test(D3D9DeviceFlag::InScene)))
return D3DERR_INVALIDCALL;
if (unlikely(Filter != D3DTEXF_NONE && Filter != D3DTEXF_LINEAR && Filter != D3DTEXF_POINT))
return D3DERR_INVALIDCALL;
VkExtent3D srcExtent = srcImage->mipLevelExtent(srcSubresource.mipLevel);
VkExtent3D dstExtent = dstImage->mipLevelExtent(dstSubresource.mipLevel);
@ -1221,8 +1224,43 @@ namespace dxvk {
uint32_t(blitInfo.dstOffsets[1].y - blitInfo.dstOffsets[0].y),
uint32_t(blitInfo.dstOffsets[1].z - blitInfo.dstOffsets[0].z) };
bool srcIsDepth = IsDepthFormat(srcFormat);
bool dstIsDepth = IsDepthFormat(dstFormat);
if (unlikely(srcIsDepth || dstIsDepth)) {
if (unlikely(!srcIsDepth || !dstIsDepth))
return D3DERR_INVALIDCALL;
if (unlikely(srcTextureInfo->Desc()->Discard || dstTextureInfo->Desc()->Discard))
return D3DERR_INVALIDCALL;
if (unlikely(srcCopyExtent.width != srcExtent.width || srcCopyExtent.height != srcExtent.height))
return D3DERR_INVALIDCALL;
if (unlikely(m_flags.test(D3D9DeviceFlag::InScene)))
return D3DERR_INVALIDCALL;
}
// Copies would only work if the extents match. (ie. no stretching)
bool stretch = srcCopyExtent != dstCopyExtent;
bool dstHasRTUsage = (dstTextureInfo->Desc()->Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) != 0;
if (stretch) {
if (unlikely(pSourceSurface == pDestSurface))
return D3DERR_INVALIDCALL;
if (unlikely(dstIsDepth))
return D3DERR_INVALIDCALL;
if (unlikely(!dstHasRTUsage))
return D3DERR_INVALIDCALL;
} else {
bool srcIsSurface = srcTextureInfo->GetType() == D3DRTYPE_SURFACE;
bool dstIsSurface = dstTextureInfo->GetType() == D3DRTYPE_SURFACE;
bool srcHasRTUsage = (srcTextureInfo->Desc()->Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) != 0;
if (unlikely(!dstHasRTUsage && (!dstIsSurface || !srcIsSurface || srcHasRTUsage)))
return D3DERR_INVALIDCALL;
}
fastPath &= !stretch;
if (!fastPath || needsResolve) {