Add debug name for PSO catching on D3D12/Vulkan during profiling incl. Development builds
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user