added GL_EXT_fog_coord.

added GL_EXT_blend_equation_separate.
minor cleanup.
This commit is contained in:
Daniel Borca 2004-07-02 10:34:48 +00:00
parent 3aa364c8e1
commit 009542a0f7
7 changed files with 343 additions and 39 deletions

View file

@ -45,7 +45,7 @@
#include "drivers/common/driverfuncs.h"
#ifndef TDFX_DEBUG
int TDFX_DEBUG = (0
int TDFX_DEBUG = (0
/* | VERBOSE_VARRAY */
/* | VERBOSE_TEXTURE */
/* | VERBOSE_IMMEDIATE */

View file

@ -1250,7 +1250,7 @@ static const struct tnl_pipeline_stage *fx_pipeline[] = {
&_tnl_vertex_transform_stage, /* TODO: Add the fastpath here */
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
/*&_tnl_fog_coordinate_stage,*/ /* TODO: Omit fog stage ZZZ ZZZ ZZZ */
&_tnl_fog_coordinate_stage,
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
&_tnl_point_attenuation_stage,
@ -1293,7 +1293,8 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
fxMesa->unitsState.blendDstFuncRGB = GR_BLEND_ZERO;
fxMesa->unitsState.blendSrcFuncAlpha = GR_BLEND_ONE;
fxMesa->unitsState.blendDstFuncAlpha = GR_BLEND_ZERO;
fxMesa->unitsState.blendEq = GR_BLEND_OP_ADD;
fxMesa->unitsState.blendEqRGB = GR_BLEND_OP_ADD;
fxMesa->unitsState.blendEqAlpha = GR_BLEND_OP_ADD;
fxMesa->unitsState.depthTestEnabled = GL_FALSE;
fxMesa->unitsState.depthMask = GL_TRUE;
@ -1482,12 +1483,14 @@ fxDDInitExtensions(GLcontext * ctx)
* 3) since NCC is not an OpenGL standard (as opposed to FXT1/DXTC), we
* can't use precompressed textures!
*/
_mesa_enable_extension(ctx, "GL_ARB_texture_compression");
if (fxMesa->type >= GR_SSTTYPE_Voodoo4) {
_mesa_enable_extension(ctx, "GL_ARB_texture_compression");
_mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
_mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
_mesa_enable_extension(ctx, "GL_S3_s3tc");
_mesa_enable_extension(ctx, "GL_NV_blend_square");
} else if (fxMesa->HaveTexus2) {
_mesa_enable_extension(ctx, "GL_ARB_texture_compression");
}
if (fxMesa->HaveCmbExt) {
@ -1496,12 +1499,17 @@ fxDDInitExtensions(GLcontext * ctx)
if (fxMesa->HavePixExt) {
_mesa_enable_extension(ctx, "GL_EXT_blend_subtract");
_mesa_enable_extension(ctx, "GL_EXT_blend_equation_separate");
}
if (fxMesa->HaveMirExt) {
_mesa_enable_extension(ctx, "GL_ARB_texture_mirrored_repeat");
}
if (fxMesa->type >= GR_SSTTYPE_Voodoo2) {
_mesa_enable_extension(ctx, "GL_EXT_fog_coord");
}
/* core-level extensions */
_mesa_enable_extension(ctx, "GL_EXT_multi_draw_arrays");
_mesa_enable_extension(ctx, "GL_IBM_multimode_draw_arrays");
@ -1545,10 +1553,13 @@ fx_check_IsInHardware(GLcontext * ctx)
}
if (ctx->Color.BlendEnabled) {
if (ctx->Color.BlendEquationRGB != GL_FUNC_ADD) {
if ((ctx->Color.BlendEquationRGB != GL_FUNC_ADD) ||
(ctx->Color.BlendEquationA != GL_FUNC_ADD)) {
if (!fxMesa->HavePixExt ||
((ctx->Color.BlendEquationRGB != GL_FUNC_SUBTRACT) &&
(ctx->Color.BlendEquationRGB != GL_FUNC_REVERSE_SUBTRACT))) {
(ctx->Color.BlendEquationRGB != GL_FUNC_REVERSE_SUBTRACT)) ||
((ctx->Color.BlendEquationA != GL_FUNC_SUBTRACT) &&
(ctx->Color.BlendEquationA != GL_FUNC_REVERSE_SUBTRACT))) {
return FX_FALLBACK_BLEND;
}
}

View file

@ -104,7 +104,8 @@
#define SETUP_PTEX 0x20
#define SETUP_PSIZ 0x40
#define SETUP_SPEC 0x80
#define MAX_SETUP 0x100
#define SETUP_FOGC 0x100
#define MAX_SETUP 0x200
#define FX_NUM_TMU 2
@ -322,7 +323,8 @@ typedef struct
GrAlphaBlendFnc_t blendDstFuncRGB;
GrAlphaBlendFnc_t blendSrcFuncAlpha;
GrAlphaBlendFnc_t blendDstFuncAlpha;
GrAlphaBlendOp_t blendEq;
GrAlphaBlendOp_t blendEqRGB;
GrAlphaBlendOp_t blendEqAlpha;
/* Depth test */
@ -727,6 +729,9 @@ void fxSetupTexture (GLcontext *ctx);
extern GLuint fx_check_IsInHardware(GLcontext *ctx);
/* run-time debugging */
#ifndef FX_DEBUG
#define FX_DEBUG 0
#endif
#if FX_DEBUG
extern int TDFX_DEBUG;
#else

View file

@ -42,7 +42,9 @@
#include "fxdrv.h"
#include "enums.h"
#include "tnl.h"
#include "tnl/t_context.h"
#include "swrast.h"
static void
fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
@ -1514,7 +1516,6 @@ fxDDBlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA)
tfxUnitsState *us = &fxMesa->unitsState;
GrAlphaBlendOp_t q;
assert( modeRGB == modeA );
switch (modeRGB) {
case GL_FUNC_ADD:
q = GR_BLEND_OP_ADD;
@ -1526,11 +1527,28 @@ fxDDBlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA)
q = GR_BLEND_OP_REVSUB;
break;
default:
return;
q = us->blendEqRGB;
}
if (q != us->blendEqRGB) {
us->blendEqRGB = q;
fxMesa->new_state |= FX_NEW_BLEND;
}
if ((q != us->blendEq) && fxMesa->HavePixExt) {
us->blendEq = q;
switch (modeA) {
case GL_FUNC_ADD:
q = GR_BLEND_OP_ADD;
break;
case GL_FUNC_SUBTRACT:
q = GR_BLEND_OP_SUB;
break;
case GL_FUNC_REVERSE_SUBTRACT:
q = GR_BLEND_OP_REVSUB;
break;
default:
q = us->blendEqAlpha;
}
if (q != us->blendEqAlpha) {
us->blendEqAlpha = q;
fxMesa->new_state |= FX_NEW_BLEND;
}
}
@ -1544,9 +1562,9 @@ fxSetupBlend(GLcontext * ctx)
if (fxMesa->HavePixExt) {
if (us->blendEnabled) {
fxMesa->Glide.grAlphaBlendFunctionExt(us->blendSrcFuncRGB, us->blendDstFuncRGB,
us->blendEq,
us->blendEqRGB,
us->blendSrcFuncAlpha, us->blendDstFuncAlpha,
us->blendEq);
us->blendEqAlpha);
} else {
fxMesa->Glide.grAlphaBlendFunctionExt(GR_BLEND_ONE, GR_BLEND_ZERO,
GR_BLEND_OP_ADD,
@ -1840,7 +1858,15 @@ fxSetupFog(GLcontext * ctx)
}
grFogTable(fxMesa->fogTable);
grFogMode(GR_FOG_WITH_TABLE_ON_Q);
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) {
grVertexLayout(GR_PARAM_FOG_EXT, GR_VERTEX_FOG_OFFSET << 2,
GR_PARAM_ENABLE);
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
} else {
grVertexLayout(GR_PARAM_FOG_EXT, GR_VERTEX_FOG_OFFSET << 2,
GR_PARAM_DISABLE);
grFogMode(GR_FOG_WITH_TABLE_ON_Q);
}
}
else {
grFogMode(GR_FOG_DISABLE);
@ -1851,6 +1877,25 @@ void
fxDDFogfv(GLcontext * ctx, GLenum pname, const GLfloat * params)
{
FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
switch (pname) {
case GL_FOG_COORDINATE_SOURCE_EXT: {
GLenum p = (GLenum)*params;
if (p == GL_FOG_COORDINATE_EXT) {
_swrast_allow_vertex_fog(ctx, GL_TRUE);
_swrast_allow_pixel_fog(ctx, GL_FALSE);
_tnl_allow_vertex_fog( ctx, GL_TRUE);
_tnl_allow_pixel_fog( ctx, GL_FALSE);
} else {
_swrast_allow_vertex_fog(ctx, GL_FALSE);
_swrast_allow_pixel_fog(ctx, GL_TRUE);
_tnl_allow_vertex_fog( ctx, GL_FALSE);
_tnl_allow_pixel_fog( ctx, GL_TRUE);
}
break;
}
default:
;
}
}
/************************************************************************/

View file

@ -238,17 +238,6 @@ static void fx_print_vertex( GLcontext *ctx, const GrVertex *v )
* rendering. These functions are only used when mixed-mode rendering
* is occurring.
*/
static void fx_draw_quad( fxMesaContext fxMesa,
GrVertex *v0,
GrVertex *v1,
GrVertex *v2,
GrVertex *v3 )
{
BEGIN_CLIP_LOOP();
QUAD( v0, v1, v2, v3 );
END_CLIP_LOOP();
}
static void fx_draw_triangle( fxMesaContext fxMesa,
GrVertex *v0,
GrVertex *v1,
@ -404,10 +393,10 @@ static void fx_draw_point_wide_aa ( fxMesaContext fxMesa,
#define FX_MAX_TRIFUNC 0x20
static struct {
tnl_points_func points;
tnl_line_func line;
tnl_points_func points;
tnl_line_func line;
tnl_triangle_func triangle;
tnl_quad_func quad;
tnl_quad_func quad;
} rast_tab[FX_MAX_TRIFUNC];
#define DO_FALLBACK (IND & FX_FALLBACK_BIT)
@ -422,7 +411,7 @@ static struct {
#define DO_FULL_QUAD 1
#define HAVE_RGBA 1
#define HAVE_SPEC 1 /* [dBorca] investigate overhead !!! */
#define HAVE_SPEC 1
#define HAVE_HW_FLATSHADE 0
#define HAVE_BACK_COLORS 0
#define VERTEX GrVertex
@ -1027,7 +1016,16 @@ static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
grDrawTriangle( VERT(v0), VERT(v1), VERT(v2) )
#define RENDER_QUAD( v0, v1, v2, v3 ) \
fx_draw_quad( fxMesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
do { \
GrVertex *_v_[4]; \
_v_[0] = VERT(v3);\
_v_[1] = VERT(v0);\
_v_[2] = VERT(v1);\
_v_[3] = VERT(v2);\
grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);\
/*grDrawTriangle( VERT(v0), VERT(v1), VERT(v3) );*/\
/*grDrawTriangle( VERT(v1), VERT(v2), VERT(v3) );*/\
} while (0)
#define INIT(x) fxRenderPrimitive( ctx, x )

View file

@ -68,13 +68,11 @@ static void copy_pv2( GLcontext *ctx, GLuint edst, GLuint esrc )
*(GLuint *)&dst->pspec = *(GLuint *)&src->pspec;
}
typedef void (*emit_func)( GLcontext *, GLuint, GLuint, void * );
static struct {
emit_func emit;
tnl_copy_pv_func copy_pv;
tnl_interp_func interp;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
void (*emit)( GLcontext *, GLuint, GLuint, void * );
tnl_copy_pv_func copy_pv;
tnl_interp_func interp;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_format;
} setup_tab[MAX_SETUP];
@ -216,6 +214,93 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
#define TAG(x) x##_2wgpt0t1a
#include "fxvbtmp.h"
/* fog { */
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_FOGC)
#define TAG(x) x##_wgf
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_FOGC)
#define TAG(x) x##_wgt0f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|SETUP_FOGC)
#define TAG(x) x##_wgt0t1f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX|SETUP_FOGC)
#define TAG(x) x##_wgpt0f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\
SETUP_PTEX|SETUP_FOGC)
#define TAG(x) x##_wgpt0t1f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wgaf
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wgt0af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wgt0t1af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wgpt0af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\
SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wgpt0t1af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_FOGC)
#define TAG(x) x##_2wgf
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_FOGC)
#define TAG(x) x##_2wgt0f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|SETUP_FOGC)
#define TAG(x) x##_2wgt0t1f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX|SETUP_FOGC)
#define TAG(x) x##_2wgpt0f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\
SETUP_PTEX|SETUP_FOGC)
#define TAG(x) x##_2wgpt0t1f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wgaf
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wgt0af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wgt0t1af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wgpt0af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\
SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wgpt0t1af
#include "fxvbtmp.h"
/* fog } */
/* Snapping for voodoo-1
*/
@ -312,6 +397,101 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
#define TAG(x) x##_2wsgpt0t1a
#include "fxvbtmp.h"
/* fog { */
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_FOGC)
#define TAG(x) x##_wsgf
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|SETUP_FOGC)
#define TAG(x) x##_wsgt0f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
SETUP_TMU1|SETUP_FOGC)
#define TAG(x) x##_wsgt0t1f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
SETUP_PTEX|SETUP_FOGC)
#define TAG(x) x##_wsgpt0f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
SETUP_TMU1|SETUP_PTEX|SETUP_FOGC)
#define TAG(x) x##_wsgpt0t1f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wsgaf
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wsgt0af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wsgt0t1af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wsgpt0af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\
SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_wsgpt0t1af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_FOGC)
#define TAG(x) x##_2wsgf
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_FOGC)
#define TAG(x) x##_2wsgt0f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
SETUP_TMU1|SETUP_FOGC)
#define TAG(x) x##_2wsgt0t1f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
SETUP_PTEX|SETUP_FOGC)
#define TAG(x) x##_2wsgpt0f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
SETUP_TMU1|SETUP_PTEX|SETUP_FOGC)
#define TAG(x) x##_2wsgpt0t1f
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wsgaf
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wsgt0af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wsgt0t1af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wsgpt0af
#include "fxvbtmp.h"
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\
SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)
#define TAG(x) x##_2wsgpt0t1af
#include "fxvbtmp.h"
/* fog } */
/* Vertex repair (multipass rendering)
*/
@ -380,6 +560,26 @@ static void init_setup_tab( void )
init_2wgt0t1a();
init_2wgpt0a();
init_2wgpt0t1a();
init_wgf();
init_wgt0f();
init_wgt0t1f();
init_wgpt0f();
init_wgpt0t1f();
init_wgaf();
init_wgt0af();
init_wgt0t1af();
init_wgpt0af();
init_wgpt0t1af();
init_2wgf();
init_2wgt0f();
init_2wgt0t1f();
init_2wgpt0f();
init_2wgpt0t1f();
init_2wgaf();
init_2wgt0af();
init_2wgt0t1af();
init_2wgpt0af();
init_2wgpt0t1af();
init_wsg();
init_wsgt0();
@ -401,6 +601,26 @@ static void init_setup_tab( void )
init_2wsgt0t1a();
init_2wsgpt0a();
init_2wsgpt0t1a();
init_wsgf();
init_wsgt0f();
init_wsgt0t1f();
init_wsgpt0f();
init_wsgpt0t1f();
init_wsgaf();
init_wsgt0af();
init_wsgt0t1af();
init_wsgpt0af();
init_wsgpt0t1af();
init_2wsgf();
init_2wsgt0f();
init_2wsgt0t1f();
init_2wsgpt0f();
init_2wsgpt0t1f();
init_2wsgaf();
init_2wsgt0af();
init_2wsgt0t1af();
init_2wsgpt0af();
init_2wsgpt0t1af();
init_g();
init_t0();
@ -417,7 +637,7 @@ static void init_setup_tab( void )
void fxPrintSetupFlags(char *msg, GLuint flags )
{
fprintf(stderr, "%s(%x): %s%s%s%s%s%s%s\n",
fprintf(stderr, "%s(%x): %s%s%s%s%s%s%s%s\n",
msg,
(int)flags,
(flags & SETUP_XYZW) ? " xyzw," : "",
@ -426,7 +646,8 @@ void fxPrintSetupFlags(char *msg, GLuint flags )
(flags & SETUP_TMU0) ? " tex-0," : "",
(flags & SETUP_TMU1) ? " tex-1," : "",
(flags & SETUP_PSIZ) ? " psiz," : "",
(flags & SETUP_SPEC) ? " spec," : "");
(flags & SETUP_SPEC) ? " spec," : "",
(flags & SETUP_FOGC) ? " fog," : "");
}
@ -484,6 +705,9 @@ void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
if (newinputs & VERT_BIT_COLOR1)
ind |= SETUP_SPEC;
if (newinputs & VERT_BIT_FOG)
ind |= SETUP_FOGC;
if (newinputs & VERT_BIT_TEX0)
ind |= SETUP_TMU0;
@ -534,6 +758,10 @@ void fxChooseVertexState( GLcontext *ctx )
ind |= SETUP_SPEC;
}
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) {
ind |= SETUP_FOGC;
}
fxMesa->SetupIndex = ind;
if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {

View file

@ -48,6 +48,8 @@ static void TAG(emit)( GLcontext *ctx,
GLuint proj_stride = VB->NdcPtr->stride;
GLfloat (*psize)[4];
GLuint psize_stride;
GLfloat (*fog)[4];
GLuint fog_stride;
GrVertex *v = (GrVertex *)dest;
GLfloat u0scale,v0scale,u1scale,v1scale;
const GLubyte *mask = VB->ClipMask;
@ -88,6 +90,11 @@ static void TAG(emit)( GLcontext *ctx,
spec_stride = VB->SecondaryColorPtr[0]->stride;
}
if (IND & SETUP_FOGC) {
fog = VB->FogCoordPtr->data;
fog_stride = VB->FogCoordPtr->stride;
}
if (start) {
proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride);
if (IND & SETUP_PSIZ)
@ -100,6 +107,8 @@ static void TAG(emit)( GLcontext *ctx,
STRIDE_4F(col, start * col_stride);
if (IND & SETUP_SPEC)
STRIDE_4F(spec, start * spec_stride);
if (IND & SETUP_FOGC)
fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride);
}
for (i=start; i < end; i++, v++) {
@ -152,6 +161,10 @@ static void TAG(emit)( GLcontext *ctx,
UNCLAMPED_FLOAT_TO_UBYTE(v->pspec[0], spec[0][2]);
STRIDE_4F(spec, spec_stride);
}
if (IND & SETUP_FOGC) {
v->fog = CLAMP(fog[0][0], 0.0f, 1.0f);
fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride);
}
if (IND & SETUP_TMU0) {
GLfloat w = v->oow;
v->tmuvtx[0].sow = tc0[0][0] * u0scale * w;
@ -251,6 +264,10 @@ static void TAG(interp)( GLcontext *ctx,
INTERP_UB( t, dst->pspec[2], out->pspec[2], in->pspec[2] );
}
if (IND & SETUP_FOGC) {
INTERP_F( t, dst->fog, out->fog, in->fog );
}
if (IND & SETUP_TMU0) {
INTERP_F( t,
dst->tmuvtx[0].sow,