aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/swrast')
-rw-r--r--mesalib/src/mesa/swrast/s_aaline.c50
-rw-r--r--mesalib/src/mesa/swrast/s_aalinetemp.h32
-rw-r--r--mesalib/src/mesa/swrast/s_aatriangle.c102
-rw-r--r--mesalib/src/mesa/swrast/s_aatritemp.h60
-rw-r--r--mesalib/src/mesa/swrast/s_accum.c19
-rw-r--r--mesalib/src/mesa/swrast/s_alpha.c4
-rw-r--r--mesalib/src/mesa/swrast/s_atifragshader.c30
-rw-r--r--mesalib/src/mesa/swrast/s_bitmap.c20
-rw-r--r--mesalib/src/mesa/swrast/s_blend.c2
-rw-r--r--mesalib/src/mesa/swrast/s_blit.c36
-rw-r--r--mesalib/src/mesa/swrast/s_clear.c149
-rw-r--r--mesalib/src/mesa/swrast/s_context.c53
-rw-r--r--mesalib/src/mesa/swrast/s_copypix.c167
-rw-r--r--mesalib/src/mesa/swrast/s_depth.c60
-rw-r--r--mesalib/src/mesa/swrast/s_drawpix.c98
-rw-r--r--mesalib/src/mesa/swrast/s_feedback.c3
-rw-r--r--mesalib/src/mesa/swrast/s_fog.c97
-rw-r--r--mesalib/src/mesa/swrast/s_fog.h4
-rw-r--r--mesalib/src/mesa/swrast/s_fragprog.c16
-rw-r--r--mesalib/src/mesa/swrast/s_lines.c51
-rw-r--r--mesalib/src/mesa/swrast/s_linetemp.h19
-rw-r--r--mesalib/src/mesa/swrast/s_logic.c27
-rw-r--r--mesalib/src/mesa/swrast/s_logic.h6
-rw-r--r--mesalib/src/mesa/swrast/s_masking.c51
-rw-r--r--mesalib/src/mesa/swrast/s_masking.h7
-rw-r--r--mesalib/src/mesa/swrast/s_points.c69
-rw-r--r--mesalib/src/mesa/swrast/s_readpix.c96
-rw-r--r--mesalib/src/mesa/swrast/s_span.c476
-rw-r--r--mesalib/src/mesa/swrast/s_span.h20
-rw-r--r--mesalib/src/mesa/swrast/s_spantemp.h16
-rw-r--r--mesalib/src/mesa/swrast/s_stencil.c12
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.c23
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c69
-rw-r--r--mesalib/src/mesa/swrast/s_triangle.c29
-rw-r--r--mesalib/src/mesa/swrast/s_tritemp.h50
-rw-r--r--mesalib/src/mesa/swrast/s_zoom.c52
-rw-r--r--mesalib/src/mesa/swrast/s_zoom.h4
-rw-r--r--mesalib/src/mesa/swrast/swrast.h6
38 files changed, 418 insertions, 1667 deletions
diff --git a/mesalib/src/mesa/swrast/s_aaline.c b/mesalib/src/mesa/swrast/s_aaline.c
index 9bfa8f2e6..6ba4604e6 100644
--- a/mesalib/src/mesa/swrast/s_aaline.c
+++ b/mesalib/src/mesa/swrast/s_aaline.c
@@ -59,10 +59,8 @@ struct LineInfo
/* DO_Z */
GLfloat zPlane[4];
- /* DO_RGBA */
+ /* DO_RGBA - always enabled */
GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4];
- /* DO_INDEX */
- GLfloat iPlane[4];
/* DO_ATTRIBS */
GLfloat wPlane[4];
GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4];
@@ -325,20 +323,6 @@ compute_coveragef(const struct LineInfo *info,
}
-/**
- * Compute coverage value for color index mode.
- * XXX this may not be quite correct.
- * \return coverage in [0,15].
- */
-static GLfloat
-compute_coveragei(const struct LineInfo *info,
- GLint winx, GLint winy)
-{
- return compute_coveragef(info, winx, winy) * 15.0F;
-}
-
-
-
typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line,
int ix, int iy);
@@ -475,22 +459,13 @@ segment(GLcontext *ctx,
}
-#define NAME(x) aa_ci_##x
-#define DO_Z
-#define DO_ATTRIBS /* for fog */
-#define DO_INDEX
-#include "s_aalinetemp.h"
-
-
#define NAME(x) aa_rgba_##x
#define DO_Z
-#define DO_RGBA
#include "s_aalinetemp.h"
#define NAME(x) aa_general_rgba_##x
#define DO_Z
-#define DO_RGBA
#define DO_ATTRIBS
#include "s_aalinetemp.h"
@@ -503,22 +478,15 @@ _swrast_choose_aa_line_function(GLcontext *ctx)
ASSERT(ctx->Line.SmoothFlag);
- if (ctx->Visual.rgbMode) {
- /* RGBA */
- if (ctx->Texture._EnabledCoordUnits != 0
- || ctx->FragmentProgram._Current
- || (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
- || ctx->Fog.ColorSumEnabled
- || swrast->_FogEnabled) {
- swrast->Line = aa_general_rgba_line;
- }
- else {
- swrast->Line = aa_rgba_line;
- }
+ if (ctx->Texture._EnabledCoordUnits != 0
+ || ctx->FragmentProgram._Current
+ || (ctx->Light.Enabled &&
+ ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
+ || ctx->Fog.ColorSumEnabled
+ || swrast->_FogEnabled) {
+ swrast->Line = aa_general_rgba_line;
}
else {
- /* Color Index */
- swrast->Line = aa_ci_line;
+ swrast->Line = aa_rgba_line;
}
}
diff --git a/mesalib/src/mesa/swrast/s_aalinetemp.h b/mesalib/src/mesa/swrast/s_aalinetemp.h
index 42ffe9f20..c28d47a67 100644
--- a/mesalib/src/mesa/swrast/s_aalinetemp.h
+++ b/mesalib/src/mesa/swrast/s_aalinetemp.h
@@ -39,11 +39,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat fx = (GLfloat) ix;
const GLfloat fy = (GLfloat) iy;
-#ifdef DO_INDEX
- const GLfloat coverage = compute_coveragei(line, ix, iy);
-#else
const GLfloat coverage = compute_coveragef(line, ix, iy);
-#endif
const GLuint i = line->span.end;
(void) swrast;
@@ -63,15 +59,10 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
#ifdef DO_Z
line->span.array->z[i] = (GLuint) solve_plane(fx, fy, line->zPlane);
#endif
-#ifdef DO_RGBA
line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane);
line->span.array->rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane);
line->span.array->rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane);
line->span.array->rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane);
-#endif
-#ifdef DO_INDEX
- line->span.array->index[i] = (GLint) solve_plane(fx, fy, line->iPlane);
-#endif
#if defined(DO_ATTRIBS)
ATTRIB_LOOP_BEGIN
GLfloat (*attribArray)[4] = line->span.array->attribs[attr];
@@ -101,11 +92,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
#endif
if (line->span.end == MAX_WIDTH) {
-#if defined(DO_RGBA)
_swrast_write_rgba_span(ctx, &(line->span));
-#else
- _swrast_write_index_span(ctx, &(line->span));
-#endif
line->span.end = 0; /* reset counter */
}
}
@@ -150,7 +137,6 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
compute_plane(line.x0, line.y0, line.x1, line.y1,
v0->attrib[FRAG_ATTRIB_WPOS][2], v1->attrib[FRAG_ATTRIB_WPOS][2], line.zPlane);
#endif
-#ifdef DO_RGBA
line.span.arrayMask |= SPAN_RGBA;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
compute_plane(line.x0, line.y0, line.x1, line.y1,
@@ -168,18 +154,6 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
constant_plane(v1->color[BCOMP], line.bPlane);
constant_plane(v1->color[ACOMP], line.aPlane);
}
-#endif
-#ifdef DO_INDEX
- line.span.arrayMask |= SPAN_INDEX;
- if (ctx->Light.ShadeModel == GL_SMOOTH) {
- compute_plane(line.x0, line.y0, line.x1, line.y1,
- v0->attrib[FRAG_ATTRIB_CI][0],
- v1->attrib[FRAG_ATTRIB_CI][0], line.iPlane);
- }
- else {
- constant_plane(v1->attrib[FRAG_ATTRIB_CI][0], line.iPlane);
- }
-#endif
#if defined(DO_ATTRIBS)
{
const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3];
@@ -257,18 +231,12 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
segment(ctx, &line, NAME(plot), 0.0, 1.0);
}
-#if defined(DO_RGBA)
_swrast_write_rgba_span(ctx, &(line.span));
-#else
- _swrast_write_index_span(ctx, &(line.span));
-#endif
}
#undef DO_Z
-#undef DO_RGBA
-#undef DO_INDEX
#undef DO_ATTRIBS
#undef NAME
diff --git a/mesalib/src/mesa/swrast/s_aatriangle.c b/mesalib/src/mesa/swrast/s_aatriangle.c
index 078f16aea..1d90f322a 100644
--- a/mesalib/src/mesa/swrast/s_aatriangle.c
+++ b/mesalib/src/mesa/swrast/s_aatriangle.c
@@ -268,88 +268,6 @@ compute_coveragef(const GLfloat v0[3], const GLfloat v1[3],
-/*
- * Compute how much (area) of the given pixel is inside the triangle.
- * Vertices MUST be specified in counter-clockwise order.
- * Return: coverage in [0, 15].
- */
-static GLint
-compute_coveragei(const GLfloat v0[3], const GLfloat v1[3],
- const GLfloat v2[3], GLint winx, GLint winy)
-{
- /* NOTE: 15 samples instead of 16. */
- static const GLfloat samples[15][2] = {
- /* start with the four corners */
- { POS(0, 2), POS(0, 0) },
- { POS(3, 3), POS(0, 2) },
- { POS(0, 0), POS(3, 1) },
- { POS(3, 1), POS(3, 3) },
- /* continue with interior samples */
- { POS(1, 1), POS(0, 1) },
- { POS(2, 0), POS(0, 3) },
- { POS(0, 3), POS(1, 3) },
- { POS(1, 2), POS(1, 0) },
- { POS(2, 3), POS(1, 2) },
- { POS(3, 2), POS(1, 1) },
- { POS(0, 1), POS(2, 2) },
- { POS(1, 0), POS(2, 1) },
- { POS(2, 1), POS(2, 3) },
- { POS(3, 0), POS(2, 0) },
- { POS(1, 3), POS(3, 0) }
- };
- const GLfloat x = (GLfloat) winx;
- const GLfloat y = (GLfloat) winy;
- const GLfloat dx0 = v1[0] - v0[0];
- const GLfloat dy0 = v1[1] - v0[1];
- const GLfloat dx1 = v2[0] - v1[0];
- const GLfloat dy1 = v2[1] - v1[1];
- const GLfloat dx2 = v0[0] - v2[0];
- const GLfloat dy2 = v0[1] - v2[1];
- GLint stop = 4, i;
- GLint insideCount = 15;
-
-#ifdef DEBUG
- {
- const GLfloat area = dx0 * dy1 - dx1 * dy0;
- ASSERT(area >= 0.0);
- }
-#endif
-
- for (i = 0; i < stop; i++) {
- const GLfloat sx = x + samples[i][0];
- const GLfloat sy = y + samples[i][1];
- const GLfloat fx0 = sx - v0[0];
- const GLfloat fy0 = sy - v0[1];
- const GLfloat fx1 = sx - v1[0];
- const GLfloat fy1 = sy - v1[1];
- const GLfloat fx2 = sx - v2[0];
- const GLfloat fy2 = sy - v2[1];
- /* cross product determines if sample is inside or outside each edge */
- GLfloat cross0 = (dx0 * fy0 - dy0 * fx0);
- GLfloat cross1 = (dx1 * fy1 - dy1 * fx1);
- GLfloat cross2 = (dx2 * fy2 - dy2 * fx2);
- /* Check if the sample is exactly on an edge. If so, let cross be a
- * positive or negative value depending on the direction of the edge.
- */
- if (cross0 == 0.0F)
- cross0 = dx0 + dy0;
- if (cross1 == 0.0F)
- cross1 = dx1 + dy1;
- if (cross2 == 0.0F)
- cross2 = dx2 + dy2;
- if (cross0 < 0.0F || cross1 < 0.0F || cross2 < 0.0F) {
- /* point is outside triangle */
- insideCount--;
- stop = 15;
- }
- }
- if (stop == 4)
- return 15;
- else
- return insideCount;
-}
-
-
static void
rgba_aa_tri(GLcontext *ctx,
const SWvertex *v0,
@@ -357,20 +275,6 @@ rgba_aa_tri(GLcontext *ctx,
const SWvertex *v2)
{
#define DO_Z
-#define DO_RGBA
-#include "s_aatritemp.h"
-}
-
-
-static void
-index_aa_tri(GLcontext *ctx,
- const SWvertex *v0,
- const SWvertex *v1,
- const SWvertex *v2)
-{
-#define DO_Z
-#define DO_ATTRIBS
-#define DO_INDEX
#include "s_aatritemp.h"
}
@@ -382,7 +286,6 @@ general_aa_tri(GLcontext *ctx,
const SWvertex *v2)
{
#define DO_Z
-#define DO_RGBA
#define DO_ATTRIBS
#include "s_aatritemp.h"
}
@@ -406,11 +309,8 @@ _swrast_set_aa_triangle_function(GLcontext *ctx)
|| NEED_SECONDARY_COLOR(ctx)) {
SWRAST_CONTEXT(ctx)->Triangle = general_aa_tri;
}
- else if (ctx->Visual.rgbMode) {
- SWRAST_CONTEXT(ctx)->Triangle = rgba_aa_tri;
- }
else {
- SWRAST_CONTEXT(ctx)->Triangle = index_aa_tri;
+ SWRAST_CONTEXT(ctx)->Triangle = rgba_aa_tri;
}
ASSERT(SWRAST_CONTEXT(ctx)->Triangle);
diff --git a/mesalib/src/mesa/swrast/s_aatritemp.h b/mesalib/src/mesa/swrast/s_aatritemp.h
index 0827b3db9..5c1c6d904 100644
--- a/mesalib/src/mesa/swrast/s_aatritemp.h
+++ b/mesalib/src/mesa/swrast/s_aatritemp.h
@@ -33,8 +33,6 @@
* The following macros may be defined to indicate what auxillary information
* must be copmuted across the triangle:
* DO_Z - if defined, compute Z values
- * DO_RGBA - if defined, compute RGBA values
- * DO_INDEX - if defined, compute color index values
* DO_ATTRIBS - if defined, compute texcoords, varying, etc.
*/
@@ -55,12 +53,7 @@
#ifdef DO_Z
GLfloat zPlane[4];
#endif
-#ifdef DO_RGBA
GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4];
-#endif
-#ifdef DO_INDEX
- GLfloat iPlane[4];
-#endif
#if defined(DO_ATTRIBS)
GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4];
GLfloat wPlane[4]; /* win[3] */
@@ -126,7 +119,6 @@
compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane);
span.arrayMask |= SPAN_Z;
#endif
-#ifdef DO_RGBA
if (ctx->Light.ShadeModel == GL_SMOOTH) {
compute_plane(p0, p1, p2, v0->color[RCOMP], v1->color[RCOMP], v2->color[RCOMP], rPlane);
compute_plane(p0, p1, p2, v0->color[GCOMP], v1->color[GCOMP], v2->color[GCOMP], gPlane);
@@ -140,17 +132,6 @@
constant_plane(v2->color[ACOMP], aPlane);
}
span.arrayMask |= SPAN_RGBA;
-#endif
-#ifdef DO_INDEX
- if (ctx->Light.ShadeModel == GL_SMOOTH) {
- compute_plane(p0, p1, p2, (GLfloat) v0->attrib[FRAG_ATTRIB_CI][0],
- v1->attrib[FRAG_ATTRIB_CI][0], v2->attrib[FRAG_ATTRIB_CI][0], iPlane);
- }
- else {
- constant_plane(v2->attrib[FRAG_ATTRIB_CI][0], iPlane);
- }
- span.arrayMask |= SPAN_INDEX;
-#endif
#if defined(DO_ATTRIBS)
{
const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3];
@@ -220,11 +201,11 @@
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5, iy + 0.5, wPlane);
+ span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
- span.attrStart[attr][c] = solve_plane(ix + 0.5, iy + 0.5, attrPlane[attr][c]);
+ span.attrStart[attr][c] = solve_plane(ix + 0.5F, iy + 0.5F, attrPlane[attr][c]);
}
ATTRIB_LOOP_END
#endif
@@ -234,23 +215,14 @@
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
SWspanarrays *array = span.array;
-#ifdef DO_INDEX
- array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
-#else
array->coverage[count] = coverage;
-#endif
#ifdef DO_Z
array->z[count] = (GLuint) solve_plane(cx, cy, zPlane);
#endif
-#ifdef DO_RGBA
array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
array->rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane);
array->rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane);
array->rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane);
-#endif
-#ifdef DO_INDEX
- array->index[count] = (GLint) solve_plane(cx, cy, iPlane);
-#endif
ix++;
count++;
coverage = compute_coveragef(pMin, pMid, pMax, ix, iy);
@@ -262,11 +234,7 @@
span.x = startX;
span.y = iy;
span.end = (GLuint) ix - (GLuint) startX;
-#if defined(DO_RGBA)
_swrast_write_rgba_span(ctx, &span);
-#else
- _swrast_write_index_span(ctx, &span);
-#endif
}
}
else {
@@ -304,23 +272,14 @@
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
SWspanarrays *array = span.array;
ASSERT(ix >= 0);
-#ifdef DO_INDEX
- array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
-#else
array->coverage[ix] = coverage;
-#endif
#ifdef DO_Z
array->z[ix] = (GLuint) solve_plane(cx, cy, zPlane);
#endif
-#ifdef DO_RGBA
array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
array->rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane);
array->rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane);
array->rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane);
-#endif
-#ifdef DO_INDEX
- array->index[ix] = (GLint) solve_plane(cx, cy, iPlane);
-#endif
ix--;
count++;
coverage = compute_coveragef(pMin, pMax, pMid, ix, iy);
@@ -328,11 +287,11 @@
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5, iy + 0.5, wPlane);
+ span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
- span.attrStart[attr][c] = solve_plane(ix + 1.5, iy + 0.5, attrPlane[attr][c]);
+ span.attrStart[attr][c] = solve_plane(ix + 1.5F, iy + 0.5F, attrPlane[attr][c]);
}
ATTRIB_LOOP_END
#endif
@@ -351,12 +310,7 @@
GLint j;
for (j = 0; j < (GLint) n; j++) {
array->coverage[j] = array->coverage[j + left];
-#ifdef DO_RGBA
COPY_CHAN4(array->rgba[j], array->rgba[j + left]);
-#endif
-#ifdef DO_INDEX
- array->index[j] = array->index[j + left];
-#endif
#ifdef DO_Z
array->z[j] = array->z[j + left];
#endif
@@ -366,18 +320,12 @@
span.x = left;
span.y = iy;
span.end = n;
-#if defined(DO_RGBA)
_swrast_write_rgba_span(ctx, &span);
-#else
- _swrast_write_index_span(ctx, &span);
-#endif
}
}
}
#undef DO_Z
-#undef DO_RGBA
-#undef DO_INDEX
#undef DO_ATTRIBS
#undef DO_OCCLUSION_TEST
diff --git a/mesalib/src/mesa/swrast/s_accum.c b/mesalib/src/mesa/swrast/s_accum.c
index c6c7dbf5c..854e106b7 100644
--- a/mesalib/src/mesa/swrast/s_accum.c
+++ b/mesalib/src/mesa/swrast/s_accum.c
@@ -27,7 +27,6 @@
#include "main/context.h"
#include "main/macros.h"
#include "main/imports.h"
-#include "main/fbobject.h"
#include "s_accum.h"
#include "s_context.h"
@@ -38,7 +37,7 @@
/* XXX this would have to change for accum buffers with more or less
* than 16 bits per color channel.
*/
-#define ACCUM_SCALE16 32767.0
+#define ACCUM_SCALE16 32767.0F
/*
@@ -131,11 +130,7 @@ _swrast_clear_accum_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint x, y, width, height;
- if (ctx->Visual.accumRedBits == 0) {
- /* No accumulation buffer! Not an error. */
- return;
- }
-
+ /* No accumulation buffer! Not an error. */
if (!rb || !rb->Data)
return;
@@ -436,10 +431,6 @@ accum_return(GLcontext *ctx, GLfloat value,
struct gl_renderbuffer *accumRb = fb->Attachment[BUFFER_ACCUM].Renderbuffer;
const GLboolean directAccess
= (accumRb->GetPointer(ctx, accumRb, 0, 0) != NULL);
- const GLboolean masking = (!ctx->Color.ColorMask[RCOMP] ||
- !ctx->Color.ColorMask[GCOMP] ||
- !ctx->Color.ColorMask[BCOMP] ||
- !ctx->Color.ColorMask[ACOMP]);
static GLchan multTable[32768];
static GLfloat prevMult = 0.0;
@@ -527,8 +518,12 @@ accum_return(GLcontext *ctx, GLfloat value,
/* store colors */
for (buffer = 0; buffer < fb->_NumColorDrawBuffers; buffer++) {
struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buffer];
+ const GLboolean masking = (!ctx->Color.ColorMask[buffer][RCOMP] ||
+ !ctx->Color.ColorMask[buffer][GCOMP] ||
+ !ctx->Color.ColorMask[buffer][BCOMP] ||
+ !ctx->Color.ColorMask[buffer][ACOMP]);
if (masking) {
- _swrast_mask_rgba_span(ctx, rb, &span);
+ _swrast_mask_rgba_span(ctx, rb, &span, buffer);
}
rb->PutRow(ctx, rb, width, xpos, ypos + i, span.array->rgba, NULL);
}
diff --git a/mesalib/src/mesa/swrast/s_alpha.c b/mesalib/src/mesa/swrast/s_alpha.c
index 5761bb00b..509477433 100644
--- a/mesalib/src/mesa/swrast/s_alpha.c
+++ b/mesalib/src/mesa/swrast/s_alpha.c
@@ -146,8 +146,8 @@ _swrast_alpha_test(const GLcontext *ctx, SWspan *span)
ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
}
else {
- const GLfloat alphaStep = span->alphaStep;
- GLfloat alpha = span->alpha;
+ const GLfloat alphaStep = FixedToFloat(span->alphaStep);
+ GLfloat alpha = FixedToFloat(span->alpha);
const GLfloat ref = ctx->Color.AlphaRef;
ALPHA_TEST(alpha, alpha += alphaStep);
}
diff --git a/mesalib/src/mesa/swrast/s_atifragshader.c b/mesalib/src/mesa/swrast/s_atifragshader.c
index e88ff1912..0f06cdf9f 100644
--- a/mesalib/src/mesa/swrast/s_atifragshader.c
+++ b/mesalib/src/mesa/swrast/s_atifragshader.c
@@ -23,7 +23,6 @@
#include "main/colormac.h"
#include "main/context.h"
#include "main/macros.h"
-#include "shader/program.h"
#include "shader/atifragshader.h"
#include "swrast/s_atifragshader.h"
@@ -83,10 +82,11 @@ apply_swizzle(GLfloat values[4], GLuint swizzle)
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.000000001;
+ if (q == 0.0F)
+ q = 0.000000001F;
values[0] = s / q;
values[1] = t / q;
- values[2] = 1 / q;
+ values[2] = 1.0F / q;
break;
}
values[3] = 0.0;
@@ -138,7 +138,7 @@ apply_src_mod(GLint optype, GLuint mod, GLfloat * val)
val[i] = 1 - val[i];
if (mod & GL_BIAS_BIT_ATI)
- val[i] = val[i] - 0.5;
+ val[i] = val[i] - 0.5F;
if (mod & GL_2X_BIT_ATI)
val[i] = 2 * val[i];
@@ -172,27 +172,27 @@ apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val)
val[i] = 8 * val[i];
break;
case GL_HALF_BIT_ATI:
- val[i] = val[i] * 0.5;
+ val[i] = val[i] * 0.5F;
break;
case GL_QUARTER_BIT_ATI:
- val[i] = val[i] * 0.25;
+ val[i] = val[i] * 0.25F;
break;
case GL_EIGHTH_BIT_ATI:
- val[i] = val[i] * 0.125;
+ val[i] = val[i] * 0.125F;
break;
}
if (has_sat) {
- if (val[i] < 0.0)
- val[i] = 0;
- else if (val[i] > 1.0)
- val[i] = 1.0;
+ if (val[i] < 0.0F)
+ val[i] = 0.0F;
+ else if (val[i] > 1.0F)
+ val[i] = 1.0F;
}
else {
- if (val[i] < -8.0)
- val[i] = -8.0;
- else if (val[i] > 8.0)
- val[i] = 8.0;
+ if (val[i] < -8.0F)
+ val[i] = -8.0F;
+ else if (val[i] > 8.0F)
+ val[i] = 8.0F;
}
}
}
diff --git a/mesalib/src/mesa/swrast/s_bitmap.c b/mesalib/src/mesa/swrast/s_bitmap.c
index 3dbdf2a61..da730213a 100644
--- a/mesalib/src/mesa/swrast/s_bitmap.c
+++ b/mesalib/src/mesa/swrast/s_bitmap.c
@@ -30,9 +30,9 @@
#include "main/glheader.h"
#include "main/bufferobj.h"
+#include "main/condrender.h"
#include "main/image.h"
#include "main/macros.h"
-#include "main/pixel.h"
#include "s_context.h"
#include "s_span.h"
@@ -56,6 +56,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
ASSERT(ctx->RenderMode == GL_RENDER);
+ if (!_mesa_check_conditional_render(ctx))
+ return; /* don't draw */
+
bitmap = (const GLubyte *) _mesa_map_pbo_source(ctx, unpack, bitmap);
if (!bitmap)
return;
@@ -122,10 +125,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
if (count + width >= MAX_WIDTH || row + 1 == height) {
/* flush the span */
span.end = count;
- if (ctx->Visual.rgbMode)
- _swrast_write_rgba_span(ctx, &span);
- else
- _swrast_write_index_span(ctx, &span);
+ _swrast_write_rgba_span(ctx, &span);
span.end = 0;
count = 0;
}
@@ -189,10 +189,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
}
}
- if (ctx->Visual.rgbMode)
- _swrast_write_rgba_span(ctx, &span);
- else
- _swrast_write_index_span(ctx, &span);
+ _swrast_write_rgba_span(ctx, &span);
/* get ready for next row */
if (mask != 1)
@@ -212,10 +209,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
}
}
- if (ctx->Visual.rgbMode)
- _swrast_write_rgba_span(ctx, &span);
- else
- _swrast_write_index_span(ctx, &span);
+ _swrast_write_rgba_span(ctx, &span);
/* get ready for next row */
if (mask != 128)
diff --git a/mesalib/src/mesa/swrast/s_blend.c b/mesalib/src/mesa/swrast/s_blend.c
index 95c83432a..5b090c72c 100644
--- a/mesalib/src/mesa/swrast/s_blend.c
+++ b/mesalib/src/mesa/swrast/s_blend.c
@@ -89,7 +89,7 @@ blend_noop(GLcontext *ctx, GLuint n, const GLubyte mask[],
else
bytes = 4 * n * sizeof(GLfloat);
- _mesa_memcpy(src, dst, bytes);
+ memcpy(src, dst, bytes);
}
diff --git a/mesalib/src/mesa/swrast/s_blit.c b/mesalib/src/mesa/swrast/s_blit.c
index 8303e4deb..753f3136f 100644
--- a/mesalib/src/mesa/swrast/s_blit.c
+++ b/mesalib/src/mesa/swrast/s_blit.c
@@ -24,6 +24,7 @@
#include "main/glheader.h"
+#include "main/condrender.h"
#include "main/image.h"
#include "main/macros.h"
#include "s_context.h"
@@ -197,14 +198,14 @@ blit_nearest(GLcontext *ctx,
}
/* allocate the src/dst row buffers */
- srcBuffer = _mesa_malloc(pixelSize * srcWidth);
+ srcBuffer = malloc(pixelSize * srcWidth);
if (!srcBuffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
- dstBuffer = _mesa_malloc(pixelSize * dstWidth);
+ dstBuffer = malloc(pixelSize * dstWidth);
if (!dstBuffer) {
- _mesa_free(srcBuffer);
+ free(srcBuffer);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
@@ -234,8 +235,8 @@ blit_nearest(GLcontext *ctx,
drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL);
}
- _mesa_free(srcBuffer);
- _mesa_free(dstBuffer);
+ free(srcBuffer);
+ free(dstBuffer);
}
@@ -365,21 +366,21 @@ blit_linear(GLcontext *ctx,
/* Allocate the src/dst row buffers.
* Keep two adjacent src rows around for bilinear sampling.
*/
- srcBuffer0 = _mesa_malloc(pixelSize * srcWidth);
+ srcBuffer0 = malloc(pixelSize * srcWidth);
if (!srcBuffer0) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
- srcBuffer1 = _mesa_malloc(pixelSize * srcWidth);
+ srcBuffer1 = malloc(pixelSize * srcWidth);
if (!srcBuffer1) {
- _mesa_free(srcBuffer0);
+ free(srcBuffer0);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
- dstBuffer = _mesa_malloc(pixelSize * dstWidth);
+ dstBuffer = malloc(pixelSize * dstWidth);
if (!dstBuffer) {
- _mesa_free(srcBuffer0);
- _mesa_free(srcBuffer1);
+ free(srcBuffer0);
+ free(srcBuffer1);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
@@ -443,9 +444,9 @@ blit_linear(GLcontext *ctx,
drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL);
}
- _mesa_free(srcBuffer0);
- _mesa_free(srcBuffer1);
- _mesa_free(dstBuffer);
+ free(srcBuffer0);
+ free(srcBuffer1);
+ free(dstBuffer);
}
@@ -534,7 +535,7 @@ simple_blit(GLcontext *ctx,
}
/* allocate the row buffer */
- rowBuffer = _mesa_malloc(bytesPerRow);
+ rowBuffer = malloc(bytesPerRow);
if (!rowBuffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
@@ -547,7 +548,7 @@ simple_blit(GLcontext *ctx,
dstY += yStep;
}
- _mesa_free(rowBuffer);
+ free(rowBuffer);
}
@@ -567,6 +568,9 @@ _swrast_BlitFramebuffer(GLcontext *ctx,
};
GLint i;
+ if (!_mesa_check_conditional_render(ctx))
+ return; /* don't clear */
+
if (!ctx->DrawBuffer->_NumColorDrawBuffers)
return;
diff --git a/mesalib/src/mesa/swrast/s_clear.c b/mesalib/src/mesa/swrast/s_clear.c
index 002718ded..7b0a63391 100644
--- a/mesalib/src/mesa/swrast/s_clear.c
+++ b/mesalib/src/mesa/swrast/s_clear.c
@@ -24,6 +24,7 @@
#include "main/glheader.h"
#include "main/colormac.h"
+#include "main/condrender.h"
#include "main/formats.h"
#include "main/macros.h"
#include "main/imports.h"
@@ -40,7 +41,8 @@
* Clear the color buffer when glColorMask is in effect.
*/
static void
-clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
+clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLuint buf)
{
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
@@ -49,7 +51,6 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
SWspan span;
GLint i;
- ASSERT(ctx->Visual.rgbMode);
ASSERT(rb->PutRow);
/* Initialize color span with clear color */
@@ -75,7 +76,7 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
UNCLAMPED_FLOAT_TO_USHORT(clearColor[BCOMP], ctx->Color.ClearColor[2]);
UNCLAMPED_FLOAT_TO_USHORT(clearColor[ACOMP], ctx->Color.ClearColor[3]);
for (i = 0; i < width; i++) {
- COPY_4V(span.array->rgba[i], clearColor);
+ COPY_4V_CAST(span.array->rgba[i], clearColor, GLchan);
}
}
else {
@@ -95,7 +96,7 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
for (i = 0; i < height; i++) {
span.x = x;
span.y = y + i;
- _swrast_mask_rgba_span(ctx, rb, &span);
+ _swrast_mask_rgba_span(ctx, rb, &span, buf);
/* write masked row */
rb->PutRow(ctx, rb, width, x, y + i, span.array->rgba, NULL);
}
@@ -103,49 +104,10 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
/**
- * Clear color index buffer with masking.
- */
-static void
-clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
- const GLint x = ctx->DrawBuffer->_Xmin;
- const GLint y = ctx->DrawBuffer->_Ymin;
- const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
- const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
- SWspan span;
- GLint i;
-
- ASSERT(!ctx->Visual.rgbMode);
- ASSERT(rb->PutRow);
- ASSERT(rb->DataType == GL_UNSIGNED_INT);
-
- /* Initialize index span with clear index */
- INIT_SPAN(span, GL_BITMAP);
- span.end = width;
- span.arrayMask = SPAN_INDEX;
- for (i = 0; i < width;i++) {
- span.array->index[i] = ctx->Color.ClearIndex;
- }
-
- /* Note that masking will change the color indexes, but only the
- * bits for which the write mask is GL_FALSE. The bits
- * which are write-enabled won't get modified.
- */
- for (i = 0; i < height;i++) {
- span.x = x;
- span.y = y + i;
- _swrast_mask_ci_span(ctx, rb, &span);
- /* write masked row */
- rb->PutRow(ctx, rb, width, x, y + i, span.array->index, NULL);
- }
-}
-
-
-/**
* Clear an rgba color buffer without channel masking.
*/
static void
-clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
+clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf)
{
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
@@ -156,12 +118,10 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
GLvoid *clearVal;
GLint i;
- ASSERT(ctx->Visual.rgbMode);
-
- ASSERT(ctx->Color.ColorMask[0] &&
- ctx->Color.ColorMask[1] &&
- ctx->Color.ColorMask[2] &&
- ctx->Color.ColorMask[3]);
+ ASSERT(ctx->Color.ColorMask[buf][0] &&
+ ctx->Color.ColorMask[buf][1] &&
+ ctx->Color.ColorMask[buf][2] &&
+ ctx->Color.ColorMask[buf][3]);
ASSERT(rb->PutMonoRow);
@@ -195,50 +155,6 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
/**
- * Clear color index buffer without masking.
- */
-static void
-clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
- const GLint x = ctx->DrawBuffer->_Xmin;
- const GLint y = ctx->DrawBuffer->_Ymin;
- const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
- const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
- GLubyte clear8;
- GLushort clear16;
- GLuint clear32;
- GLvoid *clearVal;
- GLint i;
-
- ASSERT(!ctx->Visual.rgbMode);
-
- ASSERT(rb->PutMonoRow);
-
- /* setup clear value */
- switch (rb->DataType) {
- case GL_UNSIGNED_BYTE:
- clear8 = (GLubyte) ctx->Color.ClearIndex;
- clearVal = &clear8;
- break;
- case GL_UNSIGNED_SHORT:
- clear16 = (GLushort) ctx->Color.ClearIndex;
- clearVal = &clear16;
- break;
- case GL_UNSIGNED_INT:
- clear32 = ctx->Color.ClearIndex;
- clearVal = &clear32;
- break;
- default:
- _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer");
- return;
- }
-
- for (i = 0; i < height; i++)
- rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
-}
-
-
-/**
* Clear the front/back/left/right/aux color buffers.
* This function is usually only called if the device driver can't
* clear its own color buffers for some reason (such as with masking).
@@ -246,48 +162,18 @@ clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_color_buffers(GLcontext *ctx)
{
- GLboolean masking;
GLuint buf;
- if (ctx->Visual.rgbMode) {
- if (ctx->Color.ColorMask[0] &&
- ctx->Color.ColorMask[1] &&
- ctx->Color.ColorMask[2] &&
- ctx->Color.ColorMask[3]) {
- masking = GL_FALSE;
- }
- else {
- masking = GL_TRUE;
- }
- }
- else {
- struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
- const GLuint indexMask = (1 << _mesa_get_format_bits(rb->Format, GL_INDEX_BITS)) - 1;
- if ((ctx->Color.IndexMask & indexMask) == indexMask) {
- masking = GL_FALSE;
- }
- else {
- masking = GL_TRUE;
- }
- }
-
for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) {
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[buf];
- if (ctx->Visual.rgbMode) {
- if (masking) {
- clear_rgba_buffer_with_masking(ctx, rb);
- }
- else {
- clear_rgba_buffer(ctx, rb);
- }
+ if (ctx->Color.ColorMask[buf][0] == 0 ||
+ ctx->Color.ColorMask[buf][1] == 0 ||
+ ctx->Color.ColorMask[buf][2] == 0 ||
+ ctx->Color.ColorMask[buf][3] == 0) {
+ clear_rgba_buffer_with_masking(ctx, rb, buf);
}
else {
- if (masking) {
- clear_ci_buffer_with_masking(ctx, rb);
- }
- else {
- clear_ci_buffer(ctx, rb);
- }
+ clear_rgba_buffer(ctx, rb, buf);
}
}
}
@@ -318,6 +204,9 @@ _swrast_Clear(GLcontext *ctx, GLbitfield buffers)
}
#endif
+ if (!_mesa_check_conditional_render(ctx))
+ return; /* don't clear */
+
swrast_render_start(ctx);
/* do software clearing here */
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index abf000856..751966348 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -55,6 +55,7 @@ _swrast_update_rasterflags( GLcontext *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLbitfield rasterMask = 0;
+ GLuint i;
if (ctx->Color.AlphaEnabled) rasterMask |= ALPHATEST_BIT;
if (ctx->Color.BlendEnabled) rasterMask |= BLEND_BIT;
@@ -62,17 +63,17 @@ _swrast_update_rasterflags( GLcontext *ctx )
if (swrast->_FogEnabled) rasterMask |= FOG_BIT;
if (ctx->Scissor.Enabled) rasterMask |= CLIP_BIT;
if (ctx->Stencil._Enabled) rasterMask |= STENCIL_BIT;
- if (ctx->Visual.rgbMode) {
- const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
- if (colorMask != 0xffffffff) rasterMask |= MASKING_BIT;
- if (ctx->Color._LogicOpEnabled) rasterMask |= LOGIC_OP_BIT;
- if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT;
- }
- else {
- if (ctx->Color.IndexMask != 0xffffffff) rasterMask |= MASKING_BIT;
- if (ctx->Color.IndexLogicOpEnabled) rasterMask |= LOGIC_OP_BIT;
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+ if (!ctx->Color.ColorMask[i][0] ||
+ !ctx->Color.ColorMask[i][1] ||
+ !ctx->Color.ColorMask[i][2] ||
+ !ctx->Color.ColorMask[i][3]) {
+ rasterMask |= MASKING_BIT;
+ break;
+ }
}
-
+ if (ctx->Color._LogicOpEnabled) rasterMask |= LOGIC_OP_BIT;
+ if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT;
if ( ctx->Viewport.X < 0
|| ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width
|| ctx->Viewport.Y < 0
@@ -92,13 +93,18 @@ _swrast_update_rasterflags( GLcontext *ctx )
/* more than one color buffer designated for writing (or zero buffers) */
rasterMask |= MULTI_DRAW_BIT;
}
- else if (ctx->Visual.rgbMode && *((GLuint *) ctx->Color.ColorMask) == 0) {
- rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */
- }
- else if (!ctx->Visual.rgbMode && ctx->Color.IndexMask==0) {
- rasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */
+
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+ if (ctx->Color.ColorMask[i][0] +
+ ctx->Color.ColorMask[i][1] +
+ ctx->Color.ColorMask[i][2] +
+ ctx->Color.ColorMask[i][3] == 0) {
+ rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */
+ break;
+ }
}
+
if (ctx->FragmentProgram._Current) {
rasterMask |= FRAGPROG_BIT;
}
@@ -131,26 +137,26 @@ _swrast_update_polygon( GLcontext *ctx )
if (ctx->Polygon.CullFlag) {
switch (ctx->Polygon.CullFaceMode) {
case GL_BACK:
- backface_sign = -1.0;
+ backface_sign = -1.0F;
break;
case GL_FRONT:
- backface_sign = 1.0;
+ backface_sign = 1.0F;
break;
case GL_FRONT_AND_BACK:
/* fallthrough */
default:
- backface_sign = 0.0;
+ backface_sign = 0.0F;
}
}
else {
- backface_sign = 0.0;
+ backface_sign = 0.0F;
}
SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign;
/* This is for front/back-face determination, but not for culling */
SWRAST_CONTEXT(ctx)->_BackfaceSign
- = (ctx->Polygon.FrontFace == GL_CW) ? -1.0 : 1.0;
+ = (ctx->Polygon.FrontFace == GL_CW) ? -1.0F : 1.0F;
}
@@ -874,12 +880,7 @@ _swrast_flush( GLcontext *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* flush any pending fragments from rendering points */
if (swrast->PointSpan.end > 0) {
- if (ctx->Visual.rgbMode) {
- _swrast_write_rgba_span(ctx, &(swrast->PointSpan));
- }
- else {
- _swrast_write_index_span(ctx, &(swrast->PointSpan));
- }
+ _swrast_write_rgba_span(ctx, &(swrast->PointSpan));
swrast->PointSpan.end = 0;
}
}
diff --git a/mesalib/src/mesa/swrast/s_copypix.c b/mesalib/src/mesa/swrast/s_copypix.c
index 5ecfb1e90..f4f0c8a33 100644
--- a/mesalib/src/mesa/swrast/s_copypix.c
+++ b/mesalib/src/mesa/swrast/s_copypix.c
@@ -26,12 +26,11 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/colormac.h"
+#include "main/condrender.h"
#include "main/convolve.h"
-#include "main/histogram.h"
#include "main/image.h"
#include "main/macros.h"
#include "main/imports.h"
-#include "main/pixel.h"
#include "s_context.h"
#include "s_depth.h"
@@ -115,14 +114,14 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
span.arrayAttribs = FRAG_BIT_COL0;
/* allocate space for GLfloat image */
- tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
return;
}
- convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!convImage) {
- _mesa_free(tmpImage);
+ free(tmpImage);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
return;
}
@@ -151,7 +150,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
ASSERT(ctx->Pixel.Separable2DEnabled);
_mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
}
- _mesa_free(tmpImage);
+ free(tmpImage);
/* do remaining post-convolution image transfer ops */
for (row = 0; row < height; row++) {
@@ -168,7 +167,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0];
/* copy convolved colors into span array */
- _mesa_memcpy(rgba, src, width * 4 * sizeof(GLfloat));
+ memcpy(rgba, src, width * 4 * sizeof(GLfloat));
/* write span */
span.x = destx;
@@ -186,7 +185,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
span.array->ChanType = CHAN_TYPE;
}
- _mesa_free(convImage);
+ free(convImage);
}
@@ -247,7 +246,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */
if (overlapping) {
- tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat) * 4);
+ tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat) * 4);
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
@@ -274,7 +273,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
/* Get row/span of source pixels */
if (overlapping) {
/* get from buffered image */
- _mesa_memcpy(rgba, p, width * sizeof(GLfloat) * 4);
+ memcpy(rgba, p, width * sizeof(GLfloat) * 4);
p += width * 4;
}
else {
@@ -304,101 +303,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
span.array->ChanType = CHAN_TYPE; /* restore */
if (overlapping)
- _mesa_free(tmpImage);
-}
-
-
-static void
-copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
- GLint width, GLint height,
- GLint destx, GLint desty )
-{
- GLuint *tmpImage,*p;
- GLint sy, dy, stepy;
- GLint j;
- const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
- GLint overlapping;
- SWspan span;
-
- if (!ctx->ReadBuffer->_ColorReadBuffer) {
- /* no readbuffer - OK */
- return;
- }
-
- INIT_SPAN(span, GL_BITMAP);
- _swrast_span_default_attribs(ctx, &span);
- span.arrayMask = SPAN_INDEX;
-
- if (ctx->DrawBuffer == ctx->ReadBuffer) {
- overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
- ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
- }
- else {
- overlapping = GL_FALSE;
- }
-
- /* Determine if copy should be bottom-to-top or top-to-bottom */
- if (!overlapping && srcy < desty) {
- /* top-down max-to-min */
- sy = srcy + height - 1;
- dy = desty + height - 1;
- stepy = -1;
- }
- else {
- /* bottom-up min-to-max */
- sy = srcy;
- dy = desty;
- stepy = 1;
- }
-
- if (overlapping) {
- GLint ssy = sy;
- tmpImage = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint));
- if (!tmpImage) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
- return;
- }
- /* read the image */
- p = tmpImage;
- for (j = 0; j < height; j++, ssy += stepy) {
- _swrast_read_index_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
- width, srcx, ssy, p );
- p += width;
- }
- p = tmpImage;
- }
- else {
- tmpImage = NULL; /* silence compiler warning */
- p = NULL;
- }
-
- for (j = 0; j < height; j++, sy += stepy, dy += stepy) {
- /* Get color indexes */
- if (overlapping) {
- _mesa_memcpy(span.array->index, p, width * sizeof(GLuint));
- p += width;
- }
- else {
- _swrast_read_index_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
- width, srcx, sy, span.array->index );
- }
-
- if (ctx->_ImageTransferState)
- _mesa_apply_ci_transfer_ops(ctx, ctx->_ImageTransferState,
- width, span.array->index);
-
- /* write color indexes */
- span.x = destx;
- span.y = dy;
- span.end = width;
- if (zoom)
- _swrast_write_zoomed_index_span(ctx, destx, desty, &span);
- else
- _swrast_write_index_span(ctx, &span);
- }
-
- if (overlapping)
- _mesa_free(tmpImage);
+ free(tmpImage);
}
@@ -488,7 +393,7 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat));
+ tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
@@ -509,7 +414,7 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
GLfloat depth[MAX_WIDTH];
/* get depth values */
if (overlapping) {
- _mesa_memcpy(depth, p, width * sizeof(GLfloat));
+ memcpy(depth, p, width * sizeof(GLfloat));
p += width;
}
else {
@@ -523,22 +428,14 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
span.x = destx;
span.y = dy;
span.end = width;
- if (fb->Visual.rgbMode) {
- if (zoom)
- _swrast_write_zoomed_depth_span(ctx, destx, desty, &span);
- else
- _swrast_write_rgba_span(ctx, &span);
- }
- else {
- if (zoom)
- _swrast_write_zoomed_depth_span(ctx, destx, desty, &span);
- else
- _swrast_write_index_span(ctx, &span);
- }
+ if (zoom)
+ _swrast_write_zoomed_depth_span(ctx, destx, desty, &span);
+ else
+ _swrast_write_rgba_span(ctx, &span);
}
if (overlapping)
- _mesa_free(tmpImage);
+ free(tmpImage);
}
@@ -585,7 +482,7 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLstencil *) _mesa_malloc(width * height * sizeof(GLstencil));
+ tmpImage = (GLstencil *) malloc(width * height * sizeof(GLstencil));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
@@ -607,7 +504,7 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
/* Get stencil values */
if (overlapping) {
- _mesa_memcpy(stencil, p, width * sizeof(GLstencil));
+ memcpy(stencil, p, width * sizeof(GLstencil));
p += width;
}
else {
@@ -627,7 +524,7 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
}
if (overlapping)
- _mesa_free(tmpImage);
+ free(tmpImage);
}
@@ -689,7 +586,7 @@ copy_depth_stencil_pixels(GLcontext *ctx,
if (stencilMask != 0x0) {
tempStencilImage
- = (GLstencil *) _mesa_malloc(width * height * sizeof(GLstencil));
+ = (GLstencil *) malloc(width * height * sizeof(GLstencil));
if (!tempStencilImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
return;
@@ -707,10 +604,10 @@ copy_depth_stencil_pixels(GLcontext *ctx,
if (ctx->Depth.Mask) {
tempDepthImage
- = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat));
+ = (GLfloat *) malloc(width * height * sizeof(GLfloat));
if (!tempDepthImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
- _mesa_free(tempStencilImage);
+ free(tempStencilImage);
return;
}
@@ -731,7 +628,7 @@ copy_depth_stencil_pixels(GLcontext *ctx,
/* Get stencil values */
if (overlapping) {
- _mesa_memcpy(stencil, stencilPtr, width * sizeof(GLstencil));
+ memcpy(stencil, stencilPtr, width * sizeof(GLstencil));
stencilPtr += width;
}
else {
@@ -760,7 +657,7 @@ copy_depth_stencil_pixels(GLcontext *ctx,
/* get depth values */
if (overlapping) {
- _mesa_memcpy(depth, depthPtr, width * sizeof(GLfloat));
+ memcpy(depth, depthPtr, width * sizeof(GLfloat));
depthPtr += width;
}
else {
@@ -800,10 +697,10 @@ copy_depth_stencil_pixels(GLcontext *ctx,
}
if (tempStencilImage)
- _mesa_free(tempStencilImage);
+ free(tempStencilImage);
if (tempDepthImage)
- _mesa_free(tempDepthImage);
+ free(tempDepthImage);
}
@@ -901,18 +798,16 @@ _swrast_CopyPixels( GLcontext *ctx,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
swrast_render_start(ctx);
+ if (!_mesa_check_conditional_render(ctx))
+ return; /* don't copy */
+
if (swrast->NewState)
_swrast_validate_derived( ctx );
if (!fast_copy_pixels(ctx, srcx, srcy, width, height, destx, desty, type)) {
switch (type) {
case GL_COLOR:
- if (ctx->Visual.rgbMode) {
- copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty );
- }
- else {
- copy_ci_pixels( ctx, srcx, srcy, width, height, destx, desty );
- }
+ copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty );
break;
case GL_DEPTH:
copy_depth_pixels( ctx, srcx, srcy, width, height, destx, desty );
diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c
index c37a54eb3..ed637cac1 100644
--- a/mesalib/src/mesa/swrast/s_depth.c
+++ b/mesalib/src/mesa/swrast/s_depth.c
@@ -28,7 +28,6 @@
#include "main/formats.h"
#include "main/macros.h"
#include "main/imports.h"
-#include "main/fbobject.h"
#include "s_depth.h"
#include "s_context.h"
@@ -260,7 +259,7 @@ depth_test_span16( GLcontext *ctx, GLuint n,
}
break;
case GL_NEVER:
- _mesa_bzero(mask, n * sizeof(GLubyte));
+ memset(mask, 0, n * sizeof(GLubyte));
break;
default:
_mesa_problem(ctx, "Bad depth func in depth_test_span16");
@@ -489,7 +488,7 @@ depth_test_span32( GLcontext *ctx, GLuint n,
}
break;
case GL_NEVER:
- _mesa_bzero(mask, n * sizeof(GLubyte));
+ memset(mask, 0, n * sizeof(GLubyte));
break;
default:
_mesa_problem(ctx, "Bad depth func in depth_test_span32");
@@ -498,17 +497,24 @@ depth_test_span32( GLcontext *ctx, GLuint n,
return passed;
}
-/* Apply ARB_depth_clamp to span of fragments. */
+
+
+/**
+ * Clamp fragment Z values to the depth near/far range (glDepthRange()).
+ * This is used when GL_ARB_depth_clamp/GL_DEPTH_CLAMP is turned on.
+ * In that case, vertexes are not clipped against the near/far planes
+ * so rasterization will produce fragment Z values outside the usual
+ * [0,1] range.
+ */
void
_swrast_depth_clamp_span( GLcontext *ctx, SWspan *span )
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
- struct gl_renderbuffer *rb = fb->_DepthBuffer;
const GLuint count = span->end;
- GLuint *zValues = span->array->z;
- GLuint min, max;
+ GLint *zValues = (GLint *) span->array->z; /* sign change */
+ GLint min, max;
GLfloat min_f, max_f;
- int i;
+ GLuint i;
if (ctx->Viewport.Near < ctx->Viewport.Far) {
min_f = ctx->Viewport.Near;
@@ -518,15 +524,21 @@ _swrast_depth_clamp_span( GLcontext *ctx, SWspan *span )
max_f = ctx->Viewport.Near;
}
- if (rb->DataType == GL_UNSIGNED_SHORT) {
- CLAMPED_FLOAT_TO_USHORT(min, min_f);
- CLAMPED_FLOAT_TO_USHORT(max, max_f);
- } else {
- assert(rb->DataType == GL_UNSIGNED_INT);
- min = FLOAT_TO_UINT(min_f);
- max = FLOAT_TO_UINT(max_f);
- }
-
+ /* Convert floating point values in [0,1] to device Z coordinates in
+ * [0, DepthMax].
+ * ex: If the Z buffer has 24 bits, DepthMax = 0xffffff.
+ *
+ * XXX this all falls apart if we have 31 or more bits of Z because
+ * the triangle rasterization code produces unsigned Z values. Negative
+ * vertex Z values come out as large fragment Z uints.
+ */
+ min = (GLint) (min_f * fb->_DepthMaxF);
+ max = (GLint) (max_f * fb->_DepthMaxF);
+ if (max < 0)
+ max = 0x7fffffff; /* catch over flow for 30-bit z */
+
+ /* Note that we do the comparisons here using signed integers.
+ */
for (i = 0; i < count; i++) {
if (zValues[i] < min)
zValues[i] = min;
@@ -832,7 +844,7 @@ direct_depth_test_pixels16(GLcontext *ctx, GLushort *zStart, GLuint stride,
break;
case GL_NEVER:
/* depth test never passes */
- _mesa_bzero(mask, n * sizeof(GLubyte));
+ memset(mask, 0, n * sizeof(GLubyte));
break;
default:
_mesa_problem(ctx, "Bad depth func in direct_depth_test_pixels");
@@ -1078,7 +1090,7 @@ direct_depth_test_pixels32(GLcontext *ctx, GLuint *zStart, GLuint stride,
break;
case GL_NEVER:
/* depth test never passes */
- _mesa_bzero(mask, n * sizeof(GLubyte));
+ memset(mask, 0, n * sizeof(GLubyte));
break;
default:
_mesa_problem(ctx, "Bad depth func in direct_depth_test_pixels");
@@ -1248,7 +1260,7 @@ _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb,
if (!rb) {
/* really only doing this to prevent FP exceptions later */
- _mesa_bzero(depth, n * sizeof(GLfloat));
+ memset(depth, 0, n * sizeof(GLfloat));
return;
}
@@ -1257,7 +1269,7 @@ _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb,
if (y < 0 || y >= (GLint) rb->Height ||
x + n <= 0 || x >= (GLint) rb->Width) {
/* span is completely outside framebuffer */
- _mesa_bzero(depth, n * sizeof(GLfloat));
+ memset(depth, 0, n * sizeof(GLfloat));
return;
}
@@ -1314,7 +1326,7 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb,
if (!rb) {
/* really only doing this to prevent FP exceptions later */
- _mesa_bzero(depth, n * sizeof(GLuint));
+ memset(depth, 0, n * sizeof(GLuint));
return;
}
@@ -1325,7 +1337,7 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb,
if (y < 0 || y >= (GLint) rb->Height ||
x + n <= 0 || x >= (GLint) rb->Width) {
/* span is completely outside framebuffer */
- _mesa_bzero(depth, n * sizeof(GLfloat));
+ memset(depth, 0, n * sizeof(GLfloat));
return;
}
@@ -1426,7 +1438,7 @@ _swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
/* optimized case */
GLushort *dst = (GLushort *) rb->GetPointer(ctx, rb, x, y);
GLuint len = width * height * sizeof(GLushort);
- _mesa_memset(dst, (clearValue & 0xff), len);
+ memset(dst, (clearValue & 0xff), len);
}
else {
/* general case */
diff --git a/mesalib/src/mesa/swrast/s_drawpix.c b/mesalib/src/mesa/swrast/s_drawpix.c
index 6970b2e9c..3cec3a7a2 100644
--- a/mesalib/src/mesa/swrast/s_drawpix.c
+++ b/mesalib/src/mesa/swrast/s_drawpix.c
@@ -25,12 +25,12 @@
#include "main/glheader.h"
#include "main/bufferobj.h"
+#include "main/condrender.h"
#include "main/context.h"
#include "main/convolve.h"
#include "main/image.h"
#include "main/macros.h"
#include "main/imports.h"
-#include "main/pixel.h"
#include "main/state.h"
#include "s_context.h"
@@ -267,7 +267,7 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y,
if (format == GL_COLOR_INDEX && type == GL_UNSIGNED_BYTE) {
const GLubyte *src = (const GLubyte *) pixels
+ unpack.SkipRows * unpack.RowLength + unpack.SkipPixels;
- if (ctx->Visual.rgbMode && rbType == GL_UNSIGNED_BYTE) {
+ if (rbType == GL_UNSIGNED_BYTE) {
/* convert ubyte/CI data to ubyte/RGBA */
if (simpleZoom) {
GLint row;
@@ -299,22 +299,6 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y,
}
return GL_TRUE;
}
- else if (!ctx->Visual.rgbMode && rbType == GL_UNSIGNED_INT) {
- /* write CI data to CI frame buffer */
- GLint row;
- if (simpleZoom) {
- for (row = 0; row < drawHeight; row++) {
- GLuint index32[MAX_WIDTH];
- GLint col;
- for (col = 0; col < drawWidth; col++)
- index32[col] = src[col];
- rb->PutRow(ctx, rb, drawWidth, destX, destY, index32, NULL);
- src += unpack.RowLength;
- destY += yStep;
- }
- return GL_TRUE;
- }
- }
}
/* can't handle this pixel format and/or data type */
@@ -324,57 +308,6 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y,
/*
- * Draw color index image.
- */
-static void
-draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- const GLint imgX = x, imgY = y;
- const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
- GLint row, skipPixels;
- SWspan span;
-
- INIT_SPAN(span, GL_BITMAP);
- span.arrayMask = SPAN_INDEX;
- _swrast_span_default_attribs(ctx, &span);
-
- /*
- * General solution
- */
- skipPixels = 0;
- while (skipPixels < width) {
- const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH);
- ASSERT(spanWidth <= MAX_WIDTH);
- for (row = 0; row < height; row++) {
- const GLvoid *source = _mesa_image_address2d(unpack, pixels,
- width, height,
- GL_COLOR_INDEX, type,
- row, skipPixels);
- _mesa_unpack_index_span(ctx, spanWidth, GL_UNSIGNED_INT,
- span.array->index, type, source, unpack,
- ctx->_ImageTransferState);
-
- /* These may get changed during writing/clipping */
- span.x = x + skipPixels;
- span.y = y + row;
- span.end = spanWidth;
-
- if (zoom)
- _swrast_write_zoomed_index_span(ctx, imgX, imgY, &span);
- else
- _swrast_write_index_span(ctx, &span);
- }
- skipPixels += spanWidth;
- }
-}
-
-
-
-/*
* Draw stencil image.
*/
static void
@@ -441,7 +374,6 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
&& ctx->DrawBuffer->Visual.depthBits == 16
&& !scaleOrBias
&& !zoom
- && ctx->Visual.rgbMode
&& width <= MAX_WIDTH
&& !unpack->SwapBytes) {
/* Special case: directly write 16-bit depth values */
@@ -462,7 +394,6 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
else if (type == GL_UNSIGNED_INT
&& !scaleOrBias
&& !zoom
- && ctx->Visual.rgbMode
&& width <= MAX_WIDTH
&& !unpack->SwapBytes) {
/* Special case: shift 32-bit values down to Visual.depthBits */
@@ -473,7 +404,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
_mesa_image_address2d(unpack, pixels, width, height,
GL_DEPTH_COMPONENT, type, row, 0);
if (shift == 0) {
- _mesa_memcpy(span.array->z, zSrc, width * sizeof(GLuint));
+ memcpy(span.array->z, zSrc, width * sizeof(GLuint));
}
else {
GLint col;
@@ -515,11 +446,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
if (zoom) {
_swrast_write_zoomed_depth_span(ctx, x, y, &span);
}
- else if (ctx->Visual.rgbMode) {
- _swrast_write_rgba_span(ctx, &span);
- }
else {
- _swrast_write_index_span(ctx, &span);
+ _swrast_write_rgba_span(ctx, &span);
}
}
skipPixels += spanWidth;
@@ -566,14 +494,14 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
GLint row;
GLfloat *dest, *tmpImage;
- tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
return;
}
- convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!convImage) {
- _mesa_free(tmpImage);
+ free(tmpImage);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
return;
}
@@ -597,7 +525,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
ASSERT(ctx->Pixel.Separable2DEnabled);
_mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
}
- _mesa_free(tmpImage);
+ free(tmpImage);
/* continue transfer ops and draw the convolved image */
unpack = &ctx->DefaultPacking;
@@ -677,7 +605,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
}
if (convImage) {
- _mesa_free(convImage);
+ free(convImage);
}
}
@@ -831,6 +759,9 @@ _swrast_DrawPixels( GLcontext *ctx,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLboolean save_vp_override = ctx->VertexProgram._Overriden;
+ if (!_mesa_check_conditional_render(ctx))
+ return; /* don't draw */
+
/* We are creating fragments directly, without going through vertex
* programs.
*
@@ -864,11 +795,6 @@ _swrast_DrawPixels( GLcontext *ctx,
draw_depth_pixels( ctx, x, y, width, height, type, unpack, pixels );
break;
case GL_COLOR_INDEX:
- if (ctx->Visual.rgbMode)
- draw_rgba_pixels(ctx, x,y, width, height, format, type, unpack, pixels);
- else
- draw_index_pixels(ctx, x, y, width, height, type, unpack, pixels);
- break;
case GL_RED:
case GL_GREEN:
case GL_BLUE:
diff --git a/mesalib/src/mesa/swrast/s_feedback.c b/mesalib/src/mesa/swrast/s_feedback.c
index 47ed25ee1..373b1416e 100644
--- a/mesalib/src/mesa/swrast/s_feedback.c
+++ b/mesalib/src/mesa/swrast/s_feedback.c
@@ -25,7 +25,6 @@
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/context.h"
-#include "main/enums.h"
#include "main/feedback.h"
#include "main/macros.h"
@@ -47,7 +46,7 @@ feedback_vertex(GLcontext * ctx, const SWvertex * v, const SWvertex * pv)
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, v->attrib[FRAG_ATTRIB_CI][0], vtc);
+ _mesa_feedback_vertex(ctx, win, color, vtc);
}
diff --git a/mesalib/src/mesa/swrast/s_fog.c b/mesalib/src/mesa/swrast/s_fog.c
index 77ed0cfef..3fc843921 100644
--- a/mesalib/src/mesa/swrast/s_fog.c
+++ b/mesalib/src/mesa/swrast/s_fog.c
@@ -122,38 +122,6 @@ else { \
} \
}
-/* As above, but CI mode (XXX try to merge someday) */
-#define FOG_LOOP_CI(FOG_FUNC) \
-if (span->arrayAttribs & FRAG_BIT_FOGC) { \
- GLuint i; \
- for (i = 0; i < span->end; i++) { \
- const GLfloat fogCoord = span->array->attribs[FRAG_ATTRIB_FOGC][i][0]; \
- const GLfloat c = FABSF(fogCoord); \
- GLfloat f; \
- FOG_FUNC(f, c); \
- f = CLAMP(f, 0.0F, 1.0F); \
- index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); \
- } \
-} \
-else { \
- const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0]; \
- GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0]; \
- const GLfloat wStep = span->attrStepX[FRAG_ATTRIB_WPOS][3]; \
- GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; \
- GLuint i; \
- for (i = 0; i < span->end; i++) { \
- const GLfloat c = FABSF(fogCoord) / w; \
- GLfloat f; \
- FOG_FUNC(f, c); \
- f = CLAMP(f, 0.0F, 1.0F); \
- index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); \
- fogCoord += fogStep; \
- w += wStep; \
- } \
-}
-
-
-
/**
* Apply fog to a span of RGBA pixels.
* The fog value are either in the span->array->fog array or interpolated from
@@ -172,14 +140,14 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
/* compute (scaled) fog color */
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
- rFog = ctx->Fog.Color[RCOMP] * 255.0;
- gFog = ctx->Fog.Color[GCOMP] * 255.0;
- bFog = ctx->Fog.Color[BCOMP] * 255.0;
+ rFog = ctx->Fog.Color[RCOMP] * 255.0F;
+ gFog = ctx->Fog.Color[GCOMP] * 255.0F;
+ bFog = ctx->Fog.Color[BCOMP] * 255.0F;
}
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
- rFog = ctx->Fog.Color[RCOMP] * 65535.0;
- gFog = ctx->Fog.Color[GCOMP] * 65535.0;
- bFog = ctx->Fog.Color[BCOMP] * 65535.0;
+ rFog = ctx->Fog.Color[RCOMP] * 65535.0F;
+ gFog = ctx->Fog.Color[GCOMP] * 65535.0F;
+ bFog = ctx->Fog.Color[BCOMP] * 65535.0F;
}
else {
rFog = ctx->Fog.Color[RCOMP];
@@ -275,56 +243,3 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
}
}
}
-
-
-/**
- * As above, but color index mode.
- */
-void
-_swrast_fog_ci_span( const GLcontext *ctx, SWspan *span )
-{
- const SWcontext *swrast = CONST_SWRAST_CONTEXT(ctx);
- const GLuint fogIndex = (GLuint) ctx->Fog.Index;
- GLuint *index = span->array->index;
-
- ASSERT(swrast->_FogEnabled);
- ASSERT(span->arrayMask & SPAN_INDEX);
-
- /* we need to compute fog blend factors */
- if (swrast->_PreferPixelFog) {
- /* The span's fog values are fog coordinates, now compute blend factors
- * and blend the fragment colors with the fog color.
- */
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- {
- const GLfloat fogEnd = ctx->Fog.End;
- const GLfloat fogScale = (ctx->Fog.Start == ctx->Fog.End)
- ? 1.0F : 1.0F / (ctx->Fog.End - ctx->Fog.Start);
- FOG_LOOP_CI(LINEAR_FOG);
- }
- break;
- case GL_EXP:
- {
- const GLfloat density = -ctx->Fog.Density;
- FOG_LOOP_CI(EXP_FOG);
- }
- break;
- case GL_EXP2:
- {
- const GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density;
- FOG_LOOP_CI(EXP2_FOG);
- }
- break;
- default:
- _mesa_problem(ctx, "Bad fog mode in _swrast_fog_ci_span");
- return;
- }
- }
- else {
- /* The span's fog start/step/array values are blend factors in [0,1].
- * They were previously computed per-vertex.
- */
- FOG_LOOP_CI(BLEND_FOG);
- }
-}
diff --git a/mesalib/src/mesa/swrast/s_fog.h b/mesalib/src/mesa/swrast/s_fog.h
index 50760d88a..06107de3f 100644
--- a/mesalib/src/mesa/swrast/s_fog.h
+++ b/mesalib/src/mesa/swrast/s_fog.h
@@ -37,8 +37,4 @@ _swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z);
extern void
_swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span );
-extern void
-_swrast_fog_ci_span( const GLcontext *ctx, SWspan *span );
-
-
#endif
diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c
index a22d34415..7c1de62e8 100644
--- a/mesalib/src/mesa/swrast/s_fragprog.c
+++ b/mesalib/src/mesa/swrast/s_fragprog.c
@@ -25,7 +25,6 @@
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/context.h"
-#include "main/texstate.h"
#include "shader/prog_instruction.h"
#include "s_fragprog.h"
@@ -145,10 +144,19 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
const struct gl_fragment_program *program,
const SWspan *span, GLuint col)
{
+ GLfloat *wpos = span->array->attribs[FRAG_ATTRIB_WPOS][col];
+
if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) {
/* Clear temporary registers (undefined for ARB_f_p) */
- _mesa_bzero(machine->Temporaries,
- MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
+ memset(machine->Temporaries, 0, MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
+ }
+
+ /* ARB_fragment_coord_conventions */
+ if (program->OriginUpperLeft)
+ wpos[1] = ctx->DrawBuffer->Height - 1 - wpos[1];
+ if (!program->PixelCenterInteger) {
+ wpos[0] += 0.5F;
+ wpos[1] += 0.5F;
}
/* Setup pointer to input attributes */
@@ -163,7 +171,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
/* if running a GLSL program (not ARB_fragment_program) */
if (ctx->Shader.CurrentProgram) {
/* Store front/back facing value */
- machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0 - span->facing;
+ machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0F - span->facing;
}
machine->CurElement = col;
diff --git a/mesalib/src/mesa/swrast/s_lines.c b/mesalib/src/mesa/swrast/s_lines.c
index 23cb9b57e..7db5af4ae 100644
--- a/mesalib/src/mesa/swrast/s_lines.c
+++ b/mesalib/src/mesa/swrast/s_lines.c
@@ -29,7 +29,6 @@
#include "main/macros.h"
#include "s_aaline.h"
#include "s_context.h"
-#include "s_depth.h"
#include "s_feedback.h"
#include "s_lines.h"
#include "s_span.h"
@@ -88,10 +87,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
for (i = 0; i < span->end; i++)
y[i]++;
}
- if (ctx->Visual.rgbMode)
- _swrast_write_rgba_span(ctx, span);
- else
- _swrast_write_index_span(ctx, span);
+ _swrast_write_rgba_span(ctx, span);
}
}
else {
@@ -107,10 +103,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
for (i = 0; i < span->end; i++)
x[i]++;
}
- if (ctx->Visual.rgbMode)
- _swrast_write_rgba_span(ctx, span);
- else
- _swrast_write_index_span(ctx, span);
+ _swrast_write_rgba_span(ctx, span);
}
}
}
@@ -121,12 +114,6 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
/***** Rasterization *****/
/**********************************************************************/
-/* Simple color index line (no stipple, width=1, no Z, no fog, no tex)*/
-#define NAME simple_no_z_ci_line
-#define INTERP_INDEX
-#define RENDER_SPAN(span) _swrast_write_index_span(ctx, &span)
-#include "s_linetemp.h"
-
/* Simple RGBA index line (no stipple, width=1, no Z, no fog, no tex)*/
#define NAME simple_no_z_rgba_line
#define INTERP_RGBA
@@ -134,25 +121,6 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
#include "s_linetemp.h"
-/* Z, fog, wide, stipple color index line */
-#define NAME ci_line
-#define INTERP_INDEX
-#define INTERP_Z
-#define INTERP_ATTRIBS /* for fog */
-#define RENDER_SPAN(span) \
- if (ctx->Line.StippleFlag) { \
- span.arrayMask |= SPAN_MASK; \
- compute_stipple_mask(ctx, span.end, span.array->mask); \
- } \
- if (ctx->Line.Width > 1.0) { \
- draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \
- } \
- else { \
- _swrast_write_index_span(ctx, &span); \
- }
-#include "s_linetemp.h"
-
-
/* Z, fog, wide, stipple RGBA line */
#define NAME rgba_line
#define INTERP_RGBA
@@ -234,7 +202,7 @@ static const char *lineFuncName = NULL;
#define USE(lineFunc) \
do { \
lineFuncName = #lineFunc; \
- /*_mesa_printf("%s\n", lineFuncName);*/ \
+ /*printf("%s\n", lineFuncName);*/ \
swrast->Line = lineFunc; \
} while (0)
@@ -257,7 +225,6 @@ void
_swrast_choose_line( GLcontext *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLboolean rgbmode = ctx->Visual.rgbMode;
GLboolean specular = (ctx->Fog.ColorSumEnabled ||
(ctx->Light.Enabled &&
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR));
@@ -278,23 +245,17 @@ _swrast_choose_line( GLcontext *ctx )
|| ctx->Line.Width != 1.0
|| ctx->Line.StippleFlag) {
/* no texture, but Z, fog, width>1, stipple, etc. */
- if (rgbmode)
#if CHAN_BITS == 32
- USE(general_line);
+ USE(general_line);
#else
- USE(rgba_line);
+ USE(rgba_line);
#endif
- else
- USE(ci_line);
}
else {
ASSERT(!ctx->Depth.Test);
ASSERT(ctx->Line.Width == 1.0);
/* simple lines */
- if (rgbmode)
- USE(simple_no_z_rgba_line);
- else
- USE(simple_no_z_ci_line);
+ USE(simple_no_z_rgba_line);
}
}
else if (ctx->RenderMode == GL_FEEDBACK) {
diff --git a/mesalib/src/mesa/swrast/s_linetemp.h b/mesalib/src/mesa/swrast/s_linetemp.h
index 1abf8d6c7..033431df2 100644
--- a/mesalib/src/mesa/swrast/s_linetemp.h
+++ b/mesalib/src/mesa/swrast/s_linetemp.h
@@ -31,8 +31,6 @@
* The following macros may be defined to indicate what auxillary information
* must be interplated along the line:
* INTERP_Z - if defined, interpolate Z values
- * INTERP_RGBA - if defined, interpolate RGBA values
- * INTERP_INDEX - if defined, interpolate color index values
* INTERP_ATTRIBS - if defined, interpolate attribs (texcoords, varying, etc)
*
* When one can directly address pixels in the color buffer the following
@@ -86,7 +84,6 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
DEPTH_TYPE *zPtr;
#elif defined(INTERP_Z)
const GLint depthBits = ctx->DrawBuffer->Visual.depthBits;
-/*ctx->Visual.depthBits;*/
#endif
#ifdef PIXEL_ADDRESS
PIXEL_TYPE *pixelPtr;
@@ -223,7 +220,6 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
/*
* Span setup: compute start and step values for all interpolated values.
*/
-#ifdef INTERP_RGBA
interpFlags |= SPAN_RGBA;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
span.red = ChanToFixed(vert0->color[0]);
@@ -245,19 +241,6 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
span.blueStep = 0;
span.alphaStep = 0;
}
-#endif
-#ifdef INTERP_INDEX
- interpFlags |= SPAN_INDEX;
- if (ctx->Light.ShadeModel == GL_SMOOTH) {
- span.index = FloatToFixed(vert0->attrib[FRAG_ATTRIB_CI][0]);
- span.indexStep = FloatToFixed( vert1->attrib[FRAG_ATTRIB_CI][0]
- - vert0->attrib[FRAG_ATTRIB_CI][0]) / numPixels;
- }
- else {
- span.index = FloatToFixed(vert1->attrib[FRAG_ATTRIB_CI][0]);
- span.indexStep = 0;
- }
-#endif
#if defined(INTERP_Z) || defined(DEPTH_TYPE)
interpFlags |= SPAN_Z;
{
@@ -407,9 +390,7 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
#undef NAME
#undef INTERP_Z
-#undef INTERP_RGBA
#undef INTERP_ATTRIBS
-#undef INTERP_INDEX
#undef PIXEL_ADDRESS
#undef PIXEL_TYPE
#undef DEPTH_TYPE
diff --git a/mesalib/src/mesa/swrast/s_logic.c b/mesalib/src/mesa/swrast/s_logic.c
index f0274b4c0..c36a16e66 100644
--- a/mesalib/src/mesa/swrast/s_logic.c
+++ b/mesalib/src/mesa/swrast/s_logic.c
@@ -182,33 +182,6 @@ logicop_uint4(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[],
-/*
- * Apply the current logic operator to a span of CI pixels. This is only
- * used if the device driver can't do logic ops.
- */
-void
-_swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- SWspan *span)
-{
- GLuint dest[MAX_WIDTH];
- GLuint *index = span->array->index;
-
- ASSERT(span->end < MAX_WIDTH);
- ASSERT(rb->DataType == GL_UNSIGNED_INT);
-
- /* Read dest values from frame buffer */
- if (span->arrayMask & SPAN_XY) {
- _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y,
- dest, sizeof(GLuint));
- }
- else {
- rb->GetRow(ctx, rb, span->end, span->x, span->y, dest);
- }
-
- logicop_uint1(ctx, span->end, index, dest, span->array->mask);
-}
-
-
/**
* Apply the current logic operator to a span of RGBA pixels.
* We can handle horizontal runs of pixels (spans) or arrays of x/y
diff --git a/mesalib/src/mesa/swrast/s_logic.h b/mesalib/src/mesa/swrast/s_logic.h
index ba20cd7b3..e8cfae33f 100644
--- a/mesalib/src/mesa/swrast/s_logic.h
+++ b/mesalib/src/mesa/swrast/s_logic.h
@@ -29,12 +29,6 @@
#include "swrast.h"
-
-extern void
-_swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- SWspan *span);
-
-
extern void
_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
SWspan *span);
diff --git a/mesalib/src/mesa/swrast/s_masking.c b/mesalib/src/mesa/swrast/s_masking.c
index df779b073..e38d90f19 100644
--- a/mesalib/src/mesa/swrast/s_masking.c
+++ b/mesalib/src/mesa/swrast/s_masking.c
@@ -41,7 +41,7 @@
*/
void
_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- SWspan *span)
+ SWspan *span, GLuint buf)
{
const GLuint n = span->end;
void *rbPixels;
@@ -58,7 +58,7 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
*/
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
/* treat 4xGLubyte as 1xGLuint */
- const GLuint srcMask = *((GLuint *) ctx->Color.ColorMask);
+ const GLuint srcMask = *((GLuint *) ctx->Color.ColorMask[buf]);
const GLuint dstMask = ~srcMask;
const GLuint *dst = (const GLuint *) rbPixels;
GLuint *src = (GLuint *) span->array->rgba8;
@@ -70,10 +70,10 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
/* 2-byte components */
/* XXX try to use 64-bit arithmetic someday */
- const GLushort rMask = ctx->Color.ColorMask[RCOMP] ? 0xffff : 0x0;
- const GLushort gMask = ctx->Color.ColorMask[GCOMP] ? 0xffff : 0x0;
- const GLushort bMask = ctx->Color.ColorMask[BCOMP] ? 0xffff : 0x0;
- const GLushort aMask = ctx->Color.ColorMask[ACOMP] ? 0xffff : 0x0;
+ const GLushort rMask = ctx->Color.ColorMask[buf][RCOMP] ? 0xffff : 0x0;
+ const GLushort gMask = ctx->Color.ColorMask[buf][GCOMP] ? 0xffff : 0x0;
+ const GLushort bMask = ctx->Color.ColorMask[buf][BCOMP] ? 0xffff : 0x0;
+ const GLushort aMask = ctx->Color.ColorMask[buf][ACOMP] ? 0xffff : 0x0;
const GLushort (*dst)[4] = (const GLushort (*)[4]) rbPixels;
GLushort (*src)[4] = span->array->rgba16;
GLuint i;
@@ -86,10 +86,10 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
}
else {
/* 4-byte components */
- const GLuint rMask = ctx->Color.ColorMask[RCOMP] ? ~0x0 : 0x0;
- const GLuint gMask = ctx->Color.ColorMask[GCOMP] ? ~0x0 : 0x0;
- const GLuint bMask = ctx->Color.ColorMask[BCOMP] ? ~0x0 : 0x0;
- const GLuint aMask = ctx->Color.ColorMask[ACOMP] ? ~0x0 : 0x0;
+ const GLuint rMask = ctx->Color.ColorMask[buf][RCOMP] ? ~0x0 : 0x0;
+ const GLuint gMask = ctx->Color.ColorMask[buf][GCOMP] ? ~0x0 : 0x0;
+ const GLuint bMask = ctx->Color.ColorMask[buf][BCOMP] ? ~0x0 : 0x0;
+ const GLuint aMask = ctx->Color.ColorMask[buf][ACOMP] ? ~0x0 : 0x0;
const GLuint (*dst)[4] = (const GLuint (*)[4]) rbPixels;
GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0];
GLuint i;
@@ -101,34 +101,3 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
}
}
}
-
-
-/**
- * Apply the index mask to a span of color index values.
- */
-void
-_swrast_mask_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- SWspan *span)
-{
- const GLuint srcMask = ctx->Color.IndexMask;
- const GLuint dstMask = ~srcMask;
- GLuint *index = span->array->index;
- GLuint dest[MAX_WIDTH];
- GLuint i;
-
- ASSERT(span->arrayMask & SPAN_INDEX);
- ASSERT(span->end <= MAX_WIDTH);
- ASSERT(rb->DataType == GL_UNSIGNED_INT);
-
- if (span->arrayMask & SPAN_XY) {
- _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y,
- dest, sizeof(GLuint));
- }
- else {
- _swrast_read_index_span(ctx, rb, span->end, span->x, span->y, dest);
- }
-
- for (i = 0; i < span->end; i++) {
- index[i] = (index[i] & srcMask) | (dest[i] & dstMask);
- }
-}
diff --git a/mesalib/src/mesa/swrast/s_masking.h b/mesalib/src/mesa/swrast/s_masking.h
index 3260ca34e..3ba4f8356 100644
--- a/mesalib/src/mesa/swrast/s_masking.h
+++ b/mesalib/src/mesa/swrast/s_masking.h
@@ -32,11 +32,6 @@
extern void
_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- SWspan *span);
-
-
-extern void
-_swrast_mask_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- SWspan *span);
+ SWspan *span, GLuint buf);
#endif
diff --git a/mesalib/src/mesa/swrast/s_points.c b/mesalib/src/mesa/swrast/s_points.c
index 50ec2063a..1663ece82 100644
--- a/mesalib/src/mesa/swrast/s_points.c
+++ b/mesalib/src/mesa/swrast/s_points.c
@@ -27,7 +27,6 @@
#include "main/colormac.h"
#include "main/context.h"
#include "main/macros.h"
-#include "main/texstate.h"
#include "s_context.h"
#include "s_feedback.h"
#include "s_points.h"
@@ -126,16 +125,16 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
GLfloat s, r, dsdx;
/* texcoord / pointcoord interpolants */
- s = 0.0;
- dsdx = 1.0 / size;
+ s = 0.0F;
+ dsdx = 1.0F / size;
if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) {
- dtdy = 1.0 / size;
- t0 = 0.5 * dtdy;
+ dtdy = 1.0F / size;
+ t0 = 0.5F * dtdy;
}
else {
/* GL_UPPER_LEFT */
- dtdy = -1.0 / size;
- t0 = 1.0 + 0.5 * dtdy;
+ dtdy = -1.0F / size;
+ t0 = 1.0F + 0.5F * dtdy;
}
ATTRIB_LOOP_BEGIN
@@ -245,7 +244,6 @@ static void
smooth_point(GLcontext *ctx, const SWvertex *vert)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLboolean ciMode = !ctx->Visual.rgbMode;
SWspan span;
GLfloat size, alphaAtten;
@@ -336,10 +334,6 @@ smooth_point(GLcontext *ctx, const SWvertex *vert)
if (dist2 >= rmin2) {
/* compute partial coverage */
coverage = 1.0F - (dist2 - rmin2) * cscale;
- if (ciMode) {
- /* coverage in [0,15] */
- coverage *= 15.0;
- }
}
else {
/* full coverage */
@@ -370,7 +364,6 @@ static void
large_point(GLcontext *ctx, const SWvertex *vert)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLboolean ciMode = !ctx->Visual.rgbMode;
SWspan span;
GLfloat size;
@@ -390,22 +383,15 @@ large_point(GLcontext *ctx, const SWvertex *vert)
span.arrayMask = SPAN_XY;
span.facing = swrast->PointLineFacing;
- if (ciMode) {
- span.interpMask = SPAN_Z | SPAN_INDEX;
- span.index = FloatToFixed(vert->attrib[FRAG_ATTRIB_CI][0]);
- span.indexStep = 0;
- }
- else {
- span.interpMask = SPAN_Z | SPAN_RGBA;
- span.red = ChanToFixed(vert->color[0]);
- span.green = ChanToFixed(vert->color[1]);
- span.blue = ChanToFixed(vert->color[2]);
- span.alpha = ChanToFixed(vert->color[3]);
- span.redStep = 0;
- span.greenStep = 0;
- span.blueStep = 0;
- span.alphaStep = 0;
- }
+ span.interpMask = SPAN_Z | SPAN_RGBA;
+ span.red = ChanToFixed(vert->color[0]);
+ span.green = ChanToFixed(vert->color[1]);
+ span.blue = ChanToFixed(vert->color[2]);
+ span.alpha = ChanToFixed(vert->color[3]);
+ span.redStep = 0;
+ span.greenStep = 0;
+ span.blueStep = 0;
+ span.alphaStep = 0;
/* need these for fragment programs */
span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F;
@@ -467,7 +453,6 @@ static void
pixel_point(GLcontext *ctx, const SWvertex *vert)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLboolean ciMode = !ctx->Visual.rgbMode;
/*
* Note that unlike the other functions, we put single-pixel points
* into a special span array in order to render as many points as
@@ -481,10 +466,7 @@ pixel_point(GLcontext *ctx, const SWvertex *vert)
/* Span init */
span->interpMask = 0;
span->arrayMask = SPAN_XY | SPAN_Z;
- if (ciMode)
- span->arrayMask |= SPAN_INDEX;
- else
- span->arrayMask |= SPAN_RGBA;
+ span->arrayMask |= SPAN_RGBA;
/*span->arrayMask |= SPAN_LAMBDA;*/
span->arrayAttribs = swrast->_ActiveAttribMask; /* we'll produce these vals */
@@ -498,10 +480,7 @@ pixel_point(GLcontext *ctx, const SWvertex *vert)
(swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT)) ||
span->facing != swrast->PointLineFacing) {
if (span->end > 0) {
- if (ciMode)
- _swrast_write_index_span(ctx, span);
- else
- _swrast_write_rgba_span(ctx, span);
+ _swrast_write_rgba_span(ctx, span);
span->end = 0;
}
}
@@ -511,15 +490,11 @@ pixel_point(GLcontext *ctx, const SWvertex *vert)
span->facing = swrast->PointLineFacing;
/* fragment attributes */
- if (ciMode) {
- span->array->index[count] = (GLuint) vert->attrib[FRAG_ATTRIB_CI][0];
- }
- else {
- span->array->rgba[count][RCOMP] = vert->color[0];
- span->array->rgba[count][GCOMP] = vert->color[1];
- span->array->rgba[count][BCOMP] = vert->color[2];
- span->array->rgba[count][ACOMP] = vert->color[3];
- }
+ span->array->rgba[count][RCOMP] = vert->color[0];
+ span->array->rgba[count][GCOMP] = vert->color[1];
+ span->array->rgba[count][BCOMP] = vert->color[2];
+ span->array->rgba[count][ACOMP] = vert->color[3];
+
ATTRIB_LOOP_BEGIN
COPY_4V(span->array->attribs[attr][count], vert->attrib[attr]);
ATTRIB_LOOP_END
diff --git a/mesalib/src/mesa/swrast/s_readpix.c b/mesalib/src/mesa/swrast/s_readpix.c
index 44a11cd6d..368311e14 100644
--- a/mesalib/src/mesa/swrast/s_readpix.c
+++ b/mesalib/src/mesa/swrast/s_readpix.c
@@ -33,7 +33,6 @@
#include "main/image.h"
#include "main/macros.h"
#include "main/imports.h"
-#include "main/pixel.h"
#include "main/state.h"
#include "s_context.h"
@@ -42,42 +41,6 @@
#include "s_stencil.h"
-/*
- * Read a block of color index pixels.
- */
-static void
-read_index_pixels( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum type, GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing )
-{
- struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
- GLint i;
-
- if (!rb)
- return;
-
- /* width should never be > MAX_WIDTH since we did clipping earlier */
- ASSERT(width <= MAX_WIDTH);
-
- /* process image row by row */
- for (i = 0; i < height; i++) {
- GLuint index[MAX_WIDTH];
- GLvoid *dest;
- ASSERT(rb->DataType == GL_UNSIGNED_INT);
- rb->GetRow(ctx, rb, width, x, y + i, index);
-
- dest = _mesa_image_address2d(packing, pixels, width, height,
- GL_COLOR_INDEX, type, i, 0);
-
- _mesa_pack_index_span(ctx, width, type, dest, index,
- &ctx->Pack, ctx->_ImageTransferState);
- }
-}
-
-
-
/**
* Read pixels for format=GL_DEPTH_COMPONENT.
*/
@@ -290,21 +253,21 @@ fast_read_rgba_pixels( GLcontext *ctx,
/**
* When we're using a low-precision color buffer (like 16-bit 5/6/5)
* we have to adjust our color values a bit to pass conformance.
- * The problem is when a 5 or 6-bit color value is convert to an 8-bit
+ * The problem is when a 5 or 6-bit color value is converted to an 8-bit
* value and then a floating point value, the floating point values don't
* increment uniformly as the 5 or 6-bit value is incremented.
*
* This function adjusts floating point values to compensate.
*/
static void
-adjust_colors(GLcontext *ctx, GLuint n, GLfloat rgba[][4])
+adjust_colors(const struct gl_framebuffer *fb, GLuint n, GLfloat rgba[][4])
{
- const GLuint rShift = 8 - ctx->Visual.redBits;
- const GLuint gShift = 8 - ctx->Visual.greenBits;
- const GLuint bShift = 8 - ctx->Visual.blueBits;
- const GLfloat rScale = 1.0F / (GLfloat) ((1 << ctx->Visual.redBits ) - 1);
- const GLfloat gScale = 1.0F / (GLfloat) ((1 << ctx->Visual.greenBits) - 1);
- const GLfloat bScale = 1.0F / (GLfloat) ((1 << ctx->Visual.blueBits ) - 1);
+ const GLuint rShift = 8 - fb->Visual.redBits;
+ const GLuint gShift = 8 - fb->Visual.greenBits;
+ const GLuint bShift = 8 - fb->Visual.blueBits;
+ const GLfloat rScale = 1.0F / (GLfloat) ((1 << fb->Visual.redBits ) - 1);
+ const GLfloat gScale = 1.0F / (GLfloat) ((1 << fb->Visual.greenBits) - 1);
+ const GLfloat bScale = 1.0F / (GLfloat) ((1 << fb->Visual.blueBits ) - 1);
GLuint i;
for (i = 0; i < n; i++) {
GLint r, g, b;
@@ -359,14 +322,14 @@ read_rgba_pixels( GLcontext *ctx,
GLfloat *dest, *src, *tmpImage, *convImage;
GLint row;
- tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
return;
}
- convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!convImage) {
- _mesa_free(tmpImage);
+ free(tmpImage);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
return;
}
@@ -374,18 +337,7 @@ read_rgba_pixels( GLcontext *ctx,
/* read full RGBA, FLOAT image */
dest = tmpImage;
for (row = 0; row < height; row++, y++) {
- if (fb->Visual.rgbMode) {
- _swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, dest);
- }
- else {
- GLuint index[MAX_WIDTH];
- ASSERT(rb->DataType == GL_UNSIGNED_INT);
- rb->GetRow(ctx, rb, width, x, y, index);
- _mesa_apply_ci_transfer_ops(ctx,
- transferOps & IMAGE_SHIFT_OFFSET_BIT,
- width, index);
- _mesa_map_ci_to_rgba(ctx, width, index, (GLfloat (*)[4]) dest);
- }
+ _swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, dest);
_mesa_apply_rgba_transfer_ops(ctx,
transferOps & IMAGE_PRE_CONVOLUTION_BITS,
width, (GLfloat (*)[4]) dest);
@@ -400,7 +352,7 @@ read_rgba_pixels( GLcontext *ctx,
ASSERT(ctx->Pixel.Separable2DEnabled);
_mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
}
- _mesa_free(tmpImage);
+ free(tmpImage);
/* finish transfer ops and pack the resulting image */
src = convImage;
@@ -413,7 +365,7 @@ read_rgba_pixels( GLcontext *ctx,
transferOps & IMAGE_POST_CONVOLUTION_BITS);
src += width * 4;
}
- _mesa_free(convImage);
+ free(convImage);
}
else {
/* no convolution */
@@ -432,25 +384,13 @@ read_rgba_pixels( GLcontext *ctx,
for (row = 0; row < height; row++, y++) {
/* Get float rgba pixels */
- if (fb->Visual.rgbMode) {
- _swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, rgba);
- }
- else {
- /* read CI and convert to RGBA */
- GLuint index[MAX_WIDTH];
- ASSERT(rb->DataType == GL_UNSIGNED_INT);
- rb->GetRow(ctx, rb, width, x, y, index);
- _mesa_apply_ci_transfer_ops(ctx,
- transferOps & IMAGE_SHIFT_OFFSET_BIT,
- width, index);
- _mesa_map_ci_to_rgba(ctx, width, index, rgba);
- }
+ _swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, rgba);
/* apply fudge factor for shallow color buffers */
if (fb->Visual.redBits < 8 ||
fb->Visual.greenBits < 8 ||
fb->Visual.blueBits < 8) {
- adjust_colors(ctx, width, rgba);
+ adjust_colors(fb, width, rgba);
}
/* pack the row of RGBA pixels into user's buffer */
@@ -593,10 +533,6 @@ _swrast_ReadPixels( GLcontext *ctx,
return;
switch (format) {
- case GL_COLOR_INDEX:
- read_index_pixels(ctx, x, y, width, height, type, pixels,
- &clippedPacking);
- break;
case GL_STENCIL_INDEX:
read_stencil_pixels(ctx, x, y, width, height, type, pixels,
&clippedPacking);
diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c
index d36c8132f..687c8eb0b 100644
--- a/mesalib/src/mesa/swrast/s_span.c
+++ b/mesalib/src/mesa/swrast/s_span.c
@@ -60,6 +60,7 @@
void
_swrast_span_default_attribs(GLcontext *ctx, SWspan *span)
{
+ GLchan r, g, b, a;
/* Z*/
{
const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF;
@@ -80,41 +81,33 @@ _swrast_span_default_attribs(GLcontext *ctx, SWspan *span)
span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0;
/* primary color, or color index */
- if (ctx->Visual.rgbMode) {
- GLchan r, g, b, a;
- UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]);
- UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]);
- UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]);
- UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]);
+ UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]);
+ UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]);
#if CHAN_TYPE == GL_FLOAT
- span->red = r;
- span->green = g;
- span->blue = b;
- span->alpha = a;
+ span->red = r;
+ span->green = g;
+ span->blue = b;
+ span->alpha = a;
#else
- span->red = IntToFixed(r);
- span->green = IntToFixed(g);
- span->blue = IntToFixed(b);
- span->alpha = IntToFixed(a);
+ span->red = IntToFixed(r);
+ span->green = IntToFixed(g);
+ span->blue = IntToFixed(b);
+ span->alpha = IntToFixed(a);
#endif
- span->redStep = 0;
- span->greenStep = 0;
- span->blueStep = 0;
- span->alphaStep = 0;
- span->interpMask |= SPAN_RGBA;
-
- COPY_4V(span->attrStart[FRAG_ATTRIB_COL0], ctx->Current.RasterColor);
- ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
- ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
- }
- else {
- span->index = FloatToFixed(ctx->Current.RasterIndex);
- span->indexStep = 0;
- span->interpMask |= SPAN_INDEX;
- }
+ span->redStep = 0;
+ span->greenStep = 0;
+ span->blueStep = 0;
+ span->alphaStep = 0;
+ span->interpMask |= SPAN_RGBA;
+
+ COPY_4V(span->attrStart[FRAG_ATTRIB_COL0], ctx->Current.RasterColor);
+ ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
+ ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
/* Secondary color */
- if (ctx->Visual.rgbMode && (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled))
+ if (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled)
{
COPY_4V(span->attrStart[FRAG_ATTRIB_COL1], ctx->Current.RasterSecondaryColor);
ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0);
@@ -374,38 +367,6 @@ interpolate_float_colors(SWspan *span)
-/* Fill in the span.color.index array from the interpolation values */
-static INLINE void
-interpolate_indexes(GLcontext *ctx, SWspan *span)
-{
- GLfixed index = span->index;
- const GLint indexStep = span->indexStep;
- const GLuint n = span->end;
- GLuint *indexes = span->array->index;
- GLuint i;
- (void) ctx;
-
- ASSERT(!(span->arrayMask & SPAN_INDEX));
-
- if ((span->interpMask & SPAN_FLAT) || (indexStep == 0)) {
- /* constant color */
- index = FixedToInt(index);
- for (i = 0; i < n; i++) {
- indexes[i] = index;
- }
- }
- else {
- /* interpolate */
- for (i = 0; i < n; i++) {
- indexes[i] = FixedToInt(index);
- index += indexStep;
- }
- }
- span->arrayMask |= SPAN_INDEX;
- span->interpMask &= ~SPAN_INDEX;
-}
-
-
/**
* Fill in the span.zArray array from the span->z, zStep values.
*/
@@ -645,7 +606,7 @@ interpolate_wpos(GLcontext *ctx, SWspan *span)
{
GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS];
GLuint i;
- const GLfloat zScale = 1.0 / ctx->DrawBuffer->_DepthMaxF;
+ const GLfloat zScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
GLfloat w, dw;
if (span->arrayMask & SPAN_XY) {
@@ -784,14 +745,47 @@ clip_span( GLcontext *ctx, SWspan *span )
* For arrays of values, shift them left.
*/
for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ if (span->interpMask & (1 << i)) {
+ GLuint j;
+ for (j = 0; j < 4; j++) {
+ span->attrStart[i][j] += leftClip * span->attrStepX[i][j];
+ }
+ }
+ }
+
+ span->red += leftClip * span->redStep;
+ span->green += leftClip * span->greenStep;
+ span->blue += leftClip * span->blueStep;
+ span->alpha += leftClip * span->alphaStep;
+ span->index += leftClip * span->indexStep;
+ span->z += leftClip * span->zStep;
+ span->intTex[0] += leftClip * span->intTexStep[0];
+ span->intTex[1] += leftClip * span->intTexStep[1];
+
+#define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \
+ memcpy(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
+
+ for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
if (span->arrayAttribs & (1 << i)) {
/* shift array elements left by 'leftClip' */
- _mesa_memcpy(span->array->attribs[i],
- span->array->attribs[i] + leftClip,
- (n - leftClip) * 4 * sizeof(GLfloat));
+ SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip);
}
}
+ SHIFT_ARRAY(span->array->mask, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->rgba8, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->rgba16, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->x, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->y, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->z, leftClip, n - leftClip);
+ SHIFT_ARRAY(span->array->index, leftClip, n - leftClip);
+ for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
+ SHIFT_ARRAY(span->array->lambda[i], leftClip, n - leftClip);
+ }
+ SHIFT_ARRAY(span->array->coverage, leftClip, n - leftClip);
+
+#undef SHIFT_ARRAY
+
span->leftClip = leftClip;
span->x = xmin;
span->end -= leftClip;
@@ -809,249 +803,6 @@ clip_span( GLcontext *ctx, SWspan *span )
/**
- * Apply all the per-fragment opertions to a span of color index fragments
- * and write them to the enabled color drawbuffers.
- * The 'span' parameter can be considered to be const. Note that
- * span->interpMask and span->arrayMask may be changed but will be restored
- * to their original values before returning.
- */
-void
-_swrast_write_index_span( GLcontext *ctx, SWspan *span)
-{
- const SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLbitfield origInterpMask = span->interpMask;
- const GLbitfield origArrayMask = span->arrayMask;
- struct gl_framebuffer *fb = ctx->DrawBuffer;
-
- ASSERT(span->end <= MAX_WIDTH);
- ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE ||
- span->primitive == GL_POLYGON || span->primitive == GL_BITMAP);
- ASSERT((span->interpMask | span->arrayMask) & SPAN_INDEX);
- /*
- ASSERT((span->interpMask & span->arrayMask) == 0);
- */
-
- if (span->arrayMask & SPAN_MASK) {
- /* mask was initialized by caller, probably glBitmap */
- span->writeAll = GL_FALSE;
- }
- else {
- _mesa_memset(span->array->mask, 1, span->end);
- span->writeAll = GL_TRUE;
- }
-
- /* Clipping */
- if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) {
- if (!clip_span(ctx, span)) {
- return;
- }
- }
-
- if (!(span->arrayMask & SPAN_MASK)) {
- /* post-clip sanity check */
- assert(span->x >= 0);
- assert(span->y >= 0);
- }
-
- /* Depth bounds test */
- if (ctx->Depth.BoundsTest && fb->Visual.depthBits > 0) {
- if (!_swrast_depth_bounds_test(ctx, span)) {
- return;
- }
- }
-
-#ifdef DEBUG
- /* Make sure all fragments are within window bounds */
- if (span->arrayMask & SPAN_XY) {
- GLuint i;
- for (i = 0; i < span->end; i++) {
- if (span->array->mask[i]) {
- assert(span->array->x[i] >= fb->_Xmin);
- assert(span->array->x[i] < fb->_Xmax);
- assert(span->array->y[i] >= fb->_Ymin);
- assert(span->array->y[i] < fb->_Ymax);
- }
- }
- }
-#endif
-
- /* Polygon Stippling */
- if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) {
- stipple_polygon_span(ctx, span);
- }
-
- /* Stencil and Z testing */
- if (ctx->Stencil._Enabled || ctx->Depth.Test) {
- if (!(span->arrayMask & SPAN_Z))
- _swrast_span_interpolate_z(ctx, span);
-
- if (ctx->Transform.DepthClamp)
- _swrast_depth_clamp_span(ctx, span);
-
- if (ctx->Stencil._Enabled) {
- if (!_swrast_stencil_and_ztest_span(ctx, span)) {
- span->arrayMask = origArrayMask;
- return;
- }
- }
- else {
- ASSERT(ctx->Depth.Test);
- if (!_swrast_depth_test_span(ctx, span)) {
- span->interpMask = origInterpMask;
- span->arrayMask = origArrayMask;
- return;
- }
- }
- }
-
- if (ctx->Query.CurrentOcclusionObject) {
- /* update count of 'passed' fragments */
- struct gl_query_object *q = ctx->Query.CurrentOcclusionObject;
- GLuint i;
- for (i = 0; i < span->end; i++)
- q->Result += span->array->mask[i];
- }
-
- /* we have to wait until after occlusion to do this test */
- if (ctx->Color.IndexMask == 0) {
- /* write no pixels */
- span->arrayMask = origArrayMask;
- return;
- }
-
- /* Interpolate the color indexes if needed */
- if (swrast->_FogEnabled ||
- ctx->Color.IndexLogicOpEnabled ||
- ctx->Color.IndexMask != 0xffffffff ||
- (span->arrayMask & SPAN_COVERAGE)) {
- if (!(span->arrayMask & SPAN_INDEX) /*span->interpMask & SPAN_INDEX*/) {
- interpolate_indexes(ctx, span);
- }
- }
-
- /* Fog */
- if (swrast->_FogEnabled) {
- _swrast_fog_ci_span(ctx, span);
- }
-
- /* Antialias coverage application */
- if (span->arrayMask & SPAN_COVERAGE) {
- const GLfloat *coverage = span->array->coverage;
- GLuint *index = span->array->index;
- GLuint i;
- for (i = 0; i < span->end; i++) {
- ASSERT(coverage[i] < 16);
- index[i] = (index[i] & ~0xf) | ((GLuint) coverage[i]);
- }
- }
-
- /*
- * Write to renderbuffers
- */
- {
- const GLuint numBuffers = fb->_NumColorDrawBuffers;
- GLuint buf;
-
- for (buf = 0; buf < numBuffers; buf++) {
- struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buf];
- GLuint indexSave[MAX_WIDTH];
-
- ASSERT(rb->_BaseFormat == GL_COLOR_INDEX);
-
- if (numBuffers > 1) {
- /* save indexes for second, third renderbuffer writes */
- _mesa_memcpy(indexSave, span->array->index,
- span->end * sizeof(indexSave[0]));
- }
-
- if (ctx->Color.IndexLogicOpEnabled) {
- _swrast_logicop_ci_span(ctx, rb, span);
- }
-
- if (ctx->Color.IndexMask != 0xffffffff) {
- _swrast_mask_ci_span(ctx, rb, span);
- }
-
- if (!(span->arrayMask & SPAN_INDEX) && span->indexStep == 0) {
- /* all fragments have same color index */
- GLubyte index8;
- GLushort index16;
- GLuint index32;
- void *value;
-
- if (rb->DataType == GL_UNSIGNED_BYTE) {
- index8 = FixedToInt(span->index);
- value = &index8;
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- index16 = FixedToInt(span->index);
- value = &index16;
- }
- else {
- ASSERT(rb->DataType == GL_UNSIGNED_INT);
- index32 = FixedToInt(span->index);
- value = &index32;
- }
-
- if (span->arrayMask & SPAN_XY) {
- rb->PutMonoValues(ctx, rb, span->end, span->array->x,
- span->array->y, value, span->array->mask);
- }
- else {
- rb->PutMonoRow(ctx, rb, span->end, span->x, span->y,
- value, span->array->mask);
- }
- }
- else {
- /* each fragment is a different color */
- GLubyte index8[MAX_WIDTH];
- GLushort index16[MAX_WIDTH];
- void *values;
-
- if (rb->DataType == GL_UNSIGNED_BYTE) {
- GLuint k;
- for (k = 0; k < span->end; k++) {
- index8[k] = (GLubyte) span->array->index[k];
- }
- values = index8;
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- GLuint k;
- for (k = 0; k < span->end; k++) {
- index16[k] = (GLushort) span->array->index[k];
- }
- values = index16;
- }
- else {
- ASSERT(rb->DataType == GL_UNSIGNED_INT);
- values = span->array->index;
- }
-
- if (span->arrayMask & SPAN_XY) {
- rb->PutValues(ctx, rb, span->end,
- span->array->x, span->array->y,
- values, span->array->mask);
- }
- else {
- rb->PutRow(ctx, rb, span->end, span->x, span->y,
- values, span->array->mask);
- }
- }
-
- if (buf + 1 < numBuffers) {
- /* restore original span values */
- _mesa_memcpy(span->array->index, indexSave,
- span->end * sizeof(indexSave[0]));
- }
- } /* for buf */
- }
-
- span->interpMask = origInterpMask;
- span->arrayMask = origArrayMask;
-}
-
-
-/**
* Add specular colors to primary colors.
* Only called during fixed-function operation.
* Result is float color array (FRAG_ATTRIB_COL0).
@@ -1278,7 +1029,7 @@ void
_swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask);
+ const GLuint *colorMask = (GLuint *) ctx->Color.ColorMask;
const GLbitfield origInterpMask = span->interpMask;
const GLbitfield origArrayMask = span->arrayMask;
const GLbitfield origArrayAttribs = span->arrayAttribs;
@@ -1305,7 +1056,7 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
span->writeAll = GL_FALSE;
}
else {
- _mesa_memset(span->array->mask, 1, span->end);
+ memset(span->array->mask, 1, span->end);
span->writeAll = GL_TRUE;
}
@@ -1316,6 +1067,13 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
ASSERT(span->end <= MAX_WIDTH);
+ /* Depth bounds test */
+ if (ctx->Depth.BoundsTest && fb->Visual.depthBits > 0) {
+ if (!_swrast_depth_bounds_test(ctx, span)) {
+ return;
+ }
+ }
+
#ifdef DEBUG
/* Make sure all fragments are within window bounds */
if (span->arrayMask & SPAN_XY) {
@@ -1389,7 +1147,7 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
/* We had to wait until now to check for glColorMask(0,0,0,0) because of
* the occlusion test.
*/
- if (colorMask == 0x0) {
+ if (fb->_NumColorDrawBuffers == 1 && colorMask[0] == 0x0) {
/* no colors to write */
goto end;
}
@@ -1470,8 +1228,8 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
if (!multiFragOutputs && numBuffers > 1) {
/* save colors for second, third renderbuffer writes */
- _mesa_memcpy(rgbaSave, span->array->rgba,
- 4 * span->end * sizeof(GLchan));
+ memcpy(rgbaSave, span->array->rgba,
+ 4 * span->end * sizeof(GLchan));
}
ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB);
@@ -1479,12 +1237,12 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
if (ctx->Color._LogicOpEnabled) {
_swrast_logicop_rgba_span(ctx, rb, span);
}
- else if (ctx->Color.BlendEnabled) {
+ else if ((ctx->Color.BlendEnabled >> buf) & 1) {
_swrast_blend_span(ctx, rb, span);
}
- if (colorMask != 0xffffffff) {
- _swrast_mask_rgba_span(ctx, rb, span);
+ if (colorMask[buf] != 0xffffffff) {
+ _swrast_mask_rgba_span(ctx, rb, span, buf);
}
if (span->arrayMask & SPAN_XY) {
@@ -1504,8 +1262,8 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
if (!multiFragOutputs && numBuffers > 1) {
/* restore original span values */
- _mesa_memcpy(span->array->rgba, rgbaSave,
- 4 * span->end * sizeof(GLchan));
+ memcpy(span->array->rgba, rgbaSave,
+ 4 * span->end * sizeof(GLchan));
}
} /* if rb */
@@ -1539,7 +1297,7 @@ _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb,
if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) {
/* completely above, below, or right */
/* XXX maybe leave rgba values undefined? */
- _mesa_bzero(rgba, 4 * n * sizeof(GLchan));
+ memset(rgba, 0, 4 * n * sizeof(GLchan));
}
else {
GLint skip, length;
@@ -1590,74 +1348,6 @@ _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb,
/**
- * Read CI pixels from a renderbuffer. Clipping will be done to prevent
- * reading ouside the buffer's boundaries.
- */
-void
-_swrast_read_index_span( GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, GLuint index[] )
-{
- const GLint bufWidth = (GLint) rb->Width;
- const GLint bufHeight = (GLint) rb->Height;
-
- if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) {
- /* completely above, below, or right */
- _mesa_bzero(index, n * sizeof(GLuint));
- }
- else {
- GLint skip, length;
- if (x < 0) {
- /* left edge clipping */
- skip = -x;
- length = (GLint) n - skip;
- if (length < 0) {
- /* completely left of window */
- return;
- }
- if (length > bufWidth) {
- length = bufWidth;
- }
- }
- else if ((GLint) (x + n) > bufWidth) {
- /* right edge clipping */
- skip = 0;
- length = bufWidth - x;
- if (length < 0) {
- /* completely to right of window */
- return;
- }
- }
- else {
- /* no clipping */
- skip = 0;
- length = (GLint) n;
- }
-
- ASSERT(rb->GetRow);
- ASSERT(rb->_BaseFormat == GL_COLOR_INDEX);
-
- if (rb->DataType == GL_UNSIGNED_BYTE) {
- GLubyte index8[MAX_WIDTH];
- GLint i;
- rb->GetRow(ctx, rb, length, x + skip, y, index8);
- for (i = 0; i < length; i++)
- index[skip + i] = index8[i];
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- GLushort index16[MAX_WIDTH];
- GLint i;
- rb->GetRow(ctx, rb, length, x + skip, y, index16);
- for (i = 0; i < length; i++)
- index[skip + i] = index16[i];
- }
- else if (rb->DataType == GL_UNSIGNED_INT) {
- rb->GetRow(ctx, rb, length, x + skip, y, index + skip);
- }
- }
-}
-
-
-/**
* Wrapper for gl_renderbuffer::GetValues() which does clipping to avoid
* reading values outside the buffer bounds.
* We can use this for reading any format/type of renderbuffer.
@@ -1766,9 +1456,7 @@ _swrast_get_row(GLcontext *ctx, struct gl_renderbuffer *rb,
/**
- * Get RGBA pixels from the given renderbuffer. Put the pixel colors into
- * the span's specular color arrays. The specular color arrays should no
- * longer be needed by time this function is called.
+ * Get RGBA pixels from the given renderbuffer.
* Used by blending, logicop and masking functions.
* \return pointer to the colors we read.
*/
@@ -1779,10 +1467,8 @@ _swrast_get_dest_rgba(GLcontext *ctx, struct gl_renderbuffer *rb,
const GLuint pixelSize = RGBA_PIXEL_SIZE(span->array->ChanType);
void *rbPixels;
- /*
- * Point rbPixels to a temporary space (use specular color arrays).
- */
- rbPixels = span->array->attribs[FRAG_ATTRIB_COL1];
+ /* Point rbPixels to a temporary space */
+ rbPixels = span->array->attribs[FRAG_ATTRIB_MAX - 1];
/* Get destination values from renderbuffer */
if (span->arrayMask & SPAN_XY) {
diff --git a/mesalib/src/mesa/swrast/s_span.h b/mesalib/src/mesa/swrast/s_span.h
index 0eabae20e..aaf1fec2a 100644
--- a/mesalib/src/mesa/swrast/s_span.h
+++ b/mesalib/src/mesa/swrast/s_span.h
@@ -41,13 +41,12 @@
*/
/*@{*/
#define SPAN_RGBA 0x01 /**< interpMask and arrayMask */
-#define SPAN_INDEX 0x02 /**< interpMask and arrayMask */
-#define SPAN_Z 0x04 /**< interpMask and arrayMask */
-#define SPAN_FLAT 0x08 /**< interpMask: flat shading? */
-#define SPAN_XY 0x10 /**< array.x[], y[] valid? */
-#define SPAN_MASK 0x20 /**< was array.mask[] filled in by caller? */
-#define SPAN_LAMBDA 0x40 /**< array.lambda[] valid? */
-#define SPAN_COVERAGE 0x80 /**< array.coverage[] valid? */
+#define SPAN_Z 0x02 /**< interpMask and arrayMask */
+#define SPAN_FLAT 0x04 /**< interpMask: flat shading? */
+#define SPAN_XY 0x08 /**< array.x[], y[] valid? */
+#define SPAN_MASK 0x10 /**< was array.mask[] filled in by caller? */
+#define SPAN_LAMBDA 0x20 /**< array.lambda[] valid? */
+#define SPAN_COVERAGE 0x40 /**< array.coverage[] valid? */
/*@}*/
@@ -187,9 +186,6 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH,
GLfloat s, GLfloat t, GLfloat q, GLfloat invQ);
-extern void
-_swrast_write_index_span( GLcontext *ctx, SWspan *span);
-
extern void
_swrast_write_rgba_span( GLcontext *ctx, SWspan *span);
@@ -200,10 +196,6 @@ _swrast_read_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, GLenum type, GLvoid *rgba);
extern void
-_swrast_read_index_span( GLcontext *ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, GLuint indx[] );
-
-extern void
_swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
void *values, GLuint valueSize);
diff --git a/mesalib/src/mesa/swrast/s_spantemp.h b/mesalib/src/mesa/swrast/s_spantemp.h
index bab2ca737..2948a90f6 100644
--- a/mesalib/src/mesa/swrast/s_spantemp.h
+++ b/mesalib/src/mesa/swrast/s_spantemp.h
@@ -31,7 +31,6 @@
* Define the following macros before including this file:
* NAME(BASE) to generate the function name (i.e. add prefix or suffix)
* RB_TYPE the renderbuffer DataType
- * CI_MODE if set, color index mode, else RGBA
* SPAN_VARS to declare any local variables
* INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel
* INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel
@@ -46,9 +45,7 @@
#include "main/macros.h"
-#ifdef CI_MODE
-#define RB_COMPONENTS 1
-#elif !defined(RB_COMPONENTS)
+#if !defined(RB_COMPONENTS)
#define RB_COMPONENTS 4
#endif
@@ -60,11 +57,7 @@ NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
#ifdef SPAN_VARS
SPAN_VARS
#endif
-#ifdef CI_MODE
- RB_TYPE *dest = (RB_TYPE *) values;
-#else
RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
-#endif
GLuint i;
INIT_PIXEL_PTR(pixel, x, y);
for (i = 0; i < count; i++) {
@@ -82,11 +75,7 @@ NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
#ifdef SPAN_VARS
SPAN_VARS
#endif
-#ifdef CI_MODE
- RB_TYPE *dest = (RB_TYPE *) values;
-#else
RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
-#endif
GLuint i;
for (i = 0; i < count; i++) {
INIT_PIXEL_PTR(pixel, x[i], y[i]);
@@ -125,7 +114,6 @@ NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
}
-#if !defined(CI_MODE)
static void
NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
@@ -149,7 +137,6 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
}
(void) rb;
}
-#endif
static void
@@ -226,7 +213,6 @@ NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
#undef NAME
#undef RB_TYPE
#undef RB_COMPONENTS
-#undef CI_MODE
#undef SPAN_VARS
#undef INIT_PIXEL_PTR
#undef INC_PIXEL_PTR
diff --git a/mesalib/src/mesa/swrast/s_stencil.c b/mesalib/src/mesa/swrast/s_stencil.c
index e9e9d3a4f..aa74b21ee 100644
--- a/mesalib/src/mesa/swrast/s_stencil.c
+++ b/mesalib/src/mesa/swrast/s_stencil.c
@@ -475,7 +475,7 @@ stencil_and_ztest_span(GLcontext *ctx, SWspan *span, GLuint face)
GLubyte passMask[MAX_WIDTH], failMask[MAX_WIDTH], origMask[MAX_WIDTH];
/* save the current mask bits */
- _mesa_memcpy(origMask, mask, n * sizeof(GLubyte));
+ memcpy(origMask, mask, n * sizeof(GLubyte));
/* apply the depth test */
_swrast_depth_test_span(ctx, span);
@@ -918,7 +918,7 @@ stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face )
ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
_swrast_get_values(ctx, rb, n, x, y, stencil, sizeof(GLubyte));
- _mesa_memcpy(origMask, mask, n * sizeof(GLubyte));
+ memcpy(origMask, mask, n * sizeof(GLubyte));
(void) do_stencil_test(ctx, face, n, stencil, mask);
@@ -928,7 +928,7 @@ stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face )
}
else {
GLubyte tmpMask[MAX_WIDTH];
- _mesa_memcpy(tmpMask, mask, n * sizeof(GLubyte));
+ memcpy(tmpMask, mask, n * sizeof(GLubyte));
_swrast_depth_test_span(ctx, span);
@@ -962,7 +962,7 @@ stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face )
ctx->Stencil.ZPassFunc[face], face, mask);
}
else {
- _mesa_memcpy(origMask, mask, n * sizeof(GLubyte));
+ memcpy(origMask, mask, n * sizeof(GLubyte));
_swrast_depth_test_span(ctx, span);
@@ -1181,7 +1181,7 @@ _swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
/* Note: bottom-to-top raster assumed! */
GLubyte *stencil = (GLubyte *) rb->GetPointer(ctx, rb, x, y);
GLuint len = width * height * sizeof(GLubyte);
- _mesa_memset(stencil, clearVal, len);
+ memset(stencil, clearVal, len);
}
else {
/* general case */
@@ -1189,7 +1189,7 @@ _swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
for (i = 0; i < height; i++) {
GLvoid *stencil = rb->GetPointer(ctx, rb, x, y + i);
if (rb->DataType == GL_UNSIGNED_BYTE) {
- _mesa_memset(stencil, clearVal, width);
+ memset(stencil, clearVal, width);
}
else {
_mesa_memset16((short unsigned int*) stencil, clearVal, width);
diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c
index 889164b98..f322663ad 100644
--- a/mesalib/src/mesa/swrast/s_texcombine.c
+++ b/mesalib/src/mesa/swrast/s_texcombine.c
@@ -29,7 +29,6 @@
#include "main/colormac.h"
#include "main/image.h"
#include "main/imports.h"
-#include "main/pixel.h"
#include "shader/prog_instruction.h"
#include "s_context.h"
@@ -317,18 +316,18 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
/* (a * b) + (c * d) - 0.5 */
for (i = 0; i < n; i++) {
rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] +
- arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5) * scaleRGB;
+ arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5F) * scaleRGB;
rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] +
- arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5) * scaleRGB;
+ arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5F) * scaleRGB;
rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] +
- arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5) * scaleRGB;
+ arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5F) * scaleRGB;
}
}
else {
for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * scaleRGB;
- rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * scaleRGB;
- rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * scaleRGB;
+ rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5F) * scaleRGB;
+ rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5F) * scaleRGB;
+ rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5F) * scaleRGB;
}
}
break;
@@ -369,7 +368,7 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
(arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) +
(arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F))
* 4.0F * scaleRGB;
- dot = CLAMP(dot, 0.0, 1.0F);
+ dot = CLAMP(dot, 0.0F, 1.0F);
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = dot;
}
break;
@@ -386,11 +385,11 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
case GL_MODULATE_SIGNED_ADD_ATI:
for (i = 0; i < n; i++) {
rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) +
- arg1[i][RCOMP] - 0.5) * scaleRGB;
+ arg1[i][RCOMP] - 0.5F) * scaleRGB;
rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) +
- arg1[i][GCOMP] - 0.5) * scaleRGB;
+ arg1[i][GCOMP] - 0.5F) * scaleRGB;
rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) +
- arg1[i][BCOMP] - 0.5) * scaleRGB;
+ arg1[i][BCOMP] - 0.5F) * scaleRGB;
}
break;
case GL_MODULATE_SUBTRACT_ATI:
@@ -457,7 +456,7 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
for (i = 0; i < n; i++) {
rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] +
arg2[i][ACOMP] * arg3[i][ACOMP] -
- 0.5) * scaleA;
+ 0.5F) * scaleA;
}
}
else {
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index 0bb988e3e..997c2f4bb 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -445,7 +445,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
switch (wrapMode) {
case GL_CLAMP:
/* Not exactly what the spec says, but it matches NVIDIA output */
- fcol = CLAMP(coord - 0.5F, 0.0, max-1);
+ fcol = CLAMP(coord - 0.5F, 0.0F, max - 1);
i0 = IFLOOR(fcol);
i1 = i0 + 1;
break;
@@ -475,6 +475,18 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
/**
+ * Compute slice/image to use for 1D or 2D array texture.
+ */
+static INLINE GLint
+tex_array_slice(GLfloat coord, GLsizei size)
+{
+ GLint slice = IFLOOR(coord + 0.5f);
+ slice = CLAMP(slice, 0, size - 1);
+ return slice;
+}
+
+
+/**
* Compute nearest integer texcoords for given texobj and coordinate.
*/
static INLINE void
@@ -506,13 +518,13 @@ nearest_texcoord(const struct gl_texture_object *texObj,
break;
case GL_TEXTURE_1D_ARRAY_EXT:
*i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]);
- *j = clamp_rect_coord_nearest(texObj->WrapT, texcoord[1], height);
+ *j = tex_array_slice(texcoord[1], height);
*k = 0;
break;
case GL_TEXTURE_2D_ARRAY_EXT:
*i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]);
*j = nearest_texel_location(texObj->WrapT, img, height, texcoord[1]);
- *k = clamp_rect_coord_nearest(texObj->WrapR, texcoord[2], depth);
+ *k = tex_array_slice(texcoord[2], depth);
break;
default:
*i = *j = *k = 0;
@@ -556,7 +568,7 @@ linear_texcoord(const struct gl_texture_object *texObj,
case GL_TEXTURE_1D_ARRAY_EXT:
linear_texel_locations(texObj->WrapS, img, width,
texcoord[0], i0, i1, wi);
- *j0 = clamp_rect_coord_nearest(texObj->WrapT, texcoord[1], height);
+ *j0 = tex_array_slice(texcoord[1], height);
*j1 = *j0;
*slice = 0;
break;
@@ -566,7 +578,7 @@ linear_texcoord(const struct gl_texture_object *texObj,
texcoord[0], i0, i1, wi);
linear_texel_locations(texObj->WrapT, img, height,
texcoord[1], j0, j1, wj);
- *slice = clamp_rect_coord_nearest(texObj->WrapR, texcoord[2], depth);
+ *slice = tex_array_slice(texcoord[2], depth);
break;
default:
@@ -747,28 +759,28 @@ get_border_color(const struct gl_texture_object *tObj,
{
switch (img->_BaseFormat) {
case GL_RGB:
- rgba[0] = tObj->BorderColor[0];
- rgba[1] = tObj->BorderColor[1];
- rgba[2] = tObj->BorderColor[2];
+ rgba[0] = tObj->BorderColor.f[0];
+ rgba[1] = tObj->BorderColor.f[1];
+ rgba[2] = tObj->BorderColor.f[2];
rgba[3] = 1.0F;
break;
case GL_ALPHA:
rgba[0] = rgba[1] = rgba[2] = 0.0;
- rgba[3] = tObj->BorderColor[3];
+ rgba[3] = tObj->BorderColor.f[3];
break;
case GL_LUMINANCE:
- rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor[0];
+ rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor.f[0];
rgba[3] = 1.0;
break;
case GL_LUMINANCE_ALPHA:
- rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor[0];
- rgba[3] = tObj->BorderColor[3];
+ rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor.f[0];
+ rgba[3] = tObj->BorderColor.f[3];
break;
case GL_INTENSITY:
- rgba[0] = rgba[1] = rgba[2] = rgba[3] = tObj->BorderColor[0];
+ rgba[0] = rgba[1] = rgba[2] = rgba[3] = tObj->BorderColor.f[0];
break;
default:
- COPY_4V(rgba, tObj->BorderColor);
+ COPY_4V(rgba, tObj->BorderColor.f);
}
}
@@ -2269,7 +2281,6 @@ sample_lambda_rect(GLcontext *ctx,
}
-
/**********************************************************************/
/* 2D Texture Array Sampling Functions */
/**********************************************************************/
@@ -2293,7 +2304,7 @@ sample_2d_array_nearest(GLcontext *ctx,
i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]);
j = nearest_texel_location(tObj->WrapT, img, height, texcoord[1]);
- array = clamp_rect_coord_nearest(tObj->WrapR, texcoord[2], depth);
+ array = tex_array_slice(texcoord[2], depth);
if (i < 0 || i >= (GLint) img->Width ||
j < 0 || j >= (GLint) img->Height ||
@@ -2328,10 +2339,10 @@ sample_2d_array_linear(GLcontext *ctx,
linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b);
- array = clamp_rect_coord_nearest(tObj->WrapR, texcoord[2], depth);
+ array = tex_array_slice(texcoord[2], depth);
if (array < 0 || array >= depth) {
- COPY_4V(rgba, tObj->BorderColor);
+ COPY_4V(rgba, tObj->BorderColor.f);
}
else {
if (img->Border) {
@@ -2601,7 +2612,7 @@ sample_1d_array_nearest(GLcontext *ctx,
(void) ctx;
i = nearest_texel_location(tObj->WrapS, img, width, texcoord[0]);
- array = clamp_rect_coord_nearest(tObj->WrapT, texcoord[1], height);
+ array = tex_array_slice(texcoord[1], height);
if (i < 0 || i >= (GLint) img->Width ||
array < 0 || array >= (GLint) img->Height) {
@@ -2633,7 +2644,7 @@ sample_1d_array_linear(GLcontext *ctx,
GLfloat t0[4], t1[4];
linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a);
- array = clamp_rect_coord_nearest(tObj->WrapT, texcoord[1], height);
+ array = tex_array_slice(texcoord[1], height);
if (img->Border) {
i0 += img->Border;
@@ -3002,7 +3013,7 @@ sample_depth_texture( GLcontext *ctx,
img->FetchTexelf(img, col, row, slice, &depthSample);
}
else {
- depthSample = tObj->BorderColor[0];
+ depthSample = tObj->BorderColor.f[0];
}
result = shadow_compare(function, texcoords[i][compare_coord],
@@ -3053,21 +3064,21 @@ sample_depth_texture( GLcontext *ctx,
}
if (slice < 0 || slice >= (GLint) depth) {
- depth00 = tObj->BorderColor[0];
- depth01 = tObj->BorderColor[0];
- depth10 = tObj->BorderColor[0];
- depth11 = tObj->BorderColor[0];
+ depth00 = tObj->BorderColor.f[0];
+ depth01 = tObj->BorderColor.f[0];
+ depth10 = tObj->BorderColor.f[0];
+ depth11 = tObj->BorderColor.f[0];
}
else {
/* get four depth samples from the texture */
if (useBorderTexel & (I0BIT | J0BIT)) {
- depth00 = tObj->BorderColor[0];
+ depth00 = tObj->BorderColor.f[0];
}
else {
img->FetchTexelf(img, i0, j0, slice, &depth00);
}
if (useBorderTexel & (I1BIT | J0BIT)) {
- depth10 = tObj->BorderColor[0];
+ depth10 = tObj->BorderColor.f[0];
}
else {
img->FetchTexelf(img, i1, j0, slice, &depth10);
@@ -3075,13 +3086,13 @@ sample_depth_texture( GLcontext *ctx,
if (tObj->Target != GL_TEXTURE_1D_ARRAY_EXT) {
if (useBorderTexel & (I0BIT | J1BIT)) {
- depth01 = tObj->BorderColor[0];
+ depth01 = tObj->BorderColor.f[0];
}
else {
img->FetchTexelf(img, i0, j1, slice, &depth01);
}
if (useBorderTexel & (I1BIT | J1BIT)) {
- depth11 = tObj->BorderColor[0];
+ depth11 = tObj->BorderColor.f[0];
}
else {
img->FetchTexelf(img, i1, j1, slice, &depth11);
diff --git a/mesalib/src/mesa/swrast/s_triangle.c b/mesalib/src/mesa/swrast/s_triangle.c
index 5bec60669..812dddf15 100644
--- a/mesalib/src/mesa/swrast/s_triangle.c
+++ b/mesalib/src/mesa/swrast/s_triangle.c
@@ -70,18 +70,6 @@ _swrast_culltriangle( GLcontext *ctx,
/*
- * Render a smooth or flat-shaded color index triangle.
- */
-#define NAME ci_triangle
-#define INTERP_Z 1
-#define INTERP_ATTRIBS 1 /* just for fog */
-#define INTERP_INDEX 1
-#define RENDER_SPAN( span ) _swrast_write_index_span(ctx, &span);
-#include "s_tritemp.h"
-
-
-
-/*
* Render a flat-shaded RGBA triangle.
*/
#define NAME flat_rgba_triangle
@@ -1007,7 +995,6 @@ void
_swrast_choose_triangle( GLcontext *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLboolean rgbmode = ctx->Visual.rgbMode;
if (ctx->Polygon.CullFlag &&
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) {
@@ -1029,23 +1016,15 @@ _swrast_choose_triangle( GLcontext *ctx )
ctx->Depth.Mask == GL_FALSE &&
ctx->Depth.Func == GL_LESS &&
!ctx->Stencil._Enabled) {
- if ((rgbmode &&
- ctx->Color.ColorMask[0] == 0 &&
- ctx->Color.ColorMask[1] == 0 &&
- ctx->Color.ColorMask[2] == 0 &&
- ctx->Color.ColorMask[3] == 0)
- ||
- (!rgbmode && ctx->Color.IndexMask == 0)) {
+ if (ctx->Color.ColorMask[0][0] == 0 &&
+ ctx->Color.ColorMask[0][1] == 0 &&
+ ctx->Color.ColorMask[0][2] == 0 &&
+ ctx->Color.ColorMask[0][3] == 0) {
USE(occlusion_zless_triangle);
return;
}
}
- if (!rgbmode) {
- USE(ci_triangle);
- return;
- }
-
/*
* XXX should examine swrast->_ActiveAttribMask to determine what
* needs to be interpolated.
diff --git a/mesalib/src/mesa/swrast/s_tritemp.h b/mesalib/src/mesa/swrast/s_tritemp.h
index 8e3c5b5ee..0aa8739f4 100644
--- a/mesalib/src/mesa/swrast/s_tritemp.h
+++ b/mesalib/src/mesa/swrast/s_tritemp.h
@@ -32,7 +32,6 @@
* INTERP_Z - if defined, interpolate integer Z values
* INTERP_RGB - if defined, interpolate integer RGB values
* INTERP_ALPHA - if defined, interpolate integer Alpha values
- * INTERP_INDEX - if defined, interpolate color index values
* INTERP_INT_TEX - if defined, interpolate integer ST texcoords
* (fast, simple 2-D texture mapping, without
* perspective correction)
@@ -319,9 +318,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
{
GLint scan_from_left_to_right; /* true if scanning left-to-right */
-#ifdef INTERP_INDEX
- GLfloat didx, didy;
-#endif
/*
* Execute user-supplied setup code
@@ -398,21 +394,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
# endif
}
#endif /* INTERP_RGB */
-#ifdef INTERP_INDEX
- span.interpMask |= SPAN_INDEX;
- if (ctx->Light.ShadeModel == GL_SMOOTH) {
- GLfloat eMaj_di = vMax->attrib[FRAG_ATTRIB_CI][0] - vMin->attrib[FRAG_ATTRIB_CI][0];
- GLfloat eBot_di = vMid->attrib[FRAG_ATTRIB_CI][0] - vMin->attrib[FRAG_ATTRIB_CI][0];
- didx = oneOverArea * (eMaj_di * eBot.dy - eMaj.dy * eBot_di);
- didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx);
- span.indexStep = SignedFloatToFixed(didx);
- }
- else {
- span.interpMask |= SPAN_FLAT;
- didx = didy = 0.0F;
- span.indexStep = 0;
- }
-#endif
#ifdef INTERP_INT_TEX
{
GLfloat eMaj_ds = (vMax->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE;
@@ -531,9 +512,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#ifdef INTERP_ALPHA
GLint aLeft = 0, fdaOuter = 0, fdaInner;
#endif
-#ifdef INTERP_INDEX
- GLfixed iLeft=0, diOuter=0, diInner;
-#endif
#ifdef INTERP_INT_TEX
GLfixed sLeft=0, dsOuter=0, dsInner;
GLfixed tLeft=0, dtOuter=0, dtInner;
@@ -697,18 +675,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#endif /* INTERP_RGB */
-#ifdef INTERP_INDEX
- if (ctx->Light.ShadeModel == GL_SMOOTH) {
- iLeft = (GLfixed)(vLower->attrib[FRAG_ATTRIB_CI][0] * FIXED_SCALE
- + didx * adjx + didy * adjy) + FIXED_HALF;
- diOuter = SignedFloatToFixed(didy + dxOuter * didx);
- }
- else {
- ASSERT(ctx->Light.ShadeModel == GL_FLAT);
- iLeft = FloatToFixed(v2->attrib[FRAG_ATTRIB_CI][0]);
- diOuter = 0;
- }
-#endif
#ifdef INTERP_INT_TEX
{
GLfloat s0, t0;
@@ -784,9 +750,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#ifdef INTERP_ALPHA
fdaInner = fdaOuter + span.alphaStep;
#endif
-#ifdef INTERP_INDEX
- diInner = diOuter + span.indexStep;
-#endif
#ifdef INTERP_INT_TEX
dsInner = dsOuter + span.intTexStep[0];
dtInner = dtOuter + span.intTexStep[1];
@@ -822,9 +785,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#ifdef INTERP_ALPHA
span.alpha = aLeft;
#endif
-#ifdef INTERP_INDEX
- span.index = iLeft;
-#endif
#ifdef INTERP_INT_TEX
span.intTex[0] = sLeft;
span.intTex[1] = tLeft;
@@ -855,9 +815,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#ifdef INTERP_ALPHA
CLAMP_INTERPOLANT(alpha, alphaStep, len);
#endif
-#ifdef INTERP_INDEX
- CLAMP_INTERPOLANT(index, indexStep, len);
-#endif
{
RENDER_SPAN( span );
}
@@ -896,9 +853,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#ifdef INTERP_ALPHA
aLeft += fdaOuter;
#endif
-#ifdef INTERP_INDEX
- iLeft += diOuter;
-#endif
#ifdef INTERP_INT_TEX
sLeft += dsOuter;
tLeft += dtOuter;
@@ -931,9 +885,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#ifdef INTERP_ALPHA
aLeft += fdaInner;
#endif
-#ifdef INTERP_INDEX
- iLeft += diInner;
-#endif
#ifdef INTERP_INT_TEX
sLeft += dsInner;
tLeft += dtInner;
@@ -967,7 +918,6 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#undef INTERP_Z
#undef INTERP_RGB
#undef INTERP_ALPHA
-#undef INTERP_INDEX
#undef INTERP_INT_TEX
#undef INTERP_ATTRIBS
diff --git a/mesalib/src/mesa/swrast/s_zoom.c b/mesalib/src/mesa/swrast/s_zoom.c
index a48eae192..f224627d5 100644
--- a/mesalib/src/mesa/swrast/s_zoom.c
+++ b/mesalib/src/mesa/swrast/s_zoom.c
@@ -185,15 +185,6 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
zoomed.arrayAttribs |= FRAG_BIT_COL0; /* we'll produce these values */
ASSERT(span->arrayMask & SPAN_RGBA);
}
- else if (format == GL_COLOR_INDEX) {
- /* copy Z info */
- zoomed.z = span->z;
- zoomed.zStep = span->zStep;
- /* we'll generate an array of color indexes */
- zoomed.interpMask = span->interpMask & ~SPAN_INDEX;
- zoomed.arrayMask |= SPAN_INDEX;
- ASSERT(span->arrayMask & SPAN_INDEX);
- }
else if (format == GL_DEPTH_COMPONENT) {
/* Copy color info */
zoomed.red = span->red;
@@ -288,16 +279,6 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
}
}
}
- else if (format == GL_COLOR_INDEX) {
- const GLuint *indexes = (const GLuint *) src;
- GLint i;
- for (i = 0; i < zoomedWidth; i++) {
- GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
- ASSERT(j >= 0);
- ASSERT(j < (GLint) span->end);
- zoomed.array->index[i] = indexes[j];
- }
- }
else if (format == GL_DEPTH_COMPONENT) {
const GLuint *zValues = (const GLuint *) src;
GLint i;
@@ -307,8 +288,8 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
ASSERT(j < (GLint) span->end);
zoomed.array->z[i] = zValues[j];
}
- /* Now, fall into either the RGB or COLOR_INDEX path below */
- format = ctx->Visual.rgbMode ? GL_RGBA : GL_COLOR_INDEX;
+ /* Now, fall into the RGB path below */
+ format = GL_RGBA;
}
/* write the span in rows [r0, r1) */
@@ -324,30 +305,14 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
((zoomed.array->ChanType == GL_UNSIGNED_SHORT) ? 4 * sizeof(GLushort)
: 4 * sizeof(GLfloat));
if (y1 - y0 > 1) {
- MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * pixelSize);
+ memcpy(rgbaSave, zoomed.array->rgba, zoomed.end * pixelSize);
}
for (zoomed.y = y0; zoomed.y < y1; zoomed.y++) {
_swrast_write_rgba_span(ctx, &zoomed);
zoomed.end = end; /* restore */
if (y1 - y0 > 1) {
/* restore the colors */
- MEMCPY(zoomed.array->rgba, rgbaSave, zoomed.end * pixelSize);
- }
- }
- }
- else if (format == GL_COLOR_INDEX) {
- /* use specular color array for temp storage */
- GLuint *indexSave = (GLuint *) zoomed.array->attribs[FRAG_ATTRIB_FOGC];
- const GLint end = zoomed.end; /* save */
- if (y1 - y0 > 1) {
- MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint));
- }
- for (zoomed.y = y0; zoomed.y < y1; zoomed.y++) {
- _swrast_write_index_span(ctx, &zoomed);
- zoomed.end = end; /* restore */
- if (y1 - y0 > 1) {
- /* restore the colors */
- MEMCPY(zoomed.array->index, indexSave, zoomed.end * sizeof(GLuint));
+ memcpy(zoomed.array->rgba, rgbaSave, zoomed.end * pixelSize);
}
}
}
@@ -371,15 +336,6 @@ _swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY,
void
-_swrast_write_zoomed_index_span(GLcontext *ctx, GLint imgX, GLint imgY,
- const SWspan *span)
-{
- zoom_span(ctx, imgX, imgY, span,
- (const GLvoid *) span->array->index, GL_COLOR_INDEX);
-}
-
-
-void
_swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY,
const SWspan *span)
{
diff --git a/mesalib/src/mesa/swrast/s_zoom.h b/mesalib/src/mesa/swrast/s_zoom.h
index d2815b41a..43917be65 100644
--- a/mesalib/src/mesa/swrast/s_zoom.h
+++ b/mesalib/src/mesa/swrast/s_zoom.h
@@ -37,10 +37,6 @@ _swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY,
const SWspan *span, const GLvoid *rgb);
extern void
-_swrast_write_zoomed_index_span(GLcontext *ctx, GLint imgX, GLint imgY,
- const SWspan *span);
-
-extern void
_swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY,
const SWspan *span);
diff --git a/mesalib/src/mesa/swrast/swrast.h b/mesalib/src/mesa/swrast/swrast.h
index c183b315b..c01cf7d1f 100644
--- a/mesalib/src/mesa/swrast/swrast.h
+++ b/mesalib/src/mesa/swrast/swrast.h
@@ -75,12 +75,6 @@ typedef struct {
} SWvertex;
-/**
- * Fixed point data type.
- */
-typedef int GLfixed;
-
-
#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0