Reworks the $Core::commonShaderPath variable usage to be a static variable in ShaderGen for efficiency(only one getVariable when shadergen is initialized), as well as implements the ability to set a default value, and ensures that it tries to set a path even if the pref variable is missing which is important for ported projects from older builds.

This commit is contained in:
Areloch 2017-07-24 00:40:27 -05:00
parent 3d7c1bbbf7
commit 7567ca10c3
17 changed files with 65 additions and 55 deletions

View file

@ -35,6 +35,8 @@
#include "lighting/advanced/advancedLightBinManager.h"
#include "ts/tsShape.h"
#include "shaderGen/shaderGen.h"
LangElement * ShaderFeatureGLSL::setupTexSpaceMat( Vector<ShaderComponent*> &, // componentList
Var **texSpaceMat )
{
@ -830,7 +832,7 @@ Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
//****************************************************************************
DiffuseMapFeatGLSL::DiffuseMapFeatGLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl"))
: mTorqueDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl"))
{
addDependency(&mTorqueDep);
}
@ -1951,7 +1953,7 @@ void ReflectCubeFeatGLSL::setTexData( Material::StageData &stageDat,
//****************************************************************************
RTLightingFeatGLSL::RTLightingFeatGLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/lighting.glsl" ))
: mDep(ShaderGen::smCommonShaderPath + String("/gl/lighting.glsl" ))
{
addDependency( &mDep );
}
@ -2164,7 +2166,7 @@ ShaderFeature::Resources RTLightingFeatGLSL::getResources( const MaterialFeature
//****************************************************************************
FogFeatGLSL::FogFeatGLSL()
: mFogDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
: mFogDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" ))
{
addDependency( &mFogDep );
}
@ -2294,7 +2296,7 @@ ShaderFeature::Resources FogFeatGLSL::getResources( const MaterialFeatureData &f
//****************************************************************************
VisibilityFeatGLSL::VisibilityFeatGLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
: mTorqueDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" ))
{
addDependency( &mTorqueDep );
}
@ -2460,7 +2462,7 @@ void RenderTargetZeroGLSL::processPix( Vector<ShaderComponent*> &componentList,
//****************************************************************************
HDROutGLSL::HDROutGLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
: mTorqueDep(ShaderGen::smCommonShaderPath + String("/gl/torque.glsl" ))
{
addDependency( &mTorqueDep );
}
@ -2481,7 +2483,7 @@ void HDROutGLSL::processPix( Vector<ShaderComponent*> &componentList,
#include "T3D/fx/groundCover.h"
FoliageFeatureGLSL::FoliageFeatureGLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/foliage.glsl" ))
: mDep(ShaderGen::smCommonShaderPath + String("/gl/foliage.glsl" ))
{
addDependency( &mDep );
}
@ -2627,7 +2629,7 @@ void ParticleNormalFeatureGLSL::processVert(Vector<ShaderComponent*> &componentL
//****************************************************************************
ImposterVertFeatureGLSL::ImposterVertFeatureGLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/imposter.glsl" ))
: mDep(ShaderGen::smCommonShaderPath + String("/gl/imposter.glsl" ))
{
addDependency( &mDep );
}