Repository navigation
[SPIR-V] Implement vk::ext_builtin_input and vk::ext_builtin_output - #6027
Cassandra Beckley (cassiebeckley) merged 15 commits into
Conversation
That could be better. Let me know if you think the implementation would be to complicated. We can go back and change HLSL specs. This might also make is easier to pass as a parameter to a function. If it is a function, we cannot do that. |
Steven Perron (s-perron)
left a comment
There was a problem hiding this comment.
Looks good. Just a little style comment.
|
Steven Perron (@s-perron) lmk what you think of this approach. |
I think this looks good. We should probably add more testing. For example, what happens if the builtin is passed as a parameter to a function? Making the variable static is not a problem. The input and output variables are not shared, and static tells you that. I wonder if we should enforce that. Add an error if we try to apply the attribute to a variable that is not static. We should update the spec to say that. |
Do you mean something like |
…o inline-spirv-builtin
|
Hello! Found another cases where the diagnostic should be improved [[vk::ext_builtin_output(/* FragStencilRefEXT */ 5014)]]
static int output;
[[vk::ext_builtin_input(/* FragStencilRefEXT */ 5014)]]
static int input;
[[vk::ext_extension("SPV_EXT_shader_stencil_export")]]
void main() {
int tmp = input;
output = 10;
}If input is not read, it works. The error seems wrong as it puts the blame on output, which is marked as output. We may want to error out before, if 2 variables share the same builtin but with different I/O. |
Nathan Gauër (Keenuts)
left a comment
There was a problem hiding this comment.
Fine with this.
It's easy to make the validation fails, but I'd assume that's like inline assembly, you are on your own to make sure you use this correctly.
Steven Perron (s-perron)
left a comment
There was a problem hiding this comment.
Just a couple more test to add.
Sure, I've added an error for that. |
Steven Perron (s-perron)
left a comment
There was a problem hiding this comment.
Okay, we let this sit until we update HLSL specs, and hear back from the community on some of the finer details.
|
I've added a |
I definitely think it would look better if we allowed these attributes on variables, ie microsoft/hlsl-specs#76. I haven't fully investigated how involved it would be to implement, but my intuition is that it wouldn't take that much more work.
Fixes #4217.