Should the projection matrix of the model be built in ActionScript 3 or on the GPU in the vertex shader?

All the Stage3D examples I've seen create a projection matrix of the model representation in AS3 for each rendering event. eg:

modelMatrix.identity();
// Create model matrix here
modelMatrix.translate/rotate/scale
...
modelViewProjectionMatrix.identity();
modelViewProjectionMatrix.append( modelMatrix );
modelViewProjectionMatrix.append( viewMatrix );
modelViewProjectionMatrix.append( projectionMatrix );
// Model view projection matrix to vertex constant register 0
context3D.setProgramConstantsFromMatrix( Context3DProgramType.VERTEX, 0, modelViewProjectionMatrix, true );
...

And one line in the vertex shader converts the vertex into screen space:

m44 op, va0, vc0

Is there a reason for this? Are these calculations not designed for what the GPU was created for?

Why not instead update the matrix of vision and projection when they change and upload each into separate registers:

// Projection matrix to vertex constant register 0
// This could be done once on initialization or when the projection matrix changes
context3D.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, projectionMatrix, true);
// View matrix to vertex constant register 4
context3D.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 4, viewMatrix, true);

Then on each frame and for each object:

modelMatrix.identity();
// Create model matrix here
modelMatrix.translate/rotate/scale
...
// Model matrix to vertex constant register 8
context3D.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 8, modelMatrix, true);
...

And instead, the shader will look like this:

// Perform model view projection transformation and store the results in temporary register 0 (vt0)
// - Multiply vertex position by model matrix (vc8)
m44 vt0 va0 vc8
// - Multiply vertex position by view matrix (vc4)
m44 vt0 vt0 vc4
// - Multiply vertex position by projection matrix (vc0) and write the result to the output register
m44 op vt0 vc0

UPDATE

, , , :
DirectX - GPU CPU

+5
2

. , : ? , :

  • AS3 , .
  • .
  • , !
  • - ? , ?

. . : - > - > , OpenGL. molehill GPU . , , .

tl/dr: , !

+1

, , ,

AS3 .

:

, , .

+1

All Articles