Claude/fix gpu index buffer k fucj#1161
Merged
Merged
Conversation
…er sharing The previous fix using geometry.clone() + needsUpdate still allowed internal buffer references to be shared between source and cloned geometry. When the source geometry was disposed, the shared GPU buffer references became invalid. This fix creates completely fresh TypedArrays using array.slice(0) for all attributes and index buffers, ensuring zero shared state with the source geometry. This prevents "setIndexBuffer" crashes even when source geometry is disposed while clones are still being rendered. Changes: - UnitRenderer: Deep copy all attributes and index - ResourceRenderer: Deep copy all attributes and index - BuildingRenderer: Deep copy all attributes and index - InstancedDecorations: Deep copy all attributes and index - GPUIndirectRenderer: Deep copy all attributes and index Also copies morph attributes, bounding volumes, and groups for completeness. https://claude.ai/code/session_01RVGDnXRzL5S5tELbcBqYrN
…cedDecorations - AssetManager.cloneModel() now creates completely independent geometry for all cloned meshes using deepCloneGeometry() which copies all TypedArrays with slice(0) to prevent WebGPU buffer sharing - Added deepCloneModelHierarchy() for static models and enhanced animated model cloning to also deep clone geometry after SkeletonUtils.clone() - Added geometry quarantine system to all 5 InstancedDecorations classes (Trees, Rocks, Crystals, Grass, Pebbles) that delays disposal by 4 frames to ensure GPU commands have completed before buffer destruction - This prevents "Failed to execute 'setIndexBuffer' on 'GPURenderPassEncoder'" crashes that occurred when source geometry was disposed while still in use https://claude.ai/code/session_01RVGDnXRzL5S5tELbcBqYrN
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.
No description provided.