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

Function DumpLayers

vulkaninfo/vulkaninfo.cpp:76–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76void DumpLayers(Printer &p, std::vector<LayerExtensionList> layers, const std::vector<std::unique_ptr<AppGpu>> &gpus) {
77 std::sort(layers.begin(), layers.end(), [](LayerExtensionList &left, LayerExtensionList &right) -> int {
78 return std::strncmp(left.layer_properties.layerName, right.layer_properties.layerName, VK_MAX_DESCRIPTION_SIZE) < 0;
79 });
80 switch (p.Type()) {
81 case OutputType::text:
82 case OutputType::html: {
83 p.SetHeader();
84 ArrayWrapper arr_layers(p, "Layers", layers.size());
85 IndentWrapper indent(p);
86
87 for (auto &layer : layers) {
88 std::string v_str = APIVersion(layer.layer_properties.specVersion);
89 auto props = layer.layer_properties;
90
91 std::string header = p.DecorateAsType(props.layerName) + " (" + props.description + ") " API_NAME " version " +
92 p.DecorateAsValue(v_str) + ", layer version " +
93 p.DecorateAsValue(std::to_string(props.implementationVersion));
94 ObjectWrapper obj(p, header);
95 DumpExtensions(p, "Layer Extensions", layer.extension_properties);
96
97 ObjectWrapper arr_devices(p, "Devices", gpus.size());
98 for (auto &gpu : gpus) {
99 p.SetValueDescription(std::string(gpu->props.deviceName)).PrintKeyValue("GPU id", gpu->id);
100 auto exts = gpu->inst.AppGetPhysicalDeviceLayerExtensions(gpu->phys_device, props.layerName);
101 DumpExtensions(p, "Layer-Device Extensions", exts);
102 p.AddNewline();
103 }
104 }
105 break;
106 }
107
108 case OutputType::json: {
109 assert(false && "unimplemented");
110 break;
111 }
112 case OutputType::vkconfig_output: {
113 ObjectWrapper obj(p, "Layer Properties");
114 for (auto &layer : layers) {
115 ObjectWrapper obj_name(p, layer.layer_properties.layerName);
116 p.SetMinKeyWidth(21);
117 p.PrintKeyString("layerName", layer.layer_properties.layerName);
118 p.PrintKeyString("version", APIVersion(layer.layer_properties.specVersion).str());
119 p.PrintKeyValue("implementation version", layer.layer_properties.implementationVersion);
120 p.PrintKeyString("description", layer.layer_properties.description);
121 DumpExtensions(p, "Layer Extensions", layer.extension_properties);
122 ObjectWrapper obj_devices(p, "Devices");
123 for (auto &gpu : gpus) {
124 ObjectWrapper obj_gpu(p, gpu->props.deviceName);
125 p.SetValueDescription(std::string(gpu->props.deviceName)).PrintKeyValue("GPU id", gpu->id);
126 auto exts = gpu->inst.AppGetPhysicalDeviceLayerExtensions(gpu->phys_device, layer.layer_properties.layerName);
127 DumpExtensions(p, "Layer-Device Extensions", exts);
128 }
129 }
130 break;
131 }
132 }
133}

Callers 1

RunPrinterFunction · 0.85

Calls 11

APIVersionClass · 0.85
DumpExtensionsFunction · 0.85
TypeMethod · 0.80
DecorateAsTypeMethod · 0.80
DecorateAsValueMethod · 0.80
PrintKeyValueMethod · 0.80
AddNewlineMethod · 0.80
PrintKeyStringMethod · 0.80
strMethod · 0.80
to_stringFunction · 0.70

Tested by

no test coverage detected