docs/rendering: document the EGL single-context limit

Record that multiple and shared EGL contexts are unsupported: context creation returns one handle, and GL state and command encoding remain global. Keep the ownership check unchanged and revisit multiple contexts only when a real game needs them.

Include the expected second-thread BAD_ACCESS in the generated symptom index. Checked: all six documentation tests and git diff --check.

Co-authored-by: seedds <[email protected]>
This commit is contained in:
seeddsandseedds committed 2026-11-17 01:43:52 +08:00
1 parent 9537d92fbc
commit 6c079578f3
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -1049,7 +1049,7 @@ One line per symptom in the [subsystem references](../reference/): what you see
- `DM_GL_MISSES=1` lists `glCompressedTexImage3D` and `glCompressedTexSubImage3D`, and the game crashes at `pc=0` right after GL initialisation; with `DM_GL_STUBS=1` the stubs are called with `GL_TEXTURE_2D_ARRAY` (`0x8c1a`) and BC7 sRGB (`0x8e8d`). → [Compressed OpenGL texture arrays](../reference/rendering.md#compressed-opengl-texture-arrays)
- the game aborts about 2 s after `[gl] EGL context: OpenGL 4.5`, before it asks `eglGetProcAddress` for its buffer functions: `game called nn::diag abort: Result 0` with `main+0x26220` in the backtrace, no GL call red, nothing drawn. `main` holds strings such as `GL_ARB_fragment_program not available`. → [Extensions a GL renderer checks for, and its ARB names](../reference/rendering.md#extensions-a-gl-renderer-checks-for-and-its-arb-names)
- `DM_GL_MISSES=1` lists extension names of functions the layer has, such as `glGenFramebuffersEXT`, `glBindRenderbufferEXT` and `glCheckFramebufferStatusEXT`; a game whose loader takes one of those names for the function jumps to address 0 when it calls it (`CRASH sig=11 addr=0 pc=0`). → [GL extension names of core functions](../reference/rendering.md#gl-extension-names-of-core-functions)
- a jump to address 0 after `eglGetProcAddress("eglGetCurrentDisplay")`, or a loader that takes the context for lost. → [EGL's current context, per thread](../reference/rendering.md#egls-current-context-per-thread)
- a jump to address 0 after `eglGetProcAddress("eglGetCurrentDisplay")`, or a loader that takes the context for lost; a second thread's `eglMakeCurrent` returns `EGL_FALSE` with `EGL_BAD_ACCESS` while another thread owns the context. → [EGL's current context, per thread](../reference/rendering.md#egls-current-context-per-thread)
- `gl_shaders.py` refuses a shader with `uniform block matrices_ubo is not the default block`; with `DM_GL_STUBS=1` the game calls `glGetUniformBlockIndex` and `glUniformBlockBinding`. → [GL named uniform blocks](../reference/rendering.md#gl-named-uniform-blocks)
- `DM_GL_MISSES=1` lists `glStencilOpSeparate` and `glStencilFuncSeparate`; the game needs `GL_ATI_separate_stencil` in `GL_EXTENSIONS`. → [GL two-sided stencil](../reference/rendering.md#gl-two-sided-stencil)
- `program N: a shader is missing from the library, its draws are skipped` with no `shader … is not in the library` line before it; no shadows. → [GL programs with a vertex shader alone](../reference/rendering.md#gl-programs-with-a-vertex-shader-alone)
+2 -1
View File
@@ -2035,9 +2035,10 @@ Digimon Story Cyber Sleuth: Complete Edition (Media.Vision's MVGL engine, SDK 6.
### EGL's current context, per thread
- **Symptom:** a jump to address 0 after `eglGetProcAddress("eglGetCurrentDisplay")`, or a loader that takes the context for lost.
- **Symptom:** a jump to address 0 after `eglGetProcAddress("eglGetCurrentDisplay")`, or a loader that takes the context for lost; a second thread's `eglMakeCurrent` returns `EGL_FALSE` with `EGL_BAD_ACCESS` while another thread owns the context.
- **Cause:** a glad loader asks `eglGetProcAddress` for EGL functions too, and calls `eglGetCurrentDisplay`; the layer answered only `gl` names and had no `eglGetCurrent*`.
- **Fix:** `eglGetProcAddress` answers `egl` names from the same table. `eglMakeCurrent` records the calling thread's display, context and draw/read surfaces; `eglGetCurrentContext`, `eglGetCurrentDisplay` and `eglGetCurrentSurface` (`EGL_DRAW`, `EGL_READ`) answer that binding. The layer's one context has one owner, protected by a mutex. A conflicting bind returns false with `EGL_BAD_ACCESS` and leaves both threads' bindings unchanged. Making no context current, `eglReleaseThread`, or the owning thread's exit releases it for another thread. `eglGetError` returns and clears only the calling thread's error.
- **Current limit:** multiple and shared contexts are unsupported. Every `eglCreateContext` returns the same handle (`0x2`), and GL state and command encoding are global, so a second creation does not give another thread an independent context. Keep the ownership check unchanged; revisit multiple contexts only when a real game needs them.
- **Check:** `t_gl_imports` (`test_extension_names_and_egl`).
- **Found on:** Fate/hollow ataraxia REMASTERED, [issue #2818](https://github.com/seedds/nxnative/issues/2818).