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