diff options
| -rw-r--r-- | vulkaninfo/vulkaninfo.cpp | 30 | ||||
| -rw-r--r-- | vulkaninfo/vulkaninfo.h | 8 |
2 files changed, 30 insertions, 8 deletions
diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index ef8a8699..bc2c155e 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -859,7 +859,20 @@ void print_usage(const char *argv0) { std::cout << "--summary Show a summary of the instance and GPU's on a system.\n\n"; } +#ifndef VK_USE_PLATFORM_IOS_MVK int main(int argc, char **argv) { +#else +// On iOS, we'll call this ourselves from a parent routine in the GUI +int vulkanInfoMain(int argc, char **argv) { +#endif + + bool human_readable_output = true; + bool html_output = false; + bool json_output = false; + bool vkconfig_output = false; + bool portability_json = false; + bool summary = false; + #ifdef _WIN32 if (ConsoleIsExclusive()) ConsoleEnlarge(); if (!LoadUser32Dll()) { @@ -915,6 +928,8 @@ int main(int argc, char **argv) { } std::vector<std::unique_ptr<Printer>> printers; std::ostream out(std::cout.rdbuf()); + std::ofstream json_out; + std::ofstream portability_out; std::ofstream html_out; std::ofstream vkconfig_out; @@ -971,8 +986,14 @@ int main(int argc, char **argv) { "\t\"comments\": {\n\t\t\"desc\": \"JSON configuration file describing GPU " + std::to_string(selected_gpu) + ". Generated using the vulkaninfo program.\",\n\t\t\"vulkanApiVersion\": \"" + VkVersionString(instance.vk_version) + "\"\n" + "\t}"; +#ifndef VK_USE_PLATFORM_IOS_MVK printers.push_back( std::unique_ptr<Printer>(new Printer(OutputType::json, out, selected_gpu, instance.vk_version, start_string))); +#else + json_out = std::ofstream("vulkaninfo.json"); + printers.push_back( + std::unique_ptr<Printer>(new Printer(OutputType::json, json_out, selected_gpu, instance.vk_version, start_string))); +#endif } #if defined(VK_ENABLE_BETA_EXTENSIONS) if (portability_json) { @@ -988,8 +1009,14 @@ int main(int argc, char **argv) { "'s portability features and properties. Generated using the vulkaninfo program.\",\n\t\t\"vulkanApiVersion\": " "\"" + VkVersionString(instance.vk_version) + "\"\n" + "\t}"; +#ifndef VK_USE_PLATFORM_IOS_MVK printers.push_back( std::unique_ptr<Printer>(new Printer(OutputType::json, out, selected_gpu, instance.vk_version, start_string))); +#else + portability_out = std::ofstream("portabiliyt.json"); + printers.push_back( + std::unique_ptr<Printer>(new Printer(OutputType::json, portability_out, selected_gpu, instance.vk_version, start_string))); +#endif } } #endif // defined(VK_ENABLE_BETA_EXTENSIONS) @@ -1005,6 +1032,9 @@ int main(int argc, char **argv) { } for (auto &p : printers) { +#if defined(VK_USE_PLATFORM_IOS_MVK) + p->SetAlwaysOpenDetails(true); +#endif if (summary) { DumpSummaryInstance(*p.get(), instance); p->SetHeader(); diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index 04e40d6b..0fe36e44 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -108,14 +108,6 @@ struct VulkanException : std::runtime_error { }; #define THROW_VK_ERR(func_name, err) throw VulkanException(func_name, __FILE__, __LINE__, err); -// global configuration -bool human_readable_output = true; -bool html_output = false; -bool json_output = false; -bool vkconfig_output = false; -bool portability_json = false; -bool summary = false; - #ifdef _WIN32 #define strdup _strdup |
