Skip to content

Add support for rendering to slices of 3D texture views and single layered 2D-Array texture views #7596

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

Merged
merged 12 commits into from
Apr 25, 2025

Conversation

teoxoy
Copy link
Member

@teoxoy teoxoy commented Apr 22, 2025

Connections
Resolves #7313
Resolves #6040
Resolves #4764

Description

  • allows 2D-Array texture views with a single layer to be used as render attachments
  • adds support for rendering to slices of 3D texture views

Note:

  • Vulkan implementation is not part of this PR, I will open a follow-up for that since it's more complicated due to the backend caching framebuffers.
  • We could clear 3D textures via render passes as well, I will look into it for a follow-up.

Testing
Added tests.

Squash or Rebase?
Rebase

@teoxoy teoxoy requested review from crowlKats and a team as code owners April 22, 2025 19:32
@teoxoy teoxoy force-pushed the 2darray-and-3d-renderable-views branch 3 times, most recently from 83150ec to 9d359d2 Compare April 22, 2025 19:50
Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

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

Abandoning a full review for now because I just discovered something urgent to do, here's what I've got so far.

crowlKats

This comment was marked as resolved.

@teoxoy

This comment was marked as resolved.

@teoxoy teoxoy force-pushed the 2darray-and-3d-renderable-views branch from 6c55332 to 85cae1d Compare April 23, 2025 14:51
@teoxoy teoxoy requested a review from ErichDonGubler April 24, 2025 17:48
@teoxoy teoxoy force-pushed the 2darray-and-3d-renderable-views branch from 85cae1d to 7e2ad3b Compare April 24, 2025 17:50
Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

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

LGTM! I have a bunch of minor stuff I wrote, but overall: 💯

@teoxoy teoxoy force-pushed the 2darray-and-3d-renderable-views branch from 7e2ad3b to 68d665b Compare April 25, 2025 09:39
teoxoy added 7 commits April 25, 2025 11:39
Imageless framebuffers are not needed, we know which views will be attached to the render pass already. Even if we wanted to more aggressively cache imageless framebuffers that wouldn't be possible since they still require specifiying view usage, texture usage and view formats.

Removing usage of imageless framebuffers simplifies the code substantially.
This makes texture view destruction cheap since users of wgpu-hal are required to keep resources referenced by encoders alive for at least as long as the encoder is alive.

This is also a prerequisite to implement rendering to slices of 3D textures (by creating temporary texture views).

On the other hand the cache won't be as effective but that is probably ok, we can reevaluate the implementation if it turns out to be a problem.
If fields are unused, they shouldn't be part of the cache key.
@teoxoy teoxoy force-pushed the 2darray-and-3d-renderable-views branch from 68d665b to c75940a Compare April 25, 2025 10:13
@teoxoy teoxoy merged commit 6a7aa14 into gfx-rs:trunk Apr 25, 2025
37 checks passed
@teoxoy teoxoy deleted the 2darray-and-3d-renderable-views branch April 25, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants