From 3bad1aa696156d3455441eb1eeca7d29c7ed89e8 Mon Sep 17 00:00:00 2001 From: SiliconExarch Date: Fri, 27 Aug 2021 09:55:49 +0100 Subject: [PATCH] Use PFNGLSTENCILOPSEPARATEATIPROC on Mac OS X <= 10.5 The system OpenGL headers only include the ATI implementation prior to 10.6 --- neo/renderer/RenderSystem_init.cpp | 15 +++++++++++++++ neo/renderer/qgl.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 221a7d2e..a8b900c6 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -278,7 +278,12 @@ PFNGLPROGRAMLOCALPARAMETER4FVARBPROC qglProgramLocalParameter4fvARB; PFNGLDEPTHBOUNDSEXTPROC qglDepthBoundsEXT; // DG: couldn't find any extension for this, it's supported in GL2.0 and newer, incl OpenGL ES2.0 +// SE: only the ATI implementation is provided on Mac OS X 10.4 and 10.5 +#if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1050) +PFNGLSTENCILOPSEPARATEATIPROC qglStencilOpSeparate; +#else PFNGLSTENCILOPSEPARATEPROC qglStencilOpSeparate; +#endif /* ================= @@ -398,6 +403,15 @@ static void R_CheckPortableExtensions( void ) { if ( glConfig.twoSidedStencilAvailable ) qglActiveStencilFaceEXT = (PFNGLACTIVESTENCILFACEEXTPROC)GLimp_ExtensionPointer( "glActiveStencilFaceEXT" ); +#if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1050) + if( glConfig.glVersion >= 2.0) { + common->Printf( "... got GL2.0+ glStencilOpSeparate()\n" ); + qglStencilOpSeparate = (PFNGLSTENCILOPSEPARATEATIPROC)GLimp_ExtensionPointer( "glStencilOpSeparateATI" ); + } else { + common->Printf( "... don't have GL2.0+ glStencilOpSeparate()\n" ); + qglStencilOpSeparate = NULL; + } +#else if( glConfig.glVersion >= 2.0) { common->Printf( "... got GL2.0+ glStencilOpSeparate()\n" ); qglStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)GLimp_ExtensionPointer( "glStencilOpSeparate" ); @@ -406,6 +420,7 @@ static void R_CheckPortableExtensions( void ) { common->Printf( "... don't have GL2.0+ glStencilOpSeparate()\n" ); qglStencilOpSeparate = NULL; } +#endif // ARB_vertex_buffer_object glConfig.ARBVertexBufferObjectAvailable = R_CheckExtension( "GL_ARB_vertex_buffer_object" ); diff --git a/neo/renderer/qgl.h b/neo/renderer/qgl.h index 7632136b..19be73df 100644 --- a/neo/renderer/qgl.h +++ b/neo/renderer/qgl.h @@ -96,7 +96,12 @@ extern void ( APIENTRY *qglColorTableEXT)( int, int, int, int, int, const void * extern PFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT; // DG: couldn't find any extension for this, it's supported in GL2.0 and newer, incl OpenGL ES2.0 +// SE: only the ATI implementation is provided on Mac OS X 10.4 and 10.5 +#if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1050) +extern PFNGLSTENCILOPSEPARATEATIPROC qglStencilOpSeparate; +#else extern PFNGLSTENCILOPSEPARATEPROC qglStencilOpSeparate; +#endif // ARB_texture_compression extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC qglCompressedTexImage2DARB;