Skip to content

User defined semantic for shader resources #3758

Answered by csyonghe
Rodousse asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there! We currently don't have reflection support for HLSL semantics, but we do have reflection support for user defined attributes.

[__AttributeUsage(_AttributeTargets.Var)]
struct MyVarAttribute
{
}

[MyVar]
uniform int myVar;

You can query for [MyVar] with these reflection APIs:

TypeReflection::getUserAttributeCount()
UserAttribute* getUserAttributeByIndex()
UserAttribute* getUserAttributeByName()

Here are the definition ofr the _AttributeTargets enum:

enum _AttributeTargets
{
    Struct,
    Var,
    Function
};

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Rodousse
Comment options

Answer selected by Rodousse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants