2014-12-20 21:34:19 +01:00
|
|
|
#include "context.h"
|
|
|
|
|
|
|
|
void C3D_DrawElements(C3D_IBO* ibo, GPU_Primitive_t primitive)
|
|
|
|
{
|
|
|
|
C3Di_UpdateContext();
|
|
|
|
|
|
|
|
// Set primitive type
|
2015-03-05 17:56:33 +01:00
|
|
|
GPUCMD_AddMaskedWrite(GPUREG_PRIMITIVE_CONFIG, 2, primitive);
|
|
|
|
GPUCMD_AddMaskedWrite(GPUREG_025F, 2, 0x00000001);
|
2014-12-20 21:34:19 +01:00
|
|
|
// Bind the IBO
|
|
|
|
C3Di_IBOBind(ibo);
|
|
|
|
// Number of vertices
|
2015-03-05 17:56:33 +01:00
|
|
|
GPUCMD_AddWrite(GPUREG_NUMVERTICES, ibo->indexCount);
|
2014-12-20 21:34:19 +01:00
|
|
|
|
|
|
|
// Unknown commands
|
2015-03-05 17:56:33 +01:00
|
|
|
GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG, 2, 0x00000100);
|
|
|
|
GPUCMD_AddMaskedWrite(GPUREG_0253, 2, 0x00000100);
|
2014-12-20 21:34:19 +01:00
|
|
|
|
2015-03-05 17:56:33 +01:00
|
|
|
GPUCMD_AddMaskedWrite(GPUREG_0245, 1, 0x00000000);
|
|
|
|
GPUCMD_AddWrite(GPUREG_DRAWELEMENTS, 0x00000001);
|
|
|
|
GPUCMD_AddMaskedWrite(GPUREG_0245, 1, 0x00000001);
|
|
|
|
GPUCMD_AddWrite(GPUREG_0231, 0x00000001);
|
2014-12-20 21:34:19 +01:00
|
|
|
|
|
|
|
C3Di_GetContext()->flags |= C3DiF_NeedFinishDrawing;
|
|
|
|
}
|