1case per_patch_array_of_structs 2 version 310 es 3 desc "per-patch variable type is array of structs" 4 expect compile_or_link_fail 5 require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation } 6 vertex "" 7 #version 310 es 8 ${VERTEX_DECLARATIONS} 9 void main() 10 { 11 ${VERTEX_OUTPUT} 12 } 13 "" 14 tessellation_control "" 15 #version 310 es 16 ${TESSELLATION_CONTROL_DECLARATIONS} 17 struct S 18 { 19 highp float a; 20 highp vec2 b; 21 }; 22 patch out S patchVariable[2]; // array of structures is illegal 23 void main() 24 { 25 patchVariable[0].a = gl_in[0].gl_Position.x; 26 patchVariable[0].b = gl_in[0].gl_Position.yz; 27 patchVariable[1].a = gl_in[0].gl_Position.z; 28 patchVariable[1].b = gl_in[0].gl_Position.wx; 29 ${TESSELLATION_CONTROL_OUTPUT} 30 } 31 "" 32 tessellation_evaluation "" 33 #version 310 es 34 ${TESSELLATION_EVALUATION_DECLARATIONS} 35 struct S 36 { 37 highp float a; 38 highp vec2 b; 39 }; 40 patch in S patchVariable[2]; // array of structures is illegal 41 out mediump float te_out; 42 void main() 43 { 44 te_out = patchVariable[0].a + patchVariable[1].b.y; 45 ${TESSELLATION_EVALUATION_OUTPUT} 46 } 47 "" 48 fragment "" 49 #version 310 es 50 precision mediump float; 51 ${FRAGMENT_DECLARATIONS} 52 in mediump float te_out; 53 void main() 54 { 55 ${FRAG_COLOR} = vec4(te_out); 56 } 57 "" 58end 59 60case per_patch_structs_containing_arrays 61 version 310 es 62 desc "per-patch variable type is struct containing array" 63 expect compile_or_link_fail 64 require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation } 65 vertex "" 66 #version 310 es 67 ${VERTEX_DECLARATIONS} 68 void main() 69 { 70 ${VERTEX_OUTPUT} 71 } 72 "" 73 tessellation_control "" 74 #version 310 es 75 ${TESSELLATION_CONTROL_DECLARATIONS} 76 struct S 77 { 78 highp float a; 79 highp float b[2]; 80 }; 81 patch out S patchVariable; // output structure containing array is illegal 82 void main() 83 { 84 patchVariable.a = gl_in[0].gl_Position.x; 85 patchVariable.b[0] = gl_in[0].gl_Position.y; 86 patchVariable.b[1] = gl_in[0].gl_Position.w; 87 ${TESSELLATION_CONTROL_OUTPUT} 88 } 89 "" 90 tessellation_evaluation "" 91 #version 310 es 92 ${TESSELLATION_EVALUATION_DECLARATIONS} 93 struct S 94 { 95 highp float a; 96 highp float b[2]; 97 }; 98 patch in S patchVariable; // output structure containing array is illegal 99 out mediump float te_out; 100 void main() 101 { 102 te_out = patchVariable.a + patchVariable.b[1]; 103 ${TESSELLATION_EVALUATION_OUTPUT} 104 } 105 "" 106 fragment "" 107 #version 310 es 108 precision mediump float; 109 ${FRAGMENT_DECLARATIONS} 110 in mediump float te_out; 111 void main() 112 { 113 ${FRAG_COLOR} = vec4(te_out); 114 } 115 "" 116end 117 118case per_vertex_incorrect_control_explicit_output_array_size_2 119 version 310 es 120 desc "Incorrectly sized tessellation control output array" 121 expect compile_or_link_fail 122 require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation } 123 vertex "" 124 #version 310 es 125 ${VERTEX_DECLARATIONS} 126 void main() 127 { 128 ${VERTEX_OUTPUT} 129 } 130 "" 131 tessellation_control "" 132 #version 310 es 133 ${TESSELLATION_CONTROL_DECLARATIONS} 134 out highp float varyingArray[gl_MaxPatchVertices]; // size does not match layout declaration 135 void main() 136 { 137 varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID]; 138 ${TESSELLATION_CONTROL_OUTPUT} 139 } 140 "" 141 tessellation_evaluation "" 142 #version 310 es 143 ${TESSELLATION_EVALUATION_DECLARATIONS} 144 in highp float varyingArray[gl_MaxPatchVertices]; // size is correct 145 out mediump float te_out; 146 void main() 147 { 148 te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2]; 149 ${TESSELLATION_EVALUATION_OUTPUT} 150 } 151 "" 152 fragment "" 153 #version 310 es 154 precision mediump float; 155 ${FRAGMENT_DECLARATIONS} 156 in mediump float te_out; 157 void main() 158 { 159 ${FRAG_COLOR} = vec4(te_out); 160 } 161 "" 162end 163 164case per_vertex_incorrect_control_explicit_output_array_size_3 165 version 310 es 166 desc "Incorrectly sized tessellation control output array" 167 expect compile_or_link_fail 168 require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation } 169 vertex "" 170 #version 310 es 171 ${VERTEX_DECLARATIONS} 172 void main() 173 { 174 ${VERTEX_OUTPUT} 175 } 176 "" 177 tessellation_control "" 178 #version 310 es 179 ${TESSELLATION_CONTROL_DECLARATIONS} 180 out highp float varyingArray[${GL_MAX_PATCH_VERTICES}]; // size does not match layout declaration 181 void main() 182 { 183 varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID]; 184 ${TESSELLATION_CONTROL_OUTPUT} 185 } 186 "" 187 tessellation_evaluation "" 188 #version 310 es 189 ${TESSELLATION_EVALUATION_DECLARATIONS} 190 in highp float varyingArray[gl_MaxPatchVertices]; // size is correct 191 out mediump float te_out; 192 void main() 193 { 194 te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2]; 195 ${TESSELLATION_EVALUATION_OUTPUT} 196 } 197 "" 198 fragment "" 199 #version 310 es 200 precision mediump float; 201 ${FRAGMENT_DECLARATIONS} 202 in mediump float te_out; 203 void main() 204 { 205 ${FRAG_COLOR} = vec4(te_out); 206 } 207 "" 208end 209 210case per_vertex_incorrect_eval_explicit_input_array_size 211 version 310 es 212 desc "Incorrectly sized tessellation control output array" 213 expect compile_or_link_fail 214 require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation } 215 vertex "" 216 #version 310 es 217 ${VERTEX_DECLARATIONS} 218 void main() 219 { 220 ${VERTEX_OUTPUT} 221 } 222 "" 223 tessellation_control "" 224 #version 310 es 225 ${TESSELLATION_CONTROL_DECLARATIONS} 226 out highp float varyingArray[]; 227 void main() 228 { 229 varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID]; 230 ${TESSELLATION_CONTROL_OUTPUT} 231 } 232 "" 233 tessellation_evaluation "" 234 #version 310 es 235 ${TESSELLATION_EVALUATION_DECLARATIONS} 236 in highp float varyingArray[3]; // size is not equal to gl_MaxPatchVertices 237 out mediump float te_out; 238 void main() 239 { 240 te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2]; 241 ${TESSELLATION_EVALUATION_OUTPUT} 242 } 243 "" 244 fragment "" 245 #version 310 es 246 precision mediump float; 247 ${FRAGMENT_DECLARATIONS} 248 in mediump float te_out; 249 void main() 250 { 251 ${FRAG_COLOR} = vec4(te_out); 252 } 253 "" 254end 255