From 2d61d301171620efe624d83a5457f4094eb49cba Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 17 Oct 2005 00:54:12 +0000 Subject: add GL_EXT_fog_coord support to radeon driver. No vtxfmt code (just uses fallback) yet. May cause a tcl fallback if fog coord is used together with separate specular lighting. Fog factors are precomputed and then submitted instead of the raw coords (chip limitation, same as on r200). --- src/mesa/drivers/dri/radeon/radeon_vtxfmt.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_vtxfmt.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c index e554aeb330..c734ab8d5a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c @@ -549,7 +549,8 @@ static GLboolean check_vtx_fmt( GLcontext *ctx ) GLuint ind = RADEON_CP_VC_FRMT_Z; GLuint unit; - if (rmesa->TclFallback || rmesa->vb.fell_back || ctx->CompileFlag) + if (rmesa->TclFallback || rmesa->vb.fell_back || ctx->CompileFlag || + (ctx->Fog.Enabled && (ctx->Fog.FogCoordinateSource == GL_FOG_COORD))) return GL_FALSE; if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) @@ -582,6 +583,10 @@ static GLboolean check_vtx_fmt( GLcontext *ctx ) } } + if ( ctx->Fog.FogCoordinateSource == GL_FOG_COORD ) { + ind |= RADEON_CP_VC_FRMT_PKSPEC; + } + for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { if (ctx->Texture.Unit[unit].TexGenEnabled) { @@ -657,6 +662,9 @@ static GLboolean check_vtx_fmt( GLcontext *ctx ) UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] ); UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] ); UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] ); + /* fog ??? */ +/* UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->alpha, + radeonComputeFogFactor(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]) ); */ } for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) { @@ -948,8 +956,6 @@ void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen ) /* Not active in supported states; just keep ctx->Current uptodate: */ - vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; - vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv; vfmt->Indexf = _mesa_noop_Indexf; @@ -986,6 +992,8 @@ void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen ) vfmt->VertexAttrib3fvNV = radeon_fallback_VertexAttrib3fvNV; vfmt->VertexAttrib4fNV = radeon_fallback_VertexAttrib4fNV; vfmt->VertexAttrib4fvNV = radeon_fallback_VertexAttrib4fvNV; + vfmt->FogCoordfEXT = radeon_fallback_FogCoordfEXT; + vfmt->FogCoordfvEXT = radeon_fallback_FogCoordfvEXT; (void)radeon_fallback_vtxfmt; -- cgit v1.2.3