raw-window-handle icon indicating copy to clipboard operation
raw-window-handle copied to clipboard

Add a bitset that allows libraries to state what types of raw window/display handles are supported

Open i509VCB opened this issue 1 year ago • 1 comments

Sometimes there may be a situation where you need to ask a library what windowing systems it could support before initializing a library like winit. For example if running wgpu under renderdoc, the Wayland WSI will not be supported because renderdoc disables Wayland for Vulkan (since it is broken still). In this case it may be preferable to run under XWayland while still using Vulkan.

The proposal is to create a standard type that libraries like wgpu can return to let the application know if a different windowing backend may need to be chosen. A library like wgpu could return the type shown below from an Adapter so that the application can initialize the correct windowing backend before creating a surface.

In the case of wgpu this could become a part of AdapterInfo. Glutin's EGL backend could also use this to notify the user what handle types are supported as well (although this would probably apply to all APIs in the case of glutin).

The type would look something like this.

bitflags! {
    pub struct SupportedHandles {
        const WIN_32 = 1 << 0;

        const XLIB = 1 << 1;

        const WAYLAND = 1 << 2;

        // ... The rest
    }
}

i509VCB avatar Nov 10 '23 23:11 i509VCB