Skip to content

feat(vulkan): expose the WSI surface kind to add-ons - #15

Merged
TheForgotten69 merged 1 commit into
linux-vulkanfrom
autohdr-wsi
Oct 19, 2026
Merged

TheForgotten69 merged 1 commit into
linux-vulkanfrom
autohdr-wsi

Conversation

@TheForgotten69

Copy link
Copy Markdown
Owner

Summary

Add-ons can now tell which window system a Vulkan swap chain presents to. The layer stores the surface kind (win32, wayland, xcb, xlib) as swap chain private data before init_swapchain, under a public GUID in the new include/reshade_api_wsi.hpp:

uint64_t kind = 0;
swapchain->get_private_data(reshade::api::wsi::surface_kind_guid, &kind);
// static_cast<reshade::api::wsi::surface_kind>(kind); 0 = unknown (older layer)

swapchain::get_hwnd() still returns the native window (wl_surface* on Wayland).

Why

vkAutoHDR (https://github.com/TheForgotten69/vk-autoHDR) needs this to:

  • watch the compositor's per-window color feedback (wp_color_management_surface_feedback_v1), which is only valid on Wayland surfaces;
  • detect the driver's scRGB convention (NVIDIA's Wayland WSI declares a 203-nit reference white; Mesa declares none);
  • explain to the user how to run an X11/Xwayland app natively on Wayland when its surface has no HDR formats.

Guessing from the hwnd pointer is not reliable. Inside gamescope, for example, xcb swap chains still get scRGB.

Changes

  • include/reshade_api_wsi.hpp: surface_kind enum and surface_kind_guid.
  • vulkan_hooks.hpp: the internal vulkan_wsi_kind is now an alias of the public enum, so the values cannot drift.
  • vulkan_hooks_swapchain.cpp: one set_private_data call before init_swapchain.

Testing

  • Built build-linux and ran the vkAutoHDR headless gamescope smoke suite (hdr, hdroff, xcb, nopumbo, wlnocm): all pass.
  • Checked on KWin 6.8 under a headless kwin_wayland --virtual with the NVIDIA 615 and RADV drivers: the add-on reads wayland and engages.

@TheForgotten69
TheForgotten69 merged commit b5b78df into linux-vulkan Oct 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant