Skip to content

Conversation

@Lokomojo
Copy link

@Lokomojo Lokomojo commented Nov 26, 2025

Re: #358

Turns out that only a minimal change is needed to get Wayland support working in diligent - at least for vulkan only.

This patch will only try to create a wayland window if NativeWindow::pWaylandSurface is defined, otherwise will fall back to xcb/xlib

@TheMostDiligent
Copy link
Contributor

I am not fully following the logic - are you trying to create surface for everything?
The expectation is that the user will try to initialize the swap chain for one specific surface, not all of them, so it looks like all is needed here is to add the Wayland surface and then properly use it.

@Lokomojo
Copy link
Author

Lokomojo commented Nov 27, 2025

Right yes we can get rid of the foundPlatform flag. I was thinking automatic fallback but it makes no sense since each windowing system has its own property in LinuxNativeWindow.

}
#elif defined(VK_USE_PLATFORM_WAYLAND_KHR)
if (m_Window.pDisplay != nullptr)
#elif defined(VK_USE_PLATFORM_WAYLAND_KHR) || defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty branch that remained from your first version

@remi-scarlet-1
Copy link

remi-scarlet-1 commented Jan 12, 2026

If I understood correctly the issue is merely Diligent's API missing the option to be initialized using a Wayland handle instead of an X11 one. Solving this seems rather simple, I wonder why this hasn't made it's way into the main branch yet.

Am I missing something? Is there some philosophy to Diligent's API that would prevent this from being merged?
Would we have to implement Wayland support for the other graphics engine implementations too before this is merged?

@TheMostDiligent
Copy link
Contributor

This specific change has not been merged primarily because it fails to pass PR checks.
@remi-scarlet-1 Can you test this branch and see if it works for you?

@remi-scarlet-1
Copy link

I'm currently setting up a project to test this. I'll hopefully have news to share tomorrow.

@remi-scarlet-1
Copy link

remi-scarlet-1 commented Jan 13, 2026

Alright! As promised @TheMostDiligent, I gave this fork a spin and I’m happy to report it works, but with a caveat that likely explains why the CI tests failed.

The code changes implemented by @Lokomojo are correct, but they are currently being excluded from the build because VK_USE_PLATFORM_WAYLAND_KHR remains undefined. You can see the block here:
DiligentCore/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp#L106

I managed to get it working perfectly by forcing VK_USE_PLATFORM_WAYLAND_KHR in my CMake root. I assume the proper fix would be to handle this definition inside Diligent-BuildSettings (or the core CMake config), but since this is my first time debugging someone else's library's internals, I'm a bit too uncomfortable with the build system to make that change myself properly.

I hope this helps move things forward!

@TheMostDiligent
Copy link
Contributor

@remi-scarlet-1 thanks for confirming - I will fix and merge this PR.

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.

3 participants