13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 67: Adobe Graphics Assembly<br />

Language (AGAL)<br />

The Adobe Graphics Assembly Language (AGAL) is a shader language for defining vertex and fragm<strong>en</strong>t r<strong>en</strong>dering<br />

programs. The AGAL programs must be uploaded to the r<strong>en</strong>dering context in the binary bytecode format described<br />

in this docum<strong>en</strong>t.<br />

AGAL bytecode format<br />

AGAL bytecode must use Endian.LITTLE_ENDIAN format.<br />

Bytecode Header<br />

AGAL bytecode must begin with a 7-byte header:<br />

A0000001A100 -- for a vertex program<br />

A0000001A101 -- for a fragm<strong>en</strong>t program<br />

Offset (bytes) Size (bytes) Name Description<br />

0 1 magic must be 0xa0<br />

1 4 version must be 1<br />

5 1 shader type ID must be 0xa1<br />

6 1 shader type 0 for a vertex program; 1 for a fragm<strong>en</strong>t program<br />

Tok<strong>en</strong>s<br />

The header is immediately followed by any number of tok<strong>en</strong>s. Every tok<strong>en</strong> is 192 bits (24 bytes) in size and always has<br />

the format:<br />

[opcode][destination][source1][source2 or sampler]<br />

Not every opcode uses all of these fields. Unused fields must be set to 0.<br />

Operation codes<br />

The [opcode] field is 32 bits in size and can take one of these values:<br />

Name Opcode Operation Description<br />

mov 0x00 move move data from source1 to destination, compon<strong>en</strong>t-wise<br />

add 0x01 add destination = source1 + source2, compon<strong>en</strong>t-wise<br />

sub 0x02 subtract destination = source1 - source2, compon<strong>en</strong>t-wise<br />

mul 0x03 multiply destination = source1 * source2, compon<strong>en</strong>t-wise<br />

div 0x04 divide destination = source1 / source2, compon<strong>en</strong>t-wise<br />

rcp 0x05 reciprocal destination = 1/source1, compon<strong>en</strong>t-wise<br />

Last updated 6/6/2012<br />

1123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!