Removed NV Texture Shader related stuff.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
parent 6fba0c094a
commit 3aae79c38b

@ -256,8 +256,6 @@ CDriverGL3::CDriverGL3()
_SumTextureMemoryUsed = false; _SumTextureMemoryUsed = false;
_NVTextureShaderEnabled = false;
_AnisotropicFilter = 0.f; _AnisotropicFilter = 0.f;
// Compute the Flag which say if one texture has been changed in CMaterial. // Compute the Flag which say if one texture has been changed in CMaterial.
@ -422,11 +420,6 @@ bool CDriverGL3::setupDisplay()
// Default delta camera pos. // Default delta camera pos.
_PZBCameraPos= CVector::Null; _PZBCameraPos= CVector::Null;
if (_NVTextureShaderEnabled)
{
enableNVTextureShader(false);
}
// Be always in EXTSeparateSpecularColor. // Be always in EXTSeparateSpecularColor.
if(_Extensions.EXTSeparateSpecularColor) if(_Extensions.EXTSeparateSpecularColor)
{ {
@ -494,8 +487,6 @@ bool CDriverGL3::setupDisplay()
glTexGenfv(GL_Q, GL_EYE_PLANE, params); glTexGenfv(GL_Q, GL_EYE_PLANE, params);
} }
resetTextureShaders();
_PPLExponent = 1.f; _PPLExponent = 1.f;
_PPLightDiffuseColor = NLMISC::CRGBA::White; _PPLightDiffuseColor = NLMISC::CRGBA::White;
_PPLightSpecularColor = NLMISC::CRGBA::White; _PPLightSpecularColor = NLMISC::CRGBA::White;
@ -583,34 +574,6 @@ void CDriverGL3::disableHardwareTextureShader()
_Extensions.DisableHardwareTextureShader= true; _Extensions.DisableHardwareTextureShader= true;
} }
// --------------------------------------------------
void CDriverGL3::resetTextureShaders()
{
H_AUTO_OGL(CDriverGL3_resetTextureShaders);
if (_Extensions.NVTextureShader)
{
glEnable(GL_TEXTURE_SHADER_NV);
for (uint stage = 0; stage < inlGetNumTextStages(); ++stage)
{
_DriverGLStates.activeTextureARB(stage);
if (stage != 0)
{
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB + stage - 1);
}
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
_CurrentTexAddrMode[stage] = GL_NONE;
}
glDisable(GL_TEXTURE_SHADER_NV);
_NVTextureShaderEnabled = false;
}
}
// -------------------------------------------------- // --------------------------------------------------
bool CDriverGL3::isTextureExist(const ITexture&tex) bool CDriverGL3::isTextureExist(const ITexture&tex)
{ {
@ -678,7 +641,6 @@ bool CDriverGL3::swapBuffers()
++ _SwapBufferCounter; ++ _SwapBufferCounter;
// Reset texture shaders // Reset texture shaders
//resetTextureShaders();
activeVertexProgram(NULL); activeVertexProgram(NULL);
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
@ -738,11 +700,6 @@ bool CDriverGL3::swapBuffers()
//=========================================================== //===========================================================
// Same reasoning as textures :) // Same reasoning as textures :)
_DriverGLStates.forceDefaults(inlGetNumTextStages()); _DriverGLStates.forceDefaults(inlGetNumTextStages());
if (_NVTextureShaderEnabled)
{
glDisable(GL_TEXTURE_SHADER_NV);
_NVTextureShaderEnabled = false;
}
_CurrentMaterial= NULL; _CurrentMaterial= NULL;
@ -1236,15 +1193,6 @@ uint32 CDriverGL3::getUsedTextureMemory() const
} }
// ***************************************************************************
bool CDriverGL3::supportTextureShaders() const
{
H_AUTO_OGL(CDriverGL3_supportTextureShaders)
// fully supported by NV_TEXTURE_SHADER
return _Extensions.NVTextureShader;
}
// *************************************************************************** // ***************************************************************************
bool CDriverGL3::isWaterShaderSupported() const bool CDriverGL3::isWaterShaderSupported() const
{ {
@ -1252,26 +1200,10 @@ bool CDriverGL3::isWaterShaderSupported() const
if(_Extensions.ARBFragmentProgram && ARBWaterShader[0] != 0) return true; if(_Extensions.ARBFragmentProgram && ARBWaterShader[0] != 0) return true;
if (!_Extensions.NVTextureShader && !_Extensions.ATIFragmentShader && !_Extensions.ARBFragmentProgram) return false; if ( !_Extensions.ATIFragmentShader && !_Extensions.ARBFragmentProgram) return false;
return true; return true;
} }
// ***************************************************************************
bool CDriverGL3::isTextureAddrModeSupported(CMaterial::TTexAddressingMode /* mode */) const
{
H_AUTO_OGL(CDriverGL3_isTextureAddrModeSupported)
if (_Extensions.NVTextureShader)
{
// all the given addessing mode are supported with this extension
return true;
}
else
{
return false;
}
}
// *************************************************************************** // ***************************************************************************
void CDriverGL3::setMatrix2DForTextureOffsetAddrMode(const uint stage, const float mat[4]) void CDriverGL3::setMatrix2DForTextureOffsetAddrMode(const uint stage, const float mat[4])
{ {
@ -1286,25 +1218,6 @@ void CDriverGL3::setMatrix2DForTextureOffsetAddrMode(const uint stage, const flo
} }
// ***************************************************************************
void CDriverGL3::enableNVTextureShader(bool enabled)
{
H_AUTO_OGL(CDriverGL3_enableNVTextureShader)
if (enabled != _NVTextureShaderEnabled)
{
if (enabled)
{
glEnable(GL_TEXTURE_SHADER_NV);
}
else
{
glDisable(GL_TEXTURE_SHADER_NV);
}
_NVTextureShaderEnabled = enabled;
}
}
// *************************************************************************** // ***************************************************************************
void CDriverGL3::checkForPerPixelLightingSupport() void CDriverGL3::checkForPerPixelLightingSupport()
{ {

@ -586,11 +586,11 @@ public:
/// \name texture addressing modes /// \name texture addressing modes
// @{ // @{
virtual bool supportTextureShaders() const; virtual bool supportTextureShaders() const{ return false; };
virtual bool isWaterShaderSupported() const; virtual bool isWaterShaderSupported() const;
virtual bool isTextureAddrModeSupported(CMaterial::TTexAddressingMode mode) const; virtual bool isTextureAddrModeSupported(CMaterial::TTexAddressingMode mode) const{ return false; };
virtual void setMatrix2DForTextureOffsetAddrMode(const uint stage, const float mat[4]); virtual void setMatrix2DForTextureOffsetAddrMode(const uint stage, const float mat[4]);
// @} // @}
@ -930,14 +930,6 @@ private:
CTexEnvSpecial _CurrentTexEnvSpecial[IDRV_MAT_MAXTEXTURES]; CTexEnvSpecial _CurrentTexEnvSpecial[IDRV_MAT_MAXTEXTURES];
// Texture addressing mode // Texture addressing mode
GLenum _CurrentTexAddrMode[IDRV_MAT_MAXTEXTURES]; GLenum _CurrentTexAddrMode[IDRV_MAT_MAXTEXTURES];
// Reset texture shaders to their initial state if they are used
void resetTextureShaders();
/** set texture shaders from stage 0 to stage IDRV_MAT_MAXTEXTURES - 1
* textures are needed to setup the right kind of shader (cubic or 2d texture)
*/
void setTextureShaders(const uint8 *addressingModes, const NLMISC::CSmartPtr<ITexture> *textures);
// activation of texture shaders
bool _NVTextureShaderEnabled;
// Which stages support EMBM // Which stages support EMBM
bool _StageSupportEMBM[IDRV_MAT_MAXTEXTURES]; bool _StageSupportEMBM[IDRV_MAT_MAXTEXTURES];
// Anisotropic filtering value // Anisotropic filtering value
@ -1029,12 +1021,6 @@ private:
forceActivateTexEnvColor(stage, env.ConstantColor); forceActivateTexEnvColor(stage, env.ConstantColor);
} }
/// nv texture shaders. Should be used only if this caps is present!
void enableNVTextureShader(bool enabled);
// check nv texture shader consistency
void verifyNVTextureShaderConfig();
// Called by doRefreshRenderSetup(). set _LightSetupDirty to false // Called by doRefreshRenderSetup(). set _LightSetupDirty to false
void cleanLightSetup (); void cleanLightSetup ();
@ -1375,7 +1361,6 @@ private:
void setupWaterPassR200(const CMaterial &mat); void setupWaterPassR200(const CMaterial &mat);
void setupWaterPassARB(const CMaterial &mat); void setupWaterPassARB(const CMaterial &mat);
void setupWaterPassNV20(const CMaterial &mat);
// @} // @}

@ -606,23 +606,6 @@ static bool setupWGLARBPixelFormat (const char *glext)
} }
#endif #endif
// *********************************
static bool setupNVTextureShader(const char *glext)
{
H_AUTO_OGL(setupNVTextureShader);
// reenabled to allow bloom on mac, TODO: cleanly fix the water issue
// i think this issue was mtp target related - is this the case in ryzom too?
// #ifdef NL_OS_MAC
// // Water doesn't render on GeForce 8600M GT (on MAC OS X) if this extension is enabled
// return false;
// #endif
CHECK_EXT("GL_NV_texture_shader");
return true;
}
// ********************************* // *********************************
static bool setupEXTBlendColor(const char *glext) static bool setupEXTBlendColor(const char *glext)
{ {
@ -969,7 +952,6 @@ void registerGlExtensions(CGlExtensions &ext)
// Disable feature ??? // Disable feature ???
if(!ext.DisableHardwareTextureShader) if(!ext.DisableHardwareTextureShader)
{ {
ext.NVTextureShader = setupNVTextureShader(glext);
ext.ATIEnvMapBumpMap = setupATIEnvMapBumpMap(glext); ext.ATIEnvMapBumpMap = setupATIEnvMapBumpMap(glext);
ext.ATIFragmentShader = setupATIFragmentShader(glext); ext.ATIFragmentShader = setupATIFragmentShader(glext);
ext.ARBFragmentProgram = setupARBFragmentProgram(glext); ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
@ -977,7 +959,6 @@ void registerGlExtensions(CGlExtensions &ext)
else else
{ {
ext.ATIEnvMapBumpMap = false; ext.ATIEnvMapBumpMap = false;
ext.NVTextureShader = false;
ext.ATIFragmentShader = false; ext.ATIFragmentShader = false;
ext.ARBFragmentProgram = false; ext.ARBFragmentProgram = false;
} }

@ -46,7 +46,6 @@ struct CGlExtensions
bool EXTSeparateSpecularColor; bool EXTSeparateSpecularColor;
bool NVTextureEnvCombine4; bool NVTextureEnvCombine4;
bool ARBTextureCubeMap; bool ARBTextureCubeMap;
bool NVTextureShader;
bool NVOcclusionQuery; bool NVOcclusionQuery;
bool NVTextureRectangle; bool NVTextureRectangle;
bool EXTTextureRectangle; bool EXTTextureRectangle;
@ -107,7 +106,6 @@ public:
ATITextureEnvCombine3= false; ATITextureEnvCombine3= false;
ATIXTextureEnvRoute= false; ATIXTextureEnvRoute= false;
ARBTextureCubeMap= false; ARBTextureCubeMap= false;
NVTextureShader= false;
EXTSecondaryColor= false; EXTSecondaryColor= false;
WGLARBPBuffer= false; WGLARBPBuffer= false;
WGLARBPixelFormat= false; WGLARBPixelFormat= false;
@ -162,7 +160,6 @@ public:
result += NLMISC::toString(NbTextureStages); result += NLMISC::toString(NbTextureStages);
result += "\n Programs: "; result += "\n Programs: ";
result += NVTextureShader ? "NVTextureShader " : "";
result += ATIFragmentShader ? "ATIFragmentShader " : ""; result += ATIFragmentShader ? "ATIFragmentShader " : "";
result += ARBFragmentProgram ? "ARBFragmentProgram " : ""; result += ARBFragmentProgram ? "ARBFragmentProgram " : "";
result += "ARBVertexProgram"; result += "ARBVertexProgram";

@ -229,24 +229,6 @@ CMaterial::TShader CDriverGL3::getSupportedShader(CMaterial::TShader shader)
} }
} }
// --------------------------------------------------
void CDriverGL3::setTextureShaders(const uint8 *addressingModes, const CSmartPtr<ITexture> *textures)
{
H_AUTO_OGL(CDriverGL3_setTextureShaders)
GLenum glAddrMode;
for (uint stage = 0; stage < IDRV_MAT_MAXTEXTURES; ++stage)
{
convTexAddr(textures[stage], (CMaterial::TTexAddressingMode) addressingModes[stage], glAddrMode);
if (glAddrMode != _CurrentTexAddrMode[stage]) // addressing mode different from the one in the device?
{
_DriverGLStates.activeTextureARB(stage);
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, glAddrMode);
_CurrentTexAddrMode[stage] = glAddrMode;
}
}
}
// -------------------------------------------------- // --------------------------------------------------
bool CDriverGL3::setupMaterial(CMaterial& mat) bool CDriverGL3::setupMaterial(CMaterial& mat)
{ {
@ -480,31 +462,6 @@ bool CDriverGL3::setupMaterial(CMaterial& mat)
_DriverGLStates.enableFog(_FogEnabled); _DriverGLStates.enableFog(_FogEnabled);
} }
// Texture shader part.
//=====================
if (_Extensions.NVTextureShader)
{
if (matShader == CMaterial::Normal)
{
// Texture addressing modes (support only via NVTextureShader for now)
//===================================================================
if ( mat.getFlags() & IDRV_MAT_TEX_ADDR )
{
enableNVTextureShader(true);
setTextureShaders(&mat._TexAddrMode[0], &mat._Textures[0]);
}
else
{
enableNVTextureShader(false);
}
}
else
{
enableNVTextureShader(false);
}
}
_CurrentMaterial=&mat; _CurrentMaterial=&mat;
} }
@ -2149,97 +2106,6 @@ static const uint8 WaterTexAddrMode[IDRV_MAT_MAXTEXTURES] =
static const float IdentityTexMat[4] = { 1.f, 0.f, 0.f, 1.f }; static const float IdentityTexMat[4] = { 1.f, 0.f, 0.f, 1.f };
// ***************************************************************************
void CDriverGL3::setupWaterPassNV20(const CMaterial &mat)
{
H_AUTO_OGL(CDriverGL3_setupWaterPassNV20);
static bool setupDone = false;
static CMaterial::CTexEnv texEnvReplace;
static CMaterial::CTexEnv texEnvModulate;
if (!setupDone)
{
texEnvReplace.Env.OpRGB = CMaterial::Replace;
texEnvReplace.Env.OpAlpha = CMaterial::Replace;
// use default setup for texenv modulate
setupDone = true;
}
// activate the textures & set the matrixs
ITexture *tex = mat.getTexture(0);
if (tex)
{
setupTexture(*tex);
activateTexture(0, tex);
_DriverGLStates.activeTextureARB(1);
if (tex->isBumpMap())
{
CTextureBump *tb = static_cast<CTextureBump *>(tex);
// set the matrix for the texture shader
float factor = tb->getNormalizationFactor();
float tsMatrix[4] = { 0.25f * factor, 0.f, 0.f, 0.25f * factor };
glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, tsMatrix);
}
else
{
glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, IdentityTexMat);
}
}
tex = mat.getTexture(1);
if (tex)
{
setupTexture(*tex);
activateTexture(1, tex);
_DriverGLStates.activeTextureARB(2);
if (tex->isBumpMap())
{
CTextureBump *tb = static_cast<CTextureBump *>(tex);
// set the matrix for the texture shader
float factor = tb->getNormalizationFactor();
float tsMatrix[4] = { factor, 0.f, 0.f, factor };
glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, tsMatrix);
}
else
{
glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, IdentityTexMat);
}
}
tex = mat.getTexture(2);
if (tex)
{
setupTexture(*tex);
activateTexture(2, tex);
}
tex = mat.getTexture(3);
if (tex)
{
setupTexture(*tex);
activateTexture(3, tex);
}
for (uint k = 4; k < inlGetNumTextStages(); ++k)
{
activateTexture(k, NULL);
}
// setup the texture shaders
enableNVTextureShader(true);
activateTexEnvMode(0, texEnvReplace);
activateTexEnvMode(1, texEnvReplace);
nlctassert(IDRV_MAT_MAXTEXTURES == 4); // if this value changes, may have to change the arrays WaterNoDiffuseTexAddrMode & WaterTexAddrMode
if (mat.getTexture(3) == NULL)
{
setTextureShaders(WaterNoDiffuseTexAddrMode, mat._Textures);
activateTexEnvMode(2, texEnvReplace);
}
else
{
setTextureShaders(WaterTexAddrMode, mat._Textures);
activateTexEnvMode(2, texEnvReplace);
activateTexEnvMode(3, texEnvModulate);
}
}
// *************************************************************************** // ***************************************************************************
void CDriverGL3::setupWaterPass(uint /* pass */) void CDriverGL3::setupWaterPass(uint /* pass */)
{ {
@ -2248,11 +2114,7 @@ void CDriverGL3::setupWaterPass(uint /* pass */)
CMaterial &mat = *_CurrentMaterial; CMaterial &mat = *_CurrentMaterial;
nlassert(_CurrentMaterial->getShader() == CMaterial::Water); nlassert(_CurrentMaterial->getShader() == CMaterial::Water);
if (_Extensions.NVTextureShader) if (ARBWaterShader[0])
{
setupWaterPassNV20(mat);
}
else if (ARBWaterShader[0])
{ {
setupWaterPassARB(mat); setupWaterPassARB(mat);
} }
@ -2269,7 +2131,6 @@ void CDriverGL3::endWaterMultiPass()
nlassert(_CurrentMaterial->getShader() == CMaterial::Water); nlassert(_CurrentMaterial->getShader() == CMaterial::Water);
// NB : as fragment shaders / programs bypass the texture envs, no special env enum is added (c.f CTexEnvSpecial) // NB : as fragment shaders / programs bypass the texture envs, no special env enum is added (c.f CTexEnvSpecial)
if (_Extensions.NVTextureShader) return;
if (ARBWaterShader[0]) if (ARBWaterShader[0])
{ {
glDisable(GL_FRAGMENT_PROGRAM_ARB); glDisable(GL_FRAGMENT_PROGRAM_ARB);

@ -371,8 +371,7 @@ GLint CDriverGL3::getGlTextureFormat(ITexture& tex, bool &compressed)
case ITexture::Alpha: return GL_ALPHA8; case ITexture::Alpha: return GL_ALPHA8;
case ITexture::AlphaLuminance: return GL_LUMINANCE8_ALPHA8; case ITexture::AlphaLuminance: return GL_LUMINANCE8_ALPHA8;
case ITexture::DsDt: case ITexture::DsDt:
if (_Extensions.NVTextureShader) return GL_DSDT_NV; if (_Extensions.ATIEnvMapBumpMap || _Extensions.ATIFragmentShader)
else if (_Extensions.ATIEnvMapBumpMap || _Extensions.ATIFragmentShader)
{ {
return GL_DU8DV8_ATI; return GL_DU8DV8_ATI;
} }

Loading…
Cancel
Save