#2842·drei

[v11] Environment gainmap loading throws on WebGPU — gainmap-js calls readRenderTargetPixels

Author: DennisSmolekCreated Sep 24, 2026Updated Sep 24, 2026
Labelsbugwebgpuv11

Environment with a gainmap HDR throws on WebGPU

Found by the strict GPU check in #2841 — it is the one story that fails for a reason that is not the environmental Dawn/mipmap issue:

Environment › Gainmap  (staging-environment--environment-st-4)
TypeError: renderer.readRenderTargetPixels is not a function
  HDRJPGLoader.load → prepareQuadRenderer → canReadPixels

@monogrid/gainmap-js calls readRenderTargetPixels, which exists on WebGLRenderer and not on the WebGPU Renderer (whose equivalent is the async readRenderTargetPixelsAsync). So any <Environment files="*.jpg"> that resolves to a gainmap HDR throws under WebGPU.

It surfaces as a vitest unhandled error only once the story lives long enough for the loader to run, which is why nobody saw it before the settle wait in #2841.

Options

  • Check whether a newer @monogrid/gainmap-js supports the WebGPU renderer.
  • Route gainmap decoding through #drei-platform and, on WebGPU, either use the async readback or decode on CPU.
  • Failing both, Environment should detect the WebGPU renderer and throw a clear error for gainmap inputs instead of a TypeError from inside a dependency.

Keeps DREI_STRICT_GPU=1 from going green; the gate stays opt-in until this is resolved.