From 2330ed08c3d5f5fe3c02634d54e606501dff4862 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 26 Oct 2005 09:37:53 +0000 Subject: Add disabled support for GL_EXT_fog_coord. While it seems correct to me, it's not respecting the coords (or perhaps interpreting them differently?) in my testing. However, in the process it led to a fix of a secondary color handling issue where it would be taken from the wrong offset, I believe, based off of reading the r200 driver. Also add a minor tweak to save time in the fog-but-not-specular case. --- src/mesa/drivers/dri/sis/sis_context.c | 2 ++ src/mesa/drivers/dri/sis/sis_fog.c | 16 ++++++++++++++++ src/mesa/drivers/dri/sis/sis_state.c | 1 + src/mesa/drivers/dri/sis/sis_tris.c | 33 ++++++++++++++++----------------- 4 files changed, 35 insertions(+), 17 deletions(-) (limited to 'src/mesa/drivers/dri/sis') diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index ebfc1f36ef..7e86c1127c 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -60,6 +60,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define need_GL_ARB_multisample #define need_GL_ARB_texture_compression +#define need_GL_EXT_fog_coord #define need_GL_EXT_secondary_color #include "extension_helper.h" @@ -78,6 +79,7 @@ struct dri_extension card_extensions[] = { "GL_ARB_texture_border_clamp", NULL }, { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, { "GL_ARB_texture_mirrored_repeat", NULL }, + /*{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },*/ { "GL_EXT_texture_lod_bias", NULL }, { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions }, { "GL_EXT_stencil_wrap", NULL }, diff --git a/src/mesa/drivers/dri/sis/sis_fog.c b/src/mesa/drivers/dri/sis/sis_fog.c index da36b3d795..fe9a3c95d6 100644 --- a/src/mesa/drivers/dri/sis/sis_fog.c +++ b/src/mesa/drivers/dri/sis/sis_fog.c @@ -53,6 +53,22 @@ sisDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ) switch (pname) { + case GL_FOG_COORDINATE_SOURCE_EXT: + current->hwFog &= ~MASK_FogMode; + switch (ctx->Fog.FogCoordinateSource) + { + case GL_FOG_COORDINATE_EXT: + current->hwFog &= ~MASK_FogZLookup; + break; + case GL_FRAGMENT_DEPTH_EXT: + current->hwFog |= MASK_FogZLookup; + break; + } + if (current->hwFog != prev->hwFog) { + prev->hwFog = current->hwFog; + smesa->GlobalFlag |= GFLAG_FOGSETTING; + } + break; case GL_FOG_MODE: current->hwFog &= ~MASK_FogMode; switch (ctx->Fog.Mode) diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c index f41fb3da04..1a4c324115 100644 --- a/src/mesa/drivers/dri/sis/sis_state.c +++ b/src/mesa/drivers/dri/sis/sis_state.c @@ -823,6 +823,7 @@ void sisDDInitState( sisContextPtr smesa ) /* Set initial fog settings. Start and end are the same case. */ sisDDFogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density ); sisDDFogfv( ctx, GL_FOG_END, &ctx->Fog.End ); + sisDDFogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, NULL ); sisDDFogfv( ctx, GL_FOG_MODE, NULL ); } diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c index 44cbcd6670..24f6cb9aa8 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.c +++ b/src/mesa/drivers/dri/sis/sis_tris.c @@ -403,21 +403,24 @@ do { \ #define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset] -#define VERT_SET_SPEC( v0, c ) \ +#define VERT_SET_SPEC( v, c ) \ do { \ if (specoffset != 0) { \ - UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.red, (c)[0]); \ - UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.green, (c)[1]); \ - UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.blue, (c)[2]); \ + sis_color_t *spec = (sis_color_t *)&((v)->ui[specoffset]); \ + UNCLAMPED_FLOAT_TO_UBYTE(spec->red, (c)[0]); \ + UNCLAMPED_FLOAT_TO_UBYTE(spec->green, (c)[1]); \ + UNCLAMPED_FLOAT_TO_UBYTE(spec->blue, (c)[2]); \ } \ } while (0) -#define VERT_COPY_SPEC( v0, v1 ) \ -do { \ - if (specoffset != 0) { \ - v0->v.specular.red = v1->v.specular.red; \ - v0->v.specular.green = v1->v.specular.green; \ - v0->v.specular.blue = v1->v.specular.blue; \ - } \ +#define VERT_COPY_SPEC( v0, v1 ) \ +do { \ + if (specoffset != 0) { \ + sis_color_t *spec0 = (sis_color_t *)&((v0)->ui[specoffset]); \ + sis_color_t *spec1 = (sis_color_t *)&((v1)->ui[specoffset]); \ + spec0->red = spec1->red; \ + spec0->green = spec1->green; \ + spec0->blue = spec1->blue; \ + } \ } while (0) #define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset] @@ -833,9 +836,6 @@ do { \ smesa->vertex_attrs[smesa->vertex_attr_count].offset = (N); \ smesa->vertex_attr_count++; \ } while (0) - -#define SIS_TCL_STATE_BITS \ - (_TNL_BITS_TEX_ANY | _TNL_BIT_COLOR1 | _TNL_BIT_FOG) static void sisRenderStart( GLcontext *ctx ) { @@ -880,12 +880,13 @@ static void sisRenderStart( GLcontext *ctx ) EMIT_ATTR(_TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA); + smesa->specoffset = 0; if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) { AGPParseSet |= SiS_PS_HAS_SPECULAR; - smesa->specoffset = smesa->coloroffset + 1; if (index & _TNL_BIT_COLOR1) { EMIT_ATTR(_TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR); + smesa->specoffset = smesa->coloroffset + 1; } else { EMIT_PAD(3); } @@ -895,8 +896,6 @@ static void sisRenderStart( GLcontext *ctx ) } else { EMIT_PAD(1); } - } else { - smesa->specoffset = 0; } /* projective textures are not supported by the hardware */ -- cgit v1.2.3