Skip to content

[WASM] Glyphs randomly missing when MAXIMUM_MEMORY > 2GB (strided texSubImage2D rejected) #25146

Closed

Description

@MartinZikmund

Current behavior 🐛

On Skia WebAssembly, text randomly loses glyphs, e.g. a tooltip "Timed out waiting for condition to be met" renders as "i ed out a ting for condit on to e et", and "Browse Grid" as "rowse r". The browser console shows repeated:

WebGL: INVALID_OPERATION: texSubImage2D: ArrayBufferView not big enough for request

Root cause: when an app raises the WASM memory limit above 2 GB (EmccMaximumHeapSize > 2147483648, as SamplesApp does with 4 GB), emscripten disables its garbage-free WebGL2 upload path (workaround for Firefox bug 1838218). The fallback emscriptenWebGLGetTexPixelData slices the source as height * align(width * bpp) and ignores UNPACK_ROW_LENGTH / UNPACK_SKIP_ROWS / UNPACK_SKIP_PIXELS. Skia uploads partial glyph-atlas patches with a row length set (e.g. a 16x24 R8 patch with UNPACK_ROW_LENGTH=512 gets a 384-byte view where WebGL requires 11,792 bytes), so WebGL rejects the upload and the atlas cells stay empty while Skia believes they were filled.

Expected behavior 🎯

All glyphs render, and no texSubImage2D errors are raised.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Publish SamplesApp for browserwasm (it sets EmccMaximumHeapSize to 4 GB).
  2. Open it in Chromium and browse a few pages/tooltips with varied text.
  3. Glyphs go missing at random; the console shows the texSubImage2D errors above.

Minimal JS repro on a plain WebGL2 context:

const gl = document.createElement('canvas').getContext('webgl2');
gl.bindTexture(gl.TEXTURE_2D, gl.createTexture());
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R8, 64, 64);
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
gl.pixelStorei(gl.UNPACK_ROW_LENGTH, 64);
const heap = new Uint8Array(64 * 64);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 4, 4, 8, 8, gl.RED, gl.UNSIGNED_BYTE, new Uint8Array(heap.buffer, 0, 8 * 8));
gl.getError(); // 1282 INVALID_OPERATION - this is the view emscripten's fallback path builds

Workaround 🛠️

Keep EmccMaximumHeapSize at 2 GB or below.

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

WebAssembly

Uno.Sdk version (and other relevant versions) 📦

master (net10.0-browserwasm, emscripten 3.1.56)

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

Skia desktop uses native GL and is not affected. Image uploads with a row stride different from their width likely hit the same path.

Activity

  1. self-assigned this
    on Oct 9, 2026
  2. added
    kind/bug
    platform/wasm 🌐
    triage/untriaged
    area/skia ✏️
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/skia ✏️kind/bugplatform/wasm 🌐triage/untriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions