I'm using VS2015, directx11
Here's my Vertex Shader code.
cbuffer cbperobject {
float4x4 gWorldViewProj;
};
struct VertexIn {
float3 Pos : POSITION;
float2 tex : TEXCOORD0;
};
struct VertexOut {
float4 PosH : SV_POSITION;
float2 tex : TEXCOORD0;
};
VertexOut main( VertexIn vin )
{
VertexOut vOut;
vOut.PosH = mul(float4(vin.Pos, 1.0f), gWorldViewProj);
vOut.tex = vin.tex;
return vOut;
}
and this is my pixel shader code
Texture2D shaderTexture;
SamplerState SampleType;
struct VertexIn {
float4 PosH : SV_POSITION;
float2 tex : TEXCOORD0;
};
float4 main(VertexIn Pin) : SV_TARGET
{
float4 textureColor;
textureColor = shaderTexture.Sample(SampleType, Pin.tex);
return textureColor;
}
For pixel shaders input buffer, I don't need position buffer in this code. so I deleted float4 PosH in this code. then pixel shader doesn't work I see black beer crate. when I retore the struct form which has float4 for position info and float2 for textcoord info, it works fine agian. I think I don't understand how this rendering pipeline work. Could you explain me why is this and how pipeline work? thank you.
SV_POSITION
is a required output from the Vertex Shader as it's implicitly part of the Pixel Shader processing. – Chuck Walbourn