Add support for GL_EXT_secondary_color. It looks like using
authorEric Anholt <anholt@FreeBSD.org>
Tue, 6 Dec 2005 10:38:37 +0000 (10:38 +0000)
committerEric Anholt <anholt@FreeBSD.org>
Tue, 6 Dec 2005 10:38:37 +0000 (10:38 +0000)
NEED_SECONDARY_COLOR to turn it off/on was what we wanted -- now results look
correct using seccolor on Savage IX and Savage4.

src/mesa/drivers/dri/savage/savage_xmesa.c
src/mesa/drivers/dri/savage/savagestate.c

index 53415d535b52e4c9154db0188b8ebd27c6d2a531..4f5201491d8bb0273de50a95eea9b300973cafaf 100644 (file)
@@ -61,6 +61,7 @@
 
 #define need_GL_ARB_multisample
 #define need_GL_ARB_texture_compression
+#define need_GL_EXT_secondary_color
 #include "extension_helper.h"
 
 #include "xmlpool.h"
@@ -136,6 +137,7 @@ static const struct dri_extension card_extensions[] =
     { "GL_ARB_texture_compression",        GL_ARB_texture_compression_functions },
     { "GL_EXT_stencil_wrap",               NULL },
     { "GL_EXT_texture_lod_bias",           NULL },
+    { "GL_EXT_secondary_color",            GL_EXT_secondary_color_functions },
     { NULL,                                NULL }
 };
 
index 1acabcb5f4732c8131d0ae80d7c0842371446d53..44cf2f20d37dc900955fdaca71dadce8720bd454 100644 (file)
@@ -866,40 +866,28 @@ static void savageDDColorMask_s3d(GLcontext *ctx,
        FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !(r && g && b));
 }
 
-/* Seperate specular not fully implemented in hardware...  Needs
- * some interaction with material state?  Just punt to software
- * in all cases?
- * FK: Don't fall back for now. Let's see the failure cases and
- *     fix them the right way. I don't see how this could be a
- *     hardware limitation.
- */
 static void savageUpdateSpecular_s4(GLcontext *ctx) {
     savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
     u_int32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui;
 
-    if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
-       ctx->Light.Enabled) {
+    if (NEED_SECONDARY_COLOR(ctx)) {
        imesa->regs.s4.drawLocalCtrl.ni.specShadeEn = GL_TRUE;
-       /*FALLBACK (ctx, SAVAGE_FALLBACK_SPECULAR, GL_TRUE);*/
     } else {
        imesa->regs.s4.drawLocalCtrl.ni.specShadeEn = GL_FALSE;
-       /*FALLBACK (ctx, SAVAGE_FALLBACK_SPECULAR, GL_FALSE);*/
     }
 
     if (drawLocalCtrl != imesa->regs.s4.drawLocalCtrl.ui)
        imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
 }
+
 static void savageUpdateSpecular_s3d(GLcontext *ctx) {
     savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
     u_int32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui;
 
-    if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
-       ctx->Light.Enabled) {
+    if (NEED_SECONDARY_COLOR(ctx)) {
        imesa->regs.s3d.drawCtrl.ni.specShadeEn = GL_TRUE;
-       /*FALLBACK (ctx, SAVAGE_FALLBACK_SPECULAR, GL_TRUE);*/
     } else {
        imesa->regs.s3d.drawCtrl.ni.specShadeEn = GL_FALSE;
-       /*FALLBACK (ctx, SAVAGE_FALLBACK_SPECULAR, GL_FALSE);*/
     }
 
     if (drawCtrl != imesa->regs.s3d.drawCtrl.ui)