Question

i hava a little confused about the registers.

in this article, http://www.adobe.com/devnet/flashplayer/articles/what-is-agal.html

there have two line AGAL code

m44 op, va0, vc0
mov v0, va1

the first line put the calculate result in op register,but the second line did not operate the op register,

so what's the meaning to do the first line?

also i found an demo:

//compile vertex shader
var vertexShader:Array =
    [
    "dp4 op.x, va0, vc0", //4x4 matrix transform from 0 to output clipspace
    "dp4 op.y, va0, vc1",
    "dp4 op.z, va0, vc2",
    "dp4 op.w, va0, vc3",
    "mov v0, va1.xyzw"    //copy texcoord from 1 to fragment program
    ];
var vertexAssembler:AGALMiniAssembler = new AGALMiniAssembler();
vertexAssembler.assemble(flash.display3D.Context3DProgramType.VERTEX, vertexShader.join("\n"));

//compile fragment shader
var fragmentShader:Array =
    [
    "mov ft0, v0\n",
    "tex ft1, ft0, fs1 <2d,clamp,linear>\n", //sample texture 1     
    "mov oc, ft1\n"
    ];

in vertexShader, top three line also put the reslut in op, but the fourth line alos not used it .

so what is that means?

thanks

Was it helpful?

Solution

First line simply multiplies current vertex position and Model-View-Projection matrix and writes the result to output register.

The second line uses varying register to pass some data to pixel shader. Since those two lines is all code I can see, all I can say is that va1 probably contains texture UV coords.

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