https://github.com/shader-slang/slang
Raw File
Tip revision: 706d4f91e269d473c963d31792fb2c8320933c9b authored by Tim Foley on 05 January 2021, 21:01:17 UTC
Add basic GLSL support for SV_Barycentrics (#1648)
Tip revision: 706d4f9
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