Citro3d
Loading...
Searching...
No Matches
drawArrays.c
Go to the documentation of this file.
1#include "internal.h"
2
3void C3D_DrawArrays(GPU_Primitive_t primitive, int first, int size)
4{
6
7 // Set primitive type
8 GPUCMD_AddMaskedWrite(GPUREG_PRIMITIVE_CONFIG, 2, primitive);
9 // Start a new primitive (breaks off a triangle strip/fan)
10 GPUCMD_AddWrite(GPUREG_RESTART_PRIMITIVE, 1);
11 // The index buffer is not used, but this command is still required
12 GPUCMD_AddWrite(GPUREG_INDEXBUFFER_CONFIG, 0x80000000);
13 // Number of vertices
14 GPUCMD_AddWrite(GPUREG_NUMVERTICES, size);
15 // First vertex
16 GPUCMD_AddWrite(GPUREG_VERTEX_OFFSET, first);
17 // Enable array drawing mode
18 GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 1, 1);
19 // Enable drawing mode
20 GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 0);
21 // Trigger array drawing
22 GPUCMD_AddWrite(GPUREG_DRAWARRAYS, 1);
23 // Go back to configuration mode
24 GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 1, 1);
25 // Disable array drawing mode
26 GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 1, 0);
27 // Clear the post-vertex cache
28 GPUCMD_AddWrite(GPUREG_VTX_FUNC, 1);
29
30 C3Di_GetContext()->flags |= C3DiF_DrawUsed;
31}
void C3Di_UpdateContext(void)
Definition: base.c:158
void C3D_DrawArrays(GPU_Primitive_t primitive, int first, int size)
Definition: drawArrays.c:3
@ C3DiF_DrawUsed
Definition: internal.h:76