-
Notifications
You must be signed in to change notification settings - Fork 12
Amendments to "017-shader-record" #33
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
base: main
Are you sure you want to change the base?
Amendments to "017-shader-record" #33
Conversation
…scussions regarding updated type wrapper syntax
| * For Vulkan, the compiler can remap annotations to the necessary `[[vk::push_constant]]` or | ||
| `[[vk::shader_record]]` attributes under the hood. | ||
| 2. **IR and Reflection Impact** | ||
| * For D3D, the compiler would still produce a `ConstantBuffer<T>` or resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section needs to be updated. I'm not sure of what changes need to be made to slang's reflection. What's here now was originally just placeholder text, from before the proposal was moved over to the spec repo.
| (push constants, root constants, or a small constant buffer) regardless of stage/backend. | ||
| * Parameters typed as `ShaderRecord<T>` map to per-shader-record data (Vulkan/OptiX SBT; | ||
| D3D local root signature). | ||
| * Parameters typed as `Payload<T>` map to payload registers. `in`, `out`, and `inout` apply, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding of these wrapper types is that they should be treated as if they are pointer types. So Payload<T> is effectively a T*. It is not meaningful to have inout T* or out T* because that just means the pointer itself is mutable. Instead, we probably want to have RWPayload<T>, WPayload<T> to represent payload pointers with read/write or write-only access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also just make it invalid to use in inout or out on ray tracing entrypoint parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I was running into this today with the refactor. I can make it invalid too use in/out/inout on RT entrypoint parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure I’m aligned on the RWPayload though. With PAQs, users annotate individual fields within the structure passed as T as being read, write, or read write. It generally never makes sense to make the entire payload read-only.
My thought was to instead look at the T being passed into the payload type and assume that that’s where PAQs information comes from.
Then otherwise drop in/out semantics entirely
| * If either `[[vk::shader_record]]` or `[[vk::push_constant]]` or `[[shader_record]]` or `[[push_constant]]` | ||
| appear on entrypoint parameters, these will become "syntax sugar" which is transformed by slang into | ||
| the appropriate wrapper type. `[[hit_attribute]]` might be considered for addition to allow for consistency. | ||
| * Legacy usage of bare (non-`uniform`) parameters in ray tracing entry points should result in a warning, telling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an error after slang 2026.
Main change is to have the proposal language use
Type<T>rather than[[attribute]](the later could either be syntax sugar, or could result in a diagnostic)Trimmed down some of the text regarding rates to help keep discussion focused.