diff --git a/src/DeviceBuilder.cpp b/src/DeviceBuilder.cpp index cff778a2a..4f5dcad6a 100644 --- a/src/DeviceBuilder.cpp +++ b/src/DeviceBuilder.cpp @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "OGLDebug.h" #include "OGLFragmentShaders.h" #include "OGLExtRender.h" +#include "OGLExtensions.h" #include "OGLGraphicsContext.h" #include "OGLTexture.h" @@ -235,6 +236,11 @@ CColorCombiner * OGLDeviceBuilder::CreateColorCombiner(CRender *pRender) else { m_deviceType = (SupportedDeviceType)options.OpenglRenderSetting; + if (m_deviceType == NVIDIA_OGL_DEVICE && !bNvidiaExtensionsSupported) + { + DebugMessage(M64MSG_WARNING, "Your video card does not support Nvidia OpenGL extensions. Falling back to auto device."); + m_deviceType = OGL_DEVICE; + } if( m_deviceType == OGL_DEVICE ) // Best fit { GLint maxUnit = 2; diff --git a/src/OGLCombinerNV.cpp b/src/OGLCombinerNV.cpp index 3118b1e73..2720602d9 100644 --- a/src/OGLCombinerNV.cpp +++ b/src/OGLCombinerNV.cpp @@ -90,13 +90,14 @@ bool COGLColorCombinerNvidia::Initialize(void) { m_bNVSupported = true; glEnable(GL_REGISTER_COMBINERS_NV); + return true; } else { DebugMessage(M64MSG_ERROR, "Your video card does not support Nvidia OpenGL extension combiner"); glDisable(GL_REGISTER_COMBINERS_NV); + return false; } - return true; } glDisable(GL_REGISTER_COMBINERS_NV); diff --git a/src/OGLExtensions.cpp b/src/OGLExtensions.cpp index bd0b0e78b..a8897f355 100644 --- a/src/OGLExtensions.cpp +++ b/src/OGLExtensions.cpp @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void APIENTRY EmptyFunc(void) { return; } +bool bNvidiaExtensionsSupported = false; PFUNCGLCOMBINERPARAMETERFVNVPROC pglCombinerParameterfvNV = (PFUNCGLCOMBINERPARAMETERFVNVPROC) EmptyFunc; PFUNCGLFINALCOMBINERINPUTNVPROC pglFinalCombinerInputNV = (PFUNCGLFINALCOMBINERINPUTNVPROC) EmptyFunc; PFUNCGLCOMBINEROUTPUTNVPROC pglCombinerOutputNV = (PFUNCGLCOMBINEROUTPUTNVPROC) EmptyFunc; @@ -50,11 +51,18 @@ PFUNCGLCLIENTACTIVETEXTUREARBPROC pglClientActiveTextureARB = (PFUNCGLCLIENTA void OGLExtensions_Init(void) { - INIT_ENTRY_POINT(PFUNCGLCOMBINERPARAMETERFVNVPROC, glCombinerParameterfvNV); - INIT_ENTRY_POINT(PFUNCGLFINALCOMBINERINPUTNVPROC, glFinalCombinerInputNV); - INIT_ENTRY_POINT(PFUNCGLCOMBINEROUTPUTNVPROC, glCombinerOutputNV); - INIT_ENTRY_POINT(PFUNCGLCOMBINERINPUTNVPROC, glCombinerInputNV); - INIT_ENTRY_POINT(PFUNCGLCOMBINERPARAMETERINVPROC, glCombinerParameteriNV); + /* nvidia extensions are a special case */ + bNvidiaExtensionsSupported = true; + pglCombinerParameterfvNV = (PFUNCGLCOMBINERPARAMETERFVNVPROC) CoreVideo_GL_GetProcAddress("glCombinerParameterfvNV"); + if (pglCombinerParameterfvNV == NULL) bNvidiaExtensionsSupported = false; + pglFinalCombinerInputNV = (PFUNCGLFINALCOMBINERINPUTNVPROC) CoreVideo_GL_GetProcAddress("glFinalCombinerInputNV"); + if (pglFinalCombinerInputNV == NULL) bNvidiaExtensionsSupported = false; + pglCombinerOutputNV = (PFUNCGLCOMBINEROUTPUTNVPROC) CoreVideo_GL_GetProcAddress("glCombinerOutputNV"); + if (pglCombinerOutputNV == NULL) bNvidiaExtensionsSupported = false; + pglCombinerInputNV = (PFUNCGLCOMBINERINPUTNVPROC) CoreVideo_GL_GetProcAddress("glCombinerInputNV"); + if (pglCombinerInputNV == NULL) bNvidiaExtensionsSupported = false; + pglCombinerParameteriNV = (PFUNCGLCOMBINERPARAMETERINVPROC) CoreVideo_GL_GetProcAddress("glCombinerParameteriNV"); + if (pglCombinerParameteriNV == NULL) bNvidiaExtensionsSupported = false; INIT_ENTRY_POINT(PFUNCGLACTIVETEXTUREPROC, glActiveTexture); INIT_ENTRY_POINT(PFUNCGLACTIVETEXTUREARBPROC, glActiveTextureARB); diff --git a/src/OGLExtensions.h b/src/OGLExtensions.h index da9c985f5..2b3cdef6b 100644 --- a/src/OGLExtensions.h +++ b/src/OGLExtensions.h @@ -48,6 +48,7 @@ typedef void (APIENTRYP PFUNCGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GL typedef void (APIENTRYP PFUNCGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFUNCGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +extern bool bNvidiaExtensionsSupported; extern PFUNCGLCOMBINERPARAMETERFVNVPROC pglCombinerParameterfvNV; extern PFUNCGLFINALCOMBINERINPUTNVPROC pglFinalCombinerInputNV; extern PFUNCGLCOMBINEROUTPUTNVPROC pglCombinerOutputNV;