1 /*---------------------------------------------------------------------------*
2 
3   Copyright (C) Nintendo.  All rights reserved.
4 
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law.  They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 // -------------------------------------------------------
13 // DDS.h
14 //
15 // Declares functions for DDS Reader.
16 // -------------------------------------------------------
17 #ifndef DDS_H
18 #define DDS_H
19 
20 #include "TexConvert.h"
21 
22 namespace DDSReader
23 {
24 #define PAD_BYTE(width, bpp) (((bpp) * (width) + 7) / 8)
25 #define PAD_WORD(width, bpp) ((((bpp) * (width) + 15) / 16) * 2)
26 #define PAD_WORD_SIZE(size) ((size + 1) & (~0x1))
27 #define PAD_DWORD(width, bpp) ((((bpp) * (width) + 31) / 32) * 4)
28 #define PAD_DWORD_SIZE(size) ((size + 3) & (~0x3))
29 
30 // Required for 64bit compatability
31 typedef struct _DDSD2
32 {
33     u32               dwSize;                 // size of the DDSURFACEDESC structure
34     u32               dwFlags;                // determines what fields are valid
35     u32               dwHeight;               // height of surface to be created
36     u32               dwWidth;                // width of input surface
37     union
38     {
39         LONG            lPitch;                 // distance to start of next line (return value only)
40         u32           dwLinearSize;           // Formless late-allocated optimized surface size
41     } DUMMYUNIONNAMEN(1);
42     union
43     {
44         u32           dwBackBufferCount;      // number of back buffers requested
45         u32           dwDepth;                // the depth if this is a volume texture
46     } DUMMYUNIONNAMEN(5);
47     union
48     {
49         u32           dwMipMapCount;          // number of mip-map levels requestde
50         // dwZBufferBitDepth removed, use ddpfPixelFormat one instead
51         u32           dwRefreshRate;          // refresh rate (used when display mode is described)
52         u32           dwSrcVBHandle;          // The source used in VB::Optimize
53     } DUMMYUNIONNAMEN(2);
54     u32               dwAlphaBitDepth;        // depth of alpha buffer requested
55     u32               dwReserved;             // reserved
56     void* POINTER_32	lpSurface;              // pointer to the associated surface memory
57     union
58     {
59         DDCOLORKEY      ddckCKDestOverlay;      // color key for destination overlay use
60         u32           dwEmptyFaceColor;       // Physical color for empty cubemap faces
61     } DUMMYUNIONNAMEN(3);
62     DDCOLORKEY          ddckCKDestBlt;          // color key for destination blt use
63     DDCOLORKEY          ddckCKSrcOverlay;       // color key for source overlay use
64     DDCOLORKEY          ddckCKSrcBlt;           // color key for source blt use
65     union
66     {
67         DDPIXELFORMAT   ddpfPixelFormat;        // pixel format description of the surface
68         u32           dwFVF;                  // vertex format description of vertex buffers
69     } DUMMYUNIONNAMEN(4);
70     DDSCAPS2            ddsCaps;                // direct draw surface capabilities
71     u32               dwTextureStage;         // stage in multitexture cascade
72 } DDSD2;
73 
74 }   //namespace DDSReader
75 #endif  //#ifndef DDS_H
76