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 5 of 5

Thread: Compiled source

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    Sunnyvale
    Posts
    26

    Compiled source

    Hi,

    Is there a way to get the -compiled- source of a glsl shader? I probably missed the point but i didn't find how to do in the specs.

    thx

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,580

    Re: Compiled source

    The point of glsl is to let each hardware manufacturers compile glsl to native machine code directly, with no asm in-between. The goal is to let them optimize from high level langage to their hardware directly.

    As when you compile a C++ program on a PC and a Mac, it is not C++ to x86 assembly to PPC native code but directly from high level to machine code.

  3. #3
    Junior Member Newbie
    Join Date
    May 2004
    Posts
    3

    Re: Compiled source

    How about a complied code cache sort of thing. Every vendor can have their own assembly just their is a header with identification of vendor + compiler version. So you can precompile code and reuse it but if the vendor ID or the compiler ID are not equal to the current vendor + compiler IDs reported by the drivers you have to recompile and readd to the off-line cache?

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

    Re: Compiled source

    @glitch: The NVIDIA implementation allows to export the intermediate assembly code for debug purposes.
    http://www.opengl.org/discussion_boa...;f=11;t=000023

    @ZbuffeR: Programming language compilers normally go through multiple levels of encodings. Many optimizations are done in an intermediate representation. The result of that will be a machine code representation, which is easier to read in a mnemonic form, so assembly language is used and that's assembled into microcode.
    The pseudo code might be identical among platforms. The assembly will be platform specific.
    Most C compilers have switches to export preprocessor and assembler code. Look up the listing switch /FA in MS Visual C++ for example.

    @bloodbob: This wouldn't be useful at all. The GLSL compiler will take care to optimize the code exactly for the currently running implementation. The result will be different for each hardware and each compiler version.

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Sep 2000
    Location
    SWEDEN
    Posts
    601

    Re: Compiled source

    In the issue list of the glslang spec there is a section that deals with the application geting object code back from the driver. The consensus seems to be that this is an interesting feature probably worth adding, but that the IHVs need more experience implementing glslang to expose it correctly.

    This would be useful since it could potentially save a lot of compilation time by allowing you to do lots of work at install time and/or when the user switches graphics cards instead of at load time.

Posting Permissions

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