mirror of
https://github.com/microsoft/DirectXMath
synced 2024-11-25 05:30:04 +00:00
SHMath clang warning cleanup
This commit is contained in:
parent
0aa6a41e8f
commit
dd0a88f83f
@ -11,6 +11,13 @@
|
|||||||
// C4619 #pragma warning warnings
|
// C4619 #pragma warning warnings
|
||||||
// C4456 declaration hides previous local declaration
|
// C4456 declaration hides previous local declaration
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||||
|
#pragma clang diagnostic ignored "-Wshadow"
|
||||||
|
#pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||||
|
#pragma clang diagnostic ignored "-Wunused-function"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "DirectXSH.h"
|
#include "DirectXSH.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@ -18,7 +25,9 @@ using namespace DirectX;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
#ifdef _PREFAST_
|
||||||
#pragma prefast(disable:246, "generated code by maple (nested const variable definitions)")
|
#pragma prefast(disable:246, "generated code by maple (nested const variable definitions)")
|
||||||
|
#endif
|
||||||
|
|
||||||
const float fExtraNormFac[XM_SH_MAXORDER] = { 2.0f*sqrtf(XM_PI), 2.0f / 3.0f*sqrtf(3.0f*XM_PI), 2.0f / 5.0f*sqrtf(5.0f*XM_PI), 2.0f / 7.0f*sqrtf(7.0f*XM_PI), 2.0f / 3.0f*sqrtf(XM_PI), 2.0f / 11.0f*sqrtf(11.0f*XM_PI) };
|
const float fExtraNormFac[XM_SH_MAXORDER] = { 2.0f*sqrtf(XM_PI), 2.0f / 3.0f*sqrtf(3.0f*XM_PI), 2.0f / 5.0f*sqrtf(5.0f*XM_PI), 2.0f / 7.0f*sqrtf(7.0f*XM_PI), 2.0f / 3.0f*sqrtf(XM_PI), 2.0f / 11.0f*sqrtf(11.0f*XM_PI) };
|
||||||
|
|
||||||
|
@ -9,12 +9,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define DIRECTX_SHMATH_VERSION 104
|
#define DIRECTX_SHMATH_VERSION 105
|
||||||
|
|
||||||
#include <DirectXMath.h>
|
#include <DirectXMath.h>
|
||||||
|
|
||||||
#include <winerror.h>
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
const size_t XM_SH_MINORDER = 2;
|
const size_t XM_SH_MINORDER = 2;
|
||||||
|
@ -25,6 +25,11 @@
|
|||||||
|
|
||||||
#include <wrl/client.h>
|
#include <wrl/client.h>
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic ignored "-Wcovered-switch-default"
|
||||||
|
#pragma clang diagnostic ignored "-Wswitch-enum"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
|
|
||||||
using Microsoft::WRL::ComPtr;
|
using Microsoft::WRL::ComPtr;
|
||||||
@ -90,7 +95,7 @@ namespace
|
|||||||
size_t size,
|
size_t size,
|
||||||
DXGI_FORMAT format)
|
DXGI_FORMAT format)
|
||||||
{
|
{
|
||||||
assert(pDestination && count > 0 && (((uintptr_t)pDestination & 0xF) == 0));
|
assert(pDestination && count > 0 && ((reinterpret_cast<uintptr_t>(pDestination) & 0xF) == 0));
|
||||||
assert(pSource && size > 0);
|
assert(pSource && size > 0);
|
||||||
|
|
||||||
using namespace DirectX::PackedVector;
|
using namespace DirectX::PackedVector;
|
||||||
@ -120,7 +125,7 @@ namespace
|
|||||||
LOAD_SCANLINE2(XMFLOAT2, XMLoadFloat2, g_XMIdentityR3)
|
LOAD_SCANLINE2(XMFLOAT2, XMLoadFloat2, g_XMIdentityR3)
|
||||||
|
|
||||||
case DXGI_FORMAT_R11G11B10_FLOAT:
|
case DXGI_FORMAT_R11G11B10_FLOAT:
|
||||||
LOAD_SCANLINE3(XMFLOAT3PK, XMLoadFloat3PK, g_XMIdentityR3);
|
LOAD_SCANLINE3(XMFLOAT3PK, XMLoadFloat3PK, g_XMIdentityR3)
|
||||||
|
|
||||||
case DXGI_FORMAT_R16G16_FLOAT:
|
case DXGI_FORMAT_R16G16_FLOAT:
|
||||||
LOAD_SCANLINE2(XMHALF2, XMLoadHalf2, g_XMIdentityR3)
|
LOAD_SCANLINE2(XMHALF2, XMLoadHalf2, g_XMIdentityR3)
|
||||||
@ -230,7 +235,7 @@ HRESULT DirectX::SHProjectCubeMap(
|
|||||||
else
|
else
|
||||||
texture = cubeMap;
|
texture = cubeMap;
|
||||||
|
|
||||||
assert(texture != 0);
|
assert(texture != nullptr);
|
||||||
|
|
||||||
//--- Setup for SH projection
|
//--- Setup for SH projection
|
||||||
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR)*desc.Width, 16)));
|
ScopedAlignedArrayXMVECTOR scanline(reinterpret_cast<XMVECTOR*>(_aligned_malloc(sizeof(XMVECTOR)*desc.Width, 16)));
|
||||||
@ -294,39 +299,39 @@ HRESULT DirectX::SHProjectCubeMap(
|
|||||||
switch (face)
|
switch (face)
|
||||||
{
|
{
|
||||||
case 0: // Positive X
|
case 0: // Positive X
|
||||||
iz = 1.0f - (2.0f * (float)x + 1.0f) * fPicSize;
|
iz = 1.0f - (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
iy = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iy = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
ix = 1.0f;
|
ix = 1.0f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // Negative X
|
case 1: // Negative X
|
||||||
iz = -1.0f + (2.0f * (float)x + 1.0f) * fPicSize;
|
iz = -1.0f + (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
iy = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iy = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
ix = -1;
|
ix = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // Positive Y
|
case 2: // Positive Y
|
||||||
iz = -1.0f + (2.0f * (float)y + 1.0f) * fPicSize;
|
iz = -1.0f + (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
iy = 1.0f;
|
iy = 1.0f;
|
||||||
ix = -1.0f + (2.0f * (float)x + 1.0f) * fPicSize;
|
ix = -1.0f + (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // Negative Y
|
case 3: // Negative Y
|
||||||
iz = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iz = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
iy = -1.0f;
|
iy = -1.0f;
|
||||||
ix = -1.0f + (2.0f * (float)x + 1.0f) * fPicSize;
|
ix = -1.0f + (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // Positive Z
|
case 4: // Positive Z
|
||||||
iz = 1.0f;
|
iz = 1.0f;
|
||||||
iy = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iy = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
ix = -1.0f + (2.0f * (float)x + 1.0f) * fPicSize;
|
ix = -1.0f + (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // Negative Z
|
case 5: // Negative Z
|
||||||
iz = -1.0f;
|
iz = -1.0f;
|
||||||
iy = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iy = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
ix = 1.0f - (2.0f * (float)x + 1.0f) * fPicSize;
|
ix = 1.0f - (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -25,6 +25,11 @@
|
|||||||
|
|
||||||
#include <wrl/client.h>
|
#include <wrl/client.h>
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic ignored "-Wcovered-switch-default"
|
||||||
|
#pragma clang diagnostic ignored "-Wswitch-enum"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
|
|
||||||
using Microsoft::WRL::ComPtr;
|
using Microsoft::WRL::ComPtr;
|
||||||
@ -90,7 +95,7 @@ namespace
|
|||||||
size_t size,
|
size_t size,
|
||||||
DXGI_FORMAT format)
|
DXGI_FORMAT format)
|
||||||
{
|
{
|
||||||
assert(pDestination && count > 0 && (((uintptr_t)pDestination & 0xF) == 0));
|
assert(pDestination && count > 0 && ((reinterpret_cast<uintptr_t>(pDestination) & 0xF) == 0));
|
||||||
assert(pSource && size > 0);
|
assert(pSource && size > 0);
|
||||||
|
|
||||||
using namespace DirectX::PackedVector;
|
using namespace DirectX::PackedVector;
|
||||||
@ -120,7 +125,7 @@ namespace
|
|||||||
LOAD_SCANLINE2(XMFLOAT2, XMLoadFloat2, g_XMIdentityR3)
|
LOAD_SCANLINE2(XMFLOAT2, XMLoadFloat2, g_XMIdentityR3)
|
||||||
|
|
||||||
case DXGI_FORMAT_R11G11B10_FLOAT:
|
case DXGI_FORMAT_R11G11B10_FLOAT:
|
||||||
LOAD_SCANLINE3(XMFLOAT3PK, XMLoadFloat3PK, g_XMIdentityR3);
|
LOAD_SCANLINE3(XMFLOAT3PK, XMLoadFloat3PK, g_XMIdentityR3)
|
||||||
|
|
||||||
case DXGI_FORMAT_R16G16_FLOAT:
|
case DXGI_FORMAT_R16G16_FLOAT:
|
||||||
LOAD_SCANLINE2(XMHALF2, XMLoadHalf2, g_XMIdentityR3)
|
LOAD_SCANLINE2(XMHALF2, XMLoadHalf2, g_XMIdentityR3)
|
||||||
@ -241,7 +246,7 @@ HRESULT DirectX::SHProjectCubeMap(
|
|||||||
for (UINT y = 0; y < desc.Height; ++y)
|
for (UINT y = 0; y < desc.Height; ++y)
|
||||||
{
|
{
|
||||||
XMVECTOR* ptr = scanline.get();
|
XMVECTOR* ptr = scanline.get();
|
||||||
if (!_LoadScanline(ptr, static_cast<size_t>(desc.Width), pSrc, cubeMap[face].RowPitch, desc.Format))
|
if (!_LoadScanline(ptr, static_cast<size_t>(desc.Width), pSrc, static_cast<size_t>(cubeMap[face].RowPitch), desc.Format))
|
||||||
{
|
{
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
@ -257,39 +262,39 @@ HRESULT DirectX::SHProjectCubeMap(
|
|||||||
switch (face)
|
switch (face)
|
||||||
{
|
{
|
||||||
case 0: // Positive X
|
case 0: // Positive X
|
||||||
iz = 1.0f - (2.0f * (float)x + 1.0f) * fPicSize;
|
iz = 1.0f - (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
iy = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iy = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
ix = 1.0f;
|
ix = 1.0f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // Negative X
|
case 1: // Negative X
|
||||||
iz = -1.0f + (2.0f * (float)x + 1.0f) * fPicSize;
|
iz = -1.0f + (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
iy = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iy = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
ix = -1;
|
ix = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // Positive Y
|
case 2: // Positive Y
|
||||||
iz = -1.0f + (2.0f * (float)y + 1.0f) * fPicSize;
|
iz = -1.0f + (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
iy = 1.0f;
|
iy = 1.0f;
|
||||||
ix = -1.0f + (2.0f * (float)x + 1.0f) * fPicSize;
|
ix = -1.0f + (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // Negative Y
|
case 3: // Negative Y
|
||||||
iz = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iz = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
iy = -1.0f;
|
iy = -1.0f;
|
||||||
ix = -1.0f + (2.0f * (float)x + 1.0f) * fPicSize;
|
ix = -1.0f + (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // Positive Z
|
case 4: // Positive Z
|
||||||
iz = 1.0f;
|
iz = 1.0f;
|
||||||
iy = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iy = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
ix = -1.0f + (2.0f * (float)x + 1.0f) * fPicSize;
|
ix = -1.0f + (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // Negative Z
|
case 5: // Negative Z
|
||||||
iz = -1.0f;
|
iz = -1.0f;
|
||||||
iy = 1.0f - (2.0f * (float)y + 1.0f) * fPicSize;
|
iy = 1.0f - (2.0f * float(y) + 1.0f) * fPicSize;
|
||||||
ix = 1.0f - (2.0f * (float)x + 1.0f) * fPicSize;
|
ix = 1.0f - (2.0f * float(x) + 1.0f) * fPicSize;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user