Add linux wayland support to claudia (#6249)

* Add linux wayland support to claudia

Could not do x11 because quote "oh my god x11 support might be a hecking nightmare" -pjb

but the skeleton is there i guess

* Review

* Ok massivly misunderstood pjb
This commit is contained in:
Myra
2025-10-10 20:43:28 +02:00
committed by GitHub
parent e784ac8d86
commit f4cf5565fa
2 changed files with 37 additions and 21 deletions

View File

@@ -44,26 +44,38 @@ internal sealed unsafe partial class RhiWebGpu
surfaceDesc.nextInChain = (WGPUChainedStruct*)(&surfaceDescMetal);
#elif LINUX
// TODO: Linux surface creation
/*
WGPUSurfaceSourceWaylandSurface surfaceDescWayland;
WGPUSurfaceSourceXlibWindow surfaceDescX11;
var xDisplay = _clyde._windowing.WindowGetX11Display(window);
var xWindow = _clyde._windowing.WindowGetX11Id(window);
if (xDisplay != null && xWindow != null)
if (surfaceParams.Wayland)
{
surfaceDescX11 = new WGPUSurfaceSourceXlibWindow
surfaceDescWayland = new WGPUSurfaceSourceWaylandSurface
{
chain =
{
sType = WGPUSType.WGPUSType_SurfaceSourceWaylandSurface
},
display = surfaceParams.WaylandDisplay,
surface = surfaceParams.WaylandSurface,
};
surfaceDesc.nextInChain = (WGPUChainedStruct*)(&surfaceDescWayland);
}
else
{
surfaceDescX11 = new WGPUSurfaceSourceXlibWindow()
{
chain =
{
sType = WGPUSType.WGPUSType_SurfaceSourceXlibWindow
},
display = ((IntPtr)xDisplay.Value).ToPointer(),
window = xWindow.Value
display = surfaceParams.X11Display,
// TODO "Oh my god x11 support might be a nightmare this is outside of your ability to deal with -pjb"
// window = surfaceParams.X11Window,
};
surfaceDesc.nextInChain = (WGPUChainedStruct*)(&surfaceDescX11);
*/
surfaceDesc.nextInChain = (WGPUChainedStruct*)(&surfaceDescX11);
}
#endif
var surface = wgpuInstanceCreateSurface(_wgpuInstance, &surfaceDesc);

View File

@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
@@ -480,24 +481,27 @@ internal partial class Clyde
{
return new RhiBase.RhiWindowSurfaceParams
{
X11Display = SDL.SDL_GetPointerProperty(windowProps, SDL.SDL_PROP_WINDOW_X11_DISPLAY_POINTER, 0),
X11Id = SDL.SDL_GetPointerProperty(windowProps, SDL.SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0),
Wayland = true,
WaylandDisplay = (void*)SDL.SDL_GetPointerProperty(
props,
SDL.SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER,
0),
WaylandSurface = (void*)SDL.SDL_GetPointerProperty(props,
SDL.SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER,
0),
};
}
else
{
Debug.Assert(_videoDriver == _sdlVideoDriver.X11);
return new RhiBase.RhiWindowSurfaceParams
{
Wayland = true,
WaylandDisplay = SDL.SDL_GetPointerProperty(
windowProps,
SDL.SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER,
0),
WaylandSurface = SDL.SDL_GetPointerProperty(
windowProps,
SDL.SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER,
X11Display = (void*)SDL.SDL_GetPointerProperty(props,
SDL.SDL_PROP_WINDOW_X11_DISPLAY_POINTER,
0),
// TODO "Oh my god x11 support might be a nightmare this is outside of your ability to deal with -pjb"
// X11Window = SDL.SDL_GetPointerProperty(props,
// SDL.SDL_PROP_WINDOW_X11_WINDOW_NUMBER,
// 0),
};
}
#endif