0.8.2 API documentation
convert_func.hpp
1 #pragma once
2 
3 #include "../type.hpp"
4 #include "../texture1d.hpp"
5 #include "../texture1d_array.hpp"
6 #include "../texture2d.hpp"
7 #include "../texture2d_array.hpp"
8 #include "../texture3d.hpp"
9 #include "../texture_cube.hpp"
10 #include "../texture_cube_array.hpp"
11 #include <glm/gtc/packing.hpp>
12 #include <glm/gtc/color_space.hpp>
13 #include <limits>
14 
15 namespace gli{
16 namespace detail
17 {
18  enum convertMode
19  {
20  CONVERT_MODE_DEFAULT,
21  CONVERT_MODE_CAST,
22  CONVERT_MODE_NORM,
23  CONVERT_MODE_SRGB,
24  CONVERT_MODE_HALF,
25  CONVERT_MODE_RGB9E5,
26  CONVERT_MODE_RG11B10F,
27  CONVERT_MODE_RGB10A2UNORM,
28  CONVERT_MODE_RGB10A2SNORM,
29  CONVERT_MODE_RGB10A2USCALE,
30  CONVERT_MODE_RGB10A2SSCALE,
31  CONVERT_MODE_RGB10A2UINT,
32  CONVERT_MODE_RGB10A2SINT,
33  CONVERT_MODE_44UNORM,
34  CONVERT_MODE_44SCALED,
35  CONVERT_MODE_4444UNORM,
36  CONVERT_MODE_4444SCALED,
37  CONVERT_MODE_565UNORM,
38  CONVERT_MODE_565SCALED,
39  CONVERT_MODE_5551UNORM,
40  CONVERT_MODE_5551SCALED,
41  CONVERT_MODE_332UNORM
42  };
43 
44  template <typename textureType, typename genType>
45  struct accessFunc
46  {};
47 
48  template <typename genType>
49  struct accessFunc<texture1d, genType>
50  {
51  static genType load(texture1d const & Texture, texture1d::extent_type const & TexelCoord, texture1d::size_type Layer, texture1d::size_type Face, texture1d::size_type Level)
52  {
53  GLI_ASSERT(Layer == 0 && Face == 0);
54  return Texture.load<genType>(TexelCoord, Level);
55  }
56 
57  static void store(texture1d & Texture, texture1d::extent_type const & TexelCoord, texture1d::size_type Layer, texture1d::size_type Face, texture1d::size_type Level, genType const & Texel)
58  {
59  GLI_ASSERT(Layer == 0 && Face == 0);
60  Texture.store<genType>(TexelCoord, Level, Texel);
61  }
62  };
63 
64  template <typename genType>
65  struct accessFunc<texture1d_array, genType>
66  {
67  static genType load(texture1d_array const& Texture, texture1d_array::extent_type const& TexelCoord, texture1d_array::size_type Layer, texture1d_array::size_type Face, texture1d_array::size_type Level)
68  {
69  GLI_ASSERT(Face == 0);
70  return Texture.load<genType>(TexelCoord, Layer, Level);
71  }
72 
73  static void store(texture1d_array& Texture, texture1d_array::extent_type const& TexelCoord, texture1d_array::size_type Layer, texture1d_array::size_type Face, texture1d_array::size_type Level, genType const& Texel)
74  {
75  GLI_ASSERT(Face == 0);
76  Texture.store<genType>(TexelCoord, Layer, Level, Texel);
77  }
78  };
79 
80  template <typename genType>
81  struct accessFunc<texture2d, genType>
82  {
83  static genType load(texture2d const & Texture, texture2d::extent_type const & TexelCoord, texture2d::size_type Layer, texture2d::size_type Face, texture2d::size_type Level)
84  {
85  GLI_ASSERT(Layer == 0 && Face == 0);
86  return Texture.load<genType>(TexelCoord, Level);
87  }
88 
89  static void store(texture2d & Texture, texture2d::extent_type const & TexelCoord, texture2d::size_type Layer, texture2d::size_type Face, texture2d::size_type Level, genType const & Texel)
90  {
91  GLI_ASSERT(Layer == 0 && Face == 0);
92  Texture.store<genType>(TexelCoord, Level, Texel);
93  }
94  };
95 
96  template <typename genType>
97  struct accessFunc<texture2d_array, genType>
98  {
99  static genType load(texture2d_array const & Texture, texture2d_array::extent_type const & TexelCoord, texture2d_array::size_type Layer, texture2d_array::size_type Face, texture2d_array::size_type Level)
100  {
101  GLI_ASSERT(Face == 0);
102  return Texture.load<genType>(TexelCoord, Layer, Level);
103  }
104 
105  static void store(texture2d_array & Texture, texture2d_array::extent_type const & TexelCoord, texture2d_array::size_type Layer, texture2d_array::size_type Face, texture2d_array::size_type Level, genType const & Texel)
106  {
107  GLI_ASSERT(Face == 0);
108  Texture.store<genType>(TexelCoord, Layer, Level, Texel);
109  }
110  };
111 
112  template <typename genType>
113  struct accessFunc<texture3d, genType>
114  {
115  static genType load(texture3d const & Texture, texture3d::extent_type const & TexelCoord, texture3d::size_type Layer, texture3d::size_type Face, texture3d::size_type Level)
116  {
117  GLI_ASSERT(Layer == 0 && Face == 0);
118  return Texture.load<genType>(TexelCoord, Level);
119  }
120 
121  static void store(texture3d & Texture, texture3d::extent_type const & TexelCoord, texture3d::size_type Layer, texture3d::size_type Face, texture3d::size_type Level, genType const & Texel)
122  {
123  GLI_ASSERT(Layer == 0 && Face == 0);
124  Texture.store<genType>(TexelCoord, Level, Texel);
125  }
126  };
127 
128  template <typename genType>
129  struct accessFunc<texture_cube, genType>
130  {
131  static genType load(texture_cube const& Texture, texture_cube::extent_type const& TexelCoord, texture_cube::size_type Layer, texture_cube::size_type Face, texture_cube::size_type Level)
132  {
133  GLI_ASSERT(Layer == 0);
134  return Texture.load<genType>(TexelCoord, Face, Level);
135  }
136 
137  static void store(texture_cube& Texture, texture_cube::extent_type const& TexelCoord, texture_cube::size_type Layer, texture_cube::size_type Face, texture_cube::size_type Level, genType const& Texel)
138  {
139  GLI_ASSERT(Layer == 0);
140  Texture.store<genType>(TexelCoord, Face, Level, Texel);
141  }
142  };
143 
144  template <typename genType>
145  struct accessFunc<texture_cube_array, genType>
146  {
147  static genType load(texture_cube_array const & Texture, texture_cube_array::extent_type const & TexelCoord, texture_cube_array::size_type Layer, texture_cube_array::size_type Face, texture_cube_array::size_type Level)
148  {
149  return Texture.load<genType>(TexelCoord, Layer, Face, Level);
150  }
151 
152  static void store(texture_cube_array & Texture, texture_cube_array::extent_type const & TexelCoord, texture_cube_array::size_type Layer, texture_cube_array::size_type Face, texture_cube_array::size_type Level, genType const & Texel)
153  {
154  Texture.store<genType>(TexelCoord, Layer, Face, Level, Texel);
155  }
156  };
157 
158  // convertFunc class
159 
160  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType, convertMode mode = CONVERT_MODE_CAST, bool isSamplerFloat = false>
161  struct convertFunc
162  {
163  typedef accessFunc<textureType, vecType<T, P> > access;
164 
165  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
166  {
167  return make_vec4<retType, P>(vecType<retType, P>(access::load(Texture, TexelCoord, Layer, Face, Level)));
168  }
169 
170  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
171  {
172  access::store(Texture, TexelCoord, Layer, Face, Level, vecType<T, P>(Texel));
173  }
174  };
175 
176  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType, bool isSamplerFloat>
177  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_DEFAULT, isSamplerFloat>
178  {
179  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
180  {
181  return tvec4<retType, P>(0, 0, 0, 1);
182  }
183 
184  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
185  {}
186  };
187 
188  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
189  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_NORM, true>
190  {
191  typedef accessFunc<textureType, vecType<T, P> > access;
192 
193  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
194  {
195  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_NORM requires a float sampler");
196  return make_vec4<retType, P>(compNormalize<retType>(access::load(Texture, TexelCoord, Layer, Face, Level)));
197  }
198 
199  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
200  {
201  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_NORM requires a float sampler");
202  access::store(Texture, TexelCoord, Layer, Face, Level, compScale<T>(vecType<retType, P>(Texel)));
203  }
204  };
205 
206  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
207  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_SRGB, true>
208  {
209  typedef accessFunc<textureType, vecType<T, P> > access;
210 
211  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
212  {
213  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_SRGB requires a float sampler");
214  return make_vec4<retType, P>(convertSRGBToLinear(compNormalize<retType>(access::load(Texture, TexelCoord, Layer, Face, Level))));
215  }
216 
217  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
218  {
219  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_SRGB requires a float sampler");
220  access::store(Texture, TexelCoord, Layer, Face, Level, gli::compScale<T>(convertLinearToSRGB(vecType<retType, P>(Texel))));
221  }
222  };
223 
224  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
225  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB9E5, true>
226  {
227  typedef accessFunc<textureType, uint32> access;
228 
229  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
230  {
231  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB9E5 requires a float sampler");
232  return tvec4<retType, P>(unpackF3x9_E1x5(access::load(Texture, TexelCoord, Layer, Face, Level)), static_cast<retType>(1));
233  }
234 
235  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
236  {
237  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB9E5 requires a float sampler");
238  access::store(Texture, TexelCoord, Layer, Face, Level, packF3x9_E1x5(tvec3<float, P>(Texel)));
239  }
240  };
241 
242  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
243  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RG11B10F, true>
244  {
245  typedef accessFunc<textureType, uint32> access;
246 
247  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
248  {
249  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RG11B10F requires a float sampler");
250  return tvec4<retType, P>(unpackF2x11_1x10(access::load(Texture, TexelCoord, Layer, Face, Level)), static_cast<retType>(1));
251  }
252 
253  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
254  {
255  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RG11B10F requires a float sampler");
256  access::store(Texture, TexelCoord, Layer, Face, Level, packF2x11_1x10(tvec3<float, P>(Texel)));
257  }
258  };
259 
260  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
261  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_HALF, true>
262  {
263  typedef accessFunc<textureType, vecType<uint16, P> > access;
264 
265  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
266  {
267  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_HALF requires a float sampler");
268  return make_vec4<retType, P>(vecType<retType, P>(unpackHalf(access::load(Texture, TexelCoord, Layer, Face, Level))));
269  }
270 
271  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
272  {
273  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_HALF requires a float sampler");
274  access::store(Texture, TexelCoord, Layer, Face, Level, packHalf(vecType<float, P>(Texel)));
275  }
276  };
277 
278  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
279  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_44UNORM, true>
280  {
281  typedef accessFunc<textureType, uint8> access;
282 
283  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
284  {
285  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_44UNORM requires a float sampler");
286  return tvec4<retType, P>(tvec2<retType, P>(unpackUnorm2x4(access::load(Texture, TexelCoord, Layer, Face, Level))), static_cast<retType>(0), static_cast<retType>(1));
287  }
288 
289  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
290  {
291  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_44UNORM requires a float sampler");
292  access::store(Texture, TexelCoord, Layer, Face, Level, packUnorm2x4(tvec2<float, P>(Texel)));
293  }
294  };
295 
296  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
297  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_4444UNORM, true>
298  {
299  typedef accessFunc<textureType, uint16> access;
300 
301  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
302  {
303  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_4444UNORM requires a float sampler");
304  return tvec4<retType, P>(unpackUnorm4x4(access::load(Texture, TexelCoord, Layer, Face, Level)));
305  }
306 
307  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
308  {
309  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_4444UNORM requires a float sampler");
310  access::store(Texture, TexelCoord, Layer, Face, Level, packUnorm4x4(tvec4<float, P>(Texel)));
311  }
312  };
313 
314  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
315  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_565UNORM, true>
316  {
317  typedef accessFunc<textureType, uint16> access;
318 
319  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
320  {
321  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_565UNORM requires a float sampler");
322  return tvec4<retType, P>(unpackUnorm1x5_1x6_1x5(access::load(Texture, TexelCoord, Layer, Face, Level)), static_cast<retType>(1));
323  }
324 
325  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
326  {
327  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_565UNORM requires a float sampler");
328  access::store(Texture, TexelCoord, Layer, Face, Level, packUnorm1x5_1x6_1x5(tvec3<float, P>(Texel)));
329  }
330  };
331 
332  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
333  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_5551UNORM, true>
334  {
335  typedef accessFunc<textureType, uint16> access;
336 
337  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
338  {
339  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_5551UNORM requires a float sampler");
340  return tvec4<retType, P>(unpackUnorm3x5_1x1(access::load(Texture, TexelCoord, Layer, Face, Level)));
341  }
342 
343  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
344  {
345  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_5551UNORM requires a float sampler");
346  access::store(Texture, TexelCoord, Layer, Face, Level, packUnorm3x5_1x1(tvec4<float, P>(Texel)));
347  }
348  };
349 
350  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
351  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_332UNORM, true>
352  {
353  typedef accessFunc<textureType, uint8> access;
354 
355  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
356  {
357  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_332UNORM requires a float sampler");
358  return tvec4<retType, P>(unpackUnorm2x3_1x2(access::load(Texture, TexelCoord, Layer, Face, Level)), static_cast<retType>(1));
359  }
360 
361  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
362  {
363  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_332UNORM requires a float sampler");
364  access::store(Texture, TexelCoord, Layer, Face, Level, packUnorm2x3_1x2(tvec3<float, P>(Texel)));
365  }
366  };
367 
368  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
369  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2UNORM, true>
370  {
371  typedef accessFunc<textureType, uint32> access;
372 
373  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
374  {
375  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB10A2UNORM requires a float sampler");
376  return tvec4<retType, P>(unpackUnorm3x10_1x2(access::load(Texture, TexelCoord, Layer, Face, Level)));
377  }
378 
379  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
380  {
381  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB10A2UNORM requires a float sampler");
382  access::store(Texture, TexelCoord, Layer, Face, Level, packUnorm3x10_1x2(tvec4<float, P>(Texel)));
383  }
384  };
385 
386  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
387  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2SNORM, true>
388  {
389  typedef accessFunc<textureType, uint32> access;
390 
391  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
392  {
393  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB10A2SNORM requires a float sampler");
394  return tvec4<retType, P>(unpackSnorm3x10_1x2(access::load(Texture, TexelCoord, Layer, Face, Level)));
395  }
396 
397  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
398  {
399  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB10A2SNORM requires a float sampler");
400  access::store(Texture, TexelCoord, Layer, Face, Level, packSnorm3x10_1x2(Texel));
401  }
402  };
403 
404  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
405  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2USCALE, true>
406  {
407  typedef accessFunc<textureType, uint32> access;
408 
409  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
410  {
411  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB10A2USCALE requires a float sampler");
412  glm::detail::u10u10u10u2 Unpack;
413  Unpack.pack = access::load(Texture, TexelCoord, Layer, Face, Level);
414  return tvec4<retType, P>(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w);
415  }
416 
417  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
418  {
419  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB10A2USCALE requires a float sampler");
420  glm::detail::u10u10u10u2 Unpack;
421  Unpack.data.x = static_cast<uint>(Texel.x);
422  Unpack.data.y = static_cast<uint>(Texel.y);
423  Unpack.data.z = static_cast<uint>(Texel.z);
424  Unpack.data.w = static_cast<uint>(Texel.w);
425  access::store(Texture, TexelCoord, Layer, Face, Level, Unpack.pack);
426  }
427  };
428 
429  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
430  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2SSCALE, true>
431  {
432  typedef accessFunc<textureType, uint32> access;
433 
434  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
435  {
436  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB10A2SSCALE requires a float sampler");
437  glm::detail::i10i10i10i2 Unpack;
438  Unpack.pack = access::load(Texture, TexelCoord, Layer, Face, Level);
439  return tvec4<retType, P>(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w);
440  }
441 
442  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
443  {
444  static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_RGB10A2SSCALE requires a float sampler");
445  glm::detail::i10i10i10i2 Unpack;
446  Unpack.data.x = static_cast<int>(Texel.x);
447  Unpack.data.y = static_cast<int>(Texel.y);
448  Unpack.data.z = static_cast<int>(Texel.z);
449  Unpack.data.w = static_cast<int>(Texel.w);
450  access::store(Texture, TexelCoord, Layer, Face, Level, Unpack.pack);
451  }
452  };
453 
454  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
455  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2UINT, false>
456  {
457  typedef accessFunc<textureType, uint32> access;
458 
459  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
460  {
461  static_assert(std::numeric_limits<retType>::is_integer, "CONVERT_MODE_RGB10A2UINT requires an integer sampler");
462  return tvec4<retType, P>(unpackU3x10_1x2(access::load(Texture, TexelCoord, Layer, Face, Level)));
463  }
464 
465  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
466  {
467  static_assert(std::numeric_limits<retType>::is_integer, "CONVERT_MODE_RGB10A2UINT requires an integer sampler");
468  access::store(Texture, TexelCoord, Layer, Face, Level, packU3x10_1x2(Texel));
469  }
470  };
471 
472  template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType>
473  struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2SINT, false>
474  {
475  typedef accessFunc<textureType, uint32> access;
476 
477  static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
478  {
479  static_assert(std::numeric_limits<retType>::is_integer, "CONVERT_MODE_RGB10A2SINT requires an integer sampler");
480  return tvec4<retType, P>(unpackI3x10_1x2(access::load(Texture, TexelCoord, Layer, Face, Level)));
481  }
482 
483  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
484  {
485  static_assert(std::numeric_limits<retType>::is_integer, "CONVERT_MODE_RGB10A2SINT requires an integer sampler");
486  access::store(Texture, TexelCoord, Layer, Face, Level, packI3x10_1x2(Texel));
487  }
488  };
489 
490  template <typename textureType, typename samplerValType, precision P>
491  struct convert
492  {
493  typedef glm::tvec4<samplerValType, P>(*fetchFunc)(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level);
494  typedef void(*writeFunc)(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, glm::tvec4<samplerValType, P> const & Texel);
495 
496  template <typename T, template <typename, precision> class vecType, convertMode mode>
497  struct conv
498  {
499  static tvec4<samplerValType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
500  {
501  return convertFunc<textureType, samplerValType, T, P, vecType, mode, std::numeric_limits<samplerValType>::is_iec559>::fetch(Texture, TexelCoord, Layer, Face, Level);
502  }
503 
504  static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<samplerValType, P> const & Texel)
505  {
506  convertFunc<textureType, samplerValType, T, P, vecType, mode, std::numeric_limits<samplerValType>::is_iec559>::write(Texture, TexelCoord, Layer, Face, Level, Texel);
507  }
508  };
509 
510  struct func
511  {
512  fetchFunc Fetch;
513  writeFunc Write;
514  };
515 
516  static func call(format Format)
517  {
518  static func Table[] =
519  {
520  {conv<u8, tvec2, CONVERT_MODE_44UNORM>::fetch, conv<u8, tvec2, CONVERT_MODE_44UNORM>::write}, // FORMAT_RG4_UNORM
521  {conv<u8, tvec4, CONVERT_MODE_4444UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_4444UNORM>::write}, // FORMAT_RGBA4_UNORM
522  {conv<u8, tvec4, CONVERT_MODE_4444UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_4444UNORM>::write}, // FORMAT_BGRA4_UNORM
523  {conv<u8, tvec3, CONVERT_MODE_565UNORM>::fetch, conv<u8, tvec3, CONVERT_MODE_565UNORM>::write}, // FORMAT_R5G6B5_UNORM
524  {conv<u8, tvec3, CONVERT_MODE_565UNORM>::fetch, conv<u8, tvec3, CONVERT_MODE_565UNORM>::write}, // FORMAT_B5G6R5_UNORM
525  {conv<u8, tvec4, CONVERT_MODE_5551UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_5551UNORM>::write}, // FORMAT_RGB5A1_UNORM
526  {conv<u8, tvec4, CONVERT_MODE_5551UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_5551UNORM>::write}, // FORMAT_BGR5A1_UNORM
527  {conv<u8, tvec4, CONVERT_MODE_5551UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_5551UNORM>::write}, // FORMAT_A1RGB5_UNORM
528 
529  {conv<u8, tvec1, CONVERT_MODE_NORM>::fetch, conv<u8, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_R8_UNORM
530  {conv<i8, tvec1, CONVERT_MODE_NORM>::fetch, conv<i8, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_R8_SNORM
531  {conv<u8, tvec1, CONVERT_MODE_CAST>::fetch, conv<u8, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R8_USCALED
532  {conv<i8, tvec1, CONVERT_MODE_CAST>::fetch, conv<i8, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R8_SSCALED
533  {conv<u8, tvec1, CONVERT_MODE_CAST>::fetch, conv<u8, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R8_UINT
534  {conv<i8, tvec1, CONVERT_MODE_CAST>::fetch, conv<i8, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R8_SINT
535  {conv<u8, tvec1, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec1, CONVERT_MODE_SRGB>::write}, // FORMAT_R8_SRGB
536 
537  {conv<u8, tvec2, CONVERT_MODE_NORM>::fetch, conv<u8, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_RG8_UNORM
538  {conv<i8, tvec2, CONVERT_MODE_NORM>::fetch, conv<i8, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_RG8_SNORM
539  {conv<u8, tvec2, CONVERT_MODE_CAST>::fetch, conv<u8, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_USCALED
540  {conv<i8, tvec2, CONVERT_MODE_CAST>::fetch, conv<i8, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_SSCALED
541  {conv<u8, tvec2, CONVERT_MODE_CAST>::fetch, conv<u8, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_UINT
542  {conv<i8, tvec2, CONVERT_MODE_CAST>::fetch, conv<i8, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_SINT
543  {conv<u8, tvec2, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec2, CONVERT_MODE_SRGB>::write}, // FORMAT_RG8_SRGB
544 
545  {conv<u8, tvec3, CONVERT_MODE_NORM>::fetch, conv<u8, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_RGB8_UNORM
546  {conv<i8, tvec3, CONVERT_MODE_NORM>::fetch, conv<i8, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_RGB8_SNORM
547  {conv<u8, tvec3, CONVERT_MODE_CAST>::fetch, conv<u8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_USCALED
548  {conv<i8, tvec3, CONVERT_MODE_CAST>::fetch, conv<i8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_SSCALED
549  {conv<u8, tvec3, CONVERT_MODE_CAST>::fetch, conv<u8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_UINT
550  {conv<i8, tvec3, CONVERT_MODE_CAST>::fetch, conv<i8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_SINT
551  {conv<u8, tvec3, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec3, CONVERT_MODE_SRGB>::write}, // FORMAT_RGB8_SRGB
552 
553  {conv<u8, tvec3, CONVERT_MODE_NORM>::fetch, conv<u8, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_BGR8_UNORM
554  {conv<i8, tvec3, CONVERT_MODE_NORM>::fetch, conv<i8, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_BGR8_SNORM
555  {conv<u8, tvec3, CONVERT_MODE_CAST>::fetch, conv<u8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_USCALED
556  {conv<i8, tvec3, CONVERT_MODE_CAST>::fetch, conv<i8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_SSCALED
557  {conv<u32, tvec3, CONVERT_MODE_CAST>::fetch, conv<u32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_UINT
558  {conv<i32, tvec3, CONVERT_MODE_CAST>::fetch, conv<i32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_SINT
559  {conv<u8, tvec3, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec3, CONVERT_MODE_SRGB>::write}, // FORMAT_BGR8_SRGB
560 
561  {conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA8_UNORM
562  {conv<i8, tvec4, CONVERT_MODE_NORM>::fetch, conv<i8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA8_SNORM
563  {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_USCALED
564  {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_SSCALED
565  {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_UINT
566  {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_SINT
567  {conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write}, // FORMAT_RGBA8_SRGB
568 
569  {conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_BGRA8_UNORM
570  {conv<i8, tvec4, CONVERT_MODE_NORM>::fetch, conv<i8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_BGRA8_SNORM
571  {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_USCALED
572  {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_SSCALED
573  {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_UINT
574  {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_SINT
575  {conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write}, // FORMAT_BGRA8_SRGB
576 
577  {conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_ABGR8_UNORM
578  {conv<i8, tvec4, CONVERT_MODE_NORM>::fetch, conv<i8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_ABGR8_SNORM
579  {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_USCALED
580  {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_SSCALED
581  {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_UINT
582  {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_SINT
583  {conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write}, // FORMAT_ABGR8_SRGB
584 
585  {conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::write}, // FORMAT_RGB10A2_UNORM
586  {conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::write}, // FORMAT_RGB10A2_SNORM
587  {conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::write}, // FORMAT_RGB10A2_USCALED
588  {conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::write}, // FORMAT_RGB10A2_SSCALED
589  {conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::write}, // FORMAT_RGB10A2_UINT
590  {conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::write}, // FORMAT_RGB10A2_SINT
591 
592  {conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::write}, // FORMAT_BGR10A2_UNORM
593  {conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::write}, // FORMAT_BGR10A2_SNORM
594  {conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::write}, // FORMAT_BGR10A2_USCALED
595  {conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::write}, // FORMAT_BGR10A2_SSCALED
596  {conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::write}, // FORMAT_BGR10A2_UINT
597  {conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::write}, // FORMAT_BGR10A2_SINT
598 
599  {conv<u16, tvec1, CONVERT_MODE_NORM>::fetch, conv<u16, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_R16_UNORM_PACK16
600  {conv<i16, tvec1, CONVERT_MODE_NORM>::fetch, conv<i16, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_R16_SNORM_PACK16
601  {conv<u16, tvec1, CONVERT_MODE_CAST>::fetch, conv<u16, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R16_USCALED_PACK16
602  {conv<i16, tvec1, CONVERT_MODE_CAST>::fetch, conv<i16, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R16_SSCALED_PACK16
603  {conv<u16, tvec1, CONVERT_MODE_CAST>::fetch, conv<u16, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R16_UINT_PACK16
604  {conv<i16, tvec1, CONVERT_MODE_CAST>::fetch, conv<i16, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R16_SINT_PACK16
605  {conv<u16, tvec1, CONVERT_MODE_HALF>::fetch, conv<u16, tvec1, CONVERT_MODE_HALF>::write}, // FORMAT_R16_SFLOAT_PACK16
606 
607  {conv<u16, tvec2, CONVERT_MODE_NORM>::fetch, conv<u16, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_RG16_UNORM_PACK16
608  {conv<i16, tvec2, CONVERT_MODE_NORM>::fetch, conv<i16, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_RG16_SNORM_PACK16
609  {conv<u16, tvec2, CONVERT_MODE_CAST>::fetch, conv<u16, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_USCALED_PACK16
610  {conv<i16, tvec2, CONVERT_MODE_CAST>::fetch, conv<i16, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_SSCALED_PACK16
611  {conv<u16, tvec2, CONVERT_MODE_CAST>::fetch, conv<u16, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_UINT_PACK16
612  {conv<i16, tvec2, CONVERT_MODE_CAST>::fetch, conv<i16, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_SINT_PACK16
613  {conv<u16, tvec2, CONVERT_MODE_HALF>::fetch, conv<u16, tvec2, CONVERT_MODE_HALF>::write}, // FORMAT_RG16_SFLOAT_PACK16
614 
615  {conv<u16, tvec3, CONVERT_MODE_NORM>::fetch, conv<u16, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_RGB16_UNORM_PACK16
616  {conv<i16, tvec3, CONVERT_MODE_NORM>::fetch, conv<i16, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_RGB16_SNORM_PACK16
617  {conv<u16, tvec3, CONVERT_MODE_CAST>::fetch, conv<u16, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_USCALED_PACK16
618  {conv<i16, tvec3, CONVERT_MODE_CAST>::fetch, conv<i16, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_SSCALED_PACK16
619  {conv<u16, tvec3, CONVERT_MODE_CAST>::fetch, conv<u16, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_UINT_PACK16
620  {conv<i16, tvec3, CONVERT_MODE_CAST>::fetch, conv<i16, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_SINT_PACK16
621  {conv<u16, tvec3, CONVERT_MODE_HALF>::fetch, conv<u16, tvec3, CONVERT_MODE_HALF>::write}, // FORMAT_RGB16_SFLOAT_PACK16
622 
623  {conv<u16, tvec4, CONVERT_MODE_NORM>::fetch, conv<u16, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA16_UNORM_PACK16
624  {conv<i16, tvec4, CONVERT_MODE_NORM>::fetch, conv<i16, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA16_SNORM_PACK16
625  {conv<u16, tvec4, CONVERT_MODE_CAST>::fetch, conv<u16, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_USCALED_PACK16
626  {conv<i16, tvec4, CONVERT_MODE_CAST>::fetch, conv<i16, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_SSCALED_PACK16
627  {conv<u16, tvec4, CONVERT_MODE_CAST>::fetch, conv<u16, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_UINT_PACK16
628  {conv<i16, tvec4, CONVERT_MODE_CAST>::fetch, conv<i16, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_SINT_PACK16
629  {conv<u16, tvec4, CONVERT_MODE_HALF>::fetch, conv<u16, tvec4, CONVERT_MODE_HALF>::write}, // FORMAT_RGBA16_SFLOAT_PACK16
630 
631  {conv<u32, tvec1, CONVERT_MODE_CAST>::fetch, conv<u32, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R32_UINT_PACK32
632  {conv<i32, tvec1, CONVERT_MODE_CAST>::fetch, conv<i32, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R32_SINT_PACK32
633  {conv<f32, tvec1, CONVERT_MODE_CAST>::fetch, conv<f32, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R32_SFLOAT_PACK32
634 
635  {conv<u32, tvec2, CONVERT_MODE_CAST>::fetch, conv<u32, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG32_UINT_PACK32
636  {conv<i32, tvec2, CONVERT_MODE_CAST>::fetch, conv<i32, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG32_SINT_PACK32
637  {conv<f32, tvec2, CONVERT_MODE_CAST>::fetch, conv<f32, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG32_SFLOAT_PACK32
638 
639  {conv<u32, tvec3, CONVERT_MODE_CAST>::fetch, conv<u32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB32_UINT_PACK32
640  {conv<i32, tvec3, CONVERT_MODE_CAST>::fetch, conv<i32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB32_SINT_PACK32
641  {conv<f32, tvec3, CONVERT_MODE_CAST>::fetch, conv<f32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB32_SFLOAT_PACK32
642 
643  {conv<u32, tvec4, CONVERT_MODE_CAST>::fetch, conv<u32, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA32_UINT_PACK32
644  {conv<i32, tvec4, CONVERT_MODE_CAST>::fetch, conv<i32, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA32_SINT_PACK32
645  {conv<f32, tvec4, CONVERT_MODE_CAST>::fetch, conv<f32, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA32_SFLOAT_PACK32
646 
647  {conv<u64, tvec1, CONVERT_MODE_CAST>::fetch, conv<u64, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R64_UINT_PACK64
648  {conv<i64, tvec1, CONVERT_MODE_CAST>::fetch, conv<i64, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R64_SINT_PACK64
649  {conv<f64, tvec1, CONVERT_MODE_CAST>::fetch, conv<f64, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R64_SFLOAT_PACK64
650 
651  {conv<u64, tvec2, CONVERT_MODE_CAST>::fetch, conv<u64, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG64_UINT_PACK64
652  {conv<i64, tvec2, CONVERT_MODE_CAST>::fetch, conv<i64, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG64_SINT_PACK64
653  {conv<f64, tvec2, CONVERT_MODE_CAST>::fetch, conv<f64, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG64_SFLOAT_PACK64
654 
655  {conv<u64, tvec3, CONVERT_MODE_CAST>::fetch, conv<u64, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB64_UINT_PACK64
656  {conv<i64, tvec3, CONVERT_MODE_CAST>::fetch, conv<i64, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB64_SINT_PACK64
657  {conv<f64, tvec3, CONVERT_MODE_CAST>::fetch, conv<f64, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB64_SFLOAT_PACK64
658 
659  {conv<u64, tvec4, CONVERT_MODE_CAST>::fetch, conv<u64, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA64_UINT_PACK64
660  {conv<i64, tvec4, CONVERT_MODE_CAST>::fetch, conv<i64, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA64_SINT_PACK64
661  {conv<f64, tvec4, CONVERT_MODE_CAST>::fetch, conv<f64, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA64_SFLOAT_PACK64
662 
663  {conv<u32, tvec1, CONVERT_MODE_RG11B10F>::fetch, conv<u32, tvec1, CONVERT_MODE_RG11B10F>::write}, // FORMAT_RG11B10_UFLOAT
664  {conv<u32, tvec1, CONVERT_MODE_RGB9E5>::fetch, conv<u32, tvec1, CONVERT_MODE_RGB9E5>::write}, // FORMAT_RGB9E5_UFLOAT
665 
666  {conv<u16, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u16, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D16_UNORM_PACK16
667  {conv<u32, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u32, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D24_UNORM
668  {conv<float, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<float, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D32_SFLOAT_PACK32
669  {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_S8_UINT_PACK8
670  {conv<u16, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u16, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D16_UNORM_S8_UINT_PACK32
671  {conv<u32, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u32, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D24_UNORM_S8_UINT_PACK32
672  {conv<u32, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u32, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D32_SFLOAT_S8_UINT_PACK64
673 
674  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_DXT1_UNORM_BLOCK8
675  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_DXT1_SRGB_BLOCK8
676  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT1_UNORM_BLOCK8
677  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT1_SRGB_BLOCK8
678  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT3_UNORM_BLOCK16
679  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT3_SRGB_BLOCK16
680  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT5_UNORM_BLOCK16
681  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT5_SRGB_BLOCK16
682  {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_ATI1N_UNORM_BLOCK8
683  {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<i8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_ATI1N_SNORM_BLOCK8
684  {conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_ATI2N_UNORM_BLOCK16
685  {conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<i8, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_ATI2N_SNORM_BLOCK16
686  {conv<float, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<float, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_BP_UFLOAT_BLOCK16
687  {conv<float, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<float, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_BP_SFLOAT_BLOCK16
688  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_BP_UNORM_BLOCK16
689  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_BP_SRGB_BLOCK16
690 
691  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ETC2_UNORM_BLOCK8
692  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ETC2_SRGB_BLOCK8
693  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_A1_UNORM_BLOCK8
694  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_A1_SRGB_BLOCK8
695  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_UNORM_BLOCK16
696  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_SRGB_BLOCK16
697  {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_EAC_UNORM_BLOCK8
698  {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_EAC_SNORM_BLOCK8
699  {conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_EAC_UNORM_BLOCK16
700  {conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_EAC_SNORM_BLOCK16
701 
702  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_4x4_UNORM
703  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_4x4_SRGB
704  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x4_UNORM
705  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x4_SRGB
706  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x5_UNORM
707  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x5_SRGB
708  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x5_UNORM
709  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x5_SRGB
710  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x6_UNORM
711  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x6_SRGB
712  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x5_UNORM
713  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x5_SRGB
714  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x6_UNORM
715  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x6_SRGB
716  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x8_UNORM
717  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x8_SRGB
718  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x5_UNORM
719  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x5_SRGB
720  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x6_UNORM
721  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x6_SRGB
722  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x8_UNORM
723  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x8_SRGB
724  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x10_UNORM
725  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x10_SRGB
726  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x10_UNORM
727  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x10_SRGB
728  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x12_UNORM
729  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x12_SRGB
730 
731  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_8X8_UNORM_BLOCK32
732  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_8X8_SRGB_BLOCK32
733  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_16X8_UNORM_BLOCK32
734  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_16X8_SRGB_BLOCK32
735  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_8X8_UNORM_BLOCK32
736  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_8X8_SRGB_BLOCK32
737  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_16X8_UNORM_BLOCK32
738  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_16X8_SRGB_BLOCK32
739  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_4X4_UNORM_BLOCK8
740  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_4X4_SRGB_BLOCK8
741  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_8X4_UNORM_BLOCK8
742  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_8X4_SRGB_BLOCK8
743 
744  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ETC_UNORM_BLOCK8
745  {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ATC_UNORM_BLOCK8
746  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ATCA_UNORM_BLOCK16
747  {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ATCI_UNORM_BLOCK16
748 
749  {conv<u8, tvec1, CONVERT_MODE_NORM>::fetch, conv<u8, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_L8_UNORM_PACK8
750  {conv<u8, tvec1, CONVERT_MODE_NORM>::fetch, conv<u8, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_A8_UNORM_PACK8
751  {conv<u8, tvec2, CONVERT_MODE_NORM>::fetch, conv<u8, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_LA8_UNORM_PACK8
752  {conv<u16, tvec1, CONVERT_MODE_NORM>::fetch, conv<u16, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_L16_UNORM_PACK16
753  {conv<u16, tvec1, CONVERT_MODE_NORM>::fetch, conv<u16, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_A16_UNORM_PACK16
754  {conv<u16, tvec2, CONVERT_MODE_NORM>::fetch, conv<u16, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_LA16_UNORM_PACK16
755 
756  {conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_BGRX8_UNORM
757  {conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write}, // FORMAT_BGRX8_SRGB
758 
759  {conv<u8, tvec3, CONVERT_MODE_332UNORM>::fetch, conv<u8, tvec3, CONVERT_MODE_332UNORM>::write} // FORMAT_RG3B2_UNORM
760  };
761  static_assert(sizeof(Table) / sizeof(Table[0]) == FORMAT_COUNT, "Texel functions need to be updated");
762 
763  return Table[Format - FORMAT_FIRST];
764  }
765  };
766 }//namespace detail
767 }//namespace gli
gen_type load(extent_type const &TexelCoord, size_type Layer, size_type Face, size_type Level) const
Fetch a texel from a texture. The texture format must be uncompressed.
format
Texture data format.
Definition: format.hpp:12
bool is_integer(format Format)
Evaluate whether the format is an integer format.
texture load(char const *Path)
Loads a texture storage_linear from file.
Namespace where all the classes and functions provided by GLI are exposed.
Definition: clear.hpp:6
texture_type convert(texture_type const &Texture, format Format)
Convert texture data to a new format.