mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-23 04:50:06 +00:00
Minor code review change for PPM/PFM code (#548)
This commit is contained in:
parent
4602b8e0f0
commit
2f37de7165
@ -502,7 +502,7 @@ namespace
|
|||||||
_In_ size_t width,
|
_In_ size_t width,
|
||||||
_In_ size_t height,
|
_In_ size_t height,
|
||||||
_In_ DXGI_FORMAT fmt,
|
_In_ DXGI_FORMAT fmt,
|
||||||
size_t* outNumBytes,
|
_Out_opt_ size_t* outNumBytes,
|
||||||
_Out_opt_ size_t* outRowBytes,
|
_Out_opt_ size_t* outRowBytes,
|
||||||
_Out_opt_ size_t* outNumRows) noexcept
|
_Out_opt_ size_t* outNumRows) noexcept
|
||||||
{
|
{
|
||||||
@ -516,6 +516,9 @@ namespace
|
|||||||
size_t bpe = 0;
|
size_t bpe = 0;
|
||||||
switch (fmt)
|
switch (fmt)
|
||||||
{
|
{
|
||||||
|
case DXGI_FORMAT_UNKNOWN:
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
case DXGI_FORMAT_BC1_TYPELESS:
|
case DXGI_FORMAT_BC1_TYPELESS:
|
||||||
case DXGI_FORMAT_BC1_UNORM:
|
case DXGI_FORMAT_BC1_UNORM:
|
||||||
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||||
@ -569,6 +572,15 @@ namespace
|
|||||||
bpe = 2;
|
bpe = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
|
||||||
|
|
||||||
|
case DXGI_FORMAT_P208:
|
||||||
|
planar = true;
|
||||||
|
bpe = 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
case DXGI_FORMAT_P010:
|
case DXGI_FORMAT_P010:
|
||||||
case DXGI_FORMAT_P016:
|
case DXGI_FORMAT_P016:
|
||||||
if ((height % 2) != 0)
|
if ((height % 2) != 0)
|
||||||
|
@ -581,7 +581,7 @@ namespace
|
|||||||
_In_ size_t width,
|
_In_ size_t width,
|
||||||
_In_ size_t height,
|
_In_ size_t height,
|
||||||
_In_ DXGI_FORMAT fmt,
|
_In_ DXGI_FORMAT fmt,
|
||||||
size_t* outNumBytes,
|
_Out_opt_ size_t* outNumBytes,
|
||||||
_Out_opt_ size_t* outRowBytes,
|
_Out_opt_ size_t* outRowBytes,
|
||||||
_Out_opt_ size_t* outNumRows) noexcept
|
_Out_opt_ size_t* outNumRows) noexcept
|
||||||
{
|
{
|
||||||
@ -595,6 +595,9 @@ namespace
|
|||||||
size_t bpe = 0;
|
size_t bpe = 0;
|
||||||
switch (fmt)
|
switch (fmt)
|
||||||
{
|
{
|
||||||
|
case DXGI_FORMAT_UNKNOWN:
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
case DXGI_FORMAT_BC1_TYPELESS:
|
case DXGI_FORMAT_BC1_TYPELESS:
|
||||||
case DXGI_FORMAT_BC1_UNORM:
|
case DXGI_FORMAT_BC1_UNORM:
|
||||||
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||||
|
@ -416,7 +416,7 @@ namespace
|
|||||||
_In_ size_t width,
|
_In_ size_t width,
|
||||||
_In_ size_t height,
|
_In_ size_t height,
|
||||||
_In_ D3DFORMAT fmt,
|
_In_ D3DFORMAT fmt,
|
||||||
size_t* outNumBytes,
|
_Out_opt_ size_t* outNumBytes,
|
||||||
_Out_opt_ size_t* outRowBytes,
|
_Out_opt_ size_t* outRowBytes,
|
||||||
_Out_opt_ size_t* outNumRows) noexcept
|
_Out_opt_ size_t* outNumRows) noexcept
|
||||||
{
|
{
|
||||||
@ -429,6 +429,9 @@ namespace
|
|||||||
size_t bpe = 0;
|
size_t bpe = 0;
|
||||||
switch (static_cast<int>(fmt))
|
switch (static_cast<int>(fmt))
|
||||||
{
|
{
|
||||||
|
case D3DFMT_UNKNOWN:
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
case D3DFMT_DXT1:
|
case D3DFMT_DXT1:
|
||||||
bc = true;
|
bc = true;
|
||||||
bpe = 8;
|
bpe = 8;
|
||||||
|
@ -261,6 +261,9 @@ HRESULT DirectX::CompressEx(
|
|||||||
|| IsTypeless(srcImage.format) || IsPlanar(srcImage.format) || IsPalettized(srcImage.format))
|
|| IsTypeless(srcImage.format) || IsPlanar(srcImage.format) || IsPalettized(srcImage.format))
|
||||||
return HRESULT_E_NOT_SUPPORTED;
|
return HRESULT_E_NOT_SUPPORTED;
|
||||||
|
|
||||||
|
if (!srcImage.pixels)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
// Setup GPU compressor
|
// Setup GPU compressor
|
||||||
std::unique_ptr<GPUCompressBC> gpubc(new (std::nothrow) GPUCompressBC);
|
std::unique_ptr<GPUCompressBC> gpubc(new (std::nothrow) GPUCompressBC);
|
||||||
if (!gpubc)
|
if (!gpubc)
|
||||||
|
@ -972,6 +972,9 @@ HRESULT DirectX::ComputePitch(DXGI_FORMAT fmt, size_t width, size_t height,
|
|||||||
|
|
||||||
switch (static_cast<int>(fmt))
|
switch (static_cast<int>(fmt))
|
||||||
{
|
{
|
||||||
|
case DXGI_FORMAT_UNKNOWN:
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
case DXGI_FORMAT_BC1_TYPELESS:
|
case DXGI_FORMAT_BC1_TYPELESS:
|
||||||
case DXGI_FORMAT_BC1_UNORM:
|
case DXGI_FORMAT_BC1_UNORM:
|
||||||
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||||
@ -1192,6 +1195,9 @@ size_t DirectX::ComputeScanlines(DXGI_FORMAT fmt, size_t height) noexcept
|
|||||||
{
|
{
|
||||||
switch (static_cast<int>(fmt))
|
switch (static_cast<int>(fmt))
|
||||||
{
|
{
|
||||||
|
case DXGI_FORMAT_UNKNOWN:
|
||||||
|
return 0;
|
||||||
|
|
||||||
case DXGI_FORMAT_BC1_TYPELESS:
|
case DXGI_FORMAT_BC1_TYPELESS:
|
||||||
case DXGI_FORMAT_BC1_UNORM:
|
case DXGI_FORMAT_BC1_UNORM:
|
||||||
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
case DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||||
|
@ -86,6 +86,9 @@ namespace
|
|||||||
|
|
||||||
HRESULT ReadData(_In_z_ const wchar_t* szFile, std::unique_ptr<uint8_t[]>& blob, size_t& blobSize)
|
HRESULT ReadData(_In_z_ const wchar_t* szFile, std::unique_ptr<uint8_t[]>& blob, size_t& blobSize)
|
||||||
{
|
{
|
||||||
|
if (!szFile)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
blob.reset();
|
blob.reset();
|
||||||
|
|
||||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
|
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
|
||||||
@ -361,6 +364,9 @@ HRESULT __cdecl SaveToPortablePixMap(
|
|||||||
_In_ const Image& image,
|
_In_ const Image& image,
|
||||||
_In_z_ const wchar_t* szFile) noexcept
|
_In_z_ const wchar_t* szFile) noexcept
|
||||||
{
|
{
|
||||||
|
if (!szFile)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
switch (image.format)
|
switch (image.format)
|
||||||
{
|
{
|
||||||
case DXGI_FORMAT_R8G8B8A8_UNORM:
|
case DXGI_FORMAT_R8G8B8A8_UNORM:
|
||||||
@ -688,6 +694,9 @@ HRESULT __cdecl SaveToPortablePixMapHDR(
|
|||||||
_In_ const Image& image,
|
_In_ const Image& image,
|
||||||
_In_z_ const wchar_t* szFile) noexcept
|
_In_z_ const wchar_t* szFile) noexcept
|
||||||
{
|
{
|
||||||
|
if (!szFile)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
switch (image.format)
|
switch (image.format)
|
||||||
{
|
{
|
||||||
case DXGI_FORMAT_R32G32B32A32_FLOAT:
|
case DXGI_FORMAT_R32G32B32A32_FLOAT:
|
||||||
|
Loading…
Reference in New Issue
Block a user