0.7.0
format.hpp
Go to the documentation of this file.
1 
29 #pragma once
30 
31 #include "type.hpp"
32 #include <cstdint>
33 
34 namespace gli
35 {
36  enum format
37  {
38  // unorm formats
39  FORMAT_R8_UNORM = 0, FORMAT_FIRST = FORMAT_R8_UNORM,
40  FORMAT_RG8_UNORM,
41  FORMAT_RGB8_UNORM,
42  FORMAT_RGBA8_UNORM,
43 
44  FORMAT_R16_UNORM,
45  FORMAT_RG16_UNORM,
46  FORMAT_RGB16_UNORM,
47  FORMAT_RGBA16_UNORM,
48 
49  // snorm formats
50  FORMAT_R8_SNORM,
51  FORMAT_RG8_SNORM,
52  FORMAT_RGB8_SNORM,
53  FORMAT_RGBA8_SNORM,
54 
55  FORMAT_R16_SNORM,
56  FORMAT_RG16_SNORM,
57  FORMAT_RGB16_SNORM,
58  FORMAT_RGBA16_SNORM,
59 
60  // Unsigned integer formats
61  FORMAT_R8_UINT,
62  FORMAT_RG8_UINT,
63  FORMAT_RGB8_UINT,
64  FORMAT_RGBA8_UINT,
65 
66  FORMAT_R16_UINT,
67  FORMAT_RG16_UINT,
68  FORMAT_RGB16_UINT,
69  FORMAT_RGBA16_UINT,
70 
71  FORMAT_R32_UINT,
72  FORMAT_RG32_UINT,
73  FORMAT_RGB32_UINT,
74  FORMAT_RGBA32_UINT,
75 
76  // Signed integer formats
77  FORMAT_R8_SINT,
78  FORMAT_RG8_SINT,
79  FORMAT_RGB8_SINT,
80  FORMAT_RGBA8_SINT,
81 
82  FORMAT_R16_SINT,
83  FORMAT_RG16_SINT,
84  FORMAT_RGB16_SINT,
85  FORMAT_RGBA16_SINT,
86 
87  FORMAT_R32_SINT,
88  FORMAT_RG32_SINT,
89  FORMAT_RGB32_SINT,
90  FORMAT_RGBA32_SINT,
91 
92  // Floating formats
93  FORMAT_R16_SFLOAT,
94  FORMAT_RG16_SFLOAT,
95  FORMAT_RGB16_SFLOAT,
96  FORMAT_RGBA16_SFLOAT,
97 
98  FORMAT_R32_SFLOAT,
99  FORMAT_RG32_SFLOAT,
100  FORMAT_RGB32_SFLOAT,
101  FORMAT_RGBA32_SFLOAT,
102 
103  // sRGB formats
104  FORMAT_R8_SRGB,
105  FORMAT_RG8_SRGB,
106  FORMAT_RGB8_SRGB,
107  FORMAT_RGBA8_SRGB,
108 
109  // Packed formats
110  FORMAT_RGB10A2_UNORM,
111  FORMAT_RGB10A2_UINT,
112  FORMAT_RGB9E5_UFLOAT,
113  FORMAT_RG11B10_UFLOAT,
114  FORMAT_RG3B2_UNORM,
115  FORMAT_R5G6B5_UNORM,
116  FORMAT_RGB5A1_UNORM,
117  FORMAT_RGBA4_UNORM,
118 
119  // Swizzle formats
120  FORMAT_BGRX8_UNORM,
121  FORMAT_BGRA8_UNORM,
122  FORMAT_BGRX8_SRGB,
123  FORMAT_BGRA8_SRGB,
124 
125  // Luminance Alpha formats
126  FORMAT_L8_UNORM,
127  FORMAT_A8_UNORM,
128  FORMAT_LA8_UNORM,
129  FORMAT_L16_UNORM,
130  FORMAT_A16_UNORM,
131  FORMAT_LA16_UNORM,
132 
133  // Depth formats
134  FORMAT_D16_UNORM,
135  FORMAT_D24_UNORM,
136  FORMAT_D24S8_UNORM,
137  FORMAT_D32_UFLOAT,
138  FORMAT_D32_UFLOAT_S8_UNORM,
139 
140  // Compressed formats
141  FORMAT_RGB_DXT1_UNORM, FORMAT_COMPRESSED_FIRST = FORMAT_RGB_DXT1_UNORM,
142  FORMAT_RGBA_DXT1_UNORM,
143  FORMAT_RGBA_DXT3_UNORM,
144  FORMAT_RGBA_DXT5_UNORM,
145  FORMAT_R_ATI1N_UNORM,
146  FORMAT_R_ATI1N_SNORM,
147  FORMAT_RG_ATI2N_UNORM,
148  FORMAT_RG_ATI2N_SNORM,
149  FORMAT_RGB_BP_UFLOAT,
150  FORMAT_RGB_BP_SFLOAT,
151  FORMAT_RGB_BP_UNORM,
152  FORMAT_RGB_PVRTC_8X8_UNORM,
153  FORMAT_RGB_PVRTC_16X8_UNORM,
154  FORMAT_RGBA_PVRTC_8X8_UNORM,
155  FORMAT_RGBA_PVRTC_16X8_UNORM,
156  FORMAT_RGBA_PVRTC2_8X8_UNORM,
157  FORMAT_RGBA_PVRTC2_16X8_UNORM,
158  FORMAT_RGB_ATC_UNORM,
159  FORMAT_RGBA_ATC_EXPLICIT_UNORM,
160  FORMAT_RGBA_ATC_INTERPOLATED_UNORM,
161  FORMAT_RGB_ETC_UNORM,
162  FORMAT_RGB_ETC2_UNORM,
163  FORMAT_RGBA_ETC2_PUNCHTHROUGH_UNORM,
164  FORMAT_RGBA_ETC2_UNORM,
165  FORMAT_R11_EAC_UNORM,
166  FORMAT_R11_EAC_SNORM,
167  FORMAT_RG11_EAC_UNORM,
168  FORMAT_RG11_EAC_SNORM,
169  FORMAT_RGBA_ASTC_4X4_UNORM,
170  FORMAT_RGBA_ASTC_5X4_UNORM,
171  FORMAT_RGBA_ASTC_5X5_UNORM,
172  FORMAT_RGBA_ASTC_6X5_UNORM,
173  FORMAT_RGBA_ASTC_6X6_UNORM,
174  FORMAT_RGBA_ASTC_8X5_UNORM,
175  FORMAT_RGBA_ASTC_8X6_UNORM,
176  FORMAT_RGBA_ASTC_8X8_UNORM,
177  FORMAT_RGBA_ASTC_10X5_UNORM,
178  FORMAT_RGBA_ASTC_10X6_UNORM,
179  FORMAT_RGBA_ASTC_10X8_UNORM,
180  FORMAT_RGBA_ASTC_10X10_UNORM,
181  FORMAT_RGBA_ASTC_12X10_UNORM,
182  FORMAT_RGBA_ASTC_12X12_UNORM,
183 
184  // Compressed sRGB formats
185  FORMAT_RGB_DXT1_SRGB,
186  FORMAT_RGBA_DXT1_SRGB,
187  FORMAT_RGBA_DXT3_SRGB,
188  FORMAT_RGBA_DXT5_SRGB,
189  FORMAT_RGB_BP_SRGB,
190  FORMAT_RGB_PVRTC_8X8_SRGB,
191  FORMAT_RGB_PVRTC_16X8_SRGB,
192  FORMAT_RGBA_PVRTC_8X8_SRGB,
193  FORMAT_RGBA_PVRTC_16X8_SRGB,
194  FORMAT_RGBA_PVRTC2_8X8_SRGB,
195  FORMAT_RGBA_PVRTC2_16X8_SRGB,
196  FORMAT_RGB_ETC_SRGB,
197  FORMAT_RGBA_ETC2_PUNCHTHROUGH_SRGB,
198  FORMAT_RGBA_ETC2_SRGB,
199  FORMAT_RGBA_ASTC_4X4_SRGB,
200  FORMAT_RGBA_ASTC_5X4_SRGB,
201  FORMAT_RGBA_ASTC_5X5_SRGB,
202  FORMAT_RGBA_ASTC_6X5_SRGB,
203  FORMAT_RGBA_ASTC_6X6_SRGB,
204  FORMAT_RGBA_ASTC_8X5_SRGB,
205  FORMAT_RGBA_ASTC_8X6_SRGB,
206  FORMAT_RGBA_ASTC_8X8_SRGB,
207  FORMAT_RGBA_ASTC_10X5_SRGB,
208  FORMAT_RGBA_ASTC_10X6_SRGB,
209  FORMAT_RGBA_ASTC_10X8_SRGB,
210  FORMAT_RGBA_ASTC_10X10_SRGB,
211  FORMAT_RGBA_ASTC_12X10_SRGB,
212  FORMAT_RGBA_ASTC_12X12_SRGB, FORMAT_COMPRESSED_LAST = FORMAT_RGBA_ASTC_12X12_SRGB, FORMAT_LAST = FORMAT_RGBA_ASTC_12X12_SRGB
213  };
214 
215  enum
216  {
217  FORMAT_INVALID = -1,
218  FORMAT_COUNT = FORMAT_LAST - FORMAT_FIRST + 1,
219  FORMAT_COMPRESSED_COUNT = FORMAT_COMPRESSED_LAST - FORMAT_COMPRESSED_FIRST + 1
220  };
221 
222  inline bool is_compressed(format Format)
223  {
224  return Format >= FORMAT_COMPRESSED_FIRST && Format <= FORMAT_COMPRESSED_LAST;
225  }
226 
227  inline bool is_valid(format Format)
228  {
229  return Format >= FORMAT_FIRST && Format <= FORMAT_LAST;
230  }
231 
232  std::uint32_t block_size(format Format);
233  gli::dim3_t block_dimensions(format Format);
234  std::uint32_t component_count(format Format);
235 }//namespace gli
236 
237 #include "./core/format.inl"
OpenGL Image (gli.g-truc.net)