Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility of glfw with the Apple software render in github CI #2570

Open
HinTak opened this issue Jun 1, 2024 · 8 comments
Open

Compatibility of glfw with the Apple software render in github CI #2570

HinTak opened this issue Jun 1, 2024 · 8 comments
Labels

Comments

@HinTak
Copy link

HinTak commented Jun 1, 2024

Github CI has a mac os runner which is headless AFAIK, but it has a software renderer. However, glfw can't get to it - this can be illustrated by this pull (do not merge) which runs glfwinfo after build:
#2569

Both OSX OpenGL (the GLUT part) and SDL2 can get at the apple software renderer within github CI, so this is a glfw specific problem. It would be useful to nake this work, to allow glfw to be used within github's own CI workflow for testing.

I came to be here after going down the rabbit hole of trying to look at a mac os specific problem in skia-python (which has CI testing for all three platforms, and been using glut for testing on mac os x for the above reasons, instead of glfw as in the case of linux with Xvfb):
kyamagu/skia-python#214
and downstream FlorianRhiem/pyGLFW#80

@HinTak
Copy link
Author

HinTak commented Jun 1, 2024

That sdl2 and opengl on osx works happily headless can been seen in the CI in FlorianRhiem/pyGLFW#80 (comment)

@dougbinks
Copy link
Contributor

Copying the output of the MacOS run of glfwinfo here for more information:

Error: NSGL: Failed to find a suitable pixel format
GLFW header version: 3.5.0
GLFW library version: 3.5.0
GLFW library version string: "3.5.0 Cocoa NSGL Null EGL OSMesa monotonic"
GLFW platform: Cocoa
GLFW supported platforms:
 Cocoa
 Null
Vulkan loader: missing

@dougbinks
Copy link
Contributor

#2080 is related

@HinTak
Copy link
Author

HinTak commented Jun 3, 2024

For a successful run (with either SDL2 or GLUT) within github CI's macos 14 runner, the GL context reports its vendor/renderer, version, shader version as:

b'Apple Inc.'
b'Apple Software Renderer'
b'4.1 APPLE-21.0.19'
b'4.10'

@HinTak
Copy link
Author

HinTak commented Jun 3, 2024

Glfw itself has an offscreen rendering example : https://github.com/glfw/glfw/blob/master/examples/offscreen.c . It probably should be run post-build to check that it can run!

@HinTak
Copy link
Author

HinTak commented Jun 3, 2024

In my fork's ci branch I have added the two lines from #2080, as well as running both glfwinfo and the offscreen example. Here is the result from github action:

Run ./build-cocoa-static/examples/offscreen
  ./build-cocoa-static/examples/offscreen
  shell: /bin/bash -e {0}
  env:
    CFLAGS: -Werror
    MACOSX_DEPLOYMENT_TARGET: 10.11
    CMAKE_OSX_ARCHITECTURES: x86_64;arm64
0s
Run ./build-cocoa-static/tests/glfwinfo
GLFW header version: 3.5.0
GLFW library version: 3.5.0
GLFW library version string: "3.5.0 Cocoa NSGL Null EGL OSMesa monotonic"
GLFW platform: Cocoa
GLFW supported platforms:
 Cocoa
 Null
OpenGL context version string: "2.1 APPLE-21.0.19"
OpenGL context version parsed by GLFW: 2.1.0
OpenGL context renderer string: "Apple Software Renderer"
OpenGL context vendor string: "Apple Inc."
OpenGL context shading language version: "1.20"
OpenGL framebuffer:
 red: 8 green: 8 blue: 8 alpha: 8 depth: 32 stencil: 8
 samples: 0 sample buffers: 0
 accum red: 0 accum green: 0 accum blue: 0 accum alpha: 0 aux buffers: 0
Vulkan loader: missing

@HinTak
Copy link
Author

HinTak commented Jun 3, 2024

In stock, running the offscreen example post-build gives:

Run ./build-cocoa-static/examples/offscreen
Error: NSGL: Failed to find a suitable pixel format
Error: NSGL: Failed to create OpenGL context
Error: OpenGL version string retrieval is broken
Error: Process completed with exit code 1.

HinTak added a commit to HinTak/glfw that referenced this issue Jun 4, 2024
I found that I needed to do a special DELETE_TERMINATING_NULL, because
SET_ATTRIB(x, 0) are present elsewhere, and DELETE_ATTRIB(0) is not
the reverse of ADD_ATTRIB(0).

The DELETE_ATTRIB macro is not robust enough - there should be an
UNSET_ATTRIB(a,v).

fixes glfw#2570
fixes glfw#2080
@HinTak
Copy link
Author

HinTak commented Jun 4, 2024

Linked from #589 is
d79056f on the software-context branch, which contains most of the knowledge. However, my goal is that glfw (and its dependent, pyglfw) should be usable within github's own CI system, preferably without client-side code change or addition. Adding a Xvfb line is not too painful, but no-client-side special hint is preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants