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)
|
if (data && size > 0)
|
||||||
resource->SetName(data);
|
resource->SetName(data);
|
||||||
#else
|
#else
|
||||||
char* ansi = (char*)Allocator::Allocate(size + 1);
|
const StringAsANSI<> nameANSI(data, size);
|
||||||
StringUtils::ConvertUTF162ANSI(data, ansi, size);
|
SetDebugObjectName(resource, nameANSI.Get(), size);
|
||||||
ansi[size] = '\0';
|
|
||||||
SetDebugObjectName(resource, ansi, size);
|
|
||||||
Allocator::Free(ansi);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void SetDebugObjectName(T* resource, const String& name)
|
inline void SetDebugObjectName(T* resource, const StringView& name)
|
||||||
{
|
{
|
||||||
SetDebugObjectName(resource, *name, name.Length());
|
SetDebugObjectName(resource, *name, name.Length());
|
||||||
}
|
}
|
||||||
@@ -208,7 +205,7 @@ inline void SetDebugObjectName(ComPtr<T> resource, const Char (&name)[NameLength
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
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());
|
SetDebugObjectName(resource.Get(), *name, name.Length());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user