MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_size_bytes()

size_t MayaFlux::Core::VKImage::get_size_bytes ( ) const

Get total size in bytes (for memory allocation)

Returns
Estimated size in bytes

Definition at line 103 of file VKImage.cpp.

104{
105 const size_t bpp = vk_format_bytes_per_pixel(m_format);
106
107 size_t total = 0;
108 uint32_t mip_w = m_width;
109 uint32_t mip_h = m_height;
110 uint32_t mip_d = m_depth;
111
112 for (uint32_t i = 0; i < m_mip_levels; ++i) {
113 total += static_cast<size_t>(mip_w) * mip_h * mip_d * bpp;
114 mip_w = std::max(1U, mip_w / 2);
115 mip_h = std::max(1U, mip_h / 2);
116 mip_d = std::max(1U, mip_d / 2);
117 }
118
119 return total * m_array_layers;
120}
uint32_t vk_format_bytes_per_pixel(vk::Format fmt)
Byte width of a single pixel for a given Vulkan format.

References m_array_layers, m_depth, m_format, m_height, m_mip_levels, m_width, and MayaFlux::Core::vk_format_bytes_per_pixel().

+ Here is the call graph for this function: