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

Thread: GLSL initialized uniform block members

Threaded View

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2013
    Posts
    3

    GLSL initialized uniform block members

    Prerequisite - My terminology may be slightly off or bad, please excuse and correct me where ever necessary. Please also excuse that this is my first post. I have often lurked these forums and haven't made an account until recently.

    Proposal
    I propose that uniforms inside uniform blocks may be initialized by other block members. These initialized uniform block members don't take up user accesses memory (you can't issue a command to change them directly.)

    Example
    Code :
    uniform MatricesUniformBlock {
    	mat4 ModelMatrix;
    	mat4 ViewMatrix;
    	mat4 ProjectionMatrix;
     
    	mat4 ModelViewMatrix = ViewMatrix * ModelMatrix;
    };

    In the above code ModelViewMatrix's value changes every time ModelMatrix or ViewMatrix is updated. Certain vendor implementations may already kind of do this implicitly when just initializing in the main function[1], but being explicit about the initialization would be nice.

    What do you think? I am aware that you usually just initialize something like ModelViewMatrix on the cpu and pass it to opengl, but this is a different approach which I believe is much more shader flexible.

    [1] - I actually have no idea if they do or if it's a trivial optimization.
    Last edited by saucyio; 09-18-2013 at 03:18 PM.

Posting Permissions

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