Skip to content

Don't use VkSurface and EglSurface on supported platforms #8100

@mahkoh

Description

@mahkoh

On android, X11, and wayland it is possible to perform presentation without using VkSurface and EglSurface.

On windows, it might be necessary to not use VkSurface to achieve low latency presentation: godotengine/godot-proposals#5692

On android, AIUI, not using VkSurface and EglSurface is the recommended way to do non-trivial things. I do not have a reference for this at hand.

Removing the use of EglSurface would solve one of the sources of undefined behavior in the opengl backend.

Removing the use of VkSwapachain would remove potential undefined behavior related to swapachain creation. See for example KhronosGroup/Vulkan-Docs#2544 and the discussion in https://registry.khronos.org/vulkan/specs/latest/man/html/VK_KHR_win32_surface.html

Uses of a window object by multiple graphics APIs results in undefined behavior.

VkSurface and EglSurface are abstractions over the underlying platform and since wgpu is itself a much larger abstraction, it would not be unreasonable for wgpu to absorb the VkSurface and EglSurface abstraction layer where possible.

Some additional code would have to be written. I would estimate this to require no more than 5000 loc for android, X11, and wayland combined. Most of that code would be shared between vulkan and opengl. Some of that code would also be required if wgpu ever wants to be useful in surfaceless contexts.

The Mesa wsi and chromium source code can be used as examples. Chromium does not use VkSurface and EglSurface if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions