I am trying to build textured quads out of single vertices (as POINT List) inside the Geometry Shader. The problem i am unable to solve right now is that nothing gets rendered. I already tried to debug it with Visual Studios' Graphics debugger, and found out that the output of my geometry shader is seemingly empty.
This is my Geometry Shader:
struct PS_INPUT
{
float4 position : SV_POSITION;
float2 texCoord : TEXCOORD;
};
struct VS_OUTPUT
{
float4 position : SV_POSITION;
float3 normal : NORMAL;
};
[maxvertexcount(4)]
void GS(
point VS_OUTPUT input[1],
inout TriangleStream< PS_INPUT > output
)
{
float3 decalNormal = input[0].normal;
float3 upVector = float3(0.0, 1.0f, 0.0f);
float3 frontVector = 0.2f * decalNormal;
// 2.0f = half-decal width
float3 rightVector = normalize(cross(decalNormal, upVector)) * 4.0f;
upVector = float3(0, 4.0f, 0);
float3 vertices[4] = { { 1, 0, 0 }, { 0, 0, 1 }, { -1, 0, 0 }, { 0, 0, -1 } };
vertices[0] = input[0].position.xyz - rightVector - upVector + frontVector; // Bottom Left
vertices[1] = input[0].position.xyz + rightVector - upVector + frontVector; // Bottom Right
vertices[2] = input[0].position.xyz - rightVector + upVector + frontVector; // Top Left
vertices[3] = input[0].position.xyz + rightVector + upVector + frontVector; // Top Right
float2 texCoord[4] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
texCoord[0] = float2(0, 1);
texCoord[1] = float2(1, 1);
texCoord[2] = float2(0, 0);
texCoord[3] = float2(1, 0);
PS_INPUT outputVert;
for (uint i = 0; i < 4; i++)
{
outputVert.position = float4(vertices[i], 1.0f);
outputVert.texCoord = texCoord[i];
output.Append(outputVert);
}
}
This is a screenshot of the Pipeline stages for the Draw call. As you can see there a 3 pixels present inside the vertex shader, but nothing after the geometry shader.
I already disabled all culling:
D3D11_RASTERIZER_DESC rDesc;
ZeroMemory(&rDesc, sizeof(D3D11_RASTERIZER_DESC));
rDesc.FillMode = D3D11_FILL_SOLID;
rDesc.CullMode = D3D11_CULL_NONE; // no culling for now...
rDesc.FrontCounterClockwise = false;
rDesc.DepthClipEnable = false;
And depth testing:
dsDesc.DepthEnable = false;
While setting everything like this:
context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
context->RSSetState(m_pRasterizer);
context->IASetInputLayout(m_pInputLayout);
context->VSSetShader(m_pVS, 0, 0);
context->GSSetShader(m_pGS, 0, 0);
context->PSSetShader(m_pPS, 0, 0);
What could be the problem here? I assume that there is no Pixel Shader present because the Geometry Shader isn't outputting anything, is that right? Thank you!