mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-02 04:29:14 +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:
parent
833c433556
commit
2d39be4e72
@ -1137,8 +1137,10 @@ namespace dxvk {
|
|||||||
textureInfo->GetSubresourceFromIndex(
|
textureInfo->GetSubresourceFromIndex(
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT, DstSubresource);
|
VK_IMAGE_ASPECT_COLOR_BIT, DstSubresource);
|
||||||
|
|
||||||
|
VkExtent3D mipExtent = textureInfo->GetImage()->mipLevelExtent(subresource.mipLevel);
|
||||||
|
|
||||||
VkOffset3D offset = { 0, 0, 0 };
|
VkOffset3D offset = { 0, 0, 0 };
|
||||||
VkExtent3D extent = textureInfo->GetImage()->mipLevelExtent(subresource.mipLevel);
|
VkExtent3D extent = mipExtent;
|
||||||
|
|
||||||
if (pDstBox != nullptr) {
|
if (pDstBox != nullptr) {
|
||||||
if (pDstBox->left >= pDstBox->right
|
if (pDstBox->left >= pDstBox->right
|
||||||
@ -1163,6 +1165,10 @@ namespace dxvk {
|
|||||||
auto formatInfo = imageFormatInfo(
|
auto formatInfo = imageFormatInfo(
|
||||||
textureInfo->GetImage()->info().format);
|
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 VkExtent3D regionExtent = util::computeBlockCount(extent, formatInfo->blockSize);
|
||||||
|
|
||||||
const VkDeviceSize bytesPerRow = regionExtent.width * formatInfo->elementSize;
|
const VkDeviceSize bytesPerRow = regionExtent.width * formatInfo->elementSize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user