GL Studio C++ Runtime API
dds.h File Reference

This header defines constants and structures that are needed to parse DDS files. More...

#include "DXGIFormat.h"
#include <stdint.h>

Go to the source code of this file.

Classes

struct  DDS_PIXELFORMAT
 
struct  DDS_HEADER
 
struct  DDS_HEADER_DXT10
 

Macros

#define MAKEFOURCC(ch0, ch1, ch2, ch3)    ( (DWORD)(BYTE)( ch0 ) | ( (DWORD)(BYTE)( ch1 ) << 8 ) | ( (DWORD)(BYTE)( ch2 ) << 16 ) | ( (DWORD)(BYTE)( ch3 ) << 24 ) )
 
#define D3D10_REQ_MIP_LEVELS   ( 14 )
 
#define D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION   ( 512 )
 
#define DDS_MAGIC   0x20534444
 
#define DDS_FOURCC   0x00000004
 
#define DDS_RGB   0x00000040
 
#define DDS_RGBA   0x00000041
 
#define DDS_LUMINANCE   0x00020000
 
#define DDS_ALPHA   0x00000002
 
#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_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 DDSCAPS2_CUBEMAP   0x00000200
 DDSCAPS2_CUBEMAP.
 
#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_FLAGS_VOLUME   0x00200000
 DDSCAPS2_VOLUME.
 

Typedefs

typedef uint32_t DWORD
 Type used in orignal DirectX dds.h file.
 
typedef unsigned char BYTE
 Type used in orignal DirectX dds.h file.
 
typedef uint32_t UINT
 Type used in orignal DirectX dds.h file.
 
typedef enum _D3DFORMAT D3DFORMAT
 
typedef enum D3D10_RESOURCE_DIMENSION D3D10_RESOURCE_DIMENSION
 

Enumerations

enum  _D3DFORMAT {
  D3DFMT_UNKNOWN = 0 , D3DFMT_R8G8B8 = 20 , D3DFMT_A8R8G8B8 = 21 , D3DFMT_X8R8G8B8 = 22 ,
  D3DFMT_R5G6B5 = 23 , D3DFMT_X1R5G5B5 = 24 , D3DFMT_A1R5G5B5 = 25 , D3DFMT_A4R4G4B4 = 26 ,
  D3DFMT_R3G3B2 = 27 , D3DFMT_A8 = 28 , D3DFMT_A8R3G3B2 = 29 , D3DFMT_X4R4G4B4 = 30 ,
  D3DFMT_A2B10G10R10 = 31 , D3DFMT_A8B8G8R8 = 32 , D3DFMT_X8B8G8R8 = 33 , D3DFMT_G16R16 = 34 ,
  D3DFMT_A2R10G10B10 = 35 , D3DFMT_A16B16G16R16 = 36 , D3DFMT_A8P8 = 40 , D3DFMT_P8 = 41 ,
  D3DFMT_L8 = 50 , D3DFMT_A8L8 = 51 , D3DFMT_A4L4 = 52 , D3DFMT_V8U8 = 60 ,
  D3DFMT_L6V5U5 = 61 , D3DFMT_X8L8V8U8 = 62 , D3DFMT_Q8W8V8U8 = 63 , D3DFMT_V16U16 = 64 ,
  D3DFMT_A2W10V10U10 = 67 , D3DFMT_UYVY = ( (DWORD)(BYTE)( 'U' ) | ( (DWORD)(BYTE)( 'Y' ) << 8 ) | ( (DWORD)(BYTE)( 'V' ) << 16 ) | ( (DWORD)(BYTE)( 'Y' ) << 24 ) ) , D3DFMT_R8G8_B8G8 = ( (DWORD)(BYTE)( 'R' ) | ( (DWORD)(BYTE)( 'G' ) << 8 ) | ( (DWORD)(BYTE)( 'B' ) << 16 ) | ( (DWORD)(BYTE)( 'G' ) << 24 ) ) , D3DFMT_YUY2 = ( (DWORD)(BYTE)( 'Y' ) | ( (DWORD)(BYTE)( 'U' ) << 8 ) | ( (DWORD)(BYTE)( 'Y' ) << 16 ) | ( (DWORD)(BYTE)( '2' ) << 24 ) ) ,
  D3DFMT_G8R8_G8B8 = ( (DWORD)(BYTE)( 'G' ) | ( (DWORD)(BYTE)( 'R' ) << 8 ) | ( (DWORD)(BYTE)( 'G' ) << 16 ) | ( (DWORD)(BYTE)( 'B' ) << 24 ) ) , D3DFMT_DXT1 = ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '1' ) << 24 ) ) , D3DFMT_DXT2 = ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '2' ) << 24 ) ) , D3DFMT_DXT3 = ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '3' ) << 24 ) ) ,
  D3DFMT_DXT4 = ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '4' ) << 24 ) ) , D3DFMT_DXT5 = ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '5' ) << 24 ) ) , D3DFMT_D16_LOCKABLE = 70 , D3DFMT_D32 = 71 ,
  D3DFMT_D15S1 = 73 , D3DFMT_D24S8 = 75 , D3DFMT_D24X8 = 77 , D3DFMT_D24X4S4 = 79 ,
  D3DFMT_D16 = 80 , D3DFMT_D32F_LOCKABLE = 82 , D3DFMT_D24FS8 = 83 , D3DFMT_D32_LOCKABLE = 84 ,
  D3DFMT_S8_LOCKABLE = 85 , D3DFMT_L16 = 81 , D3DFMT_VERTEXDATA = 100 , D3DFMT_INDEX16 = 101 ,
  D3DFMT_INDEX32 = 102 , D3DFMT_Q16W16V16U16 = 110 , D3DFMT_MULTI2_ARGB8 = ( (DWORD)(BYTE)( 'M' ) | ( (DWORD)(BYTE)( 'E' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '1' ) << 24 ) ) , D3DFMT_R16F = 111 ,
  D3DFMT_G16R16F = 112 , D3DFMT_A16B16G16R16F = 113 , D3DFMT_R32F = 114 , D3DFMT_G32R32F = 115 ,
  D3DFMT_A32B32G32R32F = 116 , D3DFMT_CxV8U8 = 117 , D3DFMT_A1 = 118 , D3DFMT_A2B10G10R10_XR_BIAS = 119 ,
  D3DFMT_BINARYBUFFER = 199 , D3DFMT_FORCE_DWORD = 0x7fffffff
}
 
enum  D3D10_RESOURCE_DIMENSION {
  D3D10_RESOURCE_DIMENSION_UNKNOWN = 0 , D3D10_RESOURCE_DIMENSION_BUFFER = 1 , D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2 , D3D10_RESOURCE_DIMENSION_TEXTURE2D = 3 ,
  D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4
}
 

Variables

const DDS_PIXELFORMAT DDSPF_DXT1 = { sizeof( DDS_PIXELFORMAT ), 0x00000004 , ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '1' ) << 24 ) ), 0, 0, 0, 0, 0 }
 DXT1 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_DXT2 = { sizeof( DDS_PIXELFORMAT ), 0x00000004 , ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '2' ) << 24 ) ), 0, 0, 0, 0, 0 }
 DXT2 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_DXT3 = { sizeof( DDS_PIXELFORMAT ), 0x00000004 , ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '3' ) << 24 ) ), 0, 0, 0, 0, 0 }
 DXT3 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_DXT4 = { sizeof( DDS_PIXELFORMAT ), 0x00000004 , ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '4' ) << 24 ) ), 0, 0, 0, 0, 0 }
 DXT4 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_DXT5 = { sizeof( DDS_PIXELFORMAT ), 0x00000004 , ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( 'T' ) << 16 ) | ( (DWORD)(BYTE)( '5' ) << 24 ) ), 0, 0, 0, 0, 0 }
 DXT5 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_A8R8G8B8 = { sizeof( DDS_PIXELFORMAT ), 0x00000041 , 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }
 A8R8G8B8 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_A1R5G5B5 = { sizeof( DDS_PIXELFORMAT ), 0x00000041 , 0, 16, 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000 }
 A1R5G5B5 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_A4R4G4B4 = { sizeof( DDS_PIXELFORMAT ), 0x00000041 , 0, 16, 0x00000f00, 0x000000f0, 0x0000000f, 0x0000f000 }
 A4R4G4B4 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_R8G8B8 = { sizeof( DDS_PIXELFORMAT ), 0x00000040 , 0, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }
 R8G8B8 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_R5G6B5 = { sizeof( DDS_PIXELFORMAT ), 0x00000040 , 0, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 }
 R5G6B5 Pixel format.
 
const DDS_PIXELFORMAT DDSPF_DX10 = { sizeof( DDS_PIXELFORMAT ), 0x00000004 , ( (DWORD)(BYTE)( 'D' ) | ( (DWORD)(BYTE)( 'X' ) << 8 ) | ( (DWORD)(BYTE)( '1' ) << 16 ) | ( (DWORD)(BYTE)( '0' ) << 24 ) ), 0, 0, 0, 0, 0 }
 DX10 Pixel format.
 

Detailed Description

This header defines constants and structures that are needed to parse DDS files.

Copyright Information

Copyright (c) 2017 by The DiSTI Corporation.
11301 Corporate Blvd; Suite 100
Orlando, Florida 32817
USA

All rights reserved.

This Software contains proprietary trade secrets of DiSTI and may not be reproduced, in whole or part, in any form, or by any means of electronic, mechanical, or otherwise, without the written permission of DiSTI. Said permission may be derived through the purchase of applicable DiSTI product licenses which detail the distribution rights of this content and any Derivative Works based on this or other copyrighted DiSTI Software.

NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND, AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.

LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT EXCEED FIVE DOLLARS (US$5.00).

The aforementioned terms and restrictions are governed by the laws of the State of Florida and the United States of America. Use, distribution, duplication, or disclosure by the U. S. Government is subject to "Restricted Rights" as set forth in DFARS 252.227-7014(c)(1)(ii).

Macro Definition Documentation

◆ D3D10_REQ_MIP_LEVELS

#define D3D10_REQ_MIP_LEVELS   ( 14 )

Maximum number of mipmap levels a texture resource may have. http://msdn.microsoft.com/en-us/library/bb509540.aspx

◆ D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION

#define D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION   ( 512 )

Maximum array size of a 2D texture array. http://msdn.microsoft.com/en-us/library/bb509540.aspx

◆ DDS_ALPHA

#define DDS_ALPHA   0x00000002

DDPF_ALPHA - Used in some older DDS files for alpha channel only uncompressed data (dwRGBBitCount contains the alpha channel bitcount; dwABitMask contains valid data)

◆ DDS_CUBEMAP_ALLFACES

DDS structure contains all faces

◆ DDS_FOURCC

#define DDS_FOURCC   0x00000004

DDPF_FOURCC Texture contains compressed RGB data; dwFourCC contains valid data.

◆ DDS_LUMINANCE

#define DDS_LUMINANCE   0x00020000

DDPF_LUMINANCE - Used in some older DDS files for single channel color uncompressed data (dwRGBBitCount contains the luminance channel bit count; dwRBitMask contains the channel mask). Can be combined with DDPF_ALPHAPIXELS for a two channel DDS file.

◆ DDS_MAGIC

#define DDS_MAGIC   0x20534444

A DWORD (magic number) containing the four character code value 'DDS ' It is the first value in a DDS file

◆ DDS_RGB

#define DDS_RGB   0x00000040

DDPF_RGB - Texture contains uncompressed RGB data; dwRGBBitCount and the RGB masks (dwRBitMask, dwGBitMask, dwBBitMask) contain valid data.

◆ DDS_RGBA

#define DDS_RGBA   0x00000041

DDPF_RGB | DDPF_ALPHAPIXELS - Texture contains uncompressed RGBA data; dwRGBBitCount and the RGB masks (dwRBitMask, dwGBitMask, dwBBitMask, dwABitMask) contain valid data.

◆ MAKEFOURCC

#define MAKEFOURCC (   ch0,
  ch1,
  ch2,
  ch3 
)     ( (DWORD)(BYTE)( ch0 ) | ( (DWORD)(BYTE)( ch1 ) << 8 ) | ( (DWORD)(BYTE)( ch2 ) << 16 ) | ( (DWORD)(BYTE)( ch3 ) << 24 ) )

Combines four charaters into a DWORD. Used for specified compressed texture formats. See http://msdn.microsoft.com/en-us/library/bb172558.aspx#DXTn_Compressed_Texture_Formats

Typedef Documentation

◆ D3D10_RESOURCE_DIMENSION

◆ D3DFORMAT

typedef enum _D3DFORMAT D3DFORMAT

Defines the various types of surface formats. http://msdn.microsoft.com/en-us/library/bb172558.aspx

Enumeration Type Documentation

◆ _D3DFORMAT

enum _D3DFORMAT

Defines the various types of surface formats. http://msdn.microsoft.com/en-us/library/bb172558.aspx

◆ D3D10_RESOURCE_DIMENSION

Identifies the type of resource being used. http://msdn.microsoft.com/en-us/library/bb172411.aspx