fix(web): fix Android Chrome black screen and Fixed-mode WebGL2 viewport scissor

Resolves the Android Chrome black screen after closing the welcome back interface and prevents Fixed-mode 317HD `gl.clear` from wiping surrounding HUD/border regions.

### WebGL2 Context & Fixed-Mode Scissoring
- `WebGL2.java`:
  - Enabled `preserveDrawingBuffer: true` and removed `desynchronized: true` on the `#gl-canvas` WebGL2 context to prevent Android Chrome from clearing or failing to composite between frames.
  - Added `SCISSOR_TEST` (`0x0C11`) and `scissor(x, y, width, height)` bindings.
- `WebHd317Renderer.java`:
  - Wrapped Pass 2 (`gl.clear` and 3D scene draw) in `GL_SCISSOR_TEST` (`gl.scissor(vpX, vpY, width, height)`) so Fixed-mode stone borders, chatbox, and tab areas are preserved.
  - Reused `HD317Pipeline.backend` in `ensureOverlayReady()` to avoid creating duplicate `WebHd317Renderer` instances.
- `RSImageProducer.java`:
  - Removed `desynchronized: true` from `#game-canvas`'s 2D context so Android Chrome composites `#game-canvas` transparently over `#gl-canvas`.

### Service Worker Caching
- `src/main/webapp/sw.js`:
  - Bumped `CACHE_VERSION` to `2006scape-web-v3` and switched `js/client.js` to network-first (with cache fallback) so client updates take effect immediately when online.
This commit is contained in:
Dark98 committed 2026-11-30 22:41:05 +00:00
1 parent ededb882a0
commit 4bcb91c3a2
4 files changed
+19 -7

No files matched your search

+3 -1
View File
@@ -20,6 +20,7 @@ public interface WebGL2 extends JSObject {
int SRC_ALPHA = 0x0302;
int ONE_MINUS_SRC_ALPHA = 0x0303;
int DEPTH_TEST = 0x0B71;
int SCISSOR_TEST = 0x0C11;
int BLEND = 0x0BE2;
int POLYGON_OFFSET_FILL = 0x8037;
int FLOAT = 0x1406;
@@ -65,12 +66,13 @@ public interface WebGL2 extends JSObject {
interface UniformLocation extends JSObject {}
@JSBody(params = {"canvas"}, script =
"return canvas.getContext('webgl2', { alpha: false, antialias: false, preserveDrawingBuffer: false, powerPreference: 'high-performance', desynchronized: true });")
"return canvas.getContext('webgl2', { alpha: false, antialias: false, preserveDrawingBuffer: true, powerPreference: 'high-performance' });")
static WebGL2 getContext(HTMLCanvasElement canvas) {
return null;
}
void viewport(int x, int y, int width, int height);
void scissor(int x, int y, int width, int height);
void clearColor(float r, float g, float b, float a);
void clear(int mask);
void enable(int cap);