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

Fix EGL bugs #5730

Merged
merged 8 commits into from Feb 12, 2021
Merged

Fix EGL bugs #5730

merged 8 commits into from Feb 12, 2021

Conversation

alexreinking
Copy link
Member

I'm trying to fix the outstanding EGL bugs on the buildbots before releasing v11. But when trying to repro locally, I ran into a new set of bugs!

  1. I noticed that USE_RUNTIME is broken because the egl backend has to match across all runtime targets. So I added that to the matching_features list in Target.cpp
  2. This one is more serious. Some EGL implementations can unload their libraries before (or perhaps concurrently with) __attribute__((destructor)) functions. This causes the EGL device-release to call a function in an unmapped page and segfault. I tried re-querying the location of one of the symbols, but it's apparently cached so the best I could do was explicitly release the device before main exits in the GLSL app.

@alexreinking alexreinking marked this pull request as draft February 11, 2021 10:40
@alexreinking alexreinking added this to the v11.0.0 milestone Feb 11, 2021
@alexreinking
Copy link
Member Author

alexreinking commented Feb 12, 2021

The current state of this PR passes our current buildbot testing, however there are still issues with EGL on the opengl JIT tests (which are not tested on CI). Set Halide_TARGET=host-opengl-egl and run ctest -L opengl to reproduce. All failures are of the form:

terminate called after throwing an instance of 'Halide::RuntimeError'
  what():  Error: Setting up GL framebuffer 1 failed (36054)

Where 36054 is GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT (according to my system's GL/glext.h)

The following tests FAILED:
	153 - opengl_float_texture (Subprocess aborted)
	154 - opengl_inline_reduction (Subprocess aborted)
	156 - opengl_lut (Subprocess aborted)
	157 - opengl_multiple_stages (Subprocess aborted)
	158 - opengl_produce (Subprocess aborted)
	165 - opengl_sumcolor_reduction (Subprocess aborted)
	166 - opengl_sum_reduction (Subprocess aborted)
	168 - opengl_varying (Subprocess aborted)

@alexreinking alexreinking marked this pull request as ready for review February 12, 2021 20:18
@alexreinking
Copy link
Member Author

alexreinking commented Feb 12, 2021

Turns out that OpenGL ES does not allow for 3-channel framebuffers for floating point; only 1, 2, and 4 are allowed (and even then only with an appropriate extension). In plain OpenGL, it automatically converts 3-channel to 4-channel behind the scenes. Rather than introduce our own conversions, I'm just adding a clearer error message when OpenGL ES is active (EGL prefers GLES) and skipping the tests that use 3-channel float buffers.

In 3.2 the extension is standardized, but still without 3-channel support. See Table 8.10 (page 163, 181 in the PDF) here: https://www.khronos.org/registry/OpenGL/specs/es/3.2/es_spec_3.2.pdf

@alexreinking alexreinking merged commit 0d66862 into release/11.x Feb 12, 2021
@alexreinking alexreinking deleted the bugfix/egl branch February 12, 2021 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants