mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 00:10:20 +01:00
Fix color index mode rendering.
Changed SWvertex's index field to GLfloat and fix a few other bits.
This commit is contained in:
parent
7bcada8c27
commit
1e4731f644
7 changed files with 38 additions and 19 deletions
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 5.0.3
|
||||
* Version: 6.1
|
||||
*
|
||||
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2004 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"),
|
||||
|
|
@ -331,6 +331,19 @@ 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);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 5.1
|
||||
* Version: 6.1
|
||||
*
|
||||
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2004 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"),
|
||||
|
|
@ -37,7 +36,11 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
|
|||
{
|
||||
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;
|
||||
|
||||
if (coverage == 0.0)
|
||||
|
|
@ -191,10 +194,10 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
|
|||
line.span.arrayMask |= SPAN_INDEX;
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
compute_plane(line.x0, line.y0, line.x1, line.y1,
|
||||
(GLfloat) v0->index, (GLfloat) v1->index, line.iPlane);
|
||||
v0->index, v1->index, line.iPlane);
|
||||
}
|
||||
else {
|
||||
constant_plane((GLfloat) v1->index, line.iPlane);
|
||||
constant_plane(v1->index, line.iPlane);
|
||||
}
|
||||
#endif
|
||||
#ifdef DO_TEX
|
||||
|
|
|
|||
|
|
@ -251,11 +251,11 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
|
|||
#ifdef INTERP_INDEX
|
||||
interpFlags |= SPAN_INDEX;
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
span.index = IntToFixed(vert0->index);
|
||||
span.indexStep = IntToFixed(vert1->index - vert0->index) / numPixels;
|
||||
span.index = FloatToFixed(vert0->index);
|
||||
span.indexStep = FloatToFixed(vert1->index - vert0->index) / numPixels;
|
||||
}
|
||||
else {
|
||||
span.index = IntToFixed(vert1->index);
|
||||
span.index = FloatToFixed(vert1->index);
|
||||
span.indexStep = 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.0
|
||||
* Version: 6.1
|
||||
*
|
||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
*
|
||||
|
|
@ -86,7 +86,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
|
|||
const GLchan specBlue = vert->specular[2];
|
||||
#endif
|
||||
#if FLAGS & INDEX
|
||||
const GLuint colorIndex = vert->index;
|
||||
const GLuint colorIndex = (GLuint) vert->index; /* XXX round? */
|
||||
#endif
|
||||
#if FLAGS & TEXTURE
|
||||
GLfloat texcoord[MAX_TEXTURE_COORD_UNITS][4];
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ _swrast_culltriangle( GLcontext *ctx,
|
|||
#define INTERP_FOG 1
|
||||
#define SETUP_CODE \
|
||||
span.interpMask |= SPAN_INDEX; \
|
||||
span.index = IntToFixed(v2->index); \
|
||||
span.index = FloatToFixed(v2->index);\
|
||||
span.indexStep = 0;
|
||||
#define RENDER_SPAN( span ) _swrast_write_index_span(ctx, &span);
|
||||
#include "s_tritemp.h"
|
||||
|
|
|
|||
|
|
@ -192,6 +192,9 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
|
|||
printf(" %g, %g, %g\n", v1->win[0], v1->win[1], v1->win[2]);
|
||||
printf(" %g, %g, %g\n", v2->win[0], v2->win[1], v2->win[2]);
|
||||
*/
|
||||
ASSERT(v0->win[2] >= 0.0);
|
||||
ASSERT(v1->win[2] >= 0.0);
|
||||
ASSERT(v2->win[2] >= 0.0);
|
||||
|
||||
/* Compute fixed point x,y coords w/ half-pixel offsets and snapping.
|
||||
* And find the order of the 3 vertices along the Y axis.
|
||||
|
|
@ -530,8 +533,8 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
|
|||
#ifdef INTERP_INDEX
|
||||
span.interpMask |= SPAN_INDEX;
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
GLfloat eMaj_di = (GLfloat) ((GLint) vMax->index - (GLint) vMin->index);
|
||||
GLfloat eBot_di = (GLfloat) ((GLint) vMid->index - (GLint) vMin->index);
|
||||
GLfloat eMaj_di = vMax->index - vMin->index;
|
||||
GLfloat eBot_di = vMid->index - vMin->index;
|
||||
didx = oneOverArea * (eMaj_di * eBot.dy - eMaj.dy * eBot_di);
|
||||
didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx);
|
||||
span.indexStep = SignedFloatToFixed(didx);
|
||||
|
|
@ -907,7 +910,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
|
|||
diOuter = SignedFloatToFixed(didy + dxOuter * didx);
|
||||
}
|
||||
else {
|
||||
iLeft = (GLfixed) (v2->index * FIXED_SCALE);
|
||||
iLeft = FloatToFixed(v2->index);
|
||||
diOuter = 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 5.1
|
||||
* Version: 6.1
|
||||
*
|
||||
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2004 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"),
|
||||
|
|
@ -68,7 +68,7 @@ typedef struct {
|
|||
GLchan color[4];
|
||||
GLchan specular[4];
|
||||
GLfloat fog;
|
||||
GLuint index;
|
||||
GLfloat index;
|
||||
GLfloat pointSize;
|
||||
} SWvertex;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue