AGAL (Adobe Graphics Assembly Language) 记录
来源:互联网 发布:painter mac 编辑:程序博客网 时间:2024/05/21 07:09
《Adobe图形汇编语言》
来自官方参考文档,记录一下,方便查看..
———————
Program bytecode can be created using the Pixel Bender 3D offline tools. It can also be created dynamically. This specification describes the raw bytecode format.
The input ByteArrays are in Endian.LITTLE_ENDIAN format.
TypeDescription
int88 bit little endian integer
int1616 bit little endian integer
int3232 bit little endian integer
Header: Bytecode always begins with this 7 byte header:
Offset(Bytes)Size(Bytes)NameDescription
01magicmust be 0xa0
14versionmust be 1
51shadertypeidmust be 0xa1
61shadertypeeither 0 for vertex or 1 for fragment programs
Tokens: The header is immediately followed by any number of tokens. Every
token is 192bits (24 bytes) in size and always has the format:
[opcode][destination][source1][source2 or sampler]
[操作码] [目标] [source1] [source2或采样器]
Unused fields must be set to 0.
[opcode]
The [opcode] field is 32 bits in size and can take one of these values:
Name Value Description
名称 值 说明
mov 0x00 move move data from source1 to destination, componentwise
add 0x01 add destination = source1 + source2, componentwise
sub 0x02 subtract destination = source1 - source2, componentwise
mul 0x03 multiply destination = source1 * source2, componentwise
div 0x04 divide destination = source1 / source2, componentwise
rcp 0x05 reciprocal destination = 1/source1, componentwise
min 0x06 minimum destination = minimum(source1,source2), componentwise
max 0x07 maximum destination = maximum(source1,source2), componentwise
frc 0x08 fractional destination = source1 - (float)floor(source1), componentwise
sqt 0x09 square root destination = sqrt(source1), componentwise
rsq 0x0a recip. root destination = 1/sqrt(source1), componentwise
pow 0x0b power destination = pow(source1,source2), componentwise
log 0x0c logarithm destination = log_2(source1), componentwise
exp 0x0d exponential destination = 2^source1, componentwise
nrm 0x0e normalize destination = normalize(source1), componentwise
sin 0x0f sine destination = sin(source1), componentwise
cos 0x10 cosine destination = cos(source1), componentwise
crs 0x11 cross product destination.x = source1.y * source2.z - source1.z * source2.y
destination.y = source1.z * source2.x - source1.x * source2.z
destination.z = source1.x * source2.y - source1.y * source2.x
dp3 0x12 dot product destination = source1.x*source2.x + source1.y*source2.y + source1.z*source2.z
dp4 0x13 dot product destination = source1.x*source2.x + source1.y*source2.y + source1.z*source2.z + source1.w*source2.w
abs 0x14 absolute destination = abs(source1), componentwise
neg 0x15 negate destination = -source1, componentwise
sat 0x16 saturate destination = maximum(minimum(source1,1),0), componentwise
m33 0x17 multiply destination.x = (source1.x * source2[0].x) + (source1.y * source2[0].y) + (source1.z * source2[0].z)
matrix 3x3 destination.y = (source1.x * source2[1].x) + (source1.y * source2[1].y) + (source1.z * source2[1].z)
destination.z = (source1.x * source2[2].x) + (source1.y * source2[2].y) + (source1.z * source2[2].z)
m44 0x18 multiply destination.x = (source1.x * source2[0].x) + (source1.y * source2[0].y) + (source1.z * source2[0].z) + (source1.w * source2[0].w)
matrix 4x4 destination.y = (source1.x * source2[1].x) + (source1.y * source2[1].y) + (source1.z * source2[1].z) + (source1.w * source2[1].w)
destination.z = (source1.x * source2[2].x) + (source1.y * source2[2].y) + (source1.z * source2[2].z) + (source1.w * source2[2].w)
destination.w = (source1.x * source2[3].x) + (source1.y * source2[3].y) + (source1.z * source2[3].z) + (source1.w * source2[3].w)
m34 0x19 multiply destination.x = (source1.x * source2[0].x) + (source1.y * source2[0].y) + (source1.z * source2[0].z) + (source1.w * source2[0].w)
matrix 3x4 destination.y = (source1.x * source2[1].x) + (source1.y * source2[1].y) + (source1.z * source2[1].z) + (source1.w * source2[1].w)
destination.z = (source1.x * source2[2].x) + (source1.y * source2[2].y) + (source1.z * source2[2].z) + (source1.w * source2[2].w)
kil 0x27 kill / discard (fragment shader only)
If single scalar source component is less than zero, fragment is discarded and not drawn to the frame buffer.
The destination register must be all 0.
tex 0x28 texture sample (fragment shader only)
destination = load from texture source2 at coordinates source1. In this source2 must be in sampler format.
sge 0x29 set-if-greater-equal
destination = source1 >= source2 ? 1 : 0, componentwise
slt 0x2a set-if-less-than
destination = source1 < source2 ? 1 : 0, componentwise
[destination]
The [destination] field is 32 bits in size:
31………………………..0
—-TTTT—-MMMMNNNNNNNNNNNNNNNN
T = Register type (4 bits)
M = Write mask (4 bits)
N = Register number (16 bits)
- = undefined, must be 0
[source]
The [source] field is 64 bits in size:
63…………………………………………………….0
D————-QQ—-IIII—-TTTTSSSSSSSSOOOOOOOONNNNNNNNNNNNNNNN
D = Direct=0/Indirect=1 for direct Q and I are ignored, 1bit (currently only direct allowed)
Q = Index register component select (2 bits)
I = Index register type (4 bits)
T = Register type (4 bits)
S = Swizzle (8bits, 2bits per component)
O = Indirect offset (8bits)
N = Register number (16 bits)
- = undefined, must be 0
[sampler]
The second source of the tex opcode must be in [sampler] format:
63…………………………………………………….0
FFFFMMMMWWWWSSSSDDDD——–TTTT—————-NNNNNNNNNNNNNNNN
N = Sampler index (16 bits)
T = Register type, must be 5, Sampler
F = Filter (0=nearest,1=linear) (4bits)
M = Mipmap (0=disable,1=nearest,2=linear)
W = Wrapping (0=clamp,1=repeat)
S = Special flag bits (must be 0)
D = Dimension (0=2D,1=Cube)
The following register types are available:
Name Value Count/Fragment Count/Vertex Usage
Attribute 0 n/a 8 input using Context3D::setVertexBufferAt
Constant 1 28 128 input using Context3D::setProgramConstants family of functions
Temporary 2 8 8 temporary for computation, not visible outside program
Output 3 1 1 vertex: clipspace position, fragment: color
Varying 4 8 8 output from vertex, input to fragment, transfer interpolated data
Sampler 5 8 n/a read texture, set using Context3D::setTextureAt
- AGAL (Adobe Graphics Assembly Language) 记录
- assembly language
- assembly language
- AGAL 的学习记录
- 我叫AGAL,来自Adobe 【Part1】
- 我叫AGAL,来自Adobe 【Part2】
- Assembly Language Reference
- Assembly language experiment----Encryption
- x86 Assembly Language
- Professional Assembly Language
- Professional.Assembly.Language
- Assembly language Start
- begin assembly language
- 汇编语言Assembly Language
- 什么是 .NET Assembly language?
- arm assembly language
- assembly language programm--HelloWorld
- New job,Assembly Language
- hdu 3521
- 解决png图片在IE6中不能透明
- iphone开发中使用动态库(dylib)和动态加载framework (获取iphone的IMSI和设置飞行模式)
- jQuery插件的开发
- iphone开发之单元测试SenTestCase
- AGAL (Adobe Graphics Assembly Language) 记录
- 关于 using namespace std
- 判断 iPhone 是否已插入 SIM 卡的方法
- 幽默牛逼的情侣吵架
- 第八章:标准IO库
- CreateProcess
- 全排列的递归实现方法
- 多线程与多进程
- 黑马程序员Java培训、Android培训-Java 学习过程记录_面向对象上