diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp index 7434906ff..c73e1278d 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.cpp @@ -387,7 +387,7 @@ bool CDriverGL3::setupDisplay() _CurrScissor.initFullScreen(); _ForceNormalize = false; // Setup defaults for blend, lighting ... - _DriverGLStates.forceDefaults(inlGetNumTextStages()); + _DriverGLStates.forceDefaults(IDRV_MAT_MAXTEXTURES); // Default delta camera pos. _PZBCameraPos = CVector::Null; @@ -411,7 +411,7 @@ bool CDriverGL3::setupDisplay() // Activate the default texture environnments for all stages. //=========================================================== - for (uint stage = 0; stage < inlGetNumTextStages(); ++stage) + for (uint stage = 0; stage < IDRV_MAT_MAXTEXTURES; ++stage) { // init no texture. _CurrentTexture[stage] = NULL; @@ -613,7 +613,7 @@ bool CDriverGL3::swapBuffers() //=========================================================== // This is not a requirement, but it ensure a more stable state each frame. // (well, maybe the good reason is "it hides much more the bugs" :o)). - for (uint stage = 0; stage < inlGetNumTextStages(); ++stage) + for (uint stage = 0; stage < IDRV_MAT_MAXTEXTURES; ++stage) { // init no texture. _CurrentTexture[stage]= NULL; @@ -625,7 +625,7 @@ bool CDriverGL3::swapBuffers() // Activate the default material. //=========================================================== // Same reasoning as textures :) - _DriverGLStates.forceDefaults(inlGetNumTextStages()); + _DriverGLStates.forceDefaults(IDRV_MAT_MAXTEXTURES); _CurrentMaterial= NULL; @@ -1132,7 +1132,7 @@ void CDriverGL3::setMatrix2DForTextureOffsetAddrMode(const uint stage, const flo if (!supportTextureShaders()) return; //nlassert(supportTextureShaders()); - nlassert(stage < inlGetNumTextStages()); + nlassert(stage < IDRV_MAT_MAXTEXTURES); _DriverGLStates.activeTexture(stage); //glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat); @@ -1187,7 +1187,7 @@ NLMISC::CRGBA CDriverGL3::getBlendConstantColor() const uint CDriverGL3::getNbTextureStages() const { H_AUTO_OGL(CDriverGL3_getNbTextureStages) - return inlGetNumTextStages(); + return IDRV_MAT_MAXTEXTURES; } // *************************************************************************** @@ -1807,8 +1807,8 @@ void CDriverGL3::stencilMask(uint mask) // *************************************************************************** void CDriverGL3::getNumPerStageConstant(uint &lightedMaterial, uint &unlightedMaterial) const { - lightedMaterial = inlGetNumTextStages(); - unlightedMaterial = inlGetNumTextStages(); + lightedMaterial = IDRV_MAT_MAXTEXTURES; + unlightedMaterial = IDRV_MAT_MAXTEXTURES; } // *************************************************************************** diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl.h b/code/nel/src/3d/driver/opengl3/driver_opengl.h index 4c076196f..8287ed0dc 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl3/driver_opengl.h @@ -1288,9 +1288,6 @@ private: static void initCausticCubeMap(); // @} - /// Same as getNbTextureStages(), but faster because inline, and not virtual!! - uint inlGetNumTextStages() const { return _Extensions.NbFragmentTextureUnits; } - NLMISC::CRGBA _CurrentBlendConstantColor; diff --git a/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp index e935670c6..ec0835d1e 100644 --- a/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl3/driver_opengl_material.cpp @@ -328,7 +328,7 @@ bool CDriverGL3::setupMaterial(CMaterial& mat) // because setupTexture() may disable all stage. if (matShader != CMaterial::Water && matShader != CMaterial::Program) { - for (uint stage = 0; stage < inlGetNumTextStages(); ++stage) + for (uint stage = 0; stage < IDRV_MAT_MAXTEXTURES; ++stage) { ITexture *text = mat.getTexture(uint8(stage)); if (text != NULL && !setupTexture(*text)) @@ -366,7 +366,7 @@ bool CDriverGL3::setupMaterial(CMaterial& mat) && matShader != CMaterial::Water ) { - uint maxTex = matShader == CMaterial::Specular ? 2 : inlGetNumTextStages(); + uint maxTex = matShader == CMaterial::Specular ? 2 : IDRV_MAT_MAXTEXTURES; for (uint stage = 0; stage < maxTex; ++stage) { ITexture *text = mat.getTexture(uint8(stage)); @@ -471,7 +471,7 @@ bool CDriverGL3::setupMaterial(CMaterial& mat) // Textures user matrix if (matShader == CMaterial::Normal) { - setupUserTextureMatrix(inlGetNumTextStages(), mat); + setupUserTextureMatrix(IDRV_MAT_MAXTEXTURES, mat); } else // deactivate texture matrix { @@ -602,7 +602,7 @@ void CDriverGL3::computeLightMapInfos (const CMaterial &mat) static const uint32 RGBMaskPacked = CRGBA(255,255,255,0).getPacked(); // For optimisation consideration, suppose there is not too much lightmap. - nlassert(mat._LightMaps.size()<=NL3D_DRV_MAX_LIGHTMAP); + nlassert(mat._LightMaps.size() <= NL3D_DRV_MAX_LIGHTMAP); // Compute number of lightmaps really used (ie factor not NULL), and build the LUT. _NLightMaps = 0; @@ -618,10 +618,10 @@ void CDriverGL3::computeLightMapInfos (const CMaterial &mat) } // Compute how many pass, according to driver caps. - _NLightMapPerPass = inlGetNumTextStages()-1; + _NLightMapPerPass = IDRV_MAT_MAXTEXTURES - 1; // Number of pass. - _NLightMapPass = (_NLightMaps + _NLightMapPerPass-1)/(_NLightMapPerPass); + _NLightMapPass = (_NLightMaps + _NLightMapPerPass - 1) / (_NLightMapPerPass); // NB: _NLightMaps==0 means there is no lightmaps at all. } @@ -694,7 +694,7 @@ void CDriverGL3::setupLightMapPass(uint pass) // setTexGenModeVP(0, TexGenDisabled); // FIXME GL3 // And disable other stages. - for (uint stage = 1; stage < inlGetNumTextStages(); stage++) + for (uint stage = 1; stage < IDRV_MAT_MAXTEXTURES; stage++) { // disable texturing. activateTexture(stage, NULL); @@ -743,7 +743,7 @@ void CDriverGL3::setupLightMapPass(uint pass) } // setup all stages. - for (uint stage= 0; stage