summaryrefslogtreecommitdiffstats
path: root/tests/reflection/attribute.slang
blob: a3cda4f4b2f376041c3a5eee9990b4b404bea41d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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)
{
}