"TEX R0.x, fragment.position, texture, 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 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.
TEX R0.x, fragment.position, texture, 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