In the interest of simplifying the surfman and preparing for adding support for interoperability with wgpu and for cross-process surface handles, I would like to propose version 2 of the API:
Connection
pub enum Connection {
Android(...),
Angle(...),
Cgl(...),
Ohos(...),
SurfacelessMesa(...),
Wayland(...),
Wgl(...),
X11(...),
}
Adapter
pub enum Adapter {
Android(...),
Angle(...),
Cgl(...),
Egl(...),
Ohos(...),
Wgl(...),
}
Surface
pub enum Surface {
Window(WindowSurface),
Buffer(BufferSurface),
}
pub enum BufferSurface {
Android(...),
Direct3d(...),
IoSurface(...)
Ohos(...),
Pbuffer(...),
}
pub enum WindowSurface {
Android(...),
AppKit(...)
Ohos(...),
Wayland(...),
Win32(...),
X11(...),
}
Notes:
- Only
WindowSurface would implement present meaning it's not possible to call present on a buffer surface (this causes an error today).
- Mutability concerns would be handled by a mutable getter for the currently bound surface:
if let Some(Surface::Window(window_surface)) = cnnection.bound_surface_mut() {
window_surface.present(&device);
}
Multi is eliminated. Instead a factory returns the most appropriate context given what is enabled at compile-time and what is currently running (when choosing between X11 and Wayland).
- This opens up the possibility of other kinds of offscreen buffers such as GBM, which will be necessary for cross-process rendering and integration with
wgpu.
- The idea is that
BufferSurface will provide a fallible method to get a shareable handle to be used for cross-process surfaces.
In the interest of simplifying the
surfmanand preparing for adding support for interoperability withwgpuand for cross-process surface handles, I would like to propose version 2 of the API:Connection
Adapter
Surface
Notes:
WindowSurfacewould implementpresentmeaning it's not possible to call present on a buffer surface (this causes an error today).Multiis eliminated. Instead a factory returns the most appropriate context given what is enabled at compile-time and what is currently running (when choosing between X11 and Wayland).wgpu.BufferSurfacewill provide a fallible method to get a shareable handle to be used for cross-process surfaces.