Skip to content

[wgpu] add convience functions for deferring mapping/callbacks#8125

Merged
Wumpf merged 1 commit intogfx-rs:trunkfrom
cwfitzgerald:cw/deferred-mapping
Sep 7, 2025
Merged

[wgpu] add convience functions for deferring mapping/callbacks#8125
Wumpf merged 1 commit intogfx-rs:trunkfrom
cwfitzgerald:cw/deferred-mapping

Conversation

@cwfitzgerald
Copy link
Member

@cwfitzgerald cwfitzgerald commented Aug 21, 2025

Connections

None

Description

This adds various functions for making dealing with mapping and other callbacks easier. Often you are working with a command buffer then want to map a buffer or do something when that command buffer is submitted. Normally you need to build some kind of infrastructure for this (I have many times) but this can be really easily be done by wgpu itself for very little cost.

image

Testing

Told GPT-5 to put together some tests as an experiment. I think it did okay.

Squash or Rebase?

Rebase me pls

Checklist

  • Baseline implementation
  • Improved code documentation
  • Validation tests
  • Better verbiage
  • Changelog

@cwfitzgerald cwfitzgerald force-pushed the cw/deferred-mapping branch 3 times, most recently from e910b48 to e42ba38 Compare August 22, 2025 03:03
@cwfitzgerald cwfitzgerald marked this pull request as ready for review August 22, 2025 03:03
@cwfitzgerald cwfitzgerald requested a review from a team as a code owner August 22, 2025 03:03
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

neat!
I think it's rather unfortunate to have this kind of extension in wgpu proper rather than an extension to it. Makes me wonder whether those deferred commands could be more generic and then we expose the concrete buffer extension as a utility.... but I don't want to throw a wrench into a perfectly good feature that is really hard to get into the ecosystem if we don't put it in here. So overall slight scope creep concerns, but let's ship this anyways!

@Wumpf Wumpf force-pushed the cw/deferred-mapping branch from 04f181e to 9f3694a Compare September 7, 2025 07:29
@Wumpf Wumpf enabled auto-merge (squash) September 7, 2025 07:30
@Wumpf Wumpf disabled auto-merge September 7, 2025 07:30
Co-authored-by: Kevin Reid <kpreid@switchb.org>
@Wumpf Wumpf force-pushed the cw/deferred-mapping branch from 9f3694a to 018772d Compare September 7, 2025 07:30
@Wumpf Wumpf enabled auto-merge (rebase) September 7, 2025 07:30
@Wumpf Wumpf merged commit fb28da1 into gfx-rs:trunk Sep 7, 2025
39 of 40 checks passed
@cwfitzgerald cwfitzgerald deleted the cw/deferred-mapping branch September 7, 2025 08:06
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.

3 participants