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

[metal] Fix metal erroring on an array_stride of 0 #3538

Merged
merged 3 commits into from
Apr 5, 2023

Conversation

teoxoy
Copy link
Member

@teoxoy teoxoy commented Feb 28, 2023

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

Description
Setting array_stride to 0 resulted in the following error:

Vertex Descriptor Validation
Attribute at index X references a buffer at index Y that has no stride.

Fixed it by calculating the stride and using metal's Constant step function + a rate of 0.

see https://developer.apple.com/documentation/metal/mtlvertexbufferlayoutdescriptor/1515341-stepfunction?language=objc

Testing
Should be covered by CTS; tested locally by setting array_stride to 0 in one of the tests.

@teoxoy teoxoy added this to the WebGPU Specification V1 milestone Feb 28, 2023
wgpu-hal/src/auxil/mod.rs Outdated Show resolved Hide resolved
wgpu-hal/src/metal/device.rs Show resolved Hide resolved
@teoxoy teoxoy force-pushed the fix-metal-stride-0 branch 2 times, most recently from 8dfb6e0 to 145a85a Compare March 2, 2023 21:58
wgpu/src/util/mod.rs Show resolved Hide resolved
wgpu-types/src/math.rs Outdated Show resolved Hide resolved
wgpu/examples/shadow/main.rs Outdated Show resolved Hide resolved
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.

LGTM minus the one thing

@cwfitzgerald cwfitzgerald enabled auto-merge (squash) April 5, 2023 22:28
@cwfitzgerald cwfitzgerald merged commit 6918cf3 into gfx-rs:trunk Apr 5, 2023
@teoxoy teoxoy deleted the fix-metal-stride-0 branch April 6, 2023 08:56
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