Skip to content

Commit faf69f6

Browse files
vulkaninfo: Support promoted structs in Profile JSON output
Allows the use of `--show-promoted-structs` in Profile JSON output, allowing "all" structs to be printed. Useful because it prevents the user having to determine which version of a struct to use.
1 parent 8ebb2a6 commit faf69f6

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

vulkaninfo/vulkaninfo.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -740,14 +740,14 @@ void DumpGpu(Printer &p, AppGpu &gpu, bool show_tooling_info, bool show_formats,
740740
}
741741

742742
// Print capabilities section of profiles schema
743-
void DumpGpuProfileCapabilities(Printer &p, AppGpu &gpu) {
743+
void DumpGpuProfileCapabilities(Printer &p, AppGpu &gpu, bool show_promoted_structs) {
744744
ObjectWrapper capabilities(p, "capabilities");
745745
{
746746
ObjectWrapper temp_name_obj(p, "device");
747747
DumpExtensions(p, "extensions", gpu.device_extensions);
748748
{
749749
ObjectWrapper obj(p, "features");
750-
GpuDumpFeatures(p, gpu, false);
750+
GpuDumpFeatures(p, gpu, show_promoted_structs);
751751
}
752752
{
753753
ObjectWrapper obj(p, "properties");
@@ -770,7 +770,7 @@ void DumpGpuProfileCapabilities(Printer &p, AppGpu &gpu) {
770770
}
771771
if (gpu.inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) {
772772
void *place = gpu.props2.pNext;
773-
chain_iterator_phys_device_props2(p, gpu.inst, gpu, false, place);
773+
chain_iterator_phys_device_props2(p, gpu.inst, gpu, show_promoted_structs, place);
774774
}
775775
}
776776
{
@@ -899,7 +899,9 @@ void PrintProfileBaseInfo(Printer &p, const std::string &device_name, uint32_t a
899899
p.PrintKeyString("api-version", APIVersion(apiVersion).str());
900900
p.PrintKeyString("label", device_label);
901901
p.PrintKeyString("description", std::string("Exported from ") + APP_SHORT_NAME);
902-
{ ObjectWrapper contributors(p, "contributors"); }
902+
{
903+
ObjectWrapper contributors(p, "contributors");
904+
}
903905
{
904906
ArrayWrapper contributors(p, "history");
905907
ObjectWrapper element(p, "");
@@ -1084,21 +1086,20 @@ void print_usage(const std::string &executable_name) {
10841086
}
10851087

10861088
struct ParsedResults {
1087-
OutputCategory output_category;
1088-
uint32_t selected_gpu;
1089-
bool has_selected_gpu; // differentiate between selecting the 0th gpu and using the default 0th value
1090-
bool show_tool_props;
1091-
bool show_formats;
1092-
bool show_promoted_structs;
1093-
bool show_video_props;
1094-
bool print_to_file;
1095-
std::string filename; // set if explicitely given, or if vkconfig_output has a <path> argument
1089+
OutputCategory output_category = OutputCategory::text;
1090+
uint32_t selected_gpu = 0;
1091+
bool has_selected_gpu = false; // differentiate between selecting the 0th gpu and using the default 0th value
1092+
bool show_tool_props = false;
1093+
bool show_formats = false;
1094+
bool show_promoted_structs = false;
1095+
bool show_video_props = false;
1096+
bool print_to_file = false;
1097+
std::string filename; // set if explicitly given, or if vkconfig_output has a <path> argument
10961098
std::string default_filename;
10971099
};
10981100

10991101
util::vulkaninfo_optional<ParsedResults> parse_arguments(int argc, char **argv, std::string executable_name) {
1100-
ParsedResults results{}; // default it to zero init everything
1101-
results.output_category = OutputCategory::text; // default output category
1102+
ParsedResults results{};
11021103
results.default_filename = APP_SHORT_NAME ".txt";
11031104
for (int i = 1; i < argc; ++i) {
11041105
// A internal-use-only format for communication with the Vulkan Configurator tool
@@ -1212,7 +1213,7 @@ void RunPrinter(Printer &p, ParsedResults parse_data, AppInstance &instance, std
12121213
DumpSummaryGPU(p, *(gpu.get()));
12131214
}
12141215
} else if (parse_data.output_category == OutputCategory::profile_json) {
1215-
DumpGpuProfileCapabilities(p, *(gpus.at(parse_data.selected_gpu).get()));
1216+
DumpGpuProfileCapabilities(p, *(gpus.at(parse_data.selected_gpu).get()), parse_data.show_promoted_structs);
12161217
DumpGpuProfileInfo(p, *(gpus.at(parse_data.selected_gpu).get()));
12171218
} else {
12181219
// text, html, vkconfig_output

0 commit comments

Comments
 (0)