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 #ifdef GL_ES |
| 27 precision mediump float; |
| 28 #endif |
| 29 varying vec4 color; |
| 30 |
| 31 |
| 32 |
| 33 void qualifiers(in float a[4], out float b[4], inout float c[4], const in float
d[4], float e[4]) |
| 34 { |
| 35 b[0] = a[0]; |
| 36 c[0] += d[0]; |
| 37 a[0] += 1.0; |
| 38 e[0] += 1.0; |
| 39 |
| 40 b[1] = a[1]; |
| 41 c[1] += d[1]; |
| 42 a[1] += 1.0; |
| 43 e[1] += 1.0; |
| 44 |
| 45 b[2] = a[2]; |
| 46 c[2] += d[2]; |
| 47 a[2] += 1.0; |
| 48 e[2] += 1.0; |
| 49 |
| 50 b[3] = a[3]; |
| 51 c[3] += d[3]; |
| 52 a[3] += 1.0; |
| 53 e[3] += 1.0; |
| 54 } |
| 55 |
| 56 |
| 57 |
| 58 void main (void) |
| 59 { |
| 60 float a[4]; |
| 61 float b[4]; |
| 62 float c[4]; |
| 63 float d[4]; |
| 64 float e[4]; |
| 65 float q = 0.0; |
| 66 float q2 = 0.0; |
| 67 |
| 68 a[0] = 1.0; |
| 69 b[0] = 2.0; |
| 70 c[0] = 3.0; |
| 71 d[0] = 4.0; |
| 72 e[0] = 1.0; |
| 73 |
| 74 a[1] = 1.0; |
| 75 b[1] = 2.0; |
| 76 c[1] = 3.0; |
| 77 d[1] = 4.0; |
| 78 e[1] = 1.0; |
| 79 |
| 80 a[2] = 1.0; |
| 81 b[2] = 2.0; |
| 82 c[2] = 3.0; |
| 83 d[2] = 4.0; |
| 84 e[2] = 1.0; |
| 85 |
| 86 a[3] = 1.0; |
| 87 b[3] = 2.0; |
| 88 c[3] = 3.0; |
| 89 d[3] = 4.0; |
| 90 e[3] = 1.0; |
| 91 |
| 92 qualifiers(a, b, c, d, e); |
| 93 |
| 94 // randomly test a value |
| 95 if(a[0] == 1.0) q += 1.0; |
| 96 if(b[1] == 1.0) q += 2.0; |
| 97 if(c[2] == 7.0) q += 4.0; |
| 98 if(d[3] == 4.0) q2 += 1.0; |
| 99 if(e[0] == 1.0) q2 += 2.0; |
| 100 |
| 101 gl_FragColor = vec4(vec2(q / 7.0, q2 / 3.0), 1.0, 1.0); |
| 102 } |
OLD | NEW |