Repository navigation
Description
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) 🔬
- Publish SamplesApp for
browserwasm(it setsEmccMaximumHeapSizeto 4 GB). - Open it in Chromium and browse a few pages/tooltips with varied text.
- Glyphs go missing at random; the console shows the
texSubImage2Derrors 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 buildsWorkaround 🛠️
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