Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a HLSl pixel shader that I'm using to create a deferred buffer, I have simplified the code to show you:

struct PS_INPUT
{
    float4 PosWVP                   : SV_POSITION;
    float4 NormalWorld              : NORMAL2;
};

struct PS_OUTPUT
{
    float4 PosWorld                 : POSITION;
    float4 NormalWorld              : NORMAL2;
};

PS_OUTPUT main(PS_INPUT input) : SV_Target
{
    PS_OUTPUT output = (PS_OUTPUT)0;

    output.PosWorld = input.PosWorld;
    output.NormalWorld = input.NormalWorld;

    return output; 
}

When I compile this code, I get this warning warning X3576: semantics in type overridden by variable/function or enclosing type, what is this warning and how can I fix it?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I think the problem is that your pixel shader returns a structure, so each element of that structure need to have an SV_TARGET semantic and not the whole struct, so:

struct PS_OUTPUT
{
    float4 PosWorld                 : SV_TARGET0; //changed sematic
    float4 NormalWorld              : SV_TARGET1; //changed sematic
};

PS_OUTPUT main(PS_INPUT input) //there is no semantic here
{
    PS_OUTPUT output = (PS_OUTPUT)0;

    output.PosWorld = input.PosWorld;
    output.NormalWorld = input.NormalWorld;

    return output; 
}
share|improve this answer
1  
That fixed it, thank you. –  Caesar Aug 11 '14 at 17:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.