Fix unnecessary memory allocations within D3D object debug name assignment
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user