Skip to content

Exclude StorageBuffer from device.buffers tracking#8690

Merged
slimbuck merged 2 commits intoplaycanvas:mainfrom
slimbuck:context-fix
May 6, 2026
Merged

Exclude StorageBuffer from device.buffers tracking#8690
slimbuck merged 2 commits intoplaycanvas:mainfrom
slimbuck:context-fix

Conversation

@slimbuck
Copy link
Copy Markdown
Member

@slimbuck slimbuck commented May 6, 2026

Summary

StorageBuffer registers itself in GraphicsDevice.buffers but does not implement either loseContext() or unlock(), which causes a WebGPU device-lost flow to throw on iteration:

// graphics-device.js: loseContext()
for (const buffer of this.buffers) {
    buffer.loseContext();   // TypeError on StorageBuffer
}
// graphics-device.js: restoreContext()
for (const buffer of this.buffers) {
    buffer.unlock();        // TypeError on StorageBuffer
}

@slimbuck slimbuck requested review from a team and Copilot May 6, 2026 12:35
@slimbuck slimbuck self-assigned this May 6, 2026
@slimbuck slimbuck added the area: graphics Graphics related issue label May 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a WebGPU device-lost crash caused by StorageBuffer being tracked in GraphicsDevice.buffers without implementing the loseContext() method that GraphicsDevice.loseContext() expects to call for all tracked buffers.

Changes:

  • Add StorageBuffer.loseContext() to forward device-lost handling to the underlying implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/platform/graphics/storage-buffer.js Outdated
@slimbuck slimbuck requested a review from Copilot May 6, 2026 13:26
@slimbuck slimbuck changed the title Implement loseContext() on StorageBuffer Exclude StorageBuffer from device.buffers tracking May 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/platform/graphics/storage-buffer.js
@slimbuck slimbuck merged commit 1aa6ede into playcanvas:main May 6, 2026
10 of 12 checks passed
@slimbuck slimbuck deleted the context-fix branch May 6, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants