I am trying to add a geometry shader stage to my pipeline, however when i add the geometry shader function, even the vertex shader compilation gives errors for some reason (the Vertex, Pixel and Geometry shaders are in the same file). the code inside the geometry shader seems to be causing the problem, because as soon as i deleted it, the vertex shader compiled successfully.
I haven't ever dealt with geometry shaders in any API, but it seemed to me that setting-up a geometry shader should be as simple as the rest, there are some geometry shader examples for DX11 on the internet, but not many. At least all those that i was able find were only showing the hlsl side.
cbuffer TickConstantBuffer : register(b0)
{
matrix World;
matrix View;
}
cbuffer OnEvent : register(b1)
{
matrix Projection;
}
float4 VS( float4 Pos : POSITION ) : SV_POSITION
{
float4 OutPos;
OutPos = mul(Pos, View);
OutPos = mul(OutPos, Projection);
return Pos;
}
[maxvertexcount(4)]
void GS( point float4 input[1], inout TriangleStream<float4> OutputStream )
{
float4 v;
OutputStream.Append(float4(input[0].x + 0.5, input[0].y + 0.5, input[0].z, input[0].w));
OutputStream.Append(float4(input[0].x - 0.5, input[0].y + 0.5, input[0].z, input[0].w));
OutputStream.Append(float4(input[0].x - 0.5, input[0].y - 0.5, input[0].z, input[0].w));
OutputStream.Append(float4(input[0].x + 0.5, input[0].y - 0.5, input[0].z, input[0].w));
}
float4 PS( float4 Pos : SV_POSITION ) : SV_Target
{
return float4( 1.0f, 1.0f, 0.0f, 1.0f );
}