Skip to content

Expose wgpu::TextureView-descriptor/texture/render_extent #7895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: trunk
Choose a base branch
from

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Jul 8, 2025

Description

Implements a bunch of methods on TextureView that the spec warrants
(and that would have been real useful just now for me 😄)

See:
https://www.w3.org/TR/webgpu/#texture-view-creation

A bit of an annoying consequence is that views now keep their textures alives all the way. But the underlying resources were already kept alive necessarily, so in practice this doesn't make much of a difference.

Testing
Adds checks to existing view tests. Not covering everything in excruciating detail, but covers some interesting aspects actually (automatic format changes).

Squash or Rebase?
Squash

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@Wumpf Wumpf requested a review from a team as a code owner July 8, 2025 08:19
@JMS55
Copy link
Collaborator

JMS55 commented Jul 8, 2025

Could we get this in for wgpu 26? This is a huge improvement!

@Wumpf
Copy link
Member Author

Wumpf commented Jul 9, 2025

So turns out I actually missunderstood the spec here: those are internal properties as signified by the brackets in the spec.

I agree this would still be useful to have, but I think all the complexity for the altered descriptor isn't really warranted then. I think now we should instead do it more like on Texture and expose fields from the descriptor; I'm not entirely sure about all the property resolving since it's quite a bit of code 🤔 -
texture is super useful, but also affects how long textures live, so bit of a tradeoff. But I'm in favor of having it.
render_extent is still nice to have, should leave it in.

@JMS55 which were the parts you were particularly interested in?

@JMS55
Copy link
Collaborator

JMS55 commented Jul 9, 2025

Just texture, so that I can pass texture views around and get rid of https://github.com/bevyengine/dlss_wgpu/blob/9e751fd08a88b57463f03ba0237657a01af7e6c4/src/render_parameters.rs#L85-L89.

@cwfitzgerald cwfitzgerald marked this pull request as draft July 9, 2025 15:31
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