yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Jay KwakConstant-fold for the type-casting in switch-case labels (#5436)1487a1f98

master
867 B36 linesraw
1// attribute.slang
2
3// Tests reflection of user defined attributes.
4
5//TEST:SIMPLE(filecheck=REFLECTION):-stage compute -entry main -target hlsl
6
7[__AttributeUsage(_AttributeTargets.Struct)]
8struct MyStructAttribute
9{
10    int iParam;
11    float fParam;
12};
13[__AttributeUsage(_AttributeTargets.Var)]
14struct DefaultValueAttribute
15{
16    int iParam;
17};
18
19//REFLECTION:([[# @LINE+1]]): error 30019: expected an expression of type 'float', got 'String'
20[MyStruct(0, "stringVal")] // attribute arg type mismatch
21struct A
22{
23    //REFLECTION:([[# @LINE+1]]): error 31002: attribute 'MyStruct' is not valid here
24    [MyStruct(0, 10.0)] // attribute does not apply to this construct
25    float x;
26    [DefaultValue(2.0)] // attribute arg type mismatch
27    float y;
28};
29
30ParameterBlock<A> param;
31
32[numthreads(1, 1, 1)]
33void main(
34    uint3 dispatchThreadID : SV_DispatchThreadID)
35{
36}