1# ------------------------------------------------- 2# drawElements Quality Program OpenGL ES 3.2 Module 3# ------------------------------------------------- 4# 5# Copyright 2016 The Android Open Source Project 6# 7# Licensed under the Apache License, Version 2.0 (the "License"); 8# you may not use this file except in compliance with the License. 9# You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, software 14# distributed under the License is distributed on an "AS IS" BASIS, 15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16# See the License for the specific language governing permissions and 17# limitations under the License. 18 19 20case per_patch_array_of_structs 21 version 320 es 22 desc "per-patch variable type is array of structs" 23 expect compile_or_link_fail 24 vertex "" 25 #version 320 es 26 ${VERTEX_DECLARATIONS} 27 void main() 28 { 29 ${VERTEX_OUTPUT} 30 } 31 "" 32 tessellation_control "" 33 #version 320 es 34 ${TESSELLATION_CONTROL_DECLARATIONS} 35 struct S 36 { 37 highp float a; 38 highp vec2 b; 39 }; 40 patch out S patchVariable[2]; // array of structures is illegal 41 void main() 42 { 43 patchVariable[0].a = gl_in[0].gl_Position.x; 44 patchVariable[0].b = gl_in[0].gl_Position.yz; 45 patchVariable[1].a = gl_in[0].gl_Position.z; 46 patchVariable[1].b = gl_in[0].gl_Position.wx; 47 ${TESSELLATION_CONTROL_OUTPUT} 48 } 49 "" 50 tessellation_evaluation "" 51 #version 320 es 52 ${TESSELLATION_EVALUATION_DECLARATIONS} 53 struct S 54 { 55 highp float a; 56 highp vec2 b; 57 }; 58 patch in S patchVariable[2]; // array of structures is illegal 59 out mediump float te_out; 60 void main() 61 { 62 te_out = patchVariable[0].a + patchVariable[1].b.y; 63 ${TESSELLATION_EVALUATION_OUTPUT} 64 } 65 "" 66 fragment "" 67 #version 320 es 68 precision mediump float; 69 ${FRAGMENT_DECLARATIONS} 70 in mediump float te_out; 71 void main() 72 { 73 ${FRAG_COLOR} = vec4(te_out); 74 } 75 "" 76end 77 78case per_patch_structs_containing_arrays 79 version 320 es 80 desc "per-patch variable type is struct containing array" 81 expect compile_or_link_fail 82 vertex "" 83 #version 320 es 84 ${VERTEX_DECLARATIONS} 85 void main() 86 { 87 ${VERTEX_OUTPUT} 88 } 89 "" 90 tessellation_control "" 91 #version 320 es 92 ${TESSELLATION_CONTROL_DECLARATIONS} 93 struct S 94 { 95 highp float a; 96 highp float b[2]; 97 }; 98 patch out S patchVariable; // output structure containing array is illegal 99 void main() 100 { 101 patchVariable.a = gl_in[0].gl_Position.x; 102 patchVariable.b[0] = gl_in[0].gl_Position.y; 103 patchVariable.b[1] = gl_in[0].gl_Position.w; 104 ${TESSELLATION_CONTROL_OUTPUT} 105 } 106 "" 107 tessellation_evaluation "" 108 #version 320 es 109 ${TESSELLATION_EVALUATION_DECLARATIONS} 110 struct S 111 { 112 highp float a; 113 highp float b[2]; 114 }; 115 patch in S patchVariable; // output structure containing array is illegal 116 out mediump float te_out; 117 void main() 118 { 119 te_out = patchVariable.a + patchVariable.b[1]; 120 ${TESSELLATION_EVALUATION_OUTPUT} 121 } 122 "" 123 fragment "" 124 #version 320 es 125 precision mediump float; 126 ${FRAGMENT_DECLARATIONS} 127 in mediump float te_out; 128 void main() 129 { 130 ${FRAG_COLOR} = vec4(te_out); 131 } 132 "" 133end 134 135case per_vertex_incorrect_control_explicit_output_array_size_1 136 version 320 es 137 desc "Incorrectly sized tessellation control output array" 138 expect compile_or_link_fail 139 vertex "" 140 #version 320 es 141 ${VERTEX_DECLARATIONS} 142 void main() 143 { 144 ${VERTEX_OUTPUT} 145 } 146 "" 147 tessellation_control "" 148 #version 320 es 149 ${TESSELLATION_CONTROL_DECLARATIONS} 150 out highp float varyingArray[2]; // size does not match layout declaration 151 void main() 152 { 153 varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID]; 154 ${TESSELLATION_CONTROL_OUTPUT} 155 } 156 "" 157 tessellation_evaluation "" 158 #version 320 es 159 ${TESSELLATION_EVALUATION_DECLARATIONS} 160 in highp float varyingArray[gl_MaxPatchVertices]; // size is correct 161 out mediump float te_out; 162 void main() 163 { 164 te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2]; 165 ${TESSELLATION_EVALUATION_OUTPUT} 166 } 167 "" 168 fragment "" 169 #version 320 es 170 precision mediump float; 171 ${FRAGMENT_DECLARATIONS} 172 in mediump float te_out; 173 void main() 174 { 175 ${FRAG_COLOR} = vec4(te_out); 176 } 177 "" 178end 179 180case per_vertex_incorrect_control_explicit_output_array_size_2 181 version 320 es 182 desc "Incorrectly sized tessellation control output array" 183 expect compile_or_link_fail 184 vertex "" 185 #version 320 es 186 ${VERTEX_DECLARATIONS} 187 void main() 188 { 189 ${VERTEX_OUTPUT} 190 } 191 "" 192 tessellation_control "" 193 #version 320 es 194 ${TESSELLATION_CONTROL_DECLARATIONS} 195 out highp float varyingArray[gl_MaxPatchVertices]; // size does not match layout declaration 196 void main() 197 { 198 varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID]; 199 ${TESSELLATION_CONTROL_OUTPUT} 200 } 201 "" 202 tessellation_evaluation "" 203 #version 320 es 204 ${TESSELLATION_EVALUATION_DECLARATIONS} 205 in highp float varyingArray[gl_MaxPatchVertices]; // size is correct 206 out mediump float te_out; 207 void main() 208 { 209 te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2]; 210 ${TESSELLATION_EVALUATION_OUTPUT} 211 } 212 "" 213 fragment "" 214 #version 320 es 215 precision mediump float; 216 ${FRAGMENT_DECLARATIONS} 217 in mediump float te_out; 218 void main() 219 { 220 ${FRAG_COLOR} = vec4(te_out); 221 } 222 "" 223end 224 225case per_vertex_incorrect_control_explicit_output_array_size_3 226 version 320 es 227 desc "Incorrectly sized tessellation control output array" 228 expect compile_or_link_fail 229 vertex "" 230 #version 320 es 231 ${VERTEX_DECLARATIONS} 232 void main() 233 { 234 ${VERTEX_OUTPUT} 235 } 236 "" 237 tessellation_control "" 238 #version 320 es 239 ${TESSELLATION_CONTROL_DECLARATIONS} 240 out highp float varyingArray[${GL_MAX_PATCH_VERTICES}]; // size does not match layout declaration 241 void main() 242 { 243 varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID]; 244 ${TESSELLATION_CONTROL_OUTPUT} 245 } 246 "" 247 tessellation_evaluation "" 248 #version 320 es 249 ${TESSELLATION_EVALUATION_DECLARATIONS} 250 in highp float varyingArray[gl_MaxPatchVertices]; // size is correct 251 out mediump float te_out; 252 void main() 253 { 254 te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2]; 255 ${TESSELLATION_EVALUATION_OUTPUT} 256 } 257 "" 258 fragment "" 259 #version 320 es 260 precision mediump float; 261 ${FRAGMENT_DECLARATIONS} 262 in mediump float te_out; 263 void main() 264 { 265 ${FRAG_COLOR} = vec4(te_out); 266 } 267 "" 268end 269 270case per_vertex_incorrect_eval_explicit_input_array_size 271 version 320 es 272 desc "Incorrectly sized tessellation control output array" 273 expect compile_or_link_fail 274 vertex "" 275 #version 320 es 276 ${VERTEX_DECLARATIONS} 277 void main() 278 { 279 ${VERTEX_OUTPUT} 280 } 281 "" 282 tessellation_control "" 283 #version 320 es 284 ${TESSELLATION_CONTROL_DECLARATIONS} 285 out highp float varyingArray[]; 286 void main() 287 { 288 varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID]; 289 ${TESSELLATION_CONTROL_OUTPUT} 290 } 291 "" 292 tessellation_evaluation "" 293 #version 320 es 294 ${TESSELLATION_EVALUATION_DECLARATIONS} 295 in highp float varyingArray[3]; // size is not equal to gl_MaxPatchVertices 296 out mediump float te_out; 297 void main() 298 { 299 te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2]; 300 ${TESSELLATION_EVALUATION_OUTPUT} 301 } 302 "" 303 fragment "" 304 #version 320 es 305 precision mediump float; 306 ${FRAGMENT_DECLARATIONS} 307 in mediump float te_out; 308 void main() 309 { 310 ${FRAG_COLOR} = vec4(te_out); 311 } 312 "" 313end 314