diff options
author | Daniel Borca <[email protected]> | 2004-07-02 10:34:48 +0000 |
---|---|---|
committer | Daniel Borca <[email protected]> | 2004-07-02 10:34:48 +0000 |
commit | 009542a0f7c2f90e3057f10bd1b17ae65f906d72 (patch) | |
tree | 77bbbed01bfc451c9f7f07b65b3d2220951357bc /src/mesa/drivers/glide/fxsetup.c | |
parent | 3aa364c8e11f10cc7cec384869ef59ff2f57c249 (diff) |
added GL_EXT_fog_coord.
added GL_EXT_blend_equation_separate.
minor cleanup.
Diffstat (limited to 'src/mesa/drivers/glide/fxsetup.c')
-rw-r--r-- | src/mesa/drivers/glide/fxsetup.c | 59 |
1 files changed, 52 insertions, 7 deletions
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index 9aa9599ae4c..0d900d29f45 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -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: + ; + } } /************************************************************************/ |