mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-02 22:29:16 +01:00
[dxvk] Support multi-plane formats in computeImageSize
This commit is contained in:
parent
6462174c13
commit
55a67988b2
@ -75,7 +75,25 @@ namespace dxvk::util {
|
|||||||
|
|
||||||
VkDeviceSize computeImageDataSize(VkFormat format, VkExtent3D extent) {
|
VkDeviceSize computeImageDataSize(VkFormat format, VkExtent3D extent) {
|
||||||
const DxvkFormatInfo* formatInfo = imageFormatInfo(format);
|
const DxvkFormatInfo* formatInfo = imageFormatInfo(format);
|
||||||
return formatInfo->elementSize * flattenImageExtent(computeBlockCount(extent, formatInfo->blockSize));
|
|
||||||
|
VkDeviceSize size = 0;
|
||||||
|
|
||||||
|
for (auto aspects = formatInfo->aspectMask; aspects; ) {
|
||||||
|
auto aspect = vk::getNextAspect(aspects);
|
||||||
|
auto elementSize = formatInfo->elementSize;
|
||||||
|
auto planeExtent = extent;
|
||||||
|
|
||||||
|
if (formatInfo->flags.test(DxvkFormatFlag::MultiPlane)) {
|
||||||
|
auto plane = &formatInfo->planes[vk::getPlaneIndex(aspect)];
|
||||||
|
planeExtent.width /= plane->blockSize.width;
|
||||||
|
planeExtent.height /= plane->blockSize.height;
|
||||||
|
elementSize = plane->elementSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
size += elementSize * flattenImageExtent(computeBlockCount(planeExtent, formatInfo->blockSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user