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,
|
||||
usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB,
|
||||
texture, textureView );
|
||||
|
||||
if (texture != 0 && *texture != 0)
|
||||
if ( SUCCEEDED(hr) )
|
||||
{
|
||||
SetDebugObjectName(*texture, "DDSTextureLoader");
|
||||
}
|
||||
if (texture != 0 && *texture != 0)
|
||||
{
|
||||
SetDebugObjectName(*texture, "DDSTextureLoader");
|
||||
}
|
||||
|
||||
if (textureView != 0 && *textureView != 0)
|
||||
{
|
||||
SetDebugObjectName(*textureView, "DDSTextureLoader");
|
||||
if (textureView != 0 && *textureView != 0)
|
||||
{
|
||||
SetDebugObjectName(*textureView, "DDSTextureLoader");
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
@ -1469,42 +1471,48 @@ HRESULT DirectX::CreateDDSTextureFromFileEx( ID3D11Device* d3dDevice,
|
||||
texture, textureView );
|
||||
|
||||
#if defined(_DEBUG) || defined(PROFILE)
|
||||
if (texture != 0 || textureView != 0)
|
||||
if ( SUCCEEDED(hr) )
|
||||
{
|
||||
CHAR strFileA[MAX_PATH];
|
||||
WideCharToMultiByte( CP_ACP,
|
||||
WC_NO_BEST_FIT_CHARS,
|
||||
fileName,
|
||||
-1,
|
||||
strFileA,
|
||||
MAX_PATH,
|
||||
nullptr,
|
||||
FALSE
|
||||
);
|
||||
const CHAR* pstrName = strrchr( strFileA, '\\' );
|
||||
if (!pstrName)
|
||||
if (texture != 0 || textureView != 0)
|
||||
{
|
||||
pstrName = strFileA;
|
||||
}
|
||||
else
|
||||
{
|
||||
pstrName++;
|
||||
}
|
||||
CHAR strFileA[MAX_PATH];
|
||||
int result = WideCharToMultiByte( CP_ACP,
|
||||
WC_NO_BEST_FIT_CHARS,
|
||||
fileName,
|
||||
-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)
|
||||
{
|
||||
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||
pstrName
|
||||
);
|
||||
}
|
||||
if (texture != 0 && *texture != 0)
|
||||
{
|
||||
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||
pstrName
|
||||
);
|
||||
}
|
||||
|
||||
if (textureView != 0 && *textureView != 0 )
|
||||
{
|
||||
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||
pstrName
|
||||
);
|
||||
if (textureView != 0 && *textureView != 0 )
|
||||
{
|
||||
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||
pstrName
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -859,46 +859,50 @@ HRESULT DirectX::CreateWICTextureFromFileEx( ID3D11Device* d3dDevice,
|
||||
hr = CreateTextureFromWIC( d3dDevice, d3dContext, frame.Get(), maxsize,
|
||||
usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB,
|
||||
texture, textureView );
|
||||
if ( FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
||||
#if defined(_DEBUG) || defined(PROFILE)
|
||||
if (texture != 0 || textureView != 0)
|
||||
if ( SUCCEEDED(hr) )
|
||||
{
|
||||
CHAR strFileA[MAX_PATH];
|
||||
WideCharToMultiByte( CP_ACP,
|
||||
WC_NO_BEST_FIT_CHARS,
|
||||
fileName,
|
||||
-1,
|
||||
strFileA,
|
||||
MAX_PATH,
|
||||
nullptr,
|
||||
FALSE
|
||||
);
|
||||
const CHAR* pstrName = strrchr( strFileA, '\\' );
|
||||
if (!pstrName)
|
||||
if (texture != 0 || textureView != 0)
|
||||
{
|
||||
pstrName = strFileA;
|
||||
}
|
||||
else
|
||||
{
|
||||
pstrName++;
|
||||
}
|
||||
CHAR strFileA[MAX_PATH];
|
||||
int result = WideCharToMultiByte( CP_ACP,
|
||||
WC_NO_BEST_FIT_CHARS,
|
||||
fileName,
|
||||
-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)
|
||||
{
|
||||
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||
pstrName
|
||||
);
|
||||
}
|
||||
if (texture != 0 && *texture != 0)
|
||||
{
|
||||
(*texture)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||
pstrName
|
||||
);
|
||||
}
|
||||
|
||||
if (textureView != 0 && *textureView != 0 )
|
||||
{
|
||||
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||
pstrName
|
||||
);
|
||||
if (textureView != 0 && *textureView != 0 )
|
||||
{
|
||||
(*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName,
|
||||
static_cast<UINT>( strnlen_s(pstrName, MAX_PATH) ),
|
||||
pstrName
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user