\Engine\Source\Runtime\Engine\Private\Materials\MaterialShader.cpp
这个文件中的
/**
* Compiles the shaders for a material and caches them in this shader map.
* @param Material - The material to compile shaders for.
* @param InShaderMapId - the set of static parameters to compile for
* @param Platform - The platform to compile to
*/
void FMaterialShaderMap::Compile(
FMaterial* Material,
const FMaterialShaderMapId& InShaderMapId,
TRefCountPtr<FShaderCompilerEnvironment> MaterialEnvironment,
const FMaterialCompilationOutput& InMaterialCompilationOutput,
EShaderPlatform InPlatform,
bool bSynchronousCompile,
bool bApplyCompletedShaderMapForRendering)
{
if (FPlatformProperties::RequiresCookedData())
{
UE_LOG(LogMaterial, Fatal, TEXT("Trying to compile %s at run-time, which is not supported on consoles!"), *Material->GetFriendlyName() );
}
else
{
然后调用到这里:
Engine\Source\Runtime\Engine\Private\ShaderCompiler\ShaderCompiler.cpp
/** Enqueues a shader compile job with GShaderCompilingManager. */
void GlobalBeginCompileShader(
const FString& DebugGroupName,
FVertexFactoryType* VFType,
FShaderType* ShaderType,
const FShaderPipelineType* ShaderPipelineType,
const TCHAR* SourceFilename,
const TCHAR* FunctionName,
FShaderTarget Target,
FS