-fno-strict-aliasing on the port targets: 40250 relies on MSVC's lack of type-based alias analysis (DXTCImage reads Color8888 through DWORD*). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
123 lines
2.5 KiB
C
123 lines
2.5 KiB
C
#pragma once
|
|
// Shim for the DirectX 7 <d3d.h> on non-Windows targets: the <ddraw.h> surface description 40250
|
|
// EterImageLib/DXTCImage.cpp copies straight out of a .dds file (the 124 bytes after the "DDS " magic).
|
|
//
|
|
// PORT: lpSurface is a pointer in <ddraw.h>, 4 bytes in the 32-bit client; it is a DWORD here so the
|
|
// structure keeps the on-disk layout on 64-bit targets.
|
|
#include "../win32/windows.h"
|
|
|
|
#define DDSD_CAPS 0x00000001l
|
|
#define DDSD_HEIGHT 0x00000002l
|
|
#define DDSD_WIDTH 0x00000004l
|
|
#define DDSD_PITCH 0x00000008l
|
|
#define DDSD_PIXELFORMAT 0x00001000l
|
|
#define DDSD_MIPMAPCOUNT 0x00020000l
|
|
#define DDSD_LINEARSIZE 0x00080000l
|
|
|
|
#define DDPF_ALPHAPIXELS 0x00000001l
|
|
#define DDPF_FOURCC 0x00000004l
|
|
#define DDPF_RGB 0x00000040l
|
|
#define DDPF_ALPHAPREMULT 0x00008000l
|
|
|
|
typedef struct _DDCOLORKEY
|
|
{
|
|
DWORD dwColorSpaceLowValue;
|
|
DWORD dwColorSpaceHighValue;
|
|
} DDCOLORKEY;
|
|
|
|
typedef struct _DDPIXELFORMAT
|
|
{
|
|
DWORD dwSize;
|
|
DWORD dwFlags;
|
|
DWORD dwFourCC;
|
|
union
|
|
{
|
|
DWORD dwRGBBitCount;
|
|
DWORD dwYUVBitCount;
|
|
DWORD dwZBufferBitDepth;
|
|
DWORD dwAlphaBitDepth;
|
|
DWORD dwLuminanceBitCount;
|
|
DWORD dwBumpBitCount;
|
|
DWORD dwPrivateFormatBitCount;
|
|
};
|
|
union
|
|
{
|
|
DWORD dwRBitMask;
|
|
DWORD dwYBitMask;
|
|
DWORD dwStencilBitDepth;
|
|
DWORD dwLuminanceBitMask;
|
|
DWORD dwBumpDuBitMask;
|
|
DWORD dwOperations;
|
|
};
|
|
union
|
|
{
|
|
DWORD dwGBitMask;
|
|
DWORD dwUBitMask;
|
|
DWORD dwZBitMask;
|
|
DWORD dwBumpDvBitMask;
|
|
};
|
|
union
|
|
{
|
|
DWORD dwBBitMask;
|
|
DWORD dwVBitMask;
|
|
DWORD dwStencilBitMask;
|
|
DWORD dwBumpLuminanceBitMask;
|
|
};
|
|
union
|
|
{
|
|
DWORD dwRGBAlphaBitMask;
|
|
DWORD dwYUVAlphaBitMask;
|
|
DWORD dwLuminanceAlphaBitMask;
|
|
DWORD dwRGBZBitMask;
|
|
DWORD dwYUVZBitMask;
|
|
};
|
|
} DDPIXELFORMAT;
|
|
|
|
typedef struct _DDSCAPS2
|
|
{
|
|
DWORD dwCaps;
|
|
DWORD dwCaps2;
|
|
DWORD dwCaps3;
|
|
DWORD dwCaps4;
|
|
} DDSCAPS2;
|
|
|
|
typedef struct _DDSURFACEDESC2
|
|
{
|
|
DWORD dwSize;
|
|
DWORD dwFlags;
|
|
DWORD dwHeight;
|
|
DWORD dwWidth;
|
|
union
|
|
{
|
|
LONG lPitch;
|
|
DWORD dwLinearSize;
|
|
};
|
|
union
|
|
{
|
|
DWORD dwBackBufferCount;
|
|
DWORD dwDepth;
|
|
};
|
|
union
|
|
{
|
|
DWORD dwMipMapCount;
|
|
DWORD dwRefreshRate;
|
|
DWORD dwSrcVBHandle;
|
|
};
|
|
DWORD dwAlphaBitDepth;
|
|
DWORD dwReserved;
|
|
DWORD lpSurface;
|
|
union
|
|
{
|
|
DDCOLORKEY ddckCKDestOverlay;
|
|
DWORD dwEmptyFaceColor;
|
|
};
|
|
DDCOLORKEY ddckCKDestBlt;
|
|
DDCOLORKEY ddckCKSrcOverlay;
|
|
DDCOLORKEY ddckCKSrcBlt;
|
|
DDPIXELFORMAT ddpfPixelFormat;
|
|
DDSCAPS2 ddsCaps;
|
|
DWORD dwTextureStage;
|
|
} DDSURFACEDESC2, *LPDDSURFACEDESC2;
|
|
|
|
static_assert(sizeof(DDPIXELFORMAT) == 32 && sizeof(DDSURFACEDESC2) == 124, "the .dds header layout");
|