summaryrefslogtreecommitdiffstats
path: root/tests/reflection/attribute.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/reflection/attribute.slang')
-rw-r--r--tests/reflection/attribute.slang42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/reflection/attribute.slang b/tests/reflection/attribute.slang
new file mode 100644
index 000000000..a3cda4f4b
--- /dev/null
+++ b/tests/reflection/attribute.slang
@@ -0,0 +1,42 @@
+// attribute.slang
+
+// Tests reflection of user defined attributes.
+
+//TEST:REFLECTION:-stage compute -entry main -target hlsl
+
+[AttributeUsage(AttributeTargets.Struct)]
+struct MyStructAttribute
+{
+ int iParam;
+ float fParam;
+};
+[AttributeUsage(AttributeTargets.Var)]
+struct DefaultValueAttribute
+{
+ int iParam;
+};
+
+[MyStruct(0, 1.0)]
+struct A
+{
+ float x;
+ [DefaultValue(1)]
+ float y;
+};
+
+[MyStruct(0, 2.0)]
+struct B
+{
+ float x;
+ [DefaultValue(1+1)]
+ float z;
+};
+
+ParameterBlock<A> param;
+ParameterBlock<B> param2;
+
+[numthreads(1, 1, 1)]
+void main(
+ uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+} \ No newline at end of file