For whatever reason, the renderer seems to ignore the semantics for the first argument, and always passes the pixel position. Even if a different argument has the SV_POSITION
semantic, the position still gets passed as the first argument. Is there a reason for this?
Vertex shader:
cbuffer transforms
{
float4x4 view, projection;
};
void main(
in float4 inPos : POSITION, in float3 inNorm : NORMAL,
out float4 outPos : SV_POSITION, out float3 outNorm : TEXCOORD0
)
{
outPos = mul(projection, mul(view, inPos));
outNorm = inNorm;
}
Pixel shader:
void main(
float4 inPos : SV_POSITION, in float3 inNorm : TEXCOORD0,
out float4 outClr : SV_TARGET
)
{
outClr.xyz = inNorm * 0.5 + 0.5;
outClr.w = 1.0;
}