Hi,

Here is a new version of Back face color. It also enables FOGC out.

VERT_RESULT_BFC1
VERT_RESULT_PSIZ
VERT_RESULT_COL1

is pure guess work. If some one has a example that exercise some of
those that wot help mi.

VERT_RESULT_BFC0

That is the only value where i can get Back faced to work for the moment.

VERT_RESULT_FOGC

That is the value where it seems to work for the moment. I have some
indications that it is actually dependent on the the index used in
r300_vertprog.c t_dst_index.

Cut it bee that r300VAPOutputCntl0 and r300VAPOutputCntl1 depends on the
values set in r300_vertprog.c t_dst_index?





Oliver McFadden skrev:
> Hi,
>
> I think something is wrong with the
> R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT
> change you made. You changed this to (1 << 16) however this would
> correspond to
> the R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT define.
>
> So either your change is incorrect, or the defines for
> R300_VAP_OUTPUT_VTX_FMT_0
> are incorrect. It wouldn't surprise me if some of the bits for this
> register are
> not correct; as far as I know the driver hasn't previously supported
> back-facing
> color, so these bits may have been guessed based on the standard color
> bit.
>
> I don't think it would be hard to write some OpenGL code for revenge
> (my reverse
> engineering tool) to test these bits, though.
>
>
> On 6/8/07, Tommy Schultz Lassen <[EMAIL PROTECTED]> wrote:
>> Hi Oliver
>>
>> I got the checker board shown in wave :). The problem seems to bee
>> missing VERT_RESULT_BFC0.
>>
>> I have attached a patch that gets VERT_RESULT_BFC0 a step closer.
>>
>> There is a couple of problems:
>>
>> 1) This patch makes the driver do state changes allot.
>>
>> 2) I fink there is something more basic wrong wit how wee handle
>> VERT_RESULT.
>>
>> How do the chip now that the reg wee set in r300TranslateVertexShader
>> with code like:
>>
>> vp->outputs[VERT_RESULT_BFC0] = cur_reg++;
>>
>> is for VERT_RESULT_BFC0.
>>
>>
>> Any insights?
>>
>>
>> The patch makes the tube in fog look read instead of green. NWN looks as
>> it has for some time. OK but with weird  colors on  cloaks an some
>> monsters.
>>
>> I am going to keep looking.
>>
>> /Tommy
>>

diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c
index 4670c28..cef8557 100644
--- a/src/mesa/drivers/dri/r300/r300_emit.c
+++ b/src/mesa/drivers/dri/r300/r300_emit.c
@@ -296,21 +306,21 @@ static GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten)
 	if (OutputsWritten & (1 << VERT_RESULT_COL0))
 		ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
 
-	if (OutputsWritten & (1 << VERT_RESULT_COL1))
-		ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
-
-#if 0
 	if (OutputsWritten & (1 << VERT_RESULT_BFC0))
-		ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT;
+		ret |= (1 << 16);
 
-	if (OutputsWritten & (1 << VERT_RESULT_BFC1))
-		ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT;
+	if (OutputsWritten & (1 << VERT_RESULT_FOGC))
+		ret |= (1 << 5);
 
-	if (OutputsWritten & (1 << VERT_RESULT_FOGC)) ;
-#endif
+	// Guesses
+	if (OutputsWritten & (1 << VERT_RESULT_BFC1))
+		ret |= (1 << 17);
 
 	if (OutputsWritten & (1 << VERT_RESULT_PSIZ))
-		ret |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
+		ret |= (1 << 15);
+
+	if (OutputsWritten & (1 << VERT_RESULT_COL1))
+		ret |= (1 << 2);
 
 	return ret;
 }
diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 16dddf6..f19a06f 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -189,8 +189,21 @@ static unsigned long t_dst_class(enum register_file file)
 static unsigned long t_dst_index(struct r300_vertex_program *vp,
 				 struct prog_dst_register *dst)
 {
-	if (dst->File == PROGRAM_OUTPUT)
+	if (dst->File == PROGRAM_OUTPUT) {
+		if (vp->outputs[dst->Index] == -1) {
+			int i;
+			int max_reg = 0;
+
+			for (i = 0; i < VERT_RESULT_MAX; i++)
+				if (vp->outputs[i] > max_reg)
+					max_reg = vp->outputs[i];
+
+			vp->outputs[dst->Index] = max_reg + 1;
+		}
 		return vp->outputs[dst->Index];
+	} else if (dst->File == PROGRAM_ADDRESS) {
+		assert(dst->Index == 0);
+	}
 
 	return dst->Index;
 }
@@ -350,18 +363,6 @@ static unsigned long op_operands(enum prog_opcode opcode)
 	return 0;
 }
 
-static GLboolean valid_dst(struct r300_vertex_program *vp,
-			   struct prog_dst_register *dst)
-{
-	if (dst->File == PROGRAM_OUTPUT && vp->outputs[dst->Index] == -1) {
-		return GL_FALSE;
-	} else if (dst->File == PROGRAM_ADDRESS) {
-		assert(dst->Index == 0);
-	}
-
-	return GL_TRUE;
-}
-
 /* TODO: Get rid of t_src_class call */
 #define CMP_SRCS(a, b) ((a.RelAddr != b.RelAddr) || (a.Index != b.Index && \
 		       ((t_src_class(a.File) == VSF_IN_CLASS_PARAM && \
@@ -435,35 +436,24 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
 	for (i = 0; i < VERT_RESULT_MAX; i++)
 		vp->outputs[i] = -1;
 
-	assert(vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS));
-
 	/* Assign outputs */
 	if (vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS))
 		vp->outputs[VERT_RESULT_HPOS] = cur_reg++;
 
-	if (vp->key.OutputsWritten & (1 << VERT_RESULT_PSIZ))
-		vp->outputs[VERT_RESULT_PSIZ] = cur_reg++;
-
 	if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL0))
 		vp->outputs[VERT_RESULT_COL0] = cur_reg++;
 
-	if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL1))
-		vp->outputs[VERT_RESULT_COL1] = cur_reg++;
-
-#if 0				/* Not supported yet */
 	if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0))
 		vp->outputs[VERT_RESULT_BFC0] = cur_reg++;
 
-	if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1))
-		vp->outputs[VERT_RESULT_BFC1] = cur_reg++;
+	for (i = VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++)
+		if (vp->key.OutputsWritten & (1 << i))
+			vp->outputs[i] = cur_reg++;
 
 	if (vp->key.OutputsWritten & (1 << VERT_RESULT_FOGC))
 		vp->outputs[VERT_RESULT_FOGC] = cur_reg++;
-#endif
 
-	for (i = VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++)
-		if (vp->key.OutputsWritten & (1 << i))
-			vp->outputs[i] = cur_reg++;
+	assert(vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS));
 
 	vp->translated = GL_TRUE;
 	vp->native = GL_TRUE;
@@ -472,12 +462,6 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
 	for (; vpi->Opcode != OPCODE_END; vpi++, o_inst++) {
 		FREE_TEMPS();
 
-		if (!valid_dst(vp, &vpi->DstReg)) {
-			/* redirect result to unused temp */
-			vpi->DstReg.File = PROGRAM_TEMPORARY;
-			vpi->DstReg.Index = u_temp_i;
-		}
-
 		operands = op_operands(vpi->Opcode);
 		are_srcs_scalar = operands & SCALAR_FLAG;
 		operands &= OP_MASK;
@@ -1255,8 +1239,6 @@ void r300SelectVertexShader(r300ContextPtr r300)
 	vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current;
 	InputsRead = ctx->FragmentProgram._Current->Base.InputsRead;
 
-	wanted_key.OutputsWritten |= 1 << VERT_RESULT_HPOS;
-
 	wpos_idx = -1;
 	if (InputsRead & FRAG_BIT_WPOS) {
 		for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
@@ -1272,19 +1254,8 @@ void r300SelectVertexShader(r300ContextPtr r300)
 		wpos_idx = i;
 	}
 
-	if (InputsRead & FRAG_BIT_COL0)
-		wanted_key.OutputsWritten |= 1 << VERT_RESULT_COL0;
-
-	if ((InputsRead & FRAG_BIT_COL1)	/*||
-						   (InputsRead & FRAG_BIT_FOGC) */ )
-		wanted_key.OutputsWritten |= 1 << VERT_RESULT_COL1;
-
-	for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
-		if (InputsRead & (FRAG_BIT_TEX0 << i))
-			wanted_key.OutputsWritten |=
-			    1 << (VERT_RESULT_TEX0 + i);
-
 	wanted_key.InputsRead = vpc->mesa_program.Base.InputsRead;
+	wanted_key.OutputsWritten = vpc->mesa_program.Base.OutputsWritten;
 	if (vpc->mesa_program.IsPositionInvariant) {
 		/* we wan't position don't we ? */
 		wanted_key.InputsRead |= (1 << VERT_ATTRIB_POS);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to