1,401 words
Status: accepted · 25 Nov 2026. Amends ADR-0030: the renderer carries a patch where upstream has merged a fix and not released it. Amends ADR-0044's draw order: three's own painter sorts stand.
Context
The clouds take their renderer from
three-clouds-webgpu, and every release of it since 0.1.0-alpha.7 declares
three >=0.187.0 <0.188.0; alpha.9 carries the temporal-upscale fixes the
plan's grain waits on. The game was on r185.1. The bump is four lines in two
manifests and two tarballs. On r187 the GPU suite failed 70 of 672 tests, and
every failure traced to one of eight things r187 does differently.
compileAsync is not reentrant. r187 keeps a compile's precompilation
state in one renderer field, _precompilationState. Two compiles in flight
overwrite each other's, and the second throws in _finishPreCompile
(mrdoob/three.js#35315).
warmCompile swallows a rejection by design, so what reached the page was
quieter than the throw: the second compile's pipeline is registered in the
backend's cache and never built, Pipelines.isReady answers false for it,
and the object it was for draws nothing for the life of the page. The
warm-up issues compiles concurrently on purpose (ADR-0030), so this is every
boot. Upstream fixed it for r188 by rewriting compileAsync to build each
render object synchronously again
(#35359, merged as
7d4a7890), which also closes #35352 and #35327.
A compute kernel built with compute(count) refuses a size at dispatch.
renderer.compute(kernel, size) throws for it, naming computeKernel(). The
terrain tile producer, the star reduce and warmCompute dispatched a size
that way, so on r187 the terrain stopped producing tiles.
A readback is tight. readRenderTargetPixelsAsync strips WebGPU's
256-byte row alignment before it returns. readGalaxyCube strode by the
padded row and read a wrong face at every size but a multiple of 32 texels.
QuadMesh.render lends its material a vertex node. For the length of a
draw the material's vertexNode is three's fullscreen triangle, indexed by
vertexIndex with no vertex buffer. A compile of the quad sees the
geometry's position attribute and builds a program no draw uses, so every
quad pass built its real pipeline on its first frame.
The scissor's enable flag is the target's. Into a render target, three
reads target.scissorTest where r185 read the renderer's. The cloud cube
atlas and the clipmap bake a face or a level through a scissor set only on
the renderer, so every face covered the whole atlas.
The draw list is not reversed. r185 reversed the sorted list for a
reversed-depth camera, authored renderOrder included, and sceneOrder.ts
negated the group order, the render order and the id beforehand to cancel
it. r187 negates the projected depth key instead and leaves authored order
alone, so the compensation inverted it: the cloud composite, ordered first
among the over-cloud opaques, drew after a marked mesh and veiled it.
The ACES fit is Hill's. r187's RRTAndODTFit has
v·(0.983729·v + 0.4329510) + 0.238081 below the line, the form in
selfshadow's ltc_blit.fs. r185 multiplied 0.983729 into the middle term as
well. The Natural curve cites the same source, carried r185's form, and is
held to three's fit by tonemap.gpu.test.ts.
TempNode is deprecated, and warns once per construction. r187 moved
its caching into Node, which caches any node used more than once.
@types/three 0.187 also requires QuadMesh's material, resolves
ReturnType<typeof texture> to TextureNode<unknown>, and declares
NodeLibrary.addToneMapping. Those are type changes and are made where they
fail.
Decision
The renderer is three r187, the cloud port alpha.9 on fork release 8, and an upstream fix that three has merged and not released is carried as a patch until the release that ships it.
- A patch is upstream's code, named, and temporary.
patches/three@0.187.0.patchis #35359's diff, applied to the sources it was written against and to the bundles the game loads:build/three.webgpu.js,build/three.tsl.jsandbuild/three.webgpu.nodes.js. Only two import-line hunks have no counterpart in a bundle.pnpm-workspace.yamlnames each patched dependency beside the pull request it carries, and the upgrade to the release that contains it deletes the patch in the same change. A fix of our own is not a patch: it is a pull request upstream, and until it lands the code works round the defect where the defect is met. - A kernel's size is lent, not passed.
render/dispatch.tssets the node's owndispatchSizefor one call and gives it back. The backend dispatchesdispatchSizeahead ofcount, and the kernel's bounds guard readscount, so the guard the terrain and star kernels rely on stands. - A readback is read as tight.
readGalaxyCubeand the GPU harness'sPixelscheck the length againstwidth × height × 4and refuse anything else. - A quad compiles with the vertex node its draw lends.
warmCompilereads the node by asking a quad to render into a recorder, lends it to the material for the compile, and gives it back when the compile settles. runQuadPassessets a scissored draw's target flag for the length of that draw, so no pass sets one for itself.- Three's painter sorts stand.
sceneOrder.tsis gone, andcreateRenderer.test.tsholds that no sort is installed. - The Natural curve is Hill's fit, and the shoulder's solve is its inverse; a GPU test grades the solved luminance back through the fit.
- Every node class extends
Node.
Alternatives considered
- Serialize our own compiles. One queue per renderer, each waiting compile replaying the target, MRT, tone mapping, visibility and material state its synchronous half reads. Declined: it is new code of ours whose whole job is to hide a defect upstream has already fixed, and the replay is a second account of the renderer's state that drifts from three's.
- Stay on r185. Declined: the port's peer range starts at r187, and its fixes to the temporal upscale are what the clouds plan's phase B is for.
- Wait for r188. Declined: it is not published, and the port pins
<0.188.0, so r188 waits on a port release as well. - Patch
src/only. Declined:three/webgpuresolves to the bundle, and a patch the game does not load fixes the documentation of the defect. - Route narrow targets through
warmByDrawing. Before the patch, an RG target's warm-up compiled a scalar output against whatever target was bound after a yield, the device refused it, and the first draw reused the refused pipeline. With #35359 every render object builds inside the compile's own state, andwarmSensorPassbuilds what an R8 or RG8 slice's first draw uses.
Consequences
- On the Mac mini's production build, cornerstone
weather-g1-fair, the clouds cost what they cost on r185 within a millisecond athighandultraat 1080p (19.93 and 54.60 ms against 19.82 and 54.89), and the native march is 2.4 ms cheaper. The build log's entry of 25 Nov 2026 has both sizes, every preset and the rows that measure §5.5's run-time defects rather than the clouds. - Every preset compiles on its own first frame.
low,mediumandlowEndfailed there on r185 and the adapter builds every context athighfor that reason; on r187 they build and draw with no TSL error. Navigation to first light is 4.0 to 4.3 s belowhigh, 14.9 s athighand 13.6 s atultra, where r185 took 34 s athighand more than 90 atultra. - The cloud port, both takram forks and
@pmndrs/upscalerstill extendTempNode, and each warns once per page. pnpm presets:compare --allon the tree before the plates were taken again moved eight of thirteen past the 200 px floor, tau-ceti-dusk the most at 931 px (0.61%), every difference spread evenly over its frame. The split between r187 and the corrected fit was not measured. No difference image singles out the star's granulation, the r186MaterialXNoiserewrite the frame named as the known risk.- The upgrade to r188 deletes
patches/three@0.187.0.patchand reads its release notes forDenoiseNodeandbumpScale, which the game sets neither of. postprocessingis 6.39.6, the first release whose peer range admits r187; the port's README names 6.39.4 and its peer warning.- Every reach into a renderer private that r187 kept is where it was:
_bindings,_pipelines,_currentRenderObjectFunction,_handleObjectFunctionand_callDepth. A kernel's builder made outside a dispatch is made the way three makes one, over no object with the kernel as itscompute. A builder over a renderer that has not runinit()finds_bindingsnull, where three's guard skips onlyundefined, so the WebGL builder test sets it.