Hi

I have been playing around for some time with NeverwinterNights. That
has a problem with wrong colors on cloaks an some other parts of some
models. I fink i finally have found the problem.

In the R300 driver's fragment program part the input COL1 component is
alleyways  send to the program when the program wants it. But if wee
have a vertex program that uses the secondary input color for something
and wee don't having  GL_SEPARATE_SPECULAR_COLOR. Then default fragment
program has COL1. But it while give us the wrong colors.

Attached is a patch that tests for GL_SEPARATE_SPECULAR_COLOR.

/Tommy
>From 0fec50c193afd05e9c3bd92149f6cfdc717b275d Mon Sep 17 00:00:00 2001
From: Tommy Schultz Lassen <[EMAIL PROTECTED]>
Date: Sat, 8 Sep 2007 14:36:25 +0200
Subject: [PATCH] Only use COL1 component in fragment program when ColorControl is GL_SEPARATE_SPECULAR_COLOR.

---
 src/mesa/drivers/dri/r300/r300_fragprog.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c
index cce8e68..360f828 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.c
@@ -2079,6 +2079,7 @@ static void insert_wpos(struct gl_program *prog)
  */
 static void init_program(r300ContextPtr r300, struct r300_fragment_program *fp)
 {
+	GLcontext *ctx = r300->radeon.glCtx;
 	struct r300_pfs_compile_state *cs = NULL;
 	struct gl_fragment_program *mp = &fp->mesa_program;
 	struct prog_instruction *fpi;
@@ -2142,7 +2143,9 @@ static void init_program(r300ContextPtr r300, struct r300_fragment_program *fp)
 	InputsRead &= ~FRAG_BIT_COL0;
 
 	/* Secondary color */
-	if (InputsRead & FRAG_BIT_COL1) {
+	if (ctx->Light.Model.ColorControl ==
+			     GL_SEPARATE_SPECULAR_COLOR &&
+			InputsRead & FRAG_BIT_COL1) {
 		cs->inputs[FRAG_ATTRIB_COL1].refcount = 0;
 		cs->inputs[FRAG_ATTRIB_COL1].reg = get_hw_temp(fp, 0);
 	}
-- 
1.5.2.5

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to