LOTS of changes, building upon Klaus's work.
struct sw_span is used throughout span/fragment processing. This is leading to less code and more chances for optimization.
This commit is contained in:
parent
6a731f343e
commit
2a182a9897
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_aatriangle.c,v 1.21 2001/12/17 04:54:35 brianp Exp $ */
|
||||
/* $Id: s_aatriangle.c,v 1.22 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -30,6 +30,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "macros.h"
|
||||
#include "mem.h"
|
||||
#include "mmath.h"
|
||||
#include "s_aatriangle.h"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id: s_aatritemp.h,v 1.23 2001/12/17 04:54:35 brianp Exp $ */
|
||||
/* $Id: s_aatritemp.h,v 1.24 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
* Version: 4.1
|
||||
*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -57,11 +57,9 @@
|
|||
|
||||
#ifdef DO_Z
|
||||
GLfloat zPlane[4];
|
||||
GLdepth z[MAX_WIDTH];
|
||||
#endif
|
||||
#ifdef DO_FOG
|
||||
GLfloat fogPlane[4];
|
||||
GLfloat fog[MAX_WIDTH];
|
||||
#else
|
||||
GLfloat *fog = NULL;
|
||||
#endif
|
||||
|
@ -70,9 +68,6 @@
|
|||
#endif
|
||||
#ifdef DO_INDEX
|
||||
GLfloat iPlane[4];
|
||||
GLint icoverageSpan[MAX_WIDTH];
|
||||
#else
|
||||
GLfloat coverageSpan[MAX_WIDTH];
|
||||
#endif
|
||||
#ifdef DO_SPEC
|
||||
GLfloat srPlane[4], sgPlane[4], sbPlane[4];
|
||||
|
@ -90,6 +85,9 @@
|
|||
GLfloat bf = SWRAST_CONTEXT(ctx)->_backface_sign;
|
||||
|
||||
|
||||
INIT_SPAN(span);
|
||||
span.arrayMask |= SPAN_COVERAGE;
|
||||
|
||||
/* determine bottom to top order of vertices */
|
||||
{
|
||||
GLfloat y0 = v0->win[1];
|
||||
|
@ -143,9 +141,11 @@
|
|||
*/
|
||||
#ifdef DO_Z
|
||||
compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane);
|
||||
span.arrayMask |= SPAN_Z;
|
||||
#endif
|
||||
#ifdef DO_FOG
|
||||
compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane);
|
||||
span.arrayMask |= SPAN_FOG;
|
||||
#endif
|
||||
#ifdef DO_RGBA
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
|
@ -160,6 +160,7 @@
|
|||
constant_plane(v2->color[BCOMP], bPlane);
|
||||
constant_plane(v2->color[ACOMP], aPlane);
|
||||
}
|
||||
span.arrayMask |= SPAN_RGBA;
|
||||
#endif
|
||||
#ifdef DO_INDEX
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
|
@ -169,6 +170,7 @@
|
|||
else {
|
||||
constant_plane((GLfloat) v2->index, iPlane);
|
||||
}
|
||||
span.arrayMask |= SPAN_INDEX;
|
||||
#endif
|
||||
#ifdef DO_SPEC
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
|
@ -181,6 +183,7 @@
|
|||
constant_plane(v2->specular[GCOMP], sgPlane);
|
||||
constant_plane(v2->specular[BCOMP], sbPlane);
|
||||
}
|
||||
span.arrayMask |= SPAN_SPEC;
|
||||
#endif
|
||||
#ifdef DO_TEX
|
||||
{
|
||||
|
@ -208,6 +211,7 @@
|
|||
texWidth = (GLfloat) texImage->Width;
|
||||
texHeight = (GLfloat) texImage->Height;
|
||||
}
|
||||
span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
|
||||
#elif defined(DO_MULTITEX)
|
||||
{
|
||||
GLuint u;
|
||||
|
@ -239,6 +243,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
|
||||
#endif
|
||||
|
||||
/* Begin bottom-to-top scan over the triangle.
|
||||
|
@ -282,15 +287,15 @@
|
|||
/* (cx,cy) = center of fragment */
|
||||
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
|
||||
#ifdef DO_INDEX
|
||||
icoverageSpan[count] = compute_coveragei(pMin, pMid, pMax, ix, iy);
|
||||
span.coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
|
||||
#else
|
||||
coverageSpan[count] = coverage;
|
||||
span.coverage[count] = coverage;
|
||||
#endif
|
||||
#ifdef DO_Z
|
||||
z[count] = (GLdepth) solve_plane(cx, cy, zPlane);
|
||||
span.zArray[count] = (GLdepth) solve_plane(cx, cy, zPlane);
|
||||
#endif
|
||||
#ifdef DO_FOG
|
||||
fog[count] = solve_plane(cx, cy, fogPlane);
|
||||
span.fogArray[count] = solve_plane(cx, cy, fogPlane);
|
||||
#endif
|
||||
#ifdef DO_RGBA
|
||||
span.color.rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
|
||||
|
@ -302,9 +307,9 @@
|
|||
span.color.index[count] = (GLint) solve_plane(cx, cy, iPlane);
|
||||
#endif
|
||||
#ifdef DO_SPEC
|
||||
span.specular[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
|
||||
span.specular[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
|
||||
span.specular[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
|
||||
span.specArray[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
|
||||
span.specArray[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
|
||||
span.specArray[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
|
||||
#endif
|
||||
#ifdef DO_TEX
|
||||
{
|
||||
|
@ -342,38 +347,39 @@
|
|||
|
||||
#ifdef DO_MULTITEX
|
||||
# ifdef DO_SPEC
|
||||
_old_write_multitexture_span(ctx, n, startX, iy, z, fog,
|
||||
_old_write_multitexture_span(ctx, n, startX, iy, span.zArray,
|
||||
span.fogArray,
|
||||
span.texcoords,
|
||||
span.lambda, span.color.rgba,
|
||||
span.specular,
|
||||
coverageSpan, GL_POLYGON);
|
||||
span.specArray,
|
||||
span.coverage, GL_POLYGON);
|
||||
# else
|
||||
_old_write_multitexture_span(ctx, n, startX, iy, z, fog,
|
||||
_old_write_multitexture_span(ctx, n, startX, iy, span.zArray,
|
||||
span.fogArray,
|
||||
span.texcoords,
|
||||
span.lambda, span.color.rgba,
|
||||
NULL, coverageSpan,
|
||||
NULL, span.coverage,
|
||||
GL_POLYGON);
|
||||
# endif
|
||||
#elif defined(DO_TEX)
|
||||
# ifdef DO_SPEC
|
||||
_old_write_texture_span(ctx, n, startX, iy, z, fog,
|
||||
span.texcoords[0],
|
||||
span.lambda[0], span.color.rgba,
|
||||
span.specular,
|
||||
coverageSpan, GL_POLYGON);
|
||||
# else
|
||||
_old_write_texture_span(ctx, n, startX, iy, z, fog,
|
||||
span.texcoords[0],
|
||||
span.lambda[0],
|
||||
span.color.rgba, NULL,
|
||||
coverageSpan, GL_POLYGON);
|
||||
# endif
|
||||
|
||||
span.x = startX;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
_mesa_write_texture_span(ctx, &span, GL_POLYGON);
|
||||
|
||||
#elif defined(DO_RGBA)
|
||||
_old_write_rgba_span(ctx, n, startX, iy, z, fog, span.color.rgba,
|
||||
coverageSpan, GL_POLYGON);
|
||||
span.x = startX;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
ASSERT(span.interpMask == 0);
|
||||
_mesa_write_rgba_span(ctx, &span, GL_POLYGON);
|
||||
#elif defined(DO_INDEX)
|
||||
_old_write_index_span(ctx, n, startX, iy, z, fog, span.color.index,
|
||||
icoverageSpan, GL_POLYGON);
|
||||
span.x = startX;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
ASSERT(span.interpMask == 0);
|
||||
_mesa_write_index_span(ctx, &span, GL_POLYGON);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -411,15 +417,15 @@
|
|||
/* (cx,cy) = center of fragment */
|
||||
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
|
||||
#ifdef DO_INDEX
|
||||
icoverageSpan[ix] = compute_coveragei(pMin, pMid, pMax, ix, iy);
|
||||
span.coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
|
||||
#else
|
||||
coverageSpan[ix] = coverage;
|
||||
span.coverage[ix] = coverage;
|
||||
#endif
|
||||
#ifdef DO_Z
|
||||
z[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
|
||||
span.zArray[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
|
||||
#endif
|
||||
#ifdef DO_FOG
|
||||
fog[ix] = solve_plane(cx, cy, fogPlane);
|
||||
span.fogArray[ix] = solve_plane(cx, cy, fogPlane);
|
||||
#endif
|
||||
#ifdef DO_RGBA
|
||||
span.color.rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
|
||||
|
@ -431,9 +437,9 @@
|
|||
span.color.index[ix] = (GLint) solve_plane(cx, cy, iPlane);
|
||||
#endif
|
||||
#ifdef DO_SPEC
|
||||
span.specular[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
|
||||
span.specular[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
|
||||
span.specular[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
|
||||
span.specArray[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
|
||||
span.specArray[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
|
||||
span.specArray[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
|
||||
#endif
|
||||
#ifdef DO_TEX
|
||||
{
|
||||
|
@ -489,46 +495,76 @@
|
|||
}
|
||||
}
|
||||
# ifdef DO_SPEC
|
||||
_old_write_multitexture_span(ctx, n, left, iy, z + left, fog + left,
|
||||
_old_write_multitexture_span(ctx, n, left, iy, span.zArray + left,
|
||||
span.fogArray + left,
|
||||
span.texcoords, span.lambda,
|
||||
span.color.rgba + left,
|
||||
span.specular + left,
|
||||
coverageSpan + left,
|
||||
span.specArray + left,
|
||||
span.coverage + left,
|
||||
GL_POLYGON);
|
||||
# else
|
||||
_old_write_multitexture_span(ctx, n, left, iy, z + left, fog + left,
|
||||
_old_write_multitexture_span(ctx, n, left, iy, span.zArray + left,
|
||||
span.fogArray + left,
|
||||
span.texcoords, span.lambda,
|
||||
span.color.rgba + left, NULL,
|
||||
coverageSpan + left,
|
||||
span.coverage + left,
|
||||
GL_POLYGON);
|
||||
# endif
|
||||
#elif defined(DO_TEX)
|
||||
# ifdef DO_SPEC
|
||||
_old_write_texture_span(ctx, n, left, iy, z + left, fog + left,
|
||||
span.texcoords[0] + left,
|
||||
span.lambda[0] + left,
|
||||
span.color.rgba + left,
|
||||
span.specular + left, coverageSpan + left,
|
||||
GL_POLYGON);
|
||||
# else
|
||||
_old_write_texture_span(ctx, n, left, iy, z + left, fog + left,
|
||||
span.texcoords[0] + left,
|
||||
span.lambda[0] + left,
|
||||
span.color.rgba + left, NULL,
|
||||
coverageSpan + left, GL_POLYGON);
|
||||
# endif
|
||||
|
||||
/* XXX this is temporary */
|
||||
{
|
||||
GLint j;
|
||||
for (j = 0; j < (GLint) n; j++) {
|
||||
span.fogArray[j] = span.fogArray[j + left];
|
||||
span.zArray[j] = span.zArray[j + left];
|
||||
COPY_4V(span.color.rgba[j], span.color.rgba[j + left]);
|
||||
COPY_4V(span.specArray[j], span.specArray[j + left]);
|
||||
COPY_4V(span.texcoords[0][j], span.texcoords[0][j + left]);
|
||||
span.lambda[0][j] = span.lambda[0][j + left];
|
||||
span.coverage[j] = span.coverage[j + left];
|
||||
}
|
||||
}
|
||||
span.x = left;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
_mesa_write_texture_span(ctx, &span, GL_POLYGON);
|
||||
|
||||
#elif defined(DO_RGBA)
|
||||
_old_write_rgba_span(ctx, n, left, iy, z + left, fog + left,
|
||||
span.color.rgba + left, coverageSpan + left, GL_POLYGON);
|
||||
/* XXX this is temporary */
|
||||
{
|
||||
GLint j;
|
||||
for (j = 0; j < (GLint) n; j++) {
|
||||
span.fogArray[j] = span.fogArray[j + left];
|
||||
span.zArray[j] = span.zArray[j + left];
|
||||
COPY_4V(span.color.rgba[j], span.color.rgba[j + left]);
|
||||
span.coverage[j] = span.coverage[j + left];
|
||||
}
|
||||
}
|
||||
span.x = left;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
ASSERT(span.interpMask == 0);
|
||||
_mesa_write_rgba_span(ctx, &span, GL_POLYGON);
|
||||
#elif defined(DO_INDEX)
|
||||
_old_write_index_span(ctx, n, left, iy, z + left, fog + left,
|
||||
span.color.index + left,
|
||||
icoverageSpan + left, GL_POLYGON);
|
||||
/* XXX this is temporary */
|
||||
{
|
||||
GLint j;
|
||||
for (j = 0; j < (GLint) n; j++) {
|
||||
span.fogArray[j] = span.fogArray[j + left];
|
||||
span.zArray[j] = span.zArray[j + left];
|
||||
span.color.index[j] = span.color.index[j + left];
|
||||
span.coverage[j] = span.coverage[j + left];
|
||||
}
|
||||
}
|
||||
span.x = left;
|
||||
span.y = iy;
|
||||
span.end = n;
|
||||
ASSERT(span.interpMask == 0);
|
||||
_mesa_write_index_span(ctx, &span, GL_POLYGON);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_alpha.c,v 1.5 2002/01/21 18:12:34 brianp Exp $ */
|
||||
/* $Id: s_alpha.c,v 1.6 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -49,11 +49,7 @@ _mesa_alpha_test( const GLcontext *ctx, struct sw_span *span,
|
|||
const GLchan ref = ctx->Color.AlphaRef;
|
||||
GLubyte *mask = span->mask;
|
||||
|
||||
ASSERT (span->filledMask == GL_TRUE);
|
||||
ASSERT (span->filledAlpha == GL_TRUE);
|
||||
|
||||
SW_SPAN_SET_FLAG(span->testedAlpha);
|
||||
|
||||
ASSERT (span->filledAlpha == GL_TRUE || (span->arrayMask & SPAN_RGBA));
|
||||
|
||||
/* switch cases ordered from most frequent to less frequent */
|
||||
switch (ctx->Color.AlphaFunc) {
|
||||
|
@ -97,6 +93,8 @@ _mesa_alpha_test( const GLcontext *ctx, struct sw_span *span,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* XXXX This causes conformance failures!!!! */
|
||||
while ((span->start <= span->end) &&
|
||||
(mask[span->start] == 0))
|
||||
span->start ++;
|
||||
|
@ -104,7 +102,7 @@ _mesa_alpha_test( const GLcontext *ctx, struct sw_span *span,
|
|||
while ((span->end >= span->start) &&
|
||||
(mask[span->end] == 0))
|
||||
span->end --;
|
||||
|
||||
#endif
|
||||
span->writeAll = GL_FALSE;
|
||||
|
||||
if (span->start >= span->end)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_copypix.c,v 1.28 2002/01/16 16:04:50 brianp Exp $ */
|
||||
/* $Id: s_copypix.c,v 1.29 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -101,8 +101,6 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
GLint width, GLint height, GLint destx, GLint desty)
|
||||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
GLfloat fogSpan[MAX_WIDTH];
|
||||
GLboolean quick_draw;
|
||||
GLint row;
|
||||
GLboolean changeBuffer;
|
||||
|
@ -110,23 +108,16 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
|
||||
const GLuint transferOps = ctx->_ImageTransferState;
|
||||
GLfloat *dest, *tmpImage, *convImage;
|
||||
struct sw_span span;
|
||||
|
||||
if (ctx->Depth.Test || ctx->Fog.Enabled) {
|
||||
/* fill in array of z values */
|
||||
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMax);
|
||||
GLfloat fog;
|
||||
GLint i;
|
||||
INIT_SPAN(span);
|
||||
span.arrayMask |= SPAN_RGBA;
|
||||
|
||||
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
|
||||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord);
|
||||
else
|
||||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
|
||||
if (ctx->Depth.Test)
|
||||
_mesa_span_default_z(ctx, &span);
|
||||
if (ctx->Fog.Enabled)
|
||||
_mesa_span_default_fog(ctx, &span);
|
||||
|
||||
for (i = 0; i < width; i++) {
|
||||
zspan[i] = z;
|
||||
fogSpan[i] = fog;
|
||||
}
|
||||
}
|
||||
|
||||
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0
|
||||
&& !zoom
|
||||
|
@ -254,7 +245,6 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
|
||||
for (row = 0; row < height; row++) {
|
||||
const GLfloat *src = convImage + row * width * 4;
|
||||
GLchan rgba[MAX_WIDTH][4];
|
||||
GLint i, dy;
|
||||
|
||||
/* clamp to [0,1] and convert float back to chan */
|
||||
|
@ -263,30 +253,15 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
GLint g = (GLint) (src[i * 4 + GCOMP] * CHAN_MAXF);
|
||||
GLint b = (GLint) (src[i * 4 + BCOMP] * CHAN_MAXF);
|
||||
GLint a = (GLint) (src[i * 4 + ACOMP] * CHAN_MAXF);
|
||||
rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
|
||||
rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
|
||||
rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
|
||||
rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
|
||||
span.color.rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
|
||||
span.color.rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
|
||||
span.color.rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
|
||||
span.color.rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
|
||||
}
|
||||
|
||||
if (ctx->Texture._ReallyEnabled && ctx->Pixel.PixelTextureEnabled) {
|
||||
GLchan primary_rgba[MAX_WIDTH][4];
|
||||
GLuint unit;
|
||||
DEFMARRAY(GLfloat, texcoord, MAX_WIDTH, 4); /* mac 32k limitation */
|
||||
CHECKARRAY(texcoord, return); /* mac 32k limitation */
|
||||
|
||||
/* XXX not sure how multitexture is supposed to work here */
|
||||
|
||||
MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan));
|
||||
|
||||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
|
||||
_mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba,
|
||||
texcoord);
|
||||
_old_swrast_texture_fragments( ctx, unit, width, texcoord, NULL,
|
||||
(CONST GLchan (*)[4]) primary_rgba,
|
||||
rgba);
|
||||
}
|
||||
UNDEFARRAY(texcoord); /* mac 32k limitation */
|
||||
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._ReallyEnabled) {
|
||||
span.end = width;
|
||||
_swrast_pixel_texture(ctx, &span);
|
||||
}
|
||||
|
||||
/* write row to framebuffer */
|
||||
|
@ -294,15 +269,19 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
dy = desty + row;
|
||||
if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) {
|
||||
(*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
|
||||
(const GLchan (*)[4])rgba, NULL );
|
||||
(const GLchan (*)[4])span.color.rgba, NULL );
|
||||
}
|
||||
else if (zoom) {
|
||||
_mesa_write_zoomed_rgba_span( ctx, width, destx, dy, zspan, fogSpan,
|
||||
(const GLchan (*)[4])rgba, desty);
|
||||
_mesa_write_zoomed_rgba_span( ctx, width, destx, dy, span.zArray,
|
||||
span.fogArray,
|
||||
(const GLchan (*)[4])span.color.rgba,
|
||||
desty);
|
||||
}
|
||||
else {
|
||||
_old_write_rgba_span( ctx, width, destx, dy, zspan, fogSpan, rgba,
|
||||
NULL, GL_BITMAP );
|
||||
span.x = destx;
|
||||
span.y = dy;
|
||||
span.end = width;
|
||||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,9 +297,6 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
GLint width, GLint height, GLint destx, GLint desty)
|
||||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
GLfloat fogSpan[MAX_WIDTH];
|
||||
GLchan rgba[MAX_WIDTH][4];
|
||||
GLchan *tmpImage,*p;
|
||||
GLboolean quick_draw;
|
||||
GLint sy, dy, stepy;
|
||||
|
@ -330,6 +306,10 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
|
||||
GLint overlapping;
|
||||
const GLuint transferOps = ctx->_ImageTransferState;
|
||||
struct sw_span span;
|
||||
|
||||
INIT_SPAN(span);
|
||||
span.arrayMask |= SPAN_RGBA;
|
||||
|
||||
if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) {
|
||||
copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty);
|
||||
|
@ -364,11 +344,17 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
|
||||
|
||||
for (i=0;i<width;i++) {
|
||||
zspan[i] = z;
|
||||
fogSpan[i] = fog;
|
||||
span.zArray[i] = z;
|
||||
span.fogArray[i] = fog;
|
||||
}
|
||||
span.arrayMask |= (SPAN_Z | SPAN_FOG);
|
||||
}
|
||||
|
||||
if (ctx->Depth.Test)
|
||||
_mesa_span_default_z(ctx, &span);
|
||||
if (ctx->Fog.Enabled)
|
||||
_mesa_span_default_fog(ctx, &span);
|
||||
|
||||
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0
|
||||
&& !zoom
|
||||
&& destx >= 0
|
||||
|
@ -423,7 +409,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
/* Get source pixels */
|
||||
if (overlapping) {
|
||||
/* get from buffered image */
|
||||
MEMCPY(rgba, p, width * sizeof(GLchan) * 4);
|
||||
MEMCPY(span.color.rgba, p, width * sizeof(GLchan) * 4);
|
||||
p += (width * sizeof(GLchan) * 4);
|
||||
}
|
||||
else {
|
||||
|
@ -444,7 +430,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
ctx->ReadBuffer->Alpha = ctx->ReadBuffer->BackRightAlpha;
|
||||
}
|
||||
}
|
||||
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, sy, rgba );
|
||||
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, sy, span.color.rgba );
|
||||
}
|
||||
|
||||
if (changeBuffer) {
|
||||
|
@ -462,10 +448,10 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
|
||||
/* convert chan to float */
|
||||
for (k = 0; k < width; k++) {
|
||||
rgbaFloat[k][RCOMP] = (GLfloat) rgba[k][RCOMP] * scale;
|
||||
rgbaFloat[k][GCOMP] = (GLfloat) rgba[k][GCOMP] * scale;
|
||||
rgbaFloat[k][BCOMP] = (GLfloat) rgba[k][BCOMP] * scale;
|
||||
rgbaFloat[k][ACOMP] = (GLfloat) rgba[k][ACOMP] * scale;
|
||||
rgbaFloat[k][RCOMP] = (GLfloat) span.color.rgba[k][RCOMP] * scale;
|
||||
rgbaFloat[k][GCOMP] = (GLfloat) span.color.rgba[k][GCOMP] * scale;
|
||||
rgbaFloat[k][BCOMP] = (GLfloat) span.color.rgba[k][BCOMP] * scale;
|
||||
rgbaFloat[k][ACOMP] = (GLfloat) span.color.rgba[k][ACOMP] * scale;
|
||||
}
|
||||
/* scale & bias */
|
||||
if (transferOps & IMAGE_SCALE_BIAS_BIT) {
|
||||
|
@ -485,7 +471,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
}
|
||||
/* convolution */
|
||||
if (transferOps & IMAGE_CONVOLUTION_BIT) {
|
||||
/* XXX to do */
|
||||
abort(); /* should never get here; caught at top of function */
|
||||
}
|
||||
/* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */
|
||||
if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) {
|
||||
|
@ -525,45 +511,34 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
GLint g = (GLint) (rgbaFloat[k][GCOMP] * CHAN_MAXF);
|
||||
GLint b = (GLint) (rgbaFloat[k][BCOMP] * CHAN_MAXF);
|
||||
GLint a = (GLint) (rgbaFloat[k][ACOMP] * CHAN_MAXF);
|
||||
rgba[k][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
|
||||
rgba[k][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
|
||||
rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
|
||||
rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
|
||||
span.color.rgba[k][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
|
||||
span.color.rgba[k][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
|
||||
span.color.rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
|
||||
span.color.rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
|
||||
}
|
||||
UNDEFARRAY(rgbaFloat); /* mac 32k limitation */
|
||||
}
|
||||
|
||||
if (ctx->Texture._ReallyEnabled && ctx->Pixel.PixelTextureEnabled) {
|
||||
GLuint unit;
|
||||
GLchan primary_rgba[MAX_WIDTH][4];
|
||||
DEFMARRAY(GLfloat, texcoord, MAX_WIDTH, 4); /* mac 32k limitation */
|
||||
CHECKARRAY(texcoord, return); /* mac 32k limitation */
|
||||
|
||||
/* XXX not sure how multitexture is supposed to work here */
|
||||
MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan));
|
||||
|
||||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
|
||||
_mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba,
|
||||
texcoord);
|
||||
_old_swrast_texture_fragments( ctx, unit, width, texcoord, NULL,
|
||||
(CONST GLchan (*)[4]) primary_rgba,
|
||||
rgba);
|
||||
}
|
||||
|
||||
UNDEFARRAY(texcoord); /* mac 32k limitation */
|
||||
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._ReallyEnabled) {
|
||||
span.end = width;
|
||||
_swrast_pixel_texture(ctx, &span);
|
||||
}
|
||||
|
||||
if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) {
|
||||
(*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
|
||||
(const GLchan (*)[4])rgba, NULL );
|
||||
(const GLchan (*)[4])span.color.rgba, NULL );
|
||||
}
|
||||
else if (zoom) {
|
||||
_mesa_write_zoomed_rgba_span( ctx, width, destx, dy, zspan, fogSpan,
|
||||
(const GLchan (*)[4])rgba, desty);
|
||||
_mesa_write_zoomed_rgba_span( ctx, width, destx, dy, span.zArray,
|
||||
span.fogArray,
|
||||
(const GLchan (*)[4]) span.color.rgba,
|
||||
desty);
|
||||
}
|
||||
else {
|
||||
_old_write_rgba_span( ctx, width, destx, dy, zspan, fogSpan, rgba,
|
||||
NULL, GL_BITMAP );
|
||||
span.x = destx;
|
||||
span.y = dy;
|
||||
span.end = width;
|
||||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -581,15 +556,17 @@ static void copy_ci_pixels( GLcontext *ctx,
|
|||
GLint destx, GLint desty )
|
||||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
GLfloat fogSpan[MAX_WIDTH];
|
||||
GLuint *tmpImage,*p;
|
||||
GLint sy, dy, stepy;
|
||||
GLint i, j;
|
||||
GLint j;
|
||||
GLboolean changeBuffer;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
|
||||
const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset;
|
||||
GLint overlapping;
|
||||
struct sw_span span;
|
||||
|
||||
INIT_SPAN(span);
|
||||
span.arrayMask |= SPAN_INDEX;
|
||||
|
||||
/* Determine if copy should be bottom-to-top or top-to-bottom */
|
||||
if (srcy<desty) {
|
||||
|
@ -608,21 +585,10 @@ static void copy_ci_pixels( GLcontext *ctx,
|
|||
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
|
||||
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
|
||||
|
||||
if (ctx->Depth.Test || ctx->Fog.Enabled) {
|
||||
/* fill in array of z values */
|
||||
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMax);
|
||||
GLfloat fog;
|
||||
|
||||
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
|
||||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord);
|
||||
else
|
||||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
|
||||
|
||||
for (i=0;i<width;i++) {
|
||||
zspan[i] = z;
|
||||
fogSpan[i] = fog;
|
||||
}
|
||||
}
|
||||
if (ctx->Depth.Test)
|
||||
_mesa_span_default_z(ctx, &span);
|
||||
if (ctx->Fog.Enabled)
|
||||
_mesa_span_default_fog(ctx, &span);
|
||||
|
||||
/* If read and draw buffer are different we must do buffer switching */
|
||||
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer
|
||||
|
@ -655,9 +621,8 @@ static void copy_ci_pixels( GLcontext *ctx,
|
|||
}
|
||||
|
||||
for (j = 0; j < height; j++, sy += stepy, dy += stepy) {
|
||||
GLuint indexes[MAX_WIDTH];
|
||||
if (overlapping) {
|
||||
MEMCPY(indexes, p, width * sizeof(GLuint));
|
||||
MEMCPY(span.color.index, p, width * sizeof(GLuint));
|
||||
p += width;
|
||||
}
|
||||
else {
|
||||
|
@ -665,7 +630,8 @@ static void copy_ci_pixels( GLcontext *ctx,
|
|||
(*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
|
||||
ctx->Pixel.DriverReadBuffer );
|
||||
}
|
||||
_mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy, indexes );
|
||||
_mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy,
|
||||
span.color.index );
|
||||
}
|
||||
|
||||
if (changeBuffer) {
|
||||
|
@ -675,19 +641,22 @@ static void copy_ci_pixels( GLcontext *ctx,
|
|||
}
|
||||
|
||||
if (shift_or_offset) {
|
||||
_mesa_shift_and_offset_ci( ctx, width, indexes );
|
||||
_mesa_shift_and_offset_ci( ctx, width, span.color.index );
|
||||
}
|
||||
if (ctx->Pixel.MapColorFlag) {
|
||||
_mesa_map_ci( ctx, width, indexes );
|
||||
_mesa_map_ci( ctx, width, span.color.index );
|
||||
}
|
||||
|
||||
if (zoom) {
|
||||
_mesa_write_zoomed_index_span(ctx, width, destx, dy, zspan, fogSpan,
|
||||
indexes, desty );
|
||||
_mesa_write_zoomed_index_span(ctx, width, destx, dy,
|
||||
span.zArray, span.fogArray,
|
||||
span.color.index, desty );
|
||||
}
|
||||
else {
|
||||
_old_write_index_span(ctx, width, destx, dy, zspan, fogSpan, indexes,
|
||||
NULL, GL_BITMAP);
|
||||
span.x = destx;
|
||||
span.y = dy;
|
||||
span.end = width;
|
||||
_mesa_write_index_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -709,20 +678,18 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
GLint destx, GLint desty )
|
||||
{
|
||||
GLfloat depth[MAX_WIDTH];
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
GLfloat fogSpan[MAX_WIDTH];
|
||||
GLfloat *p, *tmpImage;
|
||||
GLuint indexes[MAX_WIDTH];
|
||||
GLint sy, dy, stepy;
|
||||
GLint i, j;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
|
||||
GLint overlapping;
|
||||
DEFMARRAY(GLchan, rgba, MAX_WIDTH, 4); /* mac 32k limitation */
|
||||
CHECKARRAY(rgba, return); /* mac 32k limitation */
|
||||
struct sw_span span;
|
||||
|
||||
INIT_SPAN(span);
|
||||
span.arrayMask |= SPAN_Z;
|
||||
|
||||
if (!ctx->Visual.depthBits) {
|
||||
_mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" );
|
||||
UNDEFARRAY(rgba); /* mac 32k limitation */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -743,45 +710,15 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
|
||||
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
|
||||
|
||||
/* setup colors or indexes */
|
||||
if (ctx->Visual.rgbMode) {
|
||||
GLchan r, g, b, a;
|
||||
UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
|
||||
for (i = 0; i < width; i++) {
|
||||
rgba[i][RCOMP] = r;
|
||||
rgba[i][GCOMP] = g;
|
||||
rgba[i][BCOMP] = b;
|
||||
rgba[i][ACOMP] = a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < width; i++) {
|
||||
indexes[i] = ctx->Current.Index;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->Fog.Enabled) {
|
||||
GLfloat fog;
|
||||
|
||||
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
|
||||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord);
|
||||
else
|
||||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
|
||||
|
||||
for (i = 0; i < width; i++) {
|
||||
fogSpan[i] = fog;
|
||||
}
|
||||
}
|
||||
_mesa_span_default_color(ctx, &span);
|
||||
if (ctx->Fog.Enabled)
|
||||
_mesa_span_default_fog(ctx, &span);
|
||||
|
||||
if (overlapping) {
|
||||
GLint ssy = sy;
|
||||
tmpImage = (GLfloat *) MALLOC(width * height * sizeof(GLfloat));
|
||||
if (!tmpImage) {
|
||||
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
|
||||
UNDEFARRAY(rgba); /* mac 32k limitation */
|
||||
return;
|
||||
}
|
||||
p = tmpImage;
|
||||
|
@ -807,33 +744,38 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
|
||||
for (i = 0; i < width; i++) {
|
||||
GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
|
||||
zspan[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->DepthMax);
|
||||
span.zArray[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->DepthMax);
|
||||
}
|
||||
|
||||
if (ctx->Visual.rgbMode) {
|
||||
if (zoom) {
|
||||
_mesa_write_zoomed_rgba_span( ctx, width, destx, dy, zspan,
|
||||
fogSpan, (const GLchan (*)[4])rgba, desty );
|
||||
_mesa_write_zoomed_rgba_span( ctx, width, destx, dy, span.zArray,
|
||||
span.fogArray,
|
||||
(const GLchan (*)[4])span.color.rgba,
|
||||
desty );
|
||||
}
|
||||
else {
|
||||
_old_write_rgba_span( ctx, width, destx, dy, zspan, fogSpan,
|
||||
(GLchan (*)[4])rgba, NULL, GL_BITMAP);
|
||||
span.x = destx;
|
||||
span.y = dy;
|
||||
span.end = width;
|
||||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (zoom) {
|
||||
_mesa_write_zoomed_index_span( ctx, width, destx, dy,
|
||||
zspan, fogSpan, indexes, desty );
|
||||
span.zArray, span.fogArray,
|
||||
span.color.index, desty );
|
||||
}
|
||||
else {
|
||||
_old_write_index_span( ctx, width, destx, dy,
|
||||
zspan, fogSpan, indexes, NULL, GL_BITMAP );
|
||||
span.x = destx;
|
||||
span.y = dy;
|
||||
span.end = width;
|
||||
_mesa_write_index_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UNDEFARRAY(rgba); /* mac 32k limitation */
|
||||
|
||||
if (overlapping)
|
||||
FREE(tmpImage);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_depth.c,v 1.11 2002/01/21 18:12:34 brianp Exp $ */
|
||||
/* $Id: s_depth.c,v 1.12 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -572,10 +572,8 @@ _mesa_depth_test_span( GLcontext *ctx, struct sw_span *span)
|
|||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
|
||||
ASSERT(span->activeMask & SPAN_Z);
|
||||
ASSERT(span->filledMask == GL_TRUE);
|
||||
ASSERT(span->filledDepth == GL_TRUE);
|
||||
SW_SPAN_SET_FLAG(span->testedDepth);
|
||||
ASSERT((span->interpMask & SPAN_Z) || (span->arrayMask & SPAN_Z));
|
||||
ASSERT((span->filledDepth == GL_TRUE) || (span->arrayMask & SPAN_Z));
|
||||
|
||||
if (swrast->Driver.ReadDepthSpan) {
|
||||
/* hardware-based depth buffer */
|
||||
|
@ -583,7 +581,7 @@ _mesa_depth_test_span( GLcontext *ctx, struct sw_span *span)
|
|||
GLuint passed;
|
||||
(*swrast->Driver.ReadDepthSpan)(ctx, span->end, span->x, span->y, zbuffer);
|
||||
passed = depth_test_span32(ctx, span->end, span->x, span->y,
|
||||
zbuffer, span->depth, span->mask);
|
||||
zbuffer, span->zArray, span->mask);
|
||||
ASSERT(swrast->Driver.WriteDepthSpan);
|
||||
(*swrast->Driver.WriteDepthSpan)(ctx, span->end, span->x, span->y, zbuffer, span->mask);
|
||||
if (passed < span->end)
|
||||
|
@ -595,11 +593,11 @@ _mesa_depth_test_span( GLcontext *ctx, struct sw_span *span)
|
|||
/* software depth buffer */
|
||||
if (ctx->Visual.depthBits <= 16) {
|
||||
GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, span->x, span->y);
|
||||
passed = depth_test_span16(ctx, span->end, span->x, span->y, zptr, span->depth, span->mask);
|
||||
passed = depth_test_span16(ctx, span->end, span->x, span->y, zptr, span->zArray, span->mask);
|
||||
}
|
||||
else {
|
||||
GLuint *zptr = (GLuint *) Z_ADDRESS32(ctx, span->x, span->y);
|
||||
passed = depth_test_span32(ctx, span->end, span->x, span->y, zptr, span->depth, span->mask);
|
||||
passed = depth_test_span32(ctx, span->end, span->x, span->y, zptr, span->zArray, span->mask);
|
||||
}
|
||||
if (passed < span->end)
|
||||
span->writeAll = GL_FALSE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_drawpix.c,v 1.25 2002/01/15 21:49:58 brianp Exp $ */
|
||||
/* $Id: s_drawpix.c,v 1.26 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -489,46 +489,37 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
{
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
const GLint desty = y;
|
||||
GLint row, drawWidth;
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
GLfloat fogSpan[MAX_WIDTH];
|
||||
GLint row, drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
|
||||
struct sw_span span;
|
||||
|
||||
drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
|
||||
INIT_SPAN(span);
|
||||
span.arrayMask |= SPAN_INDEX;
|
||||
|
||||
/* Fragment depth values */
|
||||
if (ctx->Depth.Test || ctx->Fog.Enabled) {
|
||||
GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMaxF);
|
||||
GLfloat fog;
|
||||
GLint i;
|
||||
|
||||
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
|
||||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord);
|
||||
else
|
||||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
|
||||
|
||||
for (i = 0; i < drawWidth; i++) {
|
||||
zspan[i] = zval;
|
||||
fogSpan[i] = fog;
|
||||
}
|
||||
}
|
||||
if (ctx->Depth.Test)
|
||||
_mesa_span_default_z(ctx, &span);
|
||||
if (ctx->Fog.Enabled)
|
||||
_mesa_span_default_fog(ctx, &span);
|
||||
|
||||
/*
|
||||
* General solution
|
||||
*/
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
GLuint indexes[MAX_WIDTH];
|
||||
const GLvoid *source = _mesa_image_address(&ctx->Unpack,
|
||||
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0);
|
||||
_mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT, indexes,
|
||||
_mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT,
|
||||
span.color.index,
|
||||
type, source, &ctx->Unpack,
|
||||
ctx->_ImageTransferState);
|
||||
if (zoom) {
|
||||
_mesa_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, fogSpan,
|
||||
indexes, desty);
|
||||
_mesa_write_zoomed_index_span(ctx, drawWidth, x, y,
|
||||
span.zArray, span.fogArray,
|
||||
span.color.index, desty);
|
||||
}
|
||||
else {
|
||||
_old_write_index_span(ctx, drawWidth, x, y, zspan, fogSpan, indexes,
|
||||
NULL, GL_BITMAP);
|
||||
span.x = x;
|
||||
span.y = y;
|
||||
span.end = drawWidth;
|
||||
_mesa_write_index_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -594,7 +585,6 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Do a glDrawPixels of depth values.
|
||||
*/
|
||||
|
@ -606,9 +596,12 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
const GLint desty = y;
|
||||
GLchan rgba[MAX_WIDTH][4];
|
||||
GLuint ispan[MAX_WIDTH];
|
||||
GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
|
||||
struct sw_span span;
|
||||
|
||||
INIT_SPAN(span);
|
||||
span.arrayMask |= SPAN_Z;
|
||||
span.end = drawWidth;
|
||||
|
||||
if (type != GL_BYTE
|
||||
&& type != GL_UNSIGNED_BYTE
|
||||
|
@ -621,42 +614,28 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Colors or indexes */
|
||||
if (ctx->Visual.rgbMode) {
|
||||
GLint i;
|
||||
GLint 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]);
|
||||
for (i = 0; i < drawWidth; i++) {
|
||||
rgba[i][RCOMP] = r;
|
||||
rgba[i][GCOMP] = g;
|
||||
rgba[i][BCOMP] = b;
|
||||
rgba[i][ACOMP] = a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
GLint i;
|
||||
for (i = 0; i < drawWidth; i++) {
|
||||
ispan[i] = ctx->Current.RasterIndex;
|
||||
}
|
||||
}
|
||||
_mesa_span_default_color(ctx, &span);
|
||||
|
||||
if (ctx->Fog.Enabled)
|
||||
_mesa_span_default_fog(ctx, &span);
|
||||
|
||||
if (type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort)
|
||||
&& !bias_or_scale && !zoom && ctx->Visual.rgbMode) {
|
||||
/* Special case: directly write 16-bit depth values */
|
||||
GLint row;
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
const GLushort *zptr = (const GLushort *)
|
||||
_mesa_image_address(&ctx->Unpack, pixels, width, height,
|
||||
GL_DEPTH_COMPONENT, type, 0, row, 0);
|
||||
GLint i;
|
||||
for (i = 0; i < width; i++)
|
||||
zspan[i] = zptr[i];
|
||||
_old_write_rgba_span(ctx, width, x, y, zspan, 0, rgba,
|
||||
NULL, GL_BITMAP);
|
||||
for (i = 0; i < drawWidth; i++)
|
||||
span.zArray[i] = zptr[i];
|
||||
|
||||
span.x = x;
|
||||
span.y = y;
|
||||
span.end = drawWidth;
|
||||
span.filledDepth = GL_TRUE; /* XXX temporary */
|
||||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
else if (type==GL_UNSIGNED_INT && ctx->Visual.depthBits == 32
|
||||
|
@ -667,8 +646,15 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
const GLuint *zptr = (const GLuint *)
|
||||
_mesa_image_address(&ctx->Unpack, pixels, width, height,
|
||||
GL_DEPTH_COMPONENT, type, 0, row, 0);
|
||||
_old_write_rgba_span(ctx, width, x, y, zptr, 0, rgba,
|
||||
NULL, GL_BITMAP);
|
||||
|
||||
/* XXX get rid of this loop. use zArray pointer in span */
|
||||
GLint i;
|
||||
for (i = 0; i < drawWidth; i++)
|
||||
span.zArray[i] = zptr[i];
|
||||
span.x = x;
|
||||
span.y = y;
|
||||
span.end = drawWidth;
|
||||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -676,7 +662,6 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
GLint row;
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
GLfloat fspan[MAX_WIDTH];
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
const GLvoid *src = _mesa_image_address(&ctx->Unpack,
|
||||
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
|
||||
_mesa_unpack_depth_span( ctx, drawWidth, fspan, type, src,
|
||||
|
@ -686,31 +671,35 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
const GLfloat zs = ctx->DepthMaxF;
|
||||
GLint i;
|
||||
for (i = 0; i < drawWidth; i++) {
|
||||
zspan[i] = (GLdepth) (fspan[i] * zs);
|
||||
span.zArray[i] = (GLdepth) (fspan[i] * zs);
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->Visual.rgbMode) {
|
||||
if (zoom) {
|
||||
_mesa_write_zoomed_rgba_span(ctx, width, x, y, zspan, 0,
|
||||
(const GLchan (*)[4]) rgba, desty);
|
||||
_mesa_write_zoomed_rgba_span(ctx, width, x, y, span.zArray, 0,
|
||||
(const GLchan (*)[4]) span.color.rgba, desty);
|
||||
}
|
||||
else {
|
||||
_old_write_rgba_span(ctx, width, x, y, zspan, 0,
|
||||
rgba, NULL, GL_BITMAP);
|
||||
span.x = x;
|
||||
span.y = y;
|
||||
span.end = drawWidth;
|
||||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (zoom) {
|
||||
_mesa_write_zoomed_index_span(ctx, width, x, y, zspan, 0,
|
||||
ispan, GL_BITMAP);
|
||||
_mesa_write_zoomed_index_span(ctx, drawWidth, x, y,
|
||||
span.zArray, 0,
|
||||
span.color.index, GL_BITMAP);
|
||||
}
|
||||
else {
|
||||
_old_write_index_span(ctx, width, x, y, zspan, 0,
|
||||
ispan, NULL, GL_BITMAP);
|
||||
span.x = x;
|
||||
span.y = y;
|
||||
span.end = drawWidth;
|
||||
_mesa_write_index_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -728,11 +717,13 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
|
||||
const GLint desty = y;
|
||||
GLdepth zspan[MAX_WIDTH];
|
||||
GLfloat fogSpan[MAX_WIDTH];
|
||||
GLboolean quickDraw;
|
||||
GLfloat *convImage = NULL;
|
||||
GLuint transferOps = ctx->_ImageTransferState;
|
||||
struct sw_span span;
|
||||
|
||||
INIT_SPAN(span);
|
||||
span.arrayMask |= SPAN_RGBA;
|
||||
|
||||
if (!_mesa_is_legal_format_and_type(format, type)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(format or type)");
|
||||
|
@ -756,11 +747,14 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
|
||||
|
||||
for (i=0;i<width;i++) {
|
||||
zspan[i] = z;
|
||||
fogSpan[i] = fog;
|
||||
span.zArray[i] = z;
|
||||
span.fogArray[i] = fog;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->Fog.Enabled)
|
||||
_mesa_span_default_fog(ctx, &span);
|
||||
span.arrayMask |= SPAN_Z;
|
||||
|
||||
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
|
||||
&& x + width <= ctx->DrawBuffer->Width
|
||||
|
@ -827,54 +821,47 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||
* General solution
|
||||
*/
|
||||
{
|
||||
GLchan rgba[MAX_WIDTH][4];
|
||||
GLint row;
|
||||
if (width > MAX_WIDTH)
|
||||
width = MAX_WIDTH;
|
||||
for (row = 0; row < height; row++, y++) {
|
||||
const GLvoid *source = _mesa_image_address(unpack,
|
||||
pixels, width, height, format, type, 0, row, 0);
|
||||
_mesa_unpack_chan_color_span(ctx, width, GL_RGBA, (GLchan *) rgba,
|
||||
/* printf("Unpack f=0x%x t=0x%x\n", format, type);*/
|
||||
_mesa_unpack_chan_color_span(ctx, width, GL_RGBA,
|
||||
(GLchan *) span.color.rgba,
|
||||
format, type, source, unpack,
|
||||
transferOps);
|
||||
if (0){
|
||||
int k;
|
||||
for (k = 0; k < width; k++)
|
||||
printf("%02x ", span.color.rgba[k][3]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if ((ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) ||
|
||||
(ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink))
|
||||
continue;
|
||||
|
||||
if (ctx->Texture._ReallyEnabled && ctx->Pixel.PixelTextureEnabled) {
|
||||
GLchan primary_rgba[MAX_WIDTH][4];
|
||||
GLuint unit;
|
||||
|
||||
DEFMARRAY(GLfloat, texcoord, MAX_WIDTH, 4);/* mac 32k limitation */
|
||||
CHECKARRAY(texcoord, return); /* mac 32k limitation */
|
||||
|
||||
/* XXX not sure how multitexture is supposed to work here */
|
||||
MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan));
|
||||
|
||||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
|
||||
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
|
||||
_mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba,
|
||||
texcoord);
|
||||
_old_swrast_texture_fragments( ctx, unit, width,
|
||||
texcoord, NULL,
|
||||
(CONST GLchan (*)[4]) primary_rgba,
|
||||
rgba);
|
||||
}
|
||||
}
|
||||
UNDEFARRAY(texcoord); /* mac 32k limitation */
|
||||
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._ReallyEnabled) {
|
||||
span.end = width;
|
||||
_swrast_pixel_texture(ctx, &span);
|
||||
}
|
||||
|
||||
if (quickDraw) {
|
||||
(*swrast->Driver.WriteRGBASpan)(ctx, width, x, y,
|
||||
(CONST GLchan (*)[4]) rgba, NULL);
|
||||
(CONST GLchan (*)[4]) span.color.rgba, NULL);
|
||||
}
|
||||
else if (zoom) {
|
||||
_mesa_write_zoomed_rgba_span(ctx, width, x, y, zspan, fogSpan,
|
||||
(CONST GLchan (*)[4]) rgba, desty);
|
||||
_mesa_write_zoomed_rgba_span(ctx, width, x, y, span.zArray,
|
||||
span.fogArray,
|
||||
(CONST GLchan (*)[4]) span.color.rgba, desty);
|
||||
}
|
||||
else {
|
||||
_old_write_rgba_span(ctx, (GLuint) width, x, y, zspan, fogSpan,
|
||||
rgba, NULL, GL_BITMAP);
|
||||
span.x = x;
|
||||
span.y = y;
|
||||
span.end = width;
|
||||
_mesa_write_rgba_span(ctx, &span, GL_BITMAP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -905,7 +892,6 @@ _swrast_DrawPixels( GLcontext *ctx,
|
|||
_swrast_validate_derived( ctx );
|
||||
|
||||
RENDER_START(swrast,ctx);
|
||||
|
||||
switch (format) {
|
||||
case GL_STENCIL_INDEX:
|
||||
draw_stencil_pixels( ctx, x, y, width, height, type, pixels );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_fog.c,v 1.17 2002/01/21 18:12:34 brianp Exp $ */
|
||||
/* $Id: s_fog.c,v 1.18 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -85,9 +85,10 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx, struct sw_span *span,
|
|||
GLfloat fog = span->fog, Dfog = span->fogStep;
|
||||
GLchan rFog, gFog, bFog;
|
||||
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->activeMask & SPAN_FOG);
|
||||
ASSERT(span->filledColor == GL_TRUE);
|
||||
ASSERT(span->interpMask & SPAN_FOG);
|
||||
ASSERT(span->filledColor == GL_TRUE || (span->arrayMask & SPAN_RGBA));
|
||||
|
||||
UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
|
||||
|
@ -118,9 +119,10 @@ _mesa_fog_rgba_pixels_with_array( const GLcontext *ctx, struct sw_span *span,
|
|||
GLuint i;
|
||||
GLchan rFog, gFog, bFog;
|
||||
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
ASSERT(fog != NULL);
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->filledColor == GL_TRUE);
|
||||
ASSERT(span->filledColor == GL_TRUE || (span->arrayMask & SPAN_RGBA));
|
||||
|
||||
UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
|
||||
|
@ -151,6 +153,7 @@ _old_fog_rgba_pixels( const GLcontext *ctx,
|
|||
GLuint i;
|
||||
GLchan rFog, gFog, bFog;
|
||||
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
|
||||
|
@ -181,8 +184,8 @@ _mesa_fog_ci_pixels( const GLcontext *ctx, struct sw_span *span,
|
|||
GLfloat fog = span->fog, Dfog = span->fogStep;
|
||||
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->activeMask & SPAN_FOG);
|
||||
ASSERT(span->filledColor == GL_TRUE);
|
||||
ASSERT(span->interpMask & SPAN_FOG);
|
||||
ASSERT(span->interpMask & SPAN_INDEX);
|
||||
|
||||
for (i = 0; i < span->end; i++) {
|
||||
const GLfloat f = CLAMP(fog, 0.0F, 1.0F);
|
||||
|
@ -209,7 +212,7 @@ _mesa_fog_ci_pixels_with_array( const GLcontext *ctx, struct sw_span *span,
|
|||
|
||||
ASSERT(fog != NULL);
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->filledColor == GL_TRUE);
|
||||
ASSERT((span->filledColor == GL_TRUE) || (span->arrayMask & SPAN_INDEX));
|
||||
|
||||
for (i = span->start; i < span->end; i++) {
|
||||
const GLfloat f = CLAMP(fog[i], 0.0F, 1.0F);
|
||||
|
@ -383,7 +386,7 @@ compute_fog_factors_from_z( const GLcontext *ctx,
|
|||
/**
|
||||
* Apply fog to a span of RGBA pixels.
|
||||
* Input: ctx -
|
||||
* span - where span->depth has to be filled.
|
||||
* span - where span->zArray has to be filled.
|
||||
* red, green, blue, alpha - pixel colors
|
||||
* Output: red, green, blue, alpha - fogged pixel colors
|
||||
*/
|
||||
|
@ -393,13 +396,13 @@ _mesa_depth_fog_rgba_pixels(const GLcontext *ctx, struct sw_span *span,
|
|||
{
|
||||
GLfloat fogFact[PB_SIZE];
|
||||
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->activeMask & SPAN_Z);
|
||||
ASSERT(span->arrayMask & SPAN_Z);
|
||||
ASSERT(span->end <= PB_SIZE);
|
||||
ASSERT(span->filledDepth == GL_TRUE);
|
||||
ASSERT(span->filledColor == GL_TRUE);
|
||||
ASSERT((span->filledDepth) == GL_TRUE || (span->arrayMask & SPAN_Z));
|
||||
|
||||
compute_fog_factors_from_z(ctx, span->end, span->depth, fogFact );
|
||||
compute_fog_factors_from_z(ctx, span->end, span->zArray, fogFact );
|
||||
_mesa_fog_rgba_pixels_with_array( ctx, span, fogFact, rgba );
|
||||
}
|
||||
|
||||
|
@ -417,6 +420,7 @@ _old_depth_fog_rgba_pixels( const GLcontext *ctx,
|
|||
{
|
||||
GLfloat fogFact[PB_SIZE];
|
||||
ASSERT(n <= PB_SIZE);
|
||||
/* printf("%s\n", __FUNCTION__);*/
|
||||
compute_fog_factors_from_z( ctx, n, z, fogFact );
|
||||
_old_fog_rgba_pixels( ctx, n, fogFact, rgba );
|
||||
}
|
||||
|
@ -425,7 +429,7 @@ _old_depth_fog_rgba_pixels( const GLcontext *ctx,
|
|||
/**
|
||||
* Apply fog to a span of color index pixels.
|
||||
* Input: ctx -
|
||||
* span - where span->depth has to be filled.
|
||||
* span - where span->zArray has to be filled.
|
||||
* index - pixel color indexes
|
||||
* Output: index - fogged pixel color indexes
|
||||
*/
|
||||
|
@ -436,12 +440,11 @@ _mesa_depth_fog_ci_pixels( const GLcontext *ctx, struct sw_span *span,
|
|||
GLfloat fogFact[PB_SIZE];
|
||||
|
||||
ASSERT(ctx->Fog.Enabled);
|
||||
ASSERT(span->activeMask & SPAN_Z);
|
||||
ASSERT(span->arrayMask & SPAN_Z);
|
||||
ASSERT(span->end <= PB_SIZE);
|
||||
ASSERT(span->filledDepth == GL_TRUE);
|
||||
ASSERT(span->filledColor == GL_TRUE);
|
||||
ASSERT((span->filledDepth == GL_TRUE) || (span->arrayMask & SPAN_Z));
|
||||
|
||||
compute_fog_factors_from_z(ctx, span->end, span->depth, fogFact );
|
||||
compute_fog_factors_from_z(ctx, span->end, span->zArray, fogFact );
|
||||
_mesa_fog_ci_pixels_with_array( ctx, span, fogFact, index );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_pixeltex.c,v 1.4 2002/01/10 16:54:29 brianp Exp $ */
|
||||
/* $Id: s_pixeltex.c,v 1.5 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -35,17 +35,19 @@
|
|||
|
||||
#include "glheader.h"
|
||||
#include "colormac.h"
|
||||
#include "mem.h"
|
||||
|
||||
#include "s_context.h"
|
||||
#include "s_pixeltex.h"
|
||||
#include "s_texture.h"
|
||||
|
||||
|
||||
/*
|
||||
* Convert RGBA values into strq texture coordinates.
|
||||
*/
|
||||
void
|
||||
_mesa_pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4],
|
||||
GLfloat texcoord[][4])
|
||||
static void
|
||||
pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4],
|
||||
GLfloat texcoord[][4])
|
||||
{
|
||||
if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_COLOR) {
|
||||
GLuint i;
|
||||
|
@ -79,3 +81,41 @@ _mesa_pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4],
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Used byglDraw/CopyPixels: the incoming image colors are treated
|
||||
* as texture coordinates. Use those coords to texture the image.
|
||||
* This is for GL_SGIS_pixel_texture / GL_SGIX_pixel_texture.
|
||||
*/
|
||||
void
|
||||
_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span)
|
||||
{
|
||||
if (ctx->Texture._ReallyEnabled & ~TEXTURE0_ANY) {
|
||||
/* multitexture! */
|
||||
GLchan rgbaOut[MAX_WIDTH][4];
|
||||
GLuint unit;
|
||||
|
||||
MEMCPY(rgbaOut, span->color.rgba, 4 * span->end * sizeof(GLchan));
|
||||
|
||||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
|
||||
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
|
||||
pixeltexgen(ctx, span->end,
|
||||
(const GLchan (*)[4]) span->color.rgba,
|
||||
span->texcoords[unit]);
|
||||
_swrast_texture_fragments(ctx, unit, span, rgbaOut);
|
||||
}
|
||||
}
|
||||
|
||||
MEMCPY(span->color.rgba, rgbaOut, 4 * span->end * sizeof(GLchan));
|
||||
}
|
||||
else {
|
||||
/* single texture, unit 0 */
|
||||
ASSERT(ctx->Texture._ReallyEnabled & TEXTURE0_ANY);
|
||||
pixeltexgen(ctx, span->end,
|
||||
(const GLchan (*)[4]) span->color.rgba,
|
||||
span->texcoords[0]);
|
||||
_swrast_texture_fragments(ctx, 0, span, span->color.rgba);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_pixeltex.h,v 1.4 2002/01/10 16:54:29 brianp Exp $ */
|
||||
/* $Id: s_pixeltex.h,v 1.5 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -31,9 +31,9 @@
|
|||
#include "mtypes.h"
|
||||
#include "swrast.h"
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4],
|
||||
GLfloat texcoord[][4]);
|
||||
_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_span.h,v 1.11 2002/01/21 18:12:34 brianp Exp $ */
|
||||
/* $Id: s_span.h,v 1.12 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -34,50 +34,36 @@
|
|||
|
||||
|
||||
extern void
|
||||
_old_write_index_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
const GLdepth z[], const GLfloat fog[],
|
||||
GLuint index[], const GLint coverage[],
|
||||
GLenum primitive );
|
||||
_mesa_span_default_z( GLcontext *ctx, struct sw_span *span );
|
||||
|
||||
extern void
|
||||
_old_write_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
const GLdepth z[], const GLfloat fog[],
|
||||
GLchan rgba[][4], const GLfloat coverage[],
|
||||
GLenum primitive );
|
||||
|
||||
void
|
||||
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span,
|
||||
const GLfloat fog[MAX_WIDTH], GLenum primitive);
|
||||
_mesa_span_default_fog( GLcontext *ctx, struct sw_span *span );
|
||||
|
||||
extern void
|
||||
_mesa_write_monoindex_span( GLcontext *ctx, struct sw_span *span,
|
||||
GLuint index, GLenum primitive );
|
||||
_mesa_span_default_color( GLcontext *ctx, struct sw_span *span );
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span,
|
||||
GLenum primitive);
|
||||
|
||||
extern void
|
||||
_mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span,
|
||||
const GLfloat fog[MAX_WIDTH], GLenum primitive);
|
||||
GLenum primitive);
|
||||
|
||||
extern void
|
||||
_mesa_write_monocolor_span( GLcontext *ctx, struct sw_span *span,
|
||||
const GLchan color[4], GLenum primitive );
|
||||
const GLchan color[4], GLenum primitive );
|
||||
|
||||
extern void
|
||||
_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span,
|
||||
const GLfloat fog[MAX_WIDTH], GLenum primitive );
|
||||
GLenum primitive );
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_rasterize_span(GLcontext *ctx, struct sw_span *span);
|
||||
|
||||
|
||||
extern void
|
||||
_old_write_texture_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
const GLdepth z[], const GLfloat fog[],
|
||||
GLfloat texcoord[][4], GLfloat lambda[],
|
||||
GLchan rgba[][4], GLchan spec[][4],
|
||||
const GLfloat coverage[], GLenum primitive );
|
||||
|
||||
|
||||
extern void
|
||||
_old_write_multitexture_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
const GLdepth z[], const GLfloat fog[],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_stencil.c,v 1.15 2002/01/21 18:12:34 brianp Exp $ */
|
||||
/* $Id: s_stencil.c,v 1.16 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -559,10 +559,11 @@ _mesa_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span)
|
|||
|
||||
ASSERT(ctx->Stencil.Enabled);
|
||||
ASSERT(span->end <= MAX_WIDTH);
|
||||
ASSERT(span->filledMask == GL_TRUE);
|
||||
ASSERT(span->filledDepth == GL_TRUE);
|
||||
SW_SPAN_SET_FLAG(span->testedDepth);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (ctx->Depth.Test) {
|
||||
ASSERT((span->filledDepth == GL_TRUE) || (span->arrayMask & SPAN_Z));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get initial stencil values */
|
||||
if (swrast->Driver.WriteStencilSpan) {
|
||||
|
@ -578,7 +579,7 @@ _mesa_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span)
|
|||
|
||||
/* do all the stencil/depth testing/updating */
|
||||
result = stencil_and_ztest_span( ctx, span->end, span->x, span->y,
|
||||
span->depth, stencil, span->mask );
|
||||
span->zArray, stencil, span->mask );
|
||||
|
||||
if (swrast->Driver.WriteStencilSpan) {
|
||||
/* Write updated stencil values into hardware stencil buffer */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_texture.c,v 1.45 2002/01/10 16:54:29 brianp Exp $ */
|
||||
/* $Id: s_texture.c,v 1.46 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -1032,19 +1032,27 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
|
|||
texcoords[i][0], texcoords[i][1], rgba[i]);
|
||||
break;
|
||||
case GL_NEAREST_MIPMAP_NEAREST:
|
||||
sample_2d_nearest_mipmap_nearest(ctx, tObj, texcoords[i][0], texcoords[i][1],
|
||||
sample_2d_nearest_mipmap_nearest(ctx, tObj,
|
||||
texcoords[i][0],
|
||||
texcoords[i][1],
|
||||
lambda[i], rgba[i]);
|
||||
break;
|
||||
case GL_LINEAR_MIPMAP_NEAREST:
|
||||
sample_2d_linear_mipmap_nearest(ctx,tObj, texcoords[i][0], texcoords[i][1],
|
||||
sample_2d_linear_mipmap_nearest(ctx, tObj,
|
||||
texcoords[i][0],
|
||||
texcoords[i][1],
|
||||
lambda[i], rgba[i]);
|
||||
break;
|
||||
case GL_NEAREST_MIPMAP_LINEAR:
|
||||
sample_2d_nearest_mipmap_linear(ctx,tObj, texcoords[i][0], texcoords[i][1],
|
||||
sample_2d_nearest_mipmap_linear(ctx, tObj,
|
||||
texcoords[i][0],
|
||||
texcoords[i][1],
|
||||
lambda[i], rgba[i]);
|
||||
break;
|
||||
case GL_LINEAR_MIPMAP_LINEAR:
|
||||
sample_2d_linear_mipmap_linear(ctx,tObj, texcoords[i][0], texcoords[i][1],
|
||||
sample_2d_linear_mipmap_linear(ctx, tObj,
|
||||
texcoords[i][0],
|
||||
texcoords[i][1],
|
||||
lambda[i], rgba[i] );
|
||||
break;
|
||||
default:
|
||||
|
@ -1393,7 +1401,9 @@ sample_nearest_3d(GLcontext *ctx, GLuint texUnit,
|
|||
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
|
||||
(void) lambda;
|
||||
for (i=0;i<n;i++) {
|
||||
sample_3d_nearest(ctx, tObj, image, texcoords[i][0], texcoords[i][1], texcoords[i][2], rgba[i]);
|
||||
sample_3d_nearest(ctx, tObj, image,
|
||||
texcoords[i][0], texcoords[i][1], texcoords[i][2],
|
||||
rgba[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1409,7 +1419,9 @@ sample_linear_3d( GLcontext *ctx, GLuint texUnit,
|
|||
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel];
|
||||
(void) lambda;
|
||||
for (i=0;i<n;i++) {
|
||||
sample_3d_linear(ctx, tObj, image, texcoords[i][0], texcoords[i][1], texcoords[i][2], rgba[i]);
|
||||
sample_3d_linear(ctx, tObj, image,
|
||||
texcoords[i][0], texcoords[i][1], texcoords[i][2],
|
||||
rgba[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1434,26 +1446,40 @@ sample_lambda_3d( GLcontext *ctx, GLuint texUnit,
|
|||
switch (tObj->MinFilter) {
|
||||
case GL_NEAREST:
|
||||
sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel],
|
||||
texcoords[i][0], texcoords[i][1], texcoords[i][2], rgba[i]);
|
||||
texcoords[i][0], texcoords[i][1],
|
||||
texcoords[i][2], rgba[i]);
|
||||
break;
|
||||
case GL_LINEAR:
|
||||
sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel],
|
||||
texcoords[i][0], texcoords[i][1], texcoords[i][2], rgba[i]);
|
||||
texcoords[i][0], texcoords[i][1],
|
||||
texcoords[i][2], rgba[i]);
|
||||
break;
|
||||
case GL_NEAREST_MIPMAP_NEAREST:
|
||||
sample_3d_nearest_mipmap_nearest(ctx, tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
|
||||
sample_3d_nearest_mipmap_nearest(ctx, tObj,
|
||||
texcoords[i][0],
|
||||
texcoords[i][1],
|
||||
texcoords[i][2],
|
||||
lambda[i], rgba[i]);
|
||||
break;
|
||||
case GL_LINEAR_MIPMAP_NEAREST:
|
||||
sample_3d_linear_mipmap_nearest(ctx, tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
|
||||
sample_3d_linear_mipmap_nearest(ctx, tObj,
|
||||
texcoords[i][0],
|
||||
texcoords[i][1],
|
||||
texcoords[i][2],
|
||||
lambda[i], rgba[i]);
|
||||
break;
|
||||
case GL_NEAREST_MIPMAP_LINEAR:
|
||||
sample_3d_nearest_mipmap_linear(ctx, tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
|
||||
sample_3d_nearest_mipmap_linear(ctx, tObj,
|
||||
texcoords[i][0],
|
||||
texcoords[i][1],
|
||||
texcoords[i][2],
|
||||
lambda[i], rgba[i]);
|
||||
break;
|
||||
case GL_LINEAR_MIPMAP_LINEAR:
|
||||
sample_3d_linear_mipmap_linear(ctx, tObj, texcoords[i][0], texcoords[i][1], texcoords[i][2],
|
||||
sample_3d_linear_mipmap_linear(ctx, tObj,
|
||||
texcoords[i][0],
|
||||
texcoords[i][1],
|
||||
texcoords[i][2],
|
||||
lambda[i], rgba[i]);
|
||||
break;
|
||||
default:
|
||||
|
@ -1465,11 +1491,13 @@ sample_lambda_3d( GLcontext *ctx, GLuint texUnit,
|
|||
switch (tObj->MagFilter) {
|
||||
case GL_NEAREST:
|
||||
sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel],
|
||||
texcoords[i][0], texcoords[i][1], texcoords[i][2], rgba[i]);
|
||||
texcoords[i][0], texcoords[i][1],
|
||||
texcoords[i][2], rgba[i]);
|
||||
break;
|
||||
case GL_LINEAR:
|
||||
sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel],
|
||||
texcoords[i][0], texcoords[i][1], texcoords[i][2], rgba[i]);
|
||||
texcoords[i][0], texcoords[i][1],
|
||||
texcoords[i][2], rgba[i]);
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(NULL, "Bad mag filter in sample_3d_texture");
|
||||
|
@ -3062,16 +3090,20 @@ _old_swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n,
|
|||
void
|
||||
_swrast_texture_fragments( GLcontext *ctx, GLuint texUnit,
|
||||
struct sw_span *span,
|
||||
GLchan rgba[][4] )
|
||||
GLchan rgbaOut[][4] )
|
||||
{
|
||||
const GLuint mask = TEXTURE0_ANY << (texUnit * 4);
|
||||
|
||||
if (ctx->Texture._ReallyEnabled & mask) {
|
||||
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
|
||||
GLfloat *lambda = span->lambda[texUnit];
|
||||
GLfloat *lambda;
|
||||
|
||||
lambda = (span->arrayMask & SPAN_LAMBDA) ? span->lambda[texUnit] : NULL;
|
||||
|
||||
/* XXXX
|
||||
ASSERT(span->filledTex[texUnit] == GL_TRUE);
|
||||
|
||||
*/
|
||||
|
||||
if (textureUnit->_Current) { /* XXX need this? */
|
||||
const struct gl_texture_object *curObj = textureUnit->_Current;
|
||||
GLchan texel[PB_SIZE][4];
|
||||
|
@ -3111,10 +3143,9 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit,
|
|||
lambda, texel );
|
||||
}
|
||||
apply_texture( ctx, textureUnit, span->end,
|
||||
(CONST GLchan (*)[4])span->color.rgba,
|
||||
(CONST GLchan (*)[4]) texel, rgba );
|
||||
(CONST GLchan (*)[4]) span->color.rgba,
|
||||
(CONST GLchan (*)[4]) texel,
|
||||
rgbaOut );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_texture.h,v 1.8 2002/01/10 16:54:29 brianp Exp $ */
|
||||
/* $Id: s_texture.h,v 1.9 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -47,7 +47,7 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texSet,
|
|||
extern void
|
||||
_old_swrast_texture_fragments( GLcontext *ctx, GLuint texSet, GLuint n,
|
||||
GLfloat texcoords[][4], GLfloat lambda[],
|
||||
CONST GLchan primary_rgba[][4], GLchan rgba[][4] );
|
||||
|
||||
CONST GLchan primary_rgba[][4],
|
||||
GLchan rgba[][4] );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_triangle.c,v 1.48 2002/01/21 18:12:34 brianp Exp $ */
|
||||
/* $Id: s_triangle.c,v 1.49 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -80,8 +80,13 @@ static void flat_ci_triangle( GLcontext *ctx,
|
|||
#define INTERP_Z 1
|
||||
#define INTERP_FOG 1
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
_mesa_write_monoindex_span(ctx, &span, v2->index, GL_POLYGON );
|
||||
#define SETUP_CODE \
|
||||
span.interpMask |= SPAN_INDEX; \
|
||||
span.index = IntToFixed(v2->index); \
|
||||
span.indexStep = 0;
|
||||
|
||||
#define RENDER_SPAN( span ) \
|
||||
_mesa_write_index_span(ctx, &span, GL_POLYGON );
|
||||
|
||||
#include "s_tritemp.h"
|
||||
}
|
||||
|
@ -107,7 +112,7 @@ static void smooth_ci_triangle( GLcontext *ctx,
|
|||
span.color.index[i] = FixedToInt(span.index); \
|
||||
span.index += span.indexStep; \
|
||||
} \
|
||||
_mesa_write_index_span(ctx, &span, NULL, GL_POLYGON);
|
||||
_mesa_write_index_span(ctx, &span, GL_POLYGON);
|
||||
|
||||
#include "s_tritemp.h"
|
||||
}
|
||||
|
@ -156,6 +161,8 @@ static void smooth_rgba_triangle( GLcontext *ctx,
|
|||
GLuint i; \
|
||||
SW_SPAN_SET_FLAG(span.filledColor); \
|
||||
SW_SPAN_SET_FLAG(span.filledAlpha); \
|
||||
ASSERT(span.interpMask & SPAN_RGBA); \
|
||||
span.arrayMask |= SPAN_RGBA; \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
span.color.rgba[i][RCOMP] = FixedToChan(span.red); \
|
||||
span.color.rgba[i][GCOMP] = FixedToChan(span.green); \
|
||||
|
@ -166,7 +173,7 @@ static void smooth_rgba_triangle( GLcontext *ctx,
|
|||
span.blue += span.blueStep; \
|
||||
span.alpha += span.alphaStep; \
|
||||
} \
|
||||
_mesa_write_rgba_span(ctx, &span, NULL, GL_POLYGON);
|
||||
_mesa_write_rgba_span(ctx, &span, GL_POLYGON);
|
||||
|
||||
#include "s_tritemp.h"
|
||||
|
||||
|
@ -267,6 +274,7 @@ static void simple_z_textured_triangle( GLcontext *ctx,
|
|||
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
|
||||
span.intTex[1] -= FIXED_HALF; \
|
||||
SW_SPAN_SET_FLAG(span.filledColor); \
|
||||
SW_SPAN_SET_FLAG(span.filledDepth); \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
const GLdepth z = FixedToDepth(span.z); \
|
||||
if (z < zRow[i]) { \
|
||||
|
@ -460,6 +468,7 @@ affine_span(GLcontext *ctx, struct sw_span *span,
|
|||
GLchan *dest = span->color.rgba[0];
|
||||
|
||||
SW_SPAN_SET_FLAG(span->filledColor);
|
||||
SW_SPAN_SET_FLAG(span->filledAlpha);
|
||||
|
||||
span->intTex[0] -= FIXED_HALF;
|
||||
span->intTex[1] -= FIXED_HALF;
|
||||
|
@ -555,7 +564,9 @@ affine_span(GLcontext *ctx, struct sw_span *span,
|
|||
}
|
||||
break;
|
||||
}
|
||||
_mesa_write_rgba_span(ctx, span, NULL, GL_POLYGON);
|
||||
ASSERT(span->interpMask & SPAN_RGBA);
|
||||
ASSERT(span->arrayMask & SPAN_RGBA);
|
||||
_mesa_write_rgba_span(ctx, span, GL_POLYGON);
|
||||
|
||||
#undef SPAN_NEAREST
|
||||
#undef SPAN_LINEAR
|
||||
|
@ -594,6 +605,7 @@ static void affine_textured_triangle( GLcontext *ctx,
|
|||
info.format = obj->Image[b]->Format; \
|
||||
info.filter = obj->MinFilter; \
|
||||
info.envmode = unit->EnvMode; \
|
||||
span.arrayMask |= SPAN_RGBA; \
|
||||
\
|
||||
if (info.envmode == GL_BLEND) { \
|
||||
/* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \
|
||||
|
@ -726,6 +738,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
|
|||
GLchan *dest = span->color.rgba[0];
|
||||
|
||||
SW_SPAN_SET_FLAG(span->filledColor);
|
||||
SW_SPAN_SET_FLAG(span->filledAlpha);
|
||||
|
||||
tex_coord[0] = span->tex[0][0] * (info->smask + 1),
|
||||
tex_step[0] = span->texStep[0][0] * (info->smask + 1);
|
||||
|
@ -827,7 +840,9 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
|
|||
break;
|
||||
}
|
||||
|
||||
_mesa_write_rgba_span(ctx, span, NULL, GL_POLYGON);
|
||||
ASSERT(span->interpMask & SPAN_RGBA);
|
||||
ASSERT(span->arrayMask & SPAN_RGBA);
|
||||
_mesa_write_rgba_span(ctx, span, GL_POLYGON);
|
||||
|
||||
|
||||
#undef SPAN_NEAREST
|
||||
|
@ -865,6 +880,7 @@ static void persp_textured_triangle( GLcontext *ctx,
|
|||
info.format = obj->Image[b]->Format; \
|
||||
info.filter = obj->MinFilter; \
|
||||
info.envmode = unit->EnvMode; \
|
||||
span.arrayMask |= SPAN_RGBA; \
|
||||
\
|
||||
if (info.envmode == GL_BLEND) { \
|
||||
/* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \
|
||||
|
@ -939,10 +955,11 @@ static void general_textured_triangle( GLcontext *ctx,
|
|||
SW_SPAN_SET_FLAG(span.filledColor); \
|
||||
SW_SPAN_SET_FLAG(span.filledAlpha); \
|
||||
SW_SPAN_SET_FLAG(span.filledTex[0]); \
|
||||
SW_SPAN_SET_FLAG(span.filledDepth); \
|
||||
/* NOTE: we could just call rasterize_span() here instead */ \
|
||||
for (i = 0; i < span.end; i++) { \
|
||||
GLdouble invQ = span.tex[0][3] ? (1.0 / span.tex[0][3]) : 1.0; \
|
||||
span.depth[i] = FixedToDepth(span.z); \
|
||||
span.zArray[i] = FixedToDepth(span.z); \
|
||||
span.z += span.zStep; \
|
||||
span.color.rgba[i][RCOMP] = FixedToChan(span.red); \
|
||||
span.color.rgba[i][GCOMP] = FixedToChan(span.green); \
|
||||
|
@ -960,7 +977,7 @@ static void general_textured_triangle( GLcontext *ctx,
|
|||
span.tex[0][2] += span.texStep[0][2]; \
|
||||
span.tex[0][3] += span.texStep[0][3]; \
|
||||
} \
|
||||
_mesa_write_texture_span( ctx, &span, NULL, GL_POLYGON );
|
||||
_mesa_write_texture_span( ctx, &span, GL_POLYGON );
|
||||
|
||||
#include "s_tritemp.h"
|
||||
}
|
||||
|
@ -1204,11 +1221,11 @@ void _swrast_add_spec_terms_triangle( GLcontext *ctx,
|
|||
/* record the current triangle function name */
|
||||
const char *_mesa_triFuncName = NULL;
|
||||
|
||||
#define USE(triFunc) \
|
||||
do { \
|
||||
_mesa_triFuncName = #triFunc; \
|
||||
/*printf("%s\n", triFuncName);*/ \
|
||||
swrast->Triangle = triFunc; \
|
||||
#define USE(triFunc) \
|
||||
do { \
|
||||
_mesa_triFuncName = #triFunc; \
|
||||
/*printf("%s\n", _mesa_triFuncName);*/ \
|
||||
swrast->Triangle = triFunc; \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_tritemp.h,v 1.30 2001/12/17 04:58:50 brianp Exp $ */
|
||||
/* $Id: s_tritemp.h,v 1.31 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -122,6 +122,8 @@
|
|||
|
||||
struct sw_span span;
|
||||
|
||||
INIT_SPAN(span);
|
||||
|
||||
#ifdef INTERP_Z
|
||||
(void) fixedToDepthShift;
|
||||
#endif
|
||||
|
@ -340,11 +342,10 @@
|
|||
|
||||
scan_from_left_to_right = (oneOverArea < 0.0F);
|
||||
|
||||
span.activeMask = 0;
|
||||
|
||||
/* compute d?/dx and d?/dy derivatives */
|
||||
#ifdef INTERP_Z
|
||||
span.activeMask |= SPAN_Z;
|
||||
span.interpMask |= SPAN_Z;
|
||||
{
|
||||
GLfloat eMaj_dz, eBot_dz;
|
||||
eMaj_dz = vMax->win[2] - vMin->win[2];
|
||||
|
@ -365,7 +366,7 @@
|
|||
}
|
||||
#endif
|
||||
#ifdef INTERP_FOG
|
||||
span.activeMask |= SPAN_FOG;
|
||||
span.interpMask |= SPAN_FOG;
|
||||
{
|
||||
const GLfloat eMaj_dfog = vMax->fog - vMin->fog;
|
||||
const GLfloat eBot_dfog = vMid->fog - vMin->fog;
|
||||
|
@ -374,7 +375,7 @@
|
|||
}
|
||||
#endif
|
||||
#ifdef INTERP_RGB
|
||||
span.activeMask |= SPAN_RGBA;
|
||||
span.interpMask |= SPAN_RGBA;
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
GLfloat eMaj_dr, eBot_dr;
|
||||
GLfloat eMaj_dg, eBot_dg;
|
||||
|
@ -415,7 +416,7 @@
|
|||
}
|
||||
else {
|
||||
ASSERT (ctx->Light.ShadeModel == GL_FLAT);
|
||||
span.activeMask |= SPAN_FLAT;
|
||||
span.interpMask |= SPAN_FLAT;
|
||||
drdx = drdy = 0.0F;
|
||||
dgdx = dgdy = 0.0F;
|
||||
dbdx = dbdy = 0.0F;
|
||||
|
@ -429,7 +430,7 @@
|
|||
}
|
||||
#endif
|
||||
#ifdef INTERP_FLOAT_RGBA
|
||||
span.activeMask |= SPAN_RGBA;
|
||||
span.interpMask |= SPAN_RGBA;
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
GLfloat eMaj_dr, eBot_dr;
|
||||
GLfloat eMaj_dg, eBot_dg;
|
||||
|
@ -464,7 +465,7 @@
|
|||
}
|
||||
#endif
|
||||
#ifdef INTERP_SPEC
|
||||
span.activeMask |= SPAN_SPEC;
|
||||
span.interpMask |= SPAN_SPEC;
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
GLfloat eMaj_dsr, eBot_dsr;
|
||||
GLfloat eMaj_dsg, eBot_dsg;
|
||||
|
@ -501,7 +502,7 @@
|
|||
}
|
||||
#endif
|
||||
#ifdef INTERP_FLOAT_SPEC
|
||||
span.activeMask |= SPAN_SPEC;
|
||||
span.interpMask |= SPAN_SPEC;
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
GLfloat eMaj_dsr, eBot_dsr;
|
||||
GLfloat eMaj_dsg, eBot_dsg;
|
||||
|
@ -529,7 +530,7 @@
|
|||
}
|
||||
#endif
|
||||
#ifdef INTERP_INDEX
|
||||
span.activeMask |= SPAN_INDEX;
|
||||
span.interpMask |= SPAN_INDEX;
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
GLfloat eMaj_di, eBot_di;
|
||||
eMaj_di = (GLfloat) ((GLint) vMax->index - (GLint) vMin->index);
|
||||
|
@ -539,13 +540,13 @@
|
|||
didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx);
|
||||
}
|
||||
else {
|
||||
span.activeMask |= SPAN_FLAT;
|
||||
span.interpMask |= SPAN_FLAT;
|
||||
didx = didy = 0.0F;
|
||||
span.indexStep = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef INTERP_INT_TEX
|
||||
span.activeMask |= SPAN_INT_TEXTURE;
|
||||
span.interpMask |= SPAN_INT_TEXTURE;
|
||||
{
|
||||
GLfloat eMaj_ds, eBot_ds;
|
||||
eMaj_ds = (vMax->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE;
|
||||
|
@ -565,7 +566,7 @@
|
|||
|
||||
#endif
|
||||
#ifdef INTERP_TEX
|
||||
span.activeMask |= SPAN_TEXTURE;
|
||||
span.interpMask |= SPAN_TEXTURE;
|
||||
{
|
||||
GLfloat wMax = vMax->win[3];
|
||||
GLfloat wMin = vMin->win[3];
|
||||
|
@ -608,14 +609,14 @@
|
|||
GLfloat r1 = dudx * dudx + dudy * dudy;
|
||||
GLfloat r2 = dvdx * dvdx + dvdy * dvdy;
|
||||
span.rho[0] = r1 + r2; /* was rho2 = MAX2(r1,r2) */
|
||||
span.activeMask |= SPAN_LAMBDA;
|
||||
span.interpMask |= SPAN_LAMBDA;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
#ifdef INTERP_MULTITEX
|
||||
span.activeMask |= SPAN_TEXTURE;
|
||||
span.interpMask |= SPAN_TEXTURE;
|
||||
# ifdef INTERP_LAMBDA
|
||||
span.activeMask |= SPAN_LAMBDA;
|
||||
span.interpMask |= SPAN_LAMBDA;
|
||||
# endif
|
||||
{
|
||||
GLfloat wMax = vMax->win[3];
|
||||
|
@ -1143,6 +1144,7 @@
|
|||
/* initialize the span interpolants to the leftmost value */
|
||||
/* ff = fixed-pt fragment */
|
||||
const GLint right = FixedToInt(fxRightEdge);
|
||||
/*INIT_SPAN(span);*/
|
||||
SW_SPAN_RESET(span);
|
||||
span.x = FixedToInt(fxLeftEdge);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_zoom.c,v 1.8 2002/01/21 18:12:34 brianp Exp $ */
|
||||
/* $Id: s_zoom.c,v 1.9 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -51,7 +51,7 @@
|
|||
(span).color.rgba[i][BCOMP]) { \
|
||||
fprintf(stderr, "glZoom: Color-span changed in subfunction."); \
|
||||
} \
|
||||
if (tmp_span.depth[i] != (span).depth[i]) { \
|
||||
if (tmp_span.zArray[i] != (span).zArray[i]) { \
|
||||
fprintf(stderr, "glZoom: Depth-span changed in subfunction."); \
|
||||
} \
|
||||
} \
|
||||
|
@ -83,28 +83,28 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
|
|||
{
|
||||
GLint r0, r1, row;
|
||||
GLint i, j;
|
||||
struct sw_span dstspan;
|
||||
GLfloat zfog[MAX_WIDTH]; /* zoomed fog values */
|
||||
struct sw_span zoomed;
|
||||
const GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
|
||||
|
||||
SW_SPAN_RESET (dstspan);
|
||||
SW_SPAN_RESET (zoomed);
|
||||
INIT_SPAN(zoomed);
|
||||
|
||||
/* compute width of output row */
|
||||
dstspan.end = (GLint) ABSF( n * ctx->Pixel.ZoomX );
|
||||
if (dstspan.end == 0) {
|
||||
zoomed.end = (GLint) ABSF( n * ctx->Pixel.ZoomX );
|
||||
if (zoomed.end == 0) {
|
||||
return;
|
||||
}
|
||||
/*here ok or better latter? like it was before */
|
||||
else if (dstspan.end > maxwidth) {
|
||||
dstspan.end = maxwidth;
|
||||
else if (zoomed.end > maxwidth) {
|
||||
zoomed.end = maxwidth;
|
||||
}
|
||||
|
||||
if (ctx->Pixel.ZoomX<0.0) {
|
||||
/* adjust x coordinate for left/right mirroring */
|
||||
dstspan.x = x - dstspan.end;
|
||||
zoomed.x = x - zoomed.end;
|
||||
}
|
||||
else
|
||||
dstspan.x = x;
|
||||
zoomed.x = x;
|
||||
|
||||
|
||||
/* compute which rows to draw */
|
||||
|
@ -131,8 +131,8 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
|
|||
}
|
||||
|
||||
/* check if left edge is outside window */
|
||||
if (dstspan.x < 0) {
|
||||
dstspan.start = -x;
|
||||
if (zoomed.x < 0) {
|
||||
zoomed.start = -x;
|
||||
}
|
||||
|
||||
/* make sure span isn't too long or short */
|
||||
|
@ -140,56 +140,61 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
|
|||
m = maxwidth;
|
||||
}*/
|
||||
|
||||
if (dstspan.end <= dstspan.start) {
|
||||
if (zoomed.end <= zoomed.start) {
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT( dstspan.end <= MAX_WIDTH );
|
||||
ASSERT( zoomed.end <= MAX_WIDTH );
|
||||
|
||||
/* zoom the span horizontally */
|
||||
if (ctx->Pixel.ZoomX==-1.0F) {
|
||||
SW_SPAN_SET_FLAG(dstspan.filledColor);
|
||||
SW_SPAN_SET_FLAG(dstspan.filledAlpha);
|
||||
SW_SPAN_SET_FLAG(dstspan.filledDepth);
|
||||
SW_SPAN_SET_FLAG(zoomed.filledColor);
|
||||
SW_SPAN_SET_FLAG(zoomed.filledAlpha);
|
||||
SW_SPAN_SET_FLAG(zoomed.filledDepth);
|
||||
/* n==m */
|
||||
for (j=dstspan.start; j<dstspan.end; j++) {
|
||||
for (j=zoomed.start; j<zoomed.end; j++) {
|
||||
i = n - j - 1;
|
||||
COPY_CHAN4(dstspan.color.rgba[j], rgba[i]);
|
||||
dstspan.depth[j] = z[i];
|
||||
COPY_CHAN4(zoomed.color.rgba[j], rgba[i]);
|
||||
zoomed.zArray[j] = z[i];
|
||||
}
|
||||
if (fog && ctx->Fog.Enabled) {
|
||||
for (j=dstspan.start; j<dstspan.end; j++) {
|
||||
for (j=zoomed.start; j<zoomed.end; j++) {
|
||||
i = n - j - 1;
|
||||
zfog[j] = fog[i];
|
||||
zoomed.fogArray[j] = fog[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX;
|
||||
SW_SPAN_SET_FLAG(dstspan.filledColor);
|
||||
SW_SPAN_SET_FLAG(dstspan.filledAlpha);
|
||||
SW_SPAN_SET_FLAG(dstspan.filledDepth);
|
||||
for (j=dstspan.start; j<dstspan.end; j++) {
|
||||
SW_SPAN_SET_FLAG(zoomed.filledColor);
|
||||
SW_SPAN_SET_FLAG(zoomed.filledAlpha);
|
||||
SW_SPAN_SET_FLAG(zoomed.filledDepth);
|
||||
for (j=zoomed.start; j<zoomed.end; j++) {
|
||||
i = (GLint) (j * xscale);
|
||||
if (i<0) i = n + i - 1;
|
||||
COPY_CHAN4(dstspan.color.rgba[j], rgba[i]);
|
||||
dstspan.depth[j] = z[i];
|
||||
COPY_CHAN4(zoomed.color.rgba[j], rgba[i]);
|
||||
zoomed.zArray[j] = z[i];
|
||||
}
|
||||
if (fog && ctx->Fog.Enabled) {
|
||||
for (j=dstspan.start; j<dstspan.end; j++) {
|
||||
for (j=zoomed.start; j<zoomed.end; j++) {
|
||||
i = (GLint) (j * xscale);
|
||||
if (i<0) i = n + i - 1;
|
||||
zfog[j] = fog[i];
|
||||
zoomed.fogArray[j] = fog[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zoomed.arrayMask |= SPAN_Z;
|
||||
if (fog)
|
||||
zoomed.arrayMask |= SPAN_FOG;
|
||||
|
||||
/* write the span */
|
||||
for (dstspan.y = r0; dstspan.y < r1; dstspan.y++) {
|
||||
SAVE_SPAN(dstspan);
|
||||
_mesa_write_rgba_span(ctx, &dstspan, (fog ? zfog : NULL), GL_BITMAP);
|
||||
RESTORE_SPAN(dstspan);
|
||||
/* problem here: "dstspan" can change inside
|
||||
for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) {
|
||||
SAVE_SPAN(zoomed);
|
||||
ASSERT((zoomed.interpMask & SPAN_RGBA) == 0);
|
||||
_mesa_write_rgba_span(ctx, &zoomed, GL_BITMAP);
|
||||
RESTORE_SPAN(zoomed);
|
||||
/* problem here: "zoomed" can change inside
|
||||
"_mesa_write_rgba_span". Best solution: make copy "tmpspan"
|
||||
and give to function, but too slow */
|
||||
}
|
||||
|
@ -206,10 +211,15 @@ _mesa_write_zoomed_rgb_span( GLcontext *ctx,
|
|||
GLint m;
|
||||
GLint r0, r1, row, r;
|
||||
GLint i, j, skipcol;
|
||||
GLchan zrgba[MAX_WIDTH][4]; /* zoomed pixel colors */
|
||||
GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */
|
||||
GLfloat zfog[MAX_WIDTH]; /* zoomed fog values */
|
||||
GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
|
||||
struct sw_span zoomed;
|
||||
|
||||
INIT_SPAN(zoomed);
|
||||
zoomed.arrayMask |= SPAN_RGBA;
|
||||
|
||||
if (fog && ctx->Fog.Enabled)
|
||||
zoomed.arrayMask |= SPAN_FOG;
|
||||
|
||||
|
||||
/* compute width of output row */
|
||||
m = (GLint) ABSF( n * ctx->Pixel.ZoomX );
|
||||
|
@ -265,16 +275,16 @@ _mesa_write_zoomed_rgb_span( GLcontext *ctx,
|
|||
/* n==m */
|
||||
for (j=0;j<m;j++) {
|
||||
i = n - (j+skipcol) - 1;
|
||||
zrgba[j][0] = rgb[i][0];
|
||||
zrgba[j][1] = rgb[i][1];
|
||||
zrgba[j][2] = rgb[i][2];
|
||||
zrgba[j][3] = CHAN_MAX;
|
||||
zdepth[j] = z[i];
|
||||
zoomed.color.rgba[j][0] = rgb[i][0];
|
||||
zoomed.color.rgba[j][1] = rgb[i][1];
|
||||
zoomed.color.rgba[j][2] = rgb[i][2];
|
||||
zoomed.color.rgba[j][3] = CHAN_MAX;
|
||||
zoomed.zArray[j] = z[i];
|
||||
}
|
||||
if (fog && ctx->Fog.Enabled) {
|
||||
if (zoomed.arrayMask & SPAN_FOG) {
|
||||
for (j=0;j<m;j++) {
|
||||
i = n - (j+skipcol) - 1;
|
||||
zfog[j] = fog[i];
|
||||
zoomed.fogArray[j] = fog[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -283,25 +293,28 @@ _mesa_write_zoomed_rgb_span( GLcontext *ctx,
|
|||
for (j=0;j<m;j++) {
|
||||
i = (GLint) ((j+skipcol) * xscale);
|
||||
if (i<0) i = n + i - 1;
|
||||
zrgba[j][0] = rgb[i][0];
|
||||
zrgba[j][1] = rgb[i][1];
|
||||
zrgba[j][2] = rgb[i][2];
|
||||
zrgba[j][3] = CHAN_MAX;
|
||||
zdepth[j] = z[i];
|
||||
zoomed.color.rgba[j][0] = rgb[i][0];
|
||||
zoomed.color.rgba[j][1] = rgb[i][1];
|
||||
zoomed.color.rgba[j][2] = rgb[i][2];
|
||||
zoomed.color.rgba[j][3] = CHAN_MAX;
|
||||
zoomed.zArray[j] = z[i];
|
||||
}
|
||||
if (fog && ctx->Fog.Enabled) {
|
||||
if (zoomed.arrayMask & SPAN_FOG) {
|
||||
for (j=0;j<m;j++) {
|
||||
i = (GLint) ((j+skipcol) * xscale);
|
||||
if (i<0) i = n + i - 1;
|
||||
zfog[j] = fog[i];
|
||||
zoomed.fogArray[j] = fog[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* write the span */
|
||||
for (r=r0; r<r1; r++) {
|
||||
_old_write_rgba_span( ctx, m, x+skipcol, r, zdepth,
|
||||
(fog ? zfog : 0), zrgba, NULL, GL_BITMAP );
|
||||
zoomed.x = x + skipcol;
|
||||
zoomed.y = r;
|
||||
zoomed.end = m;
|
||||
ASSERT((zoomed.interpMask & SPAN_RGBA) == 0);
|
||||
_mesa_write_rgba_span( ctx, &zoomed, GL_BITMAP );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,10 +332,12 @@ _mesa_write_zoomed_index_span( GLcontext *ctx,
|
|||
GLint m;
|
||||
GLint r0, r1, row, r;
|
||||
GLint i, j, skipcol;
|
||||
GLuint zindexes[MAX_WIDTH]; /* zoomed color indexes */
|
||||
GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */
|
||||
GLfloat zfog[MAX_WIDTH]; /* zoomed fog values */
|
||||
GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
|
||||
struct sw_span zoomed;
|
||||
|
||||
SW_SPAN_RESET(zoomed);
|
||||
INIT_SPAN(zoomed);
|
||||
zoomed.arrayMask |= SPAN_INDEX;
|
||||
|
||||
/* compute width of output row */
|
||||
m = (GLint) ABSF( n * ctx->Pixel.ZoomX );
|
||||
|
@ -378,14 +393,15 @@ _mesa_write_zoomed_index_span( GLcontext *ctx,
|
|||
/* n==m */
|
||||
for (j=0;j<m;j++) {
|
||||
i = n - (j+skipcol) - 1;
|
||||
zindexes[j] = indexes[i];
|
||||
zdepth[j] = z[i];
|
||||
zoomed.color.index[j] = indexes[i];
|
||||
zoomed.zArray[j] = z[i];
|
||||
}
|
||||
if (fog && ctx->Fog.Enabled) {
|
||||
for (j=0;j<m;j++) {
|
||||
i = n - (j+skipcol) - 1;
|
||||
zfog[j] = fog[i];
|
||||
zoomed.fogArray[j] = fog[i];
|
||||
}
|
||||
zoomed.arrayMask |= SPAN_FOG;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -393,22 +409,30 @@ _mesa_write_zoomed_index_span( GLcontext *ctx,
|
|||
for (j=0;j<m;j++) {
|
||||
i = (GLint) ((j+skipcol) * xscale);
|
||||
if (i<0) i = n + i - 1;
|
||||
zindexes[j] = indexes[i];
|
||||
zdepth[j] = z[i];
|
||||
zoomed.color.index[j] = indexes[i];
|
||||
zoomed.zArray[j] = z[i];
|
||||
}
|
||||
if (fog && ctx->Fog.Enabled) {
|
||||
for (j=0;j<m;j++) {
|
||||
i = (GLint) ((j+skipcol) * xscale);
|
||||
if (i<0) i = n + i - 1;
|
||||
zfog[j] = fog[i];
|
||||
zoomed.fogArray[j] = fog[i];
|
||||
}
|
||||
zoomed.arrayMask |= SPAN_FOG;
|
||||
}
|
||||
}
|
||||
|
||||
zoomed.arrayMask |= SPAN_Z;
|
||||
|
||||
/* write the span */
|
||||
for (r=r0; r<r1; r++) {
|
||||
_old_write_index_span( ctx, m, x+skipcol, r, zdepth,
|
||||
(fog ? zfog : 0), zindexes, NULL, GL_BITMAP );
|
||||
SAVE_SPAN(zoomed);
|
||||
ASSERT((zoomed.interpMask & SPAN_INDEX) == 0);
|
||||
zoomed.x = x + skipcol;
|
||||
zoomed.y = r;
|
||||
zoomed.end = m;
|
||||
_mesa_write_index_span(ctx, &zoomed, GL_BITMAP);
|
||||
RESTORE_SPAN(zoomed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: swrast.h,v 1.15 2002/01/21 18:12:34 brianp Exp $ */
|
||||
/* $Id: swrast.h,v 1.16 2002/01/27 18:32:03 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
@ -92,7 +92,8 @@ typedef struct {
|
|||
#define SPAN_TEXTURE 0x020
|
||||
#define SPAN_INT_TEXTURE 0x040
|
||||
#define SPAN_LAMBDA 0x080
|
||||
#define SPAN_FLAT 0x100 /* flat shading? */
|
||||
#define SPAN_COVERAGE 0x100
|
||||
#define SPAN_FLAT 0x200 /* flat shading? */
|
||||
|
||||
|
||||
struct sw_span {
|
||||
|
@ -104,7 +105,10 @@ struct sw_span {
|
|||
/* This flag indicates that only a part of the span is visible */
|
||||
GLboolean writeAll;
|
||||
|
||||
GLuint activeMask; /* OR of the SPAN_* flags */
|
||||
/* This bitmask (bitwise-or of SPAN_* flags) indicates which of the
|
||||
* x/xStep variables are relevant.
|
||||
*/
|
||||
GLuint interpMask;
|
||||
|
||||
#if CHAN_TYPE == GL_FLOAT
|
||||
GLfloat red, redStep;
|
||||
|
@ -132,39 +136,52 @@ struct sw_span {
|
|||
GLfloat rho[MAX_TEXTURE_UNITS];
|
||||
GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS];
|
||||
|
||||
/* This bitmask (bitwise-or of SPAN_* flags) indicates which of the
|
||||
* fragment arrays are relevant.
|
||||
*/
|
||||
GLuint arrayMask;
|
||||
|
||||
/**
|
||||
* Arrays of fragment values. These will either be computed from the
|
||||
* x/xStep values above or loadd from glDrawPixels, etc.
|
||||
*/
|
||||
GLdepth depth[MAX_WIDTH];
|
||||
union {
|
||||
GLchan rgb[MAX_WIDTH][3];
|
||||
GLchan rgba[MAX_WIDTH][4];
|
||||
GLuint index[MAX_WIDTH];
|
||||
} color;
|
||||
GLchan specular[MAX_WIDTH][4];
|
||||
GLint itexcoords[MAX_WIDTH][2]; /* Integer texture (s, t) */
|
||||
GLchan specArray[MAX_WIDTH][4];
|
||||
GLdepth zArray[MAX_WIDTH];
|
||||
GLfloat fogArray[MAX_WIDTH];
|
||||
/* Texture (s,t,r). 4th component only used for pixel texture */
|
||||
GLfloat texcoords[MAX_TEXTURE_UNITS][MAX_WIDTH][4];
|
||||
GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH];
|
||||
GLfloat coverage[MAX_WIDTH];
|
||||
|
||||
/* This mask indicates if fragment is alive or culled */
|
||||
GLubyte mask[MAX_WIDTH];
|
||||
|
||||
#ifdef DEBUG
|
||||
GLboolean filledDepth, filledMask, filledAlpha;
|
||||
GLboolean filledDepth, filledAlpha;
|
||||
GLboolean filledColor, filledSpecular;
|
||||
GLboolean filledLambda[MAX_TEXTURE_UNITS], filledTex[MAX_TEXTURE_UNITS];
|
||||
GLboolean testedDepth, testedAlpha;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#define INIT_SPAN(S) \
|
||||
do { \
|
||||
S.interpMask = 0; \
|
||||
S.arrayMask = 0; \
|
||||
S.start = S.end = 0; \
|
||||
} while (0)
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define SW_SPAN_SET_FLAG(flag) {ASSERT((flag) == GL_FALSE);(flag) = GL_TRUE;}
|
||||
#define SW_SPAN_RESET(span) { \
|
||||
(span).filledDepth = (span).filledMask = (span).filledAlpha \
|
||||
= (span).filledColor = (span).filledSpecular \
|
||||
= (span).testedDepth = (span).testedAlpha = GL_FALSE; \
|
||||
(span).filledDepth = (span).filledAlpha \
|
||||
= (span).filledColor = (span).filledSpecular = GL_FALSE; \
|
||||
MEMSET((span).filledTex, GL_FALSE, \
|
||||
MAX_TEXTURE_UNITS*sizeof(GLboolean)); \
|
||||
MEMSET((span).filledLambda, GL_FALSE, \
|
||||
|
|
Loading…
Reference in New Issue