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 mismatch_number_of_declarations 21 version 320 es 22 desc "Shader storage block mismatch: different number of declarations" 23 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 24 require limit "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS" > 0 25 expect link_fail 26 vertex "" 27 #version 320 es 28 ${VERTEX_DECLARATIONS} 29 layout(binding=0) buffer BufferBlockName 30 { 31 mediump float variable1; 32 }; 33 34 out mediump float vtx_val; 35 void main() 36 { 37 vtx_val = variable1; 38 ${VERTEX_OUTPUT} 39 } 40 "" 41 fragment "" 42 #version 320 es 43 precision mediump float; 44 ${FRAGMENT_DECLARATIONS} 45 layout(binding=0) buffer BufferBlockName 46 { 47 mediump float variable1; 48 mediump float variable2; 49 }; 50 51 in mediump float vtx_val; 52 void main() 53 { 54 ${FRAG_COLOR} = vec4(vtx_val + variable1 + variable2); 55 } 56 "" 57end 58 59case mismatch_order 60 version 320 es 61 desc "Shader storage block mismatch: different number of declarations" 62 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 63 require limit "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS" > 0 64 expect link_fail 65 vertex "" 66 #version 320 es 67 ${VERTEX_DECLARATIONS} 68 layout(binding=0) buffer BufferBlockName 69 { 70 mediump float variable1; 71 mediump float variable2; 72 }; 73 74 out mediump float vtx_val; 75 void main() 76 { 77 vtx_val = variable1 + variable2; 78 ${VERTEX_OUTPUT} 79 } 80 "" 81 fragment "" 82 #version 320 es 83 precision mediump float; 84 ${FRAGMENT_DECLARATIONS} 85 layout(binding=0) buffer BufferBlockName 86 { 87 mediump float variable2; 88 mediump float variable1; 89 }; 90 91 in mediump float vtx_val; 92 void main() 93 { 94 ${FRAG_COLOR} = vec4(vtx_val + variable1 + variable2); 95 } 96 "" 97end 98 99case mismatch_type 100 version 320 es 101 desc "Shader storage block mismatch: different number of declarations" 102 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 103 require limit "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS" > 0 104 expect link_fail 105 vertex "" 106 #version 320 es 107 ${VERTEX_DECLARATIONS} 108 layout(binding=0) buffer BufferBlockName 109 { 110 mediump vec2 variable; 111 }; 112 113 out mediump float vtx_val; 114 void main() 115 { 116 vtx_val = variable.y; 117 ${VERTEX_OUTPUT} 118 } 119 "" 120 fragment "" 121 #version 320 es 122 precision mediump float; 123 ${FRAGMENT_DECLARATIONS} 124 layout(binding=0) buffer BufferBlockName 125 { 126 mediump float variable; 127 }; 128 129 in mediump float vtx_val; 130 void main() 131 { 132 ${FRAG_COLOR} = vec4(vtx_val + variable); 133 } 134 "" 135end 136 137case mismatch_member_name 138 version 320 es 139 desc "Shader storage block mismatch: different number of declarations" 140 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 141 require limit "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS" > 0 142 expect link_fail 143 vertex "" 144 #version 320 es 145 ${VERTEX_DECLARATIONS} 146 layout(binding=0) buffer BufferBlockName 147 { 148 mediump float variable1; 149 }; 150 151 out mediump float vtx_val; 152 void main() 153 { 154 vtx_val = variable1; 155 ${VERTEX_OUTPUT} 156 } 157 "" 158 fragment "" 159 #version 320 es 160 precision mediump float; 161 ${FRAGMENT_DECLARATIONS} 162 layout(binding=0) buffer BufferBlockName 163 { 164 mediump float variable2; 165 }; 166 167 in mediump float vtx_val; 168 void main() 169 { 170 ${FRAG_COLOR} = vec4(vtx_val + variable2); 171 } 172 "" 173end 174 175case mismatch_member_unsized_sized_array 176 version 320 es 177 desc "Shader storage block mismatch: different number of declarations" 178 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 179 require limit "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS" > 0 180 expect link_fail 181 vertex "" 182 #version 320 es 183 ${VERTEX_DECLARATIONS} 184 layout(binding=0) buffer BufferBlockName 185 { 186 mediump float variable[]; 187 }; 188 189 out mediump float vtx_val; 190 void main() 191 { 192 vtx_val = variable[0]; 193 ${VERTEX_OUTPUT} 194 } 195 "" 196 fragment "" 197 #version 320 es 198 precision mediump float; 199 ${FRAGMENT_DECLARATIONS} 200 layout(binding=0) buffer BufferBlockName 201 { 202 mediump float variable[1]; 203 }; 204 205 in mediump float vtx_val; 206 void main() 207 { 208 ${FRAG_COLOR} = vec4(vtx_val + variable[0]); 209 } 210 "" 211end 212 213case mismatch_member_array_size 214 version 320 es 215 desc "Shader storage block mismatch: different number of declarations" 216 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 217 require limit "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS" > 0 218 expect link_fail 219 vertex "" 220 #version 320 es 221 ${VERTEX_DECLARATIONS} 222 layout(binding=0) buffer BufferBlockName 223 { 224 mediump float variable[1]; 225 }; 226 227 out mediump float vtx_val; 228 void main() 229 { 230 vtx_val = variable[0]; 231 ${VERTEX_OUTPUT} 232 } 233 "" 234 fragment "" 235 #version 320 es 236 precision mediump float; 237 ${FRAGMENT_DECLARATIONS} 238 layout(binding=0) buffer BufferBlockName 239 { 240 mediump float variable[2]; 241 }; 242 243 in mediump float vtx_val; 244 void main() 245 { 246 ${FRAG_COLOR} = vec4(vtx_val + variable[0]); 247 } 248 "" 249end 250 251case mismatch_with_and_without_instance_name 252 version 320 es 253 desc "Shader storage block mismatch: different number of declarations" 254 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 255 require limit "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS" > 0 256 expect link_fail 257 vertex "" 258 #version 320 es 259 ${VERTEX_DECLARATIONS} 260 layout(binding=0) buffer BufferBlockName 261 { 262 mediump float variable; 263 } instanceName; 264 265 out mediump float vtx_val; 266 void main() 267 { 268 vtx_val = instanceName.variable; 269 ${VERTEX_OUTPUT} 270 } 271 "" 272 fragment "" 273 #version 320 es 274 precision mediump float; 275 ${FRAGMENT_DECLARATIONS} 276 layout(binding=0) buffer BufferBlockName 277 { 278 mediump float variable; 279 }; 280 281 in mediump float vtx_val; 282 void main() 283 { 284 ${FRAG_COLOR} = vec4(vtx_val + variable); 285 } 286 "" 287end 288 289case mismatch_block_array_size 290 version 320 es 291 desc "Shader storage block mismatch: different number of declarations" 292 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 293 require limit "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS" > 0 294 expect link_fail 295 vertex "" 296 #version 320 es 297 ${VERTEX_DECLARATIONS} 298 layout(binding=0) buffer BufferBlockName 299 { 300 mediump float variable; 301 } instanceName[1]; 302 303 out mediump float vtx_val; 304 void main() 305 { 306 vtx_val = instanceName[0].variable; 307 ${VERTEX_OUTPUT} 308 } 309 "" 310 fragment "" 311 #version 320 es 312 precision mediump float; 313 ${FRAGMENT_DECLARATIONS} 314 layout(binding=0) buffer BufferBlockName 315 { 316 mediump float variable; 317 } instanceName[2]; 318 319 in mediump float vtx_val; 320 void main() 321 { 322 ${FRAG_COLOR} = vec4(vtx_val + instanceName[0].variable + instanceName[1].variable); 323 } 324 "" 325end 326 327case ambiguous_variable_name_1 328 version 320 es 329 desc "Unnamed shader storage block variable and global variable with identical names" 330 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 331 expect compile_or_link_fail 332 vertex "" 333 #version 320 es 334 ${VERTEX_DECLARATIONS} 335 float variable; 336 layout(binding=0) buffer BufferBlockName 337 { 338 mediump float variable; 339 }; 340 341 out mediump float vtx_val; 342 void main() 343 { 344 vtx_val = variable; 345 ${VERTEX_OUTPUT} 346 } 347 "" 348 fragment "" 349 #version 320 es 350 precision mediump float; 351 ${FRAGMENT_DECLARATIONS} 352 in mediump float vtx_val; 353 void main() 354 { 355 ${FRAG_COLOR} = vec4(vtx_val); 356 } 357 "" 358end 359 360case ambiguous_variable_name_2 361 version 320 es 362 desc "Two unnamed shader storage blocks with variables with identical names" 363 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 1 364 expect compile_or_link_fail 365 vertex "" 366 #version 320 es 367 ${VERTEX_DECLARATIONS} 368 layout(binding=0) buffer BufferBlockNameA 369 { 370 mediump float variable; 371 }; 372 layout(binding=1) buffer BufferBlockNameB 373 { 374 mediump float variable; 375 }; 376 377 out mediump float vtx_val; 378 void main() 379 { 380 vtx_val = variable; 381 ${VERTEX_OUTPUT} 382 } 383 "" 384 fragment "" 385 #version 320 es 386 precision mediump float; 387 ${FRAGMENT_DECLARATIONS} 388 in mediump float vtx_val; 389 void main() 390 { 391 ${FRAG_COLOR} = vec4(vtx_val); 392 } 393 "" 394end 395 396case ambiguous_variable_name_3 397 version 320 es 398 desc "Two unnamed shader storage blocks in different stages with variables with identical names" 399 require limit "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS" > 0 400 require limit "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS" > 0 401 # language to make link error explicitly defined. ("Within an interface, ...") 402 require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex, fragment } 403 expect link_fail 404 vertex "" 405 #version 320 es 406 ${VERTEX_DECLARATIONS} 407 layout(binding=0) buffer BufferBlockNameA 408 { 409 mediump float variable; 410 }; 411 412 out mediump float vtx_val; 413 void main() 414 { 415 vtx_val = variable; 416 ${VERTEX_OUTPUT} 417 } 418 "" 419 fragment "" 420 #version 320 es 421 precision mediump float; 422 ${FRAGMENT_DECLARATIONS} 423 layout(binding=1) buffer BufferBlockNameB 424 { 425 mediump float variable; 426 }; 427 428 in mediump float vtx_val; 429 void main() 430 { 431 ${FRAG_COLOR} = vec4(vtx_val + variable); 432 } 433 "" 434end 435