Is this Assembly Language ?

i found these code in an example ,it seems that its fouction just like fragment shader.Do any document can help me learn this kind of assembly Language? or can someone tell me the meaning of the fellowing code?

char _fp_peel =
"!!ARBfp1.0
"
"OPTION ARB_fragment_program_shadow;
"
"TEMP R0;
"
"TEX R0.x, fragment.position, texture[0], SHADOWRECT;
"
"ADD R0.x, R0.x, -0.5;
"
"KIL R0.x;
"
"MOV result.color, fragment.color;
"
"END
";

Here you go:
http://www.opengl.org/registry/specs/ARB/fragment_program.txt

what should the assembly language code looks like using glsl?

this assembly code found in the Depth Peeling 2 Demo in the OpenGL SDK, i think these assembly code plays a role in depth peeling .
i do not know why using “TEMP R0” because it seems that R0 have no relation with the result and what is the meaning of "TEX R0.x, fragment.position, texture[0], SHADOWRECT;
"?
can someone explain this to me ?

"TEX R0.x, fragment.position, texture[0], SHADOWRECT;
"

This isn’t that hard to work out.

Assembly, regardless of type or language, generally looks like this:


INSTRUCTION OUTPUT, PARAM1, PARAM2, ...;

The INSTRUCTION here is TEX, which obviously suggests a Texture access.

R0.x is the x component of the R0 variable. That’s what TEMP R0 was for: declaring a temporary variable called R0. ARB assembly isn’t like most assembly languages; you have to declare variables that you use (unless they’re built in).

Texture accessing needs 2 things, regardless of language: a texture unit and a texture coordinate.

fragment.position is obvious based on the name, though it is built-in which is where it can be confusion (it isn’t defined anywhere). That’s the position of the fragment in window-space. The first argument of the TEX instruction is the texture coordinate.

texture[0] is the texture unit to access from. Namely, texture unit 0.

SHADOWRECT is a description of what kind of access to do. Basically, it’s like the GLSL sampler. SHADOW means depth comparison. RECT means a rectangle texture.

Therefore:


TEX R0.x, fragment.position, texture[0], SHADOWRECT;

does a shadow texture access from a rectangle texture, stored in texture unit 0, from the current fragment position, and the value is stored in the temporary variable R0’s x component.

First of all,Thank you for your reply .
You mean that the first argument of the “TEX” instruction is the texture coordinate. However R0.x is just a float variable, Can it be the texture coordinate to access the texture? You said in the end" R0 keeps the depth map’s value ", i do not understand it very well, what is R0’s really role? texcoord or float variable to keep depth?

You mean that the first argument of the “TEX” instruction is the texture coordinate.

Where did I say that?


INSTRUCTION OUTPUT, PARAM1, PARAM2, ...;

The OUTPUT is almost always the first argument in assembly languages.

Thank you very much ,i have learned this kind of assembly language in Shader Assembly Language (ARB/NV) Quick Reference Guide for OpenGL®