summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-12-28 12:57:52 -0800
committer3gg <3gg@shellblade.net>2025-12-28 12:57:52 -0800
commit75ee45cc65b35d40355178f48ef0c2d90040b863 (patch)
tree780f64e0aa6aefe9ec23f5876113fb7a4120155c /include
parent07fb91b9571fc0add797cbcd0adcc8711401a2be (diff)
Move memory allocation to the clientHEADmain
Diffstat (limited to 'include')
-rw-r--r--include/swgfx.h14
1 files changed, 3 insertions, 11 deletions
diff --git a/include/swgfx.h b/include/swgfx.h
index 94eb359..005359b 100644
--- a/include/swgfx.h
+++ b/include/swgfx.h
@@ -39,13 +39,13 @@ typedef struct sgPixel { uint8_t r, g, b, a; } sgPixel;
39 39
40typedef struct swgfx swgfx; 40typedef struct swgfx swgfx;
41 41
42swgfx* sgNew(); 42size_t sgMem(int width, int height); // Get memory requirements.
43swgfx* sgNew(int width, int height, void* mem);
43void sgDel(swgfx**); 44void sgDel(swgfx**);
44 45
45// TODO: Write client app first, then implement the functions below in the C file. 46// TODO: Write client app first, then implement the functions below in the C file.
46 47
47void sgColourBuffer(swgfx*, sgVec2i dimensions, sgPixel* buffer); 48void sgPresent(swgfx*, sgVec2i dimensions, sgPixel* screen);
48void sgPresent (swgfx*, sgVec2i dimensions, sgPixel* screen);
49 49
50void sgModelId (swgfx*); 50void sgModelId (swgfx*);
51void sgModel (swgfx*, sgVec3 position, sgVec3 right, sgVec3 up, sgVec3 forward); 51void sgModel (swgfx*, sgVec3 position, sgVec3 right, sgVec3 up, sgVec3 forward);
@@ -66,11 +66,3 @@ void sgTrianglesIndexed(swgfx*, size_t numIndices, const sgIdx* indices, const s
66void sgTrianglesIndexedNonUniform(swgfx*, size_t numTris, const sgTriIdx* tris, const sgVec3* positions); 66void sgTrianglesIndexedNonUniform(swgfx*, size_t numTris, const sgTriIdx* tris, const sgVec3* positions);
67 67
68void sgCheck(swgfx*); 68void sgCheck(swgfx*);
69
70// Memory
71#define SG_ALIGN 64
72#define SG_ALIGN_PTR(P) ((uintptr_t)(P) & (~(SG_ALIGN-1)))
73#define SG_ALIGN_ALLOC(COUNT, TYPE) (TYPE*)sgAlloc(1, COUNT * sizeof(TYPE))
74#define SG_FREE(PP) sgFree((void**)PP)
75void* sgAlloc(size_t count, size_t size);
76void sgFree(void**);