diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.h b/code/nel/src/3d/driver/opengl3/driver_opengl.h index 21f168edd..b8282db97 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.h @@ -1340,7 +1340,7 @@ private: // @} /// Same as getNbTextureStages(), but faster because inline, and not virtual!! - uint inlGetNumTextStages() const { return _Extensions.NbTextureStages; } + uint inlGetNumTextStages() const { return _Extensions.NbFragmentTextureUnits; } NLMISC::CRGBA _CurrentBlendConstantColor; diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl_extension.cpp index 2a70633df..e828aa619 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_extension.cpp @@ -835,17 +835,14 @@ void registerGlExtensions(CGlExtensions &ext) glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &ext.EXTTextureFilterAnisotropicMaximum); } + GLint nbFragmentTextureUnits; + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &nbFragmentTextureUnits); + ext.NbFragmentTextureUnits = (nbFragmentTextureUnits > IDRV_MAT_MAXTEXTURES) ? IDRV_MAT_MAXTEXTURES : nbFragmentTextureUnits; // FIXME GL3 + // --- // Check ARBMultiTexture ext.ARBMultiTexture= setupARBMultiTexture(glext); - if (ext.ARBMultiTexture) - { - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &ntext); - // We could have more than IDRV_MAT_MAXTEXTURES but the interface only - // support IDRV_MAT_MAXTEXTURES texture stages so take min - ext.NbTextureStages= (ntext<((GLint)IDRV_MAT_MAXTEXTURES)?ntext:IDRV_MAT_MAXTEXTURES); - } // Check ARBMultisample ext.ARBMultisample = setupARBMultisample(glext); diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_extension.h b/code/nel/src/3d/driver/opengl3/driver_opengl_extension.h index dc40b7af0..954fe8c32 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_extension.h @@ -38,6 +38,7 @@ struct CGlExtensions // Required extensions bool GLCore; bool ARBSeparateShaderObjects; + uint NbFragmentTextureUnits; // Optional extensions bool EXTTextureCompressionS3TC; @@ -46,7 +47,7 @@ struct CGlExtensions // Required Extensions. (old) bool ARBMultiTexture; - uint NbTextureStages; + // uint NbTextureStages; // Optional Extensions. (old) bool EXTSecondaryColor; @@ -67,20 +68,26 @@ public: CGlExtensions() { // Fill all false by default. + GLCore = false; + ARBSeparateShaderObjects = false; + NbFragmentTextureUnits = 0; + + EXTTextureCompressionS3TC = false; + EXTTextureFilterAnisotropic = false; + EXTTextureFilterAnisotropicMaximum = 0.f; + ARBMultiTexture= false; - NbTextureStages= 1; - EXTTextureCompressionS3TC= false; EXTSecondaryColor= false; - WGLARBPBuffer= false; - WGLARBPixelFormat= false; - WGLEXTSwapControl= false; - GLXEXTSwapControl= false; - GLXSGISwapControl= false; - GLXMESASwapControl= false; EXTBlendColor= false; - EXTTextureFilterAnisotropic = false; - EXTTextureFilterAnisotropicMaximum = 0.f; ARBMultisample = false; + + WGLARBPBuffer = false; + WGLARBPixelFormat = false; + WGLEXTSwapControl = false; + + GLXEXTSwapControl = false; + GLXSGISwapControl = false; + GLXMESASwapControl = false; } std::string toString() @@ -89,12 +96,16 @@ public: result += GLVersion; result += "; Available extensions:"; + result += "\n Required: "; + result += GLCore ? "GLCore " : ""; + result += ARBSeparateShaderObjects ? "ARBSeparateShaderObjects " : ""; + result += "\n Texturing: "; result += ARBMultiTexture ? "ARBMultiTexture " : ""; result += EXTTextureCompressionS3TC ? "EXTTextureCompressionS3TC " : ""; result += EXTTextureFilterAnisotropic ? "EXTTextureFilterAnisotropic (Maximum = " + NLMISC::toString(EXTTextureFilterAnisotropicMaximum) + ") " : ""; result += "texture stages(*) = "; - result += NLMISC::toString(NbTextureStages); + result += NLMISC::toString(NbFragmentTextureUnits); result += "\n Misc: "; result += EXTSecondaryColor ? "EXTSecondaryColor " : "";