mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 16:24:12 +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) {
|
||||
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…
Reference in New Issue
Block a user