Malcolm Bechard | 0b66fa3 | 2020-04-02 04:03:53 -0400 | [diff] [blame] | 1 | #version 430 |
| 2 | |
| 3 | layout (triangles) in; |
| 4 | layout (triangle_strip, max_vertices = 3) out; |
| 5 | |
| 6 | // OK: different instance names is allowed |
| 7 | layout (std140, binding = 0) uniform MatrixBlock |
| 8 | { |
| 9 | mat4 uProj; |
| 10 | mat4 uWorld; |
| 11 | } uM; |
| 12 | |
| 13 | // Verify that in/out blocks with same block name work |
| 14 | in Vertex |
| 15 | { |
| 16 | vec4 v1; |
| 17 | vec4 v2; |
| 18 | } iV[3]; |
| 19 | |
| 20 | out Vertex |
| 21 | { |
| 22 | vec4 val1; |
| 23 | } oV; |
| 24 | |
| 25 | // OK: different instance names is allowed |
| 26 | layout (std140, binding = 1) uniform ColorBlock |
| 27 | { |
| 28 | vec4 color1; |
| 29 | bool b; |
| 30 | vec4 color2; |
| 31 | vec4 color3; |
| 32 | } uC; |
| 33 | |
| 34 | // OK: different instance names is allowed |
| 35 | layout (std430, binding = 1) buffer BufferBlock |
| 36 | { |
| 37 | mat4 p; |
| 38 | } uBuf; |
| 39 | |
| 40 | vec4 getWorld(int i); |
| 41 | vec4 getColor2(); |
| 42 | |
| 43 | out vec4 oColor; |
| 44 | |
| 45 | float globalF; |
| 46 | |
| 47 | void |
| 48 | main() |
| 49 | { |
| 50 | oColor = uC.color1 * getColor2(); |
| 51 | |
| 52 | globalF = 1.0; |
| 53 | |
| 54 | for (int i = 0; i < 3; i++) |
| 55 | { |
| 56 | gl_Position = uM.uProj * getWorld(i); |
| 57 | oV.val1 = uC.color1 + iV[i].v2 * globalF; |
| 58 | EmitVertex(); |
| 59 | } |
| 60 | |
| 61 | EndPrimitive(); |
| 62 | } |