my problem is that if i try to expand my vertex with the GeometryShader DirectX seems to not connect the lines anymore and also it doesn't draw all lines
md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP); // SAME PROBLEM WITH LINELIST
UINT count = 10;
std::vector<Vertex::Geo> vertices(count);
for(UINT i = 0; i < count; ++i)
{
vertices[i].Pos = XMFLOAT3(i*1.0f, 1.0f, 1.0f);
vertices[i].Size = XMFLOAT2(16.0f, 16.0f);
}
[maxvertexcount(2)]
void GS(point VertexOut gin[1],
inout LineStream<GeoOut> stream)
{
float3 up = float3(0.0f, 1.0f, 0.0f);
float3 look = gEyePosW - gin[0].CenterW;
look.y = 0.0f; // y-axis aligned, so project to xz-plane
look = normalize(look);
float3 right = cross(up, look);
float halfWidth = 0.5f*gin[0].SizeW.x;
float halfHeight = 0.5f*gin[0].SizeW.y;
float4 v[2];
v[0] = float4(gin[0].CenterW + halfHeight*up, 1.0f);
v[1] = float4(gin[0].CenterW - halfHeight*up, 1.0f);
GeoOut gout;
[unroll]
for(int i = 0; i < 2; ++i)
{
gout.PosH = mul(v[i], gViewProj);
gout.PosW = v[i].xyz;
gout.NormalW = look;
stream.Append(gout);
}
}
I have 2 Problems. First that i get this warning:
D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: The declared input primitive type in the current Geometry Shader does not match the current input topology. [ EXECUTION ERROR #360: DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH]
EDIT: Seems that if i use D3D11_PRIMITIVE_TOPOLOGY_POINTLIST as primitiveTopology i dont get the warnig (but why if the inout is LineStream?)
the inout is LineStream so that should not be the problem :/ and as IASetPrimitiveTopology i tried line list and line strip.. both gave me this error
and the second probem is: as u can see i create 10 vertices - should mean at least 5 lines.. and after adding one point with the geometry shader it should be 10 (or?) but all i get are 2 lines
hope that someone can give me a hint
regards helgon
EDIT 2: pretty strange if i use the Draw Method it at least draw 9 lines (count - 1) if i want all 10 i have to draw 11.. pretty strange also
md3dImmediateContext->Draw(10, 0);
if i draw indexed i get just the two lines like in the screenshot (independent which indexCount i use)
md3dImmediateContext->DrawIndexed(10, 0, 0);
but the lines still are linelists and not linestrips
Edited by ~Helgon, 27 November 2012 - 07:05 PM.









