mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-22 07:54:15 +01:00
[d3d9] Validate srcRect and dstPoint in UpdateSurface
This commit is contained in:
parent
b3b2f0921c
commit
ed24c17d53
@ -658,18 +658,38 @@ namespace dxvk {
|
|||||||
VkExtent3D copyExtent = texLevelExtent;
|
VkExtent3D copyExtent = texLevelExtent;
|
||||||
|
|
||||||
if (pSourceRect != nullptr) {
|
if (pSourceRect != nullptr) {
|
||||||
|
const VkExtent3D extent = { uint32_t(pSourceRect->right - pSourceRect->left), uint32_t(pSourceRect->bottom - pSourceRect->top), 1 };
|
||||||
|
|
||||||
|
const bool extentAligned = extent.width % formatInfo->blockSize.width == 0
|
||||||
|
&& extent.height % formatInfo->blockSize.height == 0;
|
||||||
|
|
||||||
|
if (pSourceRect->left < 0
|
||||||
|
|| pSourceRect->top < 0
|
||||||
|
|| pSourceRect->right <= pSourceRect->left
|
||||||
|
|| pSourceRect->bottom <= pSourceRect->top
|
||||||
|
|| pSourceRect->left % formatInfo->blockSize.width != 0
|
||||||
|
|| pSourceRect->top % formatInfo->blockSize.height != 0
|
||||||
|
|| (extent != texLevelExtent && !extentAligned))
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
srcBlockOffset = { pSourceRect->left / int32_t(formatInfo->blockSize.width),
|
srcBlockOffset = { pSourceRect->left / int32_t(formatInfo->blockSize.width),
|
||||||
pSourceRect->top / int32_t(formatInfo->blockSize.height),
|
pSourceRect->top / int32_t(formatInfo->blockSize.height),
|
||||||
0u };
|
0u };
|
||||||
|
|
||||||
copyExtent = { alignDown(uint32_t(pSourceRect->right - pSourceRect->left), formatInfo->blockSize.width),
|
copyExtent = { extent.width,
|
||||||
alignDown(uint32_t(pSourceRect->bottom - pSourceRect->top), formatInfo->blockSize.height),
|
extent.height,
|
||||||
1u };
|
1u };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDestPoint != nullptr) {
|
if (pDestPoint != nullptr) {
|
||||||
dstOffset = { alignDown(pDestPoint->x, formatInfo->blockSize.width),
|
if (pDestPoint->x % formatInfo->blockSize.width != 0
|
||||||
alignDown(pDestPoint->y, formatInfo->blockSize.height),
|
|| pDestPoint->y % formatInfo->blockSize.height != 0
|
||||||
|
|| pDestPoint->x < 0
|
||||||
|
|| pDestPoint->y < 0)
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
dstOffset = { pDestPoint->x,
|
||||||
|
pDestPoint->y,
|
||||||
0u };
|
0u };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user