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>
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,
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,
44 template <
typename textureType,
typename genType>
48 template <
typename genType>
49 struct accessFunc<texture1d, genType>
51 static genType
load(texture1d
const & Texture, texture1d::extent_type
const & TexelCoord, texture1d::size_type Layer, texture1d::size_type Face, texture1d::size_type Level)
53 GLI_ASSERT(Layer == 0 && Face == 0);
54 return Texture.load<genType>(TexelCoord, Level);
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)
59 GLI_ASSERT(Layer == 0 && Face == 0);
60 Texture.store<genType>(TexelCoord, Level, Texel);
64 template <
typename genType>
65 struct accessFunc<texture1d_array, genType>
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)
69 GLI_ASSERT(Face == 0);
70 return Texture.load<genType>(TexelCoord, Layer, Level);
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)
75 GLI_ASSERT(Face == 0);
76 Texture.store<genType>(TexelCoord, Layer, Level, Texel);
80 template <
typename genType>
81 struct accessFunc<texture2d, genType>
83 static genType
load(texture2d
const & Texture, texture2d::extent_type
const & TexelCoord, texture2d::size_type Layer, texture2d::size_type Face, texture2d::size_type Level)
85 GLI_ASSERT(Layer == 0 && Face == 0);
86 return Texture.load<genType>(TexelCoord, Level);
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)
91 GLI_ASSERT(Layer == 0 && Face == 0);
92 Texture.store<genType>(TexelCoord, Level, Texel);
96 template <
typename genType>
97 struct accessFunc<texture2d_array, genType>
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)
101 GLI_ASSERT(Face == 0);
102 return Texture.load<genType>(TexelCoord, Layer, Level);
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)
107 GLI_ASSERT(Face == 0);
108 Texture.store<genType>(TexelCoord, Layer, Level, Texel);
112 template <
typename genType>
113 struct accessFunc<texture3d, genType>
115 static genType
load(texture3d
const & Texture, texture3d::extent_type
const & TexelCoord, texture3d::size_type Layer, texture3d::size_type Face, texture3d::size_type Level)
117 GLI_ASSERT(Layer == 0 && Face == 0);
118 return Texture.load<genType>(TexelCoord, Level);
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)
123 GLI_ASSERT(Layer == 0 && Face == 0);
124 Texture.store<genType>(TexelCoord, Level, Texel);
128 template <
typename genType>
129 struct accessFunc<texture_cube, genType>
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)
133 GLI_ASSERT(Layer == 0);
134 return Texture.load<genType>(TexelCoord, Face, Level);
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)
139 GLI_ASSERT(Layer == 0);
140 Texture.store<genType>(TexelCoord, Face, Level, Texel);
144 template <
typename genType>
145 struct accessFunc<texture_cube_array, genType>
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)
149 return Texture.
load<genType>(TexelCoord, Layer, Face, Level);
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)
154 Texture.store<genType>(TexelCoord, Layer, Face, Level, Texel);
160 template <
typename textureType,
typename retType,
typename T, precision P,
template <
typename, precision>
class vecType, convertMode mode = CONVERT_MODE_CAST,
bool isSamplerFloat =
false>
163 typedef accessFunc<textureType, vecType<T, P> > access;
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)
167 return make_vec4<retType, P>(vecType<retType, P>(
access::load(Texture, TexelCoord, Layer, Face, Level)));
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)
172 access::store(Texture, TexelCoord, Layer, Face, Level, vecType<T, P>(Texel));
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>
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)
181 return tvec4<retType, P>(0, 0, 0, 1);
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)
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>
191 typedef accessFunc<textureType, vecType<T, P> > access;
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)
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)));
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)
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)));
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>
209 typedef accessFunc<textureType, vecType<T, P> > access;
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)
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))));
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)
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))));
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>
227 typedef accessFunc<textureType, uint32> access;
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)
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));
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)
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)));
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>
245 typedef accessFunc<textureType, uint32> access;
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)
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));
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)
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)));
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>
263 typedef accessFunc<textureType, vecType<uint16, P> > access;
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)
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))));
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)
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)));
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>
281 typedef accessFunc<textureType, uint8> access;
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)
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));
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)
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)));
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>
299 typedef accessFunc<textureType, uint16> access;
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)
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)));
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)
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)));
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>
317 typedef accessFunc<textureType, uint16> access;
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)
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));
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)
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)));
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>
335 typedef accessFunc<textureType, uint16> access;
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)
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)));
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)
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)));
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>
353 typedef accessFunc<textureType, uint8> access;
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)
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));
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)
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)));
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>
371 typedef accessFunc<textureType, uint32> access;
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)
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)));
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)
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)));
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>
389 typedef accessFunc<textureType, uint32> access;
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)
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)));
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)
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));
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>
407 typedef accessFunc<textureType, uint32> access;
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)
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);
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)
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);
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>
432 typedef accessFunc<textureType, uint32> access;
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)
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);
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)
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);
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>
457 typedef accessFunc<textureType, uint32> access;
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)
462 return tvec4<retType, P>(unpackU3x10_1x2(
access::load(Texture, TexelCoord, Layer, Face, Level)));
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)
468 access::store(Texture, TexelCoord, Layer, Face, Level, packU3x10_1x2(Texel));
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>
475 typedef accessFunc<textureType, uint32> access;
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)
480 return tvec4<retType, P>(unpackI3x10_1x2(
access::load(Texture, TexelCoord, Layer, Face, Level)));
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)
486 access::store(Texture, TexelCoord, Layer, Face, Level, packI3x10_1x2(Texel));
490 template <
typename textureType,
typename samplerValType, precision P>
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);
496 template <
typename T,
template <
typename, precision>
class vecType, convertMode mode>
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)
501 return convertFunc<textureType, samplerValType, T, P, vecType, mode, std::numeric_limits<samplerValType>::is_iec559>::fetch(Texture, TexelCoord, Layer, Face, Level);
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)
506 convertFunc<textureType, samplerValType, T, P, vecType, mode, std::numeric_limits<samplerValType>::is_iec559>::write(Texture, TexelCoord, Layer, Face, Level, Texel);
516 static func call(
format Format)
518 static func Table[] =
520 {conv<u8, tvec2, CONVERT_MODE_44UNORM>::fetch, conv<u8, tvec2, CONVERT_MODE_44UNORM>::write},
521 {conv<u8, tvec4, CONVERT_MODE_4444UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_4444UNORM>::write},
522 {conv<u8, tvec4, CONVERT_MODE_4444UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_4444UNORM>::write},
523 {conv<u8, tvec3, CONVERT_MODE_565UNORM>::fetch, conv<u8, tvec3, CONVERT_MODE_565UNORM>::write},
524 {conv<u8, tvec3, CONVERT_MODE_565UNORM>::fetch, conv<u8, tvec3, CONVERT_MODE_565UNORM>::write},
525 {conv<u8, tvec4, CONVERT_MODE_5551UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_5551UNORM>::write},
526 {conv<u8, tvec4, CONVERT_MODE_5551UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_5551UNORM>::write},
527 {conv<u8, tvec4, CONVERT_MODE_5551UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_5551UNORM>::write},
529 {conv<u8, tvec1, CONVERT_MODE_NORM>::fetch, conv<u8, tvec1, CONVERT_MODE_NORM>::write},
530 {conv<i8, tvec1, CONVERT_MODE_NORM>::fetch, conv<i8, tvec1, CONVERT_MODE_NORM>::write},
531 {conv<u8, tvec1, CONVERT_MODE_CAST>::fetch, conv<u8, tvec1, CONVERT_MODE_CAST>::write},
532 {conv<i8, tvec1, CONVERT_MODE_CAST>::fetch, conv<i8, tvec1, CONVERT_MODE_CAST>::write},
533 {conv<u8, tvec1, CONVERT_MODE_CAST>::fetch, conv<u8, tvec1, CONVERT_MODE_CAST>::write},
534 {conv<i8, tvec1, CONVERT_MODE_CAST>::fetch, conv<i8, tvec1, CONVERT_MODE_CAST>::write},
535 {conv<u8, tvec1, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec1, CONVERT_MODE_SRGB>::write},
537 {conv<u8, tvec2, CONVERT_MODE_NORM>::fetch, conv<u8, tvec2, CONVERT_MODE_NORM>::write},
538 {conv<i8, tvec2, CONVERT_MODE_NORM>::fetch, conv<i8, tvec2, CONVERT_MODE_NORM>::write},
539 {conv<u8, tvec2, CONVERT_MODE_CAST>::fetch, conv<u8, tvec2, CONVERT_MODE_CAST>::write},
540 {conv<i8, tvec2, CONVERT_MODE_CAST>::fetch, conv<i8, tvec2, CONVERT_MODE_CAST>::write},
541 {conv<u8, tvec2, CONVERT_MODE_CAST>::fetch, conv<u8, tvec2, CONVERT_MODE_CAST>::write},
542 {conv<i8, tvec2, CONVERT_MODE_CAST>::fetch, conv<i8, tvec2, CONVERT_MODE_CAST>::write},
543 {conv<u8, tvec2, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec2, CONVERT_MODE_SRGB>::write},
545 {conv<u8, tvec3, CONVERT_MODE_NORM>::fetch, conv<u8, tvec3, CONVERT_MODE_NORM>::write},
546 {conv<i8, tvec3, CONVERT_MODE_NORM>::fetch, conv<i8, tvec3, CONVERT_MODE_NORM>::write},
547 {conv<u8, tvec3, CONVERT_MODE_CAST>::fetch, conv<u8, tvec3, CONVERT_MODE_CAST>::write},
548 {conv<i8, tvec3, CONVERT_MODE_CAST>::fetch, conv<i8, tvec3, CONVERT_MODE_CAST>::write},
549 {conv<u8, tvec3, CONVERT_MODE_CAST>::fetch, conv<u8, tvec3, CONVERT_MODE_CAST>::write},
550 {conv<i8, tvec3, CONVERT_MODE_CAST>::fetch, conv<i8, tvec3, CONVERT_MODE_CAST>::write},
551 {conv<u8, tvec3, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec3, CONVERT_MODE_SRGB>::write},
553 {conv<u8, tvec3, CONVERT_MODE_NORM>::fetch, conv<u8, tvec3, CONVERT_MODE_NORM>::write},
554 {conv<i8, tvec3, CONVERT_MODE_NORM>::fetch, conv<i8, tvec3, CONVERT_MODE_NORM>::write},
555 {conv<u8, tvec3, CONVERT_MODE_CAST>::fetch, conv<u8, tvec3, CONVERT_MODE_CAST>::write},
556 {conv<i8, tvec3, CONVERT_MODE_CAST>::fetch, conv<i8, tvec3, CONVERT_MODE_CAST>::write},
557 {conv<u32, tvec3, CONVERT_MODE_CAST>::fetch, conv<u32, tvec3, CONVERT_MODE_CAST>::write},
558 {conv<i32, tvec3, CONVERT_MODE_CAST>::fetch, conv<i32, tvec3, CONVERT_MODE_CAST>::write},
559 {conv<u8, tvec3, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec3, CONVERT_MODE_SRGB>::write},
561 {conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write},
562 {conv<i8, tvec4, CONVERT_MODE_NORM>::fetch, conv<i8, tvec4, CONVERT_MODE_NORM>::write},
563 {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write},
564 {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write},
565 {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write},
566 {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write},
567 {conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write},
569 {conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write},
570 {conv<i8, tvec4, CONVERT_MODE_NORM>::fetch, conv<i8, tvec4, CONVERT_MODE_NORM>::write},
571 {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write},
572 {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write},
573 {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write},
574 {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write},
575 {conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write},
577 {conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write},
578 {conv<i8, tvec4, CONVERT_MODE_NORM>::fetch, conv<i8, tvec4, CONVERT_MODE_NORM>::write},
579 {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write},
580 {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write},
581 {conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write},
582 {conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write},
583 {conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write},
585 {conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::write},
586 {conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::write},
587 {conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::write},
588 {conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::write},
589 {conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::write},
590 {conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::write},
592 {conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::write},
593 {conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::write},
594 {conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::write},
595 {conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::write},
596 {conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::write},
597 {conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::write},
599 {conv<u16, tvec1, CONVERT_MODE_NORM>::fetch, conv<u16, tvec1, CONVERT_MODE_NORM>::write},
600 {conv<i16, tvec1, CONVERT_MODE_NORM>::fetch, conv<i16, tvec1, CONVERT_MODE_NORM>::write},
601 {conv<u16, tvec1, CONVERT_MODE_CAST>::fetch, conv<u16, tvec1, CONVERT_MODE_CAST>::write},
602 {conv<i16, tvec1, CONVERT_MODE_CAST>::fetch, conv<i16, tvec1, CONVERT_MODE_CAST>::write},
603 {conv<u16, tvec1, CONVERT_MODE_CAST>::fetch, conv<u16, tvec1, CONVERT_MODE_CAST>::write},
604 {conv<i16, tvec1, CONVERT_MODE_CAST>::fetch, conv<i16, tvec1, CONVERT_MODE_CAST>::write},
605 {conv<u16, tvec1, CONVERT_MODE_HALF>::fetch, conv<u16, tvec1, CONVERT_MODE_HALF>::write},
607 {conv<u16, tvec2, CONVERT_MODE_NORM>::fetch, conv<u16, tvec2, CONVERT_MODE_NORM>::write},
608 {conv<i16, tvec2, CONVERT_MODE_NORM>::fetch, conv<i16, tvec2, CONVERT_MODE_NORM>::write},
609 {conv<u16, tvec2, CONVERT_MODE_CAST>::fetch, conv<u16, tvec2, CONVERT_MODE_CAST>::write},
610 {conv<i16, tvec2, CONVERT_MODE_CAST>::fetch, conv<i16, tvec2, CONVERT_MODE_CAST>::write},
611 {conv<u16, tvec2, CONVERT_MODE_CAST>::fetch, conv<u16, tvec2, CONVERT_MODE_CAST>::write},
612 {conv<i16, tvec2, CONVERT_MODE_CAST>::fetch, conv<i16, tvec2, CONVERT_MODE_CAST>::write},
613 {conv<u16, tvec2, CONVERT_MODE_HALF>::fetch, conv<u16, tvec2, CONVERT_MODE_HALF>::write},
615 {conv<u16, tvec3, CONVERT_MODE_NORM>::fetch, conv<u16, tvec3, CONVERT_MODE_NORM>::write},
616 {conv<i16, tvec3, CONVERT_MODE_NORM>::fetch, conv<i16, tvec3, CONVERT_MODE_NORM>::write},
617 {conv<u16, tvec3, CONVERT_MODE_CAST>::fetch, conv<u16, tvec3, CONVERT_MODE_CAST>::write},
618 {conv<i16, tvec3, CONVERT_MODE_CAST>::fetch, conv<i16, tvec3, CONVERT_MODE_CAST>::write},
619 {conv<u16, tvec3, CONVERT_MODE_CAST>::fetch, conv<u16, tvec3, CONVERT_MODE_CAST>::write},
620 {conv<i16, tvec3, CONVERT_MODE_CAST>::fetch, conv<i16, tvec3, CONVERT_MODE_CAST>::write},
621 {conv<u16, tvec3, CONVERT_MODE_HALF>::fetch, conv<u16, tvec3, CONVERT_MODE_HALF>::write},
623 {conv<u16, tvec4, CONVERT_MODE_NORM>::fetch, conv<u16, tvec4, CONVERT_MODE_NORM>::write},
624 {conv<i16, tvec4, CONVERT_MODE_NORM>::fetch, conv<i16, tvec4, CONVERT_MODE_NORM>::write},
625 {conv<u16, tvec4, CONVERT_MODE_CAST>::fetch, conv<u16, tvec4, CONVERT_MODE_CAST>::write},
626 {conv<i16, tvec4, CONVERT_MODE_CAST>::fetch, conv<i16, tvec4, CONVERT_MODE_CAST>::write},
627 {conv<u16, tvec4, CONVERT_MODE_CAST>::fetch, conv<u16, tvec4, CONVERT_MODE_CAST>::write},
628 {conv<i16, tvec4, CONVERT_MODE_CAST>::fetch, conv<i16, tvec4, CONVERT_MODE_CAST>::write},
629 {conv<u16, tvec4, CONVERT_MODE_HALF>::fetch, conv<u16, tvec4, CONVERT_MODE_HALF>::write},
631 {conv<u32, tvec1, CONVERT_MODE_CAST>::fetch, conv<u32, tvec1, CONVERT_MODE_CAST>::write},
632 {conv<i32, tvec1, CONVERT_MODE_CAST>::fetch, conv<i32, tvec1, CONVERT_MODE_CAST>::write},
633 {conv<f32, tvec1, CONVERT_MODE_CAST>::fetch, conv<f32, tvec1, CONVERT_MODE_CAST>::write},
635 {conv<u32, tvec2, CONVERT_MODE_CAST>::fetch, conv<u32, tvec2, CONVERT_MODE_CAST>::write},
636 {conv<i32, tvec2, CONVERT_MODE_CAST>::fetch, conv<i32, tvec2, CONVERT_MODE_CAST>::write},
637 {conv<f32, tvec2, CONVERT_MODE_CAST>::fetch, conv<f32, tvec2, CONVERT_MODE_CAST>::write},
639 {conv<u32, tvec3, CONVERT_MODE_CAST>::fetch, conv<u32, tvec3, CONVERT_MODE_CAST>::write},
640 {conv<i32, tvec3, CONVERT_MODE_CAST>::fetch, conv<i32, tvec3, CONVERT_MODE_CAST>::write},
641 {conv<f32, tvec3, CONVERT_MODE_CAST>::fetch, conv<f32, tvec3, CONVERT_MODE_CAST>::write},
643 {conv<u32, tvec4, CONVERT_MODE_CAST>::fetch, conv<u32, tvec4, CONVERT_MODE_CAST>::write},
644 {conv<i32, tvec4, CONVERT_MODE_CAST>::fetch, conv<i32, tvec4, CONVERT_MODE_CAST>::write},
645 {conv<f32, tvec4, CONVERT_MODE_CAST>::fetch, conv<f32, tvec4, CONVERT_MODE_CAST>::write},
647 {conv<u64, tvec1, CONVERT_MODE_CAST>::fetch, conv<u64, tvec1, CONVERT_MODE_CAST>::write},
648 {conv<i64, tvec1, CONVERT_MODE_CAST>::fetch, conv<i64, tvec1, CONVERT_MODE_CAST>::write},
649 {conv<f64, tvec1, CONVERT_MODE_CAST>::fetch, conv<f64, tvec1, CONVERT_MODE_CAST>::write},
651 {conv<u64, tvec2, CONVERT_MODE_CAST>::fetch, conv<u64, tvec2, CONVERT_MODE_CAST>::write},
652 {conv<i64, tvec2, CONVERT_MODE_CAST>::fetch, conv<i64, tvec2, CONVERT_MODE_CAST>::write},
653 {conv<f64, tvec2, CONVERT_MODE_CAST>::fetch, conv<f64, tvec2, CONVERT_MODE_CAST>::write},
655 {conv<u64, tvec3, CONVERT_MODE_CAST>::fetch, conv<u64, tvec3, CONVERT_MODE_CAST>::write},
656 {conv<i64, tvec3, CONVERT_MODE_CAST>::fetch, conv<i64, tvec3, CONVERT_MODE_CAST>::write},
657 {conv<f64, tvec3, CONVERT_MODE_CAST>::fetch, conv<f64, tvec3, CONVERT_MODE_CAST>::write},
659 {conv<u64, tvec4, CONVERT_MODE_CAST>::fetch, conv<u64, tvec4, CONVERT_MODE_CAST>::write},
660 {conv<i64, tvec4, CONVERT_MODE_CAST>::fetch, conv<i64, tvec4, CONVERT_MODE_CAST>::write},
661 {conv<f64, tvec4, CONVERT_MODE_CAST>::fetch, conv<f64, tvec4, CONVERT_MODE_CAST>::write},
663 {conv<u32, tvec1, CONVERT_MODE_RG11B10F>::fetch, conv<u32, tvec1, CONVERT_MODE_RG11B10F>::write},
664 {conv<u32, tvec1, CONVERT_MODE_RGB9E5>::fetch, conv<u32, tvec1, CONVERT_MODE_RGB9E5>::write},
666 {conv<u16, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u16, tvec1, CONVERT_MODE_DEFAULT>::write},
667 {conv<u32, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u32, tvec1, CONVERT_MODE_DEFAULT>::write},
668 {conv<float, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<float, tvec1, CONVERT_MODE_DEFAULT>::write},
669 {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write},
670 {conv<u16, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u16, tvec2, CONVERT_MODE_DEFAULT>::write},
671 {conv<u32, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u32, tvec2, CONVERT_MODE_DEFAULT>::write},
672 {conv<u32, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u32, tvec2, CONVERT_MODE_DEFAULT>::write},
674 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
675 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
676 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
677 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
678 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
679 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
680 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
681 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
682 {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write},
683 {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<i8, tvec1, CONVERT_MODE_DEFAULT>::write},
684 {conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec2, CONVERT_MODE_DEFAULT>::write},
685 {conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<i8, tvec2, CONVERT_MODE_DEFAULT>::write},
686 {conv<float, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<float, tvec3, CONVERT_MODE_DEFAULT>::write},
687 {conv<float, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<float, tvec3, CONVERT_MODE_DEFAULT>::write},
688 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
689 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
691 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
692 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
693 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
694 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
695 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
696 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
697 {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write},
698 {conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write},
699 {conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec2, CONVERT_MODE_DEFAULT>::write},
700 {conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec2, CONVERT_MODE_DEFAULT>::write},
702 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
703 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
704 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
705 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
706 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
707 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
708 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
709 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
710 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
711 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
712 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
713 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
714 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
715 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
716 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
717 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
718 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
719 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
720 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
721 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
722 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
723 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
724 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
725 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
726 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
727 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
728 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
729 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
731 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
732 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
733 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
734 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
735 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
736 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
737 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
738 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
739 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
740 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
741 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
742 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
744 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
745 {conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write},
746 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
747 {conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write},
749 {conv<u8, tvec1, CONVERT_MODE_NORM>::fetch, conv<u8, tvec1, CONVERT_MODE_NORM>::write},
750 {conv<u8, tvec1, CONVERT_MODE_NORM>::fetch, conv<u8, tvec1, CONVERT_MODE_NORM>::write},
751 {conv<u8, tvec2, CONVERT_MODE_NORM>::fetch, conv<u8, tvec2, CONVERT_MODE_NORM>::write},
752 {conv<u16, tvec1, CONVERT_MODE_NORM>::fetch, conv<u16, tvec1, CONVERT_MODE_NORM>::write},
753 {conv<u16, tvec1, CONVERT_MODE_NORM>::fetch, conv<u16, tvec1, CONVERT_MODE_NORM>::write},
754 {conv<u16, tvec2, CONVERT_MODE_NORM>::fetch, conv<u16, tvec2, CONVERT_MODE_NORM>::write},
756 {conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write},
757 {conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write},
759 {conv<u8, tvec3, CONVERT_MODE_332UNORM>::fetch, conv<u8, tvec3, CONVERT_MODE_332UNORM>::write}
761 static_assert(
sizeof(Table) /
sizeof(Table[0]) == FORMAT_COUNT,
"Texel functions need to be updated");
763 return Table[Format - FORMAT_FIRST];
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.
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.
texture_type convert(texture_type const &Texture, format Format)
Convert texture data to a new format.