Mat4 assignment multiplication failing

Hello,

I had a vertex shader that was working without problems in Linux (using ATI propietary drivers), but it failed in Windows (also with ATI drivers). After a lot of nearly blind debugging, I reduced an assigment multiplication to the following:

mat4 shaper=shBase;
shaper*=mat4(vec4(1.0,0.0,0.0,0.0),
             vec4(0.0,1.0,0.0,0.0),
             vec4(0.0,0.0,1.0,0.0),
             vec4(0.0,0.0,0.0,1.0));

Surprisingly, that was destroying the “shaper” matrix (I don’t know exactly what was happening to the matrix after that, but shaper was not shBase anymore). This test result was too weird for me so I tried:

mat4 shaper=shBase;
shaper=shaper*mat4(vec4(1.0,0.0,0.0,0.0),
             vec4(0.0,1.0,0.0,0.0),
             vec4(0.0,0.0,1.0,0.0),
             vec4(0.0,0.0,0.0,1.0));

Not so much surprisingly now, this worked, and the same change also fixed the original vertex shader.

Now the real question: I skimmed the glsl spec and couldn’t find anything about the *= operator in conjunction with matrices. Could it be because the mat4 is being created in the same expression (I can’t imagine why it would be a problem, if it is please somebody can explain it to me?) Or could it be an implementation bug or something like that?

Thanks!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.