title: Initializing structures from arrays in GLSL
body: <p>Suppose I have an array variable in a shader, declared in a shader storage block:</p>
  
  <pre><code>layout(std430, binding = 2) buffer MyBuffer
  {
    float lotsOfFloats[];
  };
  </code></pre>
  
  <p>and a struct:</p>
  
  <pre><code>struct myStruct
  {
   float f1;
   vec3 vf1;
  }struct1;
  </code></pre>
  
  <p>Is there a way to "quickly" initialize an object of this structure in a shader using the values in the array in a buffer storage block ( in the lotsOfFloats array in this example)? Say, in C++ one can copy memory from the array to the object:</p>
  
  <pre><code>memcpy(&amp;struct1, &amp;lotsOfFloats[0], sizeof(myStruct) );
  </code></pre>
  
  <p>Or one can byte copy array values to the object through assignment:</p>
  
  <pre><code>struct1 = *(myStruct*)&amp;lotsOfFloats[0];
  </code></pre>
  
  <p>Is there a similar way in GLSL? E.g. will work the second way (byte copy assignment) in GLSL?</p>