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

Thread: GLSL Compilers

  1. #1
    Member Regular Contributor
    Join Date
    Jun 2012
    Posts
    282

    GLSL Compilers

    If we have varyings which are being assigned value by some calculation in VS and are being passed to FS, but not used in FS, does the optimization pass takes care of it? Or it assigns the memory and performs the interpolation too?

    Is it specific to GPU? how about Mali and Adreno?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,526
    It is likely that unnecessary code will be eliminated, and (unless you're using separable programs) the determination will be made for the program as a whole, not just individual shaders. But it's not required; 7.3.1 of the OpenGL 4.5 specification says:

    Resources referenced in shader code are considered active unless the compiler and linker can conclusively determine that they have no observable effect on the results produced by the executable code of the program. For example, variables might be considered inactive if they are declared but not used in executable code, used only in a clause of an if statement that would never be executed, used only in functions that are never called, or used only in computations of temporary variables having no effect on any shader output. In cases where the compiler or linker cannot make a conclusive determination, any resource referenced by shader code will be considered active. The set of active resources for any interface is implementation-dependent because it depends on various analysis and optimizations performed by the compiler and linker.

  3. #3
    Member Regular Contributor
    Join Date
    Jul 2012
    Posts
    429
    I guess that, in order to ensure this, you can follow the steps given in this thread.
    You'll have to understand the output assembly however and as stated in the thread, outputs will be dependent on the driver.

    On AMD devices, you can try this tool.

Posting Permissions

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