void Loop() { UE_LOG(LogShaders, Log, TEXT("Entering job loop")); while(true) { TArray<FJobResult> JobResults; // Read & Process Input { FArchive* InputFilePtr = OpenInputFile(); if(!InputFilePtr) { break; } UE_LOG(LogShaders, Log, TEXT("Processing shader")); LastCompileTime = FPlatformTime::Seconds(); ProcessInputFromArchive(InputFilePtr, JobResults); // Close the input file. delete InputFilePtr; } // Prepare for output FArchive* OutputFilePtr = CreateOutputArchive(); check(OutputFilePtr); WriteToOutputArchive(OutputFilePtr, JobResults); // Close the output file. delete OutputFilePtr; // Change the output file name to requested one IFileManager::Get().Move(*OutputFilePath, *TempFilePath); if (GShaderCompileUseXGE) { // To signal compilation completion, create a zero length file in the working directory. WriteXGESuccessFile(*WorkingDirectory); // We only do one pass per process when using XGE. break; } } UE_LOG(LogShaders, Log, TEXT("Exiting job loop")); }
void Loop() { UE_LOG(LogShaders, Log, TEXT("Entering job loop")); while(true) { TArray<FJobResult> JobResults; // Read & Process Input { FArchive* InputFilePtr = OpenInputFile(); if(!InputFilePtr) { break; } UE_LOG(LogShaders, Log, TEXT("Processing shader")); LastCompileTime = FPlatformTime::Seconds(); ProcessInputFromArchive(InputFilePtr, JobResults); // Close the input file. delete InputFilePtr; } // Prepare for output FArchive* OutputFilePtr = CreateOutputArchive(); check(OutputFilePtr); WriteToOutputArchive(OutputFilePtr, JobResults); // Close the output file. delete OutputFilePtr; #if PLATFORM_MAC || PLATFORM_LINUX // Change the output file name to requested one IFileManager::Get().Move(*OutputFilePath, *TempFilePath); #endif #if PLATFORM_SUPPORTS_NAMED_PIPES if (CommunicationMode == ThroughNamedPipeOnce || CommunicationMode == ThroughNamedPipe) { VerifyResult(Pipe.WriteInt32(TransferBufferOut.Num()), TEXT("Writing Transfer Size")); VerifyResult(Pipe.WriteBytes(TransferBufferOut.Num(), TransferBufferOut.GetData()), TEXT("Writing Transfer Buffer")); //FPlatformMisc::LowLevelOutputDebugStringf(TEXT("*** Closing pipe...\n")); Pipe.Destroy(); if (CommunicationMode == ThroughNamedPipeOnce) { // Give up CPU time while we are waiting FPlatformProcess::Sleep(0.02f); break; } LastConnectionTime = FPlatformTime::Seconds(); } #endif // PLATFORM_SUPPORTS_NAMED_PIPES if (GShaderCompileUseXGE) { // To signal compilation completion, create a zero length file in the working directory. WriteXGESuccessFile(*WorkingDirectory); // We only do one pass per process when using XGE. break; } } UE_LOG(LogShaders, Log, TEXT("Exiting job loop")); }