Skip to the content.

The GLES 3.2 renderer for the H700 (design, 2026-12-04)

Why GLES

The Mali (tools/device/glesprobe.c, runs/glesprobe.txt)

| Limit | Value | Consequence | | — | — | — | | Vertex-stage SSBOs / images | 0 / 0 | vertex fetch cannot read storage buffers: vertex attributes (and texture buffers) | | Fragment / compute SSBOs | 35 | memexport shaders run as compute; fragment storage reads are fine | | Texture buffer texels | 65536 | 1 MB windows of RGBA32UI at most: not for whole vertex streams | | Uniform block size / per stage | 16 KB / 12 | the six Xenos blocks fit (XeFloatVS/PS 4 KB each) | | Texture units per stage / combined | 16 / 96 | Halo shaders fetch 1-6 textures | | VS outputs / FS inputs | 64 / 60 components | the ABI’s 28 fixed interface slots do not fit: compact locations per program | | Color attachments | 4 | the Xenos 4 RTs | | Renderable | RGBA16F, R11G11B10F, RG16F, R32F, RGBA32F, RGB10A2, RGBA8, RGB565 | the HDR targets map directly | | Compression | ETC2/EAC, ASTC LDR/HDR, no BC | DXT/DXN/CTX1 decode or transcode | | Extras | ARM_shader_framebuffer_fetch(+depth), EXT_shader_pixel_local_storage, EXT_buffer_storage, copy_image, geometry, tessellation, KHR_debug, get_program_binary (1 format) | tile-local resolves, persistent mapping, program cache |

What a frame is (lavapipe trace, 010_jungle opening, frame 300; tools/trace_frame.py)

544 draws and 21 resolves in ~18 render-target runs; 49 pixel and 30 vertex shaders.

CPU budget (measured, headless null GPU, CubeXX)

main thread 15-18 ms/frame, presenting thread 5-11 ms, all threads ~31 ms/frame at 30 fps; rss 347 MB. One core is free for the GL thread and the Mali driver’s own threads.

Shader contract for the GLSL ES emitter (built 2026-12-04: port/tools/xenos_spirv glsl*.odin; pack version 5)

shaderpack --glsl writes it (tools/patch_gles_shaders.py adds it to the checkout); port/shaders/shader_pack.h (“version 5”) has the full contract and the binary layout. The HLSL emitter statement for statement (same Meta, checked against the SPIR-V translation for every shader), GLSL ES 3.20 syntax, and:

Backend plan

  1. Skeleton (gles_backend.cpp): EGL (PC: Mesa llvmpipe surfaceless; device: Mali fbdev window), buffers (EXT_buffer_storage persistent maps), images, samplers, render targets (FBO cache), clears, present.
  2. Programs from the pack (GLSL text), program binary cache in the data folder, compile on worker threads with shared contexts (the Halo CE port’s approach).
  3. Draws: VAO per program vertex layout, attribute bindings per draw, UBO ring (glBindBufferRange), texture units.
  4. Resolves and the frontend’s helper passes (edram_7e3, pwl_convert, depth_pack, display_gamma, resolve_scale, resolve_downscale) as compute or fragment passes; framebuffer fetch where it saves a pass.
  5. Textures: DXT/DXN/CTX1 decode on load (dropped top mips) first; ETC2/ASTC at install time later.
  6. A GL thread fed by a command ring (the frontend records on one thread; GL calls move off it), pacing on the TCON scanline (Halo CE port).
  7. Performance: internal resolution well below 1152x640, pass cuts, program binary prewarm.