title: Primitive thickness - DX10
body: <p>i recently stepped into primitive rendering in directX10. I need that because i want to convert my ingame chat from directx9 to 10 due my huge performance lag being forced by the games weak dx9 support. The lines are being rendered fine on the positions i want. My actual problem is that they doesnt appear as thin as in directX9 (1 pixel width). They seem to be more thick than a pixel. I've read some around and found some info that its possible to fix that with some kind of geometry shader. Does anybody know how that would work and how it would look code wise? I am not into it that deep.</p>
  
  <p>Attached is the drawLine method (initialization isnt needed i belive, if so i'll post it immediliantly)</p>
  
  <pre><code> void drawLine(int x1, int y1, int x2, int y2, D3DCOLOR lineColor) {
    VERTEX Vertices[] = {
    /*p1*/{getScreenPercentage(x1, y1), lineColor}, //getScreenPercentage puts the given screencoords into the rasterized state
    /*p2*/{getScreenPercentage(x2, y2), lineColor}
    };
  
    pDevice-&gt;IASetInputLayout(pVertexLayout);
    UINT stride = sizeof(VERTEX);
    UINT offset = 0;
    pDevice-&gt;IASetVertexBuffers(0, 1, &amp;p2pBuffer, &amp;stride, &amp;offset);
  
    VERTEX* pVoid;
    p2pBuffer-&gt;Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&amp;pVoid);
    pVoid[0] = Vertices[0];
    pVoid[1] = Vertices[1];
    p2pBuffer-&gt;Unmap();
  
    pDevice-&gt;IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_LINELIST);
    pPass-&gt;Apply(0);
    pDevice-&gt;Draw(2, 0);
   }
  </code></pre>
  
  <p>And my effect</p>
  
  <pre><code>char szEffect[] = 
  "struct DATA"
  "{"
  "    float4 Pos : SV_POSITION;"
  "    float4 Color : COLOR;"
  "};"
  
  "DATA VS(float4 Pos : POSITION, float4 Col : COLOR)"
  "{"
  "    DATA Data;"
  "    Data.Pos = Pos;"
  "    Data.Color = Col;"
  "    return Data;"
  "}"
  
  "float4 PS(DATA Data) : SV_TARGET"
  "{"
  "    return Data.Color;"
  "}"
  
  "technique10 T0"
  "{"
  "    pass P0"
  "    {"
  "        SetVertexShader(CompileShader(vs_4_0, VS()));"
  "        SetGeometryShader(NULL);"
  "        SetPixelShader(CompileShader(ps_4_0, PS()));"
  "    }"
  "}";
  </code></pre>
  
  <p>Example of the output in Bad Company 2 running in windowed mode on highest settings (also tried lowest already with AA off)</p>