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 startVertex/startInstance on DX12 #1725

Closed
kvark opened this issue Jul 26, 2021 · 0 comments · Fixed by #1731
Closed

Support startVertex/startInstance on DX12 #1725

kvark opened this issue Jul 26, 2021 · 0 comments · Fixed by #1731
Assignees
Labels
area: api Issues related to API surface area: performance How fast things go type: enhancement New feature or request

Comments

@kvark
Copy link
Member

kvark commented Jul 26, 2021

Is your feature request related to a problem? Please describe.
DX12 doesn't consider firstVertex/fistInstance to be included into SV_VertexID and SV_InstanceID semantic, but WebGPU requires this.

Describe the solution you'd like
Allocate 2 root constants in front of the signature, then have the shader glue these constants with builtin semantics when asked.
This extra functionality needs to be configurable, since there is a cost to having 2 root constants allocated for each pipeline.

Describe alternatives you've considered
Passing in buffers?

Additional context
We have a test for this, which is quite nice!

@kvark kvark added type: enhancement New feature or request area: api Issues related to API surface area: performance How fast things go labels Jul 26, 2021
@kvark kvark self-assigned this Jul 27, 2021
bors bot added a commit that referenced this issue Jul 27, 2021
1731: hal/dx12: support base vertex/instance r=cwfitzgerald a=kvark

**Connections**
Fixes #1725
Depends on gfx-rs/naga#1141, gfx-rs/d3d12-rs#34, and gfx-rs/d3d12-rs#35 (thanks `@msiglreith` for quick reviews!).

**Description**
We allocate one root parameter covering the special constant buffer view with root constants. We set the root constants for each draw, but only on change.

This PR does *not* handle the indirect case. I'll follow-up with this.

**Testing**
Not thoroughly tested, but `@cwfitzgerald` already implemented a test for this, and this PR enables it on DX12.
Also, examples still seem to work :)


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
@bors bors bot closed this as completed in 2940347 Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API surface area: performance How fast things go type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant