Skip to content

Add the OpenGL ES entry points SDL 2's GLES2 renderer needs; take a statically linked NRO payload's API names from its bytes - #2619

Open
sendme365 wants to merge 3 commits into
seedds:mainfrom
sendme365:upstream-gles
Open

sendme365 wants to merge 3 commits into
seedds:mainfrom
sendme365:upstream-gles

Conversation

@sendme365

Copy link
Copy Markdown

Two changes from bringing up Xuan Yuan Sword: The Gate of Firmament (SDL-switch 2.24.0) and wine-nx ports:

1. GLES entry points (dm/gfx/gl/hle_gl.m). A game that ships SDL and asks eglBindAPI(0x30a0) got 'only desktop OpenGL is implemented' and then a NULL glShaderBinary through eglGetProcAddress, which crashed its render driver's creation. Record the bound API in g_egl, report OPENGL_ES_BIT in the config's RENDERABLE_TYPE/CONFORMANT, advertise OpenGL_ES in CLIENT_APIS, name the API in GL_VERSION/GL_SHADING_LANGUAGE_VERSION, and provide a glShaderBinary stub the game compiles from source and never calls.

2. Statically linked NRO payloads (dm/games/profile_guess.py, dm/tools/nso_syms.py, dm/tools/patch_nso.py, tests). A wine-nx port's runtime NRO has no dynamic symbol table, so romfs_nro_imports saw no imports and the guesser missed the Vulkan functions and the modules. When an NRO imports nothing, let the host API names its bytes reference stand in; exports() and the report tolerate a game without an sdk module; patch_nso walks .eh_frame by hand when the image carries no binary-search table header.

Tested: the game boots and renders (8 run-time GLSL shaders captured, opening movie plays); engine tools tests show no new failures against baseline.

A game that ships SDL and asks eglBindAPI(0x30a0) (Xuan Yuan Sword:
The Gate of Firmament's SDL-switch 2.24.0) got 'only desktop OpenGL
is implemented' and then a NULL glShaderBinary through
eglGetProcAddress, which crashed its render driver's creation. Record
the bound API in g_egl, report OPENGL_ES_BIT in the config's
RENDERABLE_TYPE/CONFORMANT, advertise OpenGL_ES in CLIENT_APIS, name
the API in GL_VERSION/GL_SHADING_LANGUAGE_VERSION, and provide a
glShaderBinary stub the game compiles from source and never calls.

Upstream-Status: pending
Reason: Xuan Yuan Sword: The Gate of Firmament (010037C01B982000) bring-up: SDL 2's opengles2 renderer needs these entry points and answers; a PR to seedds/nxnative follows this patch
Issue: LNPANDY/NX2Apple#1284
A wine-nx port's runtime NRO has no dynamic symbol table, so
romfs_nro_imports saw no imports and the guesser missed both its
Vulkan functions (taking the game for something else) and the
modules' names. When an NRO imports nothing, let the host API names
its bytes reference stand in; exports() and the nso_syms report
tolerate a game without an sdk module; and patch_nso walks .eh_frame
by hand when the image carries no binary-search table header (the
homebrew toolchain links without --eh-frame-hdr and points MOD0's
empty eh_frame_hdr range at the CIEs).

Upstream-Status: pending
Reason: wine-nx port bring-up: a statically linked runtime NRO has no dynamic table, so the profile guesser and the NSO patcher need the byte-level fallback (a PR to seedds/nxnative follows this patch)
Issue: LNPANDY/NX2Apple#1284
@github-actions github-actions Bot added opengl NVIDIA's desktop OpenGL on Metal (dm/gfx/gl) rewriter The NSO rewriter and per-build patches tools Tools and scripts (dm/tools, scripts) labels Nov 14, 2026
4.0.6 (v65536), SDK 15, DOMO's in-house engine on a self-hosted
SDL-switch 2.24.0. SDL's opengles2 driver builds the context (the GLES
entry points of the previous commit), the game compiles its GLSL
through it at run time, and the video module (subsdk4) draws its
playback with NVN from two GLSLC run-time binaries, captured into
shader_map.tsv: without it the first movie aborts the process.
Plays on the Mac; not checked on the iPhone.
@github-actions github-actions Bot added docs Documentation game: 010037C01B982000 A game profile new game Adds a game profile that main does not have yet labels Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation game: 010037C01B982000 A game profile new game Adds a game profile that main does not have yet opengl NVIDIA's desktop OpenGL on Metal (dm/gfx/gl) rewriter The NSO rewriter and per-build patches tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant