Fixed -Wmacro-redefined, -Wextra-semi-stmt, -Wdefaulted-function-deleted warnings
This commit is contained in:
Родитель
2777c0d939
Коммит
fd94273daa
|
@ -477,7 +477,7 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI
|
|||
hr = mMasterVoice->GetChannelMask(&dwChannelMask);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
xaudio2.Reset();
|
||||
return hr;
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI
|
|||
hr = mMasterVoice->SetVolume(mMasterVolume);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
xaudio2.Reset();
|
||||
return hr;
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI
|
|||
#endif
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
xaudio2.Reset();
|
||||
return hr;
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI
|
|||
hr = mMasterVoice->SetEffectChain(&chain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
mVolumeLimiter.Reset();
|
||||
xaudio2.Reset();
|
||||
return hr;
|
||||
|
@ -616,7 +616,7 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI
|
|||
hr = mMasterVoice->SetEffectParameters(0, ¶ms, sizeof(params));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
mVolumeLimiter.Reset();
|
||||
xaudio2.Reset();
|
||||
return hr;
|
||||
|
@ -641,7 +641,7 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI
|
|||
hr = XAudio2CreateReverb(mReverbEffect.ReleaseAndGetAddressOf(), rflags);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
mVolumeLimiter.Reset();
|
||||
xaudio2.Reset();
|
||||
return hr;
|
||||
|
@ -657,7 +657,7 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI
|
|||
nullptr, &effectChain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
mReverbEffect.Reset();
|
||||
mVolumeLimiter.Reset();
|
||||
xaudio2.Reset();
|
||||
|
@ -669,8 +669,8 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI
|
|||
hr = mReverbVoice->SetEffectParameters(0, &native, sizeof(XAUDIO2FX_REVERB_PARAMETERS));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SAFE_DESTROY_VOICE(mReverbVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mReverbVoice)
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
mReverbEffect.Reset();
|
||||
mVolumeLimiter.Reset();
|
||||
xaudio2.Reset();
|
||||
|
@ -689,8 +689,8 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI
|
|||
hr = X3DAudioInitialize(masterChannelMask, SPEEDOFSOUND, mX3DAudio);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SAFE_DESTROY_VOICE(mReverbVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mReverbVoice)
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
mReverbEffect.Reset();
|
||||
mVolumeLimiter.Reset();
|
||||
xaudio2.Reset();
|
||||
|
@ -737,8 +737,8 @@ void AudioEngine::Impl::SetSilentMode()
|
|||
|
||||
mVoiceInstances = 0;
|
||||
|
||||
SAFE_DESTROY_VOICE(mReverbVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mReverbVoice)
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
|
||||
mReverbEffect.Reset();
|
||||
mVolumeLimiter.Reset();
|
||||
|
@ -776,8 +776,8 @@ void AudioEngine::Impl::Shutdown()
|
|||
|
||||
mVoiceInstances = 0;
|
||||
|
||||
SAFE_DESTROY_VOICE(mReverbVoice);
|
||||
SAFE_DESTROY_VOICE(mMasterVoice);
|
||||
SAFE_DESTROY_VOICE(mReverbVoice)
|
||||
SAFE_DESTROY_VOICE(mMasterVoice)
|
||||
|
||||
mReverbEffect.Reset();
|
||||
mVolumeLimiter.Reset();
|
||||
|
|
|
@ -591,7 +591,7 @@ void DirectX::CreateXMA2(WAVEFORMATEX* wfx, size_t wfxSize, int sampleRate, int
|
|||
throw std::invalid_argument("XMA2WAVEFORMATEX");
|
||||
}
|
||||
|
||||
if (!bytesPerBlock || (bytesPerBlock > XMA_READBUFFER_MAX_BYTES))
|
||||
if ((bytesPerBlock < 1) || (bytesPerBlock > int(XMA_READBUFFER_MAX_BYTES)))
|
||||
{
|
||||
DebugTrace("XMA2 needs a valid bytes per block\n");
|
||||
throw std::invalid_argument("XMA2WAVEFORMATEX");
|
||||
|
@ -614,7 +614,7 @@ void DirectX::CreateXMA2(WAVEFORMATEX* wfx, size_t wfxSize, int sampleRate, int
|
|||
xmaFmt->ChannelMask = GetDefaultChannelMask(channels);
|
||||
|
||||
xmaFmt->SamplesEncoded = static_cast<DWORD>(samplesEncoded);
|
||||
xmaFmt->BytesPerBlock = bytesPerBlock;
|
||||
xmaFmt->BytesPerBlock = static_cast<DWORD>(bytesPerBlock);
|
||||
xmaFmt->PlayBegin = xmaFmt->PlayLength =
|
||||
xmaFmt->LoopBegin = xmaFmt->LoopLength = xmaFmt->LoopCount = 0;
|
||||
xmaFmt->EncoderVersion = 4 /* XMAENCODER_VERSION_XMA2 */;
|
||||
|
|
|
@ -107,8 +107,8 @@ namespace DirectX
|
|||
struct Vector2 : public XMFLOAT2
|
||||
{
|
||||
Vector2() noexcept : XMFLOAT2(0.f, 0.f) {}
|
||||
XM_CONSTEXPR explicit Vector2(float x) : XMFLOAT2(x, x) {}
|
||||
XM_CONSTEXPR Vector2(float _x, float _y) : XMFLOAT2(_x, _y) {}
|
||||
XM_CONSTEXPR explicit Vector2(float ix) : XMFLOAT2(ix, ix) {}
|
||||
XM_CONSTEXPR Vector2(float ix, float iy) : XMFLOAT2(ix, iy) {}
|
||||
explicit Vector2(_In_reads_(2) const float *pArray) : XMFLOAT2(pArray) {}
|
||||
Vector2(FXMVECTOR V) { XMStoreFloat2(this, V); }
|
||||
Vector2(const XMFLOAT2& V) { this->x = V.x; this->y = V.y; }
|
||||
|
@ -219,8 +219,8 @@ namespace DirectX
|
|||
struct Vector3 : public XMFLOAT3
|
||||
{
|
||||
Vector3() noexcept : XMFLOAT3(0.f, 0.f, 0.f) {}
|
||||
XM_CONSTEXPR explicit Vector3(float x) : XMFLOAT3(x, x, x) {}
|
||||
XM_CONSTEXPR Vector3(float _x, float _y, float _z) : XMFLOAT3(_x, _y, _z) {}
|
||||
XM_CONSTEXPR explicit Vector3(float ix) : XMFLOAT3(ix, ix, ix) {}
|
||||
XM_CONSTEXPR Vector3(float ix, float iy, float iz) : XMFLOAT3(ix, iy, iz) {}
|
||||
explicit Vector3(_In_reads_(3) const float *pArray) : XMFLOAT3(pArray) {}
|
||||
Vector3(FXMVECTOR V) { XMStoreFloat3(this, V); }
|
||||
Vector3(const XMFLOAT3& V) { this->x = V.x; this->y = V.y; this->z = V.z; }
|
||||
|
@ -338,8 +338,8 @@ namespace DirectX
|
|||
struct Vector4 : public XMFLOAT4
|
||||
{
|
||||
Vector4() noexcept : XMFLOAT4(0.f, 0.f, 0.f, 0.f) {}
|
||||
XM_CONSTEXPR explicit Vector4(float x) : XMFLOAT4(x, x, x, x) {}
|
||||
XM_CONSTEXPR Vector4(float _x, float _y, float _z, float _w) : XMFLOAT4(_x, _y, _z, _w) {}
|
||||
XM_CONSTEXPR explicit Vector4(float ix) : XMFLOAT4(ix, ix, ix, ix) {}
|
||||
XM_CONSTEXPR Vector4(float ix, float iy, float iz, float iw) : XMFLOAT4(ix, iy, iz, iw) {}
|
||||
explicit Vector4(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {}
|
||||
Vector4(FXMVECTOR V) { XMStoreFloat4(this, V); }
|
||||
Vector4(const XMFLOAT4& V) { this->x = V.x; this->y = V.y; this->z = V.z; this->w = V.w; }
|
||||
|
@ -603,7 +603,7 @@ namespace DirectX
|
|||
struct Plane : public XMFLOAT4
|
||||
{
|
||||
Plane() noexcept : XMFLOAT4(0.f, 1.f, 0.f, 0.f) {}
|
||||
XM_CONSTEXPR Plane(float _x, float _y, float _z, float _w) : XMFLOAT4(_x, _y, _z, _w) {}
|
||||
XM_CONSTEXPR Plane(float ix, float iy, float iz, float iw) : XMFLOAT4(ix, iy, iz, iw) {}
|
||||
Plane(const Vector3& normal, float d) : XMFLOAT4(normal.x, normal.y, normal.z, d) {}
|
||||
Plane(const Vector3& point1, const Vector3& point2, const Vector3& point3);
|
||||
Plane(const Vector3& point, const Vector3& normal);
|
||||
|
@ -657,7 +657,7 @@ namespace DirectX
|
|||
struct Quaternion : public XMFLOAT4
|
||||
{
|
||||
Quaternion() noexcept : XMFLOAT4(0, 0, 0, 1.f) {}
|
||||
XM_CONSTEXPR Quaternion(float _x, float _y, float _z, float _w) : XMFLOAT4(_x, _y, _z, _w) {}
|
||||
XM_CONSTEXPR Quaternion(float ix, float iy, float iz, float iw) : XMFLOAT4(ix, iy, iz, iw) {}
|
||||
Quaternion(const Vector3& v, float scalar) : XMFLOAT4(v.x, v.y, v.z, scalar) {}
|
||||
explicit Quaternion(const Vector4& v) : XMFLOAT4(v.x, v.y, v.z, v.w) {}
|
||||
explicit Quaternion(_In_reads_(4) const float *pArray) : XMFLOAT4(pArray) {}
|
||||
|
|
|
@ -77,4 +77,4 @@ namespace Xbox
|
|||
_Out_opt_ bool* isCubeMap = nullptr);
|
||||
|
||||
void FreeDDSTextureMemory(_In_opt_ void* grfxMemory);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1307,25 +1307,25 @@ GamePad& GamePad::Get()
|
|||
|
||||
void GamePad::ButtonStateTracker::Update(const GamePad::State& state)
|
||||
{
|
||||
UPDATE_BUTTON_STATE(a);
|
||||
UPDATE_BUTTON_STATE(a)
|
||||
|
||||
assert((!state.buttons.a && !lastState.buttons.a) == (a == UP));
|
||||
assert((state.buttons.a && lastState.buttons.a) == (a == HELD));
|
||||
assert((!state.buttons.a && lastState.buttons.a) == (a == RELEASED));
|
||||
assert((state.buttons.a && !lastState.buttons.a) == (a == PRESSED));
|
||||
|
||||
UPDATE_BUTTON_STATE(b);
|
||||
UPDATE_BUTTON_STATE(x);
|
||||
UPDATE_BUTTON_STATE(y);
|
||||
UPDATE_BUTTON_STATE(b)
|
||||
UPDATE_BUTTON_STATE(x)
|
||||
UPDATE_BUTTON_STATE(y)
|
||||
|
||||
UPDATE_BUTTON_STATE(leftStick);
|
||||
UPDATE_BUTTON_STATE(rightStick);
|
||||
UPDATE_BUTTON_STATE(leftStick)
|
||||
UPDATE_BUTTON_STATE(rightStick)
|
||||
|
||||
UPDATE_BUTTON_STATE(leftShoulder);
|
||||
UPDATE_BUTTON_STATE(rightShoulder);
|
||||
UPDATE_BUTTON_STATE(leftShoulder)
|
||||
UPDATE_BUTTON_STATE(rightShoulder)
|
||||
|
||||
UPDATE_BUTTON_STATE(back);
|
||||
UPDATE_BUTTON_STATE(start);
|
||||
UPDATE_BUTTON_STATE(back)
|
||||
UPDATE_BUTTON_STATE(start)
|
||||
|
||||
dpadUp = static_cast<ButtonState>((!!state.dpad.up) | ((!!state.dpad.up ^ !!lastState.dpad.up) << 1));
|
||||
dpadDown = static_cast<ButtonState>((!!state.dpad.down) | ((!!state.dpad.down ^ !!lastState.dpad.down) << 1));
|
||||
|
|
|
@ -162,7 +162,9 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(_XBOX_ONE) || !defined(_TITLE)
|
||||
ID3D12Device* GetDevice() const { return mDevice.Get(); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
ComPtr<ID3D12Device> mDevice;
|
||||
|
|
|
@ -52,8 +52,8 @@ namespace DirectX
|
|||
public:
|
||||
LinearAllocatorPage() noexcept;
|
||||
|
||||
LinearAllocatorPage(LinearAllocatorPage&&) = default;
|
||||
LinearAllocatorPage& operator= (LinearAllocatorPage&&) = default;
|
||||
LinearAllocatorPage(LinearAllocatorPage&&) = delete;
|
||||
LinearAllocatorPage& operator= (LinearAllocatorPage&&) = delete;
|
||||
|
||||
LinearAllocatorPage(LinearAllocatorPage const&) = delete;
|
||||
LinearAllocatorPage& operator=(LinearAllocatorPage const&) = delete;
|
||||
|
|
|
@ -1097,17 +1097,17 @@ Mouse& Mouse::Get()
|
|||
|
||||
void Mouse::ButtonStateTracker::Update(const Mouse::State& state)
|
||||
{
|
||||
UPDATE_BUTTON_STATE(leftButton);
|
||||
UPDATE_BUTTON_STATE(leftButton)
|
||||
|
||||
assert((!state.leftButton && !lastState.leftButton) == (leftButton == UP));
|
||||
assert((state.leftButton && lastState.leftButton) == (leftButton == HELD));
|
||||
assert((!state.leftButton && lastState.leftButton) == (leftButton == RELEASED));
|
||||
assert((state.leftButton && !lastState.leftButton) == (leftButton == PRESSED));
|
||||
|
||||
UPDATE_BUTTON_STATE(middleButton);
|
||||
UPDATE_BUTTON_STATE(rightButton);
|
||||
UPDATE_BUTTON_STATE(xButton1);
|
||||
UPDATE_BUTTON_STATE(xButton2);
|
||||
UPDATE_BUTTON_STATE(middleButton)
|
||||
UPDATE_BUTTON_STATE(rightButton)
|
||||
UPDATE_BUTTON_STATE(xButton1)
|
||||
UPDATE_BUTTON_STATE(xButton2)
|
||||
|
||||
lastState = state;
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
|
|||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
// Round up the srcPitch to multiples of 1024
|
||||
UINT64 dstRowPitch = (fpRowPitch + D3D12XBOX_TEXTURE_DATA_PITCH_ALIGNMENT - 1) & ~(D3D12XBOX_TEXTURE_DATA_PITCH_ALIGNMENT - 1);
|
||||
UINT64 dstRowPitch = (fpRowPitch + static_cast<uint64_t>(D3D12XBOX_TEXTURE_DATA_PITCH_ALIGNMENT) - 1u) & ~(static_cast<uint64_t>(D3D12XBOX_TEXTURE_DATA_PITCH_ALIGNMENT) - 1u);
|
||||
#else
|
||||
// Round up the srcPitch to multiples of 256
|
||||
UINT64 dstRowPitch = (fpRowPitch + 255) & ~0xFFu;
|
||||
|
@ -476,7 +476,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
|||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
// Round up the srcPitch to multiples of 1024
|
||||
UINT64 dstRowPitch = (fpRowPitch + D3D12XBOX_TEXTURE_DATA_PITCH_ALIGNMENT - 1) & ~(D3D12XBOX_TEXTURE_DATA_PITCH_ALIGNMENT - 1);
|
||||
UINT64 dstRowPitch = (fpRowPitch + static_cast<uint64_t>(D3D12XBOX_TEXTURE_DATA_PITCH_ALIGNMENT) - 1u) & ~(static_cast<uint64_t>(D3D12XBOX_TEXTURE_DATA_PITCH_ALIGNMENT) - 1u);
|
||||
#else
|
||||
// Round up the srcPitch to multiples of 256
|
||||
UINT64 dstRowPitch = (fpRowPitch + 255) & ~0xFFu;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "XboxDDSTextureLoader.h"
|
||||
|
||||
#include "PlatformHelpers.h"
|
||||
#include "dds.h"
|
||||
#include "DDS.h"
|
||||
#include "DirectXHelpers.h"
|
||||
|
||||
#include <xdk.h>
|
||||
|
@ -133,7 +133,7 @@ namespace
|
|||
}
|
||||
|
||||
// DDS files always start with the same magic number ("DDS ")
|
||||
uint32_t dwMagicNumber = *(const uint32_t*)(ddsData.get());
|
||||
auto dwMagicNumber = *reinterpret_cast<uint32_t*>(ddsData.get());
|
||||
if (dwMagicNumber != DDS_MAGIC)
|
||||
{
|
||||
return E_FAIL;
|
||||
|
@ -164,7 +164,7 @@ namespace
|
|||
|
||||
// setup the pointers in the process request
|
||||
*header = hdr;
|
||||
ptrdiff_t offset = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_XBOX);
|
||||
auto offset = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_XBOX);
|
||||
*bitData = ddsData.get() + offset;
|
||||
*bitSize = fileInfo.EndOfFile.LowPart - offset;
|
||||
|
||||
|
@ -492,7 +492,7 @@ HRESULT Xbox::CreateDDSTextureFromMemory(
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
uint32_t dwMagicNumber = *( const uint32_t* )( ddsData );
|
||||
auto dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData);
|
||||
if (dwMagicNumber != DDS_MAGIC)
|
||||
{
|
||||
return E_FAIL;
|
||||
|
@ -521,7 +521,7 @@ HRESULT Xbox::CreateDDSTextureFromMemory(
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
ptrdiff_t offset = sizeof( uint32_t ) + sizeof( DDS_HEADER ) + sizeof( DDS_HEADER_XBOX );
|
||||
auto offset = sizeof( uint32_t ) + sizeof( DDS_HEADER ) + sizeof( DDS_HEADER_XBOX );
|
||||
|
||||
HRESULT hr = CreateTextureFromDDS( d3dDevice, header,
|
||||
ddsData + offset, ddsDataSize - offset, forceSRGB,
|
||||
|
|
224
Src/dds.h
224
Src/dds.h
|
@ -1,224 +0,0 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// dds.h
|
||||
//
|
||||
// This header defines constants and structures that are useful when parsing
|
||||
// DDS files. DDS files were originally designed to use several structures
|
||||
// and constants that are native to DirectDraw and are defined in ddraw.h,
|
||||
// such as DDSURFACEDESC2 and DDSCAPS2. This file defines similar
|
||||
// (compatible) constants and structures so that one can use DDS files
|
||||
// without needing to include ddraw.h.
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248926
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
// http://go.microsoft.com/fwlink/?LinkID=615561
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
const uint32_t DDS_MAGIC = 0x20534444; // "DDS "
|
||||
|
||||
struct DDS_PIXELFORMAT
|
||||
{
|
||||
uint32_t size;
|
||||
uint32_t flags;
|
||||
uint32_t fourCC;
|
||||
uint32_t RGBBitCount;
|
||||
uint32_t RBitMask;
|
||||
uint32_t GBitMask;
|
||||
uint32_t BBitMask;
|
||||
uint32_t ABitMask;
|
||||
};
|
||||
|
||||
#define DDS_FOURCC 0x00000004 // DDPF_FOURCC
|
||||
#define DDS_RGB 0x00000040 // DDPF_RGB
|
||||
#define DDS_RGBA 0x00000041 // DDPF_RGB | DDPF_ALPHAPIXELS
|
||||
#define DDS_LUMINANCE 0x00020000 // DDPF_LUMINANCE
|
||||
#define DDS_LUMINANCEA 0x00020001 // DDPF_LUMINANCE | DDPF_ALPHAPIXELS
|
||||
#define DDS_ALPHAPIXELS 0x00000001 // DDPF_ALPHAPIXELS
|
||||
#define DDS_ALPHA 0x00000002 // DDPF_ALPHA
|
||||
#define DDS_PAL8 0x00000020 // DDPF_PALETTEINDEXED8
|
||||
#define DDS_PAL8A 0x00000021 // DDPF_PALETTEINDEXED8 | DDPF_ALPHAPIXELS
|
||||
#define DDS_BUMPDUDV 0x00080000 // DDPF_BUMPDUDV
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT1 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','1'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT2 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','2'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT3 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','3'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT4 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','4'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT5 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','5'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC4_UNORM =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','U'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC4_SNORM =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','S'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC5_UNORM =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','U'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_BC5_SNORM =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','S'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R8G8_B8G8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('R','G','B','G'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_G8R8_G8B8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('G','R','G','B'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_YUY2 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8R8G8B8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8R8G8B8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8B8G8R8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8B8G8R8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_G16R16 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R5G6B5 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A1R5G5B5 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A4R4G4B4 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00000f00, 0x000000f0, 0x0000000f, 0x0000f000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R8G8B8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 8, 0xff, 0x00, 0x00, 0x00 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L16 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 16, 0xffff, 0x0000, 0x0000, 0x0000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8L8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 16, 0x00ff, 0x0000, 0x0000, 0xff00 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8L8_ALT =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 8, 0x00ff, 0x0000, 0x0000, 0xff00 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_ALPHA, 0, 8, 0x00, 0x00, 0x00, 0xff };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_V8U8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 16, 0x00ff, 0xff00, 0x0000, 0x0000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_Q8W8V8U8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
|
||||
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_V16U16 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000 };
|
||||
|
||||
// D3DFMT_A2R10G10B10/D3DFMT_A2B10G10R10 should be written using DX10 extension to avoid D3DX 10:10:10:2 reversal issue
|
||||
|
||||
// This indicates the DDS_HEADER_DXT10 extension is present (the format is in dxgiFormat)
|
||||
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DX10 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','1','0'), 0, 0, 0, 0, 0 };
|
||||
|
||||
#define DDS_HEADER_FLAGS_TEXTURE 0x00001007 // DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT
|
||||
#define DDS_HEADER_FLAGS_MIPMAP 0x00020000 // DDSD_MIPMAPCOUNT
|
||||
#define DDS_HEADER_FLAGS_VOLUME 0x00800000 // DDSD_DEPTH
|
||||
#define DDS_HEADER_FLAGS_PITCH 0x00000008 // DDSD_PITCH
|
||||
#define DDS_HEADER_FLAGS_LINEARSIZE 0x00080000 // DDSD_LINEARSIZE
|
||||
|
||||
#define DDS_HEIGHT 0x00000002 // DDSD_HEIGHT
|
||||
#define DDS_WIDTH 0x00000004 // DDSD_WIDTH
|
||||
|
||||
#define DDS_SURFACE_FLAGS_TEXTURE 0x00001000 // DDSCAPS_TEXTURE
|
||||
#define DDS_SURFACE_FLAGS_MIPMAP 0x00400008 // DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
|
||||
#define DDS_SURFACE_FLAGS_CUBEMAP 0x00000008 // DDSCAPS_COMPLEX
|
||||
|
||||
#define DDS_CUBEMAP_POSITIVEX 0x00000600 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX
|
||||
#define DDS_CUBEMAP_NEGATIVEX 0x00000a00 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEX
|
||||
#define DDS_CUBEMAP_POSITIVEY 0x00001200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEY
|
||||
#define DDS_CUBEMAP_NEGATIVEY 0x00002200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEY
|
||||
#define DDS_CUBEMAP_POSITIVEZ 0x00004200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ
|
||||
#define DDS_CUBEMAP_NEGATIVEZ 0x00008200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ
|
||||
|
||||
#define DDS_CUBEMAP_ALLFACES ( DDS_CUBEMAP_POSITIVEX | DDS_CUBEMAP_NEGATIVEX |\
|
||||
DDS_CUBEMAP_POSITIVEY | DDS_CUBEMAP_NEGATIVEY |\
|
||||
DDS_CUBEMAP_POSITIVEZ | DDS_CUBEMAP_NEGATIVEZ )
|
||||
|
||||
#define DDS_CUBEMAP 0x00000200 // DDSCAPS2_CUBEMAP
|
||||
|
||||
#define DDS_FLAGS_VOLUME 0x00200000 // DDSCAPS2_VOLUME
|
||||
|
||||
// Subset here matches D3D10_RESOURCE_DIMENSION and D3D11_RESOURCE_DIMENSION
|
||||
enum DDS_RESOURCE_DIMENSION
|
||||
{
|
||||
DDS_DIMENSION_TEXTURE1D = 2,
|
||||
DDS_DIMENSION_TEXTURE2D = 3,
|
||||
DDS_DIMENSION_TEXTURE3D = 4,
|
||||
};
|
||||
|
||||
// Subset here matches D3D10_RESOURCE_MISC_FLAG and D3D11_RESOURCE_MISC_FLAG
|
||||
enum DDS_RESOURCE_MISC_FLAG
|
||||
{
|
||||
DDS_RESOURCE_MISC_TEXTURECUBE = 0x4L,
|
||||
};
|
||||
|
||||
enum DDS_MISC_FLAGS2
|
||||
{
|
||||
DDS_MISC_FLAGS2_ALPHA_MODE_MASK = 0x7L,
|
||||
};
|
||||
|
||||
struct DDS_HEADER
|
||||
{
|
||||
uint32_t size;
|
||||
uint32_t flags;
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
uint32_t pitchOrLinearSize;
|
||||
uint32_t depth; // only if DDS_HEADER_FLAGS_VOLUME is set in flags
|
||||
uint32_t mipMapCount;
|
||||
uint32_t reserved1[11];
|
||||
DDS_PIXELFORMAT ddspf;
|
||||
uint32_t caps;
|
||||
uint32_t caps2;
|
||||
uint32_t caps3;
|
||||
uint32_t caps4;
|
||||
uint32_t reserved2;
|
||||
};
|
||||
|
||||
struct DDS_HEADER_DXT10
|
||||
{
|
||||
DXGI_FORMAT dxgiFormat;
|
||||
uint32_t resourceDimension;
|
||||
uint32_t miscFlag; // see D3D11_RESOURCE_MISC_FLAG
|
||||
uint32_t arraySize;
|
||||
uint32_t miscFlags2; // see DDS_MISC_FLAGS2
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
static_assert( sizeof(DDS_HEADER) == 124, "DDS Header size mismatch" );
|
||||
static_assert( sizeof(DDS_HEADER_DXT10) == 20, "DDS DX10 Extended Header size mismatch");
|
||||
|
||||
} // namespace
|
|
@ -68,9 +68,12 @@
|
|||
#pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4005)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#define NODRAWTEXT
|
||||
#define NOGDI
|
||||
|
|
Загрузка…
Ссылка в новой задаче