Fix unnecessary memory allocations within D3D object debug name assignment

This commit is contained in:
2026-04-27 14:27:32 +02:00
parent dcb9b5150f
commit c33ada2715
@@ -175,16 +175,13 @@ inline void SetDebugObjectName(T* resource, const Char* data, UINT size)
if (data && size > 0)
resource->SetName(data);
#else
char* ansi = (char*)Allocator::Allocate(size + 1);
StringUtils::ConvertUTF162ANSI(data, ansi, size);
ansi[size] = '\0';
SetDebugObjectName(resource, ansi, size);
Allocator::Free(ansi);
const StringAsANSI<> nameANSI(data, size);
SetDebugObjectName(resource, nameANSI.Get(), size);
#endif
}
template<typename T>
inline void SetDebugObjectName(T* resource, const String& name)
inline void SetDebugObjectName(T* resource, const StringView& name)
{
SetDebugObjectName(resource, *name, name.Length());
}
@@ -208,7 +205,7 @@ inline void SetDebugObjectName(ComPtr<T> resource, const Char (&name)[NameLength
}
template<typename T>
inline void SetDebugObjectName(ComPtr<T> resource, const String& name)
inline void SetDebugObjectName(ComPtr<T> resource, const StringView& name)
{
SetDebugObjectName(resource.Get(), *name, name.Length());
}