Question

I have this error

Error: Error #3661: AGAL validation failed: Temporary register index out of bounds for source operand 2 at token 5 of vertex program.

when trying to converting this GLSL:

attribute vec3 aVertexPosition;

    uniform mat4 uMVMatrix;
    uniform mat4 uPMatrix;

    void main(void) {
        gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
    }

to this code:

mov vt0.w, vc0.x
mov vt0.xyz, va0.xyz

mov vt1.xyzw, vc1
mul vt5.xyzw, vt1, vc5
m44 op.xyzw, vt0.xyzw, vt5

How can I solve this? Any suggestion? Thanks!!!

Was it helpful?

Solution

There are only 8 temporary registers vt0 - vt7. You are attempting to store a 4x4 matrix in vt5, but there are only two registers after it: there isn't enough room.

I suggest that you use vt1 to both store a matrix and to receive the contents of the matrix multiplication:

mov vt0.w, vc0.x
mov vt0.xyz, va0.xyz

mov vt1, vc1
mul vt1, vt1, vc5
m44 op, vt0, vt1

The only problem is that I think that mul will not do a true matrix multiplication, it instead does a component wise multiplication, and m44 does a multiplication between a 4x4 matrix and a 4 component vector. From what I've read, I'm not sure how you can multiply two matrices in agal. You might have to do the matrix multiplication in actionscript. Let me know what happens!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top