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

Headless rendering broken on Linux #988

Closed
bwasty opened this issue Feb 11, 2018 · 2 comments · May be fixed by bwasty/gltf-viewer#58
Closed

Headless rendering broken on Linux #988

bwasty opened this issue Feb 11, 2018 · 2 comments · May be fixed by bwasty/gltf-viewer#58
Milestone

Comments

@bwasty
Copy link
Contributor

bwasty commented Feb 11, 2018

I'm trying to get headless rendering working for my glTF viewer (for screenshot generation). On macOS it works fine, but on Linux (Debian Stretch / Ubuntu 16.04) I'm either getting blank images or context creation errors. Here are some logs for both cases:

Black + Transparent image

[DEBUG] Renderer     : (NULL)
[DEBUG] Vendor       : (NULL)
[DEBUG] Version      : (NULL)
[DEBUG] GLSL         : (NULL)
[DEBUG] Profile      : None
[DEBUG] Context Flags: Debug: false, Forward Compatible: false
[DEBUG] Extensions   :
[INFO] Imported glTF in         4.8 ms
[DEBUG] Found no TANGENTS for primitive 0 of mesh 0 (tangent calculation not implemented yet)
[INFO] Loaded scene with 2 nodes, 1 meshes in 217 µs
Saved 800x600 screenshot to /input/Box.png

It's strange that gl::GetString() doesn't show any renderer/version information and gl::GetError() show nothing either.

Context Creation fails
When explicitly requesting an OpenGL 3.3 Core context (by uncommenting these lines):

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: OsError("OSMesaCreateContextAttribs failed")', /checkout/src/libcore/result.rs:906:4

(from here)

According to glxinfo, OpenGL 3.3 should be supported:

$ xvfb-run --auto-servernum --server-args="-screen 0 640x480x24" glxinfo | grep OpenGL
...
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.9, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 13.0.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
...

(on Ubuntu 16.04 the mesa version is 17.2.4, but the behaviour is the same).

Any ideas? You can reproduce this in Docker by checking out this branch and calling

./real_headless_test.sh

More history/details here: bwasty/gltf-viewer#12

@antonycourtney
Copy link

I was getting a similar context creation failure under Mesa on Linux, which I dug into a bit on #1001.

A quick, curious question: What happens if you use (2,0) instead of (3,3) as the (major,minor) version pair on this line?

This is almost certainly not the correct long term fix, but I'd be interested to know if this workaround that worked for my case also works for you. Thanks.

@goddessfreya
Copy link
Contributor

goddessfreya commented Mar 19, 2019

Hey @bwasty, while I couldn't repo this issue against master (via either Wayland + Headless, X11+ Headless, Wayland, X11, xvfb + X11, xvfb + X11 + Headless, OsMesa, xvfb + OsMesa), I did track down a bug relating to invalid drop order. Fix is here: #1125. I had to update your program, and I filed the changes I made here: bwasty/gltf-viewer#58.

I'm going to assume this got fixed somewhere between when this bug got filed originally, and today, as there has been major changes to the headless api. If that's not the case, just tell me and I'll reopen this issue.

goddessfreya added a commit that referenced this issue Mar 19, 2019
…#988, afaik. Also adds debug to more structs. (#1125)

Signed-off-by: Hal Gentz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants