1group struct "Uniform structs" 2 # Struct linkage handling 3 case basic 4 version 450 5 desc "Same uniform struct in both shaders" 6 values { 7 uniform float val.a = 1.0; 8 uniform float val.b = 2.0; 9 output float out0 = 3.0; 10 } 11 vertex "" 12 #version 450 13 ${VERTEX_DECLARATIONS} 14 struct Struct {mediump float a; mediump float b;}; 15 uniform Struct val; 16 out mediump float dummy; 17 void main() 18 { 19 dummy = val.a + val.b; 20 ${VERTEX_OUTPUT} 21 } 22 "" 23 fragment "" 24 #version 450 25 precision mediump float; 26 struct Struct {mediump float a; mediump float b;}; 27 uniform Struct val; 28 in mediump float dummy; 29 ${FRAGMENT_DECLARATIONS} 30 void main() 31 { 32 out0 = val.b + val.a; 33 out0 = out0 + dummy; 34 out0 = out0 - dummy; 35 ${FRAGMENT_OUTPUT} 36 } 37 "" 38 end 39 40 case vertex_only 41 version 450 42 desc "Uniform struct declared in both, used only in vertex." 43 values { 44 uniform float val.a = 1.0; 45 uniform float val.b = 2.0; 46 output float out0 = 3.0; 47 } 48 vertex "" 49 #version 450 50 ${VERTEX_DECLARATIONS} 51 struct Struct {mediump float a; mediump float b;}; 52 uniform Struct val; 53 out mediump float res; 54 void main() 55 { 56 res = val.a + val.b; 57 ${VERTEX_OUTPUT} 58 } 59 "" 60 fragment "" 61 #version 450 62 precision mediump float; 63 struct Struct {mediump float a; mediump float b;}; 64 uniform Struct val; 65 in mediump float res; 66 ${FRAGMENT_DECLARATIONS} 67 void main() 68 { 69 out0 = res; 70 ${FRAGMENT_OUTPUT} 71 } 72 "" 73 end 74 75 case fragment_only 76 version 450 77 desc "Uniform struct declared in both, used only in fragment." 78 values { 79 uniform float val.a = 1.0; 80 uniform float val.b = 2.0; 81 output float out0 = 3.0; 82 } 83 vertex "" 84 #version 450 85 ${VERTEX_DECLARATIONS} 86 struct Struct {mediump float a; mediump float b;}; 87 uniform Struct val; 88 void main() 89 { 90 ${VERTEX_OUTPUT} 91 } 92 "" 93 fragment "" 94 #version 450 95 precision mediump float; 96 struct Struct {mediump float a; mediump float b;}; 97 uniform Struct val; 98 ${FRAGMENT_DECLARATIONS} 99 void main() 100 { 101 out0 = val.a + val.b; 102 ${FRAGMENT_OUTPUT} 103 } 104 "" 105 end 106 107 case partial 108 version 450 109 desc "Uniform struct declared in both, used partially in both." 110 values { 111 uniform float val.a = 1.0; 112 uniform float val.b = 2.0; 113 output float out0 = 3.0; 114 } 115 vertex "" 116 #version 450 117 ${VERTEX_DECLARATIONS} 118 struct Struct {mediump float a; mediump float b;}; 119 uniform Struct val; 120 out mediump float res; 121 void main() 122 { 123 res = val.a; 124 ${VERTEX_OUTPUT} 125 } 126 "" 127 fragment "" 128 #version 450 129 precision mediump float; 130 struct Struct {mediump float a; mediump float b;}; 131 uniform Struct val; 132 ${FRAGMENT_DECLARATIONS} 133 in mediump float res; 134 void main() 135 { 136 out0 = res + val.b; 137 ${FRAGMENT_OUTPUT} 138 } 139 "" 140 end 141 142 case vec4 143 version 450 144 desc "Same uniform struct in both shaders. Datatype vec4" 145 values { 146 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 147 uniform vec4 val.b = vec4(1.0, 2.0, 3.0, 4.0); 148 output float out0 = 3.0; 149 } 150 vertex "" 151 #version 450 152 ${VERTEX_DECLARATIONS} 153 struct Struct {mediump vec4 a; mediump vec4 b;}; 154 uniform Struct val; 155 out mediump float dummy; 156 void main() 157 { 158 dummy = val.a.x + val.b.y; 159 ${VERTEX_OUTPUT} 160 } 161 "" 162 fragment "" 163 #version 450 164 precision mediump float; 165 struct Struct {mediump vec4 a; mediump vec4 b;}; 166 uniform Struct val; 167 in mediump float dummy; 168 ${FRAGMENT_DECLARATIONS} 169 void main() 170 { 171 out0 = val.b.y + val.a.x; 172 out0 = out0 + dummy; 173 out0 = out0 - dummy; 174 ${FRAGMENT_OUTPUT} 175 } 176 "" 177 end 178 179 case vertex_only_vec4 180 version 450 181 desc "Uniform struct declared in both, used only in vertex. Datatype vec4 " 182 values { 183 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 184 uniform vec4 val.b = vec4(1.0, 2.0, 3.0, 4.0); 185 output float out0 = 3.0; 186 } 187 vertex "" 188 #version 450 189 ${VERTEX_DECLARATIONS} 190 struct Struct {mediump vec4 a; mediump vec4 b;}; 191 uniform Struct val; 192 out mediump float res; 193 void main() 194 { 195 res = val.a.x + val.b.y; 196 ${VERTEX_OUTPUT} 197 } 198 "" 199 fragment "" 200 #version 450 201 precision mediump float; 202 struct Struct {mediump vec4 a; mediump vec4 b;}; 203 uniform Struct val; 204 in mediump float res; 205 ${FRAGMENT_DECLARATIONS} 206 void main() 207 { out0 = res; 208 ${FRAGMENT_OUTPUT} 209 } 210 "" 211 end 212 213 case fragment_only_vec4 214 version 450 215 desc "Uniform struct declared in both, used only in fragment. Datatype vec4" 216 values { 217 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 218 uniform vec4 val.b = vec4(1.0, 2.0, 3.0, 4.0); 219 output float out0 = 3.0; 220 } 221 vertex "" 222 #version 450 223 ${VERTEX_DECLARATIONS} 224 struct Struct {mediump vec4 a; mediump vec4 b;}; 225 uniform Struct val; 226 void main() 227 { 228 ${VERTEX_OUTPUT} 229 } 230 "" 231 fragment "" 232 #version 450 233 precision mediump float; 234 struct Struct {mediump vec4 a; mediump vec4 b;}; 235 uniform Struct val; 236 ${FRAGMENT_DECLARATIONS} 237 void main() 238 { out0 = val.a.x + val.b.y; 239 ${FRAGMENT_OUTPUT} 240 } 241 "" 242 end 243 244 case partial_vec4 245 version 450 246 desc "Uniform struct declared in both, used partially in both. Datatype vec4" 247 values { 248 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 249 uniform vec4 val.b = vec4(1.0, 2.0, 3.0, 4.0); 250 output float out0 = 3.0; 251 } 252 vertex "" 253 #version 450 254 ${VERTEX_DECLARATIONS} 255 struct Struct {mediump vec4 a; mediump vec4 b;}; 256 uniform Struct val; 257 out mediump float res; 258 void main() 259 { 260 res = val.a.x; 261 ${VERTEX_OUTPUT} 262 } 263 "" 264 fragment "" 265 #version 450 266 precision mediump float; 267 struct Struct {mediump vec4 a; mediump vec4 b;}; 268 uniform Struct val; 269 ${FRAGMENT_DECLARATIONS} 270 in mediump float res; 271 void main() 272 { out0 = res + val.b.y; 273 ${FRAGMENT_OUTPUT} 274 } 275 "" 276 end 277 278 case vec4_vec3 279 version 450 280 desc "Same uniform struct in both shaders. Datatype vec4 and vec3" 281 values { 282 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 283 uniform vec3 val.b = vec3(1.0, 2.0, 3.0); 284 output float out0 = 3.0; 285 } 286 vertex "" 287 #version 450 288 ${VERTEX_DECLARATIONS} 289 struct Struct {mediump vec4 a; mediump vec3 b;}; 290 uniform Struct val; 291 out mediump float dummy; 292 void main() 293 { 294 dummy = val.a.x + val.b.y; 295 ${VERTEX_OUTPUT} 296 } 297 "" 298 fragment "" 299 #version 450 300 precision mediump float; 301 struct Struct {mediump vec4 a; mediump vec3 b;}; 302 uniform Struct val; 303 in mediump float dummy; 304 ${FRAGMENT_DECLARATIONS} 305 void main() 306 { out0 = val.b.y + val.a.x; 307 out0 = out0 + dummy; 308 out0 = out0 - dummy; 309 ${FRAGMENT_OUTPUT} 310 } 311 "" 312 end 313 314 case vertex_only_vec4_vec3 315 version 450 316 desc "Uniform struct declared in both, used only in vertex. Datatype vec4 and vec3" 317 values { 318 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 319 uniform vec3 val.b = vec3(1.0, 2.0, 3.0); 320 output float out0 = 3.0; 321 } 322 vertex "" 323 #version 450 324 ${VERTEX_DECLARATIONS} 325 struct Struct {mediump vec4 a; mediump vec3 b;}; 326 uniform Struct val; 327 out mediump float res; 328 void main() 329 { 330 res = val.a.x + val.b.y; 331 ${VERTEX_OUTPUT} 332 } 333 "" 334 fragment "" 335 #version 450 336 precision mediump float; 337 struct Struct {mediump vec4 a; mediump vec3 b;}; 338 uniform Struct val; 339 in mediump float res; 340 ${FRAGMENT_DECLARATIONS} 341 void main() 342 { out0 = res; 343 ${FRAGMENT_OUTPUT} 344 } 345 "" 346 end 347 348 case fragment_only_vec4_vec3 349 version 450 350 desc "Uniform struct declared in both, used only in fragment. Datatype vec4 and vec3" 351 values { 352 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 353 uniform vec3 val.b = vec3(1.0, 2.0, 3.0); 354 output float out0 = 3.0; 355 } 356 vertex "" 357 #version 450 358 ${VERTEX_DECLARATIONS} 359 struct Struct {mediump vec4 a; mediump vec3 b;}; 360 uniform Struct val; 361 void main() 362 { 363 ${VERTEX_OUTPUT} 364 } 365 "" 366 fragment "" 367 #version 450 368 precision mediump float; 369 struct Struct {mediump vec4 a; mediump vec3 b;}; 370 uniform Struct val; 371 ${FRAGMENT_DECLARATIONS} 372 void main() 373 { out0 = val.a.x + val.b.y; 374 ${FRAGMENT_OUTPUT} 375 } 376 "" 377 end 378 379 case partial_vec4_vec3 380 version 450 381 desc "Uniform struct declared in both, used partially in both. Datatype vec4 and vec3" 382 values { 383 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 384 uniform vec3 val.b = vec3(1.0, 2.0, 3.0); 385 output float out0 = 3.0; 386 } 387 vertex "" 388 #version 450 389 ${VERTEX_DECLARATIONS} 390 struct Struct {mediump vec4 a; mediump vec3 b;}; 391 uniform Struct val; 392 out mediump float res; 393 void main() 394 { 395 res = val.a.x; 396 ${VERTEX_OUTPUT} 397 } 398 "" 399 fragment "" 400 #version 450 401 precision mediump float; 402 struct Struct {mediump vec4 a; mediump vec3 b;}; 403 uniform Struct val; 404 ${FRAGMENT_DECLARATIONS} 405 in mediump float res; 406 void main() 407 { out0 = res + val.b.y; 408 ${FRAGMENT_OUTPUT} 409 } 410 "" 411 end 412 413 case vec4_float 414 version 450 415 desc "Same uniform struct in both shaders. Datatype vec4 and float" 416 values { 417 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 418 uniform float val.b = 2.0; 419 output float out0 = 3.0; 420 } 421 vertex "" 422 #version 450 423 ${VERTEX_DECLARATIONS} 424 struct Struct {mediump vec4 a; mediump float b;}; 425 uniform Struct val; 426 out mediump float dummy; 427 void main() 428 { 429 dummy = val.a.x + val.b; 430 ${VERTEX_OUTPUT} 431 } 432 "" 433 fragment "" 434 #version 450 435 precision mediump float; 436 struct Struct {mediump vec4 a; mediump float b;}; 437 uniform Struct val; 438 in mediump float dummy; 439 ${FRAGMENT_DECLARATIONS} 440 void main() 441 { out0 = val.b + val.a.x; 442 out0 = out0 + dummy; 443 out0 = out0 - dummy; 444 ${FRAGMENT_OUTPUT} 445 } 446 "" 447 end 448 449 case vertex_only_vec4_float 450 version 450 451 desc "Uniform struct declared in both, used only in vertex. Datatype vec4 and float" 452 values { 453 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 454 uniform float val.b = 2.0; 455 output float out0 = 3.0; 456 } 457 vertex "" 458 #version 450 459 ${VERTEX_DECLARATIONS} 460 struct Struct {mediump vec4 a; mediump float b;}; 461 uniform Struct val; 462 out mediump float res; 463 void main() 464 { 465 res = val.a.x + val.b; 466 ${VERTEX_OUTPUT} 467 } 468 "" 469 fragment "" 470 #version 450 471 precision mediump float; 472 struct Struct {mediump vec4 a; mediump float b;}; 473 uniform Struct val; 474 in mediump float res; 475 ${FRAGMENT_DECLARATIONS} 476 void main() 477 { out0 = res; 478 ${FRAGMENT_OUTPUT} 479 } 480 "" 481 end 482 483 case fragment_only_vec4_float 484 version 450 485 desc "Uniform struct declared in both, used only in fragment. Datatype vec4 and float" 486 values { 487 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 488 uniform float val.b = 2.0; 489 output float out0 = 3.0; 490 } 491 vertex "" 492 #version 450 493 ${VERTEX_DECLARATIONS} 494 struct Struct {mediump vec4 a; mediump float b;}; 495 uniform Struct val; 496 void main() 497 { 498 ${VERTEX_OUTPUT} 499 } 500 "" 501 fragment "" 502 #version 450 503 precision mediump float; 504 struct Struct {mediump vec4 a; mediump float b;}; 505 uniform Struct val; 506 ${FRAGMENT_DECLARATIONS} 507 void main() 508 { out0 = val.a.x + val.b; 509 ${FRAGMENT_OUTPUT} 510 } 511 "" 512 end 513 514 case partial_vec4_float 515 version 450 516 desc "Uniform struct declared in both, used partially in both. Datatype vec4 and float" 517 values { 518 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 519 uniform float val.b = 2.0; 520 output float out0 = 3.0; 521 } 522 vertex "" 523 #version 450 524 ${VERTEX_DECLARATIONS} 525 struct Struct {mediump vec4 a; mediump float b;}; 526 uniform Struct val; 527 out mediump float res; 528 void main() 529 { 530 res = val.a.x; 531 ${VERTEX_OUTPUT} 532 } 533 "" 534 fragment "" 535 #version 450 536 precision mediump float; 537 struct Struct {mediump vec4 a; mediump float b;}; 538 uniform Struct val; 539 ${FRAGMENT_DECLARATIONS} 540 in mediump float res; 541 void main() 542 { out0 = res + val.b; 543 ${FRAGMENT_OUTPUT} 544 } 545 "" 546 end 547 548 case partial_vec4_struct 549 version 450 550 desc "Uniform struct declared in both, used partially in both. Datatype vec4 and struct with vec4" 551 values { 552 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 553 uniform vec4 val.b.c = vec4(1.0, 2.0, 3.0, 4.0); 554 output float out0 = 3.0; 555 } 556 vertex "" 557 #version 450 558 ${VERTEX_DECLARATIONS} 559 struct Inner {mediump vec4 c;}; 560 struct Struct {mediump vec4 a; Inner b;}; 561 uniform Struct val; 562 out mediump float res; 563 void main() 564 { 565 res = val.a.x; 566 ${VERTEX_OUTPUT} 567 } 568 "" 569 fragment "" 570 #version 450 571 precision mediump float; 572 struct Inner {mediump vec4 c;}; 573 struct Struct {mediump vec4 a; Inner b;}; 574 uniform Struct val; 575 ${FRAGMENT_DECLARATIONS} 576 in mediump float res; 577 void main() 578 { out0 = res + val.b.c.y; 579 ${FRAGMENT_OUTPUT} 580 } 581 "" 582 end 583 584 case partial_vec4_vec3_struct 585 version 450 586 desc "Uniform struct declared in both, used partially in both. Datatype vec4 and struct with vec3" 587 values { 588 uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0); 589 uniform vec3 val.b.c = vec3(1.0, 2.0, 3.0); 590 output float out0 = 3.0; 591 } 592 vertex "" 593 #version 450 594 ${VERTEX_DECLARATIONS} 595 struct Inner {mediump vec3 c;}; 596 struct Struct {mediump vec4 a; Inner b;}; 597 uniform Struct val; 598 out mediump float res; 599 void main() 600 { 601 res = val.a.x; 602 ${VERTEX_OUTPUT} 603 } 604 "" 605 fragment "" 606 #version 450 607 precision mediump float; 608 struct Inner {mediump vec3 c;}; 609 struct Struct {mediump vec4 a; Inner b;}; 610 uniform Struct val; 611 ${FRAGMENT_DECLARATIONS} 612 in mediump float res; 613 void main() 614 { out0 = res + val.b.c.y; 615 ${FRAGMENT_OUTPUT} 616 } 617 "" 618 end 619 620 case partial_vec2_vec3 621 version 450 622 desc "Uniform struct declared in both, used partially in both. Datatype vec2 and vec3" 623 values { 624 uniform vec2 val.a = vec2(1.0, 2.0); 625 uniform vec3 val.b = vec3(1.0, 2.0, 3.0); 626 output float out0 = 3.0; 627 } 628 vertex "" 629 #version 450 630 ${VERTEX_DECLARATIONS} 631 struct Struct {mediump vec2 a; mediump vec3 b;}; 632 uniform Struct val; 633 out mediump float res; 634 void main() 635 { 636 res = val.a.x; 637 ${VERTEX_OUTPUT} 638 } 639 "" 640 fragment "" 641 #version 450 642 precision mediump float; 643 struct Struct {mediump vec2 a; mediump vec3 b;}; 644 uniform Struct val; 645 ${FRAGMENT_DECLARATIONS} 646 in mediump float res; 647 void main() 648 { out0 = res + val.b.y; 649 ${FRAGMENT_OUTPUT} 650 } 651 "" 652 end 653 654 case partial_vec2_int 655 version 450 656 desc "Uniform struct declared in both, used partially in both. Datatype vec2 and int" 657 values { 658 uniform vec2 val.a = vec2(1.0, 2.0); 659 uniform int val.b = 2; 660 output float out0 = 3.0; 661 } 662 vertex "" 663 #version 450 664 ${VERTEX_DECLARATIONS} 665 struct Struct {mediump vec2 a; mediump int b;}; 666 uniform Struct val; 667 out mediump float res; 668 void main() 669 { 670 res = val.a.x; 671 ${VERTEX_OUTPUT} 672 } 673 "" 674 fragment "" 675 #version 450 676 precision mediump float; 677 struct Struct {mediump vec2 a; mediump int b;}; 678 uniform Struct val; 679 ${FRAGMENT_DECLARATIONS} 680 in mediump float res; 681 void main() 682 { out0 = res + float(val.b); 683 ${FRAGMENT_OUTPUT} 684 } 685 "" 686 end 687 688 case partial_int_float 689 version 450 690 desc "Uniform struct declared in both, used partially in both. Datatype int and float" 691 values { 692 uniform float val.a = 1.0; 693 uniform int val.b = 2; 694 output float out0 = 3.0; 695 } 696 vertex "" 697 #version 450 698 ${VERTEX_DECLARATIONS} 699 struct Struct {mediump float a; mediump int b;}; 700 uniform Struct val; 701 out mediump float res; 702 void main() 703 { 704 res = val.a; 705 ${VERTEX_OUTPUT} 706 } 707 "" 708 fragment "" 709 #version 450 710 precision mediump float; 711 struct Struct {mediump float a; mediump int b;}; 712 uniform Struct val; 713 ${FRAGMENT_DECLARATIONS} 714 in mediump float res; 715 void main() 716 { out0 = res + float(val.b); 717 ${FRAGMENT_OUTPUT} 718 } 719 "" 720 end 721 722 case partial_bvec2_vec2 723 version 450 724 desc "Uniform struct declared in both, used partially in both. Datatype bvec2 and vec2" 725 values { 726 uniform bvec2 val.a = bvec2(true, true); 727 uniform vec2 val.b = vec2(1.0, 2.0); 728 output float out0 = 3.0; 729 } 730 vertex "" 731 #version 450 732 ${VERTEX_DECLARATIONS} 733 struct Struct {bvec2 a; mediump vec2 b;}; 734 uniform Struct val; 735 out mediump float res; 736 void main() 737 { 738 res = float(val.a.x); 739 ${VERTEX_OUTPUT} 740 } 741 "" 742 fragment "" 743 #version 450 744 precision mediump float; 745 struct Struct {bvec2 a; mediump vec2 b;}; 746 uniform Struct val; 747 ${FRAGMENT_DECLARATIONS} 748 in mediump float res; 749 void main() 750 { out0 = res + val.b.y; 751 ${FRAGMENT_OUTPUT} 752 } 753 "" 754 end 755 756 case partial_ivec2_vec2 757 version 450 758 desc "Uniform struct declared in both, used partially in both. Datatype ivec2 and vec2" 759 values { 760 uniform ivec2 val.a = ivec2(1, 2); 761 uniform vec2 val.b = vec2(1.0, 2.0); 762 output float out0 = 3.0; 763 } 764 vertex "" 765 #version 450 766 ${VERTEX_DECLARATIONS} 767 struct Struct {mediump ivec2 a; mediump vec2 b;}; 768 uniform Struct val; 769 out mediump float res; 770 void main() 771 { 772 res = vec2(val.a).x; 773 ${VERTEX_OUTPUT} 774 } 775 "" 776 fragment "" 777 #version 450 778 precision mediump float; 779 struct Struct {mediump ivec2 a; mediump vec2 b;}; 780 uniform Struct val; 781 ${FRAGMENT_DECLARATIONS} 782 in mediump float res; 783 void main() 784 { out0 = res + val.b.y; 785 ${FRAGMENT_OUTPUT} 786 } 787 "" 788 end 789 790 case partial_ivec2_ivec2 791 version 450 792 desc "Uniform struct declared in both, used partially in both. Datatype ivec2 and ivec2" 793 values { 794 uniform ivec2 val.a = ivec2(1, 2); 795 uniform ivec2 val.b = ivec2(1, 2); 796 output float out0 = 3.0; 797 } 798 vertex "" 799 #version 450 800 ${VERTEX_DECLARATIONS} 801 struct Struct {mediump ivec2 a; mediump ivec2 b;}; 802 uniform Struct val; 803 out mediump float res; 804 void main() 805 { 806 res = vec2(val.a).x; 807 ${VERTEX_OUTPUT} 808 } 809 "" 810 fragment "" 811 #version 450 812 precision mediump float; 813 struct Struct {mediump ivec2 a; mediump ivec2 b;}; 814 uniform Struct val; 815 ${FRAGMENT_DECLARATIONS} 816 in mediump float res; 817 void main() 818 { out0 = res + vec2(val.b).y; 819 ${FRAGMENT_OUTPUT} 820 } 821 "" 822 end 823 824 case type_conflict_1 825 version 450 826 desc "Fragment struct has one less member than fragment version" 827 expect link_fail 828 values {output float out0 = 3.0;} 829 vertex "" 830 #version 450 831 ${VERTEX_DECLARATIONS} 832 struct Struct {mediump float a; mediump float b;}; 833 uniform Struct val; 834 out mediump float res; 835 void main() 836 { 837 res = val.a; 838 ${VERTEX_OUTPUT} 839 } 840 "" 841 fragment "" 842 #version 450 843 precision mediump float; 844 struct Struct {mediump float a;}; 845 uniform Struct val; 846 ${FRAGMENT_DECLARATIONS} 847 in mediump float res; 848 void main() 849 { out0 = res + val.a; 850 ${FRAGMENT_OUTPUT} 851 } 852 "" 853 end 854 855 case type_conflict_2 856 version 450 857 desc "Vertex struct has int, fragment struct has float." 858 expect link_fail 859 values {output float out0 = 3.0;} 860 vertex "" 861 #version 450 862 ${VERTEX_DECLARATIONS} 863 struct Struct {mediump int a;}; 864 uniform Struct val; 865 out mediump float res; 866 void main() 867 { 868 res = float(val.a); 869 ${VERTEX_OUTPUT} 870 } 871 "" 872 fragment "" 873 #version 450 874 precision mediump float; 875 struct Struct {mediump float a;}; 876 uniform Struct val; 877 ${FRAGMENT_DECLARATIONS} 878 in mediump float res; 879 void main() 880 { out0 = val.a; 881 ${FRAGMENT_OUTPUT} 882 } 883 "" 884 end 885 886 case type_conflict_3 887 version 450 888 desc "Vertex struct has vec3, fragment struct has vec4." 889 expect link_fail 890 values {output float out0 = 3.0;} 891 vertex "" 892 #version 450 893 ${VERTEX_DECLARATIONS} 894 struct Struct {mediump vec3 a;}; 895 uniform Struct val; 896 out mediump float res; 897 void main() 898 { 899 res = float(val.a.x); 900 ${VERTEX_OUTPUT} 901 } 902 "" 903 fragment "" 904 #version 450 905 precision mediump float; 906 struct Struct {mediump vec4 a;}; 907 uniform Struct val; 908 ${FRAGMENT_DECLARATIONS} 909 in mediump float res; 910 void main() 911 { out0 = val.a.x; 912 ${FRAGMENT_OUTPUT} 913 } 914 "" 915 end 916 917 case light_struct_highp 918 version 450 919 desc "Complex Light struct from use case tests." 920 values { 921 uniform float val.constantAttenuation = 1.0; 922 uniform float val.quadraticAttenuation = 1.0; 923 output float out0 = 2.0; 924 } 925 vertex "" 926 #version 450 927 struct Light 928 { 929 mediump vec3 color; 930 highp vec4 position; 931 highp vec3 direction; 932 mediump float constantAttenuation; 933 mediump float linearAttenuation; 934 mediump float quadraticAttenuation; 935 }; 936 ${VERTEX_DECLARATIONS} 937 uniform Light val; 938 out mediump float res; 939 void main() 940 { 941 res = val.constantAttenuation; 942 ${VERTEX_OUTPUT} 943 } 944 "" 945 fragment "" 946 #version 450 947 precision mediump float; 948 struct Light 949 { 950 mediump vec3 color; 951 highp vec4 position; 952 highp vec3 direction; 953 mediump float constantAttenuation; 954 mediump float linearAttenuation; 955 mediump float quadraticAttenuation; 956 }; 957 struct Struct {float a;}; 958 uniform Light val; 959 ${FRAGMENT_DECLARATIONS} 960 in mediump float res; 961 void main() 962 { 963 out0 = res + val.quadraticAttenuation; 964 ${FRAGMENT_OUTPUT} 965 } 966 "" 967 end 968 969 case light_struct_mediump 970 version 450 971 desc "Complex Light struct from use case tests, without highp usage" 972 values { 973 uniform float val.constantAttenuation = 1.0; 974 uniform float val.quadraticAttenuation = 1.0; 975 output float out0 = 2.0; 976 } 977 vertex "" 978 #version 450 979 struct Light 980 { 981 mediump vec3 color; 982 mediump vec4 position; 983 mediump vec3 direction; 984 mediump float constantAttenuation; 985 mediump float linearAttenuation; 986 mediump float quadraticAttenuation; 987 }; 988 ${VERTEX_DECLARATIONS} 989 uniform Light val; 990 out mediump float res; 991 void main() 992 { 993 res = val.constantAttenuation; 994 ${VERTEX_OUTPUT} 995 } 996 "" 997 fragment "" 998 #version 450 999 precision mediump float; 1000 struct Light 1001 { 1002 mediump vec3 color; 1003 mediump vec4 position; 1004 mediump vec3 direction; 1005 mediump float constantAttenuation; 1006 mediump float linearAttenuation; 1007 mediump float quadraticAttenuation; 1008 }; 1009 struct Struct {float a;}; 1010 uniform Light val; 1011 ${FRAGMENT_DECLARATIONS} 1012 in mediump float res; 1013 void main() 1014 { 1015 out0 = res + val.quadraticAttenuation; 1016 ${FRAGMENT_OUTPUT} 1017 } 1018 "" 1019 end 1020end 1021 1022group block "Uniform blocks" 1023 case differing_precision 1024 version 450 1025 expect build_successful 1026 vertex "" 1027 #version 450 1028 1029 uniform Block 1030 { 1031 highp vec4 val; 1032 }; 1033 1034 ${VERTEX_DECLARATIONS} 1035 out mediump float res; 1036 void main() 1037 { 1038 res = val.x; 1039 ${VERTEX_OUTPUT} 1040 } 1041 "" 1042 fragment "" 1043 #version 450 1044 1045 uniform Block 1046 { 1047 mediump vec4 val; 1048 }; 1049 1050 precision mediump float; 1051 ${FRAGMENT_DECLARATIONS} 1052 in mediump float res; 1053 void main() 1054 { 1055 dEQP_FragColor = val; 1056 } 1057 "" 1058 end 1059 1060 case type_mismatch 1061 version 450 1062 expect link_fail 1063 vertex "" 1064 #version 450 1065 1066 uniform Block 1067 { 1068 highp vec4 val; 1069 }; 1070 1071 ${VERTEX_DECLARATIONS} 1072 out mediump float res; 1073 void main() 1074 { 1075 res = val.x; 1076 ${VERTEX_OUTPUT} 1077 } 1078 "" 1079 fragment "" 1080 #version 450 1081 1082 uniform Block 1083 { 1084 highp vec3 val; 1085 }; 1086 1087 precision mediump float; 1088 ${FRAGMENT_DECLARATIONS} 1089 in mediump float res; 1090 void main() 1091 { 1092 dEQP_FragColor = vec4(val, 1.0); 1093 } 1094 "" 1095 end 1096 1097 case members_mismatch 1098 version 450 1099 expect link_fail 1100 vertex "" 1101 #version 450 1102 1103 uniform Block 1104 { 1105 highp vec4 val; 1106 }; 1107 1108 ${VERTEX_DECLARATIONS} 1109 out mediump float res; 1110 void main() 1111 { 1112 res = val.x; 1113 ${VERTEX_OUTPUT} 1114 } 1115 "" 1116 fragment "" 1117 #version 450 1118 1119 uniform Block 1120 { 1121 highp vec4 val; 1122 lowp uint u; 1123 }; 1124 1125 precision mediump float; 1126 ${FRAGMENT_DECLARATIONS} 1127 in mediump float res; 1128 void main() 1129 { 1130 dEQP_FragColor = vec4(val); 1131 } 1132 "" 1133 end 1134 1135 case layout_qualifier_mismatch_4 1136 version 450 1137 expect link_fail 1138 vertex "" 1139 #version 450 1140 1141 layout(row_major) uniform Block 1142 { 1143 highp mat3 val; 1144 }; 1145 1146 ${VERTEX_DECLARATIONS} 1147 out mediump float res; 1148 void main() 1149 { 1150 res = val[0][1]; 1151 ${VERTEX_OUTPUT} 1152 } 1153 "" 1154 fragment "" 1155 #version 450 1156 1157 layout(column_major) uniform Block 1158 { 1159 highp mat3 val; 1160 }; 1161 1162 precision mediump float; 1163 ${FRAGMENT_DECLARATIONS} 1164 in mediump float res; 1165 void main() 1166 { 1167 dEQP_FragColor = vec4(val[2], 1.0); 1168 } 1169 "" 1170 end 1171 1172 case layout_qualifier_mismatch_5 1173 version 450 1174 expect link_fail 1175 vertex "" 1176 #version 450 1177 1178 uniform Block 1179 { 1180 layout(row_major) uniform highp mat3 val; 1181 }; 1182 1183 ${VERTEX_DECLARATIONS} 1184 out mediump float res; 1185 void main() 1186 { 1187 res = val[0][1]; 1188 ${VERTEX_OUTPUT} 1189 } 1190 "" 1191 fragment "" 1192 #version 450 1193 1194 uniform Block 1195 { 1196 layout(column_major) uniform highp mat3 val; 1197 }; 1198 1199 precision mediump float; 1200 ${FRAGMENT_DECLARATIONS} 1201 in mediump float res; 1202 void main() 1203 { 1204 dEQP_FragColor = vec4(val[2], 1.0); 1205 } 1206 "" 1207 end 1208end 1209