summaryrefslogtreecommitdiff
path: root/dist/Mesa/src/mesa/swrast
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-05-17 20:26:44 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-05-17 20:26:44 +0000
commit33665e806ec3493ea068df52d152741bf74492e6 (patch)
tree3c50cc5c49821093573f5d2085a068e950221062 /dist/Mesa/src/mesa/swrast
parentae8a766b6acc2dad90b894320eda5324cd6b0e41 (diff)
Update to Mesa 7.4.2. Tested by oga@, ckuethe@ and naddy@.
Diffstat (limited to 'dist/Mesa/src/mesa/swrast')
-rw-r--r--dist/Mesa/src/mesa/swrast/s_aaline.c8
-rw-r--r--dist/Mesa/src/mesa/swrast/s_aaline.h1
-rw-r--r--dist/Mesa/src/mesa/swrast/s_aalinetemp.h2
-rw-r--r--dist/Mesa/src/mesa/swrast/s_aatriangle.c12
-rw-r--r--dist/Mesa/src/mesa/swrast/s_aatriangle.h1
-rw-r--r--dist/Mesa/src/mesa/swrast/s_accum.c10
-rw-r--r--dist/Mesa/src/mesa/swrast/s_accum.h2
-rw-r--r--dist/Mesa/src/mesa/swrast/s_alpha.c8
-rw-r--r--dist/Mesa/src/mesa/swrast/s_alpha.h3
-rw-r--r--dist/Mesa/src/mesa/swrast/s_atifragshader.c9
-rw-r--r--dist/Mesa/src/mesa/swrast/s_bitmap.c10
-rw-r--r--dist/Mesa/src/mesa/swrast/s_blend.c8
-rw-r--r--dist/Mesa/src/mesa/swrast/s_blend.h10
-rw-r--r--dist/Mesa/src/mesa/swrast/s_blit.c4
-rw-r--r--dist/Mesa/src/mesa/swrast/s_buffers.c10
-rw-r--r--dist/Mesa/src/mesa/swrast/s_context.c14
-rw-r--r--dist/Mesa/src/mesa/swrast/s_copypix.c18
-rw-r--r--dist/Mesa/src/mesa/swrast/s_depth.c10
-rw-r--r--dist/Mesa/src/mesa/swrast/s_depth.h5
-rw-r--r--dist/Mesa/src/mesa/swrast/s_drawpix.c19
-rw-r--r--dist/Mesa/src/mesa/swrast/s_drawpix.h36
-rw-r--r--dist/Mesa/src/mesa/swrast/s_feedback.c12
-rw-r--r--dist/Mesa/src/mesa/swrast/s_feedback.h1
-rw-r--r--dist/Mesa/src/mesa/swrast/s_fog.c8
-rw-r--r--dist/Mesa/src/mesa/swrast/s_fog.h5
-rw-r--r--dist/Mesa/src/mesa/swrast/s_fragprog.c54
-rw-r--r--dist/Mesa/src/mesa/swrast/s_imaging.c13
-rw-r--r--dist/Mesa/src/mesa/swrast/s_lines.c8
-rw-r--r--dist/Mesa/src/mesa/swrast/s_lines.h2
-rw-r--r--dist/Mesa/src/mesa/swrast/s_logic.c8
-rw-r--r--dist/Mesa/src/mesa/swrast/s_logic.h9
-rw-r--r--dist/Mesa/src/mesa/swrast/s_masking.c4
-rw-r--r--dist/Mesa/src/mesa/swrast/s_masking.h24
-rw-r--r--dist/Mesa/src/mesa/swrast/s_points.c19
-rw-r--r--dist/Mesa/src/mesa/swrast/s_points.h2
-rw-r--r--dist/Mesa/src/mesa/swrast/s_readpix.c22
-rw-r--r--dist/Mesa/src/mesa/swrast/s_span.c35
-rw-r--r--dist/Mesa/src/mesa/swrast/s_span.h1
-rw-r--r--dist/Mesa/src/mesa/swrast/s_spantemp.h2
-rw-r--r--dist/Mesa/src/mesa/swrast/s_stencil.c12
-rw-r--r--dist/Mesa/src/mesa/swrast/s_stencil.h3
-rw-r--r--dist/Mesa/src/mesa/swrast/s_texcombine.c13
-rw-r--r--dist/Mesa/src/mesa/swrast/s_texcombine.h3
-rw-r--r--dist/Mesa/src/mesa/swrast/s_texfilter.c1034
-rw-r--r--dist/Mesa/src/mesa/swrast/s_texfilter.h1
-rw-r--r--dist/Mesa/src/mesa/swrast/s_texstore.c28
-rw-r--r--dist/Mesa/src/mesa/swrast/s_triangle.c37
-rw-r--r--dist/Mesa/src/mesa/swrast/s_triangle.h1
-rw-r--r--dist/Mesa/src/mesa/swrast/s_zoom.c8
-rw-r--r--dist/Mesa/src/mesa/swrast/s_zoom.h11
50 files changed, 746 insertions, 834 deletions
diff --git a/dist/Mesa/src/mesa/swrast/s_aaline.c b/dist/Mesa/src/mesa/swrast/s_aaline.c
index d6a9afb42..9bfa8f2e6 100644
--- a/dist/Mesa/src/mesa/swrast/s_aaline.c
+++ b/dist/Mesa/src/mesa/swrast/s_aaline.c
@@ -23,14 +23,14 @@
*/
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
#include "swrast/s_aaline.h"
#include "swrast/s_context.h"
#include "swrast/s_span.h"
#include "swrast/swrast.h"
-#include "mtypes.h"
#define SUB_PIXEL 4
diff --git a/dist/Mesa/src/mesa/swrast/s_aaline.h b/dist/Mesa/src/mesa/swrast/s_aaline.h
index 41e7e5fd4..f1d708ec8 100644
--- a/dist/Mesa/src/mesa/swrast/s_aaline.h
+++ b/dist/Mesa/src/mesa/swrast/s_aaline.h
@@ -28,7 +28,6 @@
#define S_AALINE_H
-#include "mtypes.h"
#include "swrast.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_aalinetemp.h b/dist/Mesa/src/mesa/swrast/s_aalinetemp.h
index ca08203d8..42ffe9f20 100644
--- a/dist/Mesa/src/mesa/swrast/s_aalinetemp.h
+++ b/dist/Mesa/src/mesa/swrast/s_aalinetemp.h
@@ -76,7 +76,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
ATTRIB_LOOP_BEGIN
GLfloat (*attribArray)[4] = line->span.array->attribs[attr];
if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0
- && !ctx->FragmentProgram._Active) {
+ && !ctx->FragmentProgram._Current) {
/* texcoord w/ divide by Q */
const GLuint unit = attr - FRAG_ATTRIB_TEX0;
const GLfloat invQ = solve_plane_recip(fx, fy, line->attrPlane[attr][3]);
diff --git a/dist/Mesa/src/mesa/swrast/s_aatriangle.c b/dist/Mesa/src/mesa/swrast/s_aatriangle.c
index 66891f9fe..078f16aea 100644
--- a/dist/Mesa/src/mesa/swrast/s_aatriangle.c
+++ b/dist/Mesa/src/mesa/swrast/s_aatriangle.c
@@ -28,12 +28,12 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "s_aatriangle.h"
#include "s_context.h"
#include "s_span.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_aatriangle.h b/dist/Mesa/src/mesa/swrast/s_aatriangle.h
index ebb828eb1..4b57fa73a 100644
--- a/dist/Mesa/src/mesa/swrast/s_aatriangle.h
+++ b/dist/Mesa/src/mesa/swrast/s_aatriangle.h
@@ -28,7 +28,6 @@
#define S_AATRIANGLE_H
-#include "mtypes.h"
#include "swrast.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_accum.c b/dist/Mesa/src/mesa/swrast/s_accum.c
index b74f794d0..ff741777e 100644
--- a/dist/Mesa/src/mesa/swrast/s_accum.c
+++ b/dist/Mesa/src/mesa/swrast/s_accum.c
@@ -23,11 +23,11 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "fbobject.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/fbobject.h"
#include "s_accum.h"
#include "s_context.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_accum.h b/dist/Mesa/src/mesa/swrast/s_accum.h
index 97d2bef4c..42e38cf02 100644
--- a/dist/Mesa/src/mesa/swrast/s_accum.h
+++ b/dist/Mesa/src/mesa/swrast/s_accum.h
@@ -27,7 +27,7 @@
#define S_ACCUM_H
-#include "mtypes.h"
+#include "main/mtypes.h"
extern void
diff --git a/dist/Mesa/src/mesa/swrast/s_alpha.c b/dist/Mesa/src/mesa/swrast/s_alpha.c
index 3c55d3e9e..5761bb00b 100644
--- a/dist/Mesa/src/mesa/swrast/s_alpha.c
+++ b/dist/Mesa/src/mesa/swrast/s_alpha.c
@@ -27,10 +27,10 @@
* \brief Functions to apply alpha test.
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/macros.h"
#include "s_alpha.h"
#include "s_context.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_alpha.h b/dist/Mesa/src/mesa/swrast/s_alpha.h
index add0f74c4..7a5b72e65 100644
--- a/dist/Mesa/src/mesa/swrast/s_alpha.h
+++ b/dist/Mesa/src/mesa/swrast/s_alpha.h
@@ -28,12 +28,11 @@
#define S_ALPHA_H
-#include "mtypes.h"
#include "s_context.h"
extern GLint
-_swrast_alpha_test( const GLcontext *ctx, struct sw_span *span );
+_swrast_alpha_test( const GLcontext *ctx, SWspan *span );
#endif
diff --git a/dist/Mesa/src/mesa/swrast/s_atifragshader.c b/dist/Mesa/src/mesa/swrast/s_atifragshader.c
index 55ec757ee..21cbd3cf3 100644
--- a/dist/Mesa/src/mesa/swrast/s_atifragshader.c
+++ b/dist/Mesa/src/mesa/swrast/s_atifragshader.c
@@ -1,5 +1,4 @@
/*
- *
* Copyright (C) 2004 David Airlie All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -20,10 +19,10 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
#include "shader/program.h"
#include "shader/atifragshader.h"
#include "swrast/s_atifragshader.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_bitmap.c b/dist/Mesa/src/mesa/swrast/s_bitmap.c
index f3dda12e2..35b34e654 100644
--- a/dist/Mesa/src/mesa/swrast/s_bitmap.c
+++ b/dist/Mesa/src/mesa/swrast/s_bitmap.c
@@ -28,11 +28,11 @@
* \author Brian Paul
*/
-#include "glheader.h"
-#include "bufferobj.h"
-#include "image.h"
-#include "macros.h"
-#include "pixel.h"
+#include "main/glheader.h"
+#include "main/bufferobj.h"
+#include "main/image.h"
+#include "main/macros.h"
+#include "main/pixel.h"
#include "s_context.h"
#include "s_span.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_blend.c b/dist/Mesa/src/mesa/swrast/s_blend.c
index 4531f0ae0..95c83432a 100644
--- a/dist/Mesa/src/mesa/swrast/s_blend.c
+++ b/dist/Mesa/src/mesa/swrast/s_blend.c
@@ -35,10 +35,10 @@
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/macros.h"
#include "s_blend.h"
#include "s_context.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_blend.h b/dist/Mesa/src/mesa/swrast/s_blend.h
index c95193215..8d5a81635 100644
--- a/dist/Mesa/src/mesa/swrast/s_blend.h
+++ b/dist/Mesa/src/mesa/swrast/s_blend.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5.2
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,17 +27,15 @@
#define S_BLEND_H
-#include "mtypes.h"
#include "s_context.h"
extern void
-_swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- const struct sw_span *span, GLchan rgba[][4]);
+_swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb, SWspan *span);
extern void
-_swrast_choose_blend_func(GLcontext *ctx);
+_swrast_choose_blend_func(GLcontext *ctx, GLenum chanType);
#endif
diff --git a/dist/Mesa/src/mesa/swrast/s_blit.c b/dist/Mesa/src/mesa/swrast/s_blit.c
index af4350990..bc4b2ac62 100644
--- a/dist/Mesa/src/mesa/swrast/s_blit.c
+++ b/dist/Mesa/src/mesa/swrast/s_blit.c
@@ -23,8 +23,8 @@
*/
-#include "glheader.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/macros.h"
#include "s_context.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_buffers.c b/dist/Mesa/src/mesa/swrast/s_buffers.c
index 0d1e9bac1..9e87d6d48 100644
--- a/dist/Mesa/src/mesa/swrast/s_buffers.c
+++ b/dist/Mesa/src/mesa/swrast/s_buffers.c
@@ -24,11 +24,11 @@
/** XXX This file should be named s_clear.c */
-#include "glheader.h"
-#include "colormac.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
#include "s_accum.h"
#include "s_context.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_context.c b/dist/Mesa/src/mesa/swrast/s_context.c
index b64156a82..62857ddeb 100644
--- a/dist/Mesa/src/mesa/swrast/s_context.c
+++ b/dist/Mesa/src/mesa/swrast/s_context.c
@@ -26,15 +26,15 @@
* Brian Paul
*/
-#include "imports.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "colormac.h"
-#include "mtypes.h"
-#include "teximage.h"
-#include "swrast.h"
+#include "main/imports.h"
+#include "main/bufferobj.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/mtypes.h"
+#include "main/teximage.h"
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
+#include "swrast.h"
#include "s_blend.h"
#include "s_context.h"
#include "s_lines.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_copypix.c b/dist/Mesa/src/mesa/swrast/s_copypix.c
index 3962721a6..fc5990b26 100644
--- a/dist/Mesa/src/mesa/swrast/s_copypix.c
+++ b/dist/Mesa/src/mesa/swrast/s_copypix.c
@@ -23,15 +23,15 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "convolve.h"
-#include "histogram.h"
-#include "image.h"
-#include "macros.h"
-#include "imports.h"
-#include "pixel.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/convolve.h"
+#include "main/histogram.h"
+#include "main/image.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/pixel.h"
#include "s_context.h"
#include "s_depth.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_depth.c b/dist/Mesa/src/mesa/swrast/s_depth.c
index 31b7bae58..26e23f02d 100644
--- a/dist/Mesa/src/mesa/swrast/s_depth.c
+++ b/dist/Mesa/src/mesa/swrast/s_depth.c
@@ -23,11 +23,11 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "fbobject.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/fbobject.h"
#include "s_depth.h"
#include "s_context.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_depth.h b/dist/Mesa/src/mesa/swrast/s_depth.h
index f93d95fa3..368862568 100644
--- a/dist/Mesa/src/mesa/swrast/s_depth.h
+++ b/dist/Mesa/src/mesa/swrast/s_depth.h
@@ -27,16 +27,15 @@
#define S_DEPTH_H
-#include "mtypes.h"
#include "s_context.h"
extern GLuint
-_swrast_depth_test_span( GLcontext *ctx, struct sw_span *span);
+_swrast_depth_test_span( GLcontext *ctx, SWspan *span);
extern GLboolean
-_swrast_depth_bounds_test( GLcontext *ctx, struct sw_span *span );
+_swrast_depth_bounds_test( GLcontext *ctx, SWspan *span );
extern void
diff --git a/dist/Mesa/src/mesa/swrast/s_drawpix.c b/dist/Mesa/src/mesa/swrast/s_drawpix.c
index 730798c90..7af3e3dad 100644
--- a/dist/Mesa/src/mesa/swrast/s_drawpix.c
+++ b/dist/Mesa/src/mesa/swrast/s_drawpix.c
@@ -23,18 +23,17 @@
*/
-#include "glheader.h"
-#include "bufferobj.h"
-#include "context.h"
-#include "convolve.h"
-#include "image.h"
-#include "macros.h"
-#include "imports.h"
-#include "pixel.h"
-#include "state.h"
+#include "main/glheader.h"
+#include "main/bufferobj.h"
+#include "main/context.h"
+#include "main/convolve.h"
+#include "main/image.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/pixel.h"
+#include "main/state.h"
#include "s_context.h"
-#include "s_drawpix.h"
#include "s_span.h"
#include "s_stencil.h"
#include "s_zoom.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_drawpix.h b/dist/Mesa/src/mesa/swrast/s_drawpix.h
deleted file mode 100644
index 66067115d..000000000
--- a/dist/Mesa/src/mesa/swrast/s_drawpix.h
+++ /dev/null
@@ -1,36 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef S_DRAWPIXELS_H
-#define S_DRAWPIXELS_H
-
-
-#include "mtypes.h"
-#include "swrast.h"
-
-/* XXX kill this header? */
-
-#endif
diff --git a/dist/Mesa/src/mesa/swrast/s_feedback.c b/dist/Mesa/src/mesa/swrast/s_feedback.c
index 07b7409ab..aa7953127 100644
--- a/dist/Mesa/src/mesa/swrast/s_feedback.c
+++ b/dist/Mesa/src/mesa/swrast/s_feedback.c
@@ -22,12 +22,12 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "feedback.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/enums.h"
+#include "main/feedback.h"
+#include "main/macros.h"
#include "s_context.h"
#include "s_feedback.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_feedback.h b/dist/Mesa/src/mesa/swrast/s_feedback.h
index 73f45c10b..9feab75db 100644
--- a/dist/Mesa/src/mesa/swrast/s_feedback.h
+++ b/dist/Mesa/src/mesa/swrast/s_feedback.h
@@ -28,7 +28,6 @@
#define S_FEEDBACK_H
-#include "mtypes.h"
#include "swrast.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_fog.c b/dist/Mesa/src/mesa/swrast/s_fog.c
index 7b143f6e5..b9ba265db 100644
--- a/dist/Mesa/src/mesa/swrast/s_fog.c
+++ b/dist/Mesa/src/mesa/swrast/s_fog.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
#include "s_context.h"
#include "s_fog.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_fog.h b/dist/Mesa/src/mesa/swrast/s_fog.h
index f5744b1d9..50760d88a 100644
--- a/dist/Mesa/src/mesa/swrast/s_fog.h
+++ b/dist/Mesa/src/mesa/swrast/s_fog.h
@@ -28,7 +28,6 @@
#define S_FOG_H
-#include "mtypes.h"
#include "swrast.h"
@@ -36,10 +35,10 @@ extern GLfloat
_swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z);
extern void
-_swrast_fog_rgba_span( const GLcontext *ctx, struct sw_span *span );
+_swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span );
extern void
-_swrast_fog_ci_span( const GLcontext *ctx, struct sw_span *span );
+_swrast_fog_ci_span( const GLcontext *ctx, SWspan *span );
#endif
diff --git a/dist/Mesa/src/mesa/swrast/s_fragprog.c b/dist/Mesa/src/mesa/swrast/s_fragprog.c
index 525cf9d72..c0bda32be 100644
--- a/dist/Mesa/src/mesa/swrast/s_fragprog.c
+++ b/dist/Mesa/src/mesa/swrast/s_fragprog.c
@@ -40,20 +40,27 @@ static void
fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
GLuint unit, GLfloat color[4] )
{
- GLchan rgba[4];
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
- if (texObj)
+ if (texObj) {
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ GLchan rgba[4];
+
lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
- /* XXX use a float-valued TextureSample routine here!!! */
- swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord,
- &lambda, &rgba);
- color[0] = CHAN_TO_FLOAT(rgba[0]);
- color[1] = CHAN_TO_FLOAT(rgba[1]);
- color[2] = CHAN_TO_FLOAT(rgba[2]);
- color[3] = CHAN_TO_FLOAT(rgba[3]);
+ /* XXX use a float-valued TextureSample routine here!!! */
+ swrast->TextureSample[unit](ctx, texObj, 1,
+ (const GLfloat (*)[4]) texcoord,
+ &lambda, &rgba);
+ color[0] = CHAN_TO_FLOAT(rgba[0]);
+ color[1] = CHAN_TO_FLOAT(rgba[1]);
+ color[2] = CHAN_TO_FLOAT(rgba[2]);
+ color[3] = CHAN_TO_FLOAT(rgba[3]);
+ }
+ else {
+ color[0] = color[1] = color[2] = 0.0F;
+ color[3] = 1.0F;
+ }
}
@@ -69,13 +76,14 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
- GLfloat lambda;
- GLchan rgba[4];
if (texObj) {
- const struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel];
+ const struct gl_texture_image *texImg =
+ texObj->Image[0][texObj->BaseLevel];
const GLfloat texW = (GLfloat) texImg->WidthScale;
const GLfloat texH = (GLfloat) texImg->HeightScale;
+ GLfloat lambda;
+ GLchan rgba[4];
lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */
texdx[1], texdy[1], /* dt/dx, dt/dy */
@@ -85,14 +93,20 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
1.0F / texcoord[3]) + lodBias;
lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
- }
- swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord,
- &lambda, &rgba);
- color[0] = CHAN_TO_FLOAT(rgba[0]);
- color[1] = CHAN_TO_FLOAT(rgba[1]);
- color[2] = CHAN_TO_FLOAT(rgba[2]);
- color[3] = CHAN_TO_FLOAT(rgba[3]);
+ /* XXX use a float-valued TextureSample routine here!!! */
+ swrast->TextureSample[unit](ctx, texObj, 1,
+ (const GLfloat (*)[4]) texcoord,
+ &lambda, &rgba);
+ color[0] = CHAN_TO_FLOAT(rgba[0]);
+ color[1] = CHAN_TO_FLOAT(rgba[1]);
+ color[2] = CHAN_TO_FLOAT(rgba[2]);
+ color[3] = CHAN_TO_FLOAT(rgba[3]);
+ }
+ else {
+ color[0] = color[1] = color[2] = 0.0F;
+ color[3] = 1.0F;
+ }
}
diff --git a/dist/Mesa/src/mesa/swrast/s_imaging.c b/dist/Mesa/src/mesa/swrast/s_imaging.c
index ac69d270b..591857c34 100644
--- a/dist/Mesa/src/mesa/swrast/s_imaging.c
+++ b/dist/Mesa/src/mesa/swrast/s_imaging.c
@@ -27,10 +27,11 @@
* extensions into either swrast or a sister module.
*/
+#include "main/glheader.h"
+#include "main/colortab.h"
+#include "main/convolve.h"
#include "s_context.h"
#include "s_span.h"
-#include "colortab.h"
-#include "convolve.h"
void
@@ -54,7 +55,7 @@ _swrast_CopyColorTable( GLcontext *ctx,
/* read the data from framebuffer */
_swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
- width, x, y, data );
+ width, x, y, CHAN_TYPE, data );
RENDER_FINISH(swrast,ctx);
@@ -89,7 +90,7 @@ _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start,
/* read the data from framebuffer */
_swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
- width, x, y, data );
+ width, x, y, CHAN_TYPE, data );
RENDER_FINISH(swrast,ctx);
@@ -122,7 +123,7 @@ _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
/* read the data from framebuffer */
_swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
- width, x, y, (GLchan (*)[4]) rgba );
+ width, x, y, CHAN_TYPE, rgba );
RENDER_FINISH( swrast, ctx );
@@ -160,7 +161,7 @@ _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
/* read pixels from framebuffer */
for (i = 0; i < height; i++) {
_swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
- width, x, y + i, (GLchan (*)[4]) rgba[i] );
+ width, x, y + i, CHAN_TYPE, rgba[i] );
}
RENDER_FINISH(swrast,ctx);
diff --git a/dist/Mesa/src/mesa/swrast/s_lines.c b/dist/Mesa/src/mesa/swrast/s_lines.c
index 3de438760..23cb9b57e 100644
--- a/dist/Mesa/src/mesa/swrast/s_lines.c
+++ b/dist/Mesa/src/mesa/swrast/s_lines.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/macros.h"
#include "s_aaline.h"
#include "s_context.h"
#include "s_depth.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_lines.h b/dist/Mesa/src/mesa/swrast/s_lines.h
index 5372b99b9..22979a02b 100644
--- a/dist/Mesa/src/mesa/swrast/s_lines.h
+++ b/dist/Mesa/src/mesa/swrast/s_lines.h
@@ -27,7 +27,7 @@
#ifndef S_LINES_H
#define S_LINES_H
-#include "mtypes.h"
+#include "swrast.h"
void
_swrast_choose_line( GLcontext *ctx );
diff --git a/dist/Mesa/src/mesa/swrast/s_logic.c b/dist/Mesa/src/mesa/swrast/s_logic.c
index 0af906396..f0274b4c0 100644
--- a/dist/Mesa/src/mesa/swrast/s_logic.c
+++ b/dist/Mesa/src/mesa/swrast/s_logic.c
@@ -23,10 +23,10 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "imports.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/imports.h"
+#include "main/macros.h"
#include "s_context.h"
#include "s_logic.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_logic.h b/dist/Mesa/src/mesa/swrast/s_logic.h
index ce5f183ff..ba20cd7b3 100644
--- a/dist/Mesa/src/mesa/swrast/s_logic.h
+++ b/dist/Mesa/src/mesa/swrast/s_logic.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5.2
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,18 +27,17 @@
#define S_LOGIC_H
-#include "mtypes.h"
#include "swrast.h"
extern void
_swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- const struct sw_span *span, GLuint index[]);
+ SWspan *span);
extern void
_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- const struct sw_span *span, GLchan rgba[][4]);
+ SWspan *span);
#endif
diff --git a/dist/Mesa/src/mesa/swrast/s_masking.c b/dist/Mesa/src/mesa/swrast/s_masking.c
index a69720e83..df779b073 100644
--- a/dist/Mesa/src/mesa/swrast/s_masking.c
+++ b/dist/Mesa/src/mesa/swrast/s_masking.c
@@ -28,8 +28,8 @@
*/
-#include "glheader.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/macros.h"
#include "s_context.h"
#include "s_masking.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_masking.h b/dist/Mesa/src/mesa/swrast/s_masking.h
index e2265448f..3260ca34e 100644
--- a/dist/Mesa/src/mesa/swrast/s_masking.h
+++ b/dist/Mesa/src/mesa/swrast/s_masking.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5.2
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,32 +27,16 @@
#define S_MASKING_H
-#include "mtypes.h"
#include "swrast.h"
-/*
- * Implement glColorMask for a span of RGBA pixels.
- */
extern void
_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- const struct sw_span *span, GLchan rgba[][4]);
+ SWspan *span);
extern void
-_swrast_mask_rgba_array(GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, GLchan rgba[][4]);
-
-
-/*
- * Implement glIndexMask for a span of CI pixels.
- */
-extern void
_swrast_mask_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- const struct sw_span *span, GLuint index[]);
-
-extern void
-_swrast_mask_ci_array(GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, GLuint index[]);
+ SWspan *span);
#endif
diff --git a/dist/Mesa/src/mesa/swrast/s_points.c b/dist/Mesa/src/mesa/swrast/s_points.c
index 1a8fd7d6d..0a3ad97a7 100644
--- a/dist/Mesa/src/mesa/swrast/s_points.c
+++ b/dist/Mesa/src/mesa/swrast/s_points.c
@@ -23,11 +23,11 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "texstate.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/texstate.h"
#include "s_context.h"
#include "s_feedback.h"
#include "s_points.h"
@@ -129,13 +129,13 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
s = 0.0;
dsdx = 1.0 / size;
if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) {
- t0 = 0.0;
dtdy = 1.0 / size;
+ t0 = 0.5 * dtdy;
}
else {
/* GL_UPPER_LEFT */
- t0 = 1.0;
dtdy = -1.0 / size;
+ t0 = 1.0 + 0.5 * dtdy;
}
ATTRIB_LOOP_BEGIN
@@ -570,6 +570,9 @@ void
_swrast_choose_point(GLcontext *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ const GLfloat size = CLAMP(ctx->Point.Size,
+ ctx->Point.MinSize,
+ ctx->Point.MaxSize);
if (ctx->RenderMode == GL_RENDER) {
if (ctx->Point.PointSprite) {
@@ -578,7 +581,7 @@ _swrast_choose_point(GLcontext *ctx)
else if (ctx->Point.SmoothFlag) {
swrast->Point = smooth_point;
}
- else if (ctx->Point.Size > 1.0 ||
+ else if (size > 1.0 ||
ctx->Point._Attenuated ||
ctx->VertexProgram.PointSizeEnabled) {
swrast->Point = large_point;
diff --git a/dist/Mesa/src/mesa/swrast/s_points.h b/dist/Mesa/src/mesa/swrast/s_points.h
index 40b442e95..9e39c601e 100644
--- a/dist/Mesa/src/mesa/swrast/s_points.h
+++ b/dist/Mesa/src/mesa/swrast/s_points.h
@@ -27,7 +27,7 @@
#ifndef S_POINTS_H
#define S_POINTS_H
-#include "mtypes.h"
+#include "swrast.h"
extern void
_swrast_choose_point( GLcontext *ctx );
diff --git a/dist/Mesa/src/mesa/swrast/s_readpix.c b/dist/Mesa/src/mesa/swrast/s_readpix.c
index 9140d12ea..f26304517 100644
--- a/dist/Mesa/src/mesa/swrast/s_readpix.c
+++ b/dist/Mesa/src/mesa/swrast/s_readpix.c
@@ -23,17 +23,17 @@
*/
-#include "glheader.h"
-#include "bufferobj.h"
-#include "colormac.h"
-#include "convolve.h"
-#include "context.h"
-#include "feedback.h"
-#include "image.h"
-#include "macros.h"
-#include "imports.h"
-#include "pixel.h"
-#include "state.h"
+#include "main/glheader.h"
+#include "main/bufferobj.h"
+#include "main/colormac.h"
+#include "main/convolve.h"
+#include "main/context.h"
+#include "main/feedback.h"
+#include "main/image.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/pixel.h"
+#include "main/state.h"
#include "s_context.h"
#include "s_depth.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_span.c b/dist/Mesa/src/mesa/swrast/s_span.c
index 4c58f8de8..f07014fab 100644
--- a/dist/Mesa/src/mesa/swrast/s_span.c
+++ b/dist/Mesa/src/mesa/swrast/s_span.c
@@ -30,12 +30,12 @@
* \author Brian Paul
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "image.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/image.h"
#include "s_atifragshader.h"
#include "s_alpha.h"
@@ -442,11 +442,10 @@ _swrast_span_interpolate_z( const GLcontext *ctx, SWspan *span )
* Compute mipmap LOD from partial derivatives.
* This the ideal solution, as given in the OpenGL spec.
*/
-#if 0
-static GLfloat
-compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
- GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
- GLfloat s, GLfloat t, GLfloat q, GLfloat invQ)
+GLfloat
+_swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
+ GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
+ GLfloat s, GLfloat t, GLfloat q, GLfloat invQ)
{
GLfloat dudx = texW * ((s + dsdx) / (q + dqdx) - s * invQ);
GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ);
@@ -458,13 +457,13 @@ compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
GLfloat lambda = LOG2(rho);
return lambda;
}
-#endif
/**
* Compute mipmap LOD from partial derivatives.
* This is a faster approximation than above function.
*/
+#if 0
GLfloat
_swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
@@ -485,6 +484,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
lambda = LOG2(rho);
return lambda;
}
+#endif
/**
@@ -1032,6 +1032,7 @@ add_specular(GLcontext *ctx, SWspan *span)
ASSERT(!ctx->FragmentProgram._Current);
ASSERT(span->arrayMask & SPAN_RGBA);
ASSERT(swrast->_ActiveAttribMask & FRAG_BIT_COL1);
+ (void) swrast; /* silence warning */
if (span->array->ChanType == GL_FLOAT) {
if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
@@ -1398,11 +1399,17 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
}
/*
- * Write to renderbuffers
+ * Write to renderbuffers.
+ * Depending on glDrawBuffer() state and the which color outputs are
+ * written by the fragment shader, we may either replicate one color to
+ * all renderbuffers or write a different color to each renderbuffer.
+ * multiFragOutputs=TRUE for the later case.
*/
{
const GLuint numBuffers = fb->_NumColorDrawBuffers;
- const GLboolean multiFragOutputs = numBuffers > 1;
+ const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+ const GLboolean multiFragOutputs =
+ (fp && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0));
GLuint buf;
for (buf = 0; buf < numBuffers; buf++) {
diff --git a/dist/Mesa/src/mesa/swrast/s_span.h b/dist/Mesa/src/mesa/swrast/s_span.h
index 512134db0..c4b47df58 100644
--- a/dist/Mesa/src/mesa/swrast/s_span.h
+++ b/dist/Mesa/src/mesa/swrast/s_span.h
@@ -27,7 +27,6 @@
#define S_SPAN_H
-#include "mtypes.h"
#include "swrast.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_spantemp.h b/dist/Mesa/src/mesa/swrast/s_spantemp.h
index 1eef81eb9..bab2ca737 100644
--- a/dist/Mesa/src/mesa/swrast/s_spantemp.h
+++ b/dist/Mesa/src/mesa/swrast/s_spantemp.h
@@ -43,7 +43,7 @@
* ignored otherwise.
*/
-#include "macros.h"
+#include "main/macros.h"
#ifdef CI_MODE
diff --git a/dist/Mesa/src/mesa/swrast/s_stencil.c b/dist/Mesa/src/mesa/swrast/s_stencil.c
index cae1e0992..2e84ddec7 100644
--- a/dist/Mesa/src/mesa/swrast/s_stencil.c
+++ b/dist/Mesa/src/mesa/swrast/s_stencil.c
@@ -23,9 +23,9 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/imports.h"
#include "s_context.h"
#include "s_depth.h"
@@ -997,10 +997,12 @@ stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face )
GLboolean
_swrast_stencil_and_ztest_span(GLcontext *ctx, SWspan *span)
{
+ const GLuint face = (span->facing == 0) ? 0 : ctx->Stencil._BackFace;
+
if (span->arrayMask & SPAN_XY)
- return stencil_and_ztest_pixels(ctx, span, span->facing);
+ return stencil_and_ztest_pixels(ctx, span, face);
else
- return stencil_and_ztest_span(ctx, span, span->facing);
+ return stencil_and_ztest_span(ctx, span, face);
}
diff --git a/dist/Mesa/src/mesa/swrast/s_stencil.h b/dist/Mesa/src/mesa/swrast/s_stencil.h
index fabc25250..cd6cbc57b 100644
--- a/dist/Mesa/src/mesa/swrast/s_stencil.h
+++ b/dist/Mesa/src/mesa/swrast/s_stencil.h
@@ -27,13 +27,12 @@
#define S_STENCIL_H
-#include "mtypes.h"
#include "swrast.h"
extern GLboolean
-_swrast_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span);
+_swrast_stencil_and_ztest_span(GLcontext *ctx, SWspan *span);
extern void
diff --git a/dist/Mesa/src/mesa/swrast/s_texcombine.c b/dist/Mesa/src/mesa/swrast/s_texcombine.c
index 4ac7222da..632d65000 100644
--- a/dist/Mesa/src/mesa/swrast/s_texcombine.c
+++ b/dist/Mesa/src/mesa/swrast/s_texcombine.c
@@ -23,12 +23,13 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "imports.h"
-#include "macros.h"
-#include "pixel.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/image.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/pixel.h"
#include "s_context.h"
#include "s_texcombine.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_texcombine.h b/dist/Mesa/src/mesa/swrast/s_texcombine.h
index eca967c54..9ed96efb8 100644
--- a/dist/Mesa/src/mesa/swrast/s_texcombine.h
+++ b/dist/Mesa/src/mesa/swrast/s_texcombine.h
@@ -27,10 +27,9 @@
#define S_TEXCOMBINE_H
-#include "mtypes.h"
#include "swrast.h"
extern void
-_swrast_texture_span( GLcontext *ctx, struct sw_span *span );
+_swrast_texture_span( GLcontext *ctx, SWspan *span );
#endif
diff --git a/dist/Mesa/src/mesa/swrast/s_texfilter.c b/dist/Mesa/src/mesa/swrast/s_texfilter.c
index ee6131649..fce0bcf0c 100644
--- a/dist/Mesa/src/mesa/swrast/s_texfilter.c
+++ b/dist/Mesa/src/mesa/swrast/s_texfilter.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 7.0.3
+ * Version: 7.3
*
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -23,16 +23,26 @@
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "imports.h"
-#include "texformat.h"
+#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"
+/*
+ * Note, the FRAC macro has to work perfectly. Otherwise you'll sometimes
+ * see 1-pixel bands of improperly weighted linear-filtered textures.
+ * The tests/texwrap.c demo is a good test.
+ * Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0.
+ * Instead, if x < 0 then FRAC(x) = 1 - true_frac(x).
+ */
+#define FRAC(f) ((f) - IFLOOR(f))
+
+
/**
* Constants for integer linear interpolation.
*/
@@ -223,257 +233,271 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c,
* 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
+ * s = texcoord in [0,1]
+ * size = width (or height or depth) of texture
* Output:
- * U = texcoord in [0, width]
- * I0, I1 = two nearest texel indexes
+ * i0, i1 = returns two nearest texel indexes
+ * weight = returns blend factor between texels
*/
-#define COMPUTE_LINEAR_TEXEL_LOCATIONS(wrapMode, S, U, SIZE, I0, I1) \
-{ \
- switch (wrapMode) { \
- case GL_REPEAT: \
- U = S * SIZE - 0.5F; \
- if (img->_IsPowerOfTwo) { \
- I0 = IFLOOR(U) & (SIZE - 1); \
- I1 = (I0 + 1) & (SIZE - 1); \
- } \
- else { \
- I0 = REMAINDER(IFLOOR(U), SIZE); \
- I1 = REMAINDER(I0 + 1, SIZE); \
- } \
- break; \
- case GL_CLAMP_TO_EDGE: \
- if (S <= 0.0F) \
- U = 0.0F; \
- else if (S >= 1.0F) \
- U = (GLfloat) SIZE; \
- else \
- U = S * SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- if (I0 < 0) \
- I0 = 0; \
- if (I1 >= (GLint) SIZE) \
- I1 = SIZE - 1; \
- break; \
- case GL_CLAMP_TO_BORDER: \
- { \
- const GLfloat min = -1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- if (S <= min) \
- U = min * SIZE; \
- else if (S >= max) \
- U = max * SIZE; \
- else \
- U = S * SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- } \
- break; \
- case GL_MIRRORED_REPEAT: \
- { \
- const GLint flr = IFLOOR(S); \
- if (flr & 1) \
- U = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \
- else \
- U = S - (GLfloat) flr; /* flr is even */ \
- U = (U * SIZE) - 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- if (I0 < 0) \
- I0 = 0; \
- if (I1 >= (GLint) SIZE) \
- I1 = SIZE - 1; \
- } \
- break; \
- case GL_MIRROR_CLAMP_EXT: \
- U = FABSF(S); \
- if (U >= 1.0F) \
- U = (GLfloat) SIZE; \
- else \
- U *= SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- break; \
- case GL_MIRROR_CLAMP_TO_EDGE_EXT: \
- U = FABSF(S); \
- if (U >= 1.0F) \
- U = (GLfloat) SIZE; \
- else \
- U *= SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- if (I0 < 0) \
- I0 = 0; \
- if (I1 >= (GLint) SIZE) \
- I1 = SIZE - 1; \
- break; \
- case GL_MIRROR_CLAMP_TO_BORDER_EXT: \
- { \
- const GLfloat min = -1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- U = FABSF(S); \
- if (U <= min) \
- U = min * SIZE; \
- else if (U >= max) \
- U = max * SIZE; \
- else \
- U *= SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- } \
- break; \
- case GL_CLAMP: \
- if (S <= 0.0F) \
- U = 0.0F; \
- else if (S >= 1.0F) \
- U = (GLfloat) SIZE; \
- else \
- U = S * SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- break; \
- default: \
- _mesa_problem(ctx, "Bad wrap mode"); \
- return; \
- } \
+static INLINE void
+linear_texel_locations(GLenum wrapMode,
+ const struct gl_texture_image *img,
+ GLint size, GLfloat s,
+ GLint *i0, GLint *i1, GLfloat *weight)
+{
+ GLfloat u;
+ switch (wrapMode) {
+ case GL_REPEAT:
+ u = s * size - 0.5F;
+ if (img->_IsPowerOfTwo) {
+ *i0 = IFLOOR(u) & (size - 1);
+ *i1 = (*i0 + 1) & (size - 1);
+ }
+ else {
+ *i0 = REMAINDER(IFLOOR(u), size);
+ *i1 = REMAINDER(*i0 + 1, size);
+ }
+ break;
+ case GL_CLAMP_TO_EDGE:
+ if (s <= 0.0F)
+ u = 0.0F;
+ else if (s >= 1.0F)
+ u = (GLfloat) size;
+ else
+ u = s * size;
+ u -= 0.5F;
+ *i0 = IFLOOR(u);
+ *i1 = *i0 + 1;
+ if (*i0 < 0)
+ *i0 = 0;
+ if (*i1 >= (GLint) size)
+ *i1 = size - 1;
+ break;
+ case GL_CLAMP_TO_BORDER:
+ {
+ const GLfloat min = -1.0F / (2.0F * size);
+ const GLfloat max = 1.0F - min;
+ if (s <= min)
+ u = min * size;
+ else if (s >= max)
+ u = max * size;
+ else
+ u = s * size;
+ u -= 0.5F;
+ *i0 = IFLOOR(u);
+ *i1 = *i0 + 1;
+ }
+ break;
+ case GL_MIRRORED_REPEAT:
+ {
+ const GLint flr = IFLOOR(s);
+ if (flr & 1)
+ u = 1.0F - (s - (GLfloat) flr);
+ else
+ u = s - (GLfloat) flr;
+ u = (u * size) - 0.5F;
+ *i0 = IFLOOR(u);
+ *i1 = *i0 + 1;
+ if (*i0 < 0)
+ *i0 = 0;
+ if (*i1 >= (GLint) size)
+ *i1 = size - 1;
+ }
+ break;
+ case GL_MIRROR_CLAMP_EXT:
+ u = FABSF(s);
+ if (u >= 1.0F)
+ u = (GLfloat) size;
+ else
+ u *= size;
+ u -= 0.5F;
+ *i0 = IFLOOR(u);
+ *i1 = *i0 + 1;
+ break;
+ case GL_MIRROR_CLAMP_TO_EDGE_EXT:
+ u = FABSF(s);
+ if (u >= 1.0F)
+ u = (GLfloat) size;
+ else
+ u *= size;
+ u -= 0.5F;
+ *i0 = IFLOOR(u);
+ *i1 = *i0 + 1;
+ if (*i0 < 0)
+ *i0 = 0;
+ if (*i1 >= (GLint) size)
+ *i1 = size - 1;
+ break;
+ case GL_MIRROR_CLAMP_TO_BORDER_EXT:
+ {
+ const GLfloat min = -1.0F / (2.0F * size);
+ const GLfloat max = 1.0F - min;
+ u = FABSF(s);
+ if (u <= min)
+ u = min * size;
+ else if (u >= max)
+ u = max * size;
+ else
+ u *= size;
+ u -= 0.5F;
+ *i0 = IFLOOR(u);
+ *i1 = *i0 + 1;
+ }
+ break;
+ case GL_CLAMP:
+ if (s <= 0.0F)
+ u = 0.0F;
+ else if (s >= 1.0F)
+ u = (GLfloat) size;
+ else
+ u = s * size;
+ u -= 0.5F;
+ *i0 = IFLOOR(u);
+ *i1 = *i0 + 1;
+ break;
+ default:
+ _mesa_problem(NULL, "Bad wrap mode");
+ u = 0.0F;
+ }
+ *weight = FRAC(u);
}
/**
* Used to compute texel location for nearest sampling.
*/
-#define COMPUTE_NEAREST_TEXEL_LOCATION(wrapMode, S, SIZE, I) \
-{ \
- switch (wrapMode) { \
- case GL_REPEAT: \
- /* s limited to [0,1) */ \
- /* i limited to [0,size-1] */ \
- I = IFLOOR(S * SIZE); \
- if (img->_IsPowerOfTwo) \
- I &= (SIZE - 1); \
- else \
- I = REMAINDER(I, SIZE); \
- break; \
- case GL_CLAMP_TO_EDGE: \
- { \
- /* s limited to [min,max] */ \
- /* i limited to [0, size-1] */ \
- const GLfloat min = 1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- if (S < min) \
- I = 0; \
- else if (S > max) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(S * SIZE); \
- } \
- break; \
- case GL_CLAMP_TO_BORDER: \
- { \
- /* s limited to [min,max] */ \
- /* i limited to [-1, size] */ \
- const GLfloat min = -1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- if (S <= min) \
- I = -1; \
- else if (S >= max) \
- I = SIZE; \
- else \
- I = IFLOOR(S * SIZE); \
- } \
- break; \
- case GL_MIRRORED_REPEAT: \
- { \
- const GLfloat min = 1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- const GLint flr = IFLOOR(S); \
- GLfloat u; \
- if (flr & 1) \
- u = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \
- else \
- u = S - (GLfloat) flr; /* flr is even */ \
- if (u < min) \
- I = 0; \
- else if (u > max) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(u * SIZE); \
- } \
- break; \
- case GL_MIRROR_CLAMP_EXT: \
- { \
- /* s limited to [0,1] */ \
- /* i limited to [0,size-1] */ \
- const GLfloat u = FABSF(S); \
- if (u <= 0.0F) \
- I = 0; \
- else if (u >= 1.0F) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(u * SIZE); \
- } \
- break; \
- case GL_MIRROR_CLAMP_TO_EDGE_EXT: \
- { \
- /* s limited to [min,max] */ \
- /* i limited to [0, size-1] */ \
- const GLfloat min = 1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- const GLfloat u = FABSF(S); \
- if (u < min) \
- I = 0; \
- else if (u > max) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(u * SIZE); \
- } \
- break; \
- case GL_MIRROR_CLAMP_TO_BORDER_EXT: \
- { \
- /* s limited to [min,max] */ \
- /* i limited to [0, size-1] */ \
- const GLfloat min = -1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- const GLfloat u = FABSF(S); \
- if (u < min) \
- I = -1; \
- else if (u > max) \
- I = SIZE; \
- else \
- I = IFLOOR(u * SIZE); \
- } \
- break; \
- case GL_CLAMP: \
- /* s limited to [0,1] */ \
- /* i limited to [0,size-1] */ \
- if (S <= 0.0F) \
- I = 0; \
- else if (S >= 1.0F) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(S * SIZE); \
- break; \
- default: \
- _mesa_problem(ctx, "Bad wrap mode"); \
- return; \
- } \
+static INLINE GLint
+nearest_texel_location(GLenum wrapMode,
+ const struct gl_texture_image *img,
+ GLint size, GLfloat s)
+{
+ GLint i;
+
+ switch (wrapMode) {
+ case GL_REPEAT:
+ /* s limited to [0,1) */
+ /* i limited to [0,size-1] */
+ i = IFLOOR(s * size);
+ if (img->_IsPowerOfTwo)
+ i &= (size - 1);
+ else
+ i = REMAINDER(i, size);
+ return i;
+ case GL_CLAMP_TO_EDGE:
+ {
+ /* s limited to [min,max] */
+ /* i limited to [0, size-1] */
+ const GLfloat min = 1.0F / (2.0F * size);
+ const GLfloat max = 1.0F - min;
+ if (s < min)
+ i = 0;
+ else if (s > max)
+ i = size - 1;
+ else
+ i = IFLOOR(s * size);
+ }
+ return i;
+ case GL_CLAMP_TO_BORDER:
+ {
+ /* s limited to [min,max] */
+ /* i limited to [-1, size] */
+ const GLfloat min = -1.0F / (2.0F * size);
+ const GLfloat max = 1.0F - min;
+ if (s <= min)
+ i = -1;
+ else if (s >= max)
+ i = size;
+ else
+ i = IFLOOR(s * size);
+ }
+ return i;
+ case GL_MIRRORED_REPEAT:
+ {
+ const GLfloat min = 1.0F / (2.0F * size);
+ const GLfloat max = 1.0F - min;
+ const GLint flr = IFLOOR(s);
+ GLfloat u;
+ if (flr & 1)
+ u = 1.0F - (s - (GLfloat) flr);
+ else
+ u = s - (GLfloat) flr;
+ if (u < min)
+ i = 0;
+ else if (u > max)
+ i = size - 1;
+ else
+ i = IFLOOR(u * size);
+ }
+ return i;
+ case GL_MIRROR_CLAMP_EXT:
+ {
+ /* s limited to [0,1] */
+ /* i limited to [0,size-1] */
+ const GLfloat u = FABSF(s);
+ if (u <= 0.0F)
+ i = 0;
+ else if (u >= 1.0F)
+ i = size - 1;
+ else
+ i = IFLOOR(u * size);
+ }
+ return i;
+ case GL_MIRROR_CLAMP_TO_EDGE_EXT:
+ {
+ /* s limited to [min,max] */
+ /* i limited to [0, size-1] */
+ const GLfloat min = 1.0F / (2.0F * size);
+ const GLfloat max = 1.0F - min;
+ const GLfloat u = FABSF(s);
+ if (u < min)
+ i = 0;
+ else if (u > max)
+ i = size - 1;
+ else
+ i = IFLOOR(u * size);
+ }
+ return i;
+ case GL_MIRROR_CLAMP_TO_BORDER_EXT:
+ {
+ /* s limited to [min,max] */
+ /* i limited to [0, size-1] */
+ const GLfloat min = -1.0F / (2.0F * size);
+ const GLfloat max = 1.0F - min;
+ const GLfloat u = FABSF(s);
+ if (u < min)
+ i = -1;
+ else if (u > max)
+ i = size;
+ else
+ i = IFLOOR(u * size);
+ }
+ return i;
+ case GL_CLAMP:
+ /* s limited to [0,1] */
+ /* i limited to [0,size-1] */
+ if (s <= 0.0F)
+ i = 0;
+ else if (s >= 1.0F)
+ i = size - 1;
+ else
+ i = IFLOOR(s * size);
+ return i;
+ default:
+ _mesa_problem(NULL, "Bad wrap mode");
+ return 0;
+ }
}
/* Power of two image sizes only */
-#define COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(S, U, SIZE, I0, I1) \
-{ \
- U = S * SIZE - 0.5F; \
- I0 = IFLOOR(U) & (SIZE - 1); \
- I1 = (I0 + 1) & (SIZE - 1); \
+static INLINE void
+linear_repeat_texel_location(GLuint size, GLfloat s,
+ GLint *i0, GLint *i1, GLfloat *weight)
+{
+ GLfloat u = s * size - 0.5F;
+ *i0 = IFLOOR(u) & (size - 1);
+ *i1 = (*i0 + 1) & (size - 1);
+ *weight = FRAC(u);
}
@@ -516,17 +540,6 @@ nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda)
/*
- * Note, the FRAC macro has to work perfectly. Otherwise you'll sometimes
- * see 1-pixel bands of improperly weighted linear-filtered textures.
- * The tests/texwrap.c demo is a good test.
- * Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0.
- * Instead, if x < 0 then FRAC(x) = 1 - true_frac(x).
- */
-#define FRAC(f) ((f) - IFLOOR(f))
-
-
-
-/*
* Bitflags for texture border color sampling.
*/
#define I0BIT 1
@@ -538,7 +551,7 @@ nearest_mipmap_level(const struct gl_texture_object *tObj, GLfloat lambda)
-/*
+/**
* 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.
@@ -651,10 +664,10 @@ compute_min_mag_ranges(const struct gl_texture_object *tObj,
/* 1-D Texture Sampling Functions */
/**********************************************************************/
-/*
+/**
* Return the texture sample for coordinate (s) using GL_NEAREST filter.
*/
-static void
+static INLINE void
sample_1d_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
@@ -662,7 +675,7 @@ sample_1d_nearest(GLcontext *ctx,
{
const GLint width = img->Width2; /* without border, power of two */
GLint i;
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i);
+ i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]);
/* skip over the border, if any */
i += img->Border;
if (i < 0 || i >= (GLint) img->Width) {
@@ -675,10 +688,10 @@ sample_1d_nearest(GLcontext *ctx,
}
-/*
+/**
* Return the texture sample for coordinate (s) using GL_LINEAR filter.
*/
-static void
+static INLINE void
sample_1d_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
@@ -686,12 +699,11 @@ sample_1d_linear(GLcontext *ctx,
{
const GLint width = img->Width2;
GLint i0, i1;
- GLfloat u;
GLbitfield useBorderColor = 0x0;
GLfloat a;
GLchan t0[4], t1[4]; /* texels */
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
+ linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a);
if (img->Border) {
i0 += img->Border;
@@ -716,7 +728,6 @@ sample_1d_linear(GLcontext *ctx,
img->FetchTexelc(img, i1, 0, 0, t1);
}
- a = FRAC(u);
lerp_rgba(rgba, a, t0, t1);
}
@@ -776,7 +787,6 @@ sample_1d_nearest_mipmap_linear(GLcontext *ctx,
}
-
static void
sample_1d_linear_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
@@ -802,7 +812,7 @@ sample_1d_linear_mipmap_linear(GLcontext *ctx,
}
-
+/** Sample 1D texture, nearest filtering for both min/magnification */
static void
sample_nearest_1d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
@@ -812,13 +822,13 @@ sample_nearest_1d( GLcontext *ctx,
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_1d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
-
+/** Sample 1D texture, linear filtering for both min/magnification */
static void
sample_linear_1d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
@@ -828,17 +838,13 @@ sample_linear_1d( GLcontext *ctx,
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_1d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
-/*
- * Given an (s) texture coordinate and lambda (level of detail) value,
- * return a texture sample.
- *
- */
+/** Sample 1D texture, using lambda to choose between min/magnification */
static void
sample_lambda_1d( GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
@@ -915,7 +921,7 @@ sample_lambda_1d( GLcontext *ctx,
/**********************************************************************/
-/*
+/**
* Return the texture sample for coordinate (s,t) using GL_NEAREST filter.
*/
static INLINE void
@@ -930,8 +936,8 @@ sample_2d_nearest(GLcontext *ctx,
GLint i, j;
(void) ctx;
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i);
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j);
+ i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]);
+ j = nearest_texel_location(tObj->WrapT, img, height, texcoord[1]);
/* skip over the border, if any */
i += img->Border;
@@ -947,7 +953,6 @@ sample_2d_nearest(GLcontext *ctx,
}
-
/**
* Return the texture sample for coordinate (s,t) using GL_LINEAR filter.
* New sampling code contributed by Lynn Quam <quam@ai.sri.com>.
@@ -963,12 +968,11 @@ sample_2d_linear(GLcontext *ctx,
const GLint height = img->Height2;
GLint i0, j0, i1, j1;
GLbitfield useBorderColor = 0x0;
- GLfloat u, v;
GLfloat a, b;
GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1);
+ linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a);
+ linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b);
if (img->Border) {
i0 += img->Border;
@@ -1009,13 +1013,11 @@ sample_2d_linear(GLcontext *ctx,
img->FetchTexelc(img, i1, j1, 0, t11);
}
- a = FRAC(u);
- b = FRAC(v);
lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11);
}
-/*
+/**
* As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT.
* We don't have to worry about the texture border.
*/
@@ -1029,8 +1031,7 @@ sample_2d_linear_repeat(GLcontext *ctx,
const GLint width = img->Width2;
const GLint height = img->Height2;
GLint i0, j0, i1, j1;
- GLfloat u, v;
- GLfloat a, b;
+ GLfloat wi, wj;
GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */
(void) ctx;
@@ -1041,21 +1042,18 @@ sample_2d_linear_repeat(GLcontext *ctx,
ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX);
ASSERT(img->_IsPowerOfTwo);
- COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[0], u, width, i0, i1);
- COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[1], v, height, j0, j1);
+ linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi);
+ linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj);
img->FetchTexelc(img, i0, j0, 0, t00);
img->FetchTexelc(img, i1, j0, 0, t10);
img->FetchTexelc(img, i0, j1, 0, t01);
img->FetchTexelc(img, i1, j1, 0, t11);
- a = FRAC(u);
- b = FRAC(v);
- lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11);
+ lerp_rgba_2d(rgba, wi, wj, t00, t10, t01, t11);
}
-
static void
sample_2d_nearest_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
@@ -1070,7 +1068,6 @@ sample_2d_nearest_mipmap_nearest(GLcontext *ctx,
}
-
static void
sample_2d_linear_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
@@ -1086,7 +1083,6 @@ sample_2d_linear_mipmap_nearest(GLcontext *ctx,
}
-
static void
sample_2d_nearest_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
@@ -1112,8 +1108,6 @@ sample_2d_nearest_mipmap_linear(GLcontext *ctx,
}
-
-/* Trilinear filtering */
static void
sample_2d_linear_mipmap_linear( GLcontext *ctx,
const struct gl_texture_object *tObj,
@@ -1140,10 +1134,10 @@ sample_2d_linear_mipmap_linear( GLcontext *ctx,
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[], GLchan rgba[][4] )
+sample_2d_linear_mipmap_linear_repeat(GLcontext *ctx,
+ const struct gl_texture_object *tObj,
+ GLuint n, const GLfloat texcoord[][4],
+ const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
ASSERT(lambda != NULL);
@@ -1158,35 +1152,38 @@ sample_2d_linear_mipmap_linear_repeat( GLcontext *ctx,
else {
GLchan t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda[i]);
- sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0);
- sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
+ sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level ],
+ texcoord[i], t0);
+ sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level+1],
+ texcoord[i], t1);
lerp_rgba(rgba[i], f, t0, t1);
}
}
}
+/** Sample 2D 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[], GLchan rgba[][4] )
+sample_nearest_2d(GLcontext *ctx,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat texcoords[][4],
+ const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_2d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
-
+/** Sample 2D 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[], GLchan rgba[][4] )
+sample_linear_2d(GLcontext *ctx,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat texcoords[][4],
+ const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -1195,19 +1192,19 @@ sample_linear_2d( GLcontext *ctx,
tObj->WrapT == GL_REPEAT &&
image->_IsPowerOfTwo &&
image->Border == 0) {
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_2d_linear_repeat(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
else {
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_2d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
}
-/*
+/**
* Optimized 2-D texture sampling:
* S and T wrap mode == GL_REPEAT
* GL_NEAREST min/mag filter
@@ -1216,10 +1213,10 @@ sample_linear_2d( GLcontext *ctx,
* Format = GL_RGB
*/
static void
-opt_sample_rgb_2d( GLcontext *ctx,
- const struct gl_texture_object *tObj,
- GLuint n, const GLfloat texcoords[][4],
- const GLfloat lambda[], GLchan rgba[][4] )
+opt_sample_rgb_2d(GLcontext *ctx,
+ const struct gl_texture_object *tObj,
+ GLuint n, const GLfloat texcoords[][4],
+ const GLfloat lambda[], GLchan rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel];
const GLfloat width = (GLfloat) img->Width;
@@ -1248,7 +1245,7 @@ opt_sample_rgb_2d( GLcontext *ctx,
}
-/*
+/**
* Optimized 2-D texture sampling:
* S and T wrap mode == GL_REPEAT
* GL_NEAREST min/mag filter
@@ -1257,10 +1254,10 @@ opt_sample_rgb_2d( GLcontext *ctx,
* Format = GL_RGBA
*/
static void
-opt_sample_rgba_2d( GLcontext *ctx,
- const struct gl_texture_object *tObj,
- GLuint n, const GLfloat texcoords[][4],
- const GLfloat lambda[], GLchan rgba[][4] )
+opt_sample_rgba_2d(GLcontext *ctx,
+ const struct gl_texture_object *tObj,
+ GLuint n, const GLfloat texcoords[][4],
+ const GLfloat lambda[], GLchan rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel];
const GLfloat width = (GLfloat) img->Width;
@@ -1287,15 +1284,12 @@ opt_sample_rgba_2d( GLcontext *ctx,
}
-/*
- * Given an array of texture coordinate and lambda (level of detail)
- * values, return an array of texture sample.
- */
+/** Sample 2D 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[], GLchan rgba[][4] )
+sample_lambda_2d(GLcontext *ctx,
+ const struct gl_texture_object *tObj,
+ GLuint n, const GLfloat texcoords[][4],
+ const GLfloat lambda[], GLchan rgba[][4])
{
const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel];
GLuint minStart, minEnd; /* texels with minification */
@@ -1409,10 +1403,10 @@ sample_lambda_2d( GLcontext *ctx,
/* 3-D Texture Sampling Functions */
/**********************************************************************/
-/*
+/**
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
*/
-static void
+static INLINE void
sample_3d_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
@@ -1425,9 +1419,9 @@ sample_3d_nearest(GLcontext *ctx,
GLint i, j, k;
(void) ctx;
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i);
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j);
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, texcoord[2], depth, k);
+ i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]);
+ j = nearest_texel_location(tObj->WrapT, img, height, texcoord[1]);
+ k = nearest_texel_location(tObj->WrapR, img, depth, texcoord[2]);
if (i < 0 || i >= (GLint) img->Width ||
j < 0 || j >= (GLint) img->Height ||
@@ -1441,8 +1435,7 @@ sample_3d_nearest(GLcontext *ctx,
}
-
-/*
+/**
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
*/
static void
@@ -1457,14 +1450,13 @@ sample_3d_linear(GLcontext *ctx,
const GLint depth = img->Depth2;
GLint i0, j0, k0, i1, j1, k1;
GLbitfield useBorderColor = 0x0;
- GLfloat u, v, w;
GLfloat a, b, c;
GLchan t000[4], t010[4], t001[4], t011[4];
GLchan t100[4], t110[4], t101[4], t111[4];
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1);
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapR, texcoord[2], w, depth, k0, k1);
+ linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a);
+ linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b);
+ linear_texel_locations(tObj->WrapR, img, depth, texcoord[2], &k0, &k1, &c);
if (img->Border) {
i0 += img->Border;
@@ -1536,14 +1528,10 @@ sample_3d_linear(GLcontext *ctx,
}
/* trilinear interpolation of samples */
- a = FRAC(u);
- b = FRAC(v);
- c = FRAC(w);
lerp_rgba_3d(rgba, a, b, c, t000, t100, t010, t110, t001, t101, t011, t111);
}
-
static void
sample_3d_nearest_mipmap_nearest(GLcontext *ctx,
const struct gl_texture_object *tObj,
@@ -1623,6 +1611,7 @@ sample_3d_linear_mipmap_linear(GLcontext *ctx,
}
+/** Sample 3D texture, nearest filtering for both min/magnification */
static void
sample_nearest_3d(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
@@ -1632,37 +1621,34 @@ sample_nearest_3d(GLcontext *ctx,
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_3d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
-
+/** Sample 3D 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[], GLchan rgba[][4] )
+sample_linear_3d(GLcontext *ctx,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat texcoords[][4],
+ const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_3d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
-/*
- * Given an (s,t,r) texture coordinate and lambda (level of detail) value,
- * return a texture sample.
- */
+/** Sample 3D 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[],
- GLchan rgba[][4] )
+sample_lambda_3d(GLcontext *ctx,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat texcoords[][4], const GLfloat lambda[],
+ GLchan rgba[][4])
{
GLuint minStart, minEnd; /* texels with minification */
GLuint magStart, magEnd; /* texels with magnification */
@@ -1951,11 +1937,12 @@ sample_cube_linear_mipmap_linear(GLcontext *ctx,
}
+/** Sample cube 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[],
- GLchan rgba[][4])
+sample_lambda_cube(GLcontext *ctx,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat texcoords[][4], const GLfloat lambda[],
+ GLchan rgba[][4])
{
GLuint minStart, minEnd; /* texels with minification */
GLuint magStart, magEnd; /* texels with magnification */
@@ -2031,50 +2018,58 @@ sample_lambda_cube( GLcontext *ctx,
static INLINE GLint
clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max)
{
- if (wrapMode == GL_CLAMP) {
+ switch (wrapMode) {
+ case GL_CLAMP:
return IFLOOR( CLAMP(coord, 0.0F, max - 1) );
- }
- else if (wrapMode == GL_CLAMP_TO_EDGE) {
+ case GL_CLAMP_TO_EDGE:
return IFLOOR( CLAMP(coord, 0.5F, max - 0.5F) );
- }
- else {
+ case GL_CLAMP_TO_BORDER:
return IFLOOR( CLAMP(coord, -0.5F, max + 0.5F) );
+ default:
+ _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_nearest");
+ return 0;
}
}
-/*
+/**
* As above, but GL_LINEAR filtering.
*/
static INLINE void
clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
- GLint *i0out, GLint *i1out)
+ GLint *i0out, GLint *i1out, GLfloat *weight)
{
GLfloat fcol;
GLint i0, i1;
- if (wrapMode == GL_CLAMP) {
+ switch (wrapMode) {
+ case GL_CLAMP:
/* Not exactly what the spec says, but it matches NVIDIA output */
fcol = CLAMP(coord - 0.5F, 0.0, max-1);
i0 = IFLOOR(fcol);
i1 = i0 + 1;
- }
- else if (wrapMode == GL_CLAMP_TO_EDGE) {
+ break;
+ case GL_CLAMP_TO_EDGE:
fcol = CLAMP(coord, 0.5F, max - 0.5F);
fcol -= 0.5F;
i0 = IFLOOR(fcol);
i1 = i0 + 1;
if (i1 > max - 1)
i1 = max - 1;
- }
- else {
- ASSERT(wrapMode == GL_CLAMP_TO_BORDER);
+ break;
+ case GL_CLAMP_TO_BORDER:
fcol = CLAMP(coord, -0.5F, max + 0.5F);
fcol -= 0.5F;
i0 = IFLOOR(fcol);
i1 = i0 + 1;
+ break;
+ default:
+ _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_linear");
+ i0 = i1 = 0;
+ fcol = 0.0F;
}
*i0out = i0;
*i1out = i1;
+ *weight = FRAC(fcol);
}
@@ -2085,10 +2080,8 @@ sample_nearest_rect(GLcontext *ctx,
GLchan rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][0];
- const GLfloat width = (GLfloat) img->Width;
- const GLfloat height = (GLfloat) img->Height;
- const GLint width_minus_1 = img->Width - 1;
- const GLint height_minus_1 = img->Height - 1;
+ const GLint width = img->Width;
+ const GLint height = img->Height;
GLuint i;
(void) ctx;
@@ -2106,7 +2099,7 @@ sample_nearest_rect(GLcontext *ctx,
GLint row, col;
col = clamp_rect_coord_nearest(tObj->WrapS, texcoords[i][0], width);
row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height);
- if (col < 0 || col > width_minus_1 || row < 0 || row > height_minus_1)
+ if (col < 0 || col >= width || row < 0 || row >= height)
COPY_CHAN4(rgba[i], tObj->_BorderChan);
else
img->FetchTexelc(img, col, row, 0, rgba[i]);
@@ -2121,10 +2114,8 @@ sample_linear_rect(GLcontext *ctx,
const GLfloat lambda[], GLchan rgba[][4])
{
const struct gl_texture_image *img = tObj->Image[0][0];
- const GLfloat width = (GLfloat) img->Width;
- const GLfloat height = (GLfloat) img->Height;
- const GLint width_minus_1 = img->Width - 1;
- const GLint height_minus_1 = img->Height - 1;
+ const GLint width = img->Width;
+ const GLint height = img->Height;
GLuint i;
(void) ctx;
@@ -2138,64 +2129,22 @@ sample_linear_rect(GLcontext *ctx,
tObj->WrapT == GL_CLAMP_TO_BORDER);
ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX);
- /* XXX lots of opportunity for optimization in this loop */
for (i = 0; i < n; i++) {
- GLfloat frow, fcol;
GLint i0, j0, i1, j1;
GLchan t00[4], t01[4], t10[4], t11[4];
GLfloat a, b;
GLbitfield useBorderColor = 0x0;
- /* NOTE: we DO NOT use [0, 1] texture coordinates! */
- if (tObj->WrapS == GL_CLAMP) {
- /* Not exactly what the spec says, but it matches NVIDIA output */
- fcol = CLAMP(texcoords[i][0] - 0.5F, 0.0, width_minus_1);
- i0 = IFLOOR(fcol);
- i1 = i0 + 1;
- }
- else if (tObj->WrapS == GL_CLAMP_TO_EDGE) {
- fcol = CLAMP(texcoords[i][0], 0.5F, width - 0.5F);
- fcol -= 0.5F;
- i0 = IFLOOR(fcol);
- i1 = i0 + 1;
- if (i1 > width_minus_1)
- i1 = width_minus_1;
- }
- else {
- ASSERT(tObj->WrapS == GL_CLAMP_TO_BORDER);
- fcol = CLAMP(texcoords[i][0], -0.5F, width + 0.5F);
- fcol -= 0.5F;
- i0 = IFLOOR(fcol);
- i1 = i0 + 1;
- }
-
- if (tObj->WrapT == GL_CLAMP) {
- /* Not exactly what the spec says, but it matches NVIDIA output */
- frow = CLAMP(texcoords[i][1] - 0.5F, 0.0, width_minus_1);
- j0 = IFLOOR(frow);
- j1 = j0 + 1;
- }
- else if (tObj->WrapT == GL_CLAMP_TO_EDGE) {
- frow = CLAMP(texcoords[i][1], 0.5F, height - 0.5F);
- frow -= 0.5F;
- j0 = IFLOOR(frow);
- j1 = j0 + 1;
- if (j1 > height_minus_1)
- j1 = height_minus_1;
- }
- else {
- ASSERT(tObj->WrapT == GL_CLAMP_TO_BORDER);
- frow = CLAMP(texcoords[i][1], -0.5F, height + 0.5F);
- frow -= 0.5F;
- j0 = IFLOOR(frow);
- j1 = j0 + 1;
- }
+ clamp_rect_coord_linear(tObj->WrapS, texcoords[i][0], width,
+ &i0, &i1, &a);
+ clamp_rect_coord_linear(tObj->WrapT, texcoords[i][1], height,
+ &j0, &j1, &b);
/* compute integer rows/columns */
- if (i0 < 0 || i0 > width_minus_1) useBorderColor |= I0BIT;
- if (i1 < 0 || i1 > width_minus_1) useBorderColor |= I1BIT;
- if (j0 < 0 || j0 > height_minus_1) useBorderColor |= J0BIT;
- if (j1 < 0 || j1 > height_minus_1) useBorderColor |= J1BIT;
+ if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT;
+ if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT;
+ if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT;
+ if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT;
/* get four texel samples */
if (useBorderColor & (I0BIT | J0BIT))
@@ -2218,20 +2167,17 @@ sample_linear_rect(GLcontext *ctx,
else
img->FetchTexelc(img, i1, j1, 0, t11);
- /* compute interpolants */
- a = FRAC(fcol);
- b = FRAC(frow);
-
lerp_rgba_2d(rgba[i], a, b, t00, t10, t01, t11);
}
}
+/** Sample Rect 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[],
- GLchan rgba[][4])
+sample_lambda_rect(GLcontext *ctx,
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat texcoords[][4], const GLfloat lambda[],
+ GLchan rgba[][4])
{
GLuint minStart, minEnd, magStart, magEnd;
@@ -2243,22 +2189,22 @@ sample_lambda_rect( GLcontext *ctx,
if (minStart < minEnd) {
if (tObj->MinFilter == GL_NEAREST) {
- sample_nearest_rect( ctx, tObj, minEnd - minStart,
- texcoords + minStart, NULL, rgba + minStart);
+ sample_nearest_rect(ctx, tObj, minEnd - minStart,
+ texcoords + minStart, NULL, rgba + minStart);
}
else {
- sample_linear_rect( ctx, tObj, minEnd - minStart,
- texcoords + minStart, NULL, rgba + minStart);
+ sample_linear_rect(ctx, tObj, minEnd - minStart,
+ texcoords + minStart, NULL, rgba + minStart);
}
}
if (magStart < magEnd) {
if (tObj->MagFilter == GL_NEAREST) {
- sample_nearest_rect( ctx, tObj, magEnd - magStart,
- texcoords + magStart, NULL, rgba + magStart);
+ sample_nearest_rect(ctx, tObj, magEnd - magStart,
+ texcoords + magStart, NULL, rgba + magStart);
}
else {
- sample_linear_rect( ctx, tObj, magEnd - magStart,
- texcoords + magStart, NULL, rgba + magStart);
+ sample_linear_rect(ctx, tObj, magEnd - magStart,
+ texcoords + magStart, NULL, rgba + magStart);
}
}
}
@@ -2269,7 +2215,7 @@ sample_lambda_rect( GLcontext *ctx,
/* 2D Texture Array Sampling Functions */
/**********************************************************************/
-/*
+/**
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
*/
static void
@@ -2286,8 +2232,8 @@ sample_2d_array_nearest(GLcontext *ctx,
GLint array;
(void) ctx;
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i);
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j);
+ i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]);
+ j = nearest_texel_location(tObj->WrapT, img, height, texcoord[1]);
array = clamp_rect_coord_nearest(tObj->WrapR, texcoord[2], depth);
if (i < 0 || i >= (GLint) img->Width ||
@@ -2302,8 +2248,7 @@ sample_2d_array_nearest(GLcontext *ctx,
}
-
-/*
+/**
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
*/
static void
@@ -2319,12 +2264,11 @@ sample_2d_array_linear(GLcontext *ctx,
GLint i0, j0, i1, j1;
GLint array;
GLbitfield useBorderColor = 0x0;
- GLfloat u, v;
GLfloat a, b;
GLchan t00[4], t01[4], t10[4], t11[4];
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1);
+ linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a);
+ linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b);
array = clamp_rect_coord_nearest(tObj->WrapR, texcoord[2], depth);
if (array < 0 || array >= depth) {
@@ -2372,19 +2316,16 @@ sample_2d_array_linear(GLcontext *ctx,
}
/* trilinear interpolation of samples */
- a = FRAC(u);
- b = FRAC(v);
lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11);
}
}
-
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[], GLchan rgba[][4] )
+ const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
for (i = 0; i < n; i++) {
@@ -2428,8 +2369,10 @@ sample_2d_array_nearest_mipmap_linear(GLcontext *ctx,
else {
GLchan t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda[i]);
- sample_2d_array_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0);
- sample_2d_array_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
+ sample_2d_array_nearest(ctx, tObj, tObj->Image[0][level ],
+ texcoord[i], t0);
+ sample_2d_array_nearest(ctx, tObj, tObj->Image[0][level+1],
+ texcoord[i], t1);
lerp_rgba(rgba[i], f, t0, t1);
}
}
@@ -2438,9 +2381,9 @@ sample_2d_array_nearest_mipmap_linear(GLcontext *ctx,
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[], GLchan rgba[][4])
+ const struct gl_texture_object *tObj,
+ GLuint n, const GLfloat texcoord[][4],
+ const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
ASSERT(lambda != NULL);
@@ -2453,30 +2396,34 @@ sample_2d_array_linear_mipmap_linear(GLcontext *ctx,
else {
GLchan t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda[i]);
- sample_2d_array_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0);
- sample_2d_array_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
+ sample_2d_array_linear(ctx, tObj, tObj->Image[0][level ],
+ texcoord[i], t0);
+ sample_2d_array_linear(ctx, tObj, tObj->Image[0][level+1],
+ texcoord[i], t1);
lerp_rgba(rgba[i], f, t0, t1);
}
}
}
+/** Sample 2D Array 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[],
- GLchan rgba[][4])
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat texcoords[][4], const GLfloat lambda[],
+ GLchan rgba[][4])
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_2d_array_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
+/** Sample 2D Array texture, linear filtering for both min/magnification */
static void
sample_linear_2d_array(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
@@ -2486,16 +2433,13 @@ sample_linear_2d_array(GLcontext *ctx,
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_2d_array_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
-/*
- * Given an (s,t,r) texture coordinate and lambda (level of detail) value,
- * return a texture sample.
- */
+/** Sample 2D Array texture, using lambda to choose between min/magnification */
static void
sample_lambda_2d_array(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
@@ -2525,8 +2469,10 @@ sample_lambda_2d_array(GLcontext *ctx,
texcoords[i], rgba[i]);
break;
case GL_NEAREST_MIPMAP_NEAREST:
- sample_2d_array_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart,
- lambda + minStart, rgba + minStart);
+ sample_2d_array_nearest_mipmap_nearest(ctx, tObj, m,
+ texcoords + minStart,
+ lambda + minStart,
+ rgba + minStart);
break;
case GL_LINEAR_MIPMAP_NEAREST:
sample_2d_array_linear_mipmap_nearest(ctx, tObj, m,
@@ -2535,8 +2481,10 @@ sample_lambda_2d_array(GLcontext *ctx,
rgba + minStart);
break;
case GL_NEAREST_MIPMAP_LINEAR:
- sample_2d_array_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart,
- lambda + minStart, rgba + minStart);
+ sample_2d_array_nearest_mipmap_linear(ctx, tObj, m,
+ texcoords + minStart,
+ lambda + minStart,
+ rgba + minStart);
break;
case GL_LINEAR_MIPMAP_LINEAR:
sample_2d_array_linear_mipmap_linear(ctx, tObj, m,
@@ -2577,7 +2525,7 @@ sample_lambda_2d_array(GLcontext *ctx,
/* 1D Texture Array Sampling Functions */
/**********************************************************************/
-/*
+/**
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
*/
static void
@@ -2593,7 +2541,7 @@ sample_1d_array_nearest(GLcontext *ctx,
GLint array;
(void) ctx;
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i);
+ i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]);
array = clamp_rect_coord_nearest(tObj->WrapT, texcoord[1], height);
if (i < 0 || i >= (GLint) img->Width ||
@@ -2607,8 +2555,7 @@ sample_1d_array_nearest(GLcontext *ctx,
}
-
-/*
+/**
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
*/
static void
@@ -2623,11 +2570,10 @@ sample_1d_array_linear(GLcontext *ctx,
GLint i0, i1;
GLint array;
GLbitfield useBorderColor = 0x0;
- GLfloat u;
GLfloat a;
GLchan t0[4], t1[4];
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
+ linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a);
array = clamp_rect_coord_nearest(tObj->WrapT, texcoord[1], height);
if (img->Border) {
@@ -2657,17 +2603,15 @@ sample_1d_array_linear(GLcontext *ctx,
}
/* bilinear interpolation of samples */
- a = FRAC(u);
lerp_rgba(rgba, a, t0, t1);
}
-
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[], GLchan rgba[][4] )
+ const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
for (i = 0; i < n; i++) {
@@ -2721,9 +2665,9 @@ sample_1d_array_nearest_mipmap_linear(GLcontext *ctx,
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[], GLchan rgba[][4])
+ const struct gl_texture_object *tObj,
+ GLuint n, const GLfloat texcoord[][4],
+ const GLfloat lambda[], GLchan rgba[][4])
{
GLuint i;
ASSERT(lambda != NULL);
@@ -2744,22 +2688,23 @@ sample_1d_array_linear_mipmap_linear(GLcontext *ctx,
}
+/** Sample 1D Array 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[],
- GLchan rgba[][4])
+ const struct gl_texture_object *tObj, GLuint n,
+ const GLfloat texcoords[][4], const GLfloat lambda[],
+ GLchan rgba[][4])
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_1d_array_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
-
+/** Sample 1D Array texture, linear filtering for both min/magnification */
static void
sample_linear_1d_array(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
@@ -2769,16 +2714,13 @@ sample_linear_1d_array(GLcontext *ctx,
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
- for (i=0;i<n;i++) {
+ for (i = 0; i < n; i++) {
sample_1d_array_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
-/*
- * Given an (s,t,r) texture coordinate and lambda (level of detail) value,
- * return a texture sample.
- */
+/** Sample 1D Array texture, using lambda to choose between min/magnification */
static void
sample_lambda_1d_array(GLcontext *ctx,
const struct gl_texture_object *tObj, GLuint n,
@@ -2854,9 +2796,7 @@ sample_lambda_1d_array(GLcontext *ctx,
}
-
-
-/*
+/**
* Sample a shadow/depth texture.
*/
static void
@@ -2906,33 +2846,36 @@ sample_depth_texture( GLcontext *ctx,
break;
case GL_TEXTURE_1D:
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0],
- width, col);
+ col = nearest_texel_location(tObj->WrapS, img, width,
+ texcoords[i][0]);
row = 0;
slice = 0;
break;
case GL_TEXTURE_2D:
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0],
- width, col);
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1],
- height, row);
+ col = nearest_texel_location(tObj->WrapS, img, width,
+ texcoords[i][0]);
+ row = nearest_texel_location(tObj->WrapT, img, height,
+ texcoords[i][1]);
slice = 0;
break;
case GL_TEXTURE_1D_ARRAY_EXT:
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0],
- width, col);
+ col = nearest_texel_location(tObj->WrapS, img, width,
+ texcoords[i][0]);
row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height);
slice = 0;
+ break;
case GL_TEXTURE_2D_ARRAY_EXT:
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0],
- width, col);
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1],
- height, row);
+ col = nearest_texel_location(tObj->WrapS, img, width,
+ texcoords[i][0]);
+ row = nearest_texel_location(tObj->WrapT, img, height,
+ texcoords[i][1]);
slice = clamp_rect_coord_nearest(tObj->WrapR, texcoords[i][2], depth);
break;
+ default:
+ col = row = slice = 0;
}
if (col >= 0 && row >= 0 && col < width && row < height &&
@@ -3007,41 +2950,44 @@ sample_depth_texture( GLcontext *ctx,
GLfloat depth00, depth01, depth10, depth11;
GLint i0, i1, j0, j1;
GLint slice;
- GLfloat u, v;
+ GLfloat a, b;
GLuint useBorderTexel;
switch (tObj->Target) {
case GL_TEXTURE_RECTANGLE_ARB:
clamp_rect_coord_linear(tObj->WrapS, texcoords[i][0],
- width, &i0, &i1);
+ width, &i0, &i1, &a);
clamp_rect_coord_linear(tObj->WrapT, texcoords[i][1],
- height, &j0, &j1);
+ height, &j0, &j1, &b);
slice = 0;
break;
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoords[i][0],
- u, width, i0, i1);
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1],
- v, height,j0, j1);
+ linear_texel_locations(tObj->WrapS, img, width,
+ texcoords[i][0], &i0, &i1, &a);
+ linear_texel_locations(tObj->WrapT, img, height,
+ texcoords[i][1], &j0, &j1, &b);
slice = 0;
break;
case GL_TEXTURE_1D_ARRAY_EXT:
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoords[i][0],
- u, width, i0, i1);
+ linear_texel_locations(tObj->WrapS, img, width,
+ texcoords[i][0], &i0, &i1, &a);
j0 = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height);
j1 = j0;
slice = 0;
+ break;
case GL_TEXTURE_2D_ARRAY_EXT:
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoords[i][0],
- u, width, i0, i1);
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1],
- v, height,j0, j1);
+ linear_texel_locations(tObj->WrapS, img, width,
+ texcoords[i][0], &i0, &i1, &a);
+ linear_texel_locations(tObj->WrapT, img, height,
+ texcoords[i][1], &j0, &j1, &b);
slice = clamp_rect_coord_nearest(tObj->WrapR, texcoords[i][2], depth);
break;
+ default:
+ slice = 0;
}
useBorderTexel = 0;
@@ -3103,8 +3049,6 @@ sample_depth_texture( GLcontext *ctx,
if (0) {
/* compute a single weighted depth sample and do one comparison */
- const GLfloat a = FRAC(u + 1.0F);
- const GLfloat b = FRAC(v + 1.0F);
const GLfloat depthSample
= lerp_2d(a, b, depth00, depth10, depth01, depth11);
if ((depthSample <= texcoords[i][compare_coord] && function == GL_LEQUAL) ||
@@ -3175,8 +3119,6 @@ sample_depth_texture( GLcontext *ctx,
case GL_NONE:
/* ordinary bilinear filtering */
{
- const GLfloat a = FRAC(u + 1.0F);
- const GLfloat b = FRAC(v + 1.0F);
const GLfloat depthSample
= lerp_2d(a, b, depth00, depth10, depth01, depth11);
CLAMPED_FLOAT_TO_CHAN(result, depthSample);
@@ -3270,10 +3212,10 @@ sample_depth_texture2(const GLcontext *ctx,
GLint col, row, ii, jj, imin, imax, jmin, jmax, samples, count;
GLfloat w;
GLchan lum;
- COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapS, texcoords[i][0],
- width, col);
- COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapT, texcoords[i][1],
- height, row);
+ col = nearest_texel_location(texObj->WrapS, img, width,
+ texcoords[i][0]);
+ row = nearest_texel_location(texObj->WrapT, img, height,
+ texcoords[i][1]);
imin = col - K;
imax = col + K;
diff --git a/dist/Mesa/src/mesa/swrast/s_texfilter.h b/dist/Mesa/src/mesa/swrast/s_texfilter.h
index e4445e79a..2e265d685 100644
--- a/dist/Mesa/src/mesa/swrast/s_texfilter.h
+++ b/dist/Mesa/src/mesa/swrast/s_texfilter.h
@@ -27,7 +27,6 @@
#define S_TEXFILTER_H
-#include "mtypes.h"
#include "swrast.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_texstore.c b/dist/Mesa/src/mesa/swrast/s_texstore.c
index 547d5b9ea..16b00b9fa 100644
--- a/dist/Mesa/src/mesa/swrast/s_texstore.c
+++ b/dist/Mesa/src/mesa/swrast/s_texstore.c
@@ -36,17 +36,17 @@
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "convolve.h"
-#include "image.h"
-#include "macros.h"
-#include "mipmap.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
+#include "main/glheader.h"
+#include "main/imports.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/convolve.h"
+#include "main/image.h"
+#include "main/macros.h"
+#include "main/mipmap.h"
+#include "main/texformat.h"
+#include "main/teximage.h"
+#include "main/texstore.h"
#include "s_context.h"
#include "s_depth.h"
@@ -216,9 +216,9 @@ is_depth_format(GLenum format)
{
switch (format) {
case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16_SGIX:
- case GL_DEPTH_COMPONENT24_SGIX:
- case GL_DEPTH_COMPONENT32_SGIX:
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT24:
+ case GL_DEPTH_COMPONENT32:
return GL_TRUE;
default:
return GL_FALSE;
diff --git a/dist/Mesa/src/mesa/swrast/s_triangle.c b/dist/Mesa/src/mesa/swrast/s_triangle.c
index 59e15645f..b01f1f967 100644
--- a/dist/Mesa/src/mesa/swrast/s_triangle.c
+++ b/dist/Mesa/src/mesa/swrast/s_triangle.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.3
+ * Version: 7.3
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@@ -29,12 +29,12 @@
* functions to draw triangles.
*/
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "imports.h"
-#include "macros.h"
-#include "texformat.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/texformat.h"
#include "s_aatriangle.h"
#include "s_context.h"
@@ -131,7 +131,8 @@ _swrast_culltriangle( GLcontext *ctx,
#define SETUP_CODE \
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \
- struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
+ struct gl_texture_object *obj = \
+ ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
const GLint b = obj->BaseLevel; \
const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
@@ -182,7 +183,8 @@ _swrast_culltriangle( GLcontext *ctx,
#define SETUP_CODE \
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \
- struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
+ struct gl_texture_object *obj = \
+ ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
const GLint b = obj->BaseLevel; \
const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
@@ -263,6 +265,7 @@ affine_span(GLcontext *ctx, SWspan *span,
struct affine_info *info)
{
GLchan sample[4]; /* the filtered texture sample */
+ const GLuint texEnableSave = ctx->Texture._EnabledUnits;
/* Instead of defining a function for each mode, a test is done
* between the outer and inner loops. This is to reduce code size
@@ -392,6 +395,9 @@ affine_span(GLcontext *ctx, SWspan *span,
GLuint i;
GLchan *dest = span->array->rgba[0];
+ /* Disable tex units so they're not re-applied in swrast_write_rgba_span */
+ ctx->Texture._EnabledUnits = 0x0;
+
span->intTex[0] -= FIXED_HALF;
span->intTex[1] -= FIXED_HALF;
switch (info->filter) {
@@ -493,8 +499,12 @@ affine_span(GLcontext *ctx, SWspan *span,
}
span->interpMask &= ~SPAN_RGBA;
ASSERT(span->arrayMask & SPAN_RGBA);
+
_swrast_write_rgba_span(ctx, span);
+ /* re-enable texture units */
+ ctx->Texture._EnabledUnits = texEnableSave;
+
#undef SPAN_NEAREST
#undef SPAN_LINEAR
}
@@ -515,7 +525,8 @@ affine_span(GLcontext *ctx, SWspan *span,
#define SETUP_CODE \
struct affine_info info; \
struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
- struct gl_texture_object *obj = unit->Current2D; \
+ struct gl_texture_object *obj = \
+ ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
const GLint b = obj->BaseLevel; \
const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
@@ -785,7 +796,8 @@ fast_persp_span(GLcontext *ctx, SWspan *span,
#define SETUP_CODE \
struct persp_info info; \
const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
- const struct gl_texture_object *obj = unit->Current2D; \
+ struct gl_texture_object *obj = \
+ ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
const GLint b = obj->BaseLevel; \
info.texture = (const GLchan *) obj->Image[0][b]->Data; \
info.twidth_log2 = obj->Image[0][b]->WidthLog2; \
@@ -1041,7 +1053,8 @@ _swrast_choose_triangle( GLcontext *ctx )
const struct gl_texture_image *texImg;
GLenum minFilter, magFilter, envMode;
GLint format;
- texObj2D = ctx->Texture.Unit[0].Current2D;
+ texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
+
texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL;
format = texImg ? texImg->TexFormat->MesaFormat : -1;
minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0;
diff --git a/dist/Mesa/src/mesa/swrast/s_triangle.h b/dist/Mesa/src/mesa/swrast/s_triangle.h
index 0de812500..b81932c73 100644
--- a/dist/Mesa/src/mesa/swrast/s_triangle.h
+++ b/dist/Mesa/src/mesa/swrast/s_triangle.h
@@ -28,7 +28,6 @@
#define S_TRIANGLES_H
-#include "mtypes.h"
#include "swrast.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_zoom.c b/dist/Mesa/src/mesa/swrast/s_zoom.c
index 4473078b7..a48eae192 100644
--- a/dist/Mesa/src/mesa/swrast/s_zoom.c
+++ b/dist/Mesa/src/mesa/swrast/s_zoom.c
@@ -22,10 +22,10 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "glheader.h"
-#include "macros.h"
-#include "imports.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/colormac.h"
#include "s_context.h"
#include "s_span.h"
diff --git a/dist/Mesa/src/mesa/swrast/s_zoom.h b/dist/Mesa/src/mesa/swrast/s_zoom.h
index d10c27024..d2815b41a 100644
--- a/dist/Mesa/src/mesa/swrast/s_zoom.h
+++ b/dist/Mesa/src/mesa/swrast/s_zoom.h
@@ -25,27 +25,24 @@
#ifndef S_ZOOM_H
#define S_ZOOM_H
-#include "mtypes.h"
#include "swrast.h"
extern void
_swrast_write_zoomed_rgba_span(GLcontext *ctx, GLint imgX, GLint imgY,
- const struct sw_span *span,
- CONST GLchan rgb[][4]);
+ const SWspan *span, const GLvoid *rgba);
extern void
_swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY,
- const struct sw_span *span,
- CONST GLchan rgb[][3]);
+ const SWspan *span, const GLvoid *rgb);
extern void
_swrast_write_zoomed_index_span(GLcontext *ctx, GLint imgX, GLint imgY,
- const struct sw_span *span);
+ const SWspan *span);
extern void
_swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY,
- const struct sw_span *span);
+ const SWspan *span);
extern void