Add debug name for PSO catching on D3D12/Vulkan during profiling incl. Development builds

This commit is contained in:
Wojtek Figat
2025-07-28 23:08:26 +02:00
parent ad6764e6d7
commit 17c0892ff1
8 changed files with 95 additions and 47 deletions

View File

@@ -25,6 +25,25 @@ void GPUShaderProgram::Init(const GPUShaderProgramInitializer& initializer)
#endif
}
#if !BUILD_RELEASE
void GPUShaderProgram::GetDebugName(DebugName& name) const
{
StringView ownerName = StringUtils::GetFileNameWithoutExtension(_owner->GetName());
name.AddUninitialized(ownerName.Length() + _name.Length() + 2);
char* dst = name.Get();
for (int32 i = 0; i < ownerName.Length(); i++)
dst[i] = (char)ownerName.Get()[i];
dst += ownerName.Length();
*dst = ':';
dst++;
for (int32 i = 0; i < _name.Length(); i++)
dst[i] = _name.Get()[i];
dst[_name.Length()] = 0;
}
#endif
GPUShader::GPUShader()
: GPUResource(SpawnParams(Guid::New(), TypeInitializer))
{

View File

@@ -4,6 +4,9 @@
#include "Engine/Core/Types/BaseTypes.h"
#include "Engine/Core/Types/String.h"
#if !BUILD_RELEASE
#include "Engine/Core/Collections/Array.h"
#endif
#include "Config.h"
class GPUShader;
@@ -93,6 +96,11 @@ public:
return _flags;
}
#if !BUILD_RELEASE
typedef Array<char, InlinedAllocation<60>> DebugName;
void GetDebugName(DebugName& name) const;
#endif
public:
/// <summary>
/// Gets shader program stage type.