Add profiler events to shader compiler
This commit is contained in:
@@ -5,12 +5,15 @@
|
||||
#include "ShadersCompilation.h"
|
||||
#include "ShaderCompilationContext.h"
|
||||
#include "ShaderDebugDataExporter.h"
|
||||
#include "Config.h"
|
||||
#include "Parser/ShaderProcessing.h"
|
||||
#include "Parser/ShaderMeta.h"
|
||||
#include "Engine/Engine/EngineService.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Math/Math.h"
|
||||
#include "Engine/Core/Types/TimeSpan.h"
|
||||
#include "Parser/ShaderProcessing.h"
|
||||
#include "Engine/Graphics/Config.h"
|
||||
#include "Engine/Graphics/RenderTools.h"
|
||||
#include "Engine/Graphics/Shaders/GPUShader.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
@@ -459,4 +462,30 @@ void ShadersCompilationService::Dispose()
|
||||
ShaderIncludesMapLocker.Unlock();
|
||||
}
|
||||
|
||||
void ShaderCompilationContext::OnError(const char* message)
|
||||
{
|
||||
LOG(Error, "Failed to compile '{0}'. {1}", Options->TargetName, String(message));
|
||||
}
|
||||
|
||||
void ShaderCompilationContext::OnCollectDebugInfo(ShaderFunctionMeta& meta, int32 permutationIndex, const char* data, const int32 dataLength)
|
||||
{
|
||||
#ifdef GPU_USE_SHADERS_DEBUG_LAYER
|
||||
|
||||
// Cache data
|
||||
meta.Permutations[permutationIndex].DebugData.Set(data, dataLength);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
ShaderCompilationContext::ShaderCompilationContext(const ShaderCompilationOptions* options, ShaderMeta* meta)
|
||||
: Options(options)
|
||||
, Meta(meta)
|
||||
, Output(options->Output)
|
||||
{
|
||||
// Convert target name to ANSI text (with limited length)
|
||||
const int32 ansiNameLen = Math::Min<int32>(ARRAY_COUNT(TargetNameAnsi) - 1, options->TargetName.Length());
|
||||
StringUtils::ConvertUTF162ANSI(*options->TargetName, TargetNameAnsi, ansiNameLen);
|
||||
TargetNameAnsi[ansiNameLen] = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user