Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Problem with #version

  1. #11
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    5

    Re: Problem with #version

    //nvm, got it ... no \n are read with my file read function

  2. #12
    Junior Member Regular Contributor
    Join Date
    Aug 2007
    Posts
    121

    Re: Problem with #version

    Have you considered inverting the matrix on the CPU and passing that as a uniform? If your matrix is not modified per-vertex or per-fragment, this could provide a significant speed gain.

    The GLSL compiler could do this automatically if it detects that only uniforms are used as input to the "invert" function, but I don't know if it does. I am still using GLSL 1.20 so I don't have this function.

  3. #13
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,386

    Re: Problem with #version

    Yep, it's a long shot but it could be he's hinting at the compiler optimization trick that's documented in the DX-files - the so-called "pre-shader": the compiler factors out "batch constant" expressions involving uniforms and hoists them up into their own shader to be run as a sort of "batch preprocess" on the CPU. It's an "effect" thing, but in a perfect world it could probably be a shader thing too. ;-)

  4. #14
    Newbie Newbie
    Join Date
    Dec 2012
    Posts
    1
    What should be done to solve this issue ???

  5. #15
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,106
    Have you considered inverting the matrix on the CPU and passing that as a uniform?
    My experiences with the glsl invert function were not good. It did not seem to give a very accurate invert matrix.

Posting Permissions

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