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

dx12: Support VertexIndex and InstanceIndex semantics #2589

Open
msiglreith opened this issue Jan 20, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@msiglreith
Copy link
Member

commented Jan 20, 2019

Nonzero base vertex or instance values are reflected properly when translating to HLSL.
Recently a new feature has been added to spirv-cross to support this: KhronosGroup/SPIRV-Cross#816

We need to a new root constant into graphics pipeline layouts for storing these two values and push them on draw calls. The drawIndirectFirstInstance can't be supported it seems.

VkPI

Further investigation needed if we need to restrict it also to base vertex due to the VertexIndex semantic?

@termhn

This comment has been minimized.

Copy link
Contributor

commented Jun 26, 2019

Steps for completion:

  1. Familiarize yourself with root descriptors and root constants (https://docs.microsoft.com/en-us/windows/desktop/direct3d12/root-signatures-overview)
  2. Add new root constants here https://github.com/gfx-rs/gfx/blob/master/src/backend/dx12/src/device.rs#L1276
  3. Add to the signature here for the draw command https://github.com/gfx-rs/gfx/blob/master/src/backend/dx12/src/device.rs#L482-L483

(@msiglreith can you check my logic on this? I'm not sure if I'm right or not, not super familiar with d3d12 ;p)

@msiglreith

This comment has been minimized.

Copy link
Member Author

commented Jun 26, 2019

@termhn Thanks!
Command Signature is unrelated to this (Step 3). It defines the layout of the gpu commands in the buffers for indirect command execution.
To extend on Step 2, see the comment here: #2604 (comment)

These two issues are basically the same, one for graphics pipelines and one for compute pipeline. We have 4 root constants spare IIRC, which will be shared for both pipeline types (basically like an union).
In this case we need to allocate 2 u32 bit constants for these two builtins and patch spirv accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.