0.8.2 API documentation
filter_compute.hpp
1 #pragma once
2 
3 #include "filter.hpp"
4 #include "coord.hpp"
5 #include <glm/gtc/integer.hpp>
6 
7 namespace gli{
8 namespace detail
9 {
10  enum dimension
11  {
12  DIMENSION_1D,
13  DIMENSION_2D,
14  DIMENSION_3D
15  };
16 
17  template <typename T>
18  struct interpolate
19  {
20  typedef float type;
21  };
22 
23  template <>
24  struct interpolate<double>
25  {
26  typedef double type;
27  };
28 
29  template <>
30  struct interpolate<long double>
31  {
32  typedef long double type;
33  };
34 
35  template <dimension Dimension, typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type>
36  struct filterBase
37  {
38  typedef typename texture_type::size_type size_type;
39  typedef typename texture_type::extent_type extent_type;
40 
41  typedef texel_type(*filterFunc)(
42  texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap,
43  size_type Layer, size_type Face, interpolate_type Level,
44  texel_type const & BorderColor);
45  };
46 
47  template <dimension Dimension, typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type, bool is_float = true, bool support_border = true>
48  struct nearest : public filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
49  {
50  typedef filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
51  typedef typename base_type::size_type size_type;
52  typedef typename base_type::extent_type extent_type;
53  typedef coord_nearest<extent_type, normalized_type> coord_type;
54 
55  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, size_type Level, texel_type const & BorderColor)
56  {
57  extent_type const TexelDim(Texture.extent(Level));
58  normalized_type const TexelLast(normalized_type(TexelDim) - normalized_type(1));
59 
60  //extent_type const TexelCoord(SampleCoordWrap * TexelLast + interpolate_type(0.5));
61  extent_type const TexelCoord = extent_type(round(SampleCoordWrap * TexelLast));
62  typename extent_type::bool_type const UseTexelCoord = in_interval(TexelCoord, extent_type(0), TexelDim - 1);
63 
64  texel_type Texel(BorderColor);
65  if(all(UseTexelCoord))
66  Texel = Fetch(Texture, TexelCoord, Layer, Face, Level);
67 
68  return Texel;
69  }
70  };
71 
72  template <dimension Dimension, typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type>
73  struct nearest<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, true, false> : public filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
74  {
75  typedef filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
76  typedef typename base_type::size_type size_type;
77  typedef typename base_type::extent_type extent_type;
78  typedef coord_nearest<extent_type, normalized_type> coord_type;
79 
80  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, size_type Level, texel_type const & BorderColor)
81  {
82  normalized_type const TexelLast(normalized_type(Texture.extent(Level)) - normalized_type(1));
83  extent_type const TexelCoord(SampleCoordWrap * TexelLast + interpolate_type(0.5));
84  //extent_type const TexelCoord = extent_type(round(SampleCoordWrap * TexelLast));
85 
86  return Fetch(Texture, TexelCoord, Layer, Face, Level);
87  }
88  };
89 
90  template <dimension Dimension, typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type, bool is_float = true, bool support_border = true>
91  struct linear : public filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
92  {
93  typedef filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
94  typedef typename base_type::size_type size_type;
95  typedef typename base_type::extent_type extent_type;
96 
97  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, size_type Level, texel_type const& BorderColor)
98  {
99  return texel_type(0);
100  }
101  };
102 
103  template <typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type>
104  struct linear<DIMENSION_1D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, true, true> : public filterBase<DIMENSION_1D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
105  {
106  typedef filterBase<DIMENSION_1D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
107  typedef typename base_type::size_type size_type;
108  typedef typename base_type::extent_type extent_type;
109  typedef coord_linear_border<extent_type, normalized_type> coord_type;
110 
111  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, size_type Level, texel_type const & BorderColor)
112  {
113  coord_type const& Coord = make_coord_linear_border(Texture.extent(Level), SampleCoordWrap);
114 
115  texel_type Texel0(BorderColor);
116  if(Coord.UseTexelFloor.s)
117  Texel0 = Fetch(Texture, extent_type(Coord.TexelFloor.s), Layer, Face, Level);
118 
119  texel_type Texel1(BorderColor);
120  if(Coord.UseTexelCeil.s)
121  Texel1 = Fetch(Texture, extent_type(Coord.TexelCeil.s), Layer, Face, Level);
122 
123  return mix(Texel0, Texel1, Coord.Blend.s);
124  }
125  };
126 
127  template <typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type>
128  struct linear<DIMENSION_1D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, true, false> : public filterBase<DIMENSION_1D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
129  {
130  typedef filterBase<DIMENSION_1D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
131  typedef typename base_type::size_type size_type;
132  typedef typename base_type::extent_type extent_type;
133  typedef coord_linear<extent_type, normalized_type> coord_type;
134 
135  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, size_type Level, texel_type const & BorderColor)
136  {
137  coord_type const& Coord = make_coord_linear(Texture.extent(Level), SampleCoordWrap);
138 
139  texel_type const Texel0 = Fetch(Texture, extent_type(Coord.TexelFloor.s), Layer, Face, Level);
140  texel_type const Texel1 = Fetch(Texture, extent_type(Coord.TexelCeil.s), Layer, Face, Level);
141 
142  return mix(Texel0, Texel1, Coord.Blend.s);
143  }
144  };
145 
146  template <typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type>
147  struct linear<DIMENSION_2D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, true, true> : public filterBase<DIMENSION_2D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
148  {
149  typedef filterBase<DIMENSION_2D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
150  typedef typename base_type::size_type size_type;
151  typedef typename base_type::extent_type extent_type;
152  typedef coord_linear_border<extent_type, normalized_type> coord_type;
153 
154  static texel_type call(texture_type const& Texture, fetch_type Fetch, normalized_type const& SampleCoordWrap, size_type Layer, size_type Face, size_type Level, texel_type const& BorderColor)
155  {
156  coord_type const& Coord = make_coord_linear_border(Texture.extent(Level), SampleCoordWrap);
157 
158  texel_type Texel00(BorderColor);
159  if(Coord.UseTexelFloor.s && Coord.UseTexelFloor.t)
160  Texel00 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelFloor.t), Layer, Face, Level);
161 
162  texel_type Texel10(BorderColor);
163  if(Coord.UseTexelCeil.s && Coord.UseTexelFloor.t)
164  Texel10 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelFloor.t), Layer, Face, Level);
165 
166  texel_type Texel11(BorderColor);
167  if(Coord.UseTexelCeil.s && Coord.UseTexelCeil.t)
168  Texel11 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelCeil.t), Layer, Face, Level);
169 
170  texel_type Texel01(BorderColor);
171  if(Coord.UseTexelFloor.s && Coord.UseTexelCeil.t)
172  Texel01 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelCeil.t), Layer, Face, Level);
173 
174  texel_type const ValueA(mix(Texel00, Texel10, Coord.Blend.s));
175  texel_type const ValueB(mix(Texel01, Texel11, Coord.Blend.s));
176  return mix(ValueA, ValueB, Coord.Blend.t);
177  }
178  };
179 
180  template <typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type>
181  struct linear<DIMENSION_2D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, true, false> : public filterBase<DIMENSION_2D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
182  {
183  typedef filterBase<DIMENSION_2D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
184  typedef typename base_type::size_type size_type;
185  typedef typename base_type::extent_type extent_type;
186  typedef coord_linear<extent_type, normalized_type> coord_type;
187 
188  static texel_type call(texture_type const& Texture, fetch_type Fetch, normalized_type const& SampleCoordWrap, size_type Layer, size_type Face, size_type Level, texel_type const& BorderColor)
189  {
190  coord_type const& Coord = make_coord_linear(Texture.extent(Level), SampleCoordWrap);
191 
192  texel_type const& Texel00 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelFloor.t), Layer, Face, Level);
193  texel_type const& Texel10 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelFloor.t), Layer, Face, Level);
194  texel_type const& Texel11 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelCeil.t), Layer, Face, Level);
195  texel_type const& Texel01 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelCeil.t), Layer, Face, Level);
196 
197  texel_type const ValueA(mix(Texel00, Texel10, Coord.Blend.s));
198  texel_type const ValueB(mix(Texel01, Texel11, Coord.Blend.s));
199  return mix(ValueA, ValueB, Coord.Blend.t);
200  }
201  };
202 
203  template <typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type>
204  struct linear<DIMENSION_3D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, true, true> : public filterBase<DIMENSION_3D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
205  {
206  typedef filterBase<DIMENSION_3D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
207  typedef typename base_type::size_type size_type;
208  typedef typename base_type::extent_type extent_type;
209  typedef coord_linear_border<extent_type, normalized_type> coord_type;
210 
211  static texel_type call(texture_type const& Texture, fetch_type Fetch, normalized_type const& SampleCoordWrap, size_type Layer, size_type Face, size_type Level, texel_type const& BorderColor)
212  {
213  coord_type const& Coord = make_coord_linear_border(Texture.extent(Level), SampleCoordWrap);
214 
215  texel_type Texel000(BorderColor);
216  if(Coord.UseTexelFloor.s && Coord.UseTexelFloor.t && Coord.UseTexelFloor.p)
217  Texel000 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelFloor.t, Coord.TexelFloor.p), Layer, Face, Level);
218 
219  texel_type Texel100(BorderColor);
220  if(Coord.UseTexelCeil.s && Coord.UseTexelFloor.t && Coord.UseTexelFloor.p)
221  Texel100 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelFloor.t, Coord.TexelFloor.p), Layer, Face, Level);
222 
223  texel_type Texel110(BorderColor);
224  if(Coord.UseTexelCeil.s && Coord.UseTexelCeil.t && Coord.UseTexelFloor.p)
225  Texel110 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelCeil.t, Coord.TexelFloor.p), Layer, Face, Level);
226 
227  texel_type Texel010(BorderColor);
228  if(Coord.UseTexelFloor.s && Coord.UseTexelCeil.t && Coord.UseTexelFloor.p)
229  Texel010 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelCeil.t, Coord.TexelFloor.p), Layer, Face, Level);
230 
231  texel_type Texel001(BorderColor);
232  if (Coord.UseTexelFloor.s && Coord.UseTexelFloor.t && Coord.UseTexelCeil.p)
233  Texel001 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelFloor.t, Coord.TexelCeil.p), Layer, Face, Level);
234 
235  texel_type Texel101(BorderColor);
236  if(Coord.UseTexelCeil.s && Coord.UseTexelFloor.t && Coord.UseTexelCeil.p)
237  Texel101 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelFloor.t, Coord.TexelCeil.p), Layer, Face, Level);
238 
239  texel_type Texel111(BorderColor);
240  if(Coord.UseTexelCeil.s && Coord.UseTexelCeil.t && Coord.UseTexelCeil.p)
241  Texel111 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelCeil.t, Coord.TexelCeil.p), Layer, Face, Level);
242 
243  texel_type Texel011(BorderColor);
244  if(Coord.UseTexelFloor.s && Coord.UseTexelCeil.t && Coord.UseTexelCeil.p)
245  Texel011 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelCeil.t, Coord.TexelCeil.p), Layer, Face, Level);
246 
247  texel_type const ValueA(mix(Texel000, Texel100, Coord.Blend.s));
248  texel_type const ValueB(mix(Texel010, Texel110, Coord.Blend.s));
249 
250  texel_type const ValueC(mix(Texel001, Texel101, Coord.Blend.s));
251  texel_type const ValueD(mix(Texel011, Texel111, Coord.Blend.s));
252 
253  texel_type const ValueE(mix(ValueA, ValueB, Coord.Blend.t));
254  texel_type const ValueF(mix(ValueC, ValueD, Coord.Blend.t));
255 
256  return mix(ValueE, ValueF, Coord.Blend.p);
257  }
258  };
259 
260  template <typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type>
261  struct linear<DIMENSION_3D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, true, false> : public filterBase<DIMENSION_3D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
262  {
263  typedef filterBase<DIMENSION_3D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
264  typedef typename base_type::size_type size_type;
265  typedef typename base_type::extent_type extent_type;
266  typedef coord_linear<extent_type, normalized_type> coord_type;
267 
268  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, size_type Level, texel_type const & BorderColor)
269  {
270  coord_type const & Coord = make_coord_linear(Texture.extent(Level), SampleCoordWrap);
271 
272  texel_type const & Texel000 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelFloor.t, Coord.TexelFloor.p), Layer, Face, Level);
273  texel_type const & Texel100 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelFloor.t, Coord.TexelFloor.p), Layer, Face, Level);
274  texel_type const & Texel110 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelCeil.t, Coord.TexelFloor.p), Layer, Face, Level);
275  texel_type const & Texel010 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelCeil.t, Coord.TexelFloor.p), Layer, Face, Level);
276  texel_type const & Texel001 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelFloor.t, Coord.TexelCeil.p), Layer, Face, Level);
277  texel_type const & Texel101 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelFloor.t, Coord.TexelCeil.p), Layer, Face, Level);
278  texel_type const & Texel111 = Fetch(Texture, extent_type(Coord.TexelCeil.s, Coord.TexelCeil.t, Coord.TexelCeil.p), Layer, Face, Level);
279  texel_type const & Texel011 = Fetch(Texture, extent_type(Coord.TexelFloor.s, Coord.TexelCeil.t, Coord.TexelCeil.p), Layer, Face, Level);
280 
281  texel_type const ValueA(mix(Texel000, Texel100, Coord.Blend.s));
282  texel_type const ValueB(mix(Texel010, Texel110, Coord.Blend.s));
283 
284  texel_type const ValueC(mix(Texel001, Texel101, Coord.Blend.s));
285  texel_type const ValueD(mix(Texel011, Texel111, Coord.Blend.s));
286 
287  texel_type const ValueE(mix(ValueA, ValueB, Coord.Blend.t));
288  texel_type const ValueF(mix(ValueC, ValueD, Coord.Blend.t));
289 
290  return mix(ValueE, ValueF, Coord.Blend.p);
291  }
292  };
293 
294  template <dimension Dimension, typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type, bool is_float, bool support_border>
295  struct nearest_mipmap_nearest : public filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
296  {
297  typedef filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
298  typedef typename base_type::size_type size_type;
299  typedef typename base_type::extent_type extent_type;
300  typedef coord_linear_border<extent_type, normalized_type> coord_type;
301 
302  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, interpolate_type Level, texel_type const & BorderColor)
303  {
304  return nearest<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, is_float, support_border>::call(Texture, Fetch, SampleCoordWrap, Layer, Face, glm::iround(Level), BorderColor);
305  }
306  };
307 
308  template <dimension Dimension, typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type, bool is_float, bool support_border>
309  struct nearest_mipmap_linear : public filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
310  {
311  typedef filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
312  typedef typename base_type::size_type size_type;
313  typedef typename base_type::extent_type extent_type;
314  typedef coord_linear_border<extent_type, normalized_type> coord_type;
315 
316  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, interpolate_type Level, texel_type const & BorderColor)
317  {
318  texel_type const MinTexel = nearest<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, is_float, support_border>::call(Texture, Fetch, SampleCoordWrap, Layer, Face, static_cast<size_type>(floor(Level)), BorderColor);
319  texel_type const MaxTexel = nearest<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, is_float, support_border>::call(Texture, Fetch, SampleCoordWrap, Layer, Face, static_cast<size_type>(ceil(Level)), BorderColor);
320  return mix(MinTexel, MaxTexel, fract(Level));
321  }
322  };
323 
324  template <dimension Dimension, typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type, bool is_float, bool support_border>
325  struct linear_mipmap_nearest : public filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
326  {
327  typedef filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
328  typedef typename base_type::size_type size_type;
329  typedef typename base_type::extent_type extent_type;
330  typedef coord_linear_border<extent_type, normalized_type> coord_type;
331 
332  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, interpolate_type Level, texel_type const & BorderColor)
333  {
334  return linear<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, is_float, support_border>::call(Texture, Fetch, SampleCoordWrap, Layer, Face, glm::iround(Level), BorderColor);
335  }
336  };
337 
338  template <dimension Dimension, typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type, bool is_float, bool support_border>
339  struct linear_mipmap_linear : public filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>
340  {
341  typedef filterBase<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type> base_type;
342  typedef typename base_type::size_type size_type;
343  typedef typename base_type::extent_type extent_type;
344  typedef coord_linear_border<extent_type, normalized_type> coord_type;
345 
346  static texel_type call(texture_type const & Texture, fetch_type Fetch, normalized_type const & SampleCoordWrap, size_type Layer, size_type Face, interpolate_type Level, texel_type const & BorderColor)
347  {
348  size_type const FloorLevel = static_cast<size_type>(floor(Level));
349  size_type const CeilLevel = static_cast<size_type>(ceil(Level));
350  texel_type const MinTexel = linear<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, is_float, support_border>::call(Texture, Fetch, SampleCoordWrap, Layer, Face, FloorLevel, BorderColor);
351  texel_type const MaxTexel = linear<Dimension, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, is_float, support_border>::call(Texture, Fetch, SampleCoordWrap, Layer, Face, CeilLevel, BorderColor);
352  return mix(MinTexel, MaxTexel, fract(Level));
353  }
354  };
355 
356  template <typename filter_type, dimension Dimensions, typename texture_type, typename interpolate_type, typename normalized_type, typename fetch_type, typename texel_type, typename T>
357  inline filter_type get_filter(filter Mip, filter Min, bool Border)
358  {
359  static filter_type Table[][FILTER_COUNT][2] =
360  {
361  {
362  {
363  nearest_mipmap_nearest<Dimensions, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, std::numeric_limits<T>::is_iec559, false>::call,
364  nearest_mipmap_nearest<Dimensions, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, std::numeric_limits<T>::is_iec559, true>::call
365  },
366  {
367  linear_mipmap_nearest<Dimensions, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, std::numeric_limits<T>::is_iec559, false>::call,
368  linear_mipmap_nearest<Dimensions, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, std::numeric_limits<T>::is_iec559, true>::call
369  }
370  },
371  {
372  {
373  nearest_mipmap_linear<Dimensions, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, std::numeric_limits<T>::is_iec559, false>::call,
374  nearest_mipmap_linear<Dimensions, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, std::numeric_limits<T>::is_iec559, true>::call
375  },
376  {
377  linear_mipmap_linear<Dimensions, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, std::numeric_limits<T>::is_iec559, false>::call,
378  linear_mipmap_linear<Dimensions, texture_type, interpolate_type, normalized_type, fetch_type, texel_type, std::numeric_limits<T>::is_iec559, true>::call
379  }
380  }
381  };
382  static_assert(sizeof(Table) / sizeof(Table[0]) == FILTER_COUNT, "GLI ERROR: 'Table' doesn't match the number of supported filters");
383 
384  GLI_ASSERT(Table[Mip - FILTER_FIRST][Min - FILTER_FIRST][Border ? 1 : 0]);
385 
386  return Table[Mip - FILTER_FIRST][Min - FILTER_FIRST][Border ? 1 : 0];
387  }
388 }//namespace detail
389 }//namespace gli
390 
Include to use filter enum, to select filtering methods.
filter
Texture filtring modes.
Definition: filter.hpp:9
Namespace where all the classes and functions provided by GLI are exposed.
Definition: clear.hpp:6