Make things compile under c99

This commit is contained in:
Luke Benstead 2018-04-29 08:32:06 +01:00
parent 2bff44ce6a
commit 4653957c85
2 changed files with 61 additions and 59 deletions

View File

@ -55,38 +55,38 @@ typedef GLushort uint16;
typedef GLubyte uint8; typedef GLubyte uint8;
/* Vertex Main Buffer Internal Functions */ /* Vertex Main Buffer Internal Functions */
inline void _glKosVertexBufSwitchOP(); void _glKosVertexBufSwitchOP();
inline void _glKosVertexBufSwitchTR(); void _glKosVertexBufSwitchTR();
inline void *_glKosVertexBufAddress(unsigned char list); void *_glKosVertexBufAddress(unsigned char list);
inline void *_glKosVertexBufPointer(); void *_glKosVertexBufPointer();
inline void *_glKosTRVertexBufPointer(); void *_glKosTRVertexBufPointer();
inline void _glKosVertexBufIncrement(); void _glKosVertexBufIncrement();
inline void _glKosTRVertexBufIncrement(); void _glKosTRVertexBufIncrement();
inline void _glKosVertexBufAdd(unsigned int count); void _glKosVertexBufAdd(unsigned int count);
inline void _glKosTRVertexBufAdd(unsigned int count); void _glKosTRVertexBufAdd(unsigned int count);
inline void _glKosVertexBufDecrement(); void _glKosVertexBufDecrement();
inline void _glKosVertexBufReset(); void _glKosVertexBufReset();
inline unsigned int _glKosVertexBufCount(unsigned char list); unsigned int _glKosVertexBufCount(unsigned char list);
unsigned char _glKosList(); unsigned char _glKosList();
inline void _glKosVertexBufCopy(void *src, void *dst, GLuint count); void _glKosVertexBufCopy(void *src, void *dst, GLuint count);
inline void _glKosResetEnabledTex(); void _glKosResetEnabledTex();
inline void *_glKosMultiUVBufAddress(); void *_glKosMultiUVBufAddress();
inline void *_glKosMultiUVBufPointer(); void *_glKosMultiUVBufPointer();
inline void _glKosMultiUVBufIncrement(); void _glKosMultiUVBufIncrement();
inline void _glKosMultiUVBufAdd(GLuint count); void _glKosMultiUVBufAdd(GLuint count);
inline void _glKosMultiUVBufReset(); void _glKosMultiUVBufReset();
/* Vertex Clip Buffer Internal Functions */ /* Vertex Clip Buffer Internal Functions */
inline void *_glKosClipBufAddress(); void *_glKosClipBufAddress();
inline void *_glKosClipBufPointer(); void *_glKosClipBufPointer();
inline void _glKosClipBufIncrement(); void _glKosClipBufIncrement();
inline void _glKosClipBufReset(); void _glKosClipBufReset();
/* Vertex Array Buffer Internal Functions */ /* Vertex Array Buffer Internal Functions */
inline void _glKosArrayBufIncrement(); void _glKosArrayBufIncrement();
inline void _glKosArrayBufReset(); void _glKosArrayBufReset();
inline glVertex *_glKosArrayBufAddr(); glVertex *_glKosArrayBufAddr();
inline glVertex *_glKosArrayBufPtr(); glVertex *_glKosArrayBufPtr();
/* Initialize the OpenGL PVR Pipeline */ /* Initialize the OpenGL PVR Pipeline */
int _glKosInitPVR(); int _glKosInitPVR();
@ -211,7 +211,7 @@ GLubyte _glKosEnabledTextureMatrix();
GL_TEXTURE_OBJECT *_glKosBoundMultiTexObject(); GL_TEXTURE_OBJECT *_glKosBoundMultiTexObject();
GLuint _glKosActiveTextureBoundTexID(); GLuint _glKosActiveTextureBoundTexID();
inline void _glKosPushMultiTexObject(GL_TEXTURE_OBJECT *tex, void _glKosPushMultiTexObject(GL_TEXTURE_OBJECT *tex,
pvr_vertex_t *src, pvr_vertex_t *src,
GLuint count); GLuint count);

View File

@ -51,13 +51,13 @@ static GL_MULTITEX_OBJECT GL_MTOBJS[GL_KOS_MAX_MULTITEXTURE_OBJECTS];
static GLuint GL_MTOBJECTS = 0; static GLuint GL_MTOBJECTS = 0;
/* Custom version of sq_cpy from KOS for copying vertex data to the PVR */ /* Custom version of sq_cpy from KOS for copying vertex data to the PVR */
static inline void pvr_list_submit(void *src, int n) { static void pvr_list_submit(void *src, int n) {
GLuint *d = TA_SQ_ADDR; GLuint *d = TA_SQ_ADDR;
GLuint *s = src; GLuint *s = src;
/* fill/write queues as many times necessary */ /* fill/write queues as many times necessary */
while(n--) { while(n--) {
asm("pref @%0" : : "r"(s + 8)); /* prefetch 32 bytes for next loop */ __asm__("pref @%0" : : "r"(s + 8)); /* prefetch 32 bytes for next loop */
d[0] = *(s++); d[0] = *(s++);
d[1] = *(s++); d[1] = *(s++);
d[2] = *(s++); d[2] = *(s++);
@ -66,7 +66,7 @@ static inline void pvr_list_submit(void *src, int n) {
d[5] = *(s++); d[5] = *(s++);
d[6] = *(s++); d[6] = *(s++);
d[7] = *(s++); d[7] = *(s++);
asm("pref @%0" : : "r"(d)); __asm__("pref @%0" : : "r"(d));
d += 8; d += 8;
} }
@ -75,8 +75,9 @@ static inline void pvr_list_submit(void *src, int n) {
d[0] = d[8] = 0; d[0] = d[8] = 0;
} }
#ifdef GL_KOS_USE_DMA
/* Custom version of sq_cpy from KOS for copying 32bytes of vertex data to the PVR */ /* Custom version of sq_cpy from KOS for copying 32bytes of vertex data to the PVR */
static inline void pvr_hdr_submit(const GLuint *src) { static void pvr_hdr_submit(const GLuint *src) {
GLuint *d = TA_SQ_ADDR; GLuint *d = TA_SQ_ADDR;
d[0] = *(src++); d[0] = *(src++);
@ -88,10 +89,11 @@ static inline void pvr_hdr_submit(const GLuint *src) {
d[6] = *(src++); d[6] = *(src++);
d[7] = *(src++); d[7] = *(src++);
asm("pref @%0" : : "r"(d)); __asm__("pref @%0" : : "r"(d));
} }
#endif
inline void _glKosPushMultiTexObject(GL_TEXTURE_OBJECT *tex, void _glKosPushMultiTexObject(GL_TEXTURE_OBJECT *tex,
pvr_vertex_t *src, pvr_vertex_t *src,
GLuint count) { GLuint count) {
_glKosCompileHdrMT(&GL_MTOBJS[GL_MTOBJECTS].hdr, tex); _glKosCompileHdrMT(&GL_MTOBJS[GL_MTOBJECTS].hdr, tex);
@ -100,63 +102,63 @@ inline void _glKosPushMultiTexObject(GL_TEXTURE_OBJECT *tex,
GL_MTOBJS[GL_MTOBJECTS++].count = count; GL_MTOBJS[GL_MTOBJECTS++].count = count;
} }
inline void _glKosResetMultiTexObject() { void _glKosResetMultiTexObject() {
GL_MTOBJECTS = 0; GL_MTOBJECTS = 0;
} }
inline void *_glKosMultiUVBufAddress() { void *_glKosMultiUVBufAddress() {
return &GL_UVBUF[0]; return &GL_UVBUF[0];
} }
inline void *_glKosMultiUVBufPointer() { void *_glKosMultiUVBufPointer() {
return &GL_UVBUF[GL_UVVERTS]; return &GL_UVBUF[GL_UVVERTS];
} }
inline void _glKosMultiUVBufIncrement() { void _glKosMultiUVBufIncrement() {
++GL_UVVERTS; ++GL_UVVERTS;
} }
inline void _glKosMultiUVBufAdd(GLuint count) { void _glKosMultiUVBufAdd(GLuint count) {
GL_UVVERTS += count; GL_UVVERTS += count;
} }
inline void _glKosMultiUVBufReset() { void _glKosMultiUVBufReset() {
GL_UVVERTS = 0; GL_UVVERTS = 0;
} }
inline void *_glKosClipBufAddress() { void *_glKosClipBufAddress() {
return &GL_CBUF[0]; return &GL_CBUF[0];
} }
inline void *_glKosClipBufPointer() { void *_glKosClipBufPointer() {
return &GL_CBUF[GL_CVERTS]; return &GL_CBUF[GL_CVERTS];
} }
inline void _glKosClipBufIncrement() { void _glKosClipBufIncrement() {
++GL_CVERTS; ++GL_CVERTS;
} }
inline void _glKosClipBufAdd(GLuint count) { void _glKosClipBufAdd(GLuint count) {
GL_CVERTS += count; GL_CVERTS += count;
} }
inline void _glKosClipBufReset() { void _glKosClipBufReset() {
GL_CVERTS = 0; GL_CVERTS = 0;
} }
inline void _glKosVertexBufSwitchOP() { void _glKosVertexBufSwitchOP() {
GL_LIST = GL_KOS_LIST_OP; GL_LIST = GL_KOS_LIST_OP;
} }
inline void _glKosVertexBufSwitchTR() { void _glKosVertexBufSwitchTR() {
GL_LIST = GL_KOS_LIST_TR; GL_LIST = GL_KOS_LIST_TR;
} }
inline void *_glKosVertexBufAddress(GLubyte list) { void *_glKosVertexBufAddress(GLubyte list) {
return &GL_VBUF[list][0]; return &GL_VBUF[list][0];
} }
inline void *_glKosVertexBufPointer() { void *_glKosVertexBufPointer() {
return &GL_VBUF[GL_LIST][GL_VERTS[GL_LIST]]; return &GL_VBUF[GL_LIST][GL_VERTS[GL_LIST]];
} }
@ -184,36 +186,36 @@ static void _glKosVertexBufIncrementList(GLubyte list, GLuint count) {
} }
} }
inline void _glKosVertexBufIncrement() { void _glKosVertexBufIncrement() {
_glKosVertexBufIncrementList(GL_LIST, 1); _glKosVertexBufIncrementList(GL_LIST, 1);
} }
inline void *_glKosTRVertexBufPointer() { void *_glKosTRVertexBufPointer() {
return &GL_VBUF[GL_KOS_LIST_TR][GL_VERTS[GL_KOS_LIST_TR]]; return &GL_VBUF[GL_KOS_LIST_TR][GL_VERTS[GL_KOS_LIST_TR]];
} }
inline void _glKosTRVertexBufIncrement() { void _glKosTRVertexBufIncrement() {
_glKosVertexBufIncrementList(GL_KOS_LIST_TR, 1); _glKosVertexBufIncrementList(GL_KOS_LIST_TR, 1);
} }
inline void _glKosVertexBufAdd(GLuint count) { void _glKosVertexBufAdd(GLuint count) {
_glKosVertexBufIncrementList(GL_LIST, count); _glKosVertexBufIncrementList(GL_LIST, count);
} }
inline void _glKosTRVertexBufAdd(GLuint count) { void _glKosTRVertexBufAdd(GLuint count) {
_glKosVertexBufIncrementList(GL_KOS_LIST_TR, count); _glKosVertexBufIncrementList(GL_KOS_LIST_TR, count);
} }
inline void _glKosVertexBufDecrement() { void _glKosVertexBufDecrement() {
/* Intentionally don't free data here, we only ever grow */ /* Intentionally don't free data here, we only ever grow */
--GL_VERTS[GL_LIST]; --GL_VERTS[GL_LIST];
} }
inline void _glKosVertexBufReset() { void _glKosVertexBufReset() {
GL_VERTS[0] = GL_VERTS[1] = 0; GL_VERTS[0] = GL_VERTS[1] = 0;
} }
inline GLuint _glKosVertexBufCount(GLubyte list) { GLuint _glKosVertexBufCount(GLubyte list) {
return GL_VERTS[list]; return GL_VERTS[list];
} }
@ -221,11 +223,11 @@ GLubyte _glKosList() {
return GL_LIST; return GL_LIST;
} }
inline void _glKosVertexBufCopy(void *dst, void *src, GLuint count) { void _glKosVertexBufCopy(void *dst, void *src, GLuint count) {
memcpy(dst, src, count * 0x20); memcpy(dst, src, count * 0x20);
} }
static inline void glutSwapBuffer() { static void glutSwapBuffer() {
#ifndef GL_KOS_USE_DMA #ifndef GL_KOS_USE_DMA
QACR0 = QACRTA; QACR0 = QACRTA;
QACR1 = QACRTA; QACR1 = QACRTA;