Skip to content

Commit ed33199

Browse files
spencer-lunargcharles-lunarg
authored andcommitted
vulkaninfo: Dedicated ShowSettings struct
1 parent 73c5e04 commit ed33199

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

vulkaninfo/vulkaninfo.cpp

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -705,14 +705,21 @@ void GpuDumpVideoProfiles(Printer &p, AppGpu &gpu, bool show_video_props) {
705705
p.AddNewline();
706706
}
707707

708+
struct ShowSettings {
709+
bool all = false;
710+
bool tool_props = false;
711+
bool formats = false;
712+
bool promoted_structs = false;
713+
bool video_props = false;
714+
};
715+
708716
// Print gpu info for text, html, & vkconfig_output
709717
// Uses a separate function than schema-json for clarity
710-
void DumpGpu(Printer &p, AppGpu &gpu, bool show_tooling_info, bool show_formats, bool show_promoted_structs,
711-
bool show_video_props) {
718+
void DumpGpu(Printer &p, AppGpu &gpu, const ShowSettings &show) {
712719
ObjectWrapper obj_gpu(p, "GPU" + std::to_string(gpu.id));
713720
IndentWrapper indent(p);
714721

715-
GpuDumpProps(p, gpu, show_promoted_structs);
722+
GpuDumpProps(p, gpu, show.promoted_structs);
716723
DumpExtensions(p, "Device Extensions", gpu.device_extensions);
717724
p.AddNewline();
718725
{
@@ -723,17 +730,17 @@ void DumpGpu(Printer &p, AppGpu &gpu, bool show_tooling_info, bool show_formats,
723730
}
724731
}
725732
GpuDumpMemoryProps(p, gpu);
726-
GpuDumpFeatures(p, gpu, show_promoted_structs);
727-
if (show_tooling_info) {
733+
GpuDumpFeatures(p, gpu, show.promoted_structs);
734+
if (show.tool_props) {
728735
GpuDumpToolingInfo(p, gpu);
729736
}
730737

731-
if (p.Type() != OutputType::text || show_formats) {
738+
if (p.Type() != OutputType::text || show.formats) {
732739
GpuDevDump(p, gpu);
733740
}
734741

735742
if (!gpu.video_profiles.empty()) {
736-
GpuDumpVideoProfiles(p, gpu, show_video_props);
743+
GpuDumpVideoProfiles(p, gpu, show.video_props);
737744
}
738745

739746
p.AddNewline();
@@ -1092,10 +1099,7 @@ struct ParsedResults {
10921099
OutputCategory output_category = OutputCategory::text;
10931100
uint32_t selected_gpu = 0;
10941101
bool has_selected_gpu = false; // differentiate between selecting the 0th gpu and using the default 0th value
1095-
bool show_tool_props = false;
1096-
bool show_formats = false;
1097-
bool show_promoted_structs = false;
1098-
bool show_video_props = false;
1102+
ShowSettings show;
10991103
bool print_to_file = false;
11001104
std::string filename; // set if explicitly given, or if vkconfig_output has a <path> argument
11011105
std::string default_filename;
@@ -1142,18 +1146,19 @@ util::vulkaninfo_optional<ParsedResults> parse_arguments(int argc, char **argv,
11421146
results.print_to_file = true;
11431147
results.default_filename = APP_SHORT_NAME ".html";
11441148
} else if (strcmp(argv[i], "--show-all") == 0) {
1145-
results.show_tool_props = true;
1146-
results.show_formats = true;
1147-
results.show_promoted_structs = true;
1148-
results.show_video_props = true;
1149+
results.show.all = true;
1150+
results.show.tool_props = true;
1151+
results.show.formats = true;
1152+
results.show.promoted_structs = true;
1153+
results.show.video_props = true;
11491154
} else if (strcmp(argv[i], "--show-tool-props") == 0) {
1150-
results.show_tool_props = true;
1155+
results.show.tool_props = true;
11511156
} else if (strcmp(argv[i], "--show-formats") == 0) {
1152-
results.show_formats = true;
1157+
results.show.formats = true;
11531158
} else if (strcmp(argv[i], "--show-promoted-structs") == 0) {
1154-
results.show_promoted_structs = true;
1159+
results.show.promoted_structs = true;
11551160
} else if (strcmp(argv[i], "--show-video-props") == 0) {
1156-
results.show_video_props = true;
1161+
results.show.video_props = true;
11571162
} else if ((strcmp(argv[i], "--output") == 0 || strcmp(argv[i], "-o") == 0) && argc > (i + 1)) {
11581163
if (argv[i + 1][0] == '-') {
11591164
std::cout << "-o or --output must be followed by a filename\n";
@@ -1221,7 +1226,7 @@ void RunPrinter(Printer &p, ParsedResults parse_data, AppInstance &instance, std
12211226
DumpSummaryGPU(p, *(gpu.get()));
12221227
}
12231228
} else if (parse_data.output_category == OutputCategory::profile_json) {
1224-
DumpGpuProfileCapabilities(p, *(gpus.at(parse_data.selected_gpu).get()), parse_data.show_promoted_structs);
1229+
DumpGpuProfileCapabilities(p, *(gpus.at(parse_data.selected_gpu).get()), parse_data.show.promoted_structs);
12251230
DumpGpuProfileInfo(p, *(gpus.at(parse_data.selected_gpu).get()));
12261231
} else {
12271232
// text, html, vkconfig_output
@@ -1241,8 +1246,7 @@ void RunPrinter(Printer &p, ParsedResults parse_data, AppInstance &instance, std
12411246
IndentWrapper indent(p);
12421247

12431248
for (auto &gpu : gpus) {
1244-
DumpGpu(p, *(gpu.get()), parse_data.show_tool_props, parse_data.show_formats, parse_data.show_promoted_structs,
1245-
parse_data.show_video_props);
1249+
DumpGpu(p, *(gpu.get()), parse_data.show);
12461250
}
12471251
}
12481252
}
@@ -1315,7 +1319,7 @@ int main(int argc, char **argv) {
13151319
uint32_t gpu_counter = 0;
13161320
for (auto &phys_device : phys_devices) {
13171321
gpus.push_back(
1318-
std::unique_ptr<AppGpu>(new AppGpu(instance, gpu_counter++, phys_device, parse_data.show_promoted_structs)));
1322+
std::unique_ptr<AppGpu>(new AppGpu(instance, gpu_counter++, phys_device, parse_data.show.promoted_structs)));
13191323
}
13201324

13211325
std::vector<std::unique_ptr<AppSurface>> surfaces;

0 commit comments

Comments
 (0)