-/* $Id: s_texture.c,v 1.6 2001/01/03 15:59:30 brianp Exp $ */
+/* $Id: s_texture.c,v 1.7 2001/01/05 21:28:31 brianp Exp $ */
/*
* Mesa 3-D graphics library
* index - the palette index (8-bit only)
* Output: red, green, blue, alpha - the texel color
*/
-static void palette_sample(const struct gl_texture_object *tObj,
- GLint index, GLchan rgba[4] )
+static void
+palette_sample(const struct gl_texture_object *tObj,
+ GLint index, GLchan rgba[4] )
{
GLcontext *ctx = _mesa_get_current_context(); /* THIS IS A HACK */
const GLchan *palette;
* Given 1-D texture image and an (i) texel column coordinate, return the
* texel color.
*/
-static void get_1d_texel( const struct gl_texture_object *tObj,
- const struct gl_texture_image *img, GLint i,
- GLchan rgba[4] )
+static void
+get_1d_texel( const struct gl_texture_object *tObj,
+ const struct gl_texture_image *img, GLint i,
+ GLchan rgba[4] )
{
const GLchan *texel;
/*
* Return the texture sample for coordinate (s) using GL_NEAREST filter.
*/
-static void sample_1d_nearest( const struct gl_texture_object *tObj,
- const struct gl_texture_image *img,
- GLfloat s, GLchan rgba[4] )
+static void
+sample_1d_nearest( const struct gl_texture_object *tObj,
+ const struct gl_texture_image *img,
+ GLfloat s, GLchan rgba[4] )
{
const GLint width = img->Width2; /* without border, power of two */
const GLchan *texel;
/*
* Return the texture sample for coordinate (s) using GL_LINEAR filter.
*/
-static void sample_1d_linear( const struct gl_texture_object *tObj,
- const struct gl_texture_image *img,
- GLfloat s,
- GLchan rgba[4] )
+static void
+sample_1d_linear( const struct gl_texture_object *tObj,
+ const struct gl_texture_image *img,
+ GLfloat s, GLchan rgba[4] )
{
const GLint width = img->Width2;
GLint i0, i1;
-static void sample_nearest_1d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+sample_nearest_1d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
-static void sample_linear_1d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+sample_linear_1d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
* return a texture sample.
*
*/
-static void sample_lambda_1d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+sample_lambda_1d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
GLfloat MinMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit];
GLuint i;
* Given a texture image and an (i,j) integer texel coordinate, return the
* texel color.
*/
-static void get_2d_texel( const struct gl_texture_object *tObj,
- const struct gl_texture_image *img, GLint i, GLint j,
- GLchan rgba[4] )
+static void
+get_2d_texel( const struct gl_texture_object *tObj,
+ const struct gl_texture_image *img, GLint i, GLint j,
+ GLchan rgba[4] )
{
const GLint width = img->Width; /* includes border */
const GLchan *texel;
/*
* Return the texture sample for coordinate (s,t) using GL_NEAREST filter.
*/
-static void sample_2d_nearest( const struct gl_texture_object *tObj,
- const struct gl_texture_image *img,
- GLfloat s, GLfloat t,
- GLchan rgba[] )
+static void
+sample_2d_nearest( const struct gl_texture_object *tObj,
+ const struct gl_texture_image *img,
+ GLfloat s, GLfloat t,
+ GLchan rgba[] )
{
const GLint imgWidth = img->Width; /* includes border */
const GLint width = img->Width2; /* without border, power of two */
* 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( const struct gl_texture_object *tObj,
- const struct gl_texture_image *img,
- GLfloat s, GLfloat t,
- GLchan rgba[] )
+static void
+sample_2d_linear( const struct gl_texture_object *tObj,
+ const struct gl_texture_image *img,
+ GLfloat s, GLfloat t,
+ GLchan rgba[] )
{
const GLint width = img->Width2;
const GLint height = img->Height2;
-static void sample_nearest_2d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+sample_nearest_2d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
-static void sample_linear_2d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+sample_linear_2d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
* Given an (s,t) texture coordinate and lambda (level of detail) value,
* return a texture sample.
*/
-static void sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj,
- GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj,
+ GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
GLfloat MinMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit];
GLuint i;
* No border
* Format = GL_RGB
*/
-static void opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj,
- GLuint n, const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj,
+ GLuint n, const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel];
const GLfloat width = (GLfloat) img->Width;
* No border
* Format = GL_RGBA
*/
-static void opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj,
- GLuint n, const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj,
+ GLuint n, const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel];
const GLfloat width = (GLfloat) img->Width;
* Given a texture image and an (i,j,k) integer texel coordinate, return the
* texel color.
*/
-static void get_3d_texel( const struct gl_texture_object *tObj,
- const struct gl_texture_image *img,
- GLint i, GLint j, GLint k,
- GLchan rgba[4] )
+static void
+get_3d_texel( const struct gl_texture_object *tObj,
+ const struct gl_texture_image *img,
+ GLint i, GLint j, GLint k,
+ GLchan rgba[4] )
{
const GLint width = img->Width; /* includes border */
const GLint height = img->Height; /* includes border */
/*
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
*/
-static void sample_3d_nearest( const struct gl_texture_object *tObj,
- const struct gl_texture_image *img,
- GLfloat s, GLfloat t, GLfloat r,
- GLchan rgba[4] )
+static void
+sample_3d_nearest( const struct gl_texture_object *tObj,
+ const struct gl_texture_image *img,
+ GLfloat s, GLfloat t, GLfloat r,
+ GLchan rgba[4] )
{
const GLint imgWidth = img->Width; /* includes border, if any */
const GLint imgHeight = img->Height; /* includes border, if any */
/*
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
*/
-static void sample_3d_linear( const struct gl_texture_object *tObj,
- const struct gl_texture_image *img,
- GLfloat s, GLfloat t, GLfloat r,
- GLchan rgba[4] )
+static void
+sample_3d_linear( const struct gl_texture_object *tObj,
+ const struct gl_texture_image *img,
+ GLfloat s, GLfloat t, GLfloat r,
+ GLchan rgba[4] )
{
const GLint width = img->Width2;
const GLint height = img->Height2;
}
-static void sample_nearest_3d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+sample_nearest_3d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
-static void sample_linear_3d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+sample_linear_3d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
GLuint i;
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
* Given an (s,t,r) texture coordinate and lambda (level of detail) value,
* return a texture sample.
*/
-static void sample_lambda_3d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], const GLfloat lambda[],
- GLchan rgba[][4] )
+static void
+sample_lambda_3d( GLcontext *ctx, GLuint texUnit,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], const GLfloat lambda[],
+ GLchan rgba[][4] )
{
GLuint i;
GLfloat MinMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit];
if (needLambda) {
/* Compute min/mag filter threshold */
- if (t->MagFilter==GL_LINEAR
- && (t->MinFilter==GL_NEAREST_MIPMAP_NEAREST ||
- t->MinFilter==GL_LINEAR_MIPMAP_NEAREST)) {
+ if (t->MagFilter == GL_LINEAR
+ && (t->MinFilter == GL_NEAREST_MIPMAP_NEAREST ||
+ t->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) {
swrast->_MinMagThresh[texUnit] = 0.5F;
}
else {
/*
* Apply a unit of texture mapping to the incoming fragments.
*/
-void gl_texture_pixels( GLcontext *ctx, GLuint texUnit, GLuint n,
- const GLfloat s[], const GLfloat t[],
- const GLfloat r[], GLfloat lambda[],
- GLchan primary_rgba[][4], GLchan rgba[][4] )
+void
+_swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n,
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat r[], GLfloat lambda[],
+ GLchan primary_rgba[][4], GLchan rgba[][4] )
{
const GLuint mask = TEXTURE0_ANY << (texUnit * 4);