DDS header updated for GNUC compiler

This commit is contained in:
Chuck Walbourn 2021-01-05 01:54:28 -08:00
Родитель 7d9836759c
Коммит d21a16ef0d
2 изменённых файлов: 53 добавлений и 45 удалений

Просмотреть файл

@ -61,7 +61,7 @@ set(LIBRARY_SOURCES
Src/BufferHelpers.cpp
Src/CommonStates.cpp
Src/d3dx12.h
Src/dds.h
Src/DDS.h
Src/DDSTextureLoader.cpp
Src/DebugEffect.cpp
Src/DemandCreate.h

Просмотреть файл

@ -1,11 +1,11 @@
//--------------------------------------------------------------------------------------
// dds.h
// DDS.h
//
// This header defines constants and structures that are useful when parsing
// 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
// 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.
@ -57,117 +57,125 @@ struct DDS_PIXELFORMAT
| (static_cast<uint32_t>(static_cast<uint8_t>(ch1)) << 8) \
| (static_cast<uint32_t>(static_cast<uint8_t>(ch2)) << 16) \
| (static_cast<uint32_t>(static_cast<uint8_t>(ch3)) << 24))
#endif /* defined(MAKEFOURCC) */
#endif /* MAKEFOURCC */
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DXT1 =
#ifndef DDSGLOBALCONST
#if defined(__GNUC__) && !defined(__MINGW32__)
#define DDSGLOBALCONST extern const __attribute__((weak))
#else
#define DDSGLOBALCONST extern const __declspec(selectany)
#endif
#endif /* DDSGLOBALCONST */
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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 =
DDSGLOBALCONST 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_UYVY =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_UYVY =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('U','Y','V','Y'), 0, 0, 0, 0, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8R8G8B8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8R8G8B8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8R8G8B8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X8R8G8B8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8B8G8R8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8B8G8R8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X8B8G8R8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X8B8G8R8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_G16R16 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_G16R16 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x0000ffff, 0xffff0000, 0, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R5G6B5 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R5G6B5 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0xf800, 0x07e0, 0x001f, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A1R5G5B5 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A1R5G5B5 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x7c00, 0x03e0, 0x001f, 0x8000 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X1R5G5B5 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X1R5G5B5 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x7c00, 0x03e0, 0x001f, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A4R4G4B4 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A4R4G4B4 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x0f00, 0x00f0, 0x000f, 0xf000 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_X4R4G4B4 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X4R4G4B4 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x0f00, 0x00f0, 0x000f, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R8G8B8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R8G8B8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 24, 0xff0000, 0x00ff00, 0x0000ff, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8R3G3B2 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8R3G3B2 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00e0, 0x001c, 0x0003, 0xff00 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_R3G3B2 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R3G3B2 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 8, 0xe0, 0x1c, 0x03, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A4L4 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A4L4 =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 8, 0x0f, 0, 0, 0xf0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L8 =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 8, 0xff, 0, 0, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_L16 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L16 =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 16, 0xffff, 0, 0, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8L8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8L8 =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 16, 0x00ff, 0, 0, 0xff00 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8L8_ALT =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8L8_ALT =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 8, 0x00ff, 0, 0, 0xff00 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8 =
{ sizeof(DDS_PIXELFORMAT), DDS_ALPHA, 0, 8, 0, 0, 0, 0xff };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_V8U8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_V8U8 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 16, 0x00ff, 0xff00, 0, 0 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_Q8W8V8U8 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_Q8W8V8U8 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_V16U16 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_V16U16 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x0000ffff, 0xffff0000, 0, 0 };
// D3DFMT_A2R10G10B10/D3DFMT_A2B10G10R10 should be written using DX10 extension to avoid D3DX 10:10:10:2 reversal issue
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A2R10G10B10 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A2R10G10B10 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000 };
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A2B10G10R10 =
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A2B10G10R10 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000 };
// We do not support the following legacy Direct3D 9 formats:
@ -176,10 +184,10 @@ extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_A2B10G10R10 =
// DDSPF_X8L8V8U8 = { sizeof(DDS_PIXELFORMAT), DDS_BUMPLUMINANCE, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0 };
// This indicates the DDS_HEADER_DXT10 extension is present (the format is in dxgiFormat)
extern __declspec(selectany) const DDS_PIXELFORMAT DDSPF_DX10 =
DDSGLOBALCONST 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_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