mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
D3D: Eliminate redundant ID3D11DeviceChild* casts
This commit is contained in:
@ -81,34 +81,8 @@ bool GetFullscreenState();
|
||||
// This function will assign a name to the given resource.
|
||||
// The DirectX debug layer will make it easier to identify resources that way,
|
||||
// e.g. when listing up all resources who have unreleased references.
|
||||
template <typename T>
|
||||
void SetDebugObjectName(T resource, const char* name)
|
||||
{
|
||||
static_assert(std::is_convertible<T, ID3D11DeviceChild*>::value,
|
||||
"resource must be convertible to ID3D11DeviceChild*");
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
if (resource)
|
||||
resource->SetPrivateData(WKPDID_D3DDebugObjectName, (UINT)(name ? strlen(name) : 0), name);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string GetDebugObjectName(T resource)
|
||||
{
|
||||
static_assert(std::is_convertible<T, ID3D11DeviceChild*>::value,
|
||||
"resource must be convertible to ID3D11DeviceChild*");
|
||||
std::string name;
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
if (resource)
|
||||
{
|
||||
UINT size = 0;
|
||||
resource->GetPrivateData(WKPDID_D3DDebugObjectName, &size, nullptr); // get required size
|
||||
name.resize(size);
|
||||
resource->GetPrivateData(WKPDID_D3DDebugObjectName, &size, const_cast<char*>(name.data()));
|
||||
}
|
||||
#endif
|
||||
return name;
|
||||
}
|
||||
void SetDebugObjectName(ID3D11DeviceChild* resource, const char* name);
|
||||
std::string GetDebugObjectName(ID3D11DeviceChild* resource);
|
||||
|
||||
} // namespace D3D
|
||||
|
||||
|
Reference in New Issue
Block a user