Skip to content

Allow copying from depth textures#901

Merged
kvark merged 3 commits intogfx-rs:masterfrom
malu:copy-from-depth-texture
Aug 28, 2020
Merged

Allow copying from depth textures#901
kvark merged 3 commits intogfx-rs:masterfrom
malu:copy-from-depth-texture

Conversation

@malu
Copy link
Copy Markdown
Contributor

@malu malu commented Aug 27, 2020

Connections
Fixes #900

Description
Copying from depth textures failed with unexpected depth format before. Fix the cause in conv::texture_block_size. Add checks around the place where it would have (rightfully) failed before.

Seeing as this adds another variant to TransferError, this is not backwards compatible. The compatible alternative would be panicing (which is what currently happens via unreachable!).
Also, I could understand if you think TextureFormat::is_depth_format isn't worth it to have as public api. We could pull it into wgpu-core in that case. It would need a doc comment in case we want to keep it there.

Should this instead be based on master instead of v0.6? Just let me know and I can rebase.

Copy link
Copy Markdown
Contributor

@monocodus monocodus bot left a comment

Choose a reason for hiding this comment

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

This is an autogenerated code review.

Checker summary (by rust_clippy):
The tool has found 0 warnings, 1 errors.

@kvark
Copy link
Copy Markdown
Member

kvark commented Aug 27, 2020

Should this instead be based on master instead of v0.6? Just let me know and I can rebase.

Since this PR is breaking, it should definitely be targeted at master.
We can produce a sibling non-breaking PR for 0.6

@malu malu force-pushed the copy-from-depth-texture branch from 8d0b264 to 7186e82 Compare August 27, 2020 19:52
@malu malu changed the base branch from v0.6 to master August 27, 2020 19:52
)?;

let (block_width, _) = conv::texture_block_size(dst_texture.format);
if dst_texture.format.is_depth_format() {
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.

can we call this is_depth() to avoid repeating ourselves?

Copy link
Copy Markdown
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Beautiful!

@kvark kvark merged commit 5d50b2a into gfx-rs:master Aug 28, 2020
malu added a commit to malu/wgpu that referenced this pull request Aug 28, 2020
@kvark kvark mentioned this pull request Aug 28, 2020
6 tasks
bors bot added a commit that referenced this pull request Aug 28, 2020
904: [0.6] Allow copying from Depth32Float formatted textures r=kvark a=malu

**Connections**
Backport of #901 

**Description**
Copying from textures with format `Depth32Float` was reaching an `unreachable` and hence was impossible while copying from such textures should be well-defined and safe.

Co-authored-by: Maximilian Lupke <maxlupke@gmail.com>
kvark pushed a commit that referenced this pull request Aug 28, 2020
teoxoy added a commit that referenced this pull request May 14, 2024
This was previously added in #2230 but I don't think it was necessary. #901 already implemented the buffer <-> texture validation for those formats. It's also not a requirement in the spec.
EriKWDev pushed a commit to bitwise-git/wgpu that referenced this pull request May 14, 2024
This was previously added in gfx-rs#2230 but I don't think it was necessary. gfx-rs#901 already implemented the buffer <-> texture validation for those formats. It's also not a requirement in the spec.
teoxoy added a commit that referenced this pull request May 15, 2024
This was previously added in #2230 but I don't think it was necessary. #901 already implemented the buffer <-> texture validation for those formats. It's also not a requirement in the spec.
jimblandy pushed a commit to jimblandy/wgpu that referenced this pull request May 23, 2024
This was previously added in gfx-rs#2230 but I don't think it was necessary. gfx-rs#901 already implemented the buffer <-> texture validation for those formats. It's also not a requirement in the spec.
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.

Copying from depth texture to buffer fails

2 participants