1group if "If Statements" 2 3 case single_statement 4 version 310 es 5 values 6 { 7 input float in0 = [ 0.0 | 1.0 | 2.0 ]; 8 output float out0 = [ 0.0 | 1.0 | 1.0 ]; 9 } 10 11 both "" 12 #version 310 es 13 precision mediump float; 14 ${DECLARATIONS} 15 void main() 16 { 17 out0 = 0.0; 18 if (in0 >= 1.0) 19 out0 = 1.0; 20 ${OUTPUT} 21 } 22 "" 23 end 24 25 case compound_statement 26 version 310 es 27 values 28 { 29 input float in0 = [ 0.0 | 1.0 | 2.0 ]; 30 output float out0 = [ 0.0 | 1.0 | 1.0 ]; 31 output float out1 = [ 1.0 | 0.0 | 0.0 ]; 32 } 33 34 both "" 35 #version 310 es 36 precision mediump float; 37 ${DECLARATIONS} 38 void main() 39 { 40 out0 = 0.0; 41 out1 = 1.0; 42 if (in0 >= 1.0) 43 { 44 out0 = 1.0; 45 out1 = 0.0; 46 } 47 ${OUTPUT} 48 } 49 "" 50 end 51 52 case sequence_statements 53 version 310 es 54 values 55 { 56 input float in0 = [ 0.0 | 1.0 | 2.0 ]; 57 output float out0 = [ 0.0 | 1.0 | 1.0 ]; 58 output float out1 = [ 1.0 | 0.0 | 0.0 ]; 59 } 60 61 both "" 62 #version 310 es 63 precision mediump float; 64 ${DECLARATIONS} 65 void main() 66 { 67 out0 = 0.0; 68 out1 = 1.0; 69 if (in0 >= 1.0) 70 out0 = 1.0, out1 = 0.0; 71 ${OUTPUT} 72 } 73 "" 74 end 75 76 case sequence_condition 77 version 310 es 78 values 79 { 80 input float in0 = [ 0.0 | 1.0 | 2.0 ]; 81 output float out0 = [ 0.0 | 1.0 | 1.0 ]; 82 output float out1 = [ 1.0 | 0.0 | 0.0 ]; 83 } 84 85 both "" 86 #version 310 es 87 precision mediump float; 88 ${DECLARATIONS} 89 void main() 90 { 91 out0 = 0.0; 92 out1 = 1.0; 93 if (false, in0 >= 1.0) 94 out0 = 1.0, out1 = 0.0; 95 ${OUTPUT} 96 } 97 "" 98 end 99 100 case complex_condition 101 version 310 es 102 values 103 { 104 input float in0 = [ 0.0 | 1.0 | 2.0 ]; 105 output float out0 = [ 0.0 | 1.0 | 1.0 ]; 106 output float out1 = [ 1.0 | 0.0 | 0.0 ]; 107 } 108 109 both "" 110 #version 310 es 111 precision mediump float; 112 ${DECLARATIONS} 113 void main() 114 { 115 out0 = 0.0; 116 out1 = 1.0; 117 if (false || (in0 >= 1.0) && (in0 - 2.0*in0 < 0.0)) 118 out0 = 1.0, out1 = 0.0; 119 ${OUTPUT} 120 } 121 "" 122 end 123 124 case if_else 125 version 310 es 126 values 127 { 128 input float in0 = [ 0.0 | 1.0 | 2.0 ]; 129 output float out0 = [ 0.0 | 1.0 | 1.0 ]; 130 } 131 132 both "" 133 #version 310 es 134 precision mediump float; 135 ${DECLARATIONS} 136 void main() 137 { 138 if (in0 >= 1.0) 139 out0 = 1.0; 140 else 141 out0 = 0.0; 142 ${OUTPUT} 143 } 144 "" 145 end 146 147 case if_elseif 148 version 310 es 149 values 150 { 151 input float in0 = [ 0.0 | 1.0 | 2.0 ]; 152 output float out0 = [ 0.0 | 1.0 | 2.0 ]; 153 } 154 155 both "" 156 #version 310 es 157 precision mediump float; 158 ${DECLARATIONS} 159 void main() 160 { 161 out0 = 0.0; 162 if (in0 >= 2.0) 163 out0 = 2.0; 164 else if (in0 >= 1.0) 165 out0 = 1.0; 166 ${OUTPUT} 167 } 168 "" 169 end 170 171 case if_elseif_else 172 version 310 es 173 values 174 { 175 input float in0 = [ 0.0 | 1.0 | 2.0 ]; 176 output float out0 = [ 0.0 | 1.0 | 2.0 ]; 177 } 178 179 both "" 180 #version 310 es 181 precision mediump float; 182 ${DECLARATIONS} 183 void main() 184 { 185 if (in0 >= 2.0) 186 out0 = 2.0; 187 else if (in0 >= 1.0) 188 out0 = 1.0; 189 else 190 out0 = 0.0; 191 ${OUTPUT} 192 } 193 "" 194 end 195 196 case mixed_if_elseif_else 197 version 310 es 198 values 199 { 200 input float in0 = [ 0.0 | 1.0 | 2.0 ]; 201 output float out0 = [ 0.0 | 1.0 | 2.0 ]; 202 } 203 204 both "" 205 #version 310 es 206 precision mediump float; 207 ${DECLARATIONS} 208 void main() 209 { 210 if (in0 >= 2.0) 211 { 212 out0 = 2.0; 213 } 214 else if (in0 >= 1.0) 215 out0 = 2.0, out0 = 1.0; 216 else 217 out0 = 0.0; 218 ${OUTPUT} 219 } 220 "" 221 end 222 223end # if 224