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

Function DumpSummaryInstance

vulkaninfo/vulkaninfo.cpp:1157–1190  ·  view source on GitHub ↗

Print summary of system

Source from the content-addressed store, hash-verified

1155
1156// Print summary of system
1157void DumpSummaryInstance(Printer &p, AppInstance &inst) {
1158 p.SetSubHeader();
1159 DumpExtensions(p, "Instance Extensions", inst.global_extensions, true);
1160 p.AddNewline();
1161
1162 p.SetSubHeader();
1163 ArrayWrapper arr(p, "Instance Layers", inst.global_layers.size());
1164 IndentWrapper indent(p);
1165 std::sort(inst.global_layers.begin(), inst.global_layers.end(), [](LayerExtensionList &left, LayerExtensionList &right) -> int {
1166 return std::strncmp(left.layer_properties.layerName, right.layer_properties.layerName, VK_MAX_DESCRIPTION_SIZE) < 0;
1167 });
1168 size_t layer_name_max = 0;
1169 size_t layer_desc_max = 0;
1170 size_t layer_version_max = 0;
1171
1172 // find max of each type to align everything in columns
1173 for (auto &layer : inst.global_layers) {
1174 auto props = layer.layer_properties;
1175 layer_name_max = std::max(layer_name_max, strlen(props.layerName));
1176 layer_desc_max = std::max(layer_desc_max, strlen(props.description));
1177 layer_version_max = std::max(layer_version_max, APIVersion(layer.layer_properties.specVersion).str().size());
1178 }
1179 for (auto &layer : inst.global_layers) {
1180 auto v_str = APIVersion(layer.layer_properties.specVersion).str();
1181 auto props = layer.layer_properties;
1182
1183 auto name_padding = std::string(layer_name_max - strlen(props.layerName), ' ');
1184 auto desc_padding = std::string(layer_desc_max - strlen(props.description), ' ');
1185 auto version_padding = std::string(layer_version_max - v_str.size(), ' ');
1186 p.PrintString(std::string(props.layerName) + name_padding + " " + props.description + desc_padding + " " + v_str + " " +
1187 version_padding + " version " + std::to_string(props.implementationVersion));
1188 }
1189 p.AddNewline();
1190}
1191
1192void DumpSummaryGPU(Printer &p, AppGpu &gpu) {
1193 ObjectWrapper obj(p, "GPU" + std::to_string(gpu.id));

Callers 1

RunPrinterFunction · 0.85

Calls 6

DumpExtensionsFunction · 0.85
APIVersionClass · 0.85
AddNewlineMethod · 0.80
strMethod · 0.80
PrintStringMethod · 0.80
to_stringFunction · 0.70

Tested by

no test coverage detected