Hi,
I finally ran glean today, and noticed that SWZ wasn't implemented
properly for r300 ARB vertex programs.

So far I didn't handle per-component negation flags, the attached patch
adds that.

Question: is it okay to assume that "NegateBase" in
struct prog_src_register will always be filled the way it's filled
currently? ie that the sign for the x component is at bit 0 etc.

If it doesn't, the patch I attached obviously wouldn't work...

If there are no objections, I'll commit this in a few days.

Regards,
Tilman

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Index: src/mesa/drivers/dri/r300/r300_vertexprog.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r300/r300_vertexprog.c,v
retrieving revision 1.51
diff -u -p -r1.51 r300_vertexprog.c
--- src/mesa/drivers/dri/r300/r300_vertexprog.c 30 May 2006 18:49:20 -0000      
1.51
+++ src/mesa/drivers/dri/r300/r300_vertexprog.c 30 May 2006 19:11:56 -0000
@@ -913,7 +913,19 @@ void r300_translate_vertex_shader(struct
                        
                        o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, 
&vpi->DstReg),
                                t_dst_mask(vpi->DstReg.WriteMask), 
t_dst_class(vpi->DstReg.File));
-                       o_inst->src1=t_src(vp, &src[0]);
+                       /* SWZ supports per-component negation in the swizzle 
mask,
+                        * so we just pass src->NegateBase as-is, instead of 
reducing it
+                        * to VSF_FLAG_ALL or VSF_FLAG_NONE.
+                        * This works because the flags in NegateBase equal the 
ones we
+                        * need here.
+                        */
+                       o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
+                               t_swizzle(GET_SWZ(src->Swizzle, 0)),
+                               t_swizzle(GET_SWZ(src->Swizzle, 1)),
+                               t_swizzle(GET_SWZ(src->Swizzle, 2)),
+                               t_swizzle(GET_SWZ(src->Swizzle, 3)),
+                               t_src_class(src->File),
+                               src->NegateBase) | (src->RelAddr << 4);
                        o_inst->src2=ONE_SRC_0;
                        o_inst->src3=ZERO_SRC_0;
 

Attachment: pgpri282900Y3.pgp
Description: PGP signature

--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to