Skip to content

Push Constants#63

Merged
crud89 merged 12 commits intomainfrom
push-constants
Aug 1, 2021
Merged

Push Constants#63
crud89 merged 12 commits intomainfrom
push-constants

Conversation

@crud89
Copy link
Copy Markdown
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 Vulkan 🌋 The issue involves the Vulkan backend. 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

DX12 ❎ The issue involves the DX12 backend. Priority: Medium A issue with normal priority. Vulkan 🌋 The issue involves the Vulkan backend.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add support for push constants.

1 participant