diff options
| author | Charles Giessen <charles@lunarg.com> | 2021-06-18 16:32:40 -0600 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2021-11-29 13:03:31 -0700 |
| commit | de6e3eed59dca4e8e9875e2c08255cc41322d8d4 (patch) | |
| tree | ec9d817239f5e6f763e246dd0a5782b34c124d3f | |
| parent | 4c1550a705db7690f03564ae828a3c6cfb34f358 (diff) | |
| download | usermoji-de6e3eed59dca4e8e9875e2c08255cc41322d8d4.tar.xz | |
vulkaninfo: Remove unecessary surface macro guards
Many of the macro guards in vulkaninfo are unecessary due to not directly
touching the contents of the surfaces outside of already guarded functions.
Thus, there is little point in having guards for stuff that is always able
to compile.
| -rw-r--r-- | vulkaninfo/vulkaninfo.cpp | 17 | ||||
| -rw-r--r-- | vulkaninfo/vulkaninfo.h | 6 |
2 files changed, 4 insertions, 19 deletions
diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index 2a681b42..ef172bbf 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -191,6 +191,8 @@ bool operator==(AppSurface const &a, AppSurface const &b) { void DumpPresentableSurfaces(Printer &p, AppInstance &inst, const std::vector<std::unique_ptr<AppGpu>> &gpus, const std::vector<std::unique_ptr<AppSurface>> &surfaces) { + // Don't print anything if no surfaces are found + if (surfaces.size() == 0) return; p.SetHeader(); ObjectWrapper obj(p, "Presentable Surfaces"); IndentWrapper indent(p); @@ -912,9 +914,6 @@ int main(int argc, char **argv) { auto phys_devices = instance.FindPhysicalDevices(); std::vector<std::unique_ptr<AppSurface>> surfaces; -#if defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WIN32_KHR) || \ - defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) || defined(VK_USE_PLATFORM_WAYLAND_KHR) || \ - defined(VK_USE_PLATFORM_DIRECTFB_EXT) for (auto &surface_extension : instance.surface_extensions) { surface_extension.create_window(instance); surface_extension.surface = surface_extension.create_surface(instance); @@ -923,7 +922,6 @@ int main(int argc, char **argv) { new AppSurface(instance, phys_device, surface_extension, pNext_chains.surface_capabilities2))); } } -#endif std::vector<std::unique_ptr<AppGpu>> gpus; @@ -1036,12 +1034,8 @@ int main(int argc, char **argv) { p->AddNewline(); DumpLayers(*p.get(), instance.global_layers, gpus); - -#if defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WIN32_KHR) || \ - defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) || defined(VK_USE_PLATFORM_WAYLAND_KHR) || \ - defined(VK_USE_PLATFORM_DIRECTFB_EXT) + // Doesn't print anything if no surfaces are available DumpPresentableSurfaces(*p.get(), instance, gpus, surfaces); -#endif DumpGroups(*p.get(), instance); p->SetHeader(); @@ -1054,15 +1048,10 @@ int main(int argc, char **argv) { } } -#if defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WIN32_KHR) || \ - defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) || defined(VK_USE_PLATFORM_WAYLAND_KHR) || \ - defined(VK_USE_PLATFORM_DIRECTFB_EXT) - for (auto &surface_extension : instance.surface_extensions) { AppDestroySurface(instance, surface_extension.surface); surface_extension.destroy_window(instance); } -#endif } catch (std::exception &e) { // Print the error to stderr and leave all outputs in a valid state (mainly for json) std::cerr << "ERROR at " << e.what() << "\n"; diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index 2d368312..fa90845a 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -800,17 +800,13 @@ static VkSurfaceKHR AppCreateWin32Surface(AppInstance &inst) { return surface; } -static void AppDestroyWin32Window(AppInstance &inst) { CALL_PFN(DestroyWindow)(inst.h_wnd); } +static void AppDestroyWin32Window(AppInstance &inst) { user32_handles->pfnDestroyWindow(inst.h_wnd); } #endif // VK_USE_PLATFORM_WIN32_KHR //----------------------------------------------------------- -#if defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR) || defined(VK_USE_PLATFORM_WIN32_KHR) || \ - defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT) || defined(VK_USE_PLATFORM_WAYLAND_KHR) || \ - defined(VK_USE_PLATFORM_DIRECTFB_EXT) || defined(VK_USE_PLATFORM_ANDROID_KHR) static void AppDestroySurface(AppInstance &inst, VkSurfaceKHR surface) { // same for all platforms inst.dll.fp_vkDestroySurfaceKHR(inst.instance, surface, nullptr); } -#endif //----------------------------XCB---------------------------- |
