Repository navigation
GL surfaces - #1
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements AppRuntime's graphics contracts (
Surface,SurfaceDelegate;Graphics.md) on Linux, and drawsGLSurfacenodes in the player.Depends on PureSwift/Cacao#46 (
Image(pixels:)). CI here fails to build until it's merged into Cacao'sdevelop.How
LinuxGraphics, a new host module. It openslibEGL.so.1andlibGLESv2.so.2at run time, so the host links no GL; without them,graphicsis unavailable.framefor each attached surface, then reads the pixels back (flipped, premultiplied) into Cacao'sImage(pixels:). Before each frame it sends the moves since the last one, one per pointer. Whatever EGL context was current before a frame is current again after it; SDL's renderer may use one on the same thread.contextLost, a new context is made, and every surface getscontextRestored.rt_gl_context_generationchanges for the wasm2c shim.Sources/LinuxUI/HostGLSurface.swift):resizewith the size in pixels, and detaches it on disappear, which cancels pointers in contact and drops focus.sync-darwinui.shkeepsHost*.swiftfiles and hooks NodeView's unknown-type case toHostNodeViews.graphics, and it links-lGLESv2into hosts for apps that declaregraphics.linux-app-hostlinks it as-needed when built with an app library.docker.shmountsCACAO_PATHand passesCACAO_SCREENSHOT_DELAYthrough.Not yet
setPointerCapturedreturnsfalse.Each frame is read back and uploaded again. A GL backend for Cacao's compositor could show the pbuffer as a texture instead.
Tested
CACAO_PATH).LinuxGraphicsTests, 10 tests:resizecomes first;ExampleGLas alinux-arm64slice, linked intolinux-app-host, run headless withCACAO_SCREENSHOT_DELAY=1. That's the screenshot above.LinuxGraphics,LinuxUIandLinuxPackagerbuild. A full macOS build already stops atCLinuxHost'sfeatures.honmaster, so that failure isn't from this branch.