Skip to content

LATX, fix: Add missing EGL and GL proc-address wrappers - #399

Merged
LaurenIsACoder merged 1 commit into
lat-opensource:masterfrom
LaurenIsACoder:lauren/egl-gl-proc-address-wrappers
Aug 15, 2026
Merged

LATX, fix: Add missing EGL and GL proc-address wrappers#399
LaurenIsACoder merged 1 commit into
lat-opensource:masterfrom
LaurenIsACoder:lauren/egl-gl-proc-address-wrappers

Conversation

@LaurenIsACoder

Copy link
Copy Markdown
Contributor

Background

KZT allows an x86 guest to use the native host EGL and OpenGL libraries.
Normal exported functions can be wrapped when the library is loaded, but many
EGL and OpenGL extension functions are obtained dynamically through
eglGetProcAddress() or glXGetProcAddress().

The dynamic path is:

  1. The x86 guest requests a function by name.
  2. The host EGL/GL library returns a native LoongArch function pointer.
  3. LAT looks up the function's ABI signature in its wrapper table.
  4. LAT creates an x86-callable bridge to the native function.

Passing through libEGL.so.1 is therefore not sufficient by itself. A native
LoongArch function pointer cannot be called directly by x86 guest code; LAT
must know its arguments and return type before it can create the bridge.

Problem

The host EGL implementation returned a valid pointer for
eglQueryDeviceBinaryEXT, but LAT had no wrapper entry describing the
function.

eglGetProcAddress() could find the native function, but LAT could not create
a safe guest-callable bridge. This made the function unavailable to the guest
even though the host EGL implementation advertised the extension, causing
Wine graphics initialization to fail with KZT enabled.

The missing component was not libEGL.so.1 itself. It was the ABI description
required to bridge a function discovered dynamically at runtime.

Change

  • Add eglQueryDeviceBinaryEXT to both the direct EGL wrapper table and the
    shared EGL/GL proc-address table.
  • Audit the Khronos EGL, OpenGL, and OpenGL ES command registries against LAT's
    proc-address wrapper table.
  • Add 94 GL/OpenGL ES entry points exposed by the tested Linux Mesa stack.
  • Add six platform-independent EXT framebuffer-layer and mesh-shader entry
    points missing from both LAT and the Box64 reference table.
  • Keep using the existing ARB/EXT alias fallback where it already resolves
    an equivalent entry point.

The Khronos registries are treated as the API authority. Box64 is used only as
a cross-check; a difference from Box64 is not automatically treated as a LAT
defect.

Scope

This PR targets a Linux host running x86 Linux applications and Windows
applications through Wine.

Android-specific and unsupported mobile-platform interfaces are excluded.
Wayland EGL interoperability functions are also excluded because they require
Wayland object conversion, not only function signatures.

Validation

  • latx-x86_64 build: PASS
  • Linux GL/OpenGL ES wrapper audit:
    • 2,125 advertised core and extension entry points
    • all 2,125 resolve through an exact wrapper or the existing ARB/EXT
      fallback
  • EGL wrapper audit:
    • all supported non-Wayland entry points resolve
    • the remaining three advertised functions are Wayland interoperability
      interfaces outside the current wrapper-family scope
  • git diff --check: PASS

Bridge eglQueryDeviceBinaryEXT in both the direct EGL table and the shared GL proc-address table. Add the OpenGL and OpenGL ES entry points exposed by the Linux Mesa stack, plus platform-neutral EXT mesh and framebuffer-layer entry points missing from Box64. Existing ARB/EXT alias fallback continues to cover unsuffixed core names.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
@LaurenIsACoder
LaurenIsACoder marked this pull request as ready for review August 15, 2026 01:25
@LaurenIsACoder
LaurenIsACoder merged commit 2aa15e5 into lat-opensource:master Aug 15, 2026
20 checks passed
@LaurenIsACoder
LaurenIsACoder deleted the lauren/egl-gl-proc-address-wrappers branch August 15, 2026 01:25
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.

1 participant