1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-30 11:52:11 +01:00

[d3d11] Fix box validation in CopySubresourceRegion1

This commit is contained in:
Philip Rebohle 2021-06-24 09:57:13 +02:00
parent 9f80d9f8b2
commit 08a6b42458
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -317,6 +317,12 @@ namespace dxvk {
if (!pDstResource || !pSrcResource) if (!pDstResource || !pSrcResource)
return; return;
if (pSrcBox
&& (pSrcBox->left >= pSrcBox->right
|| pSrcBox->top >= pSrcBox->bottom
|| pSrcBox->front >= pSrcBox->back))
return;
D3D11_RESOURCE_DIMENSION dstResourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN; D3D11_RESOURCE_DIMENSION dstResourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
D3D11_RESOURCE_DIMENSION srcResourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN; D3D11_RESOURCE_DIMENSION srcResourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN;
@ -332,9 +338,6 @@ namespace dxvk {
VkDeviceSize byteCount = -1; VkDeviceSize byteCount = -1;
if (pSrcBox) { if (pSrcBox) {
if (pSrcBox->left >= pSrcBox->right)
return; // no-op, but legal
srcOffset = pSrcBox->left; srcOffset = pSrcBox->left;
byteCount = pSrcBox->right - pSrcBox->left; byteCount = pSrcBox->right - pSrcBox->left;
} }
@ -360,11 +363,6 @@ namespace dxvk {
VkExtent3D srcExtent = srcTexture->MipLevelExtent(srcLayers.mipLevel); VkExtent3D srcExtent = srcTexture->MipLevelExtent(srcLayers.mipLevel);
if (pSrcBox != nullptr) { if (pSrcBox != nullptr) {
if (pSrcBox->left >= pSrcBox->right
|| pSrcBox->top >= pSrcBox->bottom
|| pSrcBox->front >= pSrcBox->back)
return; // no-op, but legal
srcOffset.x = pSrcBox->left; srcOffset.x = pSrcBox->left;
srcOffset.y = pSrcBox->top; srcOffset.y = pSrcBox->top;
srcOffset.z = pSrcBox->front; srcOffset.z = pSrcBox->front;