DDSTextureLoader & WICTextureLoader updated to use SetDebugObjectName template introduced in Oct 12 2012 DirectXTK release
This commit is contained in:
parent
e57fcf3817
commit
c7594d5265
@ -29,6 +29,10 @@
|
|||||||
#define DXGI_1_2_FORMATS
|
#define DXGI_1_2_FORMATS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_DEBUG) || defined(PROFILE)
|
||||||
|
#pragma comment(lib,"dxguid.lib")
|
||||||
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Macros
|
// Macros
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@ -131,6 +135,16 @@ typedef public std::unique_ptr<void, handle_closer> ScopedHandle;
|
|||||||
|
|
||||||
inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; }
|
inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? 0 : h; }
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
template<UINT TNameLength>
|
||||||
|
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const char (&name)[TNameLength])
|
||||||
|
{
|
||||||
|
#if defined(_DEBUG) || defined(PROFILE)
|
||||||
|
resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
static HRESULT LoadTextureDataFromFile( _In_z_ const wchar_t* fileName,
|
static HRESULT LoadTextureDataFromFile( _In_z_ const wchar_t* fileName,
|
||||||
std::unique_ptr<uint8_t[]>& ddsData,
|
std::unique_ptr<uint8_t[]>& ddsData,
|
||||||
@ -866,11 +880,7 @@ static HRESULT CreateD3DResources( _In_ ID3D11Device* d3dDevice,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(_DEBUG) || defined(PROFILE)
|
SetDebugObjectName(tex, "DDSTextureLoader");
|
||||||
tex->SetPrivateData( WKPDID_D3DDebugObjectName,
|
|
||||||
sizeof("DDSTextureLoader")-1,
|
|
||||||
"DDSTextureLoader" );
|
|
||||||
#endif
|
|
||||||
tex->Release();
|
tex->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -950,12 +960,7 @@ static HRESULT CreateD3DResources( _In_ ID3D11Device* d3dDevice,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(_DEBUG) || defined(PROFILE)
|
SetDebugObjectName(tex, "DDSTextureLoader");
|
||||||
tex->SetPrivateData( WKPDID_D3DDebugObjectName,
|
|
||||||
sizeof("DDSTextureLoader")-1,
|
|
||||||
"DDSTextureLoader"
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
tex->Release();
|
tex->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1007,11 +1012,7 @@ static HRESULT CreateD3DResources( _In_ ID3D11Device* d3dDevice,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(_DEBUG) || defined(PROFILE)
|
SetDebugObjectName(tex, "DDSTextureLoader");
|
||||||
tex->SetPrivateData( WKPDID_D3DDebugObjectName,
|
|
||||||
sizeof("DDSTextureLoader")-1,
|
|
||||||
"DDSTextureLoader" );
|
|
||||||
#endif
|
|
||||||
tex->Release();
|
tex->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1310,23 +1311,15 @@ HRESULT DirectX::CreateDDSTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
|||||||
maxsize
|
maxsize
|
||||||
);
|
);
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(PROFILE)
|
|
||||||
if (texture != 0 && *texture != 0)
|
if (texture != 0 && *texture != 0)
|
||||||
{
|
{
|
||||||
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
SetDebugObjectName(*texture, "DDSTextureLoader");
|
||||||
sizeof("DDSTextureLoader")-1,
|
|
||||||
"DDSTextureLoader"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textureView != 0 && *textureView != 0)
|
if (textureView != 0 && *textureView != 0)
|
||||||
{
|
{
|
||||||
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
SetDebugObjectName(*textureView, "DDSTextureLoader");
|
||||||
sizeof("DDSTextureLoader")-1,
|
|
||||||
"DDSTextureLoader"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,10 @@
|
|||||||
#define DXGI_1_2_FORMATS
|
#define DXGI_1_2_FORMATS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_DEBUG) || defined(PROFILE)
|
||||||
|
#pragma comment(lib,"dxguid.lib")
|
||||||
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
template<class T> class ScopedObject
|
template<class T> class ScopedObject
|
||||||
{
|
{
|
||||||
@ -75,6 +79,16 @@ private:
|
|||||||
T* _pointer;
|
T* _pointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
template<UINT TNameLength>
|
||||||
|
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const char (&name)[TNameLength])
|
||||||
|
{
|
||||||
|
#if defined(_DEBUG) || defined(PROFILE)
|
||||||
|
resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
// WIC Pixel Format Translation Data
|
// WIC Pixel Format Translation Data
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
@ -544,12 +558,7 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(_DEBUG) || defined(PROFILE)
|
SetDebugObjectName(tex, "WICTextureLoader");
|
||||||
tex->SetPrivateData( WKPDID_D3DDebugObjectName,
|
|
||||||
sizeof("WICTextureLoader")-1,
|
|
||||||
"WICTextureLoader"
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
tex->Release();
|
tex->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -611,23 +620,15 @@ HRESULT DirectX::CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice,
|
|||||||
if ( FAILED(hr))
|
if ( FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(PROFILE)
|
|
||||||
if (texture != 0 && *texture != 0)
|
if (texture != 0 && *texture != 0)
|
||||||
{
|
{
|
||||||
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
SetDebugObjectName(*texture, "WICTextureLoader");
|
||||||
sizeof("WICTextureLoader")-1,
|
|
||||||
"WICTextureLoader"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textureView != 0 && *textureView != 0)
|
if (textureView != 0 && *textureView != 0)
|
||||||
{
|
{
|
||||||
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
SetDebugObjectName(*textureView, "WICTextureLoader");
|
||||||
sizeof("WICTextureLoader")-1,
|
|
||||||
"WICTextureLoader"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user