| 94 | } |
| 95 | |
| 96 | void 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 | |
| 138 | void ShaderGen::generateShader( const MaterialFeatureData &featureData, |
| 139 | char *vertFile, |
nothing calls this directly
no test coverage detected