preprocessor.test (81130B)
1 group basic "Basic Tests" 2 3 case correct_phases 4 version 300 es 5 expect compile_fail 6 both "" 7 #version 300 es 8 #define e +1 9 ${DECLARATIONS} 10 void main() 11 { 12 mediump int n = 1e; 13 ${OUTPUT} 14 } 15 "" 16 end 17 18 case invalid_identifier 19 version 300 es 20 expect compile_fail 21 both "" 22 #version 300 es 23 #define e +1 24 ${DECLARATIONS} 25 void main() 26 { 27 mediump int 1xyz = 1; 28 ${OUTPUT} 29 } 30 "" 31 end 32 33 case null_directive 34 version 300 es 35 values { output float out0 = 0.0; } 36 both "" 37 #version 300 es 38 precision mediump float; 39 ${DECLARATIONS} 40 41 # 42 # // comment 43 /*sfd*/ # /* */ 44 45 void main() 46 { 47 out0 = 0.0; 48 ${OUTPUT} 49 } 50 "" 51 end 52 53 case invalid_directive 54 version 300 es 55 expect compile_fail 56 both "" 57 #version 300 es 58 #defin AAA 59 ${DECLARATIONS} 60 61 void main() 62 { 63 ${OUTPUT} 64 } 65 "" 66 end 67 68 case missing_identifier 69 version 300 es 70 expect compile_fail 71 both "" 72 #version 300 es 73 #define 74 ${DECLARATIONS} 75 76 void main() 77 { 78 ${OUTPUT} 79 } 80 "" 81 end 82 83 case empty_object 84 version 300 es 85 values { output float out0 = -1.0; } 86 both "" 87 #version 300 es 88 precision mediump float; 89 ${DECLARATIONS} 90 91 # define VALUE 92 93 void main() 94 { 95 out0 = VALUE - 1.0; 96 ${OUTPUT} 97 } 98 "" 99 end 100 101 case empty_function 102 version 300 es 103 values { output float out0 = -1.0; } 104 both "" 105 #version 300 es 106 precision mediump float; 107 ${DECLARATIONS} 108 109 # define VALUE(a) 110 111 void main() 112 { 113 out0 = VALUE(2.0) - 1.0; 114 ${OUTPUT} 115 } 116 "" 117 end 118 119 case empty_directive 120 version 300 es 121 values { output float out0 = 1.0; } 122 both "" 123 #version 300 es 124 precision mediump float; 125 ${DECLARATIONS} 126 127 # 128 129 void main() 130 { 131 out0 = 1.0; 132 ${OUTPUT} 133 } 134 "" 135 end 136 137 case identifier_with_double_underscore 138 values { output float out0 = 1.0; } 139 version 300 es 140 both "" 141 #version 300 es 142 precision mediump float; 143 ${DECLARATIONS} 144 # define __VALUE__ 1 145 146 void main() 147 { 148 // __VALUE__ not used since it might be set by an "underlying software layer" 149 out0 = float(1.0); 150 ${OUTPUT} 151 } 152 "" 153 end 154 end # basic 155 156 group definitions "Symbol Definition Tests" 157 158 case define_value_and_function 159 version 300 es 160 values { output float out0 = 6.0; } 161 162 both "" 163 #version 300 es 164 precision mediump float; 165 ${DECLARATIONS:single-line} 166 # define VALUE (1.5 + 2.5) 167 # define FUNCTION(__LINE__, b) __LINE__+b 168 169 void main() 170 { 171 out0 = FUNCTION(VALUE, ((0.2) + 1.8) ); 172 ${OUTPUT} 173 } 174 "" 175 end 176 177 case undefine_object_invalid_syntax 178 version 300 es 179 expect compile_fail 180 both "" 181 #version 300 es 182 precision mediump float; 183 #define VAL 2.0 184 #undef VAL sdflkjfds 185 #define VAL 1.0 186 ${DECLARATIONS} 187 188 void main() 189 { 190 ${POSITION_FRAG_COLOR} = vec4(VAL); 191 } 192 "" 193 end 194 195 case undefine_invalid_object_1 196 version 300 es 197 expect compile_fail 198 both "" 199 #version 300 es 200 precision mediump float; 201 #undef __LINE__ 202 ${DECLARATIONS} 203 204 void main() 205 { 206 ${POSITION_FRAG_COLOR} = vec4(__LINE__); 207 } 208 "" 209 end 210 211 case undefine_invalid_object_2 212 version 300 es 213 expect compile_fail 214 both "" 215 #version 300 es 216 precision mediump float; 217 #undef __FILE__ 218 ${DECLARATIONS} 219 220 void main() 221 { 222 ${POSITION_FRAG_COLOR} = vec4(__FILE__); 223 } 224 "" 225 end 226 227 case undefine_invalid_object_3 228 version 300 es 229 expect compile_fail 230 both "" 231 #version 300 es 232 precision mediump float; 233 #undef __VERSION__ 234 ${DECLARATIONS} 235 236 void main() 237 { 238 ${POSITION_FRAG_COLOR} = vec4(__VERSION__); 239 } 240 "" 241 end 242 243 case undefine_invalid_object_4 244 version 300 es 245 expect compile_fail 246 both "" 247 #version 300 es 248 precision mediump float; 249 #undef GL_ES 250 ${DECLARATIONS} 251 252 void main() 253 { 254 ${POSITION_FRAG_COLOR} = vec4(GL_ES); 255 } 256 "" 257 end 258 259 case undefine_function 260 version 300 es 261 values { output float out0 = 1.0; } 262 both "" 263 #version 300 es 264 precision mediump float; 265 #define FUNCTION(a,b) a+b 266 #undef FUNCTION 267 #define FUNCTION(a,b) a-b 268 ${DECLARATIONS} 269 270 void main() 271 { 272 out0 = FUNCTION(3.0, 2.0); 273 ${OUTPUT} 274 } 275 "" 276 end 277 278 end # definitions 279 280 group invalid_definitions "Invalid Definition Tests" 281 282 case define_non_identifier 283 version 300 es 284 expect compile_fail 285 both "" 286 #version 300 es 287 precision mediump float; 288 #define 123 321 289 ${DECLARATIONS} 290 291 void main() 292 { 293 ${POSITION_FRAG_COLOR} = vec4(1.0); 294 } 295 "" 296 end 297 298 case undef_non_identifier_1 299 version 300 es 300 expect compile_fail 301 both "" 302 #version 300 es 303 precision mediump float; 304 #undef 123 305 ${DECLARATIONS} 306 307 void main() 308 { 309 ${POSITION_FRAG_COLOR} = vec4(1.0); 310 } 311 "" 312 end 313 314 case undef_non_identifier_2 315 version 300 es 316 expect compile_fail 317 both "" 318 #version 300 es 319 precision mediump float; 320 #undef foo.bar 321 ${DECLARATIONS} 322 323 void main() 324 { 325 ${POSITION_FRAG_COLOR} = vec4(1.0); 326 } 327 "" 328 end 329 330 331 end # invalid_definitions 332 333 group object_redefinitions "Object Redefinition Tests" 334 335 case invalid_object_ident 336 version 300 es 337 expect compile_fail 338 both "" 339 #version 300 es 340 precision mediump float; 341 ${DECLARATIONS} 342 # define AAA 2.0 343 # define AAAA 2.1 344 # define VALUE (AAA - 1.0) 345 # define VALUE (AAAA - 1.0) 346 347 void main() 348 { 349 ${POSITION_FRAG_COLOR} = vec4(VALUE); 350 } 351 "" 352 end 353 354 case invalid_object_whitespace 355 version 300 es 356 expect compile_fail 357 both "" 358 #version 300 es 359 precision mediump float; 360 ${DECLARATIONS} 361 # define AAA 2.0 362 # define VALUE (AAA - 1.0) 363 # define VALUE (AAA- 1.0) 364 365 void main() 366 { 367 ${POSITION_FRAG_COLOR} = vec4(VALUE); 368 } 369 "" 370 end 371 372 case invalid_object_op 373 version 300 es 374 expect compile_fail 375 both "" 376 #version 300 es 377 precision mediump float; 378 ${DECLARATIONS} 379 # define AAA 2.0 380 # define VALUE (AAA - 1.0) 381 # define VALUE (AAA + 1.0) 382 383 void main() 384 { 385 ${POSITION_FRAG_COLOR} = vec4(VALUE); 386 } 387 "" 388 end 389 390 case invalid_object_floatval_1 391 version 300 es 392 expect compile_fail 393 both "" 394 #version 300 es 395 precision mediump float; 396 ${DECLARATIONS} 397 # define AAA 2.0 398 # define VALUE (AAA - 1.0) 399 # define VALUE (AAA - 1.1) 400 401 void main() 402 { 403 ${POSITION_FRAG_COLOR} = vec4(VALUE); 404 } 405 "" 406 end 407 408 case invalid_object_floatval_2 409 version 300 es 410 expect compile_fail 411 both "" 412 #version 300 es 413 precision mediump float; 414 ${DECLARATIONS} 415 # define AAA 2.0 416 # define VALUE (AAA - 1.0) 417 # define VALUE (AAA - 1.0e-1) 418 419 void main() 420 { 421 ${POSITION_FRAG_COLOR} = vec4(VALUE); 422 } 423 "" 424 end 425 426 case invalid_object_intval_1 427 version 300 es 428 expect compile_fail 429 both "" 430 #version 300 es 431 precision mediump float; 432 ${DECLARATIONS} 433 # define AAA 2 434 # define VALUE (AAA - 1) 435 # define VALUE (AAA - 2) 436 437 void main() 438 { 439 ${POSITION_FRAG_COLOR} = vec4(VALUE); 440 } 441 "" 442 end 443 444 case invalid_object_intval_2 445 version 300 es 446 expect compile_fail 447 both "" 448 #version 300 es 449 precision mediump float; 450 ${DECLARATIONS} 451 # define AAA 2 452 # define VALUE (AAA - 1) 453 # define VALUE (AAA - 0x1) 454 455 void main() 456 { 457 ${POSITION_FRAG_COLOR} = vec4(VALUE); 458 } 459 "" 460 end 461 462 case redefine_object_1 463 version 300 es 464 values { output float out0 = 6.0; } 465 466 both "" 467 #version 300 es 468 precision mediump float; 469 ${DECLARATIONS} 470 # define VAL1 1.0 471 #define VAL2 2.0 472 473 #define RES2 (RES1 * VAL2) 474 #define RES1 (VAL2 / VAL1) 475 #define RES2 (RES1 * VAL2) 476 #define VALUE (RES2 + RES1) 477 478 void main() 479 { 480 out0 = VALUE; 481 ${OUTPUT} 482 } 483 "" 484 end 485 486 case redefine_object_ifdef 487 version 300 es 488 values { output float out0 = 1.0; } 489 490 both "" 491 #version 300 es 492 precision mediump float; 493 ${DECLARATIONS} 494 #define ADEFINE 1 495 #define ADEFINE 1 496 497 #ifdef ADEFINE 498 #define VALUE 1.0 499 #else 500 #define VALUE 0.0 501 #endif 502 503 void main() 504 { 505 out0 = VALUE; 506 ${OUTPUT} 507 } 508 "" 509 end 510 511 case redefine_object_undef_ifdef 512 version 300 es 513 values { output float out0 = 1.0; } 514 515 both "" 516 #version 300 es 517 precision mediump float; 518 ${DECLARATIONS} 519 #define ADEFINE 1 520 #define ADEFINE 1 521 #undef ADEFINE 522 523 #ifdef ADEFINE 524 #define VALUE 0.0 525 #else 526 #define VALUE 1.0 527 #endif 528 529 void main() 530 { 531 out0 = VALUE; 532 ${OUTPUT} 533 } 534 "" 535 end 536 537 case redefine_object_ifndef 538 version 300 es 539 values { output float out0 = 1.0; } 540 541 both "" 542 #version 300 es 543 precision mediump float; 544 ${DECLARATIONS} 545 #define ADEFINE 1 546 #define ADEFINE 1 547 548 #ifndef ADEFINE 549 #define VALUE 0.0 550 #else 551 #define VALUE 1.0 552 #endif 553 554 void main() 555 { 556 out0 = VALUE; 557 ${OUTPUT} 558 } 559 "" 560 end 561 562 case redefine_object_defined_1 563 version 300 es 564 values { output float out0 = 1.0; } 565 566 both "" 567 #version 300 es 568 precision mediump float; 569 ${DECLARATIONS} 570 #define ADEFINE 1 571 #define ADEFINE 1 572 573 #if defined(ADEFINE) 574 #define VALUE 1.0 575 #else 576 #define VALUE 0.0 577 #endif 578 579 void main() 580 { 581 out0 = VALUE; 582 ${OUTPUT} 583 } 584 "" 585 end 586 587 case redefine_object_defined_2 588 version 300 es 589 values { output float out0 = 1.0; } 590 591 both "" 592 #version 300 es 593 precision mediump float; 594 ${DECLARATIONS} 595 #define ADEFINE 1 596 #define ADEFINE 1 597 598 #if defined ADEFINE 599 #define VALUE 1.0 600 #else 601 #define VALUE 0.0 602 #endif 603 604 void main() 605 { 606 out0 = VALUE; 607 ${OUTPUT} 608 } 609 "" 610 end 611 612 case redefine_object_comment 613 version 300 es 614 values { output float out0 = 6.0; } 615 616 both "" 617 #version 300 es 618 precision mediump float; 619 ${DECLARATIONS} 620 # define VAL1 1.0 621 #define VAL2 2.0 622 623 #define RES2 /* fdsjklfdsjkl dsfjkhfdsjkh fdsjklhfdsjkh */ (RES1 * VAL2) 624 #define RES1 (VAL2 / VAL1) 625 #define RES2 /* ewrlkjhsadf */ (RES1 * VAL2) 626 #define VALUE (RES2 + RES1) 627 628 void main() 629 { 630 out0 = VALUE; 631 ${OUTPUT} 632 } 633 "" 634 end 635 636 case redefine_object_multiline_comment 637 version 300 es 638 values { output float out0 = 6.0; } 639 640 both "" 641 #version 300 es 642 precision mediump float; 643 ${DECLARATIONS} 644 # define VAL1 1.0 645 #define VAL2 2.0 646 647 #define RES2 /* fdsjklfdsjkl 648 dsfjkhfdsjkh 649 fdsjklhfdsjkh */ (RES1 * VAL2) 650 #define RES1 (VAL2 / VAL1) 651 #define RES2 /* ewrlkjhsadf */ (RES1 * VAL2) 652 #define VALUE (RES2 + RES1) 653 654 void main() 655 { 656 out0 = VALUE; 657 ${OUTPUT} 658 } 659 "" 660 end 661 662 end # object_redefinitions 663 664 group invalid_redefinitions "Invalid Redefinitions Tests" 665 666 case invalid_identifier_2 667 version 300 es 668 expect compile_fail 669 both "" 670 #version 300 es 671 precision mediump float; 672 ${DECLARATIONS} 673 # define GL_VALUE 1.0 674 675 void main() 676 { 677 ${POSITION_FRAG_COLOR} = vec4(GL_VALUE); 678 } 679 "" 680 end 681 682 end # invalid_redefinitions 683 684 group comments "Comment Tests" 685 686 case multiline_comment_define 687 version 300 es 688 values { output float out0 = 4.2; } 689 both "" 690 #version 300 es 691 precision mediump float; 692 ${DECLARATIONS} 693 #define VALUE /* current 694 value */ 4.2 695 696 void main() 697 { 698 out0 = VALUE; 699 ${OUTPUT} 700 } 701 "" 702 end 703 704 case nested_comment 705 version 300 es 706 values { output float out0 = 1.0; } 707 both "" 708 #version 300 es 709 precision mediump float; 710 ${DECLARATIONS} 711 void main() 712 { 713 out0 = 0.0; 714 /* /* */ 715 out0 = 1.0; 716 // */ 717 ${OUTPUT} 718 } 719 "" 720 end 721 722 case comment_trick_1 723 version 300 es 724 values { output float out0 = 1.0; } 725 both "" 726 #version 300 es 727 precision mediump float; 728 ${DECLARATIONS} 729 void main() 730 { 731 /*/ 732 out0 = 0.0; 733 /*/ 734 out0 = 1.0; 735 /**/ 736 ${OUTPUT} 737 } 738 "" 739 end 740 741 case comment_trick_2 742 version 300 es 743 values { output float out0 = 1.0; } 744 both "" 745 #version 300 es 746 precision mediump float; 747 ${DECLARATIONS} 748 void main() 749 { 750 /**/ 751 out0 = 1.0; 752 /*/ 753 out0 = 0.0; 754 /**/ 755 ${OUTPUT} 756 } 757 "" 758 end 759 760 case invalid_comment 761 version 300 es 762 expect compile_fail 763 both "" 764 #version 300 es 765 precision mediump float; 766 ${DECLARATIONS} 767 void main() 768 { 769 /* /* */ */ 770 ${POSITION_FRAG_COLOR} = 1.0; 771 } 772 "" 773 end 774 775 case unterminated_comment_1 776 version 300 es 777 expect compile_fail 778 both "" 779 #version 300 es 780 precision mediump float; 781 ${DECLARATIONS} 782 void main() 783 { 784 /* 785 } 786 "" 787 end 788 789 case unterminated_comment_2 790 version 300 es 791 expect compile_fail 792 both "" 793 #version 300 es 794 /* 795 precision mediump float; 796 ${DECLARATIONS} 797 void main() 798 { 799 } 800 "" 801 end 802 803 case backslash_in_a_comment_1 804 version 300 es 805 expect build_successful 806 both "" 807 #version 300 es 808 // \\note these are some declarations 809 precision mediump float; 810 ${DECLARATIONS} 811 // \\note this is the main function 812 void main() 813 { 814 // \\note this is a function body 815 ${OUTPUT} 816 } 817 "" 818 end 819 820 case backslash_in_a_comment_2 821 version 300 es 822 expect build_successful 823 both "" 824 #version 300 es 825 /* \\note these are some declarations */ 826 precision mediump float; 827 ${DECLARATIONS} 828 /* \\note this is the main function */ 829 void main() 830 { 831 /* \\note this is a function body */ 832 ${OUTPUT} 833 } 834 "" 835 end 836 end # comments 837 838 group line_continuation "Line Continuation Tests" 839 840 case comment 841 version 300 es 842 values { output float out0 = 1.0; } 843 both "" 844 #version 300 es 845 precision mediump float; 846 ${DECLARATIONS} 847 848 void main () 849 { 850 out0 = 1.0; 851 // comment \\ 852 out0 = -1.0; 853 ${OUTPUT} 854 } 855 "" 856 end 857 858 case define 859 version 300 es 860 values { output float out0 = 1.0; } 861 both "" 862 #version 300 es 863 precision mediump float; 864 ${DECLARATIONS} 865 #define A(X) \\ 866 (-1.0*(X)) 867 868 void main () 869 { 870 out0 = A(-1.0); 871 ${OUTPUT} 872 } 873 "" 874 end 875 876 case preprocessing_token 877 version 300 es 878 values { output float out0 = 1.0; } 879 both "" 880 #version 300 es 881 precision mediump float; 882 ${DECLARATIONS} 883 #def\\ 884 ine A(X) (-1.0*(X)) 885 886 void main () 887 { 888 out0 = A(-1.0); 889 ${OUTPUT} 890 } 891 "" 892 end 893 894 case token 895 version 300 es 896 values { output float out0 = 1.0; } 897 both "" 898 #version 300 es 899 precision mediump float; 900 ${DECLARATIONS} 901 902 void main () 903 { 904 float f\\ 905 oo = 1.0; 906 out0 = foo; 907 ${OUTPUT} 908 } 909 "" 910 end 911 912 case middle_of_line 913 version 300 es 914 values { output float out0 = 1.0; } 915 both "" 916 #version 300 es 917 precision mediump float; 918 ${DECLARATIONS} 919 #define A a \\ b 920 #define B 1.0 921 922 void main () 923 { 924 out0 = B; 925 ${OUTPUT} 926 } 927 "" 928 end 929 930 end # line_continuation 931 932 group function_definitions "Function Definitions Tests" 933 934 case same_object_and_function_param 935 version 300 es 936 values { output float out0 = 1.0; } 937 938 both "" 939 #version 300 es 940 precision mediump float; 941 ${DECLARATIONS} 942 #define VALUE 1.0 943 #define FUNCTION(VALUE, B) (VALUE-B) 944 945 void main() 946 { 947 out0 = FUNCTION(3.0, 2.0); 948 ${OUTPUT} 949 } 950 "" 951 end 952 953 case complex_func 954 version 300 es 955 values { output float out0 = 518.5; } 956 both "" 957 #version 300 es 958 precision mediump float; 959 ${DECLARATIONS} 960 #define AAA(a,b) a*(BBB(a,b)) 961 #define BBB(a,b) a-b 962 963 void main() 964 { 965 out0 = BBB(AAA(8.0/4.0, 2.0)*BBB(2.0*2.0,0.75*2.0), AAA(40.0,10.0*BBB(5.0,3.0))); 966 ${OUTPUT} 967 } 968 "" 969 end 970 971 case function_definition_with_comments 972 version 300 es 973 values { output float out0 = 3.0; } 974 both "" 975 #version 300 es 976 precision mediump float; 977 ${DECLARATIONS} 978 /* sdfljk */ #/* sdfljk */define /* sdfljk */ FUNC( /* jklsfd*/a /*sfdjklh*/, /*sdfklj */b /*sdfklj*/) a+b 979 980 void main() 981 { 982 out0 = FUNC(1.0, 2.0); 983 ${OUTPUT} 984 } 985 "" 986 end 987 988 end # function_definitions 989 990 group recursion "Recursions Tests" 991 992 case recursion_1 993 version 300 es 994 expect compile_fail 995 both "" 996 #version 300 es 997 precision mediump float; 998 ${DECLARATIONS} 999 # define AAA AAA 1000 1001 void main() 1002 { 1003 ${POSITION_FRAG_COLOR} = vec4(AAA); 1004 } 1005 "" 1006 end 1007 1008 case recursion_2 1009 version 300 es 1010 expect compile_fail 1011 both "" 1012 #version 300 es 1013 precision mediump float; 1014 ${DECLARATIONS} 1015 # define AAA BBB 1016 #define BBB AAA 1017 1018 void main() 1019 { 1020 ${POSITION_FRAG_COLOR} = vec4(AAA); 1021 } 1022 "" 1023 end 1024 1025 case recursion_3 1026 version 300 es 1027 expect compile_fail 1028 both "" 1029 #version 300 es 1030 precision mediump float; 1031 ${DECLARATIONS} 1032 # define AAA (1.0+BBB) 1033 #define BBB (2.0+AAA) 1034 1035 void main() 1036 { 1037 ${POSITION_FRAG_COLOR} = vec4(AAA); 1038 } 1039 "" 1040 end 1041 1042 case recursion_4 1043 version 300 es 1044 expect compile_fail 1045 both "" 1046 #version 300 es 1047 precision mediump float; 1048 ${DECLARATIONS} 1049 # define AAA(a) AAA(a) 1050 1051 void main() 1052 { 1053 ${POSITION_FRAG_COLOR} = vec4(AAA(1.0)); 1054 } 1055 "" 1056 end 1057 1058 case recursion_5 1059 version 300 es 1060 expect compile_fail 1061 both "" 1062 #version 300 es 1063 precision mediump float; 1064 ${DECLARATIONS} 1065 # define AAA(a, b) AAA(b, a) 1066 1067 void main() 1068 { 1069 ${POSITION_FRAG_COLOR} = vec4(AAA(1.0, 2.0)); 1070 } 1071 "" 1072 end 1073 1074 end # recursion 1075 1076 group function_redefinitions "Function Redefinition Tests" 1077 1078 case function_redefinition_1 1079 version 300 es 1080 values { output float out0 = 3.0; } 1081 both "" 1082 #version 300 es 1083 precision mediump float; 1084 # define FUNC(a,b) a+b 1085 # define FUNC( a, b) a+b 1086 1087 ${DECLARATIONS} 1088 void main() 1089 { 1090 out0 = FUNC(1.0, 2.0); 1091 ${OUTPUT} 1092 } 1093 "" 1094 end 1095 1096 case function_redefinition_2 1097 version 300 es 1098 values { output float out0 = 3.0; } 1099 both "" 1100 #version 300 es 1101 precision mediump float; 1102 # define FUNC(a,b) (a +b) 1103 # define FUNC( a, b )(a +b) 1104 1105 ${DECLARATIONS} 1106 void main() 1107 { 1108 out0 = FUNC(1.0, 2.0); 1109 ${OUTPUT} 1110 } 1111 "" 1112 end 1113 1114 case function_redefinition_3 1115 version 300 es 1116 values { output float out0 = 3.0; } 1117 both "" 1118 #version 300 es 1119 precision mediump float; 1120 # define FUNC(a,b) (a +b) 1121 # define FUNC(a,b)(a /* comment 1122 */ +b) 1123 1124 ${DECLARATIONS} 1125 void main() 1126 { 1127 out0 = FUNC(1.0, 2.0); 1128 ${OUTPUT} 1129 } 1130 "" 1131 end 1132 1133 case invalid_function_redefinition_param_1 1134 version 300 es 1135 expect compile_fail 1136 both "" 1137 #version 300 es 1138 precision mediump float; 1139 # define FUNC(a,b) a+b 1140 # define FUNC(A,b) A+b 1141 1142 ${DECLARATIONS} 1143 void main() 1144 { 1145 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0, 2.0)); 1146 } 1147 "" 1148 end 1149 1150 case invalid_function_redefinition_param_2 1151 version 300 es 1152 expect compile_fail 1153 both "" 1154 #version 300 es 1155 precision mediump float; 1156 # define FUNC(a,b) a+b 1157 # define FUNC(a,b,c) a+b+c 1158 1159 ${DECLARATIONS} 1160 void main() 1161 { 1162 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0, 2.0, 3.0)); 1163 } 1164 "" 1165 end 1166 1167 case invalid_function_redefinition_param_3 1168 version 300 es 1169 expect compile_fail 1170 both "" 1171 #version 300 es 1172 precision mediump float; 1173 # define FUNC(a,b) a+b 1174 # define FUNC(a,b) b+a 1175 1176 ${DECLARATIONS} 1177 void main() 1178 { 1179 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0, 2.0)); 1180 } 1181 "" 1182 end 1183 1184 end # functions_redefinitions 1185 1186 group invalid_function_definitions "Invalid Function Definition Tests" 1187 1188 case arguments_1 1189 version 300 es 1190 expect compile_fail 1191 both "" 1192 #version 300 es 1193 precision mediump float; 1194 # define FUNC(a,b) a+b 1195 1196 ${DECLARATIONS} 1197 void main() 1198 { 1199 ${POSITION_FRAG_COLOR} = vec4(FUNC); 1200 } 1201 "" 1202 end 1203 1204 case arguments_2 1205 version 300 es 1206 expect compile_fail 1207 both "" 1208 #version 300 es 1209 precision mediump float; 1210 # define FUNC(a,b) a+b 1211 1212 ${DECLARATIONS} 1213 void main() 1214 { 1215 ${POSITION_FRAG_COLOR} = vec4(FUNC()); 1216 } 1217 "" 1218 end 1219 1220 case arguments_3 1221 version 300 es 1222 expect compile_fail 1223 both "" 1224 #version 300 es 1225 precision mediump float; 1226 # define FUNC(a,b) a+b 1227 1228 ${DECLARATIONS} 1229 void main() 1230 { 1231 ${POSITION_FRAG_COLOR} = vec4(FUNC(((); 1232 } 1233 "" 1234 end 1235 1236 case arguments_4 1237 version 300 es 1238 expect compile_fail 1239 both "" 1240 #version 300 es 1241 precision mediump float; 1242 # define FUNC(a,b) a+b 1243 1244 ${DECLARATIONS} 1245 void main() 1246 { 1247 ${POSITION_FRAG_COLOR} = vec4(FUNC)); 1248 } 1249 "" 1250 end 1251 1252 case arguments_5 1253 version 300 es 1254 expect compile_fail 1255 both "" 1256 #version 300 es 1257 precision mediump float; 1258 # define FUNC(a,b) a+b 1259 1260 ${DECLARATIONS} 1261 void main() 1262 { 1263 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0)); 1264 } 1265 "" 1266 end 1267 1268 case arguments_6 1269 version 300 es 1270 expect compile_fail 1271 both "" 1272 #version 300 es 1273 precision mediump float; 1274 # define FUNC(a,b) a+b 1275 1276 ${DECLARATIONS} 1277 void main() 1278 { 1279 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0); 1280 } 1281 "" 1282 end 1283 1284 case arguments_7 1285 version 300 es 1286 expect compile_fail 1287 both "" 1288 #version 300 es 1289 precision mediump float; 1290 # define FUNC(a,b) a+b 1291 1292 ${DECLARATIONS} 1293 void main() 1294 { 1295 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,)); 1296 } 1297 "" 1298 end 1299 1300 case arguments_8 1301 version 300 es 1302 expect compile_fail 1303 both "" 1304 #version 300 es 1305 precision mediump float; 1306 # define FUNC(a,b) a+b 1307 1308 ${DECLARATIONS} 1309 void main() 1310 { 1311 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0, 2.0, 3.0)); 1312 } 1313 "" 1314 end 1315 1316 case unique_param_name 1317 version 300 es 1318 expect compile_fail 1319 both "" 1320 #version 300 es 1321 precision mediump float; 1322 # define FUNC(a,a) a+a 1323 1324 ${DECLARATIONS} 1325 void main() 1326 { 1327 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0)); 1328 } 1329 "" 1330 end 1331 1332 case argument_list_1 1333 version 300 es 1334 expect compile_fail 1335 both "" 1336 #version 300 es 1337 precision mediump float; 1338 # define FUNC(a b) a+b 1339 1340 ${DECLARATIONS} 1341 void main() 1342 { 1343 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0)); 1344 } 1345 "" 1346 end 1347 1348 case argument_list_2 1349 version 300 es 1350 expect compile_fail 1351 both "" 1352 #version 300 es 1353 precision mediump float; 1354 # define FUNC(a + b) a+b 1355 1356 ${DECLARATIONS} 1357 void main() 1358 { 1359 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0)); 1360 } 1361 "" 1362 end 1363 1364 case argument_list_3 1365 version 300 es 1366 expect compile_fail 1367 both "" 1368 #version 300 es 1369 precision mediump float; 1370 # define FUNC(,a,b) a+b 1371 1372 ${DECLARATIONS} 1373 void main() 1374 { 1375 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0)); 1376 } 1377 "" 1378 end 1379 1380 case no_closing_parenthesis_1 1381 version 300 es 1382 expect compile_fail 1383 both "" 1384 #version 300 es 1385 precision mediump float; 1386 # define FUNC( 1387 1388 ${DECLARATIONS} 1389 void main() 1390 { 1391 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0)); 1392 } 1393 "" 1394 end 1395 1396 case no_closing_parenthesis_2 1397 version 300 es 1398 expect compile_fail 1399 both "" 1400 #version 300 es 1401 precision mediump float; 1402 # define FUNC(A a+b 1403 1404 ${DECLARATIONS} 1405 void main() 1406 { 1407 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0)); 1408 } 1409 "" 1410 end 1411 1412 case no_closing_parenthesis_3 1413 version 300 es 1414 expect compile_fail 1415 both "" 1416 #version 300 es 1417 precision mediump float; 1418 # define FUNC(A,B,C a+b 1419 1420 ${DECLARATIONS} 1421 void main() 1422 { 1423 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0)); 1424 } 1425 "" 1426 end 1427 1428 case no_closing_parenthesis_4 1429 version 300 es 1430 expect compile_fail 1431 both "" 1432 #version 300 es 1433 precision mediump float; 1434 # define FUNC( 1435 "" 1436 end 1437 1438 end # invalid_function_definitions 1439 1440 group semantic "Semantic Tests" 1441 1442 case ops_as_arguments 1443 version 300 es 1444 values { output float out0 = 20.0; } 1445 both "" 1446 #version 300 es 1447 precision mediump float; 1448 ${DECLARATIONS} 1449 #define FOO(a, b) (1 a 9) b 2 1450 1451 void main() 1452 { 1453 out0 = float(FOO(+, *)); 1454 ${OUTPUT} 1455 } 1456 "" 1457 end 1458 1459 case correct_order 1460 version 300 es 1461 values { output float out0 = 1.0; } 1462 both "" 1463 #version 300 es 1464 precision mediump float; 1465 ${DECLARATIONS} 1466 #define FUNC(A) A 1467 #define A 2.0 1468 1469 void main() 1470 { 1471 out0 = FUNC(A - 1.0); 1472 ${OUTPUT} 1473 } 1474 "" 1475 end 1476 1477 end # semantic 1478 1479 group predefined_macros "Predefined Macros Tests" 1480 1481 case version 1482 version 300 es 1483 values { output float out0 = 300.0; } 1484 both "" 1485 #version 300 es 1486 precision mediump float; 1487 ${DECLARATIONS} 1488 void main() 1489 { 1490 #define AAA __VERSION__ 1491 out0 = float(AAA); 1492 ${OUTPUT} 1493 } 1494 "" 1495 end 1496 1497 case gl_es_1 1498 version 300 es 1499 values { output float out0 = 1.0; } 1500 both "" 1501 #version 300 es 1502 precision mediump float; 1503 ${DECLARATIONS} 1504 1505 void main() 1506 { 1507 out0 = float(GL_ES); 1508 ${OUTPUT} 1509 } 1510 "" 1511 end 1512 1513 case gl_es_2 1514 version 300 es 1515 values { output float out0 = 1.0; } 1516 both "" 1517 #version 300 es 1518 precision mediump float; 1519 ${DECLARATIONS} 1520 #define AAA(A) A 1521 1522 void main() 1523 { 1524 out0 = float(AAA(GL_ES)); 1525 ${OUTPUT} 1526 } 1527 "" 1528 end 1529 1530 case line_1 1531 version 300 es 1532 values { output float out0 = 2.0; } 1533 both "" 1534 #version 300 es 1535 const mediump int line = __LINE__; 1536 precision mediump float; 1537 ${DECLARATIONS} 1538 void main() 1539 { 1540 out0 = float(line); 1541 ${OUTPUT} 1542 } 1543 "" 1544 end 1545 1546 case line_2 1547 version 300 es 1548 # Note: Arguments are macro replaced in the first stage. 1549 # Macro replacement list is expanded in the last stage. 1550 values { output vec4 out0 = vec4(12.0, 12.0, 10.0, 11.0); } 1551 1552 both "" 1553 #version 300 es 1554 precision mediump float; 1555 ${DECLARATIONS:single-line} 1556 #define BBB __LINE__, /* 1557 */ __LINE__ 1558 #define AAA(a,b) BBB, a, b 1559 1560 void main() 1561 { 1562 out0 = vec4(AAA(__LINE__, 1563 __LINE__ 1564 )); 1565 ${OUTPUT} 1566 } 1567 "" 1568 end 1569 1570 case file 1571 version 300 es 1572 values { output float out0 = 0.0; } 1573 both "" 1574 #version 300 es 1575 precision mediump float; 1576 ${DECLARATIONS} 1577 void main() 1578 { 1579 out0 = float(__FILE__); 1580 ${OUTPUT} 1581 } 1582 "" 1583 end 1584 1585 case if_gl_es 1586 version 300 es 1587 values { output float out0 = 1.0; } 1588 both "" 1589 #version 300 es 1590 precision mediump float; 1591 ${DECLARATIONS} 1592 void main() 1593 { 1594 #if GL_ES 1595 out0 = 1.0; 1596 #else 1597 out0 = -1.0; 1598 #endif 1599 ${OUTPUT} 1600 } 1601 "" 1602 end 1603 1604 case if_version 1605 version 300 es 1606 values { output float out0 = 1.0; } 1607 both "" 1608 #version 300 es 1609 precision mediump float; 1610 ${DECLARATIONS} 1611 void main() 1612 { 1613 #if __VERSION__ == 300 1614 out0 = 1.0; 1615 #else 1616 out0 = -1.0; 1617 #endif 1618 ${OUTPUT} 1619 } 1620 "" 1621 end 1622 1623 end # predefined_macros 1624 1625 group conditional_inclusion "Conditional Inclusion Tests" 1626 1627 case basic_1 1628 version 300 es 1629 values { output float out0 = 1.0; } 1630 both "" 1631 #version 300 es 1632 precision mediump float; 1633 ${DECLARATIONS} 1634 void main() 1635 { 1636 #define AAA asdf 1637 1638 #if defined AAA && !defined(BBB) 1639 out0 = 1.0; 1640 #else 1641 out0 = 0.0; 1642 #endif 1643 ${OUTPUT} 1644 } 1645 "" 1646 end 1647 1648 case basic_2 1649 version 300 es 1650 values { output float out0 = 1.0; } 1651 # Note: this is expected to fail contrary to native dEQP, 1652 # see https://github.com/KhronosGroup/WebGL/pull/1523 1653 expect compile_fail 1654 both "" 1655 #version 300 es 1656 precision mediump float; 1657 ${DECLARATIONS} 1658 void main() 1659 { 1660 #define AAA defined(BBB) 1661 1662 #if !AAA 1663 out0 = 1.0; 1664 #else 1665 out0 = 0.0; 1666 #endif 1667 ${OUTPUT} 1668 } 1669 "" 1670 end 1671 1672 case defined_macro_defined_test 1673 version 300 es 1674 values { output float out0 = 1.0; } 1675 # Note: this is expected to fail contrary to native dEQP, 1676 # see https://github.com/KhronosGroup/WebGL/pull/1523 1677 expect compile_fail 1678 both "" 1679 #version 300 es 1680 precision mediump float; 1681 ${DECLARATIONS} 1682 void main() 1683 { 1684 #define AAA defined 1685 1686 #if AAA AAA 1687 out0 = 1.0; 1688 #else 1689 out0 = 0.0; 1690 #endif 1691 ${OUTPUT} 1692 } 1693 "" 1694 end 1695 1696 case defined_macro_undef 1697 version 300 es 1698 values { output float out0 = 1.0; } 1699 # Note: this is expected to fail contrary to native dEQP, 1700 # see https://github.com/KhronosGroup/WebGL/pull/1523 1701 expect compile_fail 1702 both "" 1703 #version 300 es 1704 precision mediump float; 1705 ${DECLARATIONS} 1706 void main() 1707 { 1708 #define BBB 1 1709 #define AAA defined(BBB) 1710 #undef BBB 1711 1712 #if !AAA 1713 out0 = 1.0; 1714 #else 1715 out0 = 0.0; 1716 #endif 1717 ${OUTPUT} 1718 } 1719 "" 1720 end 1721 1722 case define_defined 1723 version 300 es 1724 values { output float out0 = 1.0; } 1725 # Note: this is expected to fail contrary to native dEQP, 1726 # see https://github.com/KhronosGroup/WebGL/pull/1523 1727 expect compile_fail 1728 both "" 1729 #version 300 es 1730 precision mediump float; 1731 ${DECLARATIONS} 1732 void main() 1733 { 1734 #define CCC 1 1735 #define defined BBB 1736 #define AAA defined 1737 1738 #if AAA CCC 1739 out0 = 1.0; 1740 #else 1741 out0 = 0.0; 1742 #endif 1743 ${OUTPUT} 1744 } 1745 "" 1746 end 1747 1748 case define_defined_outside_if 1749 version 300 es 1750 values { output float out0 = 1.0; } 1751 # Note: this is expected to fail contrary to native dEQP, 1752 # see https://github.com/KhronosGroup/WebGL/pull/1523 1753 expect compile_fail 1754 both "" 1755 #version 300 es 1756 precision mediump float; 1757 ${DECLARATIONS} 1758 void main() 1759 { 1760 #define CCC - 0.5 1761 #define defined 0.5 1762 #define AAA defined 1763 out0 = 1.0 - (AAA CCC); 1764 ${OUTPUT} 1765 } 1766 "" 1767 end 1768 1769 case defined_invalid_before_all_macros_replaced 1770 version 300 es 1771 expect compile_fail 1772 values { output float out0 = 1.0; } 1773 both "" 1774 #version 300 es 1775 precision mediump float; 1776 ${DECLARATIONS} 1777 void main() 1778 { 1779 #define FOO 1 1780 #define OPEN defined( 1781 #define CLOSE FOO) 1782 1783 #if OPEN CLOSE 1784 out0 = 1.0; 1785 #else 1786 out0 = 0.0; 1787 #endif 1788 ${OUTPUT} 1789 } 1790 "" 1791 end 1792 1793 case basic_3 1794 version 300 es 1795 values { output float out0 = 1.0; } 1796 both "" 1797 #version 300 es 1798 precision mediump float; 1799 ${DECLARATIONS} 1800 void main() 1801 { 1802 #if 0 1803 out0 = -1.0; 1804 #elif 0 1805 out0 = -2.0; 1806 #elif 1 1807 out0 = 1.0; 1808 #else 1809 out0 = -3.0; 1810 #endif 1811 ${OUTPUT} 1812 } 1813 "" 1814 end 1815 1816 case basic_4 1817 version 300 es 1818 values { output float out0 = 1.0; } 1819 both "" 1820 #version 300 es 1821 precision mediump float; 1822 ${DECLARATIONS} 1823 void main() 1824 { 1825 #if 0 1826 out0 = -1.0; 1827 #elif 0 1828 out0 = -2.0; 1829 #else 1830 out0 = 1.0; 1831 #endif 1832 ${OUTPUT} 1833 } 1834 "" 1835 end 1836 1837 case basic_5 1838 version 300 es 1839 values { output float out0 = 1.0; } 1840 both "" 1841 #version 300 es 1842 precision mediump float; 1843 ${DECLARATIONS} 1844 void main() 1845 { 1846 #if 1 1847 out0 = 1.0; 1848 #elif 0 1849 out0 = -2.0; 1850 #else 1851 out0 = -1.0; 1852 #endif 1853 ${OUTPUT} 1854 } 1855 "" 1856 end 1857 1858 case unary_ops_1 1859 version 300 es 1860 values { output float out0 = 1.0; } 1861 both "" 1862 #version 300 es 1863 precision mediump float; 1864 ${DECLARATIONS} 1865 void main() 1866 { 1867 #if !((~2 >> 1) & 1) 1868 out0 = 1.0; 1869 #else 1870 out0 = -1.0; 1871 #endif 1872 ${OUTPUT} 1873 } 1874 "" 1875 end 1876 1877 case unary_ops_2 1878 version 300 es 1879 values { output float out0 = 1.0; } 1880 both "" 1881 #version 300 es 1882 precision mediump float; 1883 ${DECLARATIONS} 1884 void main() 1885 { 1886 #if !((~(- - - - - 1 + + + + + +1) >> 1) & 1) 1887 out0 = -1.0; 1888 #else 1889 out0 = 1.0; 1890 #endif 1891 ${OUTPUT} 1892 } 1893 "" 1894 end 1895 1896 end # conditional_inclusion 1897 1898 group invalid_ops "Invalid Operations Tests" 1899 1900 case invalid_op_1 1901 version 300 es 1902 expect compile_fail 1903 both "" 1904 #version 300 es 1905 precision mediump float; 1906 ${DECLARATIONS} 1907 void main() 1908 { 1909 #if !((~(+ ++1 - - - -1) >> 1) & 1) 1910 ${POSITION_FRAG_COLOR} = vec4(-1.0); 1911 #else 1912 ${POSITION_FRAG_COLOR} = vec4(1.0); 1913 #endif 1914 } 1915 "" 1916 end 1917 1918 case invalid_op_2 1919 version 300 es 1920 expect compile_fail 1921 both "" 1922 #version 300 es 1923 precision mediump float; 1924 ${DECLARATIONS} 1925 void main() 1926 { 1927 #if !((~(+ + +1 - -- -1) >> 1) & 1) 1928 ${POSITION_FRAG_COLOR} = vec4(-1.0); 1929 #else 1930 ${POSITION_FRAG_COLOR} = vec4(1.0); 1931 #endif 1932 } 1933 "" 1934 end 1935 1936 case invalid_defined_expected_identifier_1 1937 version 300 es 1938 expect compile_fail 1939 both "" 1940 #version 300 es 1941 precision mediump float; 1942 #define AAA 1 1943 1944 ${DECLARATIONS} 1945 void main() 1946 { 1947 #if defined 1948 ${POSITION_FRAG_COLOR} = vec4(1.0); 1949 #endif 1950 } 1951 "" 1952 end 1953 1954 case invalid_defined_expected_identifier_2 1955 version 300 es 1956 expect compile_fail 1957 both "" 1958 #version 300 es 1959 precision mediump float; 1960 #define AAA 1 1961 1962 ${DECLARATIONS} 1963 void main() 1964 { 1965 #if defined() 1966 ${POSITION_FRAG_COLOR} = vec4(1.0); 1967 #endif 1968 } 1969 "" 1970 end 1971 1972 case invalid_defined_expected_identifier_3 1973 version 300 es 1974 expect compile_fail 1975 both "" 1976 #version 300 es 1977 precision mediump float; 1978 #define AAA 1 1979 1980 ${DECLARATIONS} 1981 void main() 1982 { 1983 #if defined( 1984 ${POSITION_FRAG_COLOR} = vec4(1.0); 1985 #endif 1986 } 1987 "" 1988 end 1989 1990 case invalid_defined_expected_identifier_4 1991 version 300 es 1992 expect compile_fail 1993 both "" 1994 #version 300 es 1995 precision mediump float; 1996 #define AAA 1 1997 1998 ${DECLARATIONS} 1999 void main() 2000 { 2001 #if defined) 2002 ${POSITION_FRAG_COLOR} = vec4(1.0); 2003 #endif 2004 } 2005 "" 2006 end 2007 2008 case invalid_defined_expected_identifier_5 2009 version 300 es 2010 expect compile_fail 2011 both "" 2012 #version 300 es 2013 precision mediump float; 2014 #define AAA 1 2015 2016 ${DECLARATIONS} 2017 void main() 2018 { 2019 #if defined((AAA)) 2020 ${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0); 2021 #endif 2022 } 2023 "" 2024 end 2025 2026 case invalid_defined_expected_rparen 2027 version 300 es 2028 expect compile_fail 2029 both "" 2030 #version 300 es 2031 precision mediump float; 2032 #define AAA 1 2033 2034 ${DECLARATIONS} 2035 void main() 2036 { 2037 #if defined(AAA 2038 ${POSITION_FRAG_COLOR} = vec4(1.0); 2039 #endif 2040 } 2041 "" 2042 end 2043 2044 case defined_define 2045 version 300 es 2046 values { output float out0 = 1.0; } 2047 both "" 2048 #version 300 es 2049 precision mediump float; 2050 ${DECLARATIONS} 2051 #define define 1 2052 #define AAA 1.0 2053 2054 void main() 2055 { 2056 out0 = AAA; 2057 ${OUTPUT} 2058 } 2059 "" 2060 end 2061 2062 end # invalid_ops 2063 2064 group undefined_identifiers "Undefined Identifiers Tests" 2065 2066 case valid_undefined_identifier_1 2067 version 300 es 2068 values { output float out0 = 1.0; } 2069 both "" 2070 #version 300 es 2071 precision mediump float; 2072 ${DECLARATIONS} 2073 void main() 2074 { 2075 #if 1 || AAA 2076 out0 = 1.0; 2077 #else 2078 out0 = -1.0; 2079 #endif 2080 ${OUTPUT} 2081 } 2082 "" 2083 end 2084 2085 case valid_undefined_identifier_2 2086 version 300 es 2087 values { output float out0 = 1.0; } 2088 both "" 2089 #version 300 es 2090 precision mediump float; 2091 ${DECLARATIONS} 2092 void main() 2093 { 2094 #if 0 && AAA 2095 out0 = -1.0; 2096 #else 2097 out0 = 1.0; 2098 #endif 2099 ${OUTPUT} 2100 } 2101 "" 2102 end 2103 2104 case undefined_identifier_1 2105 version 300 es 2106 expect compile_fail 2107 both "" 2108 #version 300 es 2109 precision mediump float; 2110 ${DECLARATIONS} 2111 void main() 2112 { 2113 #if 1 - CCC + (-AAA || BBB) 2114 ${POSITION_FRAG_COLOR} = vec4(1.0); 2115 #else 2116 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2117 #endif 2118 } 2119 "" 2120 end 2121 2122 case undefined_identifier_2 2123 version 300 es 2124 expect compile_fail 2125 both "" 2126 #version 300 es 2127 precision mediump float; 2128 ${DECLARATIONS} 2129 void main() 2130 { 2131 #if !A 2132 ${POSITION_FRAG_COLOR} = vec4(1.0); 2133 #else 2134 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2135 #endif 2136 } 2137 "" 2138 end 2139 2140 case undefined_identifier_3 2141 version 300 es 2142 expect compile_fail 2143 both "" 2144 #version 300 es 2145 precision mediump float; 2146 ${DECLARATIONS} 2147 void main() 2148 { 2149 #if -A 2150 ${POSITION_FRAG_COLOR} = vec4(1.0); 2151 #else 2152 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2153 #endif 2154 } 2155 "" 2156 end 2157 2158 case undefined_identifier_4 2159 version 300 es 2160 expect compile_fail 2161 both "" 2162 #version 300 es 2163 precision mediump float; 2164 ${DECLARATIONS} 2165 void main() 2166 { 2167 #if ~A 2168 ${POSITION_FRAG_COLOR} = vec4(1.0); 2169 #else 2170 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2171 #endif 2172 } 2173 "" 2174 end 2175 2176 case undefined_identifier_5 2177 version 300 es 2178 expect compile_fail 2179 both "" 2180 #version 300 es 2181 precision mediump float; 2182 ${DECLARATIONS} 2183 void main() 2184 { 2185 #if A && B 2186 ${POSITION_FRAG_COLOR} = vec4(1.0); 2187 #else 2188 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2189 #endif 2190 } 2191 "" 2192 end 2193 2194 case undefined_identifier_6 2195 version 300 es 2196 expect compile_fail 2197 both "" 2198 #version 300 es 2199 precision mediump float; 2200 ${DECLARATIONS} 2201 void main() 2202 { 2203 #define A 1 2204 #if A && B 2205 ${POSITION_FRAG_COLOR} = vec4(1.0); 2206 #else 2207 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2208 #endif 2209 } 2210 "" 2211 end 2212 2213 case undefined_identifier_7 2214 version 300 es 2215 expect compile_fail 2216 both "" 2217 #version 300 es 2218 precision mediump float; 2219 ${DECLARATIONS} 2220 void main() 2221 { 2222 #define B 1 2223 #if A && B 2224 ${POSITION_FRAG_COLOR} = vec4(1.0); 2225 #else 2226 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2227 #endif 2228 } 2229 "" 2230 end 2231 2232 case undefined_identifier_8 2233 version 300 es 2234 expect compile_fail 2235 both "" 2236 #version 300 es 2237 precision mediump float; 2238 ${DECLARATIONS} 2239 void main() 2240 { 2241 #define B 1 2242 #define A 2 2243 #undef A 2244 #if A && B 2245 ${POSITION_FRAG_COLOR} = vec4(1.0); 2246 #else 2247 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2248 #endif 2249 } 2250 "" 2251 end 2252 2253 case undefined_identifier_9 2254 version 300 es 2255 expect compile_fail 2256 both "" 2257 #version 300 es 2258 precision mediump float; 2259 ${DECLARATIONS} 2260 void main() 2261 { 2262 #if A || B 2263 ${POSITION_FRAG_COLOR} = vec4(1.0); 2264 #else 2265 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2266 #endif 2267 } 2268 "" 2269 end 2270 2271 case undefined_identifier_10 2272 version 300 es 2273 expect compile_fail 2274 both "" 2275 #version 300 es 2276 precision mediump float; 2277 ${DECLARATIONS} 2278 void main() 2279 { 2280 #define A 0 2281 #if A || B 2282 ${POSITION_FRAG_COLOR} = vec4(1.0); 2283 #else 2284 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2285 #endif 2286 } 2287 "" 2288 end 2289 2290 case undefined_identifier_11 2291 version 300 es 2292 expect compile_fail 2293 both "" 2294 #version 300 es 2295 precision mediump float; 2296 ${DECLARATIONS} 2297 void main() 2298 { 2299 #define A 0 2300 #define B 2 2301 #undef B 2302 #if A || B 2303 ${POSITION_FRAG_COLOR} = vec4(1.0); 2304 #else 2305 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2306 #endif 2307 } 2308 "" 2309 end 2310 2311 case undefined_identifier_12 2312 version 300 es 2313 expect compile_fail 2314 both "" 2315 #version 300 es 2316 precision mediump float; 2317 ${DECLARATIONS} 2318 void main() 2319 { 2320 #define B 1 2321 #if A || B 2322 ${POSITION_FRAG_COLOR} = vec4(1.0); 2323 #else 2324 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2325 #endif 2326 } 2327 "" 2328 end 2329 2330 end # undefined_identifiers 2331 2332 group invalid_conditionals "Invalid Conditionals Tests" 2333 2334 case empty_if 2335 version 300 es 2336 expect compile_fail 2337 both "" 2338 #version 300 es 2339 precision mediump float; 2340 ${DECLARATIONS} 2341 void main() 2342 { 2343 #if 2344 ${POSITION_FRAG_COLOR} = vec4(1.0); 2345 } 2346 "" 2347 end 2348 2349 case empty_ifdef 2350 version 300 es 2351 expect compile_fail 2352 both "" 2353 #version 300 es 2354 precision mediump float; 2355 ${DECLARATIONS} 2356 void main() 2357 { 2358 #ifdef 2359 ${POSITION_FRAG_COLOR} = vec4(1.0); 2360 } 2361 "" 2362 end 2363 2364 case empty_ifndef 2365 version 300 es 2366 expect compile_fail 2367 both "" 2368 #version 300 es 2369 precision mediump float; 2370 ${DECLARATIONS} 2371 void main() 2372 { 2373 #ifndef 2374 ${POSITION_FRAG_COLOR} = vec4(1.0); 2375 } 2376 "" 2377 end 2378 2379 case invalid_ifdef 2380 version 300 es 2381 expect compile_fail 2382 both "" 2383 #version 300 es 2384 precision mediump float; 2385 ${DECLARATIONS} 2386 void main() 2387 { 2388 #ifdef 1 2389 ${POSITION_FRAG_COLOR} = vec4(1.0); 2390 #endif 2391 } 2392 "" 2393 end 2394 2395 case invalid_ifndef 2396 version 300 es 2397 expect compile_fail 2398 both "" 2399 #version 300 es 2400 precision mediump float; 2401 ${DECLARATIONS} 2402 void main() 2403 { 2404 #ifndef 1 2405 ${POSITION_FRAG_COLOR} = vec4(1.0); 2406 #endif 2407 } 2408 "" 2409 end 2410 2411 case empty_if_defined 2412 version 300 es 2413 expect compile_fail 2414 both "" 2415 #version 300 es 2416 precision mediump float; 2417 ${DECLARATIONS} 2418 void main() 2419 { 2420 #if defined 2421 ${POSITION_FRAG_COLOR} = vec4(1.0); 2422 } 2423 "" 2424 end 2425 2426 case unterminated_if_1 2427 version 300 es 2428 expect compile_fail 2429 both "" 2430 #version 300 es 2431 precision mediump float; 2432 ${DECLARATIONS} 2433 void main() 2434 { 2435 #if 1 2436 ${POSITION_FRAG_COLOR} = vec4(1.0); 2437 } 2438 "" 2439 end 2440 2441 case unterminated_if_2 2442 version 300 es 2443 expect compile_fail 2444 both "" 2445 #version 300 es 2446 precision mediump float; 2447 ${DECLARATIONS} 2448 void main() 2449 { 2450 #if 0 2451 ${POSITION_FRAG_COLOR} = vec4(1.0); 2452 } 2453 "" 2454 end 2455 2456 case unterminated_ifdef 2457 version 300 es 2458 expect compile_fail 2459 both "" 2460 #version 300 es 2461 precision mediump float; 2462 ${DECLARATIONS} 2463 void main() 2464 { 2465 #ifdef FOOBAR 2466 ${POSITION_FRAG_COLOR} = vec4(1.0); 2467 } 2468 "" 2469 end 2470 2471 case unterminated_ifndef 2472 version 300 es 2473 expect compile_fail 2474 both "" 2475 #version 300 es 2476 precision mediump float; 2477 ${DECLARATIONS} 2478 void main() 2479 { 2480 #ifndef GL_ES 2481 ${POSITION_FRAG_COLOR} = vec4(1.0); 2482 } 2483 "" 2484 end 2485 2486 case unterminated_else_1 2487 version 300 es 2488 expect compile_fail 2489 both "" 2490 #version 300 es 2491 precision mediump float; 2492 ${DECLARATIONS} 2493 void main() 2494 { 2495 #if 1 2496 #else 2497 ${POSITION_FRAG_COLOR} = vec4(1.0); 2498 } 2499 "" 2500 end 2501 2502 case unterminated_else_2 2503 version 300 es 2504 expect compile_fail 2505 both "" 2506 #version 300 es 2507 precision mediump float; 2508 ${DECLARATIONS} 2509 void main() 2510 { 2511 #if 0 2512 #else 2513 ${POSITION_FRAG_COLOR} = vec4(1.0); 2514 } 2515 "" 2516 end 2517 2518 case unterminated_elif_1 2519 version 300 es 2520 expect compile_fail 2521 both "" 2522 #version 300 es 2523 precision mediump float; 2524 ${DECLARATIONS} 2525 void main() 2526 { 2527 #if 0 2528 #elif 1 2529 ${POSITION_FRAG_COLOR} = vec4(1.0); 2530 } 2531 "" 2532 end 2533 2534 case unterminated_elif_2 2535 version 300 es 2536 expect compile_fail 2537 both "" 2538 #version 300 es 2539 precision mediump float; 2540 ${DECLARATIONS} 2541 void main() 2542 { 2543 #if 1 2544 #elif 0 2545 ${POSITION_FRAG_COLOR} = vec4(1.0); 2546 } 2547 "" 2548 end 2549 2550 case unterminated_elif_3 2551 version 300 es 2552 expect compile_fail 2553 both "" 2554 #version 300 es 2555 precision mediump float; 2556 ${DECLARATIONS} 2557 void main() 2558 { 2559 #if 0 2560 #elif 0 2561 ${POSITION_FRAG_COLOR} = vec4(2.0); 2562 } 2563 "" 2564 end 2565 2566 case elif_after_else 2567 version 300 es 2568 expect compile_fail 2569 both "" 2570 #version 300 es 2571 precision mediump float; 2572 ${DECLARATIONS} 2573 void main() 2574 { 2575 #if 0 2576 ${POSITION_FRAG_COLOR} = vec4(1.0); 2577 #else 2578 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2579 #elif 1 2580 ${POSITION_FRAG_COLOR} = vec4(0.0); 2581 #endif 2582 } 2583 "" 2584 end 2585 2586 case else_without_if 2587 version 300 es 2588 expect compile_fail 2589 both "" 2590 #version 300 es 2591 precision mediump float; 2592 ${DECLARATIONS} 2593 void main() 2594 { 2595 #else 2596 ${POSITION_FRAG_COLOR} = vec4(1.0); 2597 #endif 2598 } 2599 "" 2600 end 2601 2602 case elif_without_if 2603 version 300 es 2604 expect compile_fail 2605 both "" 2606 #version 300 es 2607 precision mediump float; 2608 ${DECLARATIONS} 2609 void main() 2610 { 2611 #elif 1 2612 ${POSITION_FRAG_COLOR} = vec4(1.0); 2613 #endif 2614 } 2615 "" 2616 end 2617 2618 case endif_without_if 2619 version 300 es 2620 expect compile_fail 2621 both "" 2622 #version 300 es 2623 precision mediump float; 2624 ${DECLARATIONS} 2625 void main() 2626 { 2627 ${POSITION_FRAG_COLOR} = vec4(1.0); 2628 #endif 2629 } 2630 "" 2631 end 2632 2633 case else_after_else 2634 version 300 es 2635 expect compile_fail 2636 both "" 2637 #version 300 es 2638 precision mediump float; 2639 ${DECLARATIONS} 2640 void main() 2641 { 2642 #if !GL_ES 2643 ${POSITION_FRAG_COLOR} = vec4(1.0); 2644 #else 2645 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2646 #else 2647 ${POSITION_FRAG_COLOR} = vec4(-1.0); 2648 #endif 2649 } 2650 "" 2651 end 2652 2653 case nested_elif_without_if 2654 version 300 es 2655 expect compile_fail 2656 both "" 2657 #version 300 es 2658 precision mediump float; 2659 ${DECLARATIONS} 2660 void main() 2661 { 2662 #if 1 2663 ${POSITION_FRAG_COLOR} = vec4(1.0); 2664 # elif 2665 ${POSITION_FRAG_COLOR} = vec4(0.0); 2666 # endif 2667 #endif 2668 } 2669 "" 2670 end 2671 2672 case if_float 2673 version 300 es 2674 expect compile_fail 2675 both "" 2676 #version 300 es 2677 precision mediump float; 2678 ${DECLARATIONS} 2679 void main() 2680 { 2681 #if 1.231 2682 ${POSITION_FRAG_COLOR} = vec4(1.0); 2683 # elif 2684 ${POSITION_FRAG_COLOR} = vec4(0.0); 2685 # endif 2686 #endif 2687 } 2688 "" 2689 end 2690 2691 case tokens_after_if 2692 version 300 es 2693 expect compile_fail 2694 both "" 2695 #version 300 es 2696 precision mediump float; 2697 ${DECLARATIONS} 2698 void main() 2699 { 2700 #if 1 foobar 2701 ${POSITION_FRAG_COLOR} = vec4(1.0); 2702 #endif 2703 } 2704 "" 2705 end 2706 2707 case tokens_after_elif 2708 version 300 es 2709 expect compile_fail 2710 both "" 2711 #version 300 es 2712 precision mediump float; 2713 ${DECLARATIONS} 2714 void main() 2715 { 2716 #if 0 2717 #elif foobar 2718 ${POSITION_FRAG_COLOR} = vec4(1.0); 2719 #endif 2720 } 2721 "" 2722 end 2723 2724 case tokens_after_else 2725 version 300 es 2726 expect compile_fail 2727 both "" 2728 #version 300 es 2729 precision mediump float; 2730 ${DECLARATIONS} 2731 void main() 2732 { 2733 #if 1 2734 #else foobar 1.231 2735 #endif 2736 ${POSITION_FRAG_COLOR} = vec4(1.0); 2737 } 2738 "" 2739 end 2740 2741 case tokens_after_endif 2742 version 300 es 2743 expect compile_fail 2744 both "" 2745 #version 300 es 2746 precision mediump float; 2747 ${DECLARATIONS} 2748 void main() 2749 { 2750 #if 1 2751 #else 2752 #endif foobar 2753 ${POSITION_FRAG_COLOR} = vec4(1.0); 2754 } 2755 "" 2756 end 2757 2758 case tokens_after_ifdef 2759 version 300 es 2760 expect compile_fail 2761 both "" 2762 #version 300 es 2763 precision mediump float; 2764 ${DECLARATIONS} 2765 void main() 2766 { 2767 #ifdef FOOBAR foobar 2768 #else 2769 #endif 2770 ${POSITION_FRAG_COLOR} = vec4(1.0); 2771 } 2772 "" 2773 end 2774 2775 case tokens_after_ifndef 2776 version 300 es 2777 expect compile_fail 2778 both "" 2779 #version 300 es 2780 precision mediump float; 2781 ${DECLARATIONS} 2782 void main() 2783 { 2784 #ifndef FOOBAR ,, +- << barbar 2785 #else 2786 #endif 2787 ${POSITION_FRAG_COLOR} = vec4(1.0); 2788 } 2789 "" 2790 end 2791 2792 case unterminated_nested_blocks 2793 version 300 es 2794 expect compile_fail 2795 both "" 2796 #version 300 es 2797 precision mediump float; 2798 ${DECLARATIONS} 2799 void main() 2800 { 2801 #if 1 2802 # if 1 2803 ${POSITION_FRAG_COLOR} = vec4(1.0); 2804 } 2805 "" 2806 end 2807 2808 end # invalid_conditionals 2809 2810 group conditionals "Conditionals Tests" 2811 2812 case ifdef_1 2813 version 300 es 2814 values { output float out0 = 1.0; } 2815 both "" 2816 #version 300 es 2817 #define AAA 2818 precision mediump float; 2819 ${DECLARATIONS} 2820 void main() 2821 { 2822 #ifdef AAA 2823 out0 = 1.0; 2824 #else 2825 out0 = -1.0; 2826 #endif 2827 ${OUTPUT} 2828 } 2829 "" 2830 end 2831 2832 case ifdef_2 2833 version 300 es 2834 values { output float out0 = 1.0; } 2835 both "" 2836 #version 300 es 2837 #define AAA 2838 precision mediump float; 2839 ${DECLARATIONS} 2840 void main() 2841 { 2842 #if defined ( AAA) 2843 out0 = 1.0; 2844 #else 2845 out0 = -1.0; 2846 #endif 2847 ${OUTPUT} 2848 } 2849 "" 2850 end 2851 2852 case ifdef_3 2853 version 300 es 2854 values { output float out0 = 1.0; } 2855 both "" 2856 #version 300 es 2857 precision mediump float; 2858 ${DECLARATIONS} 2859 void main() 2860 { 2861 #ifdef AAA 2862 out0 = -1.0; 2863 #else 2864 out0 = 1.0; 2865 #endif 2866 ${OUTPUT} 2867 } 2868 "" 2869 end 2870 2871 case ifndef_1 2872 version 300 es 2873 values { output float out0 = 1.0; } 2874 both "" 2875 #version 300 es 2876 precision mediump float; 2877 ${DECLARATIONS} 2878 void main() 2879 { 2880 #ifndef AAA 2881 out0 = 1.0; 2882 #else 2883 out0 = -1.0; 2884 #endif 2885 ${OUTPUT} 2886 } 2887 "" 2888 end 2889 2890 case ifndef_2 2891 version 300 es 2892 values { output float out0 = 1.0; } 2893 both "" 2894 #version 300 es 2895 precision mediump float; 2896 ${DECLARATIONS} 2897 #define AAA 2898 void main() 2899 { 2900 #ifndef AAA 2901 out0 = -1.0; 2902 #else 2903 out0 = 1.0; 2904 #endif 2905 ${OUTPUT} 2906 } 2907 "" 2908 end 2909 2910 case mixed_conditional_inclusion 2911 version 300 es 2912 values { output float out0 = 1.0; } 2913 both "" 2914 #version 300 es 2915 precision mediump float; 2916 ${DECLARATIONS} 2917 void main() 2918 { 2919 #ifndef AAA 2920 out0 = 1.0; 2921 #elif 1 2922 out0 = -1.0; 2923 #endif 2924 ${OUTPUT} 2925 } 2926 "" 2927 end 2928 2929 case nested_if_1 2930 version 300 es 2931 values { output float out0 = 1.0; } 2932 both "" 2933 #version 300 es 2934 precision mediump float; 2935 ${DECLARATIONS} 2936 void main() 2937 { 2938 #if GL_ES 2939 # if __VERSION__ != 300 2940 out0 = -1.0; 2941 # else 2942 out0 = 1.0; 2943 # endif 2944 #endif 2945 ${OUTPUT} 2946 } 2947 "" 2948 end 2949 2950 case nested_if_2 2951 version 300 es 2952 values { output float out0 = 1.0; } 2953 both "" 2954 #version 300 es 2955 precision mediump float; 2956 ${DECLARATIONS} 2957 void main() 2958 { 2959 #if 1 2960 # if 0 2961 out0 = -1.0; 2962 # else 2963 # if 0 2964 out0 = -1.0; 2965 # elif 1 2966 out0 = 1.0; 2967 # else 2968 out0 = -1.0; 2969 # endif 2970 # endif 2971 #endif 2972 ${OUTPUT} 2973 } 2974 "" 2975 end 2976 2977 case nested_if_3 2978 version 300 es 2979 values { output float out0 = 1.0; } 2980 both "" 2981 #version 300 es 2982 precision mediump float; 2983 ${DECLARATIONS} 2984 void main() 2985 { 2986 #if 0 2987 # if 1 2988 out0 = -1.0; 2989 # endif 2990 #else 2991 out0 = 1.0; 2992 #endif 2993 ${OUTPUT} 2994 } 2995 "" 2996 end 2997 2998 end # conditionals 2999 3000 group directive "Directive Tests" 3001 3002 case version_is_less 3003 expect compile_fail 3004 version 300 es 3005 both "" 3006 #version 299 es 3007 precision mediump float; 3008 ${DECLARATIONS} 3009 void main() 3010 { 3011 ${POSITION_FRAG_COLOR} = vec4(1.0); 3012 } 3013 "" 3014 end 3015 3016 case version_is_more 3017 expect compile_fail 3018 version 300 es 3019 both "" 3020 #version 301 es 3021 precision mediump float; 3022 ${DECLARATIONS} 3023 void main() 3024 { 3025 ${POSITION_FRAG_COLOR} = vec4(1.0); 3026 } 3027 "" 3028 end 3029 3030 case version_missing_es 3031 expect compile_fail 3032 version 300 es 3033 both "" 3034 #version 300 3035 precision mediump float; 3036 ${DECLARATIONS} 3037 void main() 3038 { 3039 ${POSITION_FRAG_COLOR} = vec4(1.0); 3040 } 3041 "" 3042 end 3043 3044 case version_missing 3045 expect compile_fail 3046 version 300 es 3047 both "" 3048 #version 3049 precision mediump float; 3050 ${DECLARATIONS} 3051 void main() 3052 { 3053 ${POSITION_FRAG_COLOR} = vec4(1.0); 3054 } 3055 "" 3056 end 3057 3058 case version_not_first_statement_1 3059 expect compile_fail 3060 version 300 es 3061 both "" 3062 precision mediump float; 3063 #version 300 es 3064 ${DECLARATIONS} 3065 void main() 3066 { 3067 ${POSITION_FRAG_COLOR} = vec4(1.0); 3068 } 3069 "" 3070 end 3071 3072 case version_not_first_statement_2 3073 expect compile_fail 3074 version 300 es 3075 both "" 3076 #define FOO BAR 3077 #version 300 es 3078 precision mediump float; 3079 ${DECLARATIONS} 3080 void main() 3081 { 3082 ${POSITION_FRAG_COLOR} = vec4(1.0); 3083 } 3084 "" 3085 end 3086 3087 case version_invalid_token_1 3088 expect compile_fail 3089 version 300 es 3090 both "" 3091 #version 300 es.0 3092 precision mediump float; 3093 ${DECLARATIONS} 3094 void main() 3095 { 3096 ${POSITION_FRAG_COLOR} = vec4(1.0); 3097 } 3098 "" 3099 end 3100 3101 case version_invalid_token_2 3102 expect compile_fail 3103 version 300 es 3104 both "" 3105 #version foobar 3106 precision mediump float; 3107 ${DECLARATIONS} 3108 void main() 3109 { 3110 ${POSITION_FRAG_COLOR} = vec4(1.0); 3111 } 3112 "" 3113 end 3114 3115 case invalid_version 3116 expect compile_fail 3117 version 300 es 3118 both "" 3119 #version AAA 3120 precision mediump float; 3121 ${DECLARATIONS} 3122 void main() 3123 { 3124 ${POSITION_FRAG_COLOR} = vec4(1.0); 3125 } 3126 "" 3127 end 3128 3129 case additional_tokens 3130 expect compile_fail 3131 version 300 es 3132 both "" 3133 #version 300 es foobar 3134 precision mediump float; 3135 ${DECLARATIONS} 3136 void main() 3137 { 3138 ${POSITION_FRAG_COLOR} = vec4(1.0); 3139 } 3140 "" 3141 end 3142 3143 case error_with_no_tokens 3144 version 300 es 3145 expect compile_fail 3146 both "" 3147 #version 300 es 3148 #error 3149 precision mediump float; 3150 ${DECLARATIONS} 3151 void main() 3152 { 3153 ${POSITION_FRAG_COLOR} = vec4(1.0); 3154 } 3155 "" 3156 end 3157 3158 case error 3159 version 300 es 3160 expect compile_fail 3161 both "" 3162 #version 300 es 3163 #define AAA asdf 3164 #error 1 * AAA /* comment */ 3165 precision mediump float; 3166 ${DECLARATIONS} 3167 void main() 3168 { 3169 ${POSITION_FRAG_COLOR} = vec4(1.0); 3170 } 3171 "" 3172 end 3173 3174 end # directive 3175 3176 group builtin "Built-in Symbol Tests" 3177 3178 case line 3179 version 300 es 3180 values { output float out0 = 1.0; } 3181 both "" 3182 #version 300 es 3183 precision mediump float; 3184 ${DECLARATIONS} 3185 void main() 3186 { 3187 #line 1 3188 out0 = float(__LINE__); 3189 ${OUTPUT} 3190 } 3191 "" 3192 end 3193 3194 case line_and_file 3195 version 300 es 3196 values { output vec4 out0 = vec4(234.0, 234.0, 10.0, 10.0); } 3197 both "" 3198 #version 300 es 3199 precision mediump float; 3200 ${DECLARATIONS} 3201 void main() 3202 { 3203 #line 234 10 3204 out0 = vec4(__LINE__, __LINE__, __FILE__, __FILE__); 3205 ${OUTPUT} 3206 } 3207 "" 3208 end 3209 3210 case line_expression 3211 version 300 es 3212 values { output float out0 = 20.0; } 3213 both "" 3214 #version 300 es 3215 precision mediump float; 3216 ${DECLARATIONS} 3217 void main() 3218 { 3219 #line +20 3220 out0 = float(__LINE__); 3221 ${OUTPUT} 3222 } 3223 "" 3224 end 3225 3226 case line_and_file_expression 3227 version 300 es 3228 values { output vec4 out0 = vec4(243.0, 243.0, 10.0, 10.0); } 3229 both "" 3230 #version 300 es 3231 precision mediump float; 3232 ${DECLARATIONS} 3233 void main() 3234 { 3235 #line (233 +10) (+10) 3236 out0 = vec4(__LINE__, __LINE__, __FILE__, __FILE__); 3237 ${OUTPUT} 3238 } 3239 "" 3240 end 3241 3242 case line_defined_1 3243 version 300 es 3244 values { output float out0 = 4.0; } 3245 both "" 3246 #version 300 es 3247 precision mediump float; 3248 ${DECLARATIONS} 3249 void main() 3250 { 3251 #define A 4 3252 #line A 3253 out0 = float(__LINE__); 3254 ${OUTPUT} 3255 } 3256 "" 3257 end 3258 3259 case line_defined_2 3260 version 300 es 3261 values { output vec4 out0 = vec4(234.0, 234.0, 10.0, 10.0); } 3262 both "" 3263 #version 300 es 3264 precision mediump float; 3265 ${DECLARATIONS} 3266 void main() 3267 { 3268 #define A 10 3269 #line 234 A 3270 out0 = vec4(__LINE__, __LINE__, __FILE__, __FILE__); 3271 ${OUTPUT} 3272 } 3273 "" 3274 end 3275 3276 case empty_line 3277 version 300 es 3278 expect compile_fail 3279 both "" 3280 #version 300 es 3281 precision mediump float; 3282 ${DECLARATIONS} 3283 void main() 3284 { 3285 #line 3286 ${POSITION_FRAG_COLOR} = vec4(1.0); 3287 } 3288 "" 3289 end 3290 3291 case invalid_line_file_1 3292 version 300 es 3293 expect compile_fail 3294 both "" 3295 #version 300 es 3296 precision mediump float; 3297 ${DECLARATIONS} 3298 void main() 3299 { 3300 #line 22 1.234 3301 ${POSITION_FRAG_COLOR} = vec4(__LINE__, __LINE__, __FILE__, __FILE__); 3302 } 3303 "" 3304 end 3305 3306 case invalid_line_file_3 3307 version 300 es 3308 expect compile_fail 3309 both "" 3310 #version 300 es 3311 precision mediump float; 3312 ${DECLARATIONS} 3313 void main() 3314 { 3315 #line 233 10 2 3316 ${POSITION_FRAG_COLOR} = vec4(__LINE__, __LINE__, __FILE__, __FILE__); 3317 } 3318 "" 3319 end 3320 3321 case invalid_line_file_4 3322 version 300 es 3323 expect compile_fail 3324 both "" 3325 #version 300 es 3326 precision mediump float; 3327 ${DECLARATIONS} 3328 void main() 3329 { 3330 #line foobar 3331 ${POSITION_FRAG_COLOR} = vec4(__LINE__, __LINE__, __FILE__, __FILE__); 3332 } 3333 "" 3334 end 3335 3336 end # builtin 3337 3338 group pragmas "Pragma Tests" 3339 3340 case pragma_vertex 3341 version 300 es 3342 values { output float out0 = 1.0; } 3343 vertex "" 3344 #version 300 es 3345 #pragma 3346 #pragma STDGL invariant(all) 3347 #pragma debug(off) 3348 #pragma optimize(off) 3349 3350 ${VERTEX_DECLARATIONS} 3351 void main() 3352 { 3353 ${VERTEX_OUTPUT} 3354 } 3355 "" 3356 fragment "" 3357 #version 300 es 3358 precision mediump float; 3359 ${FRAGMENT_DECLARATIONS} 3360 void main() 3361 { 3362 out0 = 1.0; 3363 ${FRAGMENT_OUTPUT} 3364 } 3365 "" 3366 end 3367 3368 case pragma_fragment 3369 version 300 es 3370 values { output float out0 = 1.0; } 3371 vertex "" 3372 #version 300 es 3373 ${VERTEX_DECLARATIONS} 3374 void main() 3375 { 3376 ${VERTEX_OUTPUT} 3377 } 3378 "" 3379 fragment "" 3380 #version 300 es 3381 #pragma 3382 #pragma debug(off) 3383 #pragma optimize(off) 3384 3385 precision mediump float; 3386 ${FRAGMENT_DECLARATIONS} 3387 void main() 3388 { 3389 out0 = 1.0; 3390 ${FRAGMENT_OUTPUT} 3391 } 3392 "" 3393 end 3394 3395 case pragma_macro_exp 3396 version 300 es 3397 values { output float out0 = 1.0; } 3398 both "" 3399 #version 300 es 3400 #define off INVALID 3401 /* pragma line not macro expanded */ 3402 #pragma debug(off) 3403 3404 precision mediump float; 3405 ${DECLARATIONS} 3406 void main() 3407 { 3408 out0 = 1.0; 3409 ${OUTPUT} 3410 } 3411 "" 3412 end 3413 3414 case pragma_unrecognized_debug 3415 version 300 es 3416 expect build_successful 3417 both "" 3418 #version 300 es 3419 #pragma debug(1.23) 3420 3421 // unrecognized preprocessor token 3422 3423 precision mediump float; 3424 ${DECLARATIONS} 3425 void main() 3426 { 3427 ${POSITION_FRAG_COLOR} = vec4(1.0); 3428 } 3429 "" 3430 end 3431 3432 case pragma_unrecognized_token 3433 # Note: upstream dEQP uses unicode characters here but we can't test 3434 # this in WebGL because it requires strings passed to glShaderSource 3435 # to be ASCII. This would cause the test to fail at glShaderSource 3436 # instead of glCompileShader, which is not what we want to test. 3437 version 300 es 3438 expect build_successful 3439 both "" 3440 #version 300 es 3441 #pragma **% 3442 3443 // trailing bytes form a valid but unrecognized preprocessor token 3444 3445 precision mediump float; 3446 ${DECLARATIONS} 3447 void main() 3448 { 3449 ${POSITION_FRAG_COLOR} = vec4(1.0); 3450 } 3451 "" 3452 end 3453 3454 end # pragmas 3455 3456 group extensions "Extension Tests" 3457 3458 case basic 3459 version 300 es 3460 values { output float out0 = 1.0; } 3461 both "" 3462 #version 300 es 3463 #extension all : warn 3464 3465 precision mediump float; 3466 ${DECLARATIONS} 3467 void main() 3468 { 3469 out0 = 1.0; 3470 ${OUTPUT} 3471 } 3472 "" 3473 end 3474 3475 case macro_exp 3476 version 300 es 3477 values { output float out0 = 1.0; } 3478 both "" 3479 #version 300 es 3480 #define warn enable 3481 3482 #extension all : warn 3483 3484 precision mediump float; 3485 ${DECLARATIONS} 3486 void main() 3487 { 3488 out0 = 1.0; 3489 ${OUTPUT} 3490 } 3491 "" 3492 end 3493 3494 case missing_extension_name 3495 version 300 es 3496 expect compile_fail 3497 both "" 3498 #version 300 es 3499 #extension 3500 precision mediump float; 3501 ${DECLARATIONS} 3502 void main() 3503 { 3504 ${POSITION_FRAG_COLOR} = vec4(1.0); 3505 } 3506 "" 3507 end 3508 3509 case invalid_extension_name 3510 version 300 es 3511 expect compile_fail 3512 both "" 3513 #version 300 es 3514 #extension 2 : all 3515 precision mediump float; 3516 ${DECLARATIONS} 3517 void main() 3518 { 3519 ${POSITION_FRAG_COLOR} = vec4(1.0); 3520 } 3521 "" 3522 end 3523 3524 case missing_colon 3525 version 300 es 3526 expect compile_fail 3527 both "" 3528 #version 300 es 3529 #extension all 3530 precision mediump float; 3531 ${DECLARATIONS} 3532 void main() 3533 { 3534 ${POSITION_FRAG_COLOR} = vec4(1.0); 3535 } 3536 "" 3537 end 3538 3539 case expected_colon 3540 version 300 es 3541 expect compile_fail 3542 both "" 3543 #version 300 es 3544 #extension all ; 3545 precision mediump float; 3546 ${DECLARATIONS} 3547 void main() 3548 { 3549 ${POSITION_FRAG_COLOR} = vec4(1.0); 3550 } 3551 "" 3552 end 3553 3554 case missing_behavior 3555 version 300 es 3556 expect compile_fail 3557 both "" 3558 #version 300 es 3559 #extension all : 3560 precision mediump float; 3561 ${DECLARATIONS} 3562 void main() 3563 { 3564 ${POSITION_FRAG_COLOR} = vec4(1.0); 3565 } 3566 "" 3567 end 3568 3569 case invalid_behavior_1 3570 version 300 es 3571 expect compile_fail 3572 both "" 3573 #version 300 es 3574 #extension all : WARN 3575 precision mediump float; 3576 ${DECLARATIONS} 3577 void main() 3578 { 3579 ${POSITION_FRAG_COLOR} = vec4(1.0); 3580 } 3581 "" 3582 end 3583 3584 case invalid_behavior_2 3585 version 300 es 3586 expect compile_fail 3587 both "" 3588 #version 300 es 3589 #extension all : require 3590 precision mediump float; 3591 ${DECLARATIONS} 3592 void main() 3593 { 3594 ${POSITION_FRAG_COLOR} = vec4(1.0); 3595 } 3596 "" 3597 end 3598 3599 case invalid_char_in_name 3600 # Note: upstream dEQP uses unicode characters here but we can't test 3601 # this in WebGL because it requires strings passed to glShaderSource 3602 # to be ASCII. This would cause the test to fail at glShaderSource 3603 # instead of glCompileShader, which is not what we want to test. 3604 version 300 es 3605 expect compile_fail 3606 both "" 3607 #version 300 es 3608 #extension all* : warn 3609 precision mediump float; 3610 ${DECLARATIONS} 3611 void main() 3612 { 3613 ${POSITION_FRAG_COLOR} = vec4(1.0); 3614 } 3615 "" 3616 end 3617 3618 case invalid_char_in_behavior 3619 # Note: upstream dEQP uses unicode characters here but we can't test 3620 # this in WebGL because it requires strings passed to glShaderSource 3621 # to be ASCII. This would cause the test to fail at glShaderSource 3622 # instead of glCompileShader, which is not what we want to test. 3623 version 300 es 3624 expect compile_fail 3625 both "" 3626 #version 300 es 3627 #extension all : war*n 3628 precision mediump float; 3629 ${DECLARATIONS} 3630 void main() 3631 { 3632 ${POSITION_FRAG_COLOR} = vec4(1.0); 3633 } 3634 "" 3635 end 3636 3637 case unterminated_comment 3638 version 300 es 3639 expect compile_fail 3640 both "" 3641 #version 300 es 3642 #extension all : warn /*asd 3643 precision mediump float; 3644 ${DECLARATIONS} 3645 void main() 3646 { 3647 ${POSITION_FRAG_COLOR} = vec4(1.0); 3648 } 3649 "" 3650 end 3651 3652 case after_non_preprocessing_tokens 3653 version 300 es 3654 expect compile_fail 3655 both "" 3656 #version 300 es 3657 #extension all : warn 3658 3659 precision mediump float; 3660 ${DECLARATIONS} 3661 void main() 3662 { 3663 #extension all : disable 3664 ${POSITION_FRAG_COLOR} = vec4(1.0); 3665 } 3666 "" 3667 end 3668 end # extensions 3669 3670 group expressions "Expression Tests" 3671 3672 case shift_left 3673 version 300 es 3674 values { output float out0 = 1.0; } 3675 both "" 3676 #version 300 es 3677 precision mediump float; 3678 ${DECLARATIONS} 3679 void main() 3680 { 3681 #define VAL 4 3682 out0 = 0.0; 3683 #if (VAL << 2) == 16 3684 out0 = 1.0; 3685 #endif 3686 ${OUTPUT} 3687 } 3688 "" 3689 end 3690 3691 case shift_right 3692 version 300 es 3693 values { output float out0 = 1.0; } 3694 both "" 3695 #version 300 es 3696 precision mediump float; 3697 ${DECLARATIONS} 3698 void main() 3699 { 3700 #define VAL 5 3701 out0 = 0.0; 3702 #if (VAL >> 1) == 2 3703 out0 = 1.0; 3704 #endif 3705 ${OUTPUT} 3706 } 3707 "" 3708 end 3709 3710 case cmp_less_than 3711 version 300 es 3712 values { output float out0 = 1.0; } 3713 both "" 3714 #version 300 es 3715 precision mediump float; 3716 ${DECLARATIONS} 3717 void main() 3718 { 3719 #define VAL 5 3720 out0 = 0.0; 3721 #if (VAL < 6) && (-VAL < -4) 3722 out0 = 1.0; 3723 #endif 3724 ${OUTPUT} 3725 } 3726 "" 3727 end 3728 3729 case less_or_equal 3730 version 300 es 3731 values { output float out0 = 1.0; } 3732 both "" 3733 #version 300 es 3734 precision mediump float; 3735 ${DECLARATIONS} 3736 void main() 3737 { 3738 #define VAL 6 3739 out0 = 0.0; 3740 #if (VAL <= 6) && (-VAL <= -6) 3741 out0 = 1.0; 3742 #endif 3743 ${OUTPUT} 3744 } 3745 "" 3746 end 3747 3748 case or 3749 version 300 es 3750 values { output float out0 = 1.0; } 3751 both "" 3752 #version 300 es 3753 precision mediump float; 3754 ${DECLARATIONS} 3755 void main() 3756 { 3757 #define VAL 6 3758 out0 = 0.0; 3759 #if (VAL | 5) == 7 3760 out0 = 1.0; 3761 #endif 3762 ${OUTPUT} 3763 } 3764 "" 3765 end 3766 3767 case and 3768 version 300 es 3769 values { output float out0 = 1.0; } 3770 both "" 3771 #version 300 es 3772 precision mediump float; 3773 ${DECLARATIONS} 3774 void main() 3775 { 3776 #define VAL 6 3777 out0 = 0.0; 3778 #if (VAL & 5) == 4 3779 out0 = 1.0; 3780 #endif 3781 ${OUTPUT} 3782 } 3783 "" 3784 end 3785 3786 case xor 3787 version 300 es 3788 values { output float out0 = 1.0; } 3789 both "" 3790 #version 300 es 3791 precision mediump float; 3792 ${DECLARATIONS} 3793 void main() 3794 { 3795 #define VAL 6 3796 out0 = 0.0; 3797 #if (VAL ^ 5) == 3 3798 out0 = 1.0; 3799 #endif 3800 ${OUTPUT} 3801 } 3802 "" 3803 end 3804 3805 case mod 3806 version 300 es 3807 values { output float out0 = 1.0; } 3808 both "" 3809 #version 300 es 3810 precision mediump float; 3811 ${DECLARATIONS} 3812 void main() 3813 { 3814 #define VAL 12 3815 out0 = 0.0; 3816 #if (VAL % 5) == 2 3817 out0 = 1.0; 3818 #endif 3819 ${OUTPUT} 3820 } 3821 "" 3822 end 3823 3824 case parenthesis_value 3825 version 300 es 3826 values { output float out0 = 1.0; } 3827 both "" 3828 #version 300 es 3829 precision mediump float; 3830 ${DECLARATIONS} 3831 void main() 3832 { 3833 #define VAL (( (4 ) ) ) 3834 out0 = 0.0; 3835 #if VAL >= 4 3836 out0 = 1.0; 3837 #endif 3838 ${OUTPUT} 3839 } 3840 "" 3841 end 3842 3843 case parenthesis_tricky 3844 version 300 es 3845 values { output float out0 = 1.0; } 3846 both "" 3847 #version 300 es 3848 precision mediump float; 3849 ${DECLARATIONS} 3850 void main() 3851 { 3852 #define VAL (( (4 ) ) 3853 out0 = 0.0; 3854 #if VAL) >= 4 3855 out0 = 1.0; 3856 #endif 3857 ${OUTPUT} 3858 } 3859 "" 3860 end 3861 3862 case parenthesis_if_no 3863 version 300 es 3864 values { output float out0 = 1.0; } 3865 both "" 3866 #version 300 es 3867 precision mediump float; 3868 ${DECLARATIONS} 3869 void main() 3870 { 3871 #define VAL 4 3872 out0 = 0.0; 3873 #if VAL >= 4 3874 out0 = 1.0; 3875 #endif 3876 ${OUTPUT} 3877 } 3878 "" 3879 end 3880 3881 case parenthesis_if 3882 version 300 es 3883 values { output float out0 = 1.0; } 3884 both "" 3885 #version 300 es 3886 precision mediump float; 3887 ${DECLARATIONS} 3888 void main() 3889 { 3890 #define VAL 4 3891 out0 = 0.0; 3892 #if (VAL >= 4) 3893 out0 = 1.0; 3894 #endif 3895 ${OUTPUT} 3896 } 3897 "" 3898 end 3899 3900 case parenthesis_multi_if 3901 version 300 es 3902 values { output float out0 = 1.0; } 3903 both "" 3904 #version 300 es 3905 precision mediump float; 3906 ${DECLARATIONS} 3907 void main() 3908 { 3909 #define VAL (4) 3910 out0 = 0.0; 3911 #if (((VAL)) >= (4)) 3912 out0 = 1.0; 3913 #endif 3914 ${OUTPUT} 3915 } 3916 "" 3917 end 3918 3919 case parenthesis_single_if 3920 version 300 es 3921 values { output float out0 = 1.0; } 3922 both "" 3923 #version 300 es 3924 precision mediump float; 3925 ${DECLARATIONS} 3926 void main() 3927 { 3928 #define VAL 4 3929 out0 = 0.0; 3930 #if (VAL >= 4) 3931 out0 = 1.0; 3932 #endif 3933 ${OUTPUT} 3934 } 3935 "" 3936 end 3937 3938 case parenthesis_ifelse_true 3939 version 300 es 3940 values { output float out0 = 1.0; } 3941 both "" 3942 #version 300 es 3943 precision mediump float; 3944 ${DECLARATIONS} 3945 void main() 3946 { 3947 #define VAL 4 3948 #if (VAL >= 4) 3949 out0 = 1.0; 3950 #else 3951 out0 = 0.0; 3952 #endif 3953 ${OUTPUT} 3954 } 3955 "" 3956 end 3957 3958 case parenthesis_ifelse_false 3959 version 300 es 3960 values { output float out0 = 1.0; } 3961 both "" 3962 #version 300 es 3963 precision mediump float; 3964 ${DECLARATIONS} 3965 void main() 3966 { 3967 #define VAL 4 3968 #if (VAL > 4) 3969 out0 = 0.0; 3970 #else 3971 out0 = 1.0; 3972 #endif 3973 ${OUTPUT} 3974 } 3975 "" 3976 end 3977 3978 case eval_basic_0 3979 version 300 es 3980 values { output float out0 = 1.0; } 3981 both "" 3982 #version 300 es 3983 precision mediump float; 3984 ${DECLARATIONS} 3985 void main() 3986 { 3987 #if -4 + 5 == 1 3988 out0 = 1.0; 3989 #else 3990 out0 = 0.0; 3991 #endif 3992 ${OUTPUT} 3993 } 3994 "" 3995 end 3996 3997 case eval_basic_1 3998 version 300 es 3999 values { output float out0 = 1.0; } 4000 both "" 4001 #version 300 es 4002 precision mediump float; 4003 ${DECLARATIONS} 4004 void main() 4005 { 4006 #if (2 * 2) - 3 >= 0 4007 out0 = 1.0; 4008 #else 4009 out0 = 0.0; 4010 #endif 4011 ${OUTPUT} 4012 } 4013 "" 4014 end 4015 4016 case eval_simple_precedence_0 4017 version 300 es 4018 values { output float out0 = 1.0; } 4019 both "" 4020 #version 300 es 4021 precision mediump float; 4022 ${DECLARATIONS} 4023 void main() 4024 { 4025 #if 2 * 3 - 3 == 3 4026 out0 = 1.0; 4027 #else 4028 out0 = 0.0; 4029 #endif 4030 ${OUTPUT} 4031 } 4032 "" 4033 end 4034 4035 case eval_simple_precedence_1 4036 version 300 es 4037 values { output float out0 = 1.0; } 4038 both "" 4039 #version 300 es 4040 precision mediump float; 4041 ${DECLARATIONS} 4042 void main() 4043 { 4044 #if 2 - 2 / 2 == 1 4045 out0 = 1.0; 4046 #else 4047 out0 = 0.0; 4048 #endif 4049 ${OUTPUT} 4050 } 4051 "" 4052 end 4053 4054 case defined_1 4055 version 300 es 4056 values { output float out0 = 1.0; } 4057 both "" 4058 #version 300 es 4059 precision mediump float; 4060 ${DECLARATIONS} 4061 #define X 0 4062 void main() 4063 { 4064 #if defined(X) 4065 out0 = 1.0; 4066 #else 4067 out0 = 0.0; 4068 #endif 4069 ${OUTPUT} 4070 } 4071 "" 4072 end 4073 4074 case defined_2 4075 version 300 es 4076 values { output float out0 = 1.0; } 4077 both "" 4078 #version 300 es 4079 precision mediump float; 4080 ${DECLARATIONS} 4081 #define X 0 4082 #define Y 1 4083 void main() 4084 { 4085 #if defined(X) == Y 4086 out0 = 1.0; 4087 #else 4088 out0 = 0.0; 4089 #endif 4090 ${OUTPUT} 4091 } 4092 "" 4093 end 4094 4095 case defined_3 4096 version 300 es 4097 values { output float out0 = 1.0; } 4098 both "" 4099 #version 300 es 4100 precision mediump float; 4101 ${DECLARATIONS} 4102 #define X 0 4103 #define Y 1 4104 void main() 4105 { 4106 #if defined(X) && defined(Y) 4107 out0 = 1.0; 4108 #else 4109 out0 = 0.0; 4110 #endif 4111 ${OUTPUT} 4112 } 4113 "" 4114 end 4115 4116 case defined_4 4117 version 300 es 4118 values { output float out0 = 1.0; } 4119 both "" 4120 #version 300 es 4121 precision mediump float; 4122 ${DECLARATIONS} 4123 #define X 0 4124 #define Y 1 4125 #undef X 4126 void main() 4127 { 4128 #if defined(X) && defined(Y) 4129 out0 = 0.0; 4130 #else 4131 out0 = 1.0; 4132 #endif 4133 ${OUTPUT} 4134 } 4135 "" 4136 end 4137 4138 case defined_5 4139 version 300 es 4140 values { output float out0 = 1.0; } 4141 both "" 4142 #version 300 es 4143 precision mediump float; 4144 ${DECLARATIONS} 4145 #define X 0 4146 #define Y 1 4147 #undef X 4148 void main() 4149 { 4150 #if defined(X) || defined(Y) 4151 out0 = 1.0; 4152 #else 4153 out0 = 0.0; 4154 #endif 4155 ${OUTPUT} 4156 } 4157 "" 4158 end 4159 4160 case defined_6 4161 version 300 es 4162 values { output float out0 = 1.0; } 4163 both "" 4164 #version 300 es 4165 precision mediump float; 4166 ${DECLARATIONS} 4167 #define X 0 4168 #define Y 1 4169 #undef Y 4170 void main() 4171 { 4172 #if defined(X) && (defined(Y) || (X == 0)) 4173 out0 = 1.0; 4174 #else 4175 out0 = 0.0; 4176 #endif 4177 ${OUTPUT} 4178 } 4179 "" 4180 end 4181 4182 end # expressions 4183 4184 group invalid_expressions "Invalid Expression Tests" 4185 4186 case invalid_unary_expr 4187 version 300 es 4188 expect compile_fail 4189 both "" 4190 #version 300 es 4191 precision mediump float; 4192 ${DECLARATIONS} 4193 void main() 4194 { 4195 #if ! 4196 ${POSITION_FRAG_COLOR} = vec4(1.0); 4197 } 4198 "" 4199 end 4200 4201 case invalid_binary_expr 4202 version 300 es 4203 expect compile_fail 4204 both "" 4205 #version 300 es 4206 precision mediump float; 4207 ${DECLARATIONS} 4208 void main() 4209 { 4210 #if 3+4+ 4211 ${POSITION_FRAG_COLOR} = vec4(1.0); 4212 } 4213 "" 4214 end 4215 4216 case missing_expr 4217 version 300 es 4218 expect compile_fail 4219 both "" 4220 #version 300 es 4221 precision mediump float; 4222 ${DECLARATIONS} 4223 void main() 4224 { 4225 #if 4226 ${POSITION_FRAG_COLOR} = vec4(1.0); 4227 } 4228 "" 4229 end 4230 4231 case invalid_expr_1 4232 version 300 es 4233 expect compile_fail 4234 both "" 4235 #version 300 es 4236 precision mediump float; 4237 ${DECLARATIONS} 4238 void main() 4239 { 4240 #if 4 4 4241 ${POSITION_FRAG_COLOR} = vec4(1.0); 4242 } 4243 "" 4244 end 4245 4246 case invalid_expr_2 4247 version 300 es 4248 expect compile_fail 4249 both "" 4250 #version 300 es 4251 precision mediump float; 4252 ${DECLARATIONS} 4253 void main() 4254 { 4255 #if 4 * * 4 4256 ${POSITION_FRAG_COLOR} = vec4(1.0); 4257 } 4258 "" 4259 end 4260 4261 case invalid_expr_3 4262 version 300 es 4263 expect compile_fail 4264 both "" 4265 #version 300 es 4266 precision mediump float; 4267 ${DECLARATIONS} 4268 void main() 4269 { 4270 #if (4)(4) 4271 ${POSITION_FRAG_COLOR} = vec4(1.0); 4272 } 4273 "" 4274 end 4275 4276 case unopened_parenthesis 4277 version 300 es 4278 expect compile_fail 4279 both "" 4280 #version 300 es 4281 precision mediump float; 4282 ${DECLARATIONS} 4283 void main() 4284 { 4285 #if 4) 4286 ${POSITION_FRAG_COLOR} = vec4(1.0); 4287 } 4288 "" 4289 end 4290 4291 case unclosed_parenthesis 4292 version 300 es 4293 expect compile_fail 4294 both "" 4295 #version 300 es 4296 precision mediump float; 4297 ${DECLARATIONS} 4298 void main() 4299 { 4300 #if ((4 + 7) 4301 ${POSITION_FRAG_COLOR} = vec4(1.0); 4302 } 4303 "" 4304 end 4305 4306 end # invalid_expressions 4307 4308 group operator_precedence "Operator precedence" 4309 4310 4311 case modulo_vs_not 4312 version 300 es 4313 values { output float out0 = 1.0; } 4314 both "" 4315 #version 300 es 4316 #if ( 8 % ! 0 ) == 0 4317 #define VAL 1.0 4318 #else 4319 #define VAL 0.0 4320 #endif 4321 4322 precision mediump float; 4323 ${DECLARATIONS} 4324 void main() 4325 { 4326 out0 = VAL; 4327 ${OUTPUT} 4328 } 4329 "" 4330 end 4331 4332 case div_vs_not 4333 version 300 es 4334 values { output float out0 = 1.0; } 4335 both "" 4336 #version 300 es 4337 #if ( 8 / ! 0 ) == 8 4338 #define VAL 1.0 4339 #else 4340 #define VAL 0.0 4341 #endif 4342 4343 precision mediump float; 4344 ${DECLARATIONS} 4345 void main() 4346 { 4347 out0 = VAL; 4348 ${OUTPUT} 4349 } 4350 "" 4351 end 4352 4353 case mul_vs_not 4354 version 300 es 4355 values { output float out0 = 1.0; } 4356 both "" 4357 #version 300 es 4358 #if ( 8 * ! 0 ) == 8 4359 #define VAL 1.0 4360 #else 4361 #define VAL 0.0 4362 #endif 4363 4364 precision mediump float; 4365 ${DECLARATIONS} 4366 void main() 4367 { 4368 out0 = VAL; 4369 ${OUTPUT} 4370 } 4371 "" 4372 end 4373 4374 case modulo_vs_bit_invert 4375 version 300 es 4376 values { output float out0 = 1.0; } 4377 both "" 4378 #version 300 es 4379 #if ( 8 % ~ 4 ) == 3 4380 #define VAL 1.0 4381 #else 4382 #define VAL 0.0 4383 #endif 4384 4385 precision mediump float; 4386 ${DECLARATIONS} 4387 void main() 4388 { 4389 out0 = VAL; 4390 ${OUTPUT} 4391 } 4392 "" 4393 end 4394 4395 case modulo_vs_minus 4396 version 300 es 4397 values { output float out0 = 1.0; } 4398 both "" 4399 #version 300 es 4400 #if ( 8 % - 2 ) == 0 4401 #define VAL 1.0 4402 #else 4403 #define VAL 0.0 4404 #endif 4405 4406 precision mediump float; 4407 ${DECLARATIONS} 4408 void main() 4409 { 4410 out0 = VAL; 4411 ${OUTPUT} 4412 } 4413 "" 4414 end 4415 4416 case modulo_vs_plus 4417 version 300 es 4418 values { output float out0 = 1.0; } 4419 both "" 4420 #version 300 es 4421 #if ( 8 % + 2 ) == 0 4422 #define VAL 1.0 4423 #else 4424 #define VAL 0.0 4425 #endif 4426 4427 precision mediump float; 4428 ${DECLARATIONS} 4429 void main() 4430 { 4431 out0 = VAL; 4432 ${OUTPUT} 4433 } 4434 "" 4435 end 4436 4437 case div_vs_bit_invert 4438 version 300 es 4439 values { output float out0 = 1.0; } 4440 both "" 4441 #version 300 es 4442 #if ( 8 / ~ 2 ) == -2 4443 #define VAL 1.0 4444 #else 4445 #define VAL 0.0 4446 #endif 4447 4448 precision mediump float; 4449 ${DECLARATIONS} 4450 void main() 4451 { 4452 out0 = VAL; 4453 ${OUTPUT} 4454 } 4455 "" 4456 end 4457 4458 case div_vs_minus 4459 version 300 es 4460 values { output float out0 = 1.0; } 4461 both "" 4462 #version 300 es 4463 #if ( 8 / - 2 ) == -4 4464 #define VAL 1.0 4465 #else 4466 #define VAL 0.0 4467 #endif 4468 4469 precision mediump float; 4470 ${DECLARATIONS} 4471 void main() 4472 { 4473 out0 = VAL; 4474 ${OUTPUT} 4475 } 4476 "" 4477 end 4478 4479 case div_vs_plus 4480 version 300 es 4481 values { output float out0 = 1.0; } 4482 both "" 4483 #version 300 es 4484 #if ( 8 / + 2 ) == 4 4485 #define VAL 1.0 4486 #else 4487 #define VAL 0.0 4488 #endif 4489 4490 precision mediump float; 4491 ${DECLARATIONS} 4492 void main() 4493 { 4494 out0 = VAL; 4495 ${OUTPUT} 4496 } 4497 "" 4498 end 4499 4500 case mul_vs_bit_invert 4501 version 300 es 4502 values { output float out0 = 1.0; } 4503 both "" 4504 #version 300 es 4505 #if ( 8 * ~ 2 ) == -24 4506 #define VAL 1.0 4507 #else 4508 #define VAL 0.0 4509 #endif 4510 4511 precision mediump float; 4512 ${DECLARATIONS} 4513 void main() 4514 { 4515 out0 = VAL; 4516 ${OUTPUT} 4517 } 4518 "" 4519 end 4520 4521 case mul_vs_minus 4522 version 300 es 4523 values { output float out0 = 1.0; } 4524 both "" 4525 #version 300 es 4526 #if ( 8 * - 2 ) == -16 4527 #define VAL 1.0 4528 #else 4529 #define VAL 0.0 4530 #endif 4531 4532 precision mediump float; 4533 ${DECLARATIONS} 4534 void main() 4535 { 4536 out0 = VAL; 4537 ${OUTPUT} 4538 } 4539 "" 4540 end 4541 4542 case mul_vs_plus 4543 version 300 es 4544 values { output float out0 = 1.0; } 4545 both "" 4546 #version 300 es 4547 #if ( 8 * + 2 ) == 16 4548 #define VAL 1.0 4549 #else 4550 #define VAL 0.0 4551 #endif 4552 4553 precision mediump float; 4554 ${DECLARATIONS} 4555 void main() 4556 { 4557 out0 = VAL; 4558 ${OUTPUT} 4559 } 4560 "" 4561 end 4562 4563 case sub_vs_modulo 4564 version 300 es 4565 values { output float out0 = 1.0; } 4566 both "" 4567 #version 300 es 4568 #if ( 8 - 3 % 2 ) == 7 4569 #define VAL 1.0 4570 #else 4571 #define VAL 0.0 4572 #endif 4573 4574 precision mediump float; 4575 ${DECLARATIONS} 4576 void main() 4577 { 4578 out0 = VAL; 4579 ${OUTPUT} 4580 } 4581 "" 4582 end 4583 4584 case sub_vs_div 4585 version 300 es 4586 values { output float out0 = 1.0; } 4587 both "" 4588 #version 300 es 4589 #if ( 8 - 3 / 2 ) == 7 4590 #define VAL 1.0 4591 #else 4592 #define VAL 0.0 4593 #endif 4594 4595 precision mediump float; 4596 ${DECLARATIONS} 4597 void main() 4598 { 4599 out0 = VAL; 4600 ${OUTPUT} 4601 } 4602 "" 4603 end 4604 4605 case sub_vs_mul 4606 version 300 es 4607 values { output float out0 = 1.0; } 4608 both "" 4609 #version 300 es 4610 #if ( 8 - 3 * 2 ) == 2 4611 #define VAL 1.0 4612 #else 4613 #define VAL 0.0 4614 #endif 4615 4616 precision mediump float; 4617 ${DECLARATIONS} 4618 void main() 4619 { 4620 out0 = VAL; 4621 ${OUTPUT} 4622 } 4623 "" 4624 end 4625 4626 case add_vs_modulo 4627 version 300 es 4628 values { output float out0 = 1.0; } 4629 both "" 4630 #version 300 es 4631 #if ( 8 + 3 % 2 ) == 9 4632 #define VAL 1.0 4633 #else 4634 #define VAL 0.0 4635 #endif 4636 4637 precision mediump float; 4638 ${DECLARATIONS} 4639 void main() 4640 { 4641 out0 = VAL; 4642 ${OUTPUT} 4643 } 4644 "" 4645 end 4646 4647 case add_vs_div 4648 version 300 es 4649 values { output float out0 = 1.0; } 4650 both "" 4651 #version 300 es 4652 #if ( 8 + 3 / 2 ) == 9 4653 #define VAL 1.0 4654 #else 4655 #define VAL 0.0 4656 #endif 4657 4658 precision mediump float; 4659 ${DECLARATIONS} 4660 void main() 4661 { 4662 out0 = VAL; 4663 ${OUTPUT} 4664 } 4665 "" 4666 end 4667 4668 case add_vs_mul 4669 version 300 es 4670 values { output float out0 = 1.0; } 4671 both "" 4672 #version 300 es 4673 #if ( 8 + 3 * 2 ) == 14 4674 #define VAL 1.0 4675 #else 4676 #define VAL 0.0 4677 #endif 4678 4679 precision mediump float; 4680 ${DECLARATIONS} 4681 void main() 4682 { 4683 out0 = VAL; 4684 ${OUTPUT} 4685 } 4686 "" 4687 end 4688 4689 case rshift_vs_sub 4690 version 300 es 4691 values { output float out0 = 1.0; } 4692 both "" 4693 #version 300 es 4694 #if ( 8 >> 3 - 2 ) == 4 4695 #define VAL 1.0 4696 #else 4697 #define VAL 0.0 4698 #endif 4699 4700 precision mediump float; 4701 ${DECLARATIONS} 4702 void main() 4703 { 4704 out0 = VAL; 4705 ${OUTPUT} 4706 } 4707 "" 4708 end 4709 4710 case rshift_vs_add 4711 version 300 es 4712 values { output float out0 = 1.0; } 4713 both "" 4714 #version 300 es 4715 #if ( 8 >> 3 + 2 ) == 0 4716 #define VAL 1.0 4717 #else 4718 #define VAL 0.0 4719 #endif 4720 4721 precision mediump float; 4722 ${DECLARATIONS} 4723 void main() 4724 { 4725 out0 = VAL; 4726 ${OUTPUT} 4727 } 4728 "" 4729 end 4730 4731 case lshift_vs_sub 4732 version 300 es 4733 values { output float out0 = 1.0; } 4734 both "" 4735 #version 300 es 4736 #if ( 8 << 3 - 2 ) == 16 4737 #define VAL 1.0 4738 #else 4739 #define VAL 0.0 4740 #endif 4741 4742 precision mediump float; 4743 ${DECLARATIONS} 4744 void main() 4745 { 4746 out0 = VAL; 4747 ${OUTPUT} 4748 } 4749 "" 4750 end 4751 4752 case lshift_vs_add 4753 version 300 es 4754 values { output float out0 = 1.0; } 4755 both "" 4756 #version 300 es 4757 #if ( 8 << 3 + 2 ) == 256 4758 #define VAL 1.0 4759 #else 4760 #define VAL 0.0 4761 #endif 4762 4763 precision mediump float; 4764 ${DECLARATIONS} 4765 void main() 4766 { 4767 out0 = VAL; 4768 ${OUTPUT} 4769 } 4770 "" 4771 end 4772 4773 case greater_or_equal_vs_rshift 4774 version 300 es 4775 values { output float out0 = 1.0; } 4776 both "" 4777 #version 300 es 4778 #if ( 8 >= 3 >> 2 ) == 1 4779 #define VAL 1.0 4780 #else 4781 #define VAL 0.0 4782 #endif 4783 4784 precision mediump float; 4785 ${DECLARATIONS} 4786 void main() 4787 { 4788 out0 = VAL; 4789 ${OUTPUT} 4790 } 4791 "" 4792 end 4793 4794 case greater_or_equal_vs_lshift 4795 version 300 es 4796 values { output float out0 = 1.0; } 4797 both "" 4798 #version 300 es 4799 #if ( 8 >= 3 << 2 ) == 0 4800 #define VAL 1.0 4801 #else 4802 #define VAL 0.0 4803 #endif 4804 4805 precision mediump float; 4806 ${DECLARATIONS} 4807 void main() 4808 { 4809 out0 = VAL; 4810 ${OUTPUT} 4811 } 4812 "" 4813 end 4814 4815 case less_or_equal_vs_rshift 4816 version 300 es 4817 values { output float out0 = 1.0; } 4818 both "" 4819 #version 300 es 4820 #if ( 8 <= 3 >> 2 ) == 0 4821 #define VAL 1.0 4822 #else 4823 #define VAL 0.0 4824 #endif 4825 4826 precision mediump float; 4827 ${DECLARATIONS} 4828 void main() 4829 { 4830 out0 = VAL; 4831 ${OUTPUT} 4832 } 4833 "" 4834 end 4835 4836 case less_or_equal_vs_lshift 4837 version 300 es 4838 values { output float out0 = 1.0; } 4839 both "" 4840 #version 300 es 4841 #if ( 8 <= 3 << 2 ) == 1 4842 #define VAL 1.0 4843 #else 4844 #define VAL 0.0 4845 #endif 4846 4847 precision mediump float; 4848 ${DECLARATIONS} 4849 void main() 4850 { 4851 out0 = VAL; 4852 ${OUTPUT} 4853 } 4854 "" 4855 end 4856 4857 case greater_vs_rshift 4858 version 300 es 4859 values { output float out0 = 1.0; } 4860 both "" 4861 #version 300 es 4862 #if ( 8 > 3 >> 2 ) == 1 4863 #define VAL 1.0 4864 #else 4865 #define VAL 0.0 4866 #endif 4867 4868 precision mediump float; 4869 ${DECLARATIONS} 4870 void main() 4871 { 4872 out0 = VAL; 4873 ${OUTPUT} 4874 } 4875 "" 4876 end 4877 4878 case greater_vs_lshift 4879 version 300 es 4880 values { output float out0 = 1.0; } 4881 both "" 4882 #version 300 es 4883 #if ( 8 > 3 << 2 ) == 0 4884 #define VAL 1.0 4885 #else 4886 #define VAL 0.0 4887 #endif 4888 4889 precision mediump float; 4890 ${DECLARATIONS} 4891 void main() 4892 { 4893 out0 = VAL; 4894 ${OUTPUT} 4895 } 4896 "" 4897 end 4898 4899 case less_vs_rshift 4900 version 300 es 4901 values { output float out0 = 1.0; } 4902 both "" 4903 #version 300 es 4904 #if ( 8 < 3 >> 2 ) == 0 4905 #define VAL 1.0 4906 #else 4907 #define VAL 0.0 4908 #endif 4909 4910 precision mediump float; 4911 ${DECLARATIONS} 4912 void main() 4913 { 4914 out0 = VAL; 4915 ${OUTPUT} 4916 } 4917 "" 4918 end 4919 4920 case less_vs_lshift 4921 version 300 es 4922 values { output float out0 = 1.0; } 4923 both "" 4924 #version 300 es 4925 #if ( 8 < 3 << 2 ) == 1 4926 #define VAL 1.0 4927 #else 4928 #define VAL 0.0 4929 #endif 4930 4931 precision mediump float; 4932 ${DECLARATIONS} 4933 void main() 4934 { 4935 out0 = VAL; 4936 ${OUTPUT} 4937 } 4938 "" 4939 end 4940 4941 case not_equal_vs_greater_or_equal 4942 version 300 es 4943 values { output float out0 = 1.0; } 4944 both "" 4945 #version 300 es 4946 #if ( 8 != 3 >= 2 ) == 1 4947 #define VAL 1.0 4948 #else 4949 #define VAL 0.0 4950 #endif 4951 4952 precision mediump float; 4953 ${DECLARATIONS} 4954 void main() 4955 { 4956 out0 = VAL; 4957 ${OUTPUT} 4958 } 4959 "" 4960 end 4961 4962 case not_equal_vs_less_or_equal 4963 version 300 es 4964 values { output float out0 = 1.0; } 4965 both "" 4966 #version 300 es 4967 #if ( 8 != 3 <= 2 ) == 1 4968 #define VAL 1.0 4969 #else 4970 #define VAL 0.0 4971 #endif 4972 4973 precision mediump float; 4974 ${DECLARATIONS} 4975 void main() 4976 { 4977 out0 = VAL; 4978 ${OUTPUT} 4979 } 4980 "" 4981 end 4982 4983 case not_equal_vs_greater 4984 version 300 es 4985 values { output float out0 = 1.0; } 4986 both "" 4987 #version 300 es 4988 #if ( 8 != 3 > 2 ) == 1 4989 #define VAL 1.0 4990 #else 4991 #define VAL 0.0 4992 #endif 4993 4994 precision mediump float; 4995 ${DECLARATIONS} 4996 void main() 4997 { 4998 out0 = VAL; 4999 ${OUTPUT} 5000 } 5001 "" 5002 end 5003 5004 case not_equal_vs_less 5005 version 300 es 5006 values { output float out0 = 1.0; } 5007 both "" 5008 #version 300 es 5009 #if ( 8 != 3 < 2 ) == 1 5010 #define VAL 1.0 5011 #else 5012 #define VAL 0.0 5013 #endif 5014 5015 precision mediump float; 5016 ${DECLARATIONS} 5017 void main() 5018 { 5019 out0 = VAL; 5020 ${OUTPUT} 5021 } 5022 "" 5023 end 5024 5025 case equal_vs_greater_or_equal 5026 version 300 es 5027 values { output float out0 = 1.0; } 5028 both "" 5029 #version 300 es 5030 #if ( 8 == 3 >= 2 ) == 0 5031 #define VAL 1.0 5032 #else 5033 #define VAL 0.0 5034 #endif 5035 5036 precision mediump float; 5037 ${DECLARATIONS} 5038 void main() 5039 { 5040 out0 = VAL; 5041 ${OUTPUT} 5042 } 5043 "" 5044 end 5045 5046 case equal_vs_less_or_equal 5047 version 300 es 5048 values { output float out0 = 1.0; } 5049 both "" 5050 #version 300 es 5051 #if ( 8 == 3 <= 2 ) == 0 5052 #define VAL 1.0 5053 #else 5054 #define VAL 0.0 5055 #endif 5056 5057 precision mediump float; 5058 ${DECLARATIONS} 5059 void main() 5060 { 5061 out0 = VAL; 5062 ${OUTPUT} 5063 } 5064 "" 5065 end 5066 5067 case equal_vs_greater 5068 version 300 es 5069 values { output float out0 = 1.0; } 5070 both "" 5071 #version 300 es 5072 #if ( 8 == 3 > 2 ) == 0 5073 #define VAL 1.0 5074 #else 5075 #define VAL 0.0 5076 #endif 5077 5078 precision mediump float; 5079 ${DECLARATIONS} 5080 void main() 5081 { 5082 out0 = VAL; 5083 ${OUTPUT} 5084 } 5085 "" 5086 end 5087 5088 case equal_vs_less 5089 version 300 es 5090 values { output float out0 = 1.0; } 5091 both "" 5092 #version 300 es 5093 #if ( 8 == 3 < 2 ) == 0 5094 #define VAL 1.0 5095 #else 5096 #define VAL 0.0 5097 #endif 5098 5099 precision mediump float; 5100 ${DECLARATIONS} 5101 void main() 5102 { 5103 out0 = VAL; 5104 ${OUTPUT} 5105 } 5106 "" 5107 end 5108 5109 case bitwise_and_vs_not_equal 5110 version 300 es 5111 values { output float out0 = 1.0; } 5112 both "" 5113 #version 300 es 5114 #if ( 8 & 3 != 2 ) == 0 5115 #define VAL 1.0 5116 #else 5117 #define VAL 0.0 5118 #endif 5119 5120 precision mediump float; 5121 ${DECLARATIONS} 5122 void main() 5123 { 5124 out0 = VAL; 5125 ${OUTPUT} 5126 } 5127 "" 5128 end 5129 5130 case bitwise_and_vs_equal 5131 version 300 es 5132 values { output float out0 = 1.0; } 5133 both "" 5134 #version 300 es 5135 #if ( 8 & 3 == 2 ) == 0 5136 #define VAL 1.0 5137 #else 5138 #define VAL 0.0 5139 #endif 5140 5141 precision mediump float; 5142 ${DECLARATIONS} 5143 void main() 5144 { 5145 out0 = VAL; 5146 ${OUTPUT} 5147 } 5148 "" 5149 end 5150 5151 case xor_vs_bitwise_and 5152 version 300 es 5153 values { output float out0 = 1.0; } 5154 both "" 5155 #version 300 es 5156 #if ( 8 ^ 3 & 2 ) == 10 5157 #define VAL 1.0 5158 #else 5159 #define VAL 0.0 5160 #endif 5161 5162 precision mediump float; 5163 ${DECLARATIONS} 5164 void main() 5165 { 5166 out0 = VAL; 5167 ${OUTPUT} 5168 } 5169 "" 5170 end 5171 5172 case bitwise_or_vs_xor 5173 version 300 es 5174 values { output float out0 = 1.0; } 5175 both "" 5176 #version 300 es 5177 #if ( 8 | 3 ^ 2 ) == 9 5178 #define VAL 1.0 5179 #else 5180 #define VAL 0.0 5181 #endif 5182 5183 precision mediump float; 5184 ${DECLARATIONS} 5185 void main() 5186 { 5187 out0 = VAL; 5188 ${OUTPUT} 5189 } 5190 "" 5191 end 5192 5193 case logical_and_vs_bitwise_or 5194 version 300 es 5195 values { output float out0 = 1.0; } 5196 both "" 5197 #version 300 es 5198 #if ( 0 && 3 | 2 ) 5199 #define VAL 0.0 5200 #else 5201 #define VAL 1.0 5202 #endif 5203 5204 precision mediump float; 5205 ${DECLARATIONS} 5206 void main() 5207 { 5208 out0 = VAL; 5209 ${OUTPUT} 5210 } 5211 "" 5212 end 5213 5214 case logical_and_vs_bitwise_and 5215 version 300 es 5216 values { output float out0 = 1.0; } 5217 both "" 5218 #version 300 es 5219 #if ( 0 && 4 & 2 ) 5220 #define VAL 0.0 5221 #else 5222 #define VAL 1.0 5223 #endif 5224 5225 precision mediump float; 5226 ${DECLARATIONS} 5227 void main() 5228 { 5229 out0 = VAL; 5230 ${OUTPUT} 5231 } 5232 "" 5233 end 5234 5235 case logical_or_vs_logical_and 5236 version 300 es 5237 values { output float out0 = 1.0; } 5238 both "" 5239 #version 300 es 5240 #if ( 0 || 4 && 0 ) 5241 #define VAL 0.0 5242 #else 5243 #define VAL 1.0 5244 #endif 5245 5246 precision mediump float; 5247 ${DECLARATIONS} 5248 void main() 5249 { 5250 out0 = VAL; 5251 ${OUTPUT} 5252 } 5253 "" 5254 end 5255 5256 end # operator_precedence