From: ljsebald <ljs...@us...> - 2024-04-20 04:26:29
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of OpenGL.". The branch, master has been updated via 8a4be75e53e7520ff558df1e2b2736db0f4abbb4 (commit) from 4c8c082e0675162a1482a810210dec6d4202dc3e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8a4be75e53e7520ff558df1e2b2736db0f4abbb4 Author: Falco Girgis <gyr...@gm...> Date: Fri Apr 19 23:23:17 2024 -0500 Fixed KGL SQ Usage (#2) * Fix for broken SQ usage by KGL * Fixes for -m4-single 1) double-precision floating point constants -> single-precision 2) used KOS's macros for FP argument order to inline ASM ----------------------------------------------------------------------- Summary of changes: gl-pvr.c | 49 ++----------------------------------------------- gl-pvr.h | 3 --- gl-sh4.h | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 58 deletions(-) diff --git a/gl-pvr.c b/gl-pvr.c index 1d13460..af6fe65 100644 --- a/gl-pvr.c +++ b/gl-pvr.c @@ -53,53 +53,8 @@ static GLuint GL_VERTS[2] = {0, 0}, static GL_MULTITEX_OBJECT GL_MTOBJS[GL_KOS_MAX_MULTITEXTURE_OBJECTS]; static GLuint GL_MTOBJECTS = 0; -#if 0 -/* Custom version of sq_cpy from KOS for copying vertex data to the PVR */ -static inline void pvr_list_submit(void *src, int n) { - GLuint *d = TA_SQ_ADDR; - GLuint *s = src; - - /* fill/write queues as many times necessary */ - while(n--) { - asm("pref @%0" : : "r"(s + 8)); /* prefetch 32 bytes for next loop */ - d[0] = *(s++); - d[1] = *(s++); - d[2] = *(s++); - d[3] = *(s++); - d[4] = *(s++); - d[5] = *(s++); - d[6] = *(s++); - d[7] = *(s++); - asm("pref @%0" : : "r"(d)); - d += 8; - } - - /* Wait for both store queues to complete */ - d = (GLuint *)0xe0000000; - d[0] = d[8] = 0; -} - -/* 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) { - GLuint *d = TA_SQ_ADDR; - - d[0] = *(src++); - d[1] = *(src++); - d[2] = *(src++); - d[3] = *(src++); - d[4] = *(src++); - d[5] = *(src++); - d[6] = *(src++); - d[7] = *(src++); - - asm("pref @%0" : : "r"(d)); -} -#else - -#define pvr_list_submit(src, n) sq_cpy(TA_SQ_ADDR, (src), ((n) << 5)) -#define pvr_hdr_submit(src) sq_cpy(TA_SQ_ADDR, (src), 32) - -#endif +#define pvr_list_submit(src, n) pvr_sq_load(NULL, (src), ((n) << 5), PVR_DMA_TA) +#define pvr_hdr_submit(src) pvr_sq_load(NULL, (src), 32, PVR_DMA_TA) inline void _glKosPushMultiTexObject(GL_TEXTURE_OBJECT *tex, pvr_vertex_t *src, diff --git a/gl-pvr.h b/gl-pvr.h index 5348d04..12f952a 100644 --- a/gl-pvr.h +++ b/gl-pvr.h @@ -34,9 +34,6 @@ typedef struct { //#define GL_USE_FLOAT 0 /* Use PVR's floating-point color Vertex Type (64bit) *NoOp* */ /* Misc SH4->PVR Commands */ -#define TA_SQ_ADDR (unsigned int *)(void *) \ - (0xe0000000 | (((unsigned long)0x10000000) & 0x03ffffe0)) - #define QACRTA ((((unsigned int)0x10000000)>>26)<<2)&0x1c #define PVR_TA_TXR_FILTER_SHIFT 14 diff --git a/gl-sh4.h b/gl-sh4.h index 488effd..a669995 100644 --- a/gl-sh4.h +++ b/gl-sh4.h @@ -9,14 +9,18 @@ #ifndef GL_SH4_H #define GL_SH4_H +#include <arch/args.h> + +#define GL_KOS_USE_DMA 1 + typedef float vector3f[3]; /* 3 float vector */ typedef float matrix4f[4][4]; /* 4x4 float matrix */ /* DEG2RAD - convert Degrees to Radians = PI / 180.0f */ -#define DEG2RAD (0.01745329251994329576923690768489) +#define DEG2RAD (0.01745329251994329576923690768489f) /* Calculate Spot Light Angle Cosine = (PI / 180.0f) * (n / 2) */ -#define LCOS(n) fcos(n*0.00872664625997164788461845384244) +#define LCOS(n) fcos(n*0.00872664625997164788461845384244f) /* Internal GL API macro */ #define mat_trans_fv12() { \ @@ -50,10 +54,10 @@ typedef float matrix4f[4][4]; /* 4x4 float matrix */ } #define mat_trans_texture4(s, t, r, q) { \ - register float __s __asm__("fr4") = (s); \ - register float __t __asm__("fr5") = (t); \ - register float __r __asm__("fr6") = (r); \ - register float __q __asm__("fr7") = (q); \ + register float __s __asm__(KOS_FPARG(0)) = (s); \ + register float __t __asm__(KOS_FPARG(1)) = (t); \ + register float __r __asm__(KOS_FPARG(2)) = (r); \ + register float __q __asm__(KOS_FPARG(3)) = (q); \ __asm__ __volatile__( \ "ftrv xmtrx,fv4\n" \ "fldi1 fr6\n" \ @@ -67,8 +71,8 @@ typedef float matrix4f[4][4]; /* 4x4 float matrix */ } #define mat_trans_texture2_nomod(s, t, so, to) { \ - register float __s __asm__("fr4") = (s); \ - register float __t __asm__("fr5") = (t); \ + register float __s __asm__(KOS_FPARG(0)) = (s); \ + register float __t __asm__(KOS_FPARG(1)) = (t); \ __asm__ __volatile__( \ "fldi0 fr6\n" \ "fldi1 fr7\n" \ hooks/post-receive -- The KallistiOS port of OpenGL. |