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

Support vertex attribute offsets higher than the strides in Metal #2054

Closed
kvark opened this issue May 19, 2018 · 1 comment
Closed

Support vertex attribute offsets higher than the strides in Metal #2054

kvark opened this issue May 19, 2018 · 1 comment
Assignees
Labels

Comments

@kvark
Copy link
Member

kvark commented May 19, 2018

There is a lot of test in CTS (e.g. "dEQP-VK.texture.filter.**") that try to use an attribute offset higher than the stride. For example, an offset of 64 on a buffer with stride 8. It is technically valid in Vulkan, but Metal doesn't like it.

One possible solution would be to detect this at pipeline creation before linking the shader, then assign additional buffer inputs to be used in the shader by those attributes... adjusting the binding model accordingly.

@kvark
Copy link
Member Author

kvark commented May 29, 2018

Having this implemented, I faced two strange/interesting sub-issues:

  1. The original vertex buffer binding may no longer be needed if we remap it and nothing needs a base offset of 0. Metal doesn't like unused vertex bindings, so I had to implement the remapping aggressively to work on the full range of bindings as opposed to just handling the exceptional ones.
  2. Still getting a Metal validation error like "Attribute at index 1: offset(4) + 12 must be <= buffers[2].stride(12).". What's not clear to me is where does the first "12" come from...

@kvark kvark added this to the Vulkan Portability MVP milestone May 29, 2018
bors bot added a commit that referenced this issue May 29, 2018
2078: [mtl] vertex buffer remapping r=grovesNL a=kvark

Fixes #2054
PR checklist:
- [x] `make` succeeds (on *nix)
- [x] `make reftests` succeeds
- [x] tested examples with the following backends: metal


Co-authored-by: Dzmitry Malyshau <[email protected]>
bors bot added a commit that referenced this issue May 29, 2018
2078: [mtl] vertex buffer remapping r=grovesNL a=kvark

Fixes #2054
PR checklist:
- [x] `make` succeeds (on *nix)
- [x] `make reftests` succeeds
- [x] tested examples with the following backends: metal


Co-authored-by: Dzmitry Malyshau <[email protected]>
@bors bors bot closed this as completed in #2078 May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant