summaryrefslogtreecommitdiff
path: root/source/slang/hlsl.meta.slang
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-01-09 20:49:25 -0800
committerGitHub <noreply@github.com>2025-01-09 20:49:25 -0800
commit55ff4686e5685c414d82f16b9c1a4a331bd4f853 (patch)
tree3ac28ec249ad345417b04247ea2d17d03adbd9b1 /source/slang/hlsl.meta.slang
parentfce63c2c550b8715e347a44b1d874f48157543d3 (diff)
Support a storage class, NodePayloadAMDX, for SPIRV work-graphs (#6052)
In order to unblock experiments with SPIRV work-graphs, Slang needs to support the storage class, `NodePayloadAMDX`. Note that this commit is only to support a storage class, `NodePayloadAMDX`. There are many parts required for work-graphs hasn't been implemented yet. The implementation of `DispatchNodeInputRecord` is not required, but it is implemented mostly for a testing purpose. Closes #6049 Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/hlsl.meta.slang')
-rw-r--r--source/slang/hlsl.meta.slang28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index a27cafbd4..07bf2ffbd 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -21365,3 +21365,31 @@ int8_t4_packed pack_clamp_s8(int16_t4 unpackedValue)
}
}
+// Work-graphs
+
+//@public:
+/// read-only input to Broadcasting launch node.
+__generic<T>
+//TODO: DispatchNodeInputRecord should be available only for broadcasting node shader.
+//[require(broadcasting_node)]
+[require(spirv)]
+struct DispatchNodeInputRecord
+{
+ /// Provide an access to a record object that only holds a single record.
+ NodePayloadPtr<T> Get()
+ {
+ int index = 0;
+ __target_switch
+ {
+ case spirv:
+ return spirv_asm
+ {
+ %in_payload_t = OpTypeNodePayloadArrayAMDX $$T;
+ %in_payload_ptr_t = OpTypePointer NodePayloadAMDX %in_payload_t;
+ %var = OpVariable %in_payload_ptr_t NodePayloadAMDX;
+ result : $$NodePayloadPtr<T> = OpAccessChain %var $index;
+ };
+ }
+ }
+};
+