Graphics‎ > ‎Graphic API‎ > ‎Direct3D‎ > ‎


Select the typ of primitive to render with IASetPrimitiveTopology. The common ones are *PRIMITIVE_TOPOLOGY_POINTLIST, *PRIMITIVE_TOPOLOGY_LINELIST and PRIMITIVE_TOPOLOGY_TRIANGLELIST. Older DirecX version did take it as a parameter to each draw function.



To set the vertex buffers and index buffer to use call ID3D11DeviceContext::IASetVertexBuffers and ID3D11DeviceContext::IASetIndexBuffers

Non-indexed or Indexed
The two basic draw commands are Draw and DrawIndexed. Draw takes the number of vertices to draw and the index of the first vertex in the vertex buffer (it is also possible to not use a vertex buffer and use SV_VertexID in the shader to generate the vertex). DrawIndexed takes the number of index to drarw, the first index in the index buffers and a offset to add to each index before reading the vertex from the vertex buffer.

DeviceContext::Draw( UINT VertexCount, UINT StartVertexLocation );
DeviceContext::DrawIndexed( UINT IndexCount, UINT StartIndexLocation, INT  BaseVertexLocation );

Instanced rendering is used to draw the same geometry multiple times, example the same fence is used many times in the same area so only the transform of it is different.

DeviceContext::DrawInstanced( UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation );
DeviceContext::DrawIndexedInstanced( UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT  BaseVertexLocation, UINT StartInstanceLocation);