MCPcopy Create free account
hub / github.com/Inori/GPCS4 / computeImageDataSize

Function computeImageDataSize

GPCS4/Graphics/Violet/VltUtil.cpp:178–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176 }
177
178 VkDeviceSize computeImageDataSize(VkFormat format, VkExtent3D extent)
179 {
180 const VltFormatInfo* formatInfo = imageFormatInfo(format);
181
182 VkDeviceSize size = 0;
183
184 for (auto aspects = formatInfo->aspectMask; aspects;)
185 {
186 auto aspect = getNextAspect(aspects);
187 auto elementSize = formatInfo->elementSize;
188 auto planeExtent = extent;
189
190 if (formatInfo->flags.test(VltFormatFlag::MultiPlane))
191 {
192 auto plane = &formatInfo->planes[getPlaneIndex(aspect)];
193 planeExtent.width /= plane->blockSize.width;
194 planeExtent.height /= plane->blockSize.height;
195 elementSize = plane->elementSize;
196 }
197
198 size += elementSize * flattenImageExtent(computeBlockCount(planeExtent, formatInfo->blockSize));
199 }
200
201 return size;
202 }
203
204 static VkColorComponentFlags remapComponentFlag(
205 VkColorComponentFlags mask,

Callers 1

Calls 6

imageFormatInfoFunction · 0.85
getNextAspectFunction · 0.85
getPlaneIndexFunction · 0.85
flattenImageExtentFunction · 0.85
computeBlockCountFunction · 0.85
testMethod · 0.45

Tested by

no test coverage detected