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

diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
index 4a0b6c0..6336a76 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
@@ -372,6 +372,7 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi
 		case RC_OPCODE_POW: ei_pow(compiler->code, vpi, inst); break;
 		case RC_OPCODE_RCP: ei_math1(compiler->code, ME_RECIP_DX, vpi, inst); break;
 		case RC_OPCODE_RSQ: ei_math1(compiler->code, ME_RECIP_SQRT_DX, vpi, inst); break;
+		case RC_OPCODE_SGT: ei_vector2(compiler->code, VE_SET_GREATER_THAN, vpi, inst); break;
 		case RC_OPCODE_SGE: ei_vector2(compiler->code, VE_SET_GREATER_THAN_EQUAL, vpi, inst); break;
 		case RC_OPCODE_SLT: ei_vector2(compiler->code, VE_SET_LESS_THAN, vpi, inst); break;
 		default:
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to