mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-09 19:50:13 +02:00
DDSTextureLoader/WICTextureLoader /analyze fixes
This commit is contained in:
parent
87880558bb
commit
3cc014ec76
@ -1394,15 +1394,17 @@ HRESULT DirectX::CreateDDSTextureFromMemoryEx( ID3D11Device* d3dDevice,
|
|||||||
ddsData + offset, ddsDataSize - offset, maxsize,
|
ddsData + offset, ddsDataSize - offset, maxsize,
|
||||||
usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB,
|
usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB,
|
||||||
texture, textureView );
|
texture, textureView );
|
||||||
|
if ( SUCCEEDED(hr) )
|
||||||
if (texture != 0 && *texture != 0)
|
|
||||||
{
|
{
|
||||||
SetDebugObjectName(*texture, "DDSTextureLoader");
|
if (texture != 0 && *texture != 0)
|
||||||
}
|
{
|
||||||
|
SetDebugObjectName(*texture, "DDSTextureLoader");
|
||||||
|
}
|
||||||
|
|
||||||
if (textureView != 0 && *textureView != 0)
|
if (textureView != 0 && *textureView != 0)
|
||||||
{
|
{
|
||||||
SetDebugObjectName(*textureView, "DDSTextureLoader");
|
SetDebugObjectName(*textureView, "DDSTextureLoader");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
@ -1469,42 +1471,48 @@ HRESULT DirectX::CreateDDSTextureFromFileEx( ID3D11Device* d3dDevice,
|
|||||||
texture, textureView );
|
texture, textureView );
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(PROFILE)
|
#if defined(_DEBUG) || defined(PROFILE)
|
||||||
if (texture != 0 || textureView != 0)
|
if ( SUCCEEDED(hr) )
|
||||||
{
|
{
|
||||||
CHAR strFileA[MAX_PATH];
|
if (texture != 0 || textureView != 0)
|
||||||
WideCharToMultiByte( CP_ACP,
|
|
||||||
WC_NO_BEST_FIT_CHARS,
|
|
||||||
fileName,
|
|
||||||
-1,
|
|
||||||
strFileA,
|
|
||||||
MAX_PATH,
|
|
||||||
nullptr,
|
|
||||||
FALSE
|
|
||||||
);
|
|
||||||
const CHAR* pstrName = strrchr( strFileA, '\\' );
|
|
||||||
if (!pstrName)
|
|
||||||
{
|
{
|
||||||
pstrName = strFileA;
|
CHAR strFileA[MAX_PATH];
|
||||||
}
|
int result = WideCharToMultiByte( CP_ACP,
|
||||||
else
|
WC_NO_BEST_FIT_CHARS,
|
||||||
{
|
fileName,
|
||||||
pstrName++;
|
-1,
|
||||||
}
|
strFileA,
|
||||||
|
MAX_PATH,
|
||||||
|
nullptr,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
if ( result > 0 )
|
||||||
|
{
|
||||||
|
const CHAR* pstrName = strrchr( strFileA, '\\' );
|
||||||
|
if (!pstrName)
|
||||||
|
{
|
||||||
|
pstrName = strFileA;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pstrName++;
|
||||||
|
}
|
||||||
|
|
||||||
if (texture != 0 && *texture != 0)
|
if (texture != 0 && *texture != 0)
|
||||||
{
|
{
|
||||||
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||||
pstrName
|
pstrName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textureView != 0 && *textureView != 0 )
|
if (textureView != 0 && *textureView != 0 )
|
||||||
{
|
{
|
||||||
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||||
pstrName
|
pstrName
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -859,46 +859,50 @@ HRESULT DirectX::CreateWICTextureFromFileEx( ID3D11Device* d3dDevice,
|
|||||||
hr = CreateTextureFromWIC( d3dDevice, d3dContext, frame.Get(), maxsize,
|
hr = CreateTextureFromWIC( d3dDevice, d3dContext, frame.Get(), maxsize,
|
||||||
usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB,
|
usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB,
|
||||||
texture, textureView );
|
texture, textureView );
|
||||||
if ( FAILED(hr))
|
|
||||||
return hr;
|
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(PROFILE)
|
#if defined(_DEBUG) || defined(PROFILE)
|
||||||
if (texture != 0 || textureView != 0)
|
if ( SUCCEEDED(hr) )
|
||||||
{
|
{
|
||||||
CHAR strFileA[MAX_PATH];
|
if (texture != 0 || textureView != 0)
|
||||||
WideCharToMultiByte( CP_ACP,
|
|
||||||
WC_NO_BEST_FIT_CHARS,
|
|
||||||
fileName,
|
|
||||||
-1,
|
|
||||||
strFileA,
|
|
||||||
MAX_PATH,
|
|
||||||
nullptr,
|
|
||||||
FALSE
|
|
||||||
);
|
|
||||||
const CHAR* pstrName = strrchr( strFileA, '\\' );
|
|
||||||
if (!pstrName)
|
|
||||||
{
|
{
|
||||||
pstrName = strFileA;
|
CHAR strFileA[MAX_PATH];
|
||||||
}
|
int result = WideCharToMultiByte( CP_ACP,
|
||||||
else
|
WC_NO_BEST_FIT_CHARS,
|
||||||
{
|
fileName,
|
||||||
pstrName++;
|
-1,
|
||||||
}
|
strFileA,
|
||||||
|
MAX_PATH,
|
||||||
|
nullptr,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
if ( result > 0 )
|
||||||
|
{
|
||||||
|
const CHAR* pstrName = strrchr( strFileA, '\\' );
|
||||||
|
if (!pstrName)
|
||||||
|
{
|
||||||
|
pstrName = strFileA;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pstrName++;
|
||||||
|
}
|
||||||
|
|
||||||
if (texture != 0 && *texture != 0)
|
if (texture != 0 && *texture != 0)
|
||||||
{
|
{
|
||||||
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||||
pstrName
|
pstrName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textureView != 0 && *textureView != 0 )
|
if (textureView != 0 && *textureView != 0 )
|
||||||
{
|
{
|
||||||
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||||
pstrName
|
pstrName
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user