Skip to content
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

Set the image stride to zero when updating a single layer on metal. #3063

Merged
merged 6 commits into from Oct 5, 2022

Conversation

nical
Copy link
Contributor

@nical nical commented Oct 5, 2022

Probably just a tad late to make the cut to the next version, but perhaps it could squeeze in a dot release?

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections

Fixes #3062

Description

When updating a single layer of a texture on metal, set the stride to zero to avoid angering the validatio layer.

The test is more valuable when run with the validation layer enabled, but even without it, it's better than nothing.
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

You and your amazing tests 😍

Got into the latest :)

@cwfitzgerald cwfitzgerald enabled auto-merge (squash) October 5, 2022 20:52
@cwfitzgerald
Copy link
Member

Seems like this code is broken on windows too 😆

@cwfitzgerald cwfitzgerald merged commit 37de3a3 into gfx-rs:master Oct 5, 2022
@nical nical deleted the mtl-copy-tex branch October 6, 2022 12:17
@teoxoy
Copy link
Member

teoxoy commented Aug 2, 2023

Should we also do the same for copy_texture_to_buffer?

The number of bytes between each 2D image of a 3D texture. This value needs to be a multiple of the source texture’s pixel size, in bytes.

Set this value to 0 for 2D textures, which means sourceSize.depth is equal to 1.

The docs of destinationBytesPerImage (arg of copyFromTexture) are the same as sourceBytesPerImage (arg of copyFromBuffer).

The stackoverflow post in the issue #3062 (comment) was also referring to destinationBytesPerImage.

I assume this hasn't been an issue since the test copies back the full texture and not a subregion.

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.

[metal] destinationBytesPerImage should probably be 0 when copying to/from a 2d texture with
3 participants