diff options
author | CrystalPT <CrystalPT@svn> | 2010-06-18 02:39:21 +0000 |
---|---|---|
committer | CrystalPT <CrystalPT@svn> | 2010-06-18 02:39:21 +0000 |
commit | 00c37913b66ca53539fc38f7b40fb1239096916e (patch) | |
tree | 743424e759056b292479098a109f46c8d8e43155 /guilib | |
parent | 4be70c0438349b1aff1bb4c92163c9da9ea47e20 (diff) |
[WIN32] added: logging in case of texture creation failure
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31161 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib')
-rw-r--r-- | guilib/D3DResource.cpp | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/guilib/D3DResource.cpp b/guilib/D3DResource.cpp index bc82686b3c..def32df0e1 100644 --- a/guilib/D3DResource.cpp +++ b/guilib/D3DResource.cpp @@ -55,7 +55,12 @@ bool CD3DTexture::Create(UINT width, UINT height, UINT mipLevels, DWORD usage, D m_pool = pool;
// create the texture
Release();
- if (D3D_OK == D3DXCreateTexture(g_Windowing.Get3DDevice(), m_width, m_height, m_mipLevels, m_usage, m_format, m_pool, &m_texture))
+ HRESULT hr = D3DXCreateTexture(g_Windowing.Get3DDevice(), m_width, m_height, m_mipLevels, m_usage, m_format, m_pool, &m_texture);
+ if (FAILED(hr))
+ {
+ CLog::Log(LOGERROR, __FUNCTION__" - failed 0x%08X", hr);
+ }
+ else
{
D3DSURFACE_DESC desc;
if( D3D_OK == m_texture->GetLevelDesc(0, &desc))
@@ -140,27 +145,35 @@ void CD3DTexture::RestoreTexture() // yay, we're back - make a new copy of the texture
if (!m_texture)
{
- D3DXCreateTexture(g_Windowing.Get3DDevice(), m_width, m_height, m_mipLevels, m_usage, m_format, m_pool, &m_texture);
- // copy the data to the texture
- D3DLOCKED_RECT lr;
- if (m_texture && m_data && LockRect(0, &lr, NULL, 0 ))
+ HRESULT hr = D3DXCreateTexture(g_Windowing.Get3DDevice(), m_width, m_height, m_mipLevels, m_usage, m_format, m_pool, &m_texture);
+ if (FAILED(hr))
+ {
+ CLog::Log(LOGERROR, __FUNCTION__": D3DXCreateTexture failed 0x%08X", hr);
+ }
+ else
{
- if (lr.Pitch == m_pitch)
- memcpy(lr.pBits, m_data, GetMemoryUsage(lr.Pitch));
- else
+ // copy the data to the texture
+ D3DLOCKED_RECT lr;
+ if (m_texture && m_data && LockRect(0, &lr, NULL, 0 ))
{
- UINT minpitch = ((UINT)lr.Pitch < m_pitch) ? lr.Pitch : m_pitch;
-
- for(UINT i = 0; i < m_height; ++i)
+ if (lr.Pitch == m_pitch)
+ memcpy(lr.pBits, m_data, GetMemoryUsage(lr.Pitch));
+ else
{
- // Get pointers to the "rows" of pixels in texture
- BYTE* pBits = (BYTE*)lr.pBits + i*lr.Pitch;
- BYTE* pData = m_data + i*m_pitch;
- memcpy(pBits, pData, minpitch);
+ UINT minpitch = ((UINT)lr.Pitch < m_pitch) ? lr.Pitch : m_pitch;
+
+ for(UINT i = 0; i < m_height; ++i)
+ {
+ // Get pointers to the "rows" of pixels in texture
+ BYTE* pBits = (BYTE*)lr.pBits + i*lr.Pitch;
+ BYTE* pData = m_data + i*m_pitch;
+ memcpy(pBits, pData, minpitch);
+ }
}
+ UnlockRect(0);
}
- UnlockRect(0);
}
+
delete[] m_data;
m_data = NULL;
m_pitch = 0;
|