Skip to content

[0011] Use variable syntax instead of function syntax for SPIR-V builtin - #129

Merged
Steven Perron (s-perron) merged 2 commits into
microsoft:mainfrom
cassiebeckley:spirv-builtin-updates
Nov 29, 2023
Merged

Steven Perron (s-perron) merged 2 commits into
microsoft:mainfrom
cassiebeckley:spirv-builtin-updates

Conversation

@cassiebeckley

Copy link
Copy Markdown
Contributor

In order to better match the semantics of builtin variables, use static variables instead of functions in order to get and set builtins.

@cassiebeckley

Copy link
Copy Markdown
Contributor Author

Steven Perron (@s-perron) for your perusal

Comment thread proposals/0011-inline-spirv.md Outdated
```
[[vk::ext_builtin_input(/* NumWorkgroups */ 24)]]
uint3 gl_NumWorkGroups();
static uint3 gl_NumWorkGroups;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since we cannot write to the builtin input, do we want to make the variable const as well? Then we can get all of the checks that it cannot be written to for free.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, that seems like a good idea. Updated.

Cassandra Beckley (cassiebeckley) added a commit to microsoft/DirectXShaderCompiler that referenced this pull request Nov 23, 2023
#6052)

`ext_extension` and `ext_capability` can only be added to functions at
the moment. This PR enables adding them to variable declarations, so
that using the variable results in the extensions and capabilities being
added to the module. This is useful for the builtin variable syntax
proposed in microsoft/hlsl-specs#129.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@s-perron

Copy link
Copy Markdown
Collaborator

@s-perron
Steven Perron (s-perron) merged commit 537b4cf into microsoft:main Nov 29, 2023
@cassiebeckley
Cassandra Beckley (cassiebeckley) deleted the spirv-builtin-updates branch December 4, 2023 20:27
Chris B (llvm-beanz) pushed a commit to llvm-beanz/hlsl-specs that referenced this pull request Feb 9, 2025
…tin (microsoft#129)

* [0011] Use variable syntax instead of function syntax for SPIR-V builtin

* Require const for input
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