Mirror of metal.sx, talks to GLES3 via opengl.sx's runtime-loaded fn-pointer variables. EGL bootstrap is owned by AndroidPlatform; this module just calls `load_gl(@eglGetProcAddress)` once during `init` to populate the pointers, then drives raw draw/state from there. The renderer's vertex layout (12 floats: pos2/uv2/color4/params4 = 48 bytes, attribute locations 0-3) is hardcoded in a single shared VAO the Gles3Gpu owns — `set_vertex_buffer` rebinds the active VBO against it. `set_vertex_constants(slot=1, data, 64)` is treated as the 4x4 projection matrix; `set_texture(slot=0, ...)` binds texture unit 0 and sets `uniform sampler2D uTex` — both match renderer.sx's shader contract. A subtle gotcha caught + recorded in the file header: declaring the same GL name as a `#foreign` function while opengl.sx also declares it as an fn-pointer global silently lets the global win, and calling through the uninitialized variable jumps to PC=0. Solution: don't re-declare; use opengl.sx's pointers and `load_gl` them. renderer.sx: the GPU-protocol shader-source branch now passes (UI_VERT_SRC_ES, UI_FRAG_SRC_ES) on Android (separate vert+frag) vs. the combined MSL library on iOS. Both gated with `inline if OS == X`.
24 KiB
Executable File
24 KiB
Executable File