Some clues, this code is returning false:
bool UNiagaraScript::CanBeRunOnGpu()const
{
if (Usage != ENiagaraScriptUsage::ParticleGPUComputeScript)
{
return false;
}
if (!CachedScriptVM.IsValid())
{
return false; <======
}
for (const FNiagaraScriptDataInterfaceCompileInfo& InterfaceInfo : CachedScriptVM.DataInterfaceInfo)
{
if (InterfaceInfo.Type.IsValid() && !InterfaceInfo.CanExecuteOnTarget(ENiagaraSimTarget::GPUComputeSim))
{
return false;
}
}
return true;
}
That CachedScriptVM is set by the result of SetVMCompilationResults which is called here:
// check the ddc first
if (!bForceCompile && GetDerivedDataCacheRef().GetSynchronous(*GetNiagaraDDCKeyString(ScriptVersion, ScriptPathName), OutData, ScriptPathName))
{
FNiagaraVMExecutableData ExeData;
if (BinaryToExecData(this, OutData, ExeData))
{
COOK_STAT(Timer.AddHit(OutData.Num()));
SetVMCompilationResults(LastGeneratedVMId, ExeData, FString(), RequestDuplicateData->GetObjectNameMap(), false);
return;
}
}
In the case where it does not find a DDC hit, it will calculate it later:
if (!bForceCompile && GetDerivedDataCacheRef().GetSynchronous(*GetNiagaraDDCKeyString(ScriptVersion, ScriptPathName), OutData, ScriptPathName))
{...}
ActiveCompileRoots.Empty();
RequestDuplicateData->GetDuplicatedObjects(MutableView(ActiveCompileRoots));
FNiagaraCompileOptions Options(GetUsage(), GetUsageId(), ScriptData->ModuleUsageBitmask, ScriptPathName, GetFullName(), GetName());
int32 JobHandle = NiagaraModule.StartScriptCompileJob(RequestData.Get(), RequestDuplicateData.Get(), Options);
FNiagaraScriptCompileMetrics ScriptMetrics;
TSharedPtr<FNiagaraVMExecutableData> ExeData = NiagaraModule.GetCompileJobResult(JobHandle, true, ScriptMetrics);
if (ExeData)
{
SetVMCompilationResults(LastGeneratedVMId, *ExeData, FString(), RequestDuplicateData->GetObjectNameMap(), false);
// save result to the ddc
if (ExecToBinaryData(this, OutData, *ExeData))
{
COOK_STAT(Timer.AddMiss(OutData.Num()));
GetDerivedDataCacheRef().Put(*GetNiagaraDDCKeyString(ScriptVersion, ScriptPathName), OutData, ScriptPathName);
}
}
ActiveCompileRoots.Empty();
This is done as part of cook. Is there a way to send a “force compile” flag to the cook? We seem to be missing the ScriptResource.