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

Add support for Specialization constants for shader options #88

Merged
merged 5 commits into from
Jun 28, 2024

Conversation

akioCL
Copy link
Contributor

@akioCL akioCL commented Jun 7, 2024

Add new command line argument ("--sc-options") was added to support shader options as specialization constants. Implementation was added for Vulkan, Metal and DX12. For Vulkan (and Metal) it translates shader options directly as specialization constants using a DXC attribute [[vk::constant_id]]. For DX12 it uses a volatile constant that will later be patched using another tool.

The [[no_specialization]] attribute was added to disable using specialization constants for a specific shader option.

Based on RFC o3de/sig-graphics-audio#163

Other relevant PRs:
o3de/DirectXShaderCompiler#4
o3de/o3de#18019

@akioCL akioCL force-pushed the specialization_constants branch from 5468252 to 433482f Compare June 7, 2024 01:41
@akioCL akioCL marked this pull request as ready for review June 7, 2024 01:48
Copy link

@moudgils moudgils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you not need to edit the grammar to allow specialization constant tags?

Signed-off-by: Akio Gaule <[email protected]>
@akioCL
Copy link
Contributor Author

akioCL commented Jun 27, 2024

Do you not need to edit the grammar to allow specialization constant tags?

No need for new attributes.

@akioCL akioCL merged commit 58c32ff into development Jun 28, 2024
2 checks passed
@akioCL akioCL deleted the specialization_constants branch June 28, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants