Tested with progs/demos/spectex and progs/tests/seccol
From 25644f5a5cac44b77496a8b65eb13cef6f97d20e Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <rand...@mail.ru>
Date: Tue, 2 Mar 2010 16:16:38 +0000
Subject: [PATCH] nouveau/nv04: GL_EXT_secondary_color

---
 src/mesa/drivers/dri/nouveau/nouveau_context.c   |    2 ++
 src/mesa/drivers/dri/nouveau/nv04_state_raster.c |   14 +++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 47ee9dc..7d695d4 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -43,6 +43,7 @@
 
 #define need_GL_EXT_framebuffer_object
 #define need_GL_EXT_fog_coord
+#define need_GL_EXT_secondary_color
 
 #include "main/remap_helper.h"
 
@@ -56,6 +57,7 @@ static const struct dri_extension nouveau_extensions[] = {
 	{ "GL_EXT_framebuffer_object",  GL_EXT_framebuffer_object_functions },
 	{ "GL_EXT_stencil_wrap",	NULL },
 	{ "GL_EXT_fog_coord",		GL_EXT_fog_coord_functions },
+	{ "GL_EXT_secondary_color",     GL_EXT_secondary_color_functions },
 	{ "GL_NV_blend_square",         NULL },
 	{ "GL_SGIS_generate_mipmap",	NULL },
 	{ NULL,				NULL }
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index 4314fc3..c11de42 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -184,7 +184,7 @@ nv04_emit_control(GLcontext *ctx, int emit)
 
 		ctrl0 |= get_comparison_op(ctx->Color.AlphaFunc) << 8 |
 			FLOAT_TO_UBYTE(ctx->Color.AlphaRef);
-
+		
 		/* Stencil test. */
 		if (ctx->Stencil.WriteMask[0])
 			ctrl0 |= NV04_MULTITEX_TRIANGLE_CONTROL0_STENCIL_WRITE;
@@ -274,7 +274,11 @@ nv04_emit_blend(GLcontext *ctx, int emit)
 			blend |= NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_GOURAUD;
 		else
 			blend |= NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_FLAT;
-
+		
+		/* Secondary color */
+		if (NEED_SECONDARY_COLOR (ctx))
+			blend |= (0x2 << 15);
+		
 		/* Fog. */
 		if (ctx->Fog.Enabled)
 			blend |= NV04_MULTITEX_TRIANGLE_BLEND_FOG_ENABLE;
@@ -302,12 +306,16 @@ nv04_emit_blend(GLcontext *ctx, int emit)
 			blend |= NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_GOURAUD;
 		else
 			blend |= NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_FLAT;
-
+		
 		/* Texture environment. */
 		if (ctx->Texture._EnabledUnits)
 			blend |= get_texenv_mode(ctx->Texture.Unit[0].EnvMode);
 		else
 			blend |= get_texenv_mode(GL_MODULATE);
+			
+		/* Secondary color */
+		if (NEED_SECONDARY_COLOR (ctx))
+			blend |= (0x1 << 12);
 
 		/* Fog. */
 		if (ctx->Fog.Enabled)
-- 
1.6.5.4

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to