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

Push Constants #63

Merged
merged 12 commits into from
Aug 1, 2021
Merged

Push Constants #63

merged 12 commits into from
Aug 1, 2021

Conversation

crud89
Copy link
Owner

@crud89 crud89 commented Jul 31, 2021

Describe the pull request
This PR introduces support for push constants (or root constants in DX 12). The concept of push constants originates from the Vulkan spec and describes a small chunk of memory that can be directly written to the command buffer and read by shaders on a per-draw-call base. There are certain restrictions, though:

  • Push constant memory may not exceed 128 bytes (more can be supported, but is not guaranteed)
  • Only one push constant range can be bound to a shader stage. However, multiple shader stages can access the same range.
  • Multiple ranges may overlap in different shader stages.

In DirectX, push constants are most closely resembled by root constants, which are directly written into the command buffer as 4 byte chunks of raw memory. Overlapping is not supported in this case, thus the implementation will duplicate overlapping memory blocks.

DXC has a the attribute [[vk::push_constant]], which (in combination with [[vk::offset]]) can be used to directly read push constants in Vulkan. For DirectX, root constants are bound to a register/space, as typical constant buffers.

Related issues

@crud89 crud89 added Priority: Medium A issue with normal priority. Type: Requirement An implementation is required before the next release. Status: In Progress Module: Vulkan 🌋 The issue involves the Vulkan backend. Module: DX12 ❎ The issue involves the DX12 backend. labels Jul 31, 2021
@crud89 crud89 added this to the Alpha #02 milestone Jul 31, 2021
@crud89 crud89 self-assigned this Jul 31, 2021
@crud89 crud89 marked this pull request as ready for review August 1, 2021 10:18
@crud89 crud89 merged commit db9cfb1 into main Aug 1, 2021
@crud89 crud89 deleted the push-constants branch August 1, 2021 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: DX12 ❎ The issue involves the DX12 backend. Module: Vulkan 🌋 The issue involves the Vulkan backend. Priority: Medium A issue with normal priority. Type: Requirement An implementation is required before the next release.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add support for push constants.
1 participant