summaryrefslogtreecommitdiffstats
path: root/tests/hlsl/simple/rw-texture.hlsl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hlsl/simple/rw-texture.hlsl')
-rw-r--r--tests/hlsl/simple/rw-texture.hlsl28
1 files changed, 19 insertions, 9 deletions
diff --git a/tests/hlsl/simple/rw-texture.hlsl b/tests/hlsl/simple/rw-texture.hlsl
index 26916b474..de8e82777 100644
--- a/tests/hlsl/simple/rw-texture.hlsl
+++ b/tests/hlsl/simple/rw-texture.hlsl
@@ -5,7 +5,16 @@
// Ensure that we implement the `Load` operations on
// `RWTexture*` types with the correct signature.
-#ifndef __SLANG__
+#ifdef __SLANG__
+#define R(X) /**/
+#define BEGIN_CBUFFER(NAME) cbuffer NAME
+#define END_CBUFFER(NAME, REG) /**/
+#define CBUFFER_REF(NAME, FIELD) FIELD
+#else
+#define R(X) : register(X)
+#define BEGIN_CBUFFER(NAME) struct SLANG_ParameterGroup_##NAME
+#define END_CBUFFER(NAME, REG) ; cbuffer NAME : REG { SLANG_ParameterGroup_##NAME NAME; }
+#define CBUFFER_REF(NAME, FIELD) NAME.FIELD
#define C C_0
#define SV_Target SV_TARGET
#define u2 u2_0
@@ -16,19 +25,20 @@
#endif
-cbuffer C : register(b0)
+BEGIN_CBUFFER(C)
{
uint2 u2;
uint3 u3;
-};
+}
+END_CBUFFER(C, register(b0))
-RWTexture2D<float4> t2 : register(u1);
-RWTexture2DArray<float4> t2a : register(u2);
-RWTexture3D<float4> t3 : register(u3);
+RWTexture2D<float4> t2 R(u1);
+RWTexture2DArray<float4> t2a R(u2);
+RWTexture3D<float4> t3 R(u3);
float4 main() : SV_Target
{
- return t2.Load(u2)
- + t2a.Load(u3)
- + t3.Load(u3);
+ return t2.Load(CBUFFER_REF(C,u2))
+ + t2a.Load(CBUFFER_REF(C,u3))
+ + t3.Load(CBUFFER_REF(C,u3));
}