6320718491
When the shadow pass runs, the pack gets real shadow buffers (spec 6.3): shadowtex0 (cleared to 1.0 every frame), shadowtex1 (a copy, made only when a program reads it) and shadowcolor0/1 (each with two sides, made only when used, cleared to their ShadowClear colour, white by default), square at shadowMapResolution within the device's limit. Samplers: shadowtex0/watershadow, shadowtex1, `shadow` (shadowtex1 beside watershadow) and the HW forms read the shadow map, through a linear depth comparison when declared sampler2DShadow; shadowcolor/shadowcolor0/1 read the colour buffers. In the shadow programs, buffer n is shadowcolor n and colortex reads a stand-in. Without the shadow pass nothing changes: the names read the stand-ins as before. shadowcomp..shadowcomp99 run after the shadow pass and before prepare, each drawing into the alt side of the shadowcolor buffers it writes and flipping them after, as composite programs do with colortex (6.1.6). The shadow pass itself draws nothing yet, so the map stays clear. Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, sections 2.1, 5.2 (samplers), 6.1.6 and 6.3; no other loader's code read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>