Results 1 to 8 of 8

Thread: Is this Assembly Language ?

  1. #1
    Member Contributor
    Join Date
    Mar 2011
    Posts
    86

    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\n"
    "OPTION ARB_fragment_program_shadow;\n"
    "TEMP R0;\n"
    "TEX R0.x, fragment.position, texture[0], SHADOWRECT;\n"
    "ADD R0.x, R0.x, -0.5;\n"
    "KIL R0.x;\n"
    "MOV result.color, fragment.color;\n"
    "END\n";

  2. #2
    Senior Member Regular Contributor
    Join Date
    Apr 2009
    Posts
    268

    Re: Is this Assembly Language ?

    Quote Originally Posted by apapaxionga
    Do any document can help me learn this kind of assembly Language?
    Here you go:
    http://www.opengl.org/registry/specs...nt_program.txt

  3. #3
    Member Contributor
    Join Date
    Mar 2011
    Posts
    86

    Re: Is this Assembly Language ?

    what should the assembly language code looks like using glsl?

  4. #4
    Member Contributor
    Join Date
    Mar 2011
    Posts
    86

    Re: Is this Assembly Language ?

    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;\n"?
    can someone explain this to me ?

  5. #5
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,676

    Re: Is this Assembly Language ?

    "TEX R0.x, fragment.position, texture[0], SHADOWRECT;\n"
    This isn't that hard to work out.

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

    Code :
    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:

    Code :
    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.

  6. #6
    Member Contributor
    Join Date
    Mar 2011
    Posts
    86

    Re: Is this Assembly Language ?


    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?

  7. #7
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,676

    Re: Is this Assembly Language ?

    You mean that the first argument of the "TEX" instruction is the texture coordinate.
    Where did I say that?

    Code :
    INSTRUCTION OUTPUT, PARAM1, PARAM2, ...;

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

  8. #8
    Member Contributor
    Join Date
    Mar 2011
    Posts
    86

    Re: Is this Assembly Language ?

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

Similar Threads

  1. ARB 'assembly'
    By lukus in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 10-26-2011, 09:25 PM
  2. assembly: is it worth it
    By ugluk in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-10-2010, 07:28 PM
  3. primary interop assembly
    By scottdennis in forum COLLADA
    Replies: 1
    Last Post: 09-09-2009, 01:49 PM
  4. assembly shading language
    By wiesl303 in forum OpenGL: GLSL
    Replies: 1
    Last Post: 11-17-2004, 09:05 AM
  5. Good old assembly:)
    By M/\dm/\n in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-18-2003, 07:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean