GL3: Cleanup

--HG--
branch : opengl3
hg/feature/opengl3
kaetemi 11 years ago
parent a37d7a3127
commit 9df1935f5e

@ -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;
}
// ***************************************************************************

@ -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;

@ -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
{
@ -618,7 +618,7 @@ 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);
@ -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<inlGetNumTextStages(); stage++)
for (uint stage= 0; stage<IDRV_MAT_MAXTEXTURES; stage++)
{
// if must setup a lightmap stage.
if (stage<nstages-1)
@ -1016,7 +1016,7 @@ void CDriverGL3::setupPPLPass(uint pass)
activateTexture(1, mat.getTexture(0));
activateTexture(2, tex2);*/
/*for (uint k = 3; k < inlGetNumTextStages(); ++k)
/*for (uint k = 3; k < IDRV_MAT_MAXTEXTURES; ++k)
{
activateTexture(k, NULL);
}*/
@ -1076,7 +1076,7 @@ void CDriverGL3::setupPPLNoSpecPass(uint pass)
/* activateTexture(0, tex0);
activateTexture(1, mat.getTexture(0));
*/
/*for (uint k = 2; k < inlGetNumTextStages(); ++k)
/*for (uint k = 2; k < IDRV_MAT_MAXTEXTURES; ++k)
{
activateTexture(k, NULL);
}*/
@ -1175,7 +1175,7 @@ void CDriverGL3::setupWaterPass(uint /* pass */)
setupTexture(*tex);
activateTexture(3, tex);
}
for (k = 4; k < inlGetNumTextStages(); ++k)
for (k = 4; k < IDRV_MAT_MAXTEXTURES; ++k)
{
activateTexture(k, NULL);
}

@ -725,7 +725,7 @@ bool CDriverGL3::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded
But this is grave only if a new texture is created, with the same pointer (bad luck).
Since an newly allocated texture always pass here before use, we are sure to avoid any problems.
*/
for (uint stage = 0; stage < inlGetNumTextStages(); stage++)
for (uint stage = 0; stage < IDRV_MAT_MAXTEXTURES; stage++)
{
activateTexture(stage, NULL);
}
@ -1468,7 +1468,7 @@ void CDriverGL3::swapTextureHandle(ITexture &tex0, ITexture &tex1)
setupTexture(tex1);
// avoid any problem, disable all textures
for (uint stage = 0; stage < inlGetNumTextStages(); stage++)
for (uint stage = 0; stage < IDRV_MAT_MAXTEXTURES; stage++)
{
activateTexture(stage, NULL);
}

Loading…
Cancel
Save