Skip to content

Commit

Permalink
apidump: Add wayland support
Browse files Browse the repository at this point in the history
Just needed to fix the wl_surface not being considered a pointer type and adding the
appropriate CMake build logic.
  • Loading branch information
charles-lunarg committed Jun 7, 2024
1 parent 27ebab7 commit ff8d7e1
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 24 deletions.
17 changes: 13 additions & 4 deletions layersvt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@ elseif(APPLE)
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU")
option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
option(BUILD_WSI_WAYLAND_SUPPORT "Build WAYLAND WSI support" ON)

find_package(PkgConfig REQUIRED)

# TODO: The monitor layer is the only layer that requires XCB support
if (BUILD_WSI_XCB_SUPPORT)
pkg_check_modules(XCB REQUIRED QUIET IMPORTED_TARGET xcb)
add_compile_definitions(VK_USE_PLATFORM_XCB_KHR)
endif()

if (BUILD_WSI_WAYLAND_SUPPORT)
pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client)
add_compile_definitions(VK_USE_PLATFORM_WAYLAND_KHR)
endif()

else()
message(FATAL_ERROR "Unsupported Platform!")
endif()
Expand Down Expand Up @@ -70,10 +76,13 @@ if(BUILD_APIDUMP)
)

if(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU")
target_compile_definitions(VkLayer_api_dump PRIVATE VK_USE_PLATFORM_XLIB_KHR)
if (BUILD_WSI_XCB_SUPPORT)
target_compile_definitions(VkLayer_api_dump PRIVATE VK_USE_PLATFORM_XLIB_KHR)
endif()

# Add Wayland API dump support
# target_compile_definitions(VkLayer_api_dump PRIVATE VK_USE_PLATFORM_XLIB_KHR)
if (BUILD_WSI_WAYLAND_SUPPORT)
target_compile_definitions(VkLayer_api_dump PRIVATE VK_USE_PLATFORM_WAYLAND_KHR)
endif()
endif()

target_compile_definitions(VkLayer_api_dump PRIVATE VK_ENABLE_BETA_EXTENSIONS)
Expand Down
11 changes: 5 additions & 6 deletions layersvt/generated/api_dump_html.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,11 @@ void dump_html_wl_display(const wl_display* object, const ApiDumpSettings& setti
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
void dump_html_wl_surface(const wl_surface object, const ApiDumpSettings& settings, int indents)
void dump_html_wl_surface(const wl_surface* object, const ApiDumpSettings& settings, int indents)
{
if (settings.showAddress())
settings.stream() << "<div class='val'>" << object << "</div></summary>";
else
settings.stream() << "<div class='val'>address</div></summary>";
settings.stream() << "<div class='val'>";
OutputAddress(settings, object);
settings.stream() << "</div>";
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#if defined(VK_USE_PLATFORM_XCB_KHR)
Expand Down Expand Up @@ -19183,7 +19182,7 @@ void dump_html_VkWaylandSurfaceCreateInfoKHR(const VkWaylandSurfaceCreateInfoKHR
}
dump_html_value<const VkWaylandSurfaceCreateFlagsKHR>(object.flags, settings, "VkWaylandSurfaceCreateFlagsKHR", "flags", indents + 1, dump_html_VkWaylandSurfaceCreateFlagsKHR);
dump_html_value<const wl_display*>(object.display, settings, "struct wl_display*", "display", indents + 1, dump_html_wl_display);
dump_html_pointer<const wl_surface>(object.surface, settings, "struct wl_surface*", "surface", indents + 1, dump_html_wl_surface);
dump_html_value<const wl_surface*>(object.surface, settings, "struct wl_surface*", "surface", indents + 1, dump_html_wl_surface);
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
Expand Down
10 changes: 4 additions & 6 deletions layersvt/generated/api_dump_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,10 @@ void dump_json_wl_display(const wl_display* object, const ApiDumpSettings& setti
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
void dump_json_wl_surface(const wl_surface object, const ApiDumpSettings& settings, int indents)
void dump_json_wl_surface(const wl_surface* object, const ApiDumpSettings& settings, int indents)
{
if (settings.showAddress())
settings.stream() << "\"" << object << "\"";
else
settings.stream() << "\"address\"";
OutputAddressJSON(settings, object);
settings.stream() << "\n";
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#if defined(VK_USE_PLATFORM_XCB_KHR)
Expand Down Expand Up @@ -18786,7 +18784,7 @@ void dump_json_VkWaylandSurfaceCreateInfoKHR(const VkWaylandSurfaceCreateInfoKHR
settings.stream() << ",\n";
dump_json_value<const wl_display*>(object.display, NULL, settings, "struct wl_display*", "display", false, false, indents + 1, dump_json_wl_display);
settings.stream() << ",\n";
dump_json_pointer<const wl_surface>(object.surface, settings, "struct wl_surface*", "surface", false, false, indents + 1, dump_json_wl_surface);
dump_json_value<const wl_surface*>(object.surface, NULL, settings, "struct wl_surface*", "surface", false, false, indents + 1, dump_json_wl_surface);
settings.stream() << "\n" << settings.indentation(indents) << "]";
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
Expand Down
13 changes: 7 additions & 6 deletions layersvt/generated/api_dump_text.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,13 @@ void dump_text_wl_display(const wl_display* object, const ApiDumpSettings& setti
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
void dump_text_wl_surface(const wl_surface object, const ApiDumpSettings& settings, int indents)
void dump_text_wl_surface(const wl_surface* object, const ApiDumpSettings& settings, int indents)
{
if (settings.showAddress())
settings.stream() << object;
else
settings.stream() << "address";
if (object == NULL) {
settings.stream() << "NULL";
return;
}
OutputAddress(settings, object);
}
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#if defined(VK_USE_PLATFORM_XCB_KHR)
Expand Down Expand Up @@ -17814,7 +17815,7 @@ void dump_text_VkWaylandSurfaceCreateInfoKHR(const VkWaylandSurfaceCreateInfoKHR
dump_text_pNext_struct_name(object.pNext, settings, indents + 1, "const void*");
dump_text_value<const VkWaylandSurfaceCreateFlagsKHR>(object.flags, settings, "VkWaylandSurfaceCreateFlagsKHR", "flags", indents + 1, dump_text_VkWaylandSurfaceCreateFlagsKHR); // AET
dump_text_value<const wl_display*>(object.display, settings, "struct wl_display*", "display", indents + 1, dump_text_wl_display); // AET
dump_text_pointer<const wl_surface>(object.surface, settings, "struct wl_surface*", "surface", indents + 1, dump_text_wl_surface);
dump_text_value<const wl_surface*>(object.surface, settings, "struct wl_surface*", "surface", indents + 1, dump_text_wl_surface); // AET
if(object.pNext != nullptr){
dump_text_pNext_trampoline(object.pNext, settings, indents < 2 ? indents + 1 : indents);
}
Expand Down
2 changes: 1 addition & 1 deletion layersvt/json/VkLayer_api_dump.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,4 @@
]
}
}
}
}
2 changes: 1 addition & 1 deletion scripts/api_dump_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@
@end function
"""

POINTER_TYPES = ['void', 'xcb_connection_t', 'Display', 'SECURITY_ATTRIBUTES', 'ANativeWindow', 'AHardwareBuffer', 'wl_display', '_screen_context', '_screen_window', '_screen_buffer']
POINTER_TYPES = ['void', 'xcb_connection_t', 'Display', 'SECURITY_ATTRIBUTES', 'ANativeWindow', 'AHardwareBuffer', 'wl_display', 'wl_surface', '_screen_context', '_screen_window', '_screen_buffer']

TRACKED_STATE = {
'vkAllocateCommandBuffers':
Expand Down

0 comments on commit ff8d7e1

Please sign in to comment.