Skip to content

Dual-Backend Compute & Pacer Tuning ​

runtime/ isolates browser graphics API variance behind pure ES modules with zero external runtime packages.

Execution Mechanics ​

  1. WebGPU First (runtime/webgpu-backend.js): Requests 'shader-f16' automatically when supported on the adapter (alias F = f16), cleanly aliasing f32 when absent, and encodes pair() or mid() stages into compact queue submissions.
  2. WebGL2 Universal Fallback (runtime/webgl2-backend.js): Packs channels into RGBA16F TEXTURE_2D_ARRAY textures and dispatches 4-target MRT drawBuffers (up to 16 channels/draw) using top-down coordinates matching F.grid_sample.
  3. Explicit No-CPU Policy: Missing both WebGPU and float/half-float FBO support fails fast rather than degrading to CPU/WASM compute that would stall the emulator main thread.
  4. Non-Blocking FrameFlowPacer (runtime/pacer.js): Estimates emaIntervalMs over 4–200 ms deltas (maxBufferMs = 120) and drops queued entries once queue length exceeds factor + 2.

Measured Parity & Timings (Headless Edge 157, Intel Xe-LPG) ​

BackendModelPyTorch Parity PSNRMax Pixel Diff960×544 (int 480×288) / 480->960PSP 480×272 / 960->1920
WebGPUGameFI-Std72.32 / 71.70 dB1 / 25520.81 ms—
WebGPUGameFI-Lite72.12 / 72.56 dB1 / 25510.13 ms7.02 ms
WebGL2GameFI-Std69.55 / 69.38 dB1 / 25540.21 ms—
WebGL2GameFI-Lite71.05 / 71.33 dB1 / 25515.14 ms43.27 ms
WebGPU / WebGL2GameSR-Lite63.48 / 63.48 dB1 / 25525.6 / 32.4 ms45.5 / 54.4 ms
WebGPU / WebGL2GameSR-Std62.52 / 62.52 dB1 / 25516.1 / 33.1 ms53.0 / 79.8 ms