-
Notifications
You must be signed in to change notification settings - Fork 53
Closed as not planned
Description
Description
I'm encountering an issue while trying to use Skia-Python in headless mode with EGL. The ModernGL context is created successfully, but Skia is unable to detect it when the backend="egl" is used. However, it works correctly with non-EGL backends (e.g., glx or using glfw).
Here is the test code I'm using:
import moderngl
import skia
from PIL import Image
width, height = 800, 600
moderngl_context = moderngl.create_standalone_context(backend="egl")
print("ModernGL context:", moderngl_context)
skia_context = skia.GrDirectContext.MakeGL()
print("Skia context:", skia_context)
info = skia.ImageInfo.MakeN32Premul(width, height)
surface = skia.Surface.MakeRenderTarget(
skia_context,
skia.Budgeted.kYes,
info
)
canvas = surface.getCanvas()
canvas.clear(skia.Color(255, 255, 255, 255))
paint = skia.Paint(
Color=skia.Color(0, 100, 255, 200),
Style=skia.Paint.kFill_Style,
AntiAlias=True
)
canvas.drawCircle(width // 2, height // 2, min(width, height) // 4, paint)
canvas.flush()
image = surface.makeImageSnapshot()
pixels = image.tobytes()
image = Image.frombytes("RGBA", (width, height), pixels)
image.save('skia_circle.png')Steps to Reproduce
- Use the provided code with
moderngl.create_standalone_context(backend="egl"). - Observe that the
skia.GrDirectContext.MakeGL()context isNone.
Expected Behavior
Skia should detect the EGL-based ModernGL context and render as expected.
Actual Behavior
Skia fails to detect the EGL context, and skia.GrDirectContext.MakeGL() returns None.
Additional Notes
- The same code works when
backend="glx"or when usingglfw, which relies onxorgand GLX. - Running headless with EGL is critical for our use case to avoid X11 dependencies.
Let me know if more details or logs are needed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels