From 673cd93bc9965457d40ef00d16bf18ed87793632 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 20 Dec 2010 16:48:03 +0100 Subject: [PATCH] Changed: #573 Added new checks for FBO extensions and multisample --- .../driver/opengl/driver_opengl_extension.cpp | 66 +++++++++++++++++++ .../driver/opengl/driver_opengl_extension.h | 27 +++++++- 2 files changed, 91 insertions(+), 2 deletions(-) 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 482740c2c..404ec215a 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -417,6 +417,17 @@ NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC nglRenderbufferStorageEXT; NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC nglFramebufferRenderbufferEXT; NEL_PFNGLDELETERENDERBUFFERSEXTPROC nglDeleteRenderbuffersEXT; NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC nglDeleteFramebuffersEXT; +NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC nglGetRenderbufferParameterivEXT; +NEL_PFNGENERATEMIPMAPEXTPROC nglGenerateMipmapEXT; + +// GL_EXT_framebuffer_blit +NEL_PFNGLBLITFRAMEBUFFEREXTPROC nglBlitFramebufferEXT; + +// GL_EXT_framebuffer_multisample +NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMultisampleEXT; + +// GL_ARB_multisample +NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB; #ifdef NL_OS_WINDOWS PFNWGLALLOCATEMEMORYNVPROC nwglAllocateMemoryNV; @@ -889,6 +900,17 @@ static bool setupWGLARBPBuffer(const char *glext) return true; } +// ********************************* +static bool setupARBMultisample(const char *glext) +{ + H_AUTO_OGL(setupARBMultisample); + CHECK_EXT("GL_ARB_multisample"); + + CHECK_ADDRESS(NEL_PFNGLSAMPLECOVERAGEARBPROC, glSampleCoverageARB); + + return true; +} + #ifdef NL_OS_WINDOWS // ********************************* static bool setupWGLARBPixelFormat (const char *glext) @@ -1188,6 +1210,14 @@ static bool setupARBTextureRectangle(const char *glext) return true; } +// *************************************************************************** +static bool setupEXTTextureFilterAnisotropic(const char *glext) +{ + H_AUTO_OGL(setupEXTTextureFilterAnisotropic); + CHECK_EXT("GL_EXT_texture_filter_anisotropic"); + return true; +} + // *************************************************************************** static bool setupFrameBufferObject(const char *glext) { @@ -1206,6 +1236,30 @@ static bool setupFrameBufferObject(const char *glext) CHECK_ADDRESS(NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC, glFramebufferRenderbufferEXT); CHECK_ADDRESS(NEL_PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT); CHECK_ADDRESS(NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC, glDeleteFramebuffersEXT); + CHECK_ADDRESS(NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC, glGetRenderbufferParameterivEXT); + CHECK_ADDRESS(NEL_PFNGENERATEMIPMAPEXTPROC, glGenerateMipmapEXT); + + return true; +} + +// *************************************************************************** +static bool setupFrameBufferBlit(const char *glext) +{ + H_AUTO_OGL(setupFrameBufferBlit); + CHECK_EXT("GL_EXT_framebuffer_blit"); + + CHECK_ADDRESS(NEL_PFNGLBLITFRAMEBUFFEREXTPROC, glBlitFramebufferEXT); + + return true; +} + +// *************************************************************************** +static bool setupFrameBufferMultisample(const char *glext) +{ + H_AUTO_OGL(setupFrameBufferMultisample); + CHECK_EXT("GL_EXT_framebuffer_multisample"); + + CHECK_ADDRESS(NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC, glRenderbufferStorageMultisampleEXT); return true; } @@ -1268,6 +1322,9 @@ void registerGlExtensions(CGlExtensions &ext) // Check ARBTextureNonPowerOfTwo ext.ARBTextureNonPowerOfTwo= setupARBTextureNonPowerOfTwo(glext); + // Check ARBMultisample + ext.ARBMultisample = setupARBMultisample(glext); + // Check NVVertexArrayRange // Disable feature ??? if(!ext.DisableHardwareVertexArrayAGP) @@ -1360,9 +1417,18 @@ void registerGlExtensions(CGlExtensions &ext) // Check GL_ARB_texture_rectangle ext.ARBTextureRectangle = setupARBTextureRectangle(glext); + // Check GL_EXT_texture_filter_anisotropic + ext.EXTTextureFilterAnisotropic = setupEXTTextureFilterAnisotropic(glext); + // Check GL_EXT_framebuffer_object ext.FrameBufferObject = setupFrameBufferObject(glext); + // Check GL_EXT_framebuffer_blit + ext.FrameBufferBlit = setupFrameBufferBlit(glext); + + // Check GL_EXT_framebuffer_multisample + ext.FrameBufferMultisample = setupFrameBufferMultisample(glext); + // Check GL_EXT_packed_depth_stencil ext.PackedDepthStencil = setupPackedDepthStencil(glext); 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 1c9cc0967..670ecd84b 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h @@ -80,7 +80,10 @@ struct CGlExtensions bool EXTTextureRectangle; bool ARBTextureRectangle; bool FrameBufferObject; + bool FrameBufferBlit; + bool FrameBufferMultisample; bool PackedDepthStencil; + bool EXTTextureFilterAnisotropic; // true if NVVertexProgram and if we know that VP is emulated bool NVVertexProgramEmulated; bool EXTSecondaryColor; @@ -114,6 +117,7 @@ struct CGlExtensions bool ARBVertexBufferObject; bool ARBVertexProgram; bool ARBTextureNonPowerOfTwo; + bool ARBMultisample; public: @@ -165,10 +169,14 @@ public: ARBVertexProgram = false; NVTextureRectangle = false; EXTTextureRectangle = false; + EXTTextureFilterAnisotropic = false; ARBTextureRectangle = false; ARBTextureNonPowerOfTwo = false; + ARBMultisample = false; NVOcclusionQuery = false; FrameBufferObject = false; + FrameBufferBlit = false; + FrameBufferMultisample = false; PackedDepthStencil = false; NVVertexArrayRange2 = false; NVStateVARWithoutFlush = 0; @@ -177,7 +185,7 @@ public: DisableHardwareVertexProgram= false; DisableHardwareVertexArrayAGP= false; DisableHardwareTextureShader= false; - }; + } std::string toString() { @@ -198,6 +206,7 @@ public: result += NVTextureRectangle ? "NVTextureRectangle " : ""; result += EXTTextureRectangle ? "EXTTextureRectangle " : ""; result += ARBTextureRectangle ? "ARBTextureRectangle " : ""; + result += EXTTextureFilterAnisotropic ? "EXTTextureFilterAnisotropic " : ""; result += ARBTextureNonPowerOfTwo ? "ARBTextureNonPowerOfTwo " : ""; result += "texture stages(*) = "; result += NLMISC::toString(NbTextureStages); @@ -218,6 +227,7 @@ public: result += EXTBlendColor ? "EXTBlendColor " : ""; result += NVOcclusionQuery ? "NVOcclusionQuery " : ""; result += NVStateVARWithoutFlush ? "NVStateVARWithoutFlush " : ""; + result += ARBMultisample ? "ARBMultisample " : ""; #ifdef NL_OS_WINDOWS result += "\n WindowsGL: "; @@ -241,6 +251,8 @@ public: result += "\n FBO: "; result += FrameBufferObject ? "FramebufferObject " : ""; + result += FrameBufferBlit ? "FrameBufferBlit " : ""; + result += FrameBufferMultisample ? "FrameBufferMultisample " : ""; result += PackedDepthStencil ? "PackedDepthStencil " : ""; return result; @@ -329,6 +341,7 @@ extern NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC nglGetCompressedTexImageARB; //==================== extern NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC nglFlushVertexArrayRangeNV; extern NEL_PFNGLVERTEXARRAYRANGENVPROC nglVertexArrayRangeNV; + #ifdef NL_OS_WINDOWS extern PFNWGLALLOCATEMEMORYNVPROC nwglAllocateMemoryNV; extern PFNWGLFREEMEMORYNVPROC nwglFreeMemoryNV; @@ -712,6 +725,16 @@ extern NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC nglRenderbufferStorageEXT; extern NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC nglFramebufferRenderbufferEXT; extern NEL_PFNGLDELETERENDERBUFFERSEXTPROC nglDeleteRenderbuffersEXT; extern NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC nglDeleteFramebuffersEXT; +extern NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC nglGetRenderbufferParameterivEXT; +extern NEL_PFNGENERATEMIPMAPEXTPROC nglGenerateMipmapEXT; + +// GL_EXT_framebuffer_blit +extern NEL_PFNGLBLITFRAMEBUFFEREXTPROC nglBlitFramebufferEXT; + +// GL_EXT_framebuffer_multisample +extern NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMultisampleEXT; + +// GL_ARB_multisample +extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB; #endif // NL_OPENGL_EXTENSION_H -