viewer/nodes: fix WebGPU pipeline poisoning from missing uv2 on slabs and empty roofs#464
Open
connorsoohoo wants to merge 1 commit into
Open
viewer/nodes: fix WebGPU pipeline poisoning from missing uv2 on slabs and empty roofs#464connorsoohoo wants to merge 1 commit into
connorsoohoo wants to merge 1 commit into
Conversation
… and empty roofs
Slab surface/side meshes (split in buildSlabGeometry) and the empty-roof
merged-mesh fallback shipped geometry without a uv2 attribute while their
default catalog finishes (woodplank floor, roof shingles) carry an aoMap
that samples uv2. three r184's WebGPU renderer crashes mid scene pass on
the referenced-but-missing attribute, leaving the post-processing MRT
render target bound — every pipeline compiled afterwards validates
against the wrong 3-attachment framebuffer and fails ("Color target has
no corresponding fragment stage output" → Invalid RenderPipeline →
Invalid CommandBuffer on every submit), and post FX permanently falls
back after retries.
- slab/geometry.ts: emit uv2 (copy of uv) on the split top/side
geometries, matching the ensureUv2Attribute convention.
- roof-system.tsx: the children-less merged-roof fallback used
BoxGeometry(0,0,0), which has uv but no uv2; use
ensureRenderableGeometryAttributes(new BufferGeometry()) instead.
- post-processing.tsx: reset the render target when a render pass throws
so a future bad mesh costs one frame, not the whole session.
Reproduced with apps/ifc-converter loading 07-revit-architectural.ifc
(35 slabs + 2 segment-less roofs); clean console after the fix.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes the WebGPU error cascade (
Color target has no corresponding fragment stage output→Invalid RenderPipeline→Invalid CommandBufferon every queue submit) that fires when a scene contains slabs or segment-less roofs whose default catalog finish carries an aoMap — most visibly when loading IFC files inapps/ifc-converter.Root cause: two geometry producers ship meshes without a
uv2attribute while their slot material samplesuv2(aoMap):buildSlabGeometry's top/side face split rebuilt geometries with onlyposition+uv; the default surface finishlibrary:wood-woodplank48has an AO map.BoxGeometry(0, 0, 0), which hasuvbut nouv2; roofs imported from IFC have no segments, so they all hit this branch.three r184's WebGPU renderer throws mid scene pass on the referenced-but-missing attribute (
Cannot read properties of undefined (reading 'id')inRenderObject.getAttributes), which leaves the post-processing MRT render target bound on the renderer — every pipeline compiled afterwards validates against the wrong 3-attachment framebuffer, and post FX permanently falls back once the retry budget is exhausted.Changes:
packages/nodes/src/slab/geometry.ts— emituv2(copy ofuv) on the split top/side geometries, matching the existingensureUv2Attributeconvention.packages/viewer/src/systems/roof/roof-system.tsx— replace theBoxGeometry(0,0,0)fallback withensureRenderableGeometryAttributes(new BufferGeometry()), which carries all four attributes and keeps a valid position for Drei's BVH.packages/viewer/src/components/viewer/post-processing.tsx— defense-in-depth: reset the render target when a render pass throws, so any future mid-pass exception costs one frame instead of poisoning every pipeline for the session.How to test
bun install && bun dev, then open the IFC converter app (port 3003) and load the "Revit Architectural" example (?file=07-revit-architectural.ifc) — any example with slabs reproduces.THREE.AttributeNode: Vertex attribute "uv2" not found,[viewer/post-processing] Render pass failed., and repeatingWebGPU uncaptured error: Invalid RenderPipeline / Invalid CommandBufferentries; post FX (SSGI/ink) drops out after 3 retries.Screenshots / screen recording
N/A — the change is "errors gone": before, the converter console streams GPUValidationError spam and the viewer loses SSGI/ink; after, the same model loads with a clean console and full post FX.
Checklist
bun devbun checkto verify)mainbranch🤖 Generated with Claude Code
Note
Medium Risk
Touches WebGPU rendering and geometry attributes on common paths (IFC slabs/roofs); changes are narrow and align with existing ensureRenderableGeometryAttributes patterns, with low regression risk outside WebGPU/post-FX.
Overview
Fixes a WebGPU error cascade when slab or segment-less roof meshes use default finishes whose aoMap samples
uv2, but the geometry only hadposition+uv.Slab split geometry now mirrors
uvintouv2on top/side buffers (same convention asensureRenderableGeometryAttributes). Empty merged roofs no longer useBoxGeometry(0,0,0); they useensureRenderableGeometryAttributes(new BufferGeometry())so BVH-safe position anduv2are present.Post-processing resets the render target to
nullwhen a render pass throws, so a mid-pass failure does not leave the MRT bound and poison subsequent pipeline compiles.Reviewed by Cursor Bugbot for commit 8d883ee. Bugbot is set up for automated code reviews on this repo. Configure here.