Skip to content

Commit 74f7445

Browse files
committed
More code review
1 parent 94fc437 commit 74f7445

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

DirectXTex/DirectXTexSwizzle.cpp

+5-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "DirectXTexP.h"
1414

1515
using namespace DirectX;
16-
using namespace DirectX::Internal;
1716

1817

1918
namespace
@@ -55,10 +54,10 @@ namespace
5554

5655
constexpr size_t MAX_TEXTURE_DIMENSION = 16384u;
5756

58-
#if defined(_M_X64) || defined(_M_ARM64)
59-
constexpr size_t MAX_TEXTURE_SIZE = 16384u * 16384u * 16u;
57+
#if defined(_M_X64) || defined(_M_ARM64) || __x86_64__ || __aarch64__
58+
constexpr uint64_t MAX_TEXTURE_SIZE = 16384u * 16384u * 16u;
6059
#else
61-
constexpr size_t MAX_TEXTURE_SIZE = UINT32_MAX;
60+
constexpr uint64_t MAX_TEXTURE_SIZE = UINT32_MAX;
6261
#endif
6362

6463
// Standard Swizzle is not defined for these formats.
@@ -147,7 +146,7 @@ namespace
147146
if (!dptr)
148147
return E_POINTER;
149148

150-
if ((srcImage.rowPitch > UINT32_MAX) || (destImage.rowPitch > UINT32_MAX))
149+
if (srcImage.rowPitch > UINT32_MAX)
151150
return HRESULT_E_ARITHMETIC_OVERFLOW;
152151

153152
const size_t height = isCompressed ? (srcImage.height + 3) / 4 : srcImage.height;
@@ -216,7 +215,7 @@ namespace
216215
if (!dptr)
217216
return E_POINTER;
218217

219-
if ((srcImage.rowPitch > UINT32_MAX) || (destImage.rowPitch > UINT32_MAX))
218+
if (srcImage.rowPitch > UINT32_MAX)
220219
return HRESULT_E_ARITHMETIC_OVERFLOW;
221220

222221
const size_t height = isCompressed ? (srcImage.height + 3) / 4 : srcImage.height;
@@ -296,9 +295,6 @@ namespace
296295
if (!dptr)
297296
return E_POINTER;
298297

299-
if (destImage.rowPitch > UINT32_MAX)
300-
return HRESULT_E_ARITHMETIC_OVERFLOW;
301-
302298
// TODO: linear to swizzle x,y,z
303299
return E_NOTIMPL;
304300
}
@@ -320,9 +316,6 @@ namespace
320316
if (!dptr)
321317
return E_POINTER;
322318

323-
if (destImage.rowPitch > UINT32_MAX)
324-
return HRESULT_E_ARITHMETIC_OVERFLOW;
325-
326319
// TODO: swizzle x,y,z to linear
327320
return E_NOTIMPL;
328321
}

0 commit comments

Comments
 (0)