summaryrefslogtreecommitdiffstats
path: root/source/slang/hlsl.meta.slang.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/hlsl.meta.slang.cpp')
-rw-r--r--source/slang/hlsl.meta.slang.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/source/slang/hlsl.meta.slang.cpp b/source/slang/hlsl.meta.slang.cpp
index e9e2277e6..a3744f620 100644
--- a/source/slang/hlsl.meta.slang.cpp
+++ b/source/slang/hlsl.meta.slang.cpp
@@ -38,7 +38,8 @@ sb << "\n";
sb << " __intrinsic_op T Load(int location);\n";
sb << " __intrinsic_op T Load(int location, out uint status);\n";
sb << "\n";
-sb << " __intrinsic_op __subscript(uint index) -> T;\n";
+sb << " __intrinsic_op(bufferLoad)\n";
+sb << " __subscript(uint index) -> T;\n";
sb << "};\n";
sb << "\n";
sb << "__generic<T> __magic_type(HLSLConsumeStructuredBufferType) struct ConsumeStructuredBuffer\n";
@@ -173,7 +174,14 @@ sb << " uint address,\n";
sb << " uint4 value);\n";
sb << "};\n";
sb << "\n";
-sb << "__generic<T> __magic_type(HLSLRWStructuredBufferType) struct RWStructuredBuffer\n";
+sb << "__generic<T>\n";
+sb << "__magic_type(HLSLRWStructuredBufferType)\n";
+sb << "__intrinsic_type(";
+
+ // TODO: we really need a simple way to write an "expression splice"
+ sb << kIROp_readWriteStructuredBufferType;
+sb << ")\n";
+sb << "struct RWStructuredBuffer\n";
sb << "{\n";
sb << " __intrinsic_op uint DecrementCounter();\n";
sb << "\n";
@@ -186,7 +194,15 @@ sb << "\n";
sb << " __intrinsic_op T Load(int location);\n";
sb << " __intrinsic_op T Load(int location, out uint status);\n";
sb << "\n";
-sb << " __intrinsic_op __subscript(uint index) -> T { get; set; }\n";
+sb << "\t__intrinsic_op\n";
+sb << "\t__subscript(uint index) -> T\n";
+sb << "\t{\n";
+sb << "\t\t__intrinsic_op(bufferLoad)\n";
+sb << "\t\tget;\n";
+sb << "\n";
+sb << "\t\t__intrinsic_op(bufferStore)\n";
+sb << "\t\tset;\n";
+sb << "\t}\n";
sb << "};\n";
sb << "\n";
sb << "__generic<T> __magic_type(HLSLPointStreamType) struct PointStream\n";