0.6.1
dx.hpp
Go to the documentation of this file.
1 
29 #pragma once
30 
31 #include "storage.hpp"
32 #include <array>
33 
34 namespace gli
35 {
36  class dx
37  {
38  public:
39  #define GLI_MAKEFOURCC(ch0, ch1, ch2, ch3) \
40  (std::uint32_t)( \
41  (((std::uint32_t)(std::uint8_t)(ch3) << 24) & 0xFF000000) | \
42  (((std::uint32_t)(std::uint8_t)(ch2) << 16) & 0x00FF0000) | \
43  (((std::uint32_t)(std::uint8_t)(ch1) << 8) & 0x0000FF00) | \
44  ((std::uint32_t)(std::uint8_t)(ch0) & 0x000000FF) )
45 
46  enum D3DFORMAT
47  {
49 
58  D3DFMT_A8 = 28,
67 
69  D3DFMT_P8 = 41,
70 
71  D3DFMT_L8 = 50,
74 
81 
82  D3DFMT_UYVY = GLI_MAKEFOURCC('U', 'Y', 'V', 'Y'),
83  D3DFMT_R8G8_B8G8 = GLI_MAKEFOURCC('R', 'G', 'B', 'G'),
84  D3DFMT_YUY2 = GLI_MAKEFOURCC('Y', 'U', 'Y', '2'),
85  D3DFMT_G8R8_G8B8 = GLI_MAKEFOURCC('G', 'R', 'G', 'B'),
86  D3DFMT_DXT1 = GLI_MAKEFOURCC('D', 'X', 'T', '1'),
87  D3DFMT_DXT2 = GLI_MAKEFOURCC('D', 'X', 'T', '2'),
88  D3DFMT_DXT3 = GLI_MAKEFOURCC('D', 'X', 'T', '3'),
89  D3DFMT_DXT4 = GLI_MAKEFOURCC('D', 'X', 'T', '4'),
90  D3DFMT_DXT5 = GLI_MAKEFOURCC('D', 'X', 'T', '5'),
91 
92  D3DFMT_ATI1 = GLI_MAKEFOURCC('A', 'T', 'I', '1'),
93  D3DFMT_AT1N = GLI_MAKEFOURCC('A', 'T', '1', 'N'),
94  D3DFMT_ATI2 = GLI_MAKEFOURCC('A', 'T', 'I', '2'),
95  D3DFMT_AT2N = GLI_MAKEFOURCC('A', 'T', '2', 'N'),
96 
97  D3DFMT_ETC = GLI_MAKEFOURCC('E', 'T', 'C', ' '),
98  D3DFMT_ETC1 = GLI_MAKEFOURCC('E', 'T', 'C', '1'),
99  D3DFMT_ATC = GLI_MAKEFOURCC('A', 'T', 'C', ' '),
100  D3DFMT_ATCA = GLI_MAKEFOURCC('A', 'T', 'C', 'A'),
101  D3DFMT_ATCI = GLI_MAKEFOURCC('A', 'T', 'C', 'I'),
102 
103  D3DFMT_POWERVR_2BPP = GLI_MAKEFOURCC('P', 'T', 'C', '2'),
104  D3DFMT_POWERVR_4BPP = GLI_MAKEFOURCC('P', 'T', 'C', '4'),
105 
113 
116 
118 
122 
124 
126 
127  D3DFMT_R16F = 111,
130 
131  D3DFMT_R32F = 114,
134 
136 
137  D3DFMT_DX10 = GLI_MAKEFOURCC('D', 'X', '1', '0'),
138 
139  D3DFMT_FORCE_DWORD = 0x7fffffff
140  };
141 
143  {
260 
306  DXGI_FORMAT_FORCE_UINT = 0xffffffffUL
307  };
308 
309  enum DDPF
310  {
312  DDPF_ALPHA = 0x2,
313  DDPF_FOURCC = 0x4,
314  DDPF_RGB = 0x40,
315  DDPF_YUV = 0x200,
316  DDPF_LUMINANCE = 0x20000,
322 
323  };
324 
325  struct format
326  {
330  glm::u32vec4 Mask;
331  };
332 
333  public:
334  dx();
335 
336  format const & translate(gli::format const & Format) const;
337  gli::format find(D3DFORMAT FourCC);
338  gli::format find(dxgiFormat Format);
339 
340  private:
341  std::array<format, FORMAT_COUNT> Translation;
342  };
343 }//namespace gli
344 
345 #include "dx.inl"
D3DFORMAT
Definition: dx.hpp:46
Definition: dx.hpp:36
format
Definition: format.hpp:33
DDPF
Definition: dx.hpp:309
glm::u32vec4 Mask
Definition: dx.hpp:330
D3DFORMAT D3DFormat
Definition: dx.hpp:328
OpenGL Image (gli.g-truc.net)
dxgiFormat
Definition: dx.hpp:142
format const & translate(gli::format const &Format) const
#define GLI_MAKEFOURCC(ch0, ch1, ch2, ch3)
Definition: dx.hpp:39
DDPF DDPixelFormat
Definition: dx.hpp:327
gli::format find(D3DFORMAT FourCC)
dxgiFormat DXGIFormat
Definition: dx.hpp:329