Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: counting instructions

  1. #1
    Junior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    France
    Posts
    134

    counting instructions

    Hello

    Is there a way to know how many instruction a vertex/fragment shader coded in GLSL takes ?

    thanks

  2. #2
    Junior Member Regular Contributor execom_rt's Avatar
    Join Date
    Jul 2000
    Location
    Canada
    Posts
    237

    Re: counting instructions

    - on Windows / Linux nVidia boards, use the Cg toolkit and the command line tool 'Cg.exe' and compile your shader with parameters -entry main -oglsl -D__GLSL_CG_DATA_TYPES -D__GLSL_CG_STDLIB -D__GLSL_SAMPLER_RECT -profile (choose vp40, fp40, arbvp1 etc) .. you will get the instructions count for Geforce, Geforce FX and Geforce 6 series) as well as the assembler output.

    - on MacOSX with ATI and nVidia boards, use OpenGL Shader Builder, there is a panel which shows the intermediate output (GLSL->Compiler->Assembler (using Apple own assembler format). You will get instructions count as well.

    - On Windows with ATI, you need benchmark, there is no official way to get the intermediate output of a shader (AFAIK)

  3. #3
    Junior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    France
    Posts
    134

    Re: counting instructions

    thanks

  4. #4
    Intern Contributor
    Join Date
    Mar 2004
    Posts
    50

    Re: counting instructions

    - on Windows / Linux nVidia boards, use the Cg toolkit and the command line tool 'Cg.exe' and compile your shader with parameters -entry main -oglsl -D__GLSL_CG_DATA_TYPES -D__GLSL_CG_STDLIB -D__GLSL_SAMPLER_RECT -profile (choose vp40, fp40, arbvp1 etc) .. you will get the instructions count for Geforce, Geforce FX and Geforce 6 series) as well as the assembler output.
    Why does one need to define Cg data types and the Cg standard library to compile GLSL code? Are these options (-D__GLSL_CG . . .) documented or published anywhere?

  5. #5
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: counting instructions

    Searched yourself? This is Google's very first hit:
    http://download.nvidia.com/developer...lease%2060.pdf

  6. #6
    Intern Contributor
    Join Date
    Mar 2004
    Posts
    50

    Re: counting instructions

    Ok, that didn't help:
    In future GLSL-enabled drivers, the preprocessor name __GLSL_CG_DATA_TYPES will be defined if these Cg data types are supported to allow . . .
    My real question was:
    Why does one need to define Cg data types and the Cg standard library to compile GLSL code?

  7. #7
    Intern Contributor spasi's Avatar
    Join Date
    Feb 2004
    Location
    Greece
    Posts
    67

    Re: counting instructions

    Originally posted by kingjosh:
    Why does one need to define Cg data types and the Cg standard library to compile GLSL code?
    To take advantage of fixed-point and half data types for better performance on NV hardware. That's my only use of Cg, I haven't had any other need so far.
    spasi
    zDimensions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •