1 # Generic invalid cases that don't fall into other categories 2 3 group c_cast "C-style casts" 4 5 case float_0 6 expect compile_fail 7 version 300 es 8 both "" 9 #version 300 es 10 precision highp float; 11 ${DECLARATIONS} 12 void main () 13 { 14 float a = 0.0; 15 float b = (float)a; 16 ${POSITION_FRAG_COLOR} = vec4(0.0); 17 } 18 "" 19 end 20 21 case float_1 22 expect compile_fail 23 version 300 es 24 both "" 25 #version 300 es 26 precision highp float; 27 ${DECLARATIONS} 28 void main () 29 { 30 int a = 0; 31 float b = (float)a; 32 ${POSITION_FRAG_COLOR} = vec4(b); 33 } 34 "" 35 end 36 37 case float_2 38 expect compile_fail 39 version 300 es 40 both "" 41 #version 300 es 42 ${DECLARATIONS} 43 void main () 44 { 45 highp float a = 0.0; 46 mediump float b = (mediump float)a; 47 ${POSITION_FRAG_COLOR} = vec4(0.0); 48 } 49 "" 50 end 51 52 case int 53 expect compile_fail 54 version 300 es 55 both "" 56 #version 300 es 57 precision highp float; 58 ${DECLARATIONS} 59 void main () 60 { 61 float a = 0.0; 62 int b = (int)a; 63 ${POSITION_FRAG_COLOR} = vec4(0.0); 64 } 65 "" 66 end 67 68 case uint 69 expect compile_fail 70 version 300 es 71 both "" 72 #version 300 es 73 precision highp float; 74 ${DECLARATIONS} 75 void main () 76 { 77 float a = 0.0; 78 uint b = (uint)a; 79 ${POSITION_FRAG_COLOR} = vec4(0.0); 80 } 81 "" 82 end 83 84 case bool 85 expect compile_fail 86 version 300 es 87 both "" 88 #version 300 es 89 precision highp float; 90 ${DECLARATIONS} 91 void main () 92 { 93 int a = 1; 94 bool b = (bool)a; 95 ${POSITION_FRAG_COLOR} = vec4(0.0); 96 } 97 "" 98 end 99 100 end # casts 101