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 * ShaderFeatureHLSL::setupTexSpaceMat( Vector<ShaderComponent*> &, // componentList
Var **texSpaceMat )
{
@ -821,7 +823,7 @@ Var* ShaderFeatureHLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
//****************************************************************************
DiffuseMapFeatHLSL::DiffuseMapFeatHLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl"))
: mTorqueDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl"))
{
addDependency(&mTorqueDep);
}
@ -2021,7 +2023,7 @@ void ReflectCubeFeatHLSL::setTexData( Material::StageData &stageDat,
//****************************************************************************
RTLightingFeatHLSL::RTLightingFeatHLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/lighting.hlsl" ))
: mDep(ShaderGen::smCommonShaderPath + String("/lighting.hlsl" ))
{
addDependency( &mDep );
}
@ -2234,7 +2236,7 @@ ShaderFeature::Resources RTLightingFeatHLSL::getResources( const MaterialFeature
//****************************************************************************
FogFeatHLSL::FogFeatHLSL()
: mFogDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
: mFogDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" ))
{
addDependency( &mFogDep );
}
@ -2364,7 +2366,7 @@ ShaderFeature::Resources FogFeatHLSL::getResources( const MaterialFeatureData &f
//****************************************************************************
VisibilityFeatHLSL::VisibilityFeatHLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
: mTorqueDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" ))
{
addDependency( &mTorqueDep );
}
@ -2531,7 +2533,7 @@ void RenderTargetZeroHLSL::processPix( Vector<ShaderComponent*> &componentList,
//****************************************************************************
HDROutHLSL::HDROutHLSL()
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
: mTorqueDep(ShaderGen::smCommonShaderPath + String("/torque.hlsl" ))
{
addDependency( &mTorqueDep );
}
@ -2552,7 +2554,7 @@ void HDROutHLSL::processPix( Vector<ShaderComponent*> &componentList,
#include "T3D/fx/groundCover.h"
FoliageFeatureHLSL::FoliageFeatureHLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/foliage.hlsl" ))
: mDep(ShaderGen::smCommonShaderPath + String("/foliage.hlsl" ))
{
addDependency( &mDep );
}
@ -2698,7 +2700,7 @@ void ParticleNormalFeatureHLSL::processVert(Vector<ShaderComponent*> &componentL
//****************************************************************************
ImposterVertFeatureHLSL::ImposterVertFeatureHLSL()
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/imposter.hlsl" ))
: mDep(ShaderGen::smCommonShaderPath + String("/imposter.hlsl" ))
{
addDependency( &mDep );
}