View Full Version : Compiled source
05-31-2004, 07:25 AM
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.
05-31-2004, 08:10 AM
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.
05-31-2004, 07:45 PM
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?
06-01-2004, 02:05 AM
@glitch: The NVIDIA implementation allows to export the intermediate assembly code for debug purposes.
@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.
06-01-2004, 04:54 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.