summaryrefslogtreecommitdiff
path: root/tests/diagnostics/attribute-error.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2019-01-29 15:18:15 -0800
committerGitHub <noreply@github.com>2019-01-29 15:18:15 -0800
commit685a811e3d4405c4619e974e3610902d621efee7 (patch)
tree40bcf976326a303373d53dae0ff11ef6a5518b3e /tests/diagnostics/attribute-error.slang
parentf8b8ea0055ad877551198e1e295d33860b504672 (diff)
parentc1761283e7bb6b5cfcedf910e76fd4f939395b1d (diff)
Merge pull request #812 from csyonghe/attribute
Add support for user defined attributes
Diffstat (limited to 'tests/diagnostics/attribute-error.slang')
-rw-r--r--tests/diagnostics/attribute-error.slang34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/diagnostics/attribute-error.slang b/tests/diagnostics/attribute-error.slang
new file mode 100644
index 000000000..b913d3d4a
--- /dev/null
+++ b/tests/diagnostics/attribute-error.slang
@@ -0,0 +1,34 @@
+// 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, "stringVal")] // attribute arg type mismatch
+struct A
+{
+ [MyStruct(0, 10.0)] // attribute does not apply to this construct
+ float x;
+ [DefaultValue(2.0)] // attribute arg type mismatch
+ float y;
+};
+
+ParameterBlock<A> param;
+
+[numthreads(1, 1, 1)]
+void main(
+ uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+} \ No newline at end of file