aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-08 09:33:13 +0200
committermarha <marha@users.sourceforge.net>2012-06-08 09:33:13 +0200
commit990bc3f015a4f8fce2eb918375defcd44980a845 (patch)
tree8e8301f19482b52cc00bd95b4593522cc93267af /mesalib/src/mesa/swrast
parent1af6fc1b5d93e54d6674de8b5870448b29f139a7 (diff)
downloadvcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.tar.gz
vcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.tar.bz2
vcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.zip
Used synchronise script to update files
Diffstat (limited to 'mesalib/src/mesa/swrast')
-rw-r--r--mesalib/src/mesa/swrast/NOTES108
-rw-r--r--mesalib/src/mesa/swrast/s_aaline.h76
-rw-r--r--mesalib/src/mesa/swrast/s_aatriangle.h76
-rw-r--r--mesalib/src/mesa/swrast/s_alpha.c320
-rw-r--r--mesalib/src/mesa/swrast/s_alpha.h78
-rw-r--r--mesalib/src/mesa/swrast/s_atifragshader.c1208
-rw-r--r--mesalib/src/mesa/swrast/s_atifragshader.h76
-rw-r--r--mesalib/src/mesa/swrast/s_blend.h90
-rw-r--r--mesalib/src/mesa/swrast/s_feedback.c276
-rw-r--r--mesalib/src/mesa/swrast/s_feedback.h100
-rw-r--r--mesalib/src/mesa/swrast/s_fog.h84
-rw-r--r--mesalib/src/mesa/swrast/s_lines.h82
-rw-r--r--mesalib/src/mesa/swrast/s_logic.h80
-rw-r--r--mesalib/src/mesa/swrast/s_masking.h82
-rw-r--r--mesalib/src/mesa/swrast/s_points.h78
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.h74
-rw-r--r--mesalib/src/mesa/swrast/s_triangle.h100
17 files changed, 1494 insertions, 1494 deletions
diff --git a/mesalib/src/mesa/swrast/NOTES b/mesalib/src/mesa/swrast/NOTES
index d6f991ee8..ea373aa12 100644
--- a/mesalib/src/mesa/swrast/NOTES
+++ b/mesalib/src/mesa/swrast/NOTES
@@ -1,55 +1,55 @@
-INTRODUCTION
-
-Mesa's native software rasterizer. This module provides the fallback
-paths for rasterization operations and states that aren't accelerated
-in hardware drivers, and as the full rasterization engine in software
-drivers.
-
-The swrast module 'stands alone', relying only on interfaces to core
-mesa and it's own driver interface. It knows nothing about the tnl or
-other modules, allowing it to be used for fallback paths in future tnl
-schemes without modification.
-
-As well as providing triangle/line/point rasterization functionality,
-the module provides implementations of the pixel operations
-(ReadPixels, etc), and texture operations (CopyTexSubImage) which may
-be plugged in to the core Mesa driver interface where accelerated
-versions of these operations are unavailable.
-
-
-STATE
-
-To create and destroy the module:
-
- GLboolean _swrast_CreateContext( struct gl_context *ctx );
- void _swrast_DestroyContext( struct gl_context *ctx );
-
-This module tracks state changes internally and maintains derived
-values based on the current state. For this to work, the driver
-ensure the following funciton is called whenever the state changes and
-the swsetup module is 'awake':
-
- void _swrast_InvalidateState( struct gl_context *ctx, GLuint new_state );
-
-There is no explicit call to put the swrast module to sleep.
-
-
-CUSTOMIZATION
-
- void (*choose_point)( struct gl_context * );
- void (*choose_line)( struct gl_context * );
- void (*choose_triangle)( struct gl_context * );
-
-Drivers may add additional triangle/line/point functions to swrast by
-overriding these functions. It is necessary for the driver to be very
-careful that it doesn't return an inappropriate function, eg a
-rasterization function in feedback mode. See the X11 driver for
-examples.
-
-DRIVER INTERFACE
-
-The swrast device driver provides swrast primarily with span- and
-pixel- level interfaces to a framebuffer, with a few additional hooks
-for locking and setting the read buffer.
-
+INTRODUCTION
+
+Mesa's native software rasterizer. This module provides the fallback
+paths for rasterization operations and states that aren't accelerated
+in hardware drivers, and as the full rasterization engine in software
+drivers.
+
+The swrast module 'stands alone', relying only on interfaces to core
+mesa and it's own driver interface. It knows nothing about the tnl or
+other modules, allowing it to be used for fallback paths in future tnl
+schemes without modification.
+
+As well as providing triangle/line/point rasterization functionality,
+the module provides implementations of the pixel operations
+(ReadPixels, etc), and texture operations (CopyTexSubImage) which may
+be plugged in to the core Mesa driver interface where accelerated
+versions of these operations are unavailable.
+
+
+STATE
+
+To create and destroy the module:
+
+ GLboolean _swrast_CreateContext( struct gl_context *ctx );
+ void _swrast_DestroyContext( struct gl_context *ctx );
+
+This module tracks state changes internally and maintains derived
+values based on the current state. For this to work, the driver
+ensure the following funciton is called whenever the state changes and
+the swsetup module is 'awake':
+
+ void _swrast_InvalidateState( struct gl_context *ctx, GLuint new_state );
+
+There is no explicit call to put the swrast module to sleep.
+
+
+CUSTOMIZATION
+
+ void (*choose_point)( struct gl_context * );
+ void (*choose_line)( struct gl_context * );
+ void (*choose_triangle)( struct gl_context * );
+
+Drivers may add additional triangle/line/point functions to swrast by
+overriding these functions. It is necessary for the driver to be very
+careful that it doesn't return an inappropriate function, eg a
+rasterization function in feedback mode. See the X11 driver for
+examples.
+
+DRIVER INTERFACE
+
+The swrast device driver provides swrast primarily with span- and
+pixel- level interfaces to a framebuffer, with a few additional hooks
+for locking and setting the read buffer.
+
See the definition of struct swrast_device_driver in swrast.h. \ No newline at end of file
diff --git a/mesalib/src/mesa/swrast/s_aaline.h b/mesalib/src/mesa/swrast/s_aaline.h
index 993c12eab..74d5518e1 100644
--- a/mesalib/src/mesa/swrast/s_aaline.h
+++ b/mesalib/src/mesa/swrast/s_aaline.h
@@ -1,38 +1,38 @@
-
-/*
- * 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_AALINE_H
-#define S_AALINE_H
-
-
-struct gl_context;
-
-
-extern void
-_swrast_choose_aa_line_function(struct gl_context *ctx);
-
-
-#endif
+
+/*
+ * 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_AALINE_H
+#define S_AALINE_H
+
+
+struct gl_context;
+
+
+extern void
+_swrast_choose_aa_line_function(struct gl_context *ctx);
+
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_aatriangle.h b/mesalib/src/mesa/swrast/s_aatriangle.h
index dec637920..e40efb198 100644
--- a/mesalib/src/mesa/swrast/s_aatriangle.h
+++ b/mesalib/src/mesa/swrast/s_aatriangle.h
@@ -1,38 +1,38 @@
-
-/*
- * 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_AATRIANGLE_H
-#define S_AATRIANGLE_H
-
-
-struct gl_context;
-
-
-extern void
-_swrast_set_aa_triangle_function(struct gl_context *ctx);
-
-
-#endif
+
+/*
+ * 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_AATRIANGLE_H
+#define S_AATRIANGLE_H
+
+
+struct gl_context;
+
+
+extern void
+_swrast_set_aa_triangle_function(struct gl_context *ctx);
+
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_alpha.c b/mesalib/src/mesa/swrast/s_alpha.c
index 798b506e4..df2181ba9 100644
--- a/mesalib/src/mesa/swrast/s_alpha.c
+++ b/mesalib/src/mesa/swrast/s_alpha.c
@@ -1,160 +1,160 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * 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"),
- * 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.
- */
-
-/**
- * \file swrast/s_alpha.c
- * \brief Functions to apply alpha test.
- */
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/colormac.h"
-#include "main/macros.h"
-
-#include "s_alpha.h"
-#include "s_context.h"
-
-
-#define ALPHA_TEST(ALPHA, LOOP_CODE) \
-do { \
- switch (ctx->Color.AlphaFunc) { \
- case GL_LESS: \
- for (i = 0; i < n; i++) { \
- mask[i] &= (ALPHA < ref); \
- LOOP_CODE; \
- } \
- break; \
- case GL_LEQUAL: \
- for (i = 0; i < n; i++) { \
- mask[i] &= (ALPHA <= ref); \
- LOOP_CODE; \
- } \
- break; \
- case GL_GEQUAL: \
- for (i = 0; i < n; i++) { \
- mask[i] &= (ALPHA >= ref); \
- LOOP_CODE; \
- } \
- break; \
- case GL_GREATER: \
- for (i = 0; i < n; i++) { \
- mask[i] &= (ALPHA > ref); \
- LOOP_CODE; \
- } \
- break; \
- case GL_NOTEQUAL: \
- for (i = 0; i < n; i++) { \
- mask[i] &= (ALPHA != ref); \
- LOOP_CODE; \
- } \
- break; \
- case GL_EQUAL: \
- for (i = 0; i < n; i++) { \
- mask[i] &= (ALPHA == ref); \
- LOOP_CODE; \
- } \
- break; \
- default: \
- _mesa_problem(ctx, "Invalid alpha test in _swrast_alpha_test" ); \
- return 0; \
- } \
-} while (0)
-
-
-
-/**
- * Perform the alpha test for an array of pixels.
- * For pixels that fail the test, mask[i] will be set to 0.
- * \return 0 if all pixels in the span failed the alpha test,
- * 1 if one or more pixels passed the alpha test.
- */
-GLint
-_swrast_alpha_test(const struct gl_context *ctx, SWspan *span)
-{
- const GLuint n = span->end;
- GLubyte *mask = span->array->mask;
- GLuint i;
-
- if (ctx->Color.AlphaFunc == GL_ALWAYS) {
- /* do nothing */
- return 1;
- }
- else if (ctx->Color.AlphaFunc == GL_NEVER) {
- /* All pixels failed - caller should check for this return value and
- * act accordingly.
- */
- span->writeAll = GL_FALSE;
- return 0;
- }
-
- if (span->arrayMask & SPAN_RGBA) {
- /* Use array's alpha values */
- if (span->array->ChanType == GL_UNSIGNED_BYTE) {
- GLubyte (*rgba)[4] = span->array->rgba8;
- GLubyte ref;
- CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef);
- ALPHA_TEST(rgba[i][ACOMP], ;);
- }
- else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
- GLushort (*rgba)[4] = span->array->rgba16;
- GLushort ref;
- CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef);
- ALPHA_TEST(rgba[i][ACOMP], ;);
- }
- else {
- GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
- const GLfloat ref = ctx->Color.AlphaRef;
- ALPHA_TEST(rgba[i][ACOMP], ;);
- }
- }
- else {
- /* Interpolate alpha values */
- ASSERT(span->interpMask & SPAN_RGBA);
- if (span->array->ChanType == GL_UNSIGNED_BYTE) {
- const GLfixed alphaStep = span->alphaStep;
- GLfixed alpha = span->alpha;
- GLubyte ref;
- CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef);
- ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
- }
- else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
- const GLfixed alphaStep = span->alphaStep;
- GLfixed alpha = span->alpha;
- GLushort ref;
- CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef);
- ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
- }
- else {
- const GLfloat alphaStep = FixedToFloat(span->alphaStep);
- GLfloat alpha = FixedToFloat(span->alpha);
- const GLfloat ref = ctx->Color.AlphaRef;
- ALPHA_TEST(alpha, alpha += alphaStep);
- }
- }
-
- span->writeAll = GL_FALSE;
-
- /* XXX examine mask[] values? */
- return 1;
-}
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.2
+ *
+ * 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"),
+ * 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.
+ */
+
+/**
+ * \file swrast/s_alpha.c
+ * \brief Functions to apply alpha test.
+ */
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+
+#include "s_alpha.h"
+#include "s_context.h"
+
+
+#define ALPHA_TEST(ALPHA, LOOP_CODE) \
+do { \
+ switch (ctx->Color.AlphaFunc) { \
+ case GL_LESS: \
+ for (i = 0; i < n; i++) { \
+ mask[i] &= (ALPHA < ref); \
+ LOOP_CODE; \
+ } \
+ break; \
+ case GL_LEQUAL: \
+ for (i = 0; i < n; i++) { \
+ mask[i] &= (ALPHA <= ref); \
+ LOOP_CODE; \
+ } \
+ break; \
+ case GL_GEQUAL: \
+ for (i = 0; i < n; i++) { \
+ mask[i] &= (ALPHA >= ref); \
+ LOOP_CODE; \
+ } \
+ break; \
+ case GL_GREATER: \
+ for (i = 0; i < n; i++) { \
+ mask[i] &= (ALPHA > ref); \
+ LOOP_CODE; \
+ } \
+ break; \
+ case GL_NOTEQUAL: \
+ for (i = 0; i < n; i++) { \
+ mask[i] &= (ALPHA != ref); \
+ LOOP_CODE; \
+ } \
+ break; \
+ case GL_EQUAL: \
+ for (i = 0; i < n; i++) { \
+ mask[i] &= (ALPHA == ref); \
+ LOOP_CODE; \
+ } \
+ break; \
+ default: \
+ _mesa_problem(ctx, "Invalid alpha test in _swrast_alpha_test" ); \
+ return 0; \
+ } \
+} while (0)
+
+
+
+/**
+ * Perform the alpha test for an array of pixels.
+ * For pixels that fail the test, mask[i] will be set to 0.
+ * \return 0 if all pixels in the span failed the alpha test,
+ * 1 if one or more pixels passed the alpha test.
+ */
+GLint
+_swrast_alpha_test(const struct gl_context *ctx, SWspan *span)
+{
+ const GLuint n = span->end;
+ GLubyte *mask = span->array->mask;
+ GLuint i;
+
+ if (ctx->Color.AlphaFunc == GL_ALWAYS) {
+ /* do nothing */
+ return 1;
+ }
+ else if (ctx->Color.AlphaFunc == GL_NEVER) {
+ /* All pixels failed - caller should check for this return value and
+ * act accordingly.
+ */
+ span->writeAll = GL_FALSE;
+ return 0;
+ }
+
+ if (span->arrayMask & SPAN_RGBA) {
+ /* Use array's alpha values */
+ if (span->array->ChanType == GL_UNSIGNED_BYTE) {
+ GLubyte (*rgba)[4] = span->array->rgba8;
+ GLubyte ref;
+ CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef);
+ ALPHA_TEST(rgba[i][ACOMP], ;);
+ }
+ else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
+ GLushort (*rgba)[4] = span->array->rgba16;
+ GLushort ref;
+ CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef);
+ ALPHA_TEST(rgba[i][ACOMP], ;);
+ }
+ else {
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ const GLfloat ref = ctx->Color.AlphaRef;
+ ALPHA_TEST(rgba[i][ACOMP], ;);
+ }
+ }
+ else {
+ /* Interpolate alpha values */
+ ASSERT(span->interpMask & SPAN_RGBA);
+ if (span->array->ChanType == GL_UNSIGNED_BYTE) {
+ const GLfixed alphaStep = span->alphaStep;
+ GLfixed alpha = span->alpha;
+ GLubyte ref;
+ CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef);
+ ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
+ }
+ else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
+ const GLfixed alphaStep = span->alphaStep;
+ GLfixed alpha = span->alpha;
+ GLushort ref;
+ CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef);
+ ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
+ }
+ else {
+ const GLfloat alphaStep = FixedToFloat(span->alphaStep);
+ GLfloat alpha = FixedToFloat(span->alpha);
+ const GLfloat ref = ctx->Color.AlphaRef;
+ ALPHA_TEST(alpha, alpha += alphaStep);
+ }
+ }
+
+ span->writeAll = GL_FALSE;
+
+ /* XXX examine mask[] values? */
+ return 1;
+}
diff --git a/mesalib/src/mesa/swrast/s_alpha.h b/mesalib/src/mesa/swrast/s_alpha.h
index ac5cd8dab..fca209a44 100644
--- a/mesalib/src/mesa/swrast/s_alpha.h
+++ b/mesalib/src/mesa/swrast/s_alpha.h
@@ -1,39 +1,39 @@
-/*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999-2002 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_ALPHA_H
-#define S_ALPHA_H
-
-
-#include "main/glheader.h"
-#include "s_span.h"
-
-struct gl_context;
-
-extern GLint
-_swrast_alpha_test( const struct gl_context *ctx, SWspan *span );
-
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 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_ALPHA_H
+#define S_ALPHA_H
+
+
+#include "main/glheader.h"
+#include "s_span.h"
+
+struct gl_context;
+
+extern GLint
+_swrast_alpha_test( const struct gl_context *ctx, SWspan *span );
+
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_atifragshader.c b/mesalib/src/mesa/swrast/s_atifragshader.c
index 6019eea5e..1eb026e00 100644
--- a/mesalib/src/mesa/swrast/s_atifragshader.c
+++ b/mesalib/src/mesa/swrast/s_atifragshader.c
@@ -1,604 +1,604 @@
-/*
- * Copyright (C) 2004 David Airlie 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
- * DAVID AIRLIE 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.
- */
-
-#include "main/glheader.h"
-#include "main/colormac.h"
-#include "main/macros.h"
-#include "main/atifragshader.h"
-#include "swrast/s_atifragshader.h"
-#include "swrast/s_context.h"
-
-
-/**
- * State for executing ATI fragment shader.
- */
-struct atifs_machine
-{
- GLfloat Registers[6][4]; /** six temporary registers */
- GLfloat PrevPassRegisters[6][4];
- GLfloat Inputs[2][4]; /** Primary, secondary input colors */
-};
-
-
-
-/**
- * Fetch a texel.
- */
-static void
-fetch_texel(struct gl_context * ctx, const GLfloat texcoord[4], GLfloat lambda,
- GLuint unit, GLfloat color[4])
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- /* XXX use a float-valued TextureSample routine here!!! */
- swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
- 1, (const GLfloat(*)[4]) texcoord,
- &lambda, (GLfloat (*)[4]) color);
-}
-
-static void
-apply_swizzle(GLfloat values[4], GLuint swizzle)
-{
- GLfloat s, t, r, q;
-
- s = values[0];
- t = values[1];
- r = values[2];
- q = values[3];
-
- switch (swizzle) {
- case GL_SWIZZLE_STR_ATI:
- values[0] = s;
- values[1] = t;
- values[2] = r;
- break;
- case GL_SWIZZLE_STQ_ATI:
- values[0] = s;
- values[1] = t;
- values[2] = q;
- break;
- case GL_SWIZZLE_STR_DR_ATI:
- values[0] = s / r;
- values[1] = t / r;
- values[2] = 1 / r;
- break;
- case GL_SWIZZLE_STQ_DQ_ATI:
-/* make sure q is not 0 to avoid problems later with infinite values (texture lookup)? */
- if (q == 0.0F)
- q = 0.000000001F;
- values[0] = s / q;
- values[1] = t / q;
- values[2] = 1.0F / q;
- break;
- }
- values[3] = 0.0;
-}
-
-static void
-apply_src_rep(GLint optype, GLuint rep, GLfloat * val)
-{
- GLint i;
- GLint start, end;
- if (!rep)
- return;
-
- start = optype ? 3 : 0;
- end = 4;
-
- for (i = start; i < end; i++) {
- switch (rep) {
- case GL_RED:
- val[i] = val[0];
- break;
- case GL_GREEN:
- val[i] = val[1];
- break;
- case GL_BLUE:
- val[i] = val[2];
- break;
- case GL_ALPHA:
- val[i] = val[3];
- break;
- }
- }
-}
-
-static void
-apply_src_mod(GLint optype, GLuint mod, GLfloat * val)
-{
- GLint i;
- GLint start, end;
-
- if (!mod)
- return;
-
- start = optype ? 3 : 0;
- end = 4;
-
- for (i = start; i < end; i++) {
- if (mod & GL_COMP_BIT_ATI)
- val[i] = 1 - val[i];
-
- if (mod & GL_BIAS_BIT_ATI)
- val[i] = val[i] - 0.5F;
-
- if (mod & GL_2X_BIT_ATI)
- val[i] = 2 * val[i];
-
- if (mod & GL_NEGATE_BIT_ATI)
- val[i] = -val[i];
- }
-}
-
-static void
-apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val)
-{
- GLint i;
- GLint has_sat = mod & GL_SATURATE_BIT_ATI;
- GLint start, end;
-
- mod &= ~GL_SATURATE_BIT_ATI;
-
- start = optype ? 3 : 0;
- end = optype ? 4 : 3;
-
- for (i = start; i < end; i++) {
- switch (mod) {
- case GL_2X_BIT_ATI:
- val[i] = 2 * val[i];
- break;
- case GL_4X_BIT_ATI:
- val[i] = 4 * val[i];
- break;
- case GL_8X_BIT_ATI:
- val[i] = 8 * val[i];
- break;
- case GL_HALF_BIT_ATI:
- val[i] = val[i] * 0.5F;
- break;
- case GL_QUARTER_BIT_ATI:
- val[i] = val[i] * 0.25F;
- break;
- case GL_EIGHTH_BIT_ATI:
- val[i] = val[i] * 0.125F;
- break;
- }
-
- if (has_sat) {
- if (val[i] < 0.0F)
- val[i] = 0.0F;
- else if (val[i] > 1.0F)
- val[i] = 1.0F;
- }
- else {
- if (val[i] < -8.0F)
- val[i] = -8.0F;
- else if (val[i] > 8.0F)
- val[i] = 8.0F;
- }
- }
-}
-
-
-static void
-write_dst_addr(GLuint optype, GLuint mod, GLuint mask, GLfloat * src,
- GLfloat * dst)
-{
- GLint i;
- apply_dst_mod(optype, mod, src);
-
- if (optype == ATI_FRAGMENT_SHADER_COLOR_OP) {
- if (mask) {
- if (mask & GL_RED_BIT_ATI)
- dst[0] = src[0];
-
- if (mask & GL_GREEN_BIT_ATI)
- dst[1] = src[1];
-
- if (mask & GL_BLUE_BIT_ATI)
- dst[2] = src[2];
- }
- else {
- for (i = 0; i < 3; i++)
- dst[i] = src[i];
- }
- }
- else
- dst[3] = src[3];
-}
-
-static void
-finish_pass(struct atifs_machine *machine)
-{
- GLint i;
-
- for (i = 0; i < 6; i++) {
- COPY_4V(machine->PrevPassRegisters[i], machine->Registers[i]);
- }
-}
-
-struct ati_fs_opcode_st ati_fs_opcodes[] = {
- {GL_ADD_ATI, 2},
- {GL_SUB_ATI, 2},
- {GL_MUL_ATI, 2},
- {GL_MAD_ATI, 3},
- {GL_LERP_ATI, 3},
- {GL_MOV_ATI, 1},
- {GL_CND_ATI, 3},
- {GL_CND0_ATI, 3},
- {GL_DOT2_ADD_ATI, 3},
- {GL_DOT3_ATI, 2},
- {GL_DOT4_ATI, 2}
-};
-
-
-
-static void
-handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst,
- const SWspan *span, GLuint column, GLuint idx)
-{
- GLuint swizzle = texinst->swizzle;
- GLuint pass_tex = texinst->src;
-
- if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) {
- pass_tex -= GL_TEXTURE0_ARB;
- COPY_4V(machine->Registers[idx],
- span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]);
- }
- else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) {
- pass_tex -= GL_REG_0_ATI;
- COPY_4V(machine->Registers[idx], machine->PrevPassRegisters[pass_tex]);
- }
- apply_swizzle(machine->Registers[idx], swizzle);
-
-}
-
-static void
-handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine,
- struct atifs_setupinst *texinst, const SWspan *span,
- GLuint column, GLuint idx)
-{
-/* sample from unit idx using texinst->src as coords */
- GLuint swizzle = texinst->swizzle;
- GLuint coord_source = texinst->src;
- GLfloat tex_coords[4] = { 0 };
-
- if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) {
- coord_source -= GL_TEXTURE0_ARB;
- COPY_4V(tex_coords,
- span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]);
- }
- else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) {
- coord_source -= GL_REG_0_ATI;
- COPY_4V(tex_coords, machine->PrevPassRegisters[coord_source]);
- }
- apply_swizzle(tex_coords, swizzle);
- fetch_texel(ctx, tex_coords, 0.0F, idx, machine->Registers[idx]);
-}
-
-#define SETUP_SRC_REG(optype, i, x) \
-do { \
- COPY_4V(src[optype][i], x); \
-} while (0)
-
-
-
-/**
- * Execute the given fragment shader.
- * NOTE: we do everything in single-precision floating point
- * \param ctx - rendering context
- * \param shader - the shader to execute
- * \param machine - virtual machine state
- * \param span - the SWspan we're operating on
- * \param column - which pixel [i] we're operating on in the span
- */
-static void
-execute_shader(struct gl_context *ctx, const struct ati_fragment_shader *shader,
- struct atifs_machine *machine, const SWspan *span,
- GLuint column)
-{
- GLuint pc;
- struct atifs_instruction *inst;
- struct atifs_setupinst *texinst;
- GLint optype;
- GLuint i;
- GLint j, pass;
- GLint dstreg;
- GLfloat src[2][3][4];
- GLfloat zeros[4] = { 0.0, 0.0, 0.0, 0.0 };
- GLfloat ones[4] = { 1.0, 1.0, 1.0, 1.0 };
- GLfloat dst[2][4], *dstp;
-
- for (pass = 0; pass < shader->NumPasses; pass++) {
- if (pass > 0)
- finish_pass(machine);
- for (j = 0; j < MAX_NUM_FRAGMENT_REGISTERS_ATI; j++) {
- texinst = &shader->SetupInst[pass][j];
- if (texinst->Opcode == ATI_FRAGMENT_SHADER_PASS_OP)
- handle_pass_op(machine, texinst, span, column, j);
- else if (texinst->Opcode == ATI_FRAGMENT_SHADER_SAMPLE_OP)
- handle_sample_op(ctx, machine, texinst, span, column, j);
- }
-
- for (pc = 0; pc < shader->numArithInstr[pass]; pc++) {
- inst = &shader->Instructions[pass][pc];
-
- /* setup the source registers for color and alpha ops */
- for (optype = 0; optype < 2; optype++) {
- for (i = 0; i < inst->ArgCount[optype]; i++) {
- GLint index = inst->SrcReg[optype][i].Index;
-
- if (index >= GL_REG_0_ATI && index <= GL_REG_5_ATI)
- SETUP_SRC_REG(optype, i,
- machine->Registers[index - GL_REG_0_ATI]);
- else if (index >= GL_CON_0_ATI && index <= GL_CON_7_ATI) {
- if (shader->LocalConstDef & (1 << (index - GL_CON_0_ATI))) {
- SETUP_SRC_REG(optype, i,
- shader->Constants[index - GL_CON_0_ATI]);
- } else {
- SETUP_SRC_REG(optype, i,
- ctx->ATIFragmentShader.GlobalConstants[index - GL_CON_0_ATI]);
- }
- }
- else if (index == GL_ONE)
- SETUP_SRC_REG(optype, i, ones);
- else if (index == GL_ZERO)
- SETUP_SRC_REG(optype, i, zeros);
- else if (index == GL_PRIMARY_COLOR_EXT)
- SETUP_SRC_REG(optype, i,
- machine->Inputs[ATI_FS_INPUT_PRIMARY]);
- else if (index == GL_SECONDARY_INTERPOLATOR_ATI)
- SETUP_SRC_REG(optype, i,
- machine->Inputs[ATI_FS_INPUT_SECONDARY]);
-
- apply_src_rep(optype, inst->SrcReg[optype][i].argRep,
- src[optype][i]);
- apply_src_mod(optype, inst->SrcReg[optype][i].argMod,
- src[optype][i]);
- }
- }
-
- /* Execute the operations - color then alpha */
- for (optype = 0; optype < 2; optype++) {
- if (inst->Opcode[optype]) {
- switch (inst->Opcode[optype]) {
- case GL_ADD_ATI:
- if (!optype)
- for (i = 0; i < 3; i++) {
- dst[optype][i] =
- src[optype][0][i] + src[optype][1][i];
- }
- else
- dst[optype][3] = src[optype][0][3] + src[optype][1][3];
- break;
- case GL_SUB_ATI:
- if (!optype)
- for (i = 0; i < 3; i++) {
- dst[optype][i] =
- src[optype][0][i] - src[optype][1][i];
- }
- else
- dst[optype][3] = src[optype][0][3] - src[optype][1][3];
- break;
- case GL_MUL_ATI:
- if (!optype)
- for (i = 0; i < 3; i++) {
- dst[optype][i] =
- src[optype][0][i] * src[optype][1][i];
- }
- else
- dst[optype][3] = src[optype][0][3] * src[optype][1][3];
- break;
- case GL_MAD_ATI:
- if (!optype)
- for (i = 0; i < 3; i++) {
- dst[optype][i] =
- src[optype][0][i] * src[optype][1][i] +
- src[optype][2][i];
- }
- else
- dst[optype][3] =
- src[optype][0][3] * src[optype][1][3] +
- src[optype][2][3];
- break;
- case GL_LERP_ATI:
- if (!optype)
- for (i = 0; i < 3; i++) {
- dst[optype][i] =
- src[optype][0][i] * src[optype][1][i] + (1 -
- src
- [optype]
- [0][i]) *
- src[optype][2][i];
- }
- else
- dst[optype][3] =
- src[optype][0][3] * src[optype][1][3] + (1 -
- src[optype]
- [0][3]) *
- src[optype][2][3];
- break;
-
- case GL_MOV_ATI:
- if (!optype)
- for (i = 0; i < 3; i++) {
- dst[optype][i] = src[optype][0][i];
- }
- else
- dst[optype][3] = src[optype][0][3];
- break;
- case GL_CND_ATI:
- if (!optype) {
- for (i = 0; i < 3; i++) {
- dst[optype][i] =
- (src[optype][2][i] >
- 0.5) ? src[optype][0][i] : src[optype][1][i];
- }
- }
- else {
- dst[optype][3] =
- (src[optype][2][3] >
- 0.5) ? src[optype][0][3] : src[optype][1][3];
- }
- break;
-
- case GL_CND0_ATI:
- if (!optype)
- for (i = 0; i < 3; i++) {
- dst[optype][i] =
- (src[optype][2][i] >=
- 0) ? src[optype][0][i] : src[optype][1][i];
- }
- else {
- dst[optype][3] =
- (src[optype][2][3] >=
- 0) ? src[optype][0][3] : src[optype][1][3];
- }
- break;
- case GL_DOT2_ADD_ATI:
- {
- GLfloat result;
-
- /* DOT 2 always uses the source from the color op */
- /* could save recalculation of dot products for alpha inst */
- result = src[0][0][0] * src[0][1][0] +
- src[0][0][1] * src[0][1][1] + src[0][2][2];
- if (!optype) {
- for (i = 0; i < 3; i++) {
- dst[optype][i] = result;
- }
- }
- else
- dst[optype][3] = result;
- }
- break;
- case GL_DOT3_ATI:
- {
- GLfloat result;
-
- /* DOT 3 always uses the source from the color op */
- result = src[0][0][0] * src[0][1][0] +
- src[0][0][1] * src[0][1][1] +
- src[0][0][2] * src[0][1][2];
-
- if (!optype) {
- for (i = 0; i < 3; i++) {
- dst[optype][i] = result;
- }
- }
- else
- dst[optype][3] = result;
- }
- break;
- case GL_DOT4_ATI:
- {
- GLfloat result;
-
- /* DOT 4 always uses the source from the color op */
- result = src[0][0][0] * src[0][1][0] +
- src[0][0][1] * src[0][1][1] +
- src[0][0][2] * src[0][1][2] +
- src[0][0][3] * src[0][1][3];
- if (!optype) {
- for (i = 0; i < 3; i++) {
- dst[optype][i] = result;
- }
- }
- else
- dst[optype][3] = result;
- }
- break;
-
- }
- }
- }
-
- /* write out the destination registers */
- for (optype = 0; optype < 2; optype++) {
- if (inst->Opcode[optype]) {
- dstreg = inst->DstReg[optype].Index;
- dstp = machine->Registers[dstreg - GL_REG_0_ATI];
-
- if ((optype == 0) || ((inst->Opcode[1] != GL_DOT2_ADD_ATI) &&
- (inst->Opcode[1] != GL_DOT3_ATI) && (inst->Opcode[1] != GL_DOT4_ATI)))
- write_dst_addr(optype, inst->DstReg[optype].dstMod,
- inst->DstReg[optype].dstMask, dst[optype],
- dstp);
- else
- write_dst_addr(1, inst->DstReg[0].dstMod, 0, dst[1], dstp);
- }
- }
- }
- }
-}
-
-
-/**
- * Init fragment shader virtual machine state.
- */
-static void
-init_machine(struct gl_context * ctx, struct atifs_machine *machine,
- const struct ati_fragment_shader *shader,
- const SWspan *span, GLuint col)
-{
- GLfloat (*inputs)[4] = machine->Inputs;
- GLint i, j;
-
- for (i = 0; i < 6; i++) {
- for (j = 0; j < 4; j++)
- machine->Registers[i][j] = 0.0;
- }
-
- COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]);
- COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]);
-}
-
-
-
-/**
- * Execute the current ATI shader program, operating on the given span.
- */
-void
-_swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span)
-{
- const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
- struct atifs_machine machine;
- GLuint i;
-
- /* incoming colors should be floats */
- ASSERT(span->array->ChanType == GL_FLOAT);
-
- for (i = 0; i < span->end; i++) {
- if (span->array->mask[i]) {
- init_machine(ctx, &machine, shader, span, i);
-
- execute_shader(ctx, shader, &machine, span, i);
-
- /* store result color */
- {
- const GLfloat *colOut = machine.Registers[0];
- /*fprintf(stderr,"outputs %f %f %f %f\n",
- colOut[0], colOut[1], colOut[2], colOut[3]); */
- COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut);
- }
- }
- }
-}
+/*
+ * Copyright (C) 2004 David Airlie 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
+ * DAVID AIRLIE 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.
+ */
+
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+#include "main/atifragshader.h"
+#include "swrast/s_atifragshader.h"
+#include "swrast/s_context.h"
+
+
+/**
+ * State for executing ATI fragment shader.
+ */
+struct atifs_machine
+{
+ GLfloat Registers[6][4]; /** six temporary registers */
+ GLfloat PrevPassRegisters[6][4];
+ GLfloat Inputs[2][4]; /** Primary, secondary input colors */
+};
+
+
+
+/**
+ * Fetch a texel.
+ */
+static void
+fetch_texel(struct gl_context * ctx, const GLfloat texcoord[4], GLfloat lambda,
+ GLuint unit, GLfloat color[4])
+{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+ /* XXX use a float-valued TextureSample routine here!!! */
+ swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
+ 1, (const GLfloat(*)[4]) texcoord,
+ &lambda, (GLfloat (*)[4]) color);
+}
+
+static void
+apply_swizzle(GLfloat values[4], GLuint swizzle)
+{
+ GLfloat s, t, r, q;
+
+ s = values[0];
+ t = values[1];
+ r = values[2];
+ q = values[3];
+
+ switch (swizzle) {
+ case GL_SWIZZLE_STR_ATI:
+ values[0] = s;
+ values[1] = t;
+ values[2] = r;
+ break;
+ case GL_SWIZZLE_STQ_ATI:
+ values[0] = s;
+ values[1] = t;
+ values[2] = q;
+ break;
+ case GL_SWIZZLE_STR_DR_ATI:
+ values[0] = s / r;
+ values[1] = t / r;
+ values[2] = 1 / r;
+ break;
+ case GL_SWIZZLE_STQ_DQ_ATI:
+/* make sure q is not 0 to avoid problems later with infinite values (texture lookup)? */
+ if (q == 0.0F)
+ q = 0.000000001F;
+ values[0] = s / q;
+ values[1] = t / q;
+ values[2] = 1.0F / q;
+ break;
+ }
+ values[3] = 0.0;
+}
+
+static void
+apply_src_rep(GLint optype, GLuint rep, GLfloat * val)
+{
+ GLint i;
+ GLint start, end;
+ if (!rep)
+ return;
+
+ start = optype ? 3 : 0;
+ end = 4;
+
+ for (i = start; i < end; i++) {
+ switch (rep) {
+ case GL_RED:
+ val[i] = val[0];
+ break;
+ case GL_GREEN:
+ val[i] = val[1];
+ break;
+ case GL_BLUE:
+ val[i] = val[2];
+ break;
+ case GL_ALPHA:
+ val[i] = val[3];
+ break;
+ }
+ }
+}
+
+static void
+apply_src_mod(GLint optype, GLuint mod, GLfloat * val)
+{
+ GLint i;
+ GLint start, end;
+
+ if (!mod)
+ return;
+
+ start = optype ? 3 : 0;
+ end = 4;
+
+ for (i = start; i < end; i++) {
+ if (mod & GL_COMP_BIT_ATI)
+ val[i] = 1 - val[i];
+
+ if (mod & GL_BIAS_BIT_ATI)
+ val[i] = val[i] - 0.5F;
+
+ if (mod & GL_2X_BIT_ATI)
+ val[i] = 2 * val[i];
+
+ if (mod & GL_NEGATE_BIT_ATI)
+ val[i] = -val[i];
+ }
+}
+
+static void
+apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val)
+{
+ GLint i;
+ GLint has_sat = mod & GL_SATURATE_BIT_ATI;
+ GLint start, end;
+
+ mod &= ~GL_SATURATE_BIT_ATI;
+
+ start = optype ? 3 : 0;
+ end = optype ? 4 : 3;
+
+ for (i = start; i < end; i++) {
+ switch (mod) {
+ case GL_2X_BIT_ATI:
+ val[i] = 2 * val[i];
+ break;
+ case GL_4X_BIT_ATI:
+ val[i] = 4 * val[i];
+ break;
+ case GL_8X_BIT_ATI:
+ val[i] = 8 * val[i];
+ break;
+ case GL_HALF_BIT_ATI:
+ val[i] = val[i] * 0.5F;
+ break;
+ case GL_QUARTER_BIT_ATI:
+ val[i] = val[i] * 0.25F;
+ break;
+ case GL_EIGHTH_BIT_ATI:
+ val[i] = val[i] * 0.125F;
+ break;
+ }
+
+ if (has_sat) {
+ if (val[i] < 0.0F)
+ val[i] = 0.0F;
+ else if (val[i] > 1.0F)
+ val[i] = 1.0F;
+ }
+ else {
+ if (val[i] < -8.0F)
+ val[i] = -8.0F;
+ else if (val[i] > 8.0F)
+ val[i] = 8.0F;
+ }
+ }
+}
+
+
+static void
+write_dst_addr(GLuint optype, GLuint mod, GLuint mask, GLfloat * src,
+ GLfloat * dst)
+{
+ GLint i;
+ apply_dst_mod(optype, mod, src);
+
+ if (optype == ATI_FRAGMENT_SHADER_COLOR_OP) {
+ if (mask) {
+ if (mask & GL_RED_BIT_ATI)
+ dst[0] = src[0];
+
+ if (mask & GL_GREEN_BIT_ATI)
+ dst[1] = src[1];
+
+ if (mask & GL_BLUE_BIT_ATI)
+ dst[2] = src[2];
+ }
+ else {
+ for (i = 0; i < 3; i++)
+ dst[i] = src[i];
+ }
+ }
+ else
+ dst[3] = src[3];
+}
+
+static void
+finish_pass(struct atifs_machine *machine)
+{
+ GLint i;
+
+ for (i = 0; i < 6; i++) {
+ COPY_4V(machine->PrevPassRegisters[i], machine->Registers[i]);
+ }
+}
+
+struct ati_fs_opcode_st ati_fs_opcodes[] = {
+ {GL_ADD_ATI, 2},
+ {GL_SUB_ATI, 2},
+ {GL_MUL_ATI, 2},
+ {GL_MAD_ATI, 3},
+ {GL_LERP_ATI, 3},
+ {GL_MOV_ATI, 1},
+ {GL_CND_ATI, 3},
+ {GL_CND0_ATI, 3},
+ {GL_DOT2_ADD_ATI, 3},
+ {GL_DOT3_ATI, 2},
+ {GL_DOT4_ATI, 2}
+};
+
+
+
+static void
+handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst,
+ const SWspan *span, GLuint column, GLuint idx)
+{
+ GLuint swizzle = texinst->swizzle;
+ GLuint pass_tex = texinst->src;
+
+ if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) {
+ pass_tex -= GL_TEXTURE0_ARB;
+ COPY_4V(machine->Registers[idx],
+ span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]);
+ }
+ else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) {
+ pass_tex -= GL_REG_0_ATI;
+ COPY_4V(machine->Registers[idx], machine->PrevPassRegisters[pass_tex]);
+ }
+ apply_swizzle(machine->Registers[idx], swizzle);
+
+}
+
+static void
+handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine,
+ struct atifs_setupinst *texinst, const SWspan *span,
+ GLuint column, GLuint idx)
+{
+/* sample from unit idx using texinst->src as coords */
+ GLuint swizzle = texinst->swizzle;
+ GLuint coord_source = texinst->src;
+ GLfloat tex_coords[4] = { 0 };
+
+ if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) {
+ coord_source -= GL_TEXTURE0_ARB;
+ COPY_4V(tex_coords,
+ span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]);
+ }
+ else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) {
+ coord_source -= GL_REG_0_ATI;
+ COPY_4V(tex_coords, machine->PrevPassRegisters[coord_source]);
+ }
+ apply_swizzle(tex_coords, swizzle);
+ fetch_texel(ctx, tex_coords, 0.0F, idx, machine->Registers[idx]);
+}
+
+#define SETUP_SRC_REG(optype, i, x) \
+do { \
+ COPY_4V(src[optype][i], x); \
+} while (0)
+
+
+
+/**
+ * Execute the given fragment shader.
+ * NOTE: we do everything in single-precision floating point
+ * \param ctx - rendering context
+ * \param shader - the shader to execute
+ * \param machine - virtual machine state
+ * \param span - the SWspan we're operating on
+ * \param column - which pixel [i] we're operating on in the span
+ */
+static void
+execute_shader(struct gl_context *ctx, const struct ati_fragment_shader *shader,
+ struct atifs_machine *machine, const SWspan *span,
+ GLuint column)
+{
+ GLuint pc;
+ struct atifs_instruction *inst;
+ struct atifs_setupinst *texinst;
+ GLint optype;
+ GLuint i;
+ GLint j, pass;
+ GLint dstreg;
+ GLfloat src[2][3][4];
+ GLfloat zeros[4] = { 0.0, 0.0, 0.0, 0.0 };
+ GLfloat ones[4] = { 1.0, 1.0, 1.0, 1.0 };
+ GLfloat dst[2][4], *dstp;
+
+ for (pass = 0; pass < shader->NumPasses; pass++) {
+ if (pass > 0)
+ finish_pass(machine);
+ for (j = 0; j < MAX_NUM_FRAGMENT_REGISTERS_ATI; j++) {
+ texinst = &shader->SetupInst[pass][j];
+ if (texinst->Opcode == ATI_FRAGMENT_SHADER_PASS_OP)
+ handle_pass_op(machine, texinst, span, column, j);
+ else if (texinst->Opcode == ATI_FRAGMENT_SHADER_SAMPLE_OP)
+ handle_sample_op(ctx, machine, texinst, span, column, j);
+ }
+
+ for (pc = 0; pc < shader->numArithInstr[pass]; pc++) {
+ inst = &shader->Instructions[pass][pc];
+
+ /* setup the source registers for color and alpha ops */
+ for (optype = 0; optype < 2; optype++) {
+ for (i = 0; i < inst->ArgCount[optype]; i++) {
+ GLint index = inst->SrcReg[optype][i].Index;
+
+ if (index >= GL_REG_0_ATI && index <= GL_REG_5_ATI)
+ SETUP_SRC_REG(optype, i,
+ machine->Registers[index - GL_REG_0_ATI]);
+ else if (index >= GL_CON_0_ATI && index <= GL_CON_7_ATI) {
+ if (shader->LocalConstDef & (1 << (index - GL_CON_0_ATI))) {
+ SETUP_SRC_REG(optype, i,
+ shader->Constants[index - GL_CON_0_ATI]);
+ } else {
+ SETUP_SRC_REG(optype, i,
+ ctx->ATIFragmentShader.GlobalConstants[index - GL_CON_0_ATI]);
+ }
+ }
+ else if (index == GL_ONE)
+ SETUP_SRC_REG(optype, i, ones);
+ else if (index == GL_ZERO)
+ SETUP_SRC_REG(optype, i, zeros);
+ else if (index == GL_PRIMARY_COLOR_EXT)
+ SETUP_SRC_REG(optype, i,
+ machine->Inputs[ATI_FS_INPUT_PRIMARY]);
+ else if (index == GL_SECONDARY_INTERPOLATOR_ATI)
+ SETUP_SRC_REG(optype, i,
+ machine->Inputs[ATI_FS_INPUT_SECONDARY]);
+
+ apply_src_rep(optype, inst->SrcReg[optype][i].argRep,
+ src[optype][i]);
+ apply_src_mod(optype, inst->SrcReg[optype][i].argMod,
+ src[optype][i]);
+ }
+ }
+
+ /* Execute the operations - color then alpha */
+ for (optype = 0; optype < 2; optype++) {
+ if (inst->Opcode[optype]) {
+ switch (inst->Opcode[optype]) {
+ case GL_ADD_ATI:
+ if (!optype)
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] =
+ src[optype][0][i] + src[optype][1][i];
+ }
+ else
+ dst[optype][3] = src[optype][0][3] + src[optype][1][3];
+ break;
+ case GL_SUB_ATI:
+ if (!optype)
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] =
+ src[optype][0][i] - src[optype][1][i];
+ }
+ else
+ dst[optype][3] = src[optype][0][3] - src[optype][1][3];
+ break;
+ case GL_MUL_ATI:
+ if (!optype)
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] =
+ src[optype][0][i] * src[optype][1][i];
+ }
+ else
+ dst[optype][3] = src[optype][0][3] * src[optype][1][3];
+ break;
+ case GL_MAD_ATI:
+ if (!optype)
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] =
+ src[optype][0][i] * src[optype][1][i] +
+ src[optype][2][i];
+ }
+ else
+ dst[optype][3] =
+ src[optype][0][3] * src[optype][1][3] +
+ src[optype][2][3];
+ break;
+ case GL_LERP_ATI:
+ if (!optype)
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] =
+ src[optype][0][i] * src[optype][1][i] + (1 -
+ src
+ [optype]
+ [0][i]) *
+ src[optype][2][i];
+ }
+ else
+ dst[optype][3] =
+ src[optype][0][3] * src[optype][1][3] + (1 -
+ src[optype]
+ [0][3]) *
+ src[optype][2][3];
+ break;
+
+ case GL_MOV_ATI:
+ if (!optype)
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] = src[optype][0][i];
+ }
+ else
+ dst[optype][3] = src[optype][0][3];
+ break;
+ case GL_CND_ATI:
+ if (!optype) {
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] =
+ (src[optype][2][i] >
+ 0.5) ? src[optype][0][i] : src[optype][1][i];
+ }
+ }
+ else {
+ dst[optype][3] =
+ (src[optype][2][3] >
+ 0.5) ? src[optype][0][3] : src[optype][1][3];
+ }
+ break;
+
+ case GL_CND0_ATI:
+ if (!optype)
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] =
+ (src[optype][2][i] >=
+ 0) ? src[optype][0][i] : src[optype][1][i];
+ }
+ else {
+ dst[optype][3] =
+ (src[optype][2][3] >=
+ 0) ? src[optype][0][3] : src[optype][1][3];
+ }
+ break;
+ case GL_DOT2_ADD_ATI:
+ {
+ GLfloat result;
+
+ /* DOT 2 always uses the source from the color op */
+ /* could save recalculation of dot products for alpha inst */
+ result = src[0][0][0] * src[0][1][0] +
+ src[0][0][1] * src[0][1][1] + src[0][2][2];
+ if (!optype) {
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] = result;
+ }
+ }
+ else
+ dst[optype][3] = result;
+ }
+ break;
+ case GL_DOT3_ATI:
+ {
+ GLfloat result;
+
+ /* DOT 3 always uses the source from the color op */
+ result = src[0][0][0] * src[0][1][0] +
+ src[0][0][1] * src[0][1][1] +
+ src[0][0][2] * src[0][1][2];
+
+ if (!optype) {
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] = result;
+ }
+ }
+ else
+ dst[optype][3] = result;
+ }
+ break;
+ case GL_DOT4_ATI:
+ {
+ GLfloat result;
+
+ /* DOT 4 always uses the source from the color op */
+ result = src[0][0][0] * src[0][1][0] +
+ src[0][0][1] * src[0][1][1] +
+ src[0][0][2] * src[0][1][2] +
+ src[0][0][3] * src[0][1][3];
+ if (!optype) {
+ for (i = 0; i < 3; i++) {
+ dst[optype][i] = result;
+ }
+ }
+ else
+ dst[optype][3] = result;
+ }
+ break;
+
+ }
+ }
+ }
+
+ /* write out the destination registers */
+ for (optype = 0; optype < 2; optype++) {
+ if (inst->Opcode[optype]) {
+ dstreg = inst->DstReg[optype].Index;
+ dstp = machine->Registers[dstreg - GL_REG_0_ATI];
+
+ if ((optype == 0) || ((inst->Opcode[1] != GL_DOT2_ADD_ATI) &&
+ (inst->Opcode[1] != GL_DOT3_ATI) && (inst->Opcode[1] != GL_DOT4_ATI)))
+ write_dst_addr(optype, inst->DstReg[optype].dstMod,
+ inst->DstReg[optype].dstMask, dst[optype],
+ dstp);
+ else
+ write_dst_addr(1, inst->DstReg[0].dstMod, 0, dst[1], dstp);
+ }
+ }
+ }
+ }
+}
+
+
+/**
+ * Init fragment shader virtual machine state.
+ */
+static void
+init_machine(struct gl_context * ctx, struct atifs_machine *machine,
+ const struct ati_fragment_shader *shader,
+ const SWspan *span, GLuint col)
+{
+ GLfloat (*inputs)[4] = machine->Inputs;
+ GLint i, j;
+
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 4; j++)
+ machine->Registers[i][j] = 0.0;
+ }
+
+ COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]);
+ COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]);
+}
+
+
+
+/**
+ * Execute the current ATI shader program, operating on the given span.
+ */
+void
+_swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span)
+{
+ const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
+ struct atifs_machine machine;
+ GLuint i;
+
+ /* incoming colors should be floats */
+ ASSERT(span->array->ChanType == GL_FLOAT);
+
+ for (i = 0; i < span->end; i++) {
+ if (span->array->mask[i]) {
+ init_machine(ctx, &machine, shader, span, i);
+
+ execute_shader(ctx, shader, &machine, span, i);
+
+ /* store result color */
+ {
+ const GLfloat *colOut = machine.Registers[0];
+ /*fprintf(stderr,"outputs %f %f %f %f\n",
+ colOut[0], colOut[1], colOut[2], colOut[3]); */
+ COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut);
+ }
+ }
+ }
+}
diff --git a/mesalib/src/mesa/swrast/s_atifragshader.h b/mesalib/src/mesa/swrast/s_atifragshader.h
index 16ed86fd7..10aaaa592 100644
--- a/mesalib/src/mesa/swrast/s_atifragshader.h
+++ b/mesalib/src/mesa/swrast/s_atifragshader.h
@@ -1,38 +1,38 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.1
- *
- * Copyright (C) 1999-2003 David Airlie 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
- * DAVID AIRLIE 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_ATIFRAGSHADER_H
-#define S_ATIFRAGSHADER_H
-
-
-#include "s_span.h"
-
-struct gl_context;
-
-extern void
-_swrast_exec_fragment_shader( struct gl_context *ctx, SWspan *span );
-
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2003 David Airlie 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
+ * DAVID AIRLIE 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_ATIFRAGSHADER_H
+#define S_ATIFRAGSHADER_H
+
+
+#include "s_span.h"
+
+struct gl_context;
+
+extern void
+_swrast_exec_fragment_shader( struct gl_context *ctx, SWspan *span );
+
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_blend.h b/mesalib/src/mesa/swrast/s_blend.h
index 8ecff52cf..69cd89e7a 100644
--- a/mesalib/src/mesa/swrast/s_blend.h
+++ b/mesalib/src/mesa/swrast/s_blend.h
@@ -1,45 +1,45 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * 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"),
- * 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_BLEND_H
-#define S_BLEND_H
-
-
-#include "main/glheader.h"
-#include "s_span.h"
-
-struct gl_context;
-struct gl_renderbuffer;
-
-
-extern void
-_swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span);
-
-
-extern void
-_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType);
-
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.2
+ *
+ * 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"),
+ * 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_BLEND_H
+#define S_BLEND_H
+
+
+#include "main/glheader.h"
+#include "s_span.h"
+
+struct gl_context;
+struct gl_renderbuffer;
+
+
+extern void
+_swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span);
+
+
+extern void
+_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType);
+
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_feedback.c b/mesalib/src/mesa/swrast/s_feedback.c
index e548bf9c3..00f92d463 100644
--- a/mesalib/src/mesa/swrast/s_feedback.c
+++ b/mesalib/src/mesa/swrast/s_feedback.c
@@ -1,138 +1,138 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.0
- *
- * Copyright (C) 1999-2007 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.
- */
-
-#include "main/glheader.h"
-#include "main/colormac.h"
-#include "main/feedback.h"
-#include "main/macros.h"
-
-#include "s_context.h"
-#include "s_feedback.h"
-#include "s_triangle.h"
-
-
-
-static void
-feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv)
-{
- GLfloat win[4];
- const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0];
- const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0];
-
- win[0] = v->attrib[FRAG_ATTRIB_WPOS][0];
- win[1] = v->attrib[FRAG_ATTRIB_WPOS][1];
- win[2] = v->attrib[FRAG_ATTRIB_WPOS][2] / ctx->DrawBuffer->_DepthMaxF;
- win[3] = 1.0F / v->attrib[FRAG_ATTRIB_WPOS][3];
-
- _mesa_feedback_vertex(ctx, win, color, vtc);
-}
-
-
-/*
- * Put triangle in feedback buffer.
- */
-void
-_swrast_feedback_triangle(struct gl_context *ctx, const SWvertex *v0,
- const SWvertex *v1, const SWvertex *v2)
-{
- if (!_swrast_culltriangle(ctx, v0, v1, v2)) {
- _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN);
- _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */
-
- if (ctx->Light.ShadeModel == GL_SMOOTH) {
- feedback_vertex(ctx, v0, v0);
- feedback_vertex(ctx, v1, v1);
- feedback_vertex(ctx, v2, v2);
- }
- else {
- feedback_vertex(ctx, v0, v2);
- feedback_vertex(ctx, v1, v2);
- feedback_vertex(ctx, v2, v2);
- }
- }
-}
-
-
-void
-_swrast_feedback_line(struct gl_context *ctx, const SWvertex *v0,
- const SWvertex *v1)
-{
- GLenum token = GL_LINE_TOKEN;
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- if (swrast->StippleCounter == 0)
- token = GL_LINE_RESET_TOKEN;
-
- _mesa_feedback_token(ctx, (GLfloat) (GLint) token);
-
- if (ctx->Light.ShadeModel == GL_SMOOTH) {
- feedback_vertex(ctx, v0, v0);
- feedback_vertex(ctx, v1, v1);
- }
- else {
- feedback_vertex(ctx, v0, v1);
- feedback_vertex(ctx, v1, v1);
- }
-
- swrast->StippleCounter++;
-}
-
-
-void
-_swrast_feedback_point(struct gl_context *ctx, const SWvertex *v)
-{
- _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN);
- feedback_vertex(ctx, v, v);
-}
-
-
-void
-_swrast_select_triangle(struct gl_context *ctx, const SWvertex *v0,
- const SWvertex *v1, const SWvertex *v2)
-{
- if (!_swrast_culltriangle(ctx, v0, v1, v2)) {
- const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
-
- _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs );
- _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs );
- _mesa_update_hitflag( ctx, v2->attrib[FRAG_ATTRIB_WPOS][2] * zs );
- }
-}
-
-
-void
-_swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1)
-{
- const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
- _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs );
- _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs );
-}
-
-
-void
-_swrast_select_point(struct gl_context *ctx, const SWvertex *v)
-{
- const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
- _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs );
-}
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.0
+ *
+ * Copyright (C) 1999-2007 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.
+ */
+
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/feedback.h"
+#include "main/macros.h"
+
+#include "s_context.h"
+#include "s_feedback.h"
+#include "s_triangle.h"
+
+
+
+static void
+feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv)
+{
+ GLfloat win[4];
+ const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0];
+ const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0];
+
+ win[0] = v->attrib[FRAG_ATTRIB_WPOS][0];
+ win[1] = v->attrib[FRAG_ATTRIB_WPOS][1];
+ win[2] = v->attrib[FRAG_ATTRIB_WPOS][2] / ctx->DrawBuffer->_DepthMaxF;
+ win[3] = 1.0F / v->attrib[FRAG_ATTRIB_WPOS][3];
+
+ _mesa_feedback_vertex(ctx, win, color, vtc);
+}
+
+
+/*
+ * Put triangle in feedback buffer.
+ */
+void
+_swrast_feedback_triangle(struct gl_context *ctx, const SWvertex *v0,
+ const SWvertex *v1, const SWvertex *v2)
+{
+ if (!_swrast_culltriangle(ctx, v0, v1, v2)) {
+ _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN);
+ _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */
+
+ if (ctx->Light.ShadeModel == GL_SMOOTH) {
+ feedback_vertex(ctx, v0, v0);
+ feedback_vertex(ctx, v1, v1);
+ feedback_vertex(ctx, v2, v2);
+ }
+ else {
+ feedback_vertex(ctx, v0, v2);
+ feedback_vertex(ctx, v1, v2);
+ feedback_vertex(ctx, v2, v2);
+ }
+ }
+}
+
+
+void
+_swrast_feedback_line(struct gl_context *ctx, const SWvertex *v0,
+ const SWvertex *v1)
+{
+ GLenum token = GL_LINE_TOKEN;
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+ if (swrast->StippleCounter == 0)
+ token = GL_LINE_RESET_TOKEN;
+
+ _mesa_feedback_token(ctx, (GLfloat) (GLint) token);
+
+ if (ctx->Light.ShadeModel == GL_SMOOTH) {
+ feedback_vertex(ctx, v0, v0);
+ feedback_vertex(ctx, v1, v1);
+ }
+ else {
+ feedback_vertex(ctx, v0, v1);
+ feedback_vertex(ctx, v1, v1);
+ }
+
+ swrast->StippleCounter++;
+}
+
+
+void
+_swrast_feedback_point(struct gl_context *ctx, const SWvertex *v)
+{
+ _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN);
+ feedback_vertex(ctx, v, v);
+}
+
+
+void
+_swrast_select_triangle(struct gl_context *ctx, const SWvertex *v0,
+ const SWvertex *v1, const SWvertex *v2)
+{
+ if (!_swrast_culltriangle(ctx, v0, v1, v2)) {
+ const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
+
+ _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs );
+ _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs );
+ _mesa_update_hitflag( ctx, v2->attrib[FRAG_ATTRIB_WPOS][2] * zs );
+ }
+}
+
+
+void
+_swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1)
+{
+ const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
+ _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs );
+ _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs );
+}
+
+
+void
+_swrast_select_point(struct gl_context *ctx, const SWvertex *v)
+{
+ const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
+ _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs );
+}
diff --git a/mesalib/src/mesa/swrast/s_feedback.h b/mesalib/src/mesa/swrast/s_feedback.h
index f0ca2c0e6..6bfd49735 100644
--- a/mesalib/src/mesa/swrast/s_feedback.h
+++ b/mesalib/src/mesa/swrast/s_feedback.h
@@ -1,50 +1,50 @@
-
-/*
- * 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_FEEDBACK_H
-#define S_FEEDBACK_H
-
-
-#include "swrast.h"
-
-
-extern void _swrast_feedback_point( struct gl_context *ctx, const SWvertex *v );
-
-extern void _swrast_feedback_line( struct gl_context *ctx,
- const SWvertex *v1, const SWvertex *v2 );
-
-extern void _swrast_feedback_triangle( struct gl_context *ctx, const SWvertex *v0,
- const SWvertex *v1, const SWvertex *v2 );
-
-extern void _swrast_select_point( struct gl_context *ctx, const SWvertex *v );
-
-extern void _swrast_select_line( struct gl_context *ctx,
- const SWvertex *v1, const SWvertex *v2 );
-
-extern void _swrast_select_triangle( struct gl_context *ctx, const SWvertex *v0,
- const SWvertex *v1, const SWvertex *v2 );
-
-#endif
+
+/*
+ * 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_FEEDBACK_H
+#define S_FEEDBACK_H
+
+
+#include "swrast.h"
+
+
+extern void _swrast_feedback_point( struct gl_context *ctx, const SWvertex *v );
+
+extern void _swrast_feedback_line( struct gl_context *ctx,
+ const SWvertex *v1, const SWvertex *v2 );
+
+extern void _swrast_feedback_triangle( struct gl_context *ctx, const SWvertex *v0,
+ const SWvertex *v1, const SWvertex *v2 );
+
+extern void _swrast_select_point( struct gl_context *ctx, const SWvertex *v );
+
+extern void _swrast_select_line( struct gl_context *ctx,
+ const SWvertex *v1, const SWvertex *v2 );
+
+extern void _swrast_select_triangle( struct gl_context *ctx, const SWvertex *v0,
+ const SWvertex *v1, const SWvertex *v2 );
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_fog.h b/mesalib/src/mesa/swrast/s_fog.h
index eed9b8bdd..9f93b7050 100644
--- a/mesalib/src/mesa/swrast/s_fog.h
+++ b/mesalib/src/mesa/swrast/s_fog.h
@@ -1,42 +1,42 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999-2002 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_FOG_H
-#define S_FOG_H
-
-
-#include "main/glheader.h"
-#include "s_span.h"
-
-struct gl_context;
-
-extern GLfloat
-_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z);
-
-extern void
-_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span );
-
-#endif
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ *
+ * Copyright (C) 1999-2002 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_FOG_H
+#define S_FOG_H
+
+
+#include "main/glheader.h"
+#include "s_span.h"
+
+struct gl_context;
+
+extern GLfloat
+_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z);
+
+extern void
+_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span );
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_lines.h b/mesalib/src/mesa/swrast/s_lines.h
index 0f95eecab..a4c98a855 100644
--- a/mesalib/src/mesa/swrast/s_lines.h
+++ b/mesalib/src/mesa/swrast/s_lines.h
@@ -1,41 +1,41 @@
-
-/*
- * 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_LINES_H
-#define S_LINES_H
-
-#include "swrast.h"
-
-void
-_swrast_choose_line( struct gl_context *ctx );
-
-void
-_swrast_add_spec_terms_line( struct gl_context *ctx,
- const SWvertex *v0,
- const SWvertex *v1 );
-
-
-#endif
+
+/*
+ * 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_LINES_H
+#define S_LINES_H
+
+#include "swrast.h"
+
+void
+_swrast_choose_line( struct gl_context *ctx );
+
+void
+_swrast_add_spec_terms_line( struct gl_context *ctx,
+ const SWvertex *v0,
+ const SWvertex *v1 );
+
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_logic.h b/mesalib/src/mesa/swrast/s_logic.h
index 39713b990..0a3adfca5 100644
--- a/mesalib/src/mesa/swrast/s_logic.h
+++ b/mesalib/src/mesa/swrast/s_logic.h
@@ -1,40 +1,40 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * 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"),
- * 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_LOGIC_H
-#define S_LOGIC_H
-
-
-#include "s_span.h"
-
-struct gl_context;
-struct gl_renderbuffer;
-
-extern void
-_swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
- SWspan *span);
-
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.2
+ *
+ * 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"),
+ * 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_LOGIC_H
+#define S_LOGIC_H
+
+
+#include "s_span.h"
+
+struct gl_context;
+struct gl_renderbuffer;
+
+extern void
+_swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
+ SWspan *span);
+
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_masking.h b/mesalib/src/mesa/swrast/s_masking.h
index 7ab02cc7a..5124509a0 100644
--- a/mesalib/src/mesa/swrast/s_masking.h
+++ b/mesalib/src/mesa/swrast/s_masking.h
@@ -1,41 +1,41 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * 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"),
- * 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_MASKING_H
-#define S_MASKING_H
-
-
-#include "main/glheader.h"
-#include "s_span.h"
-
-struct gl_context;
-struct gl_renderbuffer;
-
-
-extern void
-_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
- SWspan *span, GLuint buf);
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.2
+ *
+ * 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"),
+ * 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_MASKING_H
+#define S_MASKING_H
+
+
+#include "main/glheader.h"
+#include "s_span.h"
+
+struct gl_context;
+struct gl_renderbuffer;
+
+
+extern void
+_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
+ SWspan *span, GLuint buf);
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_points.h b/mesalib/src/mesa/swrast/s_points.h
index d99470bfe..0b6550e80 100644
--- a/mesalib/src/mesa/swrast/s_points.h
+++ b/mesalib/src/mesa/swrast/s_points.h
@@ -1,39 +1,39 @@
-
-/*
- * 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_POINTS_H
-#define S_POINTS_H
-
-#include "swrast.h"
-
-extern void
-_swrast_choose_point( struct gl_context *ctx );
-
-extern void
-_swrast_add_spec_terms_point( struct gl_context *ctx,
- const SWvertex *v0 );
-
-#endif
+
+/*
+ * 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_POINTS_H
+#define S_POINTS_H
+
+#include "swrast.h"
+
+extern void
+_swrast_choose_point( struct gl_context *ctx );
+
+extern void
+_swrast_add_spec_terms_point( struct gl_context *ctx,
+ const SWvertex *v0 );
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_texcombine.h b/mesalib/src/mesa/swrast/s_texcombine.h
index 3897acd69..11049d86b 100644
--- a/mesalib/src/mesa/swrast/s_texcombine.h
+++ b/mesalib/src/mesa/swrast/s_texcombine.h
@@ -1,37 +1,37 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2005 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_TEXCOMBINE_H
-#define S_TEXCOMBINE_H
-
-
-#include "s_span.h"
-
-struct gl_context;
-
-extern void
-_swrast_texture_span( struct gl_context *ctx, SWspan *span );
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 1999-2005 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_TEXCOMBINE_H
+#define S_TEXCOMBINE_H
+
+
+#include "s_span.h"
+
+struct gl_context;
+
+extern void
+_swrast_texture_span( struct gl_context *ctx, SWspan *span );
+
+#endif
diff --git a/mesalib/src/mesa/swrast/s_triangle.h b/mesalib/src/mesa/swrast/s_triangle.h
index bde5dd58b..46e23d420 100644
--- a/mesalib/src/mesa/swrast/s_triangle.h
+++ b/mesalib/src/mesa/swrast/s_triangle.h
@@ -1,50 +1,50 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 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_TRIANGLES_H
-#define S_TRIANGLES_H
-
-
-#include "swrast.h"
-
-
-extern GLboolean
-_swrast_culltriangle( struct gl_context *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2);
-
-extern void
-_swrast_choose_triangle( struct gl_context *ctx );
-
-extern void
-_swrast_add_spec_terms_triangle( struct gl_context *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2 );
-
-
-#endif
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.1
+ *
+ * Copyright (C) 1999-2003 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_TRIANGLES_H
+#define S_TRIANGLES_H
+
+
+#include "swrast.h"
+
+
+extern GLboolean
+_swrast_culltriangle( struct gl_context *ctx,
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2);
+
+extern void
+_swrast_choose_triangle( struct gl_context *ctx );
+
+extern void
+_swrast_add_spec_terms_triangle( struct gl_context *ctx,
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 );
+
+
+#endif