1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 02:52:10 +01:00

[dxvk] Introduce per-aspect version of computeImageDataSize

This commit is contained in:
Philip Rebohle 2022-09-05 04:30:38 +02:00
parent 957d99ed8d
commit e9851bee86
2 changed files with 20 additions and 1 deletions

View File

@ -145,10 +145,16 @@ namespace dxvk::util {
VkDeviceSize computeImageDataSize(VkFormat format, VkExtent3D extent) {
const DxvkFormatInfo* formatInfo = lookupFormatInfo(format);
return computeImageDataSize(format, extent, formatInfo->aspectMask);
}
VkDeviceSize computeImageDataSize(VkFormat format, VkExtent3D extent, VkImageAspectFlags aspects) {
const DxvkFormatInfo* formatInfo = lookupFormatInfo(format);
VkDeviceSize size = 0;
for (auto aspects = formatInfo->aspectMask; aspects; ) {
while (aspects) {
auto aspect = vk::getNextAspect(aspects);
auto elementSize = formatInfo->elementSize;
auto planeExtent = extent;

View File

@ -298,6 +298,19 @@ namespace dxvk::util {
*/
VkDeviceSize computeImageDataSize(VkFormat format, VkExtent3D extent);
/**
* \brief Computes image data size, in bytes
*
* Convenience method that can be used to compute the number
* of bytes required to store image data in a given format
* for the given aspects.
* \param [in] format The image format
* \param [in] extent Image size, in pixels
* \param [in] aspects Aspect mask
* \returns Data size, in bytes
*/
VkDeviceSize computeImageDataSize(VkFormat format, VkExtent3D extent, VkImageAspectFlags aspects);
/**
* \brief Applies a component mapping to a component mask
*