From dc0c8148cbb17d796a2c714ca8e746a1dc5621e3 Mon Sep 17 00:00:00 2001 From: Falco Girgis Date: Mon, 27 Jan 2025 00:53:23 -0600 Subject: [PATCH] API FP ABI conformity fixes. --- GL/glu.c | 4 ++-- GL/matrix.c | 20 ++++++++++---------- GL/state.c | 8 ++++---- include/GL/gl.h | 22 +++++++++++----------- include/GL/glu.h | 6 +++--- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/GL/glu.c b/GL/glu.c index 717b273..2ed4444 100644 --- a/GL/glu.c +++ b/GL/glu.c @@ -2,8 +2,8 @@ #include "private.h" /* Set the Perspective */ -void APIENTRY gluPerspective(GLfloat angle, GLfloat aspect, - GLfloat znear, GLfloat zfar) { +void APIENTRY gluPerspective(GLdouble angle, GLdouble aspect, + GLdouble znear, GLdouble zfar) { GLfloat fW, fH; fH = tanf(angle * (M_PI / 360.0f)) * znear; diff --git a/GL/matrix.c b/GL/matrix.c index 4d7ac5d..1aa713a 100644 --- a/GL/matrix.c +++ b/GL/matrix.c @@ -221,9 +221,9 @@ void APIENTRY glLoadMatrixf(const GLfloat *m) { } /* Ortho */ -void APIENTRY glOrtho(GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat znear, GLfloat zfar) { +void APIENTRY glOrtho(GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble znear, GLdouble zfar) { Matrix4x4 ortho __attribute__((aligned(32))) = { 1.0f, 0.0f, 0.0f, 0.0f, @@ -244,9 +244,9 @@ void APIENTRY glOrtho(GLfloat left, GLfloat right, /* Set the GL frustum */ -void APIENTRY glFrustum(GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat znear, GLfloat zfar) { +void APIENTRY glFrustum(GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble znear, GLdouble zfar) { Matrix4x4 frustum __attribute__((aligned(32))); MEMSET(frustum, 0, sizeof(float) * 16); @@ -360,7 +360,7 @@ void APIENTRY glDepthRangef(GLclampf n, GLclampf f) { DEPTH_RANGE_MULTIPLIER_H = (n + f) / 2.0f; } -void APIENTRY glDepthRange(GLclampf n, GLclampf f){ +void APIENTRY glDepthRange(GLdouble n, GLdouble f){ glDepthRangef(n,f); } @@ -384,9 +384,9 @@ GL_FORCE_INLINE void vec3f_normalize_sh4(float *v){ } } -void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, - GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, - GLfloat upz) { +void gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, + GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, + GLdouble upz) { GLfloat m [16] __attribute__((aligned(32))); GLfloat f [3]; GLfloat u [3]; diff --git a/GL/state.c b/GL/state.c index fd28b2a..04003f4 100644 --- a/GL/state.c +++ b/GL/state.c @@ -679,14 +679,14 @@ GLAPI void APIENTRY glClearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { /* Depth Testing */ GLAPI void APIENTRY glClearDepthf(GLfloat depth) { - glClearDepth(depth); -} - -GLAPI void APIENTRY glClearDepth(GLfloat depth) { /* We reverse because using invW means that farther Z == lower number */ GPUSetClearDepth(MIN(1.0f - depth, PVR_MIN_Z)); } +GLAPI void APIENTRY glClearDepth(GLdouble depth) { + glClearDepthf(depth); +} + GLAPI void APIENTRY glDrawBuffer(GLenum mode) { _GL_UNUSED(mode); diff --git a/include/GL/gl.h b/include/GL/gl.h index d3914de..c26f456 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -446,7 +446,7 @@ __BEGIN_DECLS #define GLshort short #define GLint int #define GLfloat float -#define GLdouble float +#define GLdouble double #define GLvoid void #define GLushort unsigned short #define GLuint unsigned int @@ -454,7 +454,7 @@ __BEGIN_DECLS #define GLsizei unsigned int #define GLfixed const unsigned int #define GLclampf float -#define GLclampd float +#define GLclampd double #define GLubyte unsigned char #define GLbitfield unsigned int #define GLboolean unsigned char @@ -579,12 +579,12 @@ GLAPI void APIENTRY glReadBuffer(GLenum mode); GLAPI void APIENTRY glDrawBuffer(GLenum mode); /* Depth Testing */ -GLAPI void APIENTRY glClearDepth(GLfloat depth); +GLAPI void APIENTRY glClearDepth(GLdouble depth); GLAPI void APIENTRY glClearDepthf(GLfloat depth); GLAPI void APIENTRY glDepthMask(GLboolean flag); GLAPI void APIENTRY glDepthFunc(GLenum func); -GLAPI void APIENTRY glDepthRange(GLclampf n, GLclampf f); -GLAPI void APIENTRY glDepthRangef(GLclampf n, GLclampf f); +GLAPI void APIENTRY glDepthRange(GLdouble n, GLdouble f); +GLAPI void APIENTRY glDepthRangef(GLfloat n, GLfloat f); /* Hints */ /* Currently Supported Capabilities: @@ -696,9 +696,9 @@ GLAPI void APIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z); GLAPI void APIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); #define glRotated glRotatef -GLAPI void APIENTRY glOrtho(GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat znear, GLfloat zfar); +GLAPI void APIENTRY glOrtho(GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble znear, GLdouble zfar); GLAPI void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height); @@ -706,9 +706,9 @@ GLAPI void APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height); GLAPI void APIENTRY glKosGetMatrix(GLenum mode, GLfloat *params); -GLAPI void APIENTRY glFrustum(GLfloat left, GLfloat right, - GLfloat bottom, GLfloat top, - GLfloat znear, GLfloat zfar); +GLAPI void APIENTRY glFrustum(GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble znear, GLdouble zfar); /* Fog Functions - client must enable GL_FOG for this to take effect */ GLAPI void APIENTRY glFogi(GLenum pname, GLint param); diff --git a/include/GL/glu.h b/include/GL/glu.h index 87842ae..7a7c4b5 100644 --- a/include/GL/glu.h +++ b/include/GL/glu.h @@ -30,9 +30,9 @@ GLAPI void APIENTRY gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); /* gluLookAt - Set Camera Position for Rendering. */ -GLAPI void APIENTRY gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, - GLfloat centerx, GLfloat centery, GLfloat centerz, - GLfloat upx, GLfloat upy, GLfloat upz); +GLAPI void APIENTRY gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, + GLdouble centerx, GLdouble centery, GLdouble centerz, + GLdouble upx, GLdouble upy, GLdouble upz); /* generate mipmaps for any image provided by the user and then pass them to OpenGL */ GLAPI GLint APIENTRY gluBuild2DMipmaps(GLenum target, GLint internalFormat,