MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Tools / GpuDumpMemoryProps

Function GpuDumpMemoryProps

vulkaninfo/vulkaninfo.cpp:471–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471void GpuDumpMemoryProps(Printer &p, AppGpu &gpu) {
472 p.SetHeader();
473 ObjectWrapper obj_mem_props(p, "VkPhysicalDeviceMemoryProperties");
474 IndentWrapper indent(p);
475 {
476 ObjectWrapper obj_mem_heaps(p, "memoryHeaps", gpu.memory_props.memoryHeapCount);
477
478 for (uint32_t i = 0; i < gpu.memory_props.memoryHeapCount; ++i) {
479 p.SetElementIndex(static_cast<int>(i));
480 ObjectWrapper obj_mem_heap(p, "memoryHeaps");
481 p.SetMinKeyWidth(6);
482 p.PrintKeyString("size", append_human_readable(gpu.memory_props.memoryHeaps[i].size));
483 if (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_MEMORY_BUDGET_EXTENSION_NAME)) {
484 p.PrintKeyString("budget", append_human_readable(gpu.heapBudget[i]));
485 p.PrintKeyString("usage", append_human_readable(gpu.heapUsage[i]));
486 }
487 DumpVkMemoryHeapFlags(p, "flags", gpu.memory_props.memoryHeaps[i].flags);
488 }
489 }
490 {
491 ObjectWrapper obj_mem_types(p, "memoryTypes", gpu.memory_props.memoryTypeCount);
492 for (uint32_t i = 0; i < gpu.memory_props.memoryTypeCount; ++i) {
493 p.SetElementIndex(static_cast<int>(i));
494 ObjectWrapper obj_mem_type(p, "memoryTypes");
495 p.SetMinKeyWidth(13);
496 p.PrintKeyValue("heapIndex", gpu.memory_props.memoryTypes[i].heapIndex);
497
498 auto flags = gpu.memory_props.memoryTypes[i].propertyFlags;
499 DumpVkMemoryPropertyFlags(p, "propertyFlags = " + to_hex_str(flags), flags);
500
501 ObjectWrapper usable_for(p, "usable for");
502 const uint32_t memtype_bit = 1U << i;
503
504 // only linear and optimal tiling considered
505 for (auto &image_tiling : gpu.memory_image_support_types) {
506 p.SetOpenDetails();
507 ArrayWrapper arr(p, VkImageTilingString(VkImageTiling(image_tiling.tiling)));
508 bool has_any_support_types = false;
509 bool regular = false;
510 bool transient = false;
511 bool sparse = false;
512 for (auto &image_format : image_tiling.formats) {
513 if (image_format.type_support.size() > 0) {
514 bool has_a_support_type = false;
515 for (auto &img_type : image_format.type_support) {
516 if (img_type.Compatible(memtype_bit)) {
517 has_a_support_type = true;
518 has_any_support_types = true;
519 if (img_type.type == ImageTypeSupport::Type::regular) regular = true;
520 if (img_type.type == ImageTypeSupport::Type::transient) transient = true;
521 if (img_type.type == ImageTypeSupport::Type::sparse) sparse = true;
522 }
523 }
524 if (has_a_support_type) {
525 if (image_format.format == color_format) {
526 p.PrintString("color images");
527 } else {
528 p.PrintString(VkFormatString(image_format.format));

Callers 1

DumpGpuFunction · 0.85

Calls 11

append_human_readableFunction · 0.85
DumpVkMemoryHeapFlagsFunction · 0.85
to_hex_strFunction · 0.85
VkImageTilingStringFunction · 0.85
VkFormatStringFunction · 0.85
PrintKeyStringMethod · 0.80
PrintKeyValueMethod · 0.80
CompatibleMethod · 0.80
PrintStringMethod · 0.80
AddNewlineMethod · 0.80

Tested by

no test coverage detected