aboutsummaryrefslogtreecommitdiff
path: root/vulkaninfo/vulkaninfo.cpp
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2024-06-17 14:48:29 -0500
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2024-08-21 12:10:17 -0600
commit40294f25aa4522fe309504aaf30c1c259e11b75b (patch)
treef3d958977bec7b24cd21eacf325ff3baba716aa4 /vulkaninfo/vulkaninfo.cpp
parentf993f9722589d339a2e2766332b4d591157b5ade (diff)
downloadusermoji-40294f25aa4522fe309504aaf30c1c259e11b75b.tar.xz
vulkaninfo: Add --show-promoted-structs option
This option restores behavior that prints out structures which have been promoted to core vulkan and their members combined into the VkPhysicalDeviceVulkanXXX structs. For example, VkPhysicalDeviceVulkan12Features contains all of the features that VkPhysicalDeviceVulkanMemoryModelFeatures does, so only the former needs to be output. However, some users will want both structs present regardless and the --show-promoted-structs option allows that behavior. This commit also removes redundant checks when iterating the pNext chains while printing, as those same checks occur when the chain is being created, removing duplicate code-gen and runtime checks.
Diffstat (limited to 'vulkaninfo/vulkaninfo.cpp')
-rw-r--r--vulkaninfo/vulkaninfo.cpp64
1 files changed, 35 insertions, 29 deletions
diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp
index 719c0a37..09030a0d 100644
--- a/vulkaninfo/vulkaninfo.cpp
+++ b/vulkaninfo/vulkaninfo.cpp
@@ -351,7 +351,7 @@ void DumpGroups(Printer &p, AppInstance &inst) {
}
}
-void GpuDumpProps(Printer &p, AppGpu &gpu) {
+void GpuDumpProps(Printer &p, AppGpu &gpu, bool show_promoted_structs) {
auto props = gpu.GetDeviceProperties();
p.SetSubHeader();
{
@@ -378,7 +378,7 @@ void GpuDumpProps(Printer &p, AppGpu &gpu) {
p.AddNewline();
if (gpu.inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) {
void *place = gpu.props2.pNext;
- chain_iterator_phys_device_props2(p, gpu.inst, gpu, place);
+ chain_iterator_phys_device_props2(p, gpu.inst, gpu, show_promoted_structs, place);
}
}
@@ -523,13 +523,13 @@ void GpuDumpMemoryProps(Printer &p, AppGpu &gpu) {
p.AddNewline();
}
-void GpuDumpFeatures(Printer &p, AppGpu &gpu) {
+void GpuDumpFeatures(Printer &p, AppGpu &gpu, bool show_promoted_structs) {
p.SetHeader();
DumpVkPhysicalDeviceFeatures(p, "VkPhysicalDeviceFeatures", gpu.features);
p.AddNewline();
if (gpu.inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) {
void *place = gpu.features2.pNext;
- chain_iterator_phys_device_features2(p, gpu, place);
+ chain_iterator_phys_device_features2(p, gpu, show_promoted_structs, place);
}
}
@@ -618,11 +618,11 @@ void GpuDevDump(Printer &p, AppGpu &gpu) {
// Print gpu info for text, html, & vkconfig_output
// Uses a separate function than schema-json for clarity
-void DumpGpu(Printer &p, AppGpu &gpu, bool show_tooling_info, bool show_formats) {
+void DumpGpu(Printer &p, AppGpu &gpu, bool show_tooling_info, bool show_formats, bool show_promoted_structs) {
ObjectWrapper obj_gpu(p, "GPU" + std::to_string(gpu.id));
IndentWrapper indent(p);
- GpuDumpProps(p, gpu);
+ GpuDumpProps(p, gpu, show_promoted_structs);
DumpExtensions(p, "Device Extensions", gpu.device_extensions);
p.AddNewline();
{
@@ -633,7 +633,7 @@ void DumpGpu(Printer &p, AppGpu &gpu, bool show_tooling_info, bool show_formats)
}
}
GpuDumpMemoryProps(p, gpu);
- GpuDumpFeatures(p, gpu);
+ GpuDumpFeatures(p, gpu, show_promoted_structs);
if (show_tooling_info) {
GpuDumpToolingInfo(p, gpu);
}
@@ -653,7 +653,7 @@ void DumpGpuProfileCapabilities(Printer &p, AppGpu &gpu) {
DumpExtensions(p, "extensions", gpu.device_extensions);
{
ObjectWrapper obj(p, "features");
- GpuDumpFeatures(p, gpu);
+ GpuDumpFeatures(p, gpu, false);
}
{
ObjectWrapper obj(p, "properties");
@@ -676,7 +676,7 @@ void DumpGpuProfileCapabilities(Printer &p, AppGpu &gpu) {
}
if (gpu.inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) {
void *place = gpu.props2.pNext;
- chain_iterator_phys_device_props2(p, gpu.inst, gpu, place);
+ chain_iterator_phys_device_props2(p, gpu.inst, gpu, false, place);
}
}
{
@@ -914,35 +914,36 @@ static void ConsoleEnlarge() {
enum class OutputCategory { text, html, profile_json, vkconfig_output, summary };
const char *help_message_body =
"OPTIONS:\n"
- "[-h, --help] Print this help.\n"
- "[--summary] Show a summary of the instance and GPU's on a system.\n"
+ "[-h, --help] Print this help.\n"
+ "[--summary] Show a summary of the instance and GPU's on a system.\n"
"[-o <filename>, --output <filename>]\n"
- " Print output to a new file whose name is specified by filename.\n"
- " File will be written to the current working directory.\n"
- "[--text] Produce a text version of " APP_SHORT_NAME
+ " Print output to a new file whose name is specified by filename.\n"
+ " File will be written to the current working directory.\n"
+ "[--text] Produce a text version of " APP_SHORT_NAME
" output to stdout. This is\n"
- " the default output.\n"
- "[--html] Produce an html version of " APP_SHORT_NAME
+ " the default output.\n"
+ "[--html] Produce an html version of " APP_SHORT_NAME
" output, saved as\n"
- " \"" APP_SHORT_NAME
+ " \"" APP_SHORT_NAME
".html\" in the directory in which the command\n"
- " is run.\n"
- "[-j, --json] Produce a json version of " APP_SHORT_NAME
+ " is run.\n"
+ "[-j, --json] Produce a json version of " APP_SHORT_NAME
" output conforming to the Vulkan\n"
- " Profiles schema, saved as \n"
+ " Profiles schema, saved as \n"
" \"VP_" APP_UPPER_CASE_NAME
"_[DEVICE_NAME]_[DRIVER_VERSION].json\"\n"
" of the first gpu in the system.\n"
"[-j=<gpu-number>, --json=<gpu-number>]\n"
- " For a multi-gpu system, a single gpu can be targetted by\n"
- " specifying the gpu-number associated with the gpu of \n"
- " interest. This number can be determined by running\n"
- " " APP_SHORT_NAME
+ " For a multi-gpu system, a single gpu can be targetted by\n"
+ " specifying the gpu-number associated with the gpu of \n"
+ " interest. This number can be determined by running\n"
+ " " APP_SHORT_NAME
" without any options specified.\n"
- "[--show-tool-props] Show the active VkPhysicalDeviceToolPropertiesEXT that " APP_SHORT_NAME
+ "[--show-tool-props] Show the active VkPhysicalDeviceToolPropertiesEXT that " APP_SHORT_NAME
" finds.\n"
- "[--show-formats] Display the format properties of each physical device.\n"
- " Note: This only affects text output.\n";
+ "[--show-formats] Display the format properties of each physical device.\n"
+ " Note: This only affects text output.\n"
+ "[--show-promoted-structs] Include structs promoted to core in pNext Chains.\n";
void print_usage(const std::string &executable_name) {
std::cout << "\n" APP_SHORT_NAME " - Summarize " API_NAME " information in relation to the current environment.\n\n";
@@ -954,6 +955,7 @@ void print_usage(const std::string &executable_name) {
std::cout << " " << executable_name << " --html\n";
std::cout << " " << executable_name << " --show-formats\n";
std::cout << " " << executable_name << " --show-tool-props\n";
+ std::cout << " " << executable_name << " --show-promoted-structs\n";
std::cout << "\n" << help_message_body << std::endl;
}
@@ -963,6 +965,7 @@ struct ParsedResults {
bool has_selected_gpu; // differentiate between selecting the 0th gpu and using the default 0th value
bool show_tool_props;
bool show_formats;
+ bool show_promoted_structs;
bool print_to_file;
std::string filename; // set if explicitely given, or if vkconfig_output has a <path> argument
std::string default_filename;
@@ -1013,6 +1016,8 @@ util::vulkaninfo_optional<ParsedResults> parse_arguments(int argc, char **argv,
results.show_tool_props = true;
} else if (strcmp(argv[i], "--show-formats") == 0) {
results.show_formats = true;
+ } else if (strcmp(argv[i], "--show-promoted-structs") == 0) {
+ results.show_promoted_structs = true;
} else if ((strcmp(argv[i], "--output") == 0 || strcmp(argv[i], "-o") == 0) && argc > (i + 1)) {
if (argv[i + 1][0] == '-') {
std::cout << "-o or --output must be followed by a filename\n";
@@ -1100,7 +1105,7 @@ void RunPrinter(Printer &p, ParsedResults parse_data, AppInstance &instance, std
IndentWrapper indent(p);
for (auto &gpu : gpus) {
- DumpGpu(p, *(gpu.get()), parse_data.show_tool_props, parse_data.show_formats);
+ DumpGpu(p, *(gpu.get()), parse_data.show_tool_props, parse_data.show_formats, parse_data.show_promoted_structs);
}
}
}
@@ -1172,7 +1177,8 @@ int main(int argc, char **argv) {
uint32_t gpu_counter = 0;
for (auto &phys_device : phys_devices) {
- gpus.push_back(std::unique_ptr<AppGpu>(new AppGpu(instance, gpu_counter++, phys_device)));
+ gpus.push_back(
+ std::unique_ptr<AppGpu>(new AppGpu(instance, gpu_counter++, phys_device, parse_data.show_promoted_structs)));
}
std::vector<std::unique_ptr<AppSurface>> surfaces;