https://github.com/shader-slang/slang
Raw File
Tip revision: aa8f7b899b7b562b3d3c6e25c3da41569505e70c authored by Chad Engler on 29 September 2021, 20:02:47 UTC
Fix ARM64 detection for MSVC (#1951)
Tip revision: aa8f7b8
attribute-error.slang
// attribute.slang

// Tests reflection of user defined attributes.

//DIAGNOSTIC_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)
{
}
back to top