OLD | NEW |
(Empty) | |
| 1 |
| 2 /* |
| 3 ** Copyright (c) 2012 The Khronos Group Inc. |
| 4 ** |
| 5 ** Permission is hereby granted, free of charge, to any person obtaining a |
| 6 ** copy of this software and/or associated documentation files (the |
| 7 ** "Materials"), to deal in the Materials without restriction, including |
| 8 ** without limitation the rights to use, copy, modify, merge, publish, |
| 9 ** distribute, sublicense, and/or sell copies of the Materials, and to |
| 10 ** permit persons to whom the Materials are furnished to do so, subject to |
| 11 ** the following conditions: |
| 12 ** |
| 13 ** The above copyright notice and this permission notice shall be included |
| 14 ** in all copies or substantial portions of the Materials. |
| 15 ** |
| 16 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 19 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 20 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 21 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 22 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
| 23 */ |
| 24 |
| 25 |
| 26 attribute vec4 gtf_Vertex; |
| 27 uniform mat4 gtf_ModelViewProjectionMatrix; |
| 28 varying vec4 color; |
| 29 |
| 30 |
| 31 |
| 32 struct sabcd |
| 33 { |
| 34 float a; |
| 35 float b; |
| 36 float c; |
| 37 float d; |
| 38 }; |
| 39 |
| 40 |
| 41 |
| 42 sabcd qualifiers(in sabcd a, out sabcd b, inout sabcd c, const in sabcd d, |
| 43 sabcd e) |
| 44 { |
| 45 sabcd one = sabcd(1.0, 1.0, 1.0, 1.0); |
| 46 |
| 47 b = a; |
| 48 |
| 49 c.a += d.a; |
| 50 c.b += d.b; |
| 51 c.c += d.c; |
| 52 c.d += d.d; |
| 53 |
| 54 a.a += one.a; |
| 55 a.b += one.b; |
| 56 a.c += one.c; |
| 57 a.d += one.d; |
| 58 |
| 59 return e; |
| 60 } |
| 61 |
| 62 void main (void) |
| 63 { |
| 64 sabcd a = sabcd(1.0, 1.0, 1.0, 1.0); |
| 65 sabcd b = sabcd(2.0, 2.0, 2.0, 2.0); |
| 66 sabcd c = sabcd(3.0, 3.0, 3.0, 3.0); |
| 67 sabcd d = sabcd(4.0, 4.0, 4.0, 4.0); |
| 68 sabcd e = sabcd(1.0, 1.0, 1.0, 1.0); |
| 69 sabcd f = sabcd(0.0, 0.0, 0.0, 0.0); |
| 70 sabcd one = sabcd(1.0, 1.0, 1.0, 1.0); |
| 71 sabcd four = sabcd(4.0, 4.0, 4.0, 4.0); |
| 72 sabcd seven = sabcd(7.0, 7.0, 7.0, 7.0); |
| 73 float q = 0.0; |
| 74 float q2 = 0.0; |
| 75 |
| 76 f = qualifiers(a, b, c, d, e); |
| 77 |
| 78 if(a == one) q += 1.0; |
| 79 if(b == one) q += 2.0; |
| 80 if(c == seven) q += 4.0; |
| 81 if(d == four) q2 += 1.0; |
| 82 if(e == one) q2 += 2.0; |
| 83 if(f == one) q2 += 4.0; |
| 84 |
| 85 color = vec4(vec2(q / 7.0, q2 / 7.0), 1.0, 1.0); |
| 86 gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex; |
| 87 } |
OLD | NEW |