aboutsummaryrefslogtreecommitdiff
path: root/vulkaninfo/vulkaninfo.cpp
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2021-06-18 16:32:40 -0600
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2021-11-29 13:03:31 -0700
commitde6e3eed59dca4e8e9875e2c08255cc41322d8d4 (patch)
treeec9d817239f5e6f763e246dd0a5782b34c124d3f /vulkaninfo/vulkaninfo.cpp
parent4c1550a705db7690f03564ae828a3c6cfb34f358 (diff)
downloadusermoji-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.
Diffstat (limited to 'vulkaninfo/vulkaninfo.cpp')
-rw-r--r--vulkaninfo/vulkaninfo.cpp17
1 files changed, 3 insertions, 14 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";