1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[d3d11] Check image block alignment in UpdateSubresource1

Fixes validation errors in World of Warcraft, which for some reason
tries to update individual pixels of block-compressed textures.
See #964.
This commit is contained in:
Philip Rebohle 2019-03-14 01:11:39 +01:00
parent 833c433556
commit 2d39be4e72
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -1137,8 +1137,10 @@ namespace dxvk {
textureInfo->GetSubresourceFromIndex(
VK_IMAGE_ASPECT_COLOR_BIT, DstSubresource);
VkExtent3D mipExtent = textureInfo->GetImage()->mipLevelExtent(subresource.mipLevel);
VkOffset3D offset = { 0, 0, 0 };
VkExtent3D extent = textureInfo->GetImage()->mipLevelExtent(subresource.mipLevel);
VkExtent3D extent = mipExtent;
if (pDstBox != nullptr) {
if (pDstBox->left >= pDstBox->right
@ -1163,6 +1165,10 @@ namespace dxvk {
auto formatInfo = imageFormatInfo(
textureInfo->GetImage()->info().format);
if (!util::isBlockAligned(offset, formatInfo->blockSize)
|| !util::isBlockAligned(offset, extent, formatInfo->blockSize, mipExtent))
return;
const VkExtent3D regionExtent = util::computeBlockCount(extent, formatInfo->blockSize);
const VkDeviceSize bytesPerRow = regionExtent.width * formatInfo->elementSize;