From b7f8f7abcc3cc1dfa820ebba47a772b78d6a4cfb Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 29 Jan 2019 11:41:54 -0800 Subject: Add support for user defined attributes. --- tests/diagnostics/attribute-error.slang | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/diagnostics/attribute-error.slang (limited to 'tests/diagnostics/attribute-error.slang') diff --git a/tests/diagnostics/attribute-error.slang b/tests/diagnostics/attribute-error.slang new file mode 100644 index 000000000..472593f3b --- /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 param; + +[numthreads(1, 1, 1)] +void main( + uint3 dispatchThreadID : SV_DispatchThreadID) +{ +} \ No newline at end of file -- cgit v1.2.3