MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / DrawPrimitive

Method DrawPrimitive

GTE/Graphics/DX11/DX11Engine.cpp:750–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

748}
749
750uint64_t DX11Engine::DrawPrimitive(VertexBuffer const* vbuffer, IndexBuffer const* ibuffer)
751{
752 UINT numActiveVertices = vbuffer->GetNumActiveElements();
753 UINT vertexOffset = vbuffer->GetOffset();
754
755 UINT numActiveIndices = ibuffer->GetNumActiveIndices();
756 UINT firstIndex = ibuffer->GetFirstIndex();
757 uint32_t type = ibuffer->GetPrimitiveType();
758
759 switch (type)
760 {
761 case IP_POLYPOINT:
762 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
763 break;
764 case IP_POLYSEGMENT_DISJOINT:
765 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
766 break;
767 case IP_POLYSEGMENT_CONTIGUOUS:
768 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP);
769 break;
770 case IP_TRIMESH:
771 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
772 break;
773 case IP_TRISTRIP:
774 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
775 break;
776 case IP_POLYSEGMENT_DISJOINT_ADJ:
777 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ);
778 break;
779 case IP_POLYSEGMENT_CONTIGUOUS_ADJ:
780 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ);
781 break;
782 case IP_TRIMESH_ADJ:
783 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ);
784 break;
785 case IP_TRISTRIP_ADJ:
786 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ);
787 break;
788 default:
789 LogError("Unknown primitive topology = " + std::to_string(type));
790 }
791
792 ID3D11Query* occlusionQuery = nullptr;
793 uint64_t numPixelsDrawn = 0;
794 if (mAllowOcclusionQuery)
795 {
796 occlusionQuery = BeginOcclusionQuery();
797 }
798
799 if (ibuffer->IsIndexed())
800 {
801 if (numActiveIndices > 0)
802 {
803 mImmediate->DrawIndexed(numActiveIndices, firstIndex, vertexOffset);
804 }
805 }
806 else
807 {

Callers

nothing calls this directly

Calls 11

GetNumActiveIndicesMethod · 0.80
GetFirstIndexMethod · 0.80
GetPrimitiveTypeMethod · 0.80
IsIndexedMethod · 0.80
StandardUsageMethod · 0.80
GetNumActiveElementsMethod · 0.45
GetOffsetMethod · 0.45
DrawMethod · 0.45
BindMethod · 0.45
EnableMethod · 0.45
DisableMethod · 0.45

Tested by

no test coverage detected