On Tue, May 25, 2010 at 11:57:23AM +0200, Marek Olšák wrote:
> The patch looks good but it's r5xx-only. I'll commit this when an r3xx
> version is implemented too.
yes I realized that the opcode is R500 only. I've taken a different approach
using transformations which works too, but I don't know if it's acceptable.
I'm attaching the patch which also handles the SLE case.
>
> -Marek
>
> On Mon, May 24, 2010 at 6:00 PM, Gianluca Anzolin
> <[email protected]>wrote:
>
> > Hello,
> >
> > Yesterday I was trying to run an example taken from chapter 6 of the book
> > OpenGl
> > Shading Language with the new gallium driver (I have a RV570 graphic card),
> > but
> > I got this error when compiling the vertex shader: Unknown opcode 35.
> >
> > Digging in the source code I found that the opcode 35 is for the > operator
> > between two vectors (RC_OPCODE_SGT). It's related to the following vertex
> > shader code:
> >
> > if (diffuse > 0.0)
> > {
> > spec = max(dot(reflectVec, viewVec), 0.0);
> > spec = pow(spec, 16.0);
> > }
> >
> >
> >
> > When I changed the comparison to ">=" the problem disappeared. Infact there
> > is
> > no switch case for RC_OPCODE_SGT in the file r3xx_vertprog.c. I added that
> > case
> > to the switch statement (see the patch attached) and I got it working even
> > with
> > the ">" operator.
> >
> > I hope the patch is correct, if there is a better fix I'd really like to
> > know.
> >
> > Thanks,
> >
> > Gianluca
> >
> >
> > _______________________________________________
> > mesa-dev mailing list
> > [email protected]
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> >
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
index 5ba2c29..774657a 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
@@ -579,6 +579,20 @@ static void transform_r300_vertex_fix_LIT(struct radeon_compiler* c,
inst->U.I.SrcReg[0] = srcreg(RC_FILE_TEMPORARY, tempreg);
}
+static void transform_r300_vertex_SGT(struct radeon_compiler* c,
+ struct rc_instruction* inst)
+{
+ transform_SGT(c, inst);
+ transform_r300_vertex_CMP(c, inst->Prev);
+}
+
+static void transform_r300_vertex_SLE(struct radeon_compiler* c,
+ struct rc_instruction* inst)
+{
+ transform_SLE(c, inst);
+ transform_r300_vertex_CMP(c, inst->Prev);
+}
+
/**
* For use with radeonLocalTransform, this transforms non-native ALU
* instructions of the r300 up to r500 vertex engine.
@@ -600,6 +614,8 @@ int r300_transform_vertex_alu(
case RC_OPCODE_SUB: transform_SUB(c, inst); return 1;
case RC_OPCODE_SWZ: transform_SWZ(c, inst); return 1;
case RC_OPCODE_XPD: transform_XPD(c, inst); return 1;
+ case RC_OPCODE_SGT: transform_r300_vertex_SGT(c, inst); return 1;
+ case RC_OPCODE_SLE: transform_r300_vertex_SLE(c, inst); return 1;
default:
return 0;
}
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev