Skip to content

Record 1 barrier for N Queue::write_buffer/texture calls by deferring to submit time - #10319

Open
JMS55 wants to merge 4 commits into
gfx-rs:trunkfrom
JMS55:coalesce-pending-write-barriers
Open

JMS55 wants to merge 4 commits into
gfx-rs:trunkfrom
JMS55:coalesce-pending-write-barriers

Conversation

@JMS55

@JMS55 JMS55 commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Connections
Fixes #6673

Description
Instead of recording a barrier for the staging buffer immediately when Queue::write_buffer/texture is called, defer it to submit time, so that only a single barrier is needed for N writes.

This only works for the first time you write to a resource (I think per submit?), with subsequent writes reverting back to immediate barriers (23a82b5).

Subresource ranges are also not tracked, barriers are still per-resource.

Testing
TODO

Squash or Rebase?
Squash

Checklist

  • I self-reviewed and fully understand this PR.
  • CHANGELOG.md entries for the user-facing effects of this change are present.
  • The PR is minimal, and doesn't make sense to land as multiple PRs.
  • Commits are logically scoped and individually reviewable.
  • The PR description has enough context to understand the motivation and solution implemented.
  • (If applicable) WebGPU implementations built with wgpu may be affected behaviorally.
  • (If applicable) Validation and feature gates are in place to confine behavioral changes.
  • (If applicable) Tests demonstrate the validation and altered logic works.

@cwfitzgerald

Copy link
Copy Markdown
Member

Oh nice, I've had implementing something like this in the back of my mind for ages now

@cwfitzgerald cwfitzgerald self-assigned this Sep 14, 2026
cwfitzgerald
cwfitzgerald previously approved these changes Sep 14, 2026

@cwfitzgerald cwfitzgerald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry I'm just testing something I haven't actually looked at this yet

@mergify

mergify Bot commented Sep 14, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

cwfitzgerald
cwfitzgerald previously approved these changes Sep 14, 2026

@cwfitzgerald cwfitzgerald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Testing again

@cwfitzgerald cwfitzgerald moved this from To triage to Small in Triage Sep 16, 2026
@inner-daemons
inner-daemons self-requested a review September 16, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Small

Development

Successfully merging this pull request may close these issues.

Queue::write_buffer() generates a large amount of barriers

2 participants