mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-09 19:50:13 +02:00
Minor code review for loaders
This commit is contained in:
parent
50abcdf121
commit
c07bf59658
@ -1035,7 +1035,7 @@ namespace
|
|||||||
|
|
||||||
D3D12_SUBRESOURCE_DATA res =
|
D3D12_SUBRESOURCE_DATA res =
|
||||||
{
|
{
|
||||||
reinterpret_cast<const void*>(pSrcBits),
|
pSrcBits,
|
||||||
static_cast<LONG_PTR>(RowBytes),
|
static_cast<LONG_PTR>(RowBytes),
|
||||||
static_cast<LONG_PTR>(NumBytes)
|
static_cast<LONG_PTR>(NumBytes)
|
||||||
};
|
};
|
||||||
@ -1126,7 +1126,8 @@ namespace
|
|||||||
IID_ID3D12Resource, reinterpret_cast<void**>(texture));
|
IID_ID3D12Resource, reinterpret_cast<void**>(texture));
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
_Analysis_assume_(*texture != nullptr);
|
assert(texture != nullptr && *texture != nullptr);
|
||||||
|
_Analysis_assume_(texture != nullptr && *texture != nullptr);
|
||||||
|
|
||||||
SetDebugObjectName(*texture, L"DDSTextureLoader");
|
SetDebugObjectName(*texture, L"DDSTextureLoader");
|
||||||
}
|
}
|
||||||
@ -1166,7 +1167,7 @@ namespace
|
|||||||
if ((header->ddspf.flags & DDS_FOURCC) &&
|
if ((header->ddspf.flags & DDS_FOURCC) &&
|
||||||
(MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC))
|
(MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC))
|
||||||
{
|
{
|
||||||
auto d3d10ext = reinterpret_cast<const DDS_HEADER_DXT10*>(reinterpret_cast<const uint8_t*>(header) + sizeof(DDS_HEADER));
|
auto d3d10ext = reinterpret_cast<const DDS_HEADER_DXT10*>(reinterpret_cast<const char*>(header) + sizeof(DDS_HEADER));
|
||||||
|
|
||||||
arraySize = d3d10ext->arraySize;
|
arraySize = d3d10ext->arraySize;
|
||||||
if (arraySize == 0)
|
if (arraySize == 0)
|
||||||
@ -1427,7 +1428,7 @@ namespace
|
|||||||
_In_ ID3D12Resource** texture) noexcept
|
_In_ ID3D12Resource** texture) noexcept
|
||||||
{
|
{
|
||||||
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
|
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
|
||||||
if (texture)
|
if (texture && *texture)
|
||||||
{
|
{
|
||||||
const wchar_t* pstrName = wcsrchr(fileName, '\\');
|
const wchar_t* pstrName = wcsrchr(fileName, '\\');
|
||||||
if (!pstrName)
|
if (!pstrName)
|
||||||
@ -1439,10 +1440,7 @@ namespace
|
|||||||
pstrName++;
|
pstrName++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture && *texture)
|
(*texture)->SetName(pstrName);
|
||||||
{
|
|
||||||
(*texture)->SetName(pstrName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UNREFERENCED_PARAMETER(fileName);
|
UNREFERENCED_PARAMETER(fileName);
|
||||||
|
@ -952,7 +952,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
|||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// Determine source format's WIC equivalent
|
// Determine source format's WIC equivalent
|
||||||
WICPixelFormatGUID pfGuid;
|
WICPixelFormatGUID pfGuid = {};
|
||||||
bool sRGB = forceSRGB;
|
bool sRGB = forceSRGB;
|
||||||
switch ( desc.Format )
|
switch ( desc.Format )
|
||||||
{
|
{
|
||||||
@ -1060,7 +1060,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
|||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// Pick a target format
|
// Pick a target format
|
||||||
WICPixelFormatGUID targetGuid;
|
WICPixelFormatGUID targetGuid = {};
|
||||||
if ( targetFormat )
|
if ( targetFormat )
|
||||||
{
|
{
|
||||||
targetGuid = *targetFormat;
|
targetGuid = *targetFormat;
|
||||||
|
@ -1094,7 +1094,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
|||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// Determine source format's WIC equivalent
|
// Determine source format's WIC equivalent
|
||||||
WICPixelFormatGUID pfGuid;
|
WICPixelFormatGUID pfGuid = {};
|
||||||
bool sRGB = forceSRGB;
|
bool sRGB = forceSRGB;
|
||||||
switch ( desc.Format )
|
switch ( desc.Format )
|
||||||
{
|
{
|
||||||
@ -1202,7 +1202,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
|||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
// Pick a target format
|
// Pick a target format
|
||||||
WICPixelFormatGUID targetGuid;
|
WICPixelFormatGUID targetGuid = {};
|
||||||
if ( targetFormat )
|
if ( targetFormat )
|
||||||
{
|
{
|
||||||
targetGuid = *targetFormat;
|
targetGuid = *targetFormat;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user