The GPU depth sort's view of a three.js WebGPURenderer: its device, and the
GPU resources behind an element texture and an ordering attribute.
This is the one file that reaches into three's internals for the sort
(renderer.backend), the same containment as
rendering/element-texture-row-upload.ts, so a three upgrade that moves them
breaks here and nowhere else. The bridge never uploads anything itself:
a texture is handed over only once three has uploaded its CURRENT version
(isElementTextureCurrent); before that the node keeps the SortWorker, so
the sort can never read texels older than the commit it orders;
an ordering attribute's buffer is the one three created, or created here
through the backend's own createStorageAttribute when three has not drawn
it yet (ordering pairs on native WebGPU are storage attributes,
element-storage.ts). Three later finds it and records the version, so it
does not re-upload the host array over the sort. A host write still
pending on the attribute makes the element-storage pump wait before the
device write, for the same reason.
The GPU depth sort's view of a three.js
WebGPURenderer: its device, and the GPU resources behind an element texture and an ordering attribute.This is the one file that reaches into three's internals for the sort (
renderer.backend), the same containment asrendering/element-texture-row-upload.ts, so a three upgrade that moves them breaks here and nowhere else. The bridge never uploads anything itself:isElementTextureCurrent); before that the node keeps the SortWorker, so the sort can never read texels older than the commit it orders;createStorageAttributewhen three has not drawn it yet (ordering pairs on native WebGPU are storage attributes,element-storage.ts). Three later finds it and records the version, so it does not re-upload the host array over the sort. A host write still pending on the attribute makes the element-storage pump wait before the device write, for the same reason.