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: Copying all data from interface blocks

  1. #1
    Junior Member Regular Contributor
    Join Date
    Aug 2003
    Location
    Toronto, Canada
    Posts
    159

    Copying all data from interface blocks

    Hey, is there an easy way to copy all the data in an interface block from the input to the output? For example lets say in the geometry shader I have

    Code :
    in Vertex {
        vec4 color;
        vec3 camSpaceVert;
        vec3 camVector;
        vec3 norm;
        vec2 texCoord0;
    } vVertIn[];
     
    out Vertex {
        vec4 color;
        vec3 camSpaceVert;
        vec3 camVector;
        vec3 norm;
        vec2 texCoord0;
    } vVertOut;


    The geometry shader is only changing the gl_Position values (and doing layered rendering) so all of the input data just needs to be copied for every vertex. Is there a way to do the full copy implicitly or do I need to copy each member individually? This becomes cumbersome as members are added/removed from the inputs/outputs.

    This doesn't work:
    Code :
    vVertOut = vVertIn[i];

    Thoughts? Thanks.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    985
    Have you tried putting the list of varyings into a struct and simply declare a struct variable in the in/out blocks? I don't recall whether there is struct assignment support in GLSL, but sure what you tried shouldn't work, even though they look like to be identical as the two interface blocks have different type, thus definitely not assignable.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Junior Member Regular Contributor
    Join Date
    Aug 2003
    Location
    Toronto, Canada
    Posts
    159
    Thanks for the suggestion, you're correct. If I put it in a struct within the interface block is does how. However this extra layer of having to do interface.struct.value makes it pretty ugly also. And I think I'd need to split up the members that have different qualifiers (like noperspective) into different structs, which means it's still a multi-line copy. Guess it's not possible, thank's for the suggestion though.

Posting Permissions

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