Original Post
Hi, I tried to draw simple 2D textured rectangle in DirectX 11 and i got this two errors on draw call: D3D11: ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. Semantic 'TEXCOORD' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX ] D3D11: ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. Semantic 'SV_POSITION' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX ] Help Here is the shader code:
cbuffer cb2d : register( b0 )
{
float4 gAdjust : packoffset( c0 );
float4 gColor : packoffset( c1 );
};
Texture2D gTexture;
SamplerState LinearSampler
{
Filter = MIN_MAG_MIP_LINEAR;
AddressU = Wrap;
AddressV = Wrap;
};
void vsmain( in float2 inPos : POSITION,
#ifdef TEXTURE
in float2 inUV : TEXCOORD,
out float2 outUV : TEXCOORD0,
#endif
out float4 outPos : SV_POSITION
)
{
outPos = float4( inPos.xy*gAdjust.xy + gAdjust.zw, 0.5f, 1.f );
#ifdef TEXTURE
outUV = inUV;
#endif
}
void psmain( float4 inPos : SV_POSITION,
#ifdef TEXTURE
float2 inUV : TEXCOORD0,
#endif
out float4 outColor : SV_Target
)
{
#ifdef TEXTURE
outColor = gTexture.Sample( LinearSampler, inUV );
#else
outColor = gColor;
#endif
}