summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Smith <whydoubt@gmail.com>2018-08-29 22:34:16 -0500
committerMark Young <marky@lunarg.com>2018-11-13 11:53:20 -0700
commit6ddce1e249899b021a13ed0f5f610e92d453e3fd (patch)
treea40629b0c44acb94fde053a56ae170a10eea406f
parent4ec4d971ed59a9952c28a0448cc1d685a1faa694 (diff)
downloadVulkan-Tools-6ddce1e249899b021a13ed0f5f610e92d453e3fd.tar.gz
Vulkan-Tools-6ddce1e249899b021a13ed0f5f610e92d453e3fd.tar.bz2
Vulkan-Tools-6ddce1e249899b021a13ed0f5f610e92d453e3fd.zip
vulkaninfo: Describe multiple surface extensions
Describe all available surface extensions, and adjust formatting of human-readable output to improve appearance when describing multiple surface extensions.
-rw-r--r--vulkaninfo/CMakeLists.txt17
-rw-r--r--vulkaninfo/vulkaninfo.c78
2 files changed, 48 insertions, 47 deletions
diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt
index 9d604cb5..24b354b6 100644
--- a/vulkaninfo/CMakeLists.txt
+++ b/vulkaninfo/CMakeLists.txt
@@ -32,27 +32,16 @@ if(UNIX AND NOT APPLE) # i.e. Linux
include(FindPkgConfig)
option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
- set(VULKANINFO_WSI_SELECTION "XCB" CACHE STRING "Select WSI target for vulkaninfo (XCB, XLIB)")
if(BUILD_WSI_XCB_SUPPORT)
find_package(XCB REQUIRED)
+ target_include_directories(vulkaninfo PRIVATE ${XCB_INCLUDE_DIRS})
+ target_link_libraries(vulkaninfo ${XCB_LIBRARIES})
+ target_compile_definitions(vulkaninfo PRIVATE -DVK_USE_PLATFORM_XCB_KHR)
endif()
if(BUILD_WSI_XLIB_SUPPORT)
find_package(X11 REQUIRED)
- endif()
-
- if(VULKANINFO_WSI_SELECTION STREQUAL "XCB")
- if(NOT BUILD_WSI_XCB_SUPPORT)
- message(FATAL_ERROR "Selected XCB for vulkaninfo build but not building Xcb support")
- endif()
- target_include_directories(vulkaninfo PRIVATE ${XCB_INCLUDE_DIRS})
- target_link_libraries(vulkaninfo ${XCB_LIBRARIES})
- target_compile_definitions(vulkaninfo PRIVATE -DVK_USE_PLATFORM_XCB_KHR)
- elseif(VULKANINFO_WSI_SELECTION STREQUAL "XLIB")
- if(NOT BUILD_WSI_XLIB_SUPPORT)
- message(FATAL_ERROR "Selected XLIB for vulkaninfo build but not building Xlib support")
- endif()
target_include_directories(vulkaninfo PRIVATE ${X11_INCLUDE_DIR})
target_link_libraries(vulkaninfo ${X11_LIBRARIES})
target_compile_definitions(vulkaninfo PRIVATE -DVK_USE_PLATFORM_XLIB_KHR)
diff --git a/vulkaninfo/vulkaninfo.c b/vulkaninfo/vulkaninfo.c
index 1fde1681..f6611639 100644
--- a/vulkaninfo/vulkaninfo.c
+++ b/vulkaninfo/vulkaninfo.c
@@ -150,16 +150,20 @@ struct AppInstance {
#ifdef VK_USE_PLATFORM_WIN32_KHR
HINSTANCE h_instance; // Windows Instance
HWND h_wnd; // window handle
-#elif VK_USE_PLATFORM_XCB_KHR
+#endif
+#ifdef VK_USE_PLATFORM_XCB_KHR
xcb_connection_t *xcb_connection;
xcb_screen_t *xcb_screen;
xcb_window_t xcb_window;
-#elif VK_USE_PLATFORM_XLIB_KHR
+#endif
+#ifdef VK_USE_PLATFORM_XLIB_KHR
Display *xlib_display;
Window xlib_window;
-#elif VK_USE_PLATFORM_ANDROID_KHR // TODO
+#endif
+#ifdef VK_USE_PLATFORM_ANDROID_KHR // TODO
ANativeWindow *window;
-#elif VK_USE_PLATFORM_MACOS_MVK
+#endif
+#ifdef VK_USE_PLATFORM_MACOS_MVK
void *window;
#endif
};
@@ -751,26 +755,32 @@ static void AppCreateInstance(struct AppInstance *inst) {
//---Build a list of extensions to load---
- const char *info_instance_extensions[] = {VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME,
- VK_KHR_DISPLAY_EXTENSION_NAME,
- VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
- VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME,
- VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME,
- VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME,
- VK_KHR_SURFACE_EXTENSION_NAME,
- VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME,
+ const char *info_instance_extensions[] = {
+ VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME,
+ VK_KHR_DISPLAY_EXTENSION_NAME,
+ VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
+ VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME,
+ VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME,
+ VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME,
+ VK_KHR_SURFACE_EXTENSION_NAME,
+ VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME,
#ifdef VK_USE_PLATFORM_WIN32_KHR
- VK_KHR_WIN32_SURFACE_EXTENSION_NAME
-#elif VK_USE_PLATFORM_XCB_KHR
- VK_KHR_XCB_SURFACE_EXTENSION_NAME
-#elif VK_USE_PLATFORM_XLIB_KHR
- VK_KHR_XLIB_SURFACE_EXTENSION_NAME
-#elif VK_USE_PLATFORM_WAYLAND_KHR
- VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
-#elif VK_USE_PLATFORM_ANDROID_KHR
- VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
-#elif VK_USE_PLATFORM_MACOS_MVK
- VK_MVK_MACOS_SURFACE_EXTENSION_NAME
+ VK_KHR_WIN32_SURFACE_EXTENSION_NAME,
+#endif
+#ifdef VK_USE_PLATFORM_XCB_KHR
+ VK_KHR_XCB_SURFACE_EXTENSION_NAME,
+#endif
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+ VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
+#endif
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
+ VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,
+#endif
+#ifdef VK_USE_PLATFORM_ANDROID_KHR
+ VK_KHR_ANDROID_SURFACE_EXTENSION_NAME,
+#endif
+#ifdef VK_USE_PLATFORM_MACOS_MVK
+ VK_MVK_MACOS_SURFACE_EXTENSION_NAME,
#endif
};
const uint32_t info_instance_extensions_count = ARRAY_SIZE(info_instance_extensions);
@@ -1166,11 +1176,11 @@ static void AppDestroyXcbWindow(struct AppInstance *inst) {
xcb_destroy_window(inst->xcb_connection, inst->xcb_window);
xcb_disconnect(inst->xcb_connection);
}
-//VK_USE_PLATFORM_XCB_KHR
+#endif //VK_USE_PLATFORM_XCB_KHR
//-----------------------------------------------------------
//----------------------------XLib---------------------------
-#elif VK_USE_PLATFORM_XLIB_KHR
+#ifdef VK_USE_PLATFORM_XLIB_KHR
static void AppCreateXlibWindow(struct AppInstance *inst) {
long visualMask = VisualScreenMask;
int numberOfVisuals;
@@ -1451,8 +1461,7 @@ static void AppDumpSurfaceCapabilities(struct AppInstance *inst, struct AppGpu *
}
fprintf(out, "\t\t\t\t\t\t</details>\n");
} else if (human_readable_output) {
- printf("\nVkSurfaceCapabilitiesKHR:\n");
- printf("=========================\n");
+ printf("VkSurfaceCapabilitiesKHR:\n");
printf("\tminImageCount = %u\n", inst->surface_capabilities.minImageCount);
printf("\tmaxImageCount = %u\n", inst->surface_capabilities.maxImageCount);
printf("\tcurrentExtent:\n");
@@ -1650,6 +1659,8 @@ static void AppDumpSurfaceExtension(struct AppInstance *inst, struct AppGpu *gpu
AppDestroySurface(inst);
if (html_output) {
fprintf(out, "\t\t\t\t</details>\n");
+ } else if (human_readable_output) {
+ printf("\n");
}
}
surface_extension->destroy_window(inst);
@@ -3558,8 +3569,9 @@ int main(int argc, char **argv) {
surface_ext_win32.create_surface = AppCreateWin32Surface;
surface_ext_win32.destroy_window = AppDestroyWin32Window;
AppDumpSurfaceExtension(&inst, gpus, gpu_count, &surface_ext_win32, &format_count, &present_mode_count, out);
+#endif
//--XCB--
-#elif VK_USE_PLATFORM_XCB_KHR
+#ifdef VK_USE_PLATFORM_XCB_KHR
struct SurfaceExtensionInfo surface_ext_xcb;
surface_ext_xcb.name = VK_KHR_XCB_SURFACE_EXTENSION_NAME;
surface_ext_xcb.create_window = AppCreateXcbWindow;
@@ -3568,8 +3580,9 @@ int main(int argc, char **argv) {
if (has_display) {
AppDumpSurfaceExtension(&inst, gpus, gpu_count, &surface_ext_xcb, &format_count, &present_mode_count, out);
}
+#endif
//--XLIB--
-#elif VK_USE_PLATFORM_XLIB_KHR
+#ifdef VK_USE_PLATFORM_XLIB_KHR
struct SurfaceExtensionInfo surface_ext_xlib;
surface_ext_xlib.name = VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
surface_ext_xlib.create_window = AppCreateXlibWindow;
@@ -3578,8 +3591,9 @@ int main(int argc, char **argv) {
if (has_display) {
AppDumpSurfaceExtension(&inst, gpus, gpu_count, &surface_ext_xlib, &format_count, &present_mode_count, out);
}
+#endif
//--MACOS--
-#elif VK_USE_PLATFORM_MACOS_MVK
+#ifdef VK_USE_PLATFORM_MACOS_MVK
struct SurfaceExtensionInfo surface_ext_macos;
surface_ext_macos.name = VK_MVK_MACOS_SURFACE_EXTENSION_NAME;
surface_ext_macos.create_window = AppCreateMacOSWindow;
@@ -3593,14 +3607,12 @@ int main(int argc, char **argv) {
if (html_output) {
fprintf(out, "\t\t\t\t<details><summary>None found</summary></details>\n");
} else if (human_readable_output) {
- printf("None found\n");
+ printf("None found\n\n");
}
}
if (html_output) {
fprintf(out, "\t\t\t</details>\n");
- } else if (human_readable_output) {
- printf("\n");
}
//---------