summaryrefslogtreecommitdiff
path: root/src/code/gfxalloc.c
blob: 3b4d72f05747a5113386a6c9d85e7302effb3735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "gfxalloc.h"
#include "alignment.h"

Gfx* Gfx_Open(Gfx* gfx) {
    return gfx + 1;
}

Gfx* Gfx_Close(Gfx* gfx, Gfx* dst) {
    gSPBranchList(gfx, dst);
    return dst;
}

void* Gfx_Alloc(Gfx** gfxP, u32 size) {
    u8* ptr;
    Gfx* dst;

    size = ALIGN8(size);

    ptr = (u8*)(*gfxP + 1);

    dst = (Gfx*)(ptr + size);
    gSPBranchList(*gfxP, dst);

    *gfxP = dst;
    return ptr;
}