MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / initShaderGen

Method initShaderGen

Engine/source/shaderGen/shaderGen.cpp:96–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void ShaderGen::initShaderGen()
97{
98 if (mInit)
99 return;
100
101 const GFXAdapterType adapterType = GFX->getAdapterType();
102 if (!mInitDelegates[adapterType])
103 return;
104
105 smCommonShaderPath = String(Con::getVariable("$Core::CommonShaderPath", "shaders/common"));
106
107 mInitDelegates[adapterType](this);
108 mFeatureInitSignal.trigger( adapterType );
109 mInit = true;
110
111 String shaderPath = Con::getVariable( "$shaderGen::cachePath");
112 if (!shaderPath.equal( "shadergen:" ) && !shaderPath.isEmpty() )
113 {
114 // this is necessary, especially under Windows with UAC enabled
115 if (!Torque::FS::VerifyWriteAccess(shaderPath))
116 {
117 // we don't have write access so enable the virtualized memory store
118 Con::warnf("ShaderGen: Write permission unavailable, switching to virtualized memory storage");
119 shaderPath.clear();
120 }
121
122 }
123
124 if ( shaderPath.equal( "shadergen:" ) || shaderPath.isEmpty() )
125 {
126 // If we didn't get a path then we're gonna cache the shaders to
127 // a virtualized memory file system.
128 mMemFS = new Torque::Mem::MemFileSystem( "shadergen:/" );
129 Torque::FS::Mount( "shadergen", mMemFS );
130 }
131 else
132 Torque::FS::Mount( "shadergen", shaderPath + "/" );
133
134 // Delete the auto-generated conditioner include file.
135 Torque::FS::Remove( "shadergen:/" + ConditionerFeature::ConditionerIncludeFileName );
136}
137
138void ShaderGen::generateShader( const MaterialFeatureData &featureData,
139 char *vertFile,

Callers

nothing calls this directly

Calls 10

getVariableFunction · 0.85
MountFunction · 0.85
RemoveFunction · 0.85
StringClass · 0.50
warnfFunction · 0.50
getAdapterTypeMethod · 0.45
triggerMethod · 0.45
equalMethod · 0.45
isEmptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected