1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

Move Graph_Alloc and open/close Disps to gfx.h (#1976)

* move graph_alloc and open/close Disps to gfx.h

* zcolchk bss reeeeeee

* fix matching gc-eu-mq (bss)

* remove __gfxCtx extern

* revert makefile -Werror=implicit-function-declaration

* bss
This commit is contained in:
Dragorn421 2024-09-07 12:30:55 +02:00 committed by GitHub
parent c54c1f2274
commit 62b30e2ebe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 51 additions and 47 deletions

View file

@ -161,4 +161,52 @@ typedef struct UCodeDisas {
/* 0xD4 */ u32 geometryMode;
} UCodeDisas; // size = 0xD8
void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size);
void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size);
#define WORK_DISP __gfxCtx->work.p
#define POLY_OPA_DISP __gfxCtx->polyOpa.p
#define POLY_XLU_DISP __gfxCtx->polyXlu.p
#define OVERLAY_DISP __gfxCtx->overlay.p
#if OOT_DEBUG
void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line);
void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line);
// __gfxCtx shouldn't be used directly.
// Use the DISP macros defined above when writing to display buffers.
#define OPEN_DISPS(gfxCtx, file, line) \
{ \
GraphicsContext* __gfxCtx; \
Gfx* dispRefs[4]; \
__gfxCtx = gfxCtx; \
(void)__gfxCtx; \
Graph_OpenDisps(dispRefs, gfxCtx, file, line)
#define CLOSE_DISPS(gfxCtx, file, line) \
do { \
Graph_CloseDisps(dispRefs, gfxCtx, file, line); \
} while (0); \
} \
(void)0
#define GRAPH_ALLOC(gfxCtx, size) Graph_Alloc(gfxCtx, size)
#else
#define OPEN_DISPS(gfxCtx, file, line) \
{ \
GraphicsContext* __gfxCtx = gfxCtx; \
s32 __dispPad
#define CLOSE_DISPS(gfxCtx, file, line) \
do {} while (0); \
} \
(void)0
#define GRAPH_ALLOC(gfxCtx, size) ((void*)((gfxCtx)->polyOpa.d = (Gfx*)((u8*)(gfxCtx)->polyOpa.d - ALIGN16(size))))
#endif
#endif