Skip to content

fix(render): clone geometry in all renderers to prevent WebGPU crash#1055

Merged
braedonsaunders merged 1 commit into
mainfrom
claude/fix-gpu-render-crash-mfoR7
Jan 26, 2026
Merged

fix(render): clone geometry in all renderers to prevent WebGPU crash#1055
braedonsaunders merged 1 commit into
mainfrom
claude/fix-gpu-render-crash-mfoR7

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

The previous fix only addressed GPUIndirectRenderer, but BuildingRenderer, UnitRenderer, and ResourceRenderer also shared geometry from the asset cache without cloning. When instanced groups were cleaned up during LOD changes or inactive mesh cleanup cycles, the shared GPU buffers were disposed while still referenced by other meshes.

Changes:

  • UnitRenderer: Clone geometry when creating instanced groups, dispose geometry during cleanup (lines 719, 1183, 1251, 1333)
  • BuildingRenderer: Clone geometry when creating instanced groups, dispose geometry during cleanup (lines 283, 243, 2416)
  • ResourceRenderer: Clone geometry when creating instanced groups (line 197)

The ~7 minute crash timing corresponds to the INACTIVE_MESH_CLEANUP_FRAMES threshold combined with entity spawning/despawning patterns in a 6-player AI game causing enough cleanup cycles to hit the race condition.

The previous fix only addressed GPUIndirectRenderer, but BuildingRenderer,
UnitRenderer, and ResourceRenderer also shared geometry from the asset
cache without cloning. When instanced groups were cleaned up during
LOD changes or inactive mesh cleanup cycles, the shared GPU buffers
were disposed while still referenced by other meshes.

Changes:
- UnitRenderer: Clone geometry when creating instanced groups, dispose
  geometry during cleanup (lines 719, 1183, 1251, 1333)
- BuildingRenderer: Clone geometry when creating instanced groups, dispose
  geometry during cleanup (lines 283, 243, 2416)
- ResourceRenderer: Clone geometry when creating instanced groups (line 197)

The ~7 minute crash timing corresponds to the INACTIVE_MESH_CLEANUP_FRAMES
threshold combined with entity spawning/despawning patterns in a 6-player
AI game causing enough cleanup cycles to hit the race condition.
@braedonsaunders braedonsaunders merged commit 7b0801d into main Jan 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants