#include "main/glheader.h"
#include "main/context.h"
#include "main/colormac.h"
#include "main/imports.h"
#include "main/texformat.h"
#include "s_context.h"
#include "s_texfilter.h"
Defines | |
#define | FRAC(f) ((f) - IFLOOR(f)) |
#define | LERP(T, A, B) ( (A) + (T) * ((B) - (A)) ) |
Linear interpolation macro. | |
#define | REMAINDER(A, B) (((A) + (B) * 1024) % (B)) |
If A is a signed integer, A % B doesn't give the right value for A < 0 (in terms of texture repeat). | |
#define | I0BIT 1 |
#define | I1BIT 2 |
#define | J0BIT 4 |
#define | J1BIT 8 |
#define | K0BIT 16 |
#define | K1BIT 32 |
Functions | |
static INLINE GLfloat | lerp_2d (GLfloat a, GLfloat b, GLfloat v00, GLfloat v10, GLfloat v01, GLfloat v11) |
Do 2D/biliner interpolation of float values. | |
static INLINE GLfloat | lerp_3d (GLfloat a, GLfloat b, GLfloat c, GLfloat v000, GLfloat v100, GLfloat v010, GLfloat v110, GLfloat v001, GLfloat v101, GLfloat v011, GLfloat v111) |
Do 3D/trilinear interpolation of float values. | |
static INLINE void | lerp_rgba (GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4]) |
Do linear interpolation of colors. | |
static INLINE void | lerp_rgba_2d (GLfloat result[4], GLfloat a, GLfloat b, const GLfloat t00[4], const GLfloat t10[4], const GLfloat t01[4], const GLfloat t11[4]) |
Do bilinear interpolation of colors. | |
static INLINE void | lerp_rgba_3d (GLfloat result[4], GLfloat a, GLfloat b, GLfloat c, const GLfloat t000[4], const GLfloat t100[4], const GLfloat t010[4], const GLfloat t110[4], const GLfloat t001[4], const GLfloat t101[4], const GLfloat t011[4], const GLfloat t111[4]) |
Do trilinear interpolation of colors. | |
static INLINE void | linear_texel_locations (GLenum wrapMode, const struct gl_texture_image *img, GLint size, GLfloat s, GLint *i0, GLint *i1, GLfloat *weight) |
Used to compute texel locations for linear sampling. | |
static INLINE GLint | nearest_texel_location (GLenum wrapMode, const struct gl_texture_image *img, GLint size, GLfloat s) |
Used to compute texel location for nearest sampling. | |
static INLINE void | linear_repeat_texel_location (GLuint size, GLfloat s, GLint *i0, GLint *i1, GLfloat *weight) |
static INLINE GLint | clamp_rect_coord_nearest (GLenum wrapMode, GLfloat coord, GLint max) |
Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode. | |
static INLINE void | clamp_rect_coord_linear (GLenum wrapMode, GLfloat coord, GLint max, GLint *i0out, GLint *i1out, GLfloat *weight) |
As above, but GL_LINEAR filtering. | |
static INLINE void | nearest_texcoord (const struct gl_texture_object *texObj, const GLfloat texcoord[4], GLint *i, GLint *j, GLint *k) |
Compute nearest integer texcoords for given texobj and coordinate. | |
static INLINE void | linear_texcoord (const struct gl_texture_object *texObj, const GLfloat texcoord[4], GLint *i0, GLint *i1, GLint *j0, GLint *j1, GLint *slice, GLfloat *wi, GLfloat *wj) |
Compute linear integer texcoords for given texobj and coordinate. | |
static INLINE GLint | linear_mipmap_level (const struct gl_texture_object *tObj, GLfloat lambda) |
For linear interpolation between mipmap levels N and N+1, this function computes N. | |
static INLINE GLint | nearest_mipmap_level (const struct gl_texture_object *tObj, GLfloat lambda) |
Compute the nearest mipmap level to take texels from. | |
static INLINE void | compute_min_mag_ranges (const struct gl_texture_object *tObj, GLuint n, const GLfloat lambda[], GLuint *minStart, GLuint *minEnd, GLuint *magStart, GLuint *magEnd) |
The lambda[] array values are always monotonic. | |
static INLINE void | get_border_color (const struct gl_texture_object *tObj, const struct gl_texture_image *img, GLfloat rgba[4]) |
When we sample the border color, it must be interpreted according to the base texture format. | |
static INLINE void | sample_1d_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) |
Return the texture sample for coordinate (s) using GL_NEAREST filter. | |
static INLINE void | sample_1d_linear (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) |
Return the texture sample for coordinate (s) using GL_LINEAR filter. | |
static void | sample_1d_nearest_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_1d_linear_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_1d_nearest_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_1d_linear_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_nearest_1d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 1D texture, nearest filtering for both min/magnification. | |
static void | sample_linear_1d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 1D texture, linear filtering for both min/magnification. | |
static void | sample_lambda_1d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 1D texture, using lambda to choose between min/magnification. | |
static INLINE void | sample_2d_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[]) |
Return the texture sample for coordinate (s,t) using GL_NEAREST filter. | |
static INLINE void | sample_2d_linear (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[]) |
Return the texture sample for coordinate (s,t) using GL_LINEAR filter. | |
static INLINE void | sample_2d_linear_repeat (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[]) |
As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT. | |
static void | sample_2d_nearest_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_2d_linear_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_2d_nearest_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_2d_linear_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_2d_linear_mipmap_linear_repeat (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_nearest_2d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 2D texture, nearest filtering for both min/magnification. | |
static void | sample_linear_2d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 2D texture, linear filtering for both min/magnification. | |
static void | opt_sample_rgb_2d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Optimized 2-D texture sampling: S and T wrap mode == GL_REPEAT GL_NEAREST min/mag filter No border, RowStride == Width, Format = GL_RGB. | |
static void | opt_sample_rgba_2d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Optimized 2-D texture sampling: S and T wrap mode == GL_REPEAT GL_NEAREST min/mag filter No border RowStride == Width, Format = GL_RGBA. | |
static void | sample_lambda_2d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 2D texture, using lambda to choose between min/magnification. | |
static INLINE void | sample_3d_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) |
Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. | |
static void | sample_3d_linear (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) |
Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. | |
static void | sample_3d_nearest_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_3d_linear_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_3d_nearest_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_3d_linear_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_nearest_3d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 3D texture, nearest filtering for both min/magnification. | |
static void | sample_linear_3d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 3D texture, linear filtering for both min/magnification. | |
static void | sample_lambda_3d (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 3D texture, using lambda to choose between min/magnification. | |
static struct gl_texture_image ** | choose_cube_face (const struct gl_texture_object *texObj, const GLfloat texcoord[4], GLfloat newCoord[4]) |
Choose one of six sides of a texture cube map given the texture coord (rx,ry,rz). | |
static void | sample_nearest_cube (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_linear_cube (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_cube_nearest_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_cube_linear_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_cube_nearest_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_cube_linear_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_lambda_cube (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample cube texture, using lambda to choose between min/magnification. | |
static void | sample_nearest_rect (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_linear_rect (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_lambda_rect (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample Rect texture, using lambda to choose between min/magnification. | |
static void | sample_2d_array_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) |
Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. | |
static void | sample_2d_array_linear (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) |
Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. | |
static void | sample_2d_array_nearest_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_2d_array_linear_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_2d_array_nearest_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_2d_array_linear_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_nearest_2d_array (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 2D Array texture, nearest filtering for both min/magnification. | |
static void | sample_linear_2d_array (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 2D Array texture, linear filtering for both min/magnification. | |
static void | sample_lambda_2d_array (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 2D Array texture, using lambda to choose between min/magnification. | |
static void | sample_1d_array_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) |
Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. | |
static void | sample_1d_array_linear (GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLfloat rgba[4]) |
Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. | |
static void | sample_1d_array_nearest_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_1d_array_linear_mipmap_nearest (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_1d_array_nearest_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_1d_array_linear_mipmap_linear (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
static void | sample_nearest_1d_array (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 1D Array texture, nearest filtering for both min/magnification. | |
static void | sample_linear_1d_array (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 1D Array texture, linear filtering for both min/magnification. | |
static void | sample_lambda_1d_array (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
Sample 1D Array texture, using lambda to choose between min/magnification. | |
static INLINE GLfloat | shadow_compare (GLenum function, GLfloat coord, GLfloat depthSample, GLfloat ambient) |
Compare texcoord against depth sample. | |
static INLINE GLfloat | shadow_compare4 (GLenum function, GLfloat coord, GLfloat depth00, GLfloat depth01, GLfloat depth10, GLfloat depth11, GLfloat ambient, GLfloat wi, GLfloat wj) |
Compare texcoord against four depth samples. | |
static void | sample_depth_texture (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat texel[][4]) |
Sample a shadow/depth texture. | |
static void | null_sample_func (GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]) |
We use this function when a texture object is in an "incomplete" state. | |
texture_sample_func | _swrast_choose_texture_sample_func (GLcontext *ctx, const struct gl_texture_object *t) |
Choose the texture sampling function for the given texture object. |
#define FRAC | ( | f | ) | ((f) - IFLOOR(f)) |
#define I0BIT 1 |
#define I1BIT 2 |
#define J0BIT 4 |
#define J1BIT 8 |
#define K0BIT 16 |
#define K1BIT 32 |
#define LERP | ( | T, | |||
A, | |||||
B | ) | ( (A) + (T) * ((B) - (A)) ) |
Linear interpolation macro.
#define REMAINDER | ( | A, | |||
B | ) | (((A) + (B) * 1024) % (B)) |
If A is a signed integer, A % B doesn't give the right value for A < 0 (in terms of texture repeat).
Just casting to unsigned fixes that.
texture_sample_func _swrast_choose_texture_sample_func | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | t | |||
) |
Choose the texture sampling function for the given texture object.
static struct gl_texture_image** choose_cube_face | ( | const struct gl_texture_object * | texObj, | |
const GLfloat | texcoord[4], | |||
GLfloat | newCoord[4] | |||
) | [static, read] |
Choose one of six sides of a texture cube map given the texture coord (rx,ry,rz).
Return pointer to corresponding array of texture images.
static INLINE void clamp_rect_coord_linear | ( | GLenum | wrapMode, | |
GLfloat | coord, | |||
GLint | max, | |||
GLint * | i0out, | |||
GLint * | i1out, | |||
GLfloat * | weight | |||
) | [static] |
As above, but GL_LINEAR filtering.
static INLINE GLint clamp_rect_coord_nearest | ( | GLenum | wrapMode, | |
GLfloat | coord, | |||
GLint | max | |||
) | [static] |
Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode.
static INLINE void compute_min_mag_ranges | ( | const struct gl_texture_object * | tObj, | |
GLuint | n, | |||
const GLfloat | lambda[], | |||
GLuint * | minStart, | |||
GLuint * | minEnd, | |||
GLuint * | magStart, | |||
GLuint * | magEnd | |||
) | [static] |
The lambda[] array values are always monotonic.
Either the whole span will be minified, magnified, or split between the two. This function determines the subranges in [0, n-1] that are to be minified or magnified.
static INLINE void get_border_color | ( | const struct gl_texture_object * | tObj, | |
const struct gl_texture_image * | img, | |||
GLfloat | rgba[4] | |||
) | [static] |
When we sample the border color, it must be interpreted according to the base texture format.
Ex: if the texture base format it GL_ALPHA, we return (0,0,0,BorderAlpha).
static INLINE GLfloat lerp_2d | ( | GLfloat | a, | |
GLfloat | b, | |||
GLfloat | v00, | |||
GLfloat | v10, | |||
GLfloat | v01, | |||
GLfloat | v11 | |||
) | [static] |
Do 2D/biliner interpolation of float values.
v00, v10, v01 and v11 are typically four texture samples in a square/box. a and b are the horizontal and vertical interpolants. It's important that this function is inlined when compiled with optimization! If we find that's not true on some systems, convert to a macro.
static INLINE GLfloat lerp_3d | ( | GLfloat | a, | |
GLfloat | b, | |||
GLfloat | c, | |||
GLfloat | v000, | |||
GLfloat | v100, | |||
GLfloat | v010, | |||
GLfloat | v110, | |||
GLfloat | v001, | |||
GLfloat | v101, | |||
GLfloat | v011, | |||
GLfloat | v111 | |||
) | [static] |
static INLINE void lerp_rgba | ( | GLfloat | result[4], | |
GLfloat | t, | |||
const GLfloat | a[4], | |||
const GLfloat | b[4] | |||
) | [static] |
Do linear interpolation of colors.
static INLINE void lerp_rgba_2d | ( | GLfloat | result[4], | |
GLfloat | a, | |||
GLfloat | b, | |||
const GLfloat | t00[4], | |||
const GLfloat | t10[4], | |||
const GLfloat | t01[4], | |||
const GLfloat | t11[4] | |||
) | [static] |
Do bilinear interpolation of colors.
static INLINE void lerp_rgba_3d | ( | GLfloat | result[4], | |
GLfloat | a, | |||
GLfloat | b, | |||
GLfloat | c, | |||
const GLfloat | t000[4], | |||
const GLfloat | t100[4], | |||
const GLfloat | t010[4], | |||
const GLfloat | t110[4], | |||
const GLfloat | t001[4], | |||
const GLfloat | t101[4], | |||
const GLfloat | t011[4], | |||
const GLfloat | t111[4] | |||
) | [static] |
Do trilinear interpolation of colors.
static INLINE GLint linear_mipmap_level | ( | const struct gl_texture_object * | tObj, | |
GLfloat | lambda | |||
) | [static] |
For linear interpolation between mipmap levels N and N+1, this function computes N.
static INLINE void linear_repeat_texel_location | ( | GLuint | size, | |
GLfloat | s, | |||
GLint * | i0, | |||
GLint * | i1, | |||
GLfloat * | weight | |||
) | [static] |
static INLINE void linear_texcoord | ( | const struct gl_texture_object * | texObj, | |
const GLfloat | texcoord[4], | |||
GLint * | i0, | |||
GLint * | i1, | |||
GLint * | j0, | |||
GLint * | j1, | |||
GLint * | slice, | |||
GLfloat * | wi, | |||
GLfloat * | wj | |||
) | [static] |
Compute linear integer texcoords for given texobj and coordinate.
static INLINE void linear_texel_locations | ( | GLenum | wrapMode, | |
const struct gl_texture_image * | img, | |||
GLint | size, | |||
GLfloat | s, | |||
GLint * | i0, | |||
GLint * | i1, | |||
GLfloat * | weight | |||
) | [static] |
Used to compute texel locations for linear sampling.
Input: wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER s = texcoord in [0,1] size = width (or height or depth) of texture Output: i0, i1 = returns two nearest texel indexes weight = returns blend factor between texels
static INLINE GLint nearest_mipmap_level | ( | const struct gl_texture_object * | tObj, | |
GLfloat | lambda | |||
) | [static] |
Compute the nearest mipmap level to take texels from.
static INLINE void nearest_texcoord | ( | const struct gl_texture_object * | texObj, | |
const GLfloat | texcoord[4], | |||
GLint * | i, | |||
GLint * | j, | |||
GLint * | k | |||
) | [static] |
Compute nearest integer texcoords for given texobj and coordinate.
static INLINE GLint nearest_texel_location | ( | GLenum | wrapMode, | |
const struct gl_texture_image * | img, | |||
GLint | size, | |||
GLfloat | s | |||
) | [static] |
Used to compute texel location for nearest sampling.
static void null_sample_func | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
We use this function when a texture object is in an "incomplete" state.
When a fragment program attempts to sample an incomplete texture we return black (see issue 23 in GL_ARB_fragment_program spec). Note: fragment programs don't observe the texture enable/disable flags.
static void opt_sample_rgb_2d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Optimized 2-D texture sampling: S and T wrap mode == GL_REPEAT GL_NEAREST min/mag filter No border, RowStride == Width, Format = GL_RGB.
static void opt_sample_rgba_2d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Optimized 2-D texture sampling: S and T wrap mode == GL_REPEAT GL_NEAREST min/mag filter No border RowStride == Width, Format = GL_RGBA.
static void sample_1d_array_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[4] | |||
) | [static] |
Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
static void sample_1d_array_linear_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_1d_array_linear_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_1d_array_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[4] | |||
) | [static] |
Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
static void sample_1d_array_nearest_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_1d_array_nearest_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static INLINE void sample_1d_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[4] | |||
) | [static] |
Return the texture sample for coordinate (s) using GL_LINEAR filter.
static void sample_1d_linear_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_1d_linear_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static INLINE void sample_1d_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[4] | |||
) | [static] |
Return the texture sample for coordinate (s) using GL_NEAREST filter.
static void sample_1d_nearest_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_1d_nearest_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_2d_array_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[4] | |||
) | [static] |
Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
static void sample_2d_array_linear_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_2d_array_linear_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_2d_array_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[4] | |||
) | [static] |
Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
static void sample_2d_array_nearest_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_2d_array_nearest_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static INLINE void sample_2d_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[] | |||
) | [static] |
Return the texture sample for coordinate (s,t) using GL_LINEAR filter.
New sampling code contributed by Lynn Quam <quam@ai.sri.com>.
static void sample_2d_linear_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_2d_linear_mipmap_linear_repeat | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_2d_linear_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static INLINE void sample_2d_linear_repeat | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[] | |||
) | [static] |
As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT.
We don't have to worry about the texture border.
static INLINE void sample_2d_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[] | |||
) | [static] |
Return the texture sample for coordinate (s,t) using GL_NEAREST filter.
static void sample_2d_nearest_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_2d_nearest_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_3d_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[4] | |||
) | [static] |
Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
static void sample_3d_linear_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_3d_linear_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static INLINE void sample_3d_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
const struct gl_texture_image * | img, | |||
const GLfloat | texcoord[4], | |||
GLfloat | rgba[4] | |||
) | [static] |
Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
static void sample_3d_nearest_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_3d_nearest_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_cube_linear_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_cube_linear_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_cube_nearest_mipmap_linear | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_cube_nearest_mipmap_nearest | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoord[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_depth_texture | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | texel[][4] | |||
) | [static] |
Sample a shadow/depth texture.
static void sample_lambda_1d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 1D texture, using lambda to choose between min/magnification.
static void sample_lambda_1d_array | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 1D Array texture, using lambda to choose between min/magnification.
static void sample_lambda_2d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 2D texture, using lambda to choose between min/magnification.
static void sample_lambda_2d_array | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 2D Array texture, using lambda to choose between min/magnification.
static void sample_lambda_3d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 3D texture, using lambda to choose between min/magnification.
static void sample_lambda_cube | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample cube texture, using lambda to choose between min/magnification.
static void sample_lambda_rect | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample Rect texture, using lambda to choose between min/magnification.
static void sample_linear_1d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 1D texture, linear filtering for both min/magnification.
static void sample_linear_1d_array | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 1D Array texture, linear filtering for both min/magnification.
static void sample_linear_2d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 2D texture, linear filtering for both min/magnification.
static void sample_linear_2d_array | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 2D Array texture, linear filtering for both min/magnification.
static void sample_linear_3d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 3D texture, linear filtering for both min/magnification.
static void sample_linear_cube | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_linear_rect | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_nearest_1d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 1D texture, nearest filtering for both min/magnification.
static void sample_nearest_1d_array | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 1D Array texture, nearest filtering for both min/magnification.
static void sample_nearest_2d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 2D texture, nearest filtering for both min/magnification.
static void sample_nearest_2d_array | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 2D Array texture, nearest filtering for both min/magnification.
static void sample_nearest_3d | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
Sample 3D texture, nearest filtering for both min/magnification.
static void sample_nearest_cube | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static void sample_nearest_rect | ( | GLcontext * | ctx, | |
const struct gl_texture_object * | tObj, | |||
GLuint | n, | |||
const GLfloat | texcoords[][4], | |||
const GLfloat | lambda[], | |||
GLfloat | rgba[][4] | |||
) | [static] |
static INLINE GLfloat shadow_compare | ( | GLenum | function, | |
GLfloat | coord, | |||
GLfloat | depthSample, | |||
GLfloat | ambient | |||
) | [static] |
Compare texcoord against depth sample.
Return 1.0 or the ambient value.
static INLINE GLfloat shadow_compare4 | ( | GLenum | function, | |
GLfloat | coord, | |||
GLfloat | depth00, | |||
GLfloat | depth01, | |||
GLfloat | depth10, | |||
GLfloat | depth11, | |||
GLfloat | ambient, | |||
GLfloat | wi, | |||
GLfloat | wj | |||
) | [static] |
Compare texcoord against four depth samples.