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 Performance vs Maintainability

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2015
    Location
    United Kingdom, Middlesbrough
    Posts
    9

    Post GLSL Performance vs Maintainability

    Hello, so I've been going back and forth between many shader files and constantly have to change, tweak and remove parameters in that order.

    I've already modified my parser to allow #include support so common functionality can be in one file which is just great but wondered if I'd get a performance hit by doing the same to my uniform (UBO's) because it would mean that some shader files will include UBO's it never uses?

    Furthermore, if you have any optimisation tips I'd LOVE to hear them

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    5,932
    Well, if they're std140 UBOs, and they have bindings specified in-shader, then that could cause the implementation to reserve space for them even if they go unused. Then again, maybe not.

    If you want to be more certain about these things, declare structs in your included files, but define the actual UBOs in the sources that use them. So your UBO would just be `layout(...) uniform Name {StructName data;};`, with all of the parameter modifications happening in the structs.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2015
    Location
    United Kingdom, Middlesbrough
    Posts
    9
    Quote Originally Posted by Alfonse Reinheart View Post
    Well, if they're std140 UBOs, and they have bindings specified in-shader, then that could cause the implementation to reserve space for them even if they go unused. Then again, maybe not.

    If you want to be more certain about these things, declare structs in your included files, but define the actual UBOs in the sources that use them. So your UBO would just be `layout(...) uniform Name {StructName data;};`, with all of the parameter modifications happening in the structs.
    Yes I'm using both qualifiers. That's exactly what I was looking for thank you, works like a charm

Tags for this Thread

Posting Permissions

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