Hi !
I compile my pixel shader with the version : ps_5_0 as a parameter in the instruction :
if(FAILED(D3DX11CompileFromFileA("./Shaders/GBuffer.hlsl",NULL, NULL, "pixel_main", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &blobPixelGBuffer, &errorBlob, NULL )))
But at the compilation, I get these errors if I put the semantics COLOR0, COLOR1, and COLOR2 or SV_Target0, SV_Target1, SV_Target2,
both generates compilation errors.
The shader is here :
struct psIn
{
float4 color : COLOR0 ;
float4 RTposition : POSITION1 ;
float2 texCoord : TEXCOORD0 ;
float3 normal : NORMAL ;
float4 posInLightSpace : TEXCOORD1 ;
};
struct psOut
{
float4 color : SV_Target ;
float4 RTposition : SV_Target1 ;
float4 RTnormal : SV_Target2 ;
};
SamplerState colorMap : register( s[0] ) ;
SamplerState specularMap : register( s[1] ) ;
SamplerState shadowMap : register( s[2] );
cbuffer GBufferConstants
{
bool texturedMesh ;
bool isSpecular ;
float epsilon ;
}
Texture2D texObj2D ;
float4 getColor(psIn IN)
{
if(texturedMesh == true)
{
return texObj2D.Sample(colorMap, IN.texCoord) ;
}
else
return IN.color ;
}
/* pixel shader */
psOut pixel_main(psIn IN, psOut OUT )
{
OUT.color = getColor(IN) ; ;
OUT.RTposition = IN.RTposition ;
OUT.RTnormal = float4(IN.normal, 1.0) ;
return OUT ;
}
Do you have an idea ? I looked in the directx documantation and it seems that it is SV_Target but it don't work