From 8172d78b1b8ac135f470e5658cf161a5dd20f804 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 21 Jun 2014 06:41:14 +0200 Subject: [PATCH] Don't enforce native fragment programs on modern hardware. Fixes water for the open source ATI/AMD driver, which reports fragment programs as not native (as they are translated to modern hardware). --- code/nel/src/3d/driver/opengl/driver_opengl.cpp | 5 +++++ .../src/3d/driver/opengl/driver_opengl_extension.cpp | 12 +++++++++++- .../src/3d/driver/opengl/driver_opengl_extension.h | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 3d6031caf..eb59f2205 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -483,6 +483,11 @@ bool CDriverGL::setupDisplay() glLightModeli((GLenum)GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT); #endif } + + if (_Extensions.ARBFragmentShader) + { + _ForceNativeFragmentPrograms = false; + } _VertexProgramEnabled= false; _PixelProgramEnabled= false; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 515d553aa..aee3e74bb 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -1249,6 +1249,15 @@ static bool setupNVFragmentProgram2(const char *glext) return true; } +// ********************************* +static bool setupARBFragmentShader(const char *glext) +{ + H_AUTO_OGL(setupNVFragmentProgram2); + CHECK_EXT("GL_ARB_fragment_shader"); + + return true; +} + // *************************************************************************** static bool setupARBVertexBufferObject(const char *glext) { @@ -1627,7 +1636,7 @@ void registerGlExtensions(CGlExtensions &ext) { ext.NVVertexProgram = setupNVVertexProgram(glext); ext.EXTVertexShader = setupEXTVertexShader(glext); - ext.ARBVertexProgram= setupARBVertexProgram(glext); + ext.ARBVertexProgram = setupARBVertexProgram(glext); } else { @@ -1642,6 +1651,7 @@ void registerGlExtensions(CGlExtensions &ext) { ext.ARBFragmentProgram = setupARBFragmentProgram(glext); ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext); + ext.ARBFragmentShader = setupARBFragmentShader(glext); } else { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h index 07599366c..dba5facfb 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h @@ -104,6 +104,7 @@ struct CGlExtensions bool ARBVertexProgram; bool ARBTextureNonPowerOfTwo; bool ARBMultisample; + bool ARBFragmentShader; // NV Pixel Programs bool NVFragmentProgram2; @@ -178,6 +179,7 @@ public: ARBTextureRectangle = false; ARBTextureNonPowerOfTwo = false; ARBMultisample = false; + ARBFragmentShader = false; NVOcclusionQuery = false; ARBOcclusionQuery = false; FrameBufferObject = false;