Enable compilation with clang-cl (LLVM on Windows) (#135)

This commit is contained in:
Chuck Walbourn
2019-04-16 17:38:37 -07:00
parent c7261a0951
commit 86b2bb5194
13 changed files with 73 additions and 129 deletions

View File

@@ -32,7 +32,7 @@
#include <dxgiformat.h>
#include "directxtex.h"
#include "DirectXTex.h"
//Uncomment to add support for OpenEXR (.exr)
//#define USE_OPENEXR
@@ -626,12 +626,12 @@ namespace
else
{
// WIC shares the same filter values for mode and dither
static_assert(WIC_FLAGS_DITHER == TEX_FILTER_DITHER, "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_DITHER_DIFFUSION == TEX_FILTER_DITHER_DIFFUSION, "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_FILTER_POINT == TEX_FILTER_POINT, "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_FILTER_LINEAR == TEX_FILTER_LINEAR, "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_FILTER_CUBIC == TEX_FILTER_CUBIC, "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_FILTER_FANT == TEX_FILTER_FANT, "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_DITHER == static_cast<DirectX::WIC_FLAGS>(TEX_FILTER_DITHER), "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_DITHER_DIFFUSION == static_cast<DirectX::WIC_FLAGS>(TEX_FILTER_DITHER_DIFFUSION), "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_FILTER_POINT == static_cast<DirectX::WIC_FLAGS>(TEX_FILTER_POINT), "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_FILTER_LINEAR == static_cast<DirectX::WIC_FLAGS>(TEX_FILTER_LINEAR), "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_FILTER_CUBIC == static_cast<DirectX::WIC_FLAGS>(TEX_FILTER_CUBIC), "WIC_FLAGS_* & TEX_FILTER_* should match");
static_assert(WIC_FLAGS_FILTER_FANT == static_cast<DirectX::WIC_FLAGS>(TEX_FILTER_FANT), "WIC_FLAGS_* & TEX_FILTER_* should match");
return LoadFromWICFile(fileName, dwFilter | WIC_FLAGS_ALL_FRAMES, &info, *image);
}
@@ -705,7 +705,7 @@ namespace
HRESULT hr = EvaluateImage(image, [&](const XMVECTOR * pixels, size_t width, size_t y)
{
static const XMVECTORF32 s_luminance = { 0.3f, 0.59f, 0.11f, 0.f };
static const XMVECTORF32 s_luminance = {{{ 0.3f, 0.59f, 0.11f, 0.f }}};
UNREFERENCED_PARAMETER(y);
@@ -1368,7 +1368,7 @@ namespace
}
//--------------------------------------------------------------------------------------
#define SIGN_EXTEND(x,nb) ((((x)&(1<<((nb)-1)))?((~0)<<(nb)):0)|(x))
#define SIGN_EXTEND(x,nb) ((((x)&(1<<((nb)-1)))?((~0)^((1<<(nb))-1)):0)|(x))
#define NUM_PIXELS_PER_BLOCK 16
@@ -1728,8 +1728,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 10);
e0_A.y = SIGN_EXTEND(e0_A.y, 10);
e0_A.z = SIGN_EXTEND(e0_A.z, 10);
@@ -1745,7 +1743,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 5);
e1_B.y = SIGN_EXTEND(e1_B.y, 5);
e1_B.z = SIGN_EXTEND(e1_B.z, 5);
#pragma prefast(pop)
}
wprintf(L"\tMode 1 - [10 5 5 5] shape %llu\n", m->d);
@@ -1807,8 +1804,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 7);
e0_A.y = SIGN_EXTEND(e0_A.y, 7);
e0_A.z = SIGN_EXTEND(e0_A.z, 7);
@@ -1824,7 +1819,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 6);
e1_B.y = SIGN_EXTEND(e1_B.y, 6);
e1_B.z = SIGN_EXTEND(e1_B.z, 6);
#pragma prefast(pop)
}
wprintf(L"\tMode 2 - [7 6 6 6] shape %llu\n", m->d);
@@ -1888,8 +1882,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 11);
e0_A.y = SIGN_EXTEND(e0_A.y, 11);
e0_A.z = SIGN_EXTEND(e0_A.z, 11);
@@ -1905,7 +1897,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 5);
e1_B.y = SIGN_EXTEND(e1_B.y, 4);
e1_B.z = SIGN_EXTEND(e1_B.z, 4);
#pragma prefast(pop)
}
wprintf(L"\tMode 3 - [11 5 4 4] shape %llu\n", m->d);
@@ -1969,8 +1960,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 11);
e0_A.y = SIGN_EXTEND(e0_A.y, 11);
e0_A.z = SIGN_EXTEND(e0_A.z, 11);
@@ -1986,7 +1975,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 4);
e1_B.y = SIGN_EXTEND(e1_B.y, 5);
e1_B.z = SIGN_EXTEND(e1_B.z, 4);
#pragma prefast(pop)
}
wprintf(L"\tMode 4 - [11 4 5 4] shape %llu\n", m->d);
@@ -2045,8 +2033,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 11);
e0_A.y = SIGN_EXTEND(e0_A.y, 11);
e0_A.z = SIGN_EXTEND(e0_A.z, 11);
@@ -2062,7 +2048,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 4);
e1_B.y = SIGN_EXTEND(e1_B.y, 4);
e1_B.z = SIGN_EXTEND(e1_B.z, 5);
#pragma prefast(pop)
}
wprintf(L"\tMode 5 - [11 4 4 5] shape %llu\n", m->d);
@@ -2122,8 +2107,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 9);
e0_A.y = SIGN_EXTEND(e0_A.y, 9);
e0_A.z = SIGN_EXTEND(e0_A.z, 9);
@@ -2139,7 +2122,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 5);
e1_B.y = SIGN_EXTEND(e1_B.y, 5);
e1_B.z = SIGN_EXTEND(e1_B.z, 5);
#pragma prefast(pop)
}
wprintf(L"\tMode 6 - [9 5 5 5] shape %llu\n", m->d);
@@ -2199,8 +2181,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 8);
e0_A.y = SIGN_EXTEND(e0_A.y, 8);
e0_A.z = SIGN_EXTEND(e0_A.z, 8);
@@ -2216,7 +2196,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 6);
e1_B.y = SIGN_EXTEND(e1_B.y, 5);
e1_B.z = SIGN_EXTEND(e1_B.z, 5);
#pragma prefast(pop)
}
wprintf(L"\tMode 7 - [8 6 5 5] shape %llu\n", m->d);
@@ -2278,8 +2257,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 8);
e0_A.y = SIGN_EXTEND(e0_A.y, 8);
e0_A.z = SIGN_EXTEND(e0_A.z, 8);
@@ -2295,7 +2272,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 5);
e1_B.y = SIGN_EXTEND(e1_B.y, 6);
e1_B.z = SIGN_EXTEND(e1_B.z, 5);
#pragma prefast(pop)
}
wprintf(L"\tMode 8 - [8 5 6 5] shape %llu\n", m->d);
@@ -2357,8 +2333,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 8);
e0_A.y = SIGN_EXTEND(e0_A.y, 8);
e0_A.z = SIGN_EXTEND(e0_A.z, 8);
@@ -2374,7 +2348,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 5);
e1_B.y = SIGN_EXTEND(e1_B.y, 5);
e1_B.z = SIGN_EXTEND(e1_B.z, 6);
#pragma prefast(pop)
}
wprintf(L"\tMode 9 - [8 5 5 6] shape %llu\n", m->d);
@@ -2436,8 +2409,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 6);
e0_A.y = SIGN_EXTEND(e0_A.y, 6);
e0_A.z = SIGN_EXTEND(e0_A.z, 6);
@@ -2453,7 +2424,6 @@ namespace
e1_B.x = SIGN_EXTEND(e1_B.x, 6);
e1_B.y = SIGN_EXTEND(e1_B.y, 6);
e1_B.z = SIGN_EXTEND(e1_B.z, 6);
#pragma prefast(pop)
}
wprintf(L"\tMode 10 - [6 6 6 6] shape %llu\n", m->d);
@@ -2494,8 +2464,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 10);
e0_A.y = SIGN_EXTEND(e0_A.y, 10);
e0_A.z = SIGN_EXTEND(e0_A.z, 10);
@@ -2503,7 +2471,6 @@ namespace
e0_B.x = SIGN_EXTEND(e0_B.x, 10);
e0_B.y = SIGN_EXTEND(e0_B.y, 10);
e0_B.z = SIGN_EXTEND(e0_B.z, 10);
#pragma prefast(pop)
}
wprintf(L"\tMode 11 - [10 10]\n");
@@ -2545,8 +2512,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 11);
e0_A.y = SIGN_EXTEND(e0_A.y, 11);
e0_A.z = SIGN_EXTEND(e0_A.z, 11);
@@ -2554,7 +2519,6 @@ namespace
e0_B.x = SIGN_EXTEND(e0_B.x, 9);
e0_B.y = SIGN_EXTEND(e0_B.y, 9);
e0_B.z = SIGN_EXTEND(e0_B.z, 9);
#pragma prefast(pop)
}
wprintf(L"\tMode 12 - [11 9]\n");
@@ -2599,8 +2563,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 12);
e0_A.y = SIGN_EXTEND(e0_A.y, 12);
e0_A.z = SIGN_EXTEND(e0_A.z, 12);
@@ -2608,7 +2570,6 @@ namespace
e0_B.x = SIGN_EXTEND(e0_B.x, 8);
e0_B.y = SIGN_EXTEND(e0_B.y, 8);
e0_B.z = SIGN_EXTEND(e0_B.z, 8);
#pragma prefast(pop)
}
wprintf(L"\tMode 13 - [12 8]\n");
@@ -2665,8 +2626,6 @@ namespace
if (bSigned)
{
#pragma prefast(push)
#pragma prefast(disable : 26453, "Shift here is never negative")
e0_A.x = SIGN_EXTEND(e0_A.x, 16);
e0_A.y = SIGN_EXTEND(e0_A.y, 16);
e0_A.z = SIGN_EXTEND(e0_A.z, 16);
@@ -2674,7 +2633,6 @@ namespace
e0_B.x = SIGN_EXTEND(e0_B.x, 4);
e0_B.y = SIGN_EXTEND(e0_B.y, 4);
e0_B.z = SIGN_EXTEND(e0_B.z, 4);
#pragma prefast(pop)
}
wprintf(L"\tMode 14 - [16 4]\n");