Hash :
86ce0f0e
Author :
Date :
2025-04-24T00:00:00
Add EXT_multi_draw_arrays stubs Bug: angleproject:414506477 Change-Id: Idc3ca950b88c9632268922ec7a311936916c2a43 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6522405 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// validationESEXT.cpp: Validation functions for OpenGL ES extension entry points.
#include "libANGLE/validationESEXT_autogen.h"
#include "libANGLE/Context.h"
#include "libANGLE/Display.h"
#include "libANGLE/ErrorStrings.h"
#include "libANGLE/MemoryObject.h"
#include "libANGLE/PixelLocalStorage.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES2.h"
#include "libANGLE/validationES3.h"
#include "libANGLE/validationES31.h"
#include "libANGLE/validationES32.h"
#include <optional>
namespace gl
{
using namespace err;
void RecordVersionErrorESEXT(const Context *context, angle::EntryPoint entryPoint)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kEntryPointRequiresESEXT);
}
namespace
{
template <typename ObjectT>
bool ValidateGetImageFormatAndType(const Context *context,
angle::EntryPoint entryPoint,
ObjectT *obj,
GLenum format,
GLenum type)
{
GLenum implFormat = obj->getImplementationColorReadFormat(context);
if (!ValidES3Format(format) && (format != implFormat || format == GL_NONE))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidFormat);
return false;
}
GLenum implType = obj->getImplementationColorReadType(context);
if (!ValidES3Type(type) && (type != implType || type == GL_NONE))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidType);
return false;
}
// Format/type combinations are not yet validated.
return true;
}
bool IsValidImageLayout(ImageLayout layout)
{
switch (layout)
{
case ImageLayout::Undefined:
case ImageLayout::General:
case ImageLayout::ColorAttachment:
case ImageLayout::DepthStencilAttachment:
case ImageLayout::DepthStencilReadOnlyAttachment:
case ImageLayout::ShaderReadOnly:
case ImageLayout::TransferSrc:
case ImageLayout::TransferDst:
case ImageLayout::DepthReadOnlyStencilAttachment:
case ImageLayout::DepthAttachmentStencilReadOnly:
return true;
default:
return false;
}
}
bool IsValidMemoryObjectParameter(const Context *context,
angle::EntryPoint entryPoint,
GLenum pname)
{
switch (pname)
{
case GL_DEDICATED_MEMORY_OBJECT_EXT:
return true;
case GL_PROTECTED_MEMORY_OBJECT_EXT:
if (!context->getExtensions().protectedTexturesEXT)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
return true;
default:
return false;
}
}
bool ValidateObjectIdentifierAndName(const Context *context,
angle::EntryPoint entryPoint,
GLenum identifier,
GLuint name)
{
const bool isGLES11 = context->getClientVersion() == ES_1_1;
const bool isGLES3 = context->getClientVersion() >= ES_3_0;
const bool isGLES31 = context->getClientVersion() >= ES_3_1;
switch (identifier)
{
case GL_BUFFER_OBJECT_EXT:
if (context->getBuffer({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidBufferName);
return false;
}
return true;
case GL_SHADER_OBJECT_EXT:
if (isGLES11)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidType);
return false;
}
if (context->getShaderNoResolveCompile({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidShaderName);
return false;
}
return true;
case GL_PROGRAM_OBJECT_EXT:
if (isGLES11)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidType);
return false;
}
if (context->getProgramNoResolveLink({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidProgramName);
return false;
}
return true;
case GL_VERTEX_ARRAY_OBJECT_EXT:
if (!isGLES3 && !context->getExtensions().vertexArrayObjectOES)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidType);
return false;
}
if (context->getVertexArray({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidVertexArrayName);
return false;
}
return true;
case GL_QUERY_OBJECT_EXT:
if (!isGLES3 && !context->getExtensions().occlusionQueryBooleanEXT)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidType);
return false;
}
if (context->getQuery({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidQueryName);
return false;
}
return true;
case GL_TRANSFORM_FEEDBACK:
if (!isGLES3)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidType);
return false;
}
if (context->getTransformFeedback({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidTransformFeedbackName);
return false;
}
return true;
case GL_SAMPLER:
if (!isGLES3)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidType);
return false;
}
if (context->getSampler({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidSamplerName);
return false;
}
return true;
case GL_TEXTURE:
if (context->getTexture({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidTextureName);
return false;
}
return true;
case GL_RENDERBUFFER:
if (!context->isRenderbuffer({name}))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidRenderbufferName);
return false;
}
return true;
case GL_FRAMEBUFFER:
if (context->getFramebuffer({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidFramebufferName);
return false;
}
return true;
case GL_PROGRAM_PIPELINE_OBJECT_EXT:
if (!isGLES31 && !context->getExtensions().separateShaderObjectsEXT)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidType);
return false;
}
if (context->getProgramPipeline({name}) == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidProgramPipelineName);
return false;
}
return true;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidIndentifier);
return false;
}
}
bool ValidateClearTexImageFormat(const Context *context,
angle::EntryPoint entryPoint,
TextureType textureType,
const Format &textureFormat,
GLenum format,
GLenum type)
{
if (textureFormat.info->compressed)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureIsCompressed);
return false;
}
if (!ValidateTexImageFormatCombination(context, entryPoint, textureType,
textureFormat.info->internalFormat, format, type))
{
return false;
}
return true;
}
bool ValidateClearTexImageCommon(const Context *context,
angle::EntryPoint entryPoint,
TextureID texturePacked,
GLint level,
const std::optional<Box> &area,
GLenum format,
GLenum type,
const void *data)
{
if (texturePacked.value == 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kMissingTextureName);
return false;
}
Texture *tex = context->getTexture(texturePacked);
if (tex == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kMissingTextureName);
return false;
}
if (tex->getType() == TextureType::Buffer)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kBufferTextureNotAllowed);
return false;
}
if (!ValidMipLevel(context, tex->getType(), level))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMipLevel);
return false;
}
if (area.has_value() && (area->x < 0 || area->y < 0 || area->z < 0 || area->width < 0 ||
area->height < 0 || area->depth < 0))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kNegativeOffset);
return false;
}
if (tex->getType() == TextureType::CubeMap)
{
if (area.has_value() && area->z + area->depth > 6)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDestinationTextureTooSmall);
return false;
}
ImageIndexIterator it = ImageIndexIterator::MakeGeneric(
tex->getType(), level, level + 1, area.has_value() ? area->z : ImageIndex::kEntireLevel,
area.has_value() ? area->z + area->depth : ImageIndex::kEntireLevel);
while (it.hasNext())
{
const ImageIndex index = it.next();
TextureTarget target = index.getTarget();
const Extents extents = tex->getExtents(target, level);
if (!tex->getState().getImageDesc(index).format.valid())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDestinationLevelNotDefined);
return false;
}
if (area.has_value() &&
(area->x + area->width > extents.width || area->y + area->height > extents.height))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDestinationTextureTooSmall);
return false;
}
if (!ValidateClearTexImageFormat(context, entryPoint, tex->getType(),
tex->getFormat(target, level), format, type))
{
return false;
}
}
}
else
{
TextureTarget target = NonCubeTextureTypeToTarget(tex->getType());
const Extents extents = tex->getExtents(target, level);
if (!tex->getState().getImageDesc(target, level).format.valid())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDestinationLevelNotDefined);
return false;
}
if (area.has_value() &&
(area->x + area->width > extents.width || area->y + area->height > extents.height ||
area->z + area->depth > extents.depth))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kDestinationTextureTooSmall);
return false;
}
if (!ValidateClearTexImageFormat(context, entryPoint, tex->getType(),
tex->getFormat(target, level), format, type))
{
return false;
}
}
return true;
}
} // namespace
bool ValidateGetTexImage(const Context *context,
angle::EntryPoint entryPoint,
TextureTarget target,
GLint level)
{
if (!ValidTexture2DDestinationTarget(context, target) &&
!ValidTexture3DDestinationTarget(context, target))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidTextureTarget);
return false;
}
if (level < 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeLevel);
return false;
}
TextureType textureType = TextureTargetToType(target);
if (!ValidMipLevel(context, textureType, level))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMipLevel);
return false;
}
return true;
}
bool ValidateGetTexImageANGLE(const Context *context,
angle::EntryPoint entryPoint,
TextureTarget target,
GLint level,
GLenum format,
GLenum type,
const void *pixels)
{
if (!ValidateGetTexImage(context, entryPoint, target, level))
{
return false;
}
Texture *texture = context->getTextureByTarget(target);
if (!ValidateGetImageFormatAndType(context, entryPoint, texture, format, type))
{
return false;
}
GLsizei width = static_cast<GLsizei>(texture->getWidth(target, level));
GLsizei height = static_cast<GLsizei>(texture->getHeight(target, level));
if (!ValidatePixelPack(context, entryPoint, format, type, 0, 0, width, height, -1, nullptr,
pixels))
{
return false;
}
if (texture->getFormat(target, level).info->compressed)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kGetImageCompressed);
return false;
}
return true;
}
bool ValidateGetCompressedTexImageANGLE(const Context *context,
angle::EntryPoint entryPoint,
TextureTarget target,
GLint level,
const void *pixels)
{
if (!ValidateGetTexImage(context, entryPoint, target, level))
{
return false;
}
Texture *texture = context->getTextureByTarget(target);
if (!texture->getFormat(target, level).info->compressed)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kGetImageNotCompressed);
return false;
}
return true;
}
bool ValidateGetRenderbufferImageANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLenum target,
GLenum format,
GLenum type,
const void *pixels)
{
if (target != GL_RENDERBUFFER)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidRenderbufferTarget);
return false;
}
Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer();
if (!ValidateGetImageFormatAndType(context, entryPoint, renderbuffer, format, type))
{
return false;
}
GLsizei width = renderbuffer->getWidth();
GLsizei height = renderbuffer->getHeight();
if (!ValidatePixelPack(context, entryPoint, format, type, 0, 0, width, height, -1, nullptr,
pixels))
{
return false;
}
return true;
}
bool ValidateDrawElementsBaseVertexEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLint basevertex)
{
if (!context->getExtensions().drawElementsBaseVertexAny())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
return ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 1);
}
bool ValidateDrawElementsInstancedBaseVertexEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLsizei instancecount,
GLint basevertex)
{
if (!context->getExtensions().drawElementsBaseVertexAny())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
return ValidateDrawElementsInstancedBase(context, entryPoint, mode, count, type, indices,
instancecount, 0);
}
bool ValidateDrawRangeElementsBaseVertexEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
GLuint start,
GLuint end,
GLsizei count,
DrawElementsType type,
const void *indices,
GLint basevertex)
{
if (!context->getExtensions().drawElementsBaseVertexAny())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
if (end < start)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidElementRange);
return false;
}
if (!ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 1))
{
return false;
}
// Skip range checks for no-op calls.
if (count <= 0)
{
return true;
}
// Note that resolving the index range is a bit slow. We should probably optimize this.
IndexRange indexRange{IndexRange::Undefined()};
ANGLE_VALIDATION_TRY(context->getState().getVertexArray()->getIndexRange(
context, type, count, indices, context->getState().isPrimitiveRestartEnabled(),
&indexRange));
if (!indexRange.isEmpty() && (indexRange.end() > end || indexRange.start() < start))
{
// GL spec says that behavior in this case is undefined - generating an error is fine.
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExceedsElementRange);
return false;
}
return true;
}
bool ValidateMultiDrawElementsBaseVertexEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
const GLsizei *count,
DrawElementsType type,
const void *const *indices,
GLsizei drawcount,
const GLint *basevertex)
{
return true;
}
bool ValidateMultiDrawArraysEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode modePacked,
const GLint *first,
const GLsizei *count,
GLsizei primcount)
{
UNIMPLEMENTED();
return false;
}
bool ValidateMultiDrawElementsEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode modePacked,
const GLsizei *count,
DrawElementsType typePacked,
const void *const *indices,
GLsizei primcount)
{
UNIMPLEMENTED();
return false;
}
bool ValidateMultiDrawArraysIndirectEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode modePacked,
const void *indirect,
GLsizei drawcount,
GLsizei stride)
{
if (!ValidateMultiDrawIndirectBase(context, entryPoint, drawcount, stride))
{
return false;
}
if (!ValidateDrawArraysIndirect(context, entryPoint, modePacked, indirect))
{
return false;
}
return true;
}
bool ValidateMultiDrawElementsIndirectEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode modePacked,
DrawElementsType typePacked,
const void *indirect,
GLsizei drawcount,
GLsizei stride)
{
if (!ValidateMultiDrawIndirectBase(context, entryPoint, drawcount, stride))
{
return false;
}
const State &state = context->getState();
TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
if (!ValidateDrawElementsIndirect(context, entryPoint, modePacked, typePacked, indirect))
{
return false;
}
if (curTransformFeedback && curTransformFeedback->isActive() &&
!curTransformFeedback->isPaused())
{
// EXT_geometry_shader allows transform feedback to work with all draw commands.
// [EXT_geometry_shader] Section 12.1, "Transform Feedback"
if (context->getExtensions().geometryShaderAny() || context->getClientVersion() >= ES_3_2)
{
if (!ValidateTransformFeedbackPrimitiveMode(
context, entryPoint, curTransformFeedback->getPrimitiveMode(), modePacked))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidDrawModeTransformFeedback);
return false;
}
}
else
{
// An INVALID_OPERATION error is generated if transform feedback is active and not
// paused.
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kUnsupportedDrawModeForTransformFeedback);
return false;
}
}
return true;
}
bool ValidateDrawArraysInstancedBaseInstanceEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
GLint first,
GLsizei count,
GLsizei instanceCount,
GLuint baseInstance)
{
return ValidateDrawArraysInstancedBase(context, entryPoint, mode, first, count, instanceCount,
baseInstance);
}
bool ValidateDrawElementsInstancedBaseInstanceEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
void const *indices,
GLsizei instancecount,
GLuint baseinstance)
{
return ValidateDrawElementsInstancedBase(context, entryPoint, mode, count, type, indices,
instancecount, baseinstance);
}
bool ValidateDrawElementsInstancedBaseVertexBaseInstanceEXT(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
GLsizei count,
DrawElementsType typePacked,
const void *indices,
GLsizei instancecount,
GLint basevertex,
GLuint baseinstance)
{
return ValidateDrawElementsInstancedBase(context, entryPoint, mode, count, typePacked, indices,
instancecount, baseinstance);
}
bool ValidateDrawElementsBaseVertexOES(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLint basevertex)
{
if (!context->getExtensions().drawElementsBaseVertexAny())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
return ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 1);
}
bool ValidateDrawElementsInstancedBaseVertexOES(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLsizei instancecount,
GLint basevertex)
{
if (!context->getExtensions().drawElementsBaseVertexAny())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
return ValidateDrawElementsInstancedBase(context, entryPoint, mode, count, type, indices,
instancecount, 0);
}
bool ValidateDrawRangeElementsBaseVertexOES(const Context *context,
angle::EntryPoint entryPoint,
PrimitiveMode mode,
GLuint start,
GLuint end,
GLsizei count,
DrawElementsType type,
const void *indices,
GLint basevertex)
{
if (!context->getExtensions().drawElementsBaseVertexAny())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
if (end < start)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidElementRange);
return false;
}
if (!ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 1))
{
return false;
}
// Skip range checks for no-op calls.
if (count <= 0)
{
return true;
}
// Note that resolving the index range is a bit slow. We should probably optimize this.
IndexRange indexRange{IndexRange::Undefined()};
ANGLE_VALIDATION_TRY(context->getState().getVertexArray()->getIndexRange(
context, type, count, indices, context->getState().isPrimitiveRestartEnabled(),
&indexRange));
if (!indexRange.isEmpty() && (indexRange.end() > end || indexRange.start() < start))
{
// GL spec says that behavior in this case is undefined - generating an error is fine.
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExceedsElementRange);
return false;
}
return true;
}
// GL_KHR_blend_equation_advanced
bool ValidateBlendBarrierKHR(const Context *context, angle::EntryPoint entryPoint)
{
return true;
}
bool ValidateGetGraphicsResetStatusKHR(const Context *context, angle::EntryPoint entryPoint)
{
if (context->getClientVersion() < ES_2_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES2Required);
return false;
}
return true;
}
bool ValidateGetnUniformfvKHR(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei bufSize,
const GLfloat *params)
{
if (context->getClientVersion() < ES_2_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES2Required);
return false;
}
return ValidateSizedGetUniform(context, entryPoint, programPacked, locationPacked, bufSize,
nullptr);
}
bool ValidateGetnUniformivKHR(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei bufSize,
const GLint *params)
{
if (context->getClientVersion() < ES_2_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES2Required);
return false;
}
return ValidateSizedGetUniform(context, entryPoint, programPacked, locationPacked, bufSize,
nullptr);
}
bool ValidateGetnUniformuivKHR(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei bufSize,
const GLuint *params)
{
// Based on the spec, if ES 3.0 or later is not supported, all references to GetnUniformuiv
// should be removed.
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateSizedGetUniform(context, entryPoint, programPacked, locationPacked, bufSize,
nullptr);
}
bool ValidateReadnPixelsKHR(const Context *context,
angle::EntryPoint entryPoint,
GLint x,
GLint y,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
GLsizei bufSize,
const void *data)
{
if (context->getClientVersion() < ES_2_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES2Required);
return false;
}
if (bufSize < 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeBufSize);
return false;
}
return ValidateReadPixelsBase(context, entryPoint, x, y, width, height, format, type, bufSize,
nullptr, nullptr, nullptr, data);
}
bool ValidateBlendEquationOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum mode)
{
switch (mode)
{
case GL_FUNC_ADD_OES:
case GL_FUNC_SUBTRACT_OES:
case GL_FUNC_REVERSE_SUBTRACT_OES:
return true;
default:
errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidBlendEquation);
return false;
}
}
bool ValidateBlendEquationSeparateiEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint buf,
GLenum modeRGB,
GLenum modeAlpha)
{
return ValidateBlendEquationSeparatei(state, errors, entryPoint, buf, modeRGB, modeAlpha);
}
bool ValidateBlendEquationiEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint buf,
GLenum mode)
{
return ValidateBlendEquationi(state, errors, entryPoint, buf, mode);
}
bool ValidateBlendFuncSeparateiEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint buf,
GLenum srcRGB,
GLenum dstRGB,
GLenum srcAlpha,
GLenum dstAlpha)
{
return ValidateBlendFuncSeparatei(state, errors, entryPoint, buf, srcRGB, dstRGB, srcAlpha,
dstAlpha);
}
bool ValidateBlendFunciEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint buf,
GLenum src,
GLenum dst)
{
return ValidateBlendFunci(state, errors, entryPoint, buf, src, dst);
}
bool ValidateColorMaskiEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint index,
GLboolean r,
GLboolean g,
GLboolean b,
GLboolean a)
{
return ValidateColorMaski(state, errors, entryPoint, index, r, g, b, a);
}
bool ValidateDisableiEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum target,
GLuint index)
{
return ValidateDisablei(state, errors, entryPoint, target, index);
}
bool ValidateEnableiEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum target,
GLuint index)
{
return ValidateEnablei(state, errors, entryPoint, target, index);
}
bool ValidateIsEnablediEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum target,
GLuint index)
{
return ValidateIsEnabledi(state, errors, entryPoint, target, index);
}
bool ValidateBlendEquationSeparateiOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint buf,
GLenum modeRGB,
GLenum modeAlpha)
{
return ValidateBlendEquationSeparatei(state, errors, entryPoint, buf, modeRGB, modeAlpha);
}
bool ValidateBlendEquationiOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint buf,
GLenum mode)
{
return ValidateBlendEquationi(state, errors, entryPoint, buf, mode);
}
bool ValidateBlendFuncSeparateiOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint buf,
GLenum srcRGB,
GLenum dstRGB,
GLenum srcAlpha,
GLenum dstAlpha)
{
return ValidateBlendFuncSeparatei(state, errors, entryPoint, buf, srcRGB, dstRGB, srcAlpha,
dstAlpha);
}
bool ValidateBlendFunciOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint buf,
GLenum src,
GLenum dst)
{
return ValidateBlendFunci(state, errors, entryPoint, buf, src, dst);
}
bool ValidateColorMaskiOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLuint index,
GLboolean r,
GLboolean g,
GLboolean b,
GLboolean a)
{
return ValidateColorMaski(state, errors, entryPoint, index, r, g, b, a);
}
bool ValidateDisableiOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum target,
GLuint index)
{
return ValidateDisablei(state, errors, entryPoint, target, index);
}
bool ValidateEnableiOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum target,
GLuint index)
{
return ValidateEnablei(state, errors, entryPoint, target, index);
}
bool ValidateIsEnablediOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum target,
GLuint index)
{
return ValidateIsEnabledi(state, errors, entryPoint, target, index);
}
bool ValidateProvokingVertexANGLE(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
ProvokingVertexConvention provokeModePacked)
{
switch (provokeModePacked)
{
case ProvokingVertexConvention::FirstVertexConvention:
case ProvokingVertexConvention::LastVertexConvention:
break;
default:
errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidProvokingVertex);
return false;
}
return true;
}
bool ValidateGetInteger64vEXT(const Context *context,
angle::EntryPoint entryPoint,
GLenum pname,
const GLint64 *data)
{
if (!context->getExtensions().disjointTimerQueryEXT)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
GLenum nativeType = GL_NONE;
unsigned int numParams = 0;
if (!ValidateStateQuery(context, entryPoint, pname, &nativeType, &numParams))
{
return false;
}
return true;
}
bool ValidateCopyImageSubDataEXT(const Context *context,
angle::EntryPoint entryPoint,
GLuint srcName,
GLenum srcTarget,
GLint srcLevel,
GLint srcX,
GLint srcY,
GLint srcZ,
GLuint dstName,
GLenum dstTarget,
GLint dstLevel,
GLint dstX,
GLint dstY,
GLint dstZ,
GLsizei srcWidth,
GLsizei srcHeight,
GLsizei srcDepth)
{
return ValidateCopyImageSubDataBase(context, entryPoint, srcName, srcTarget, srcLevel, srcX,
srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ,
srcWidth, srcHeight, srcDepth);
}
bool ValidateCopyImageSubDataOES(const Context *context,
angle::EntryPoint entryPoint,
GLuint srcName,
GLenum srcTarget,
GLint srcLevel,
GLint srcX,
GLint srcY,
GLint srcZ,
GLuint dstName,
GLenum dstTarget,
GLint dstLevel,
GLint dstX,
GLint dstY,
GLint dstZ,
GLsizei srcWidth,
GLsizei srcHeight,
GLsizei srcDepth)
{
return ValidateCopyImageSubDataBase(context, entryPoint, srcName, srcTarget, srcLevel, srcX,
srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ,
srcWidth, srcHeight, srcDepth);
}
bool ValidateBufferStorageMemEXT(const Context *context,
angle::EntryPoint entryPoint,
TextureType target,
GLsizeiptr size,
MemoryObjectID memory,
GLuint64 offset)
{
UNIMPLEMENTED();
return false;
}
bool ValidateCreateMemoryObjectsEXT(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const MemoryObjectID *memoryObjects)
{
return ValidateGenOrDelete(context, entryPoint, n, memoryObjects);
}
bool ValidateDeleteMemoryObjectsEXT(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const MemoryObjectID *memoryObjects)
{
return ValidateGenOrDelete(context, entryPoint, n, memoryObjects);
}
bool ValidateGetMemoryObjectParameterivEXT(const Context *context,
angle::EntryPoint entryPoint,
MemoryObjectID memoryObject,
GLenum pname,
const GLint *params)
{
const MemoryObject *memory = context->getMemoryObject(memoryObject);
if (memory == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMemoryObject);
return false;
}
if (!IsValidMemoryObjectParameter(context, entryPoint, pname))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidMemoryObjectParameter);
return false;
}
return true;
}
bool ValidateGetUnsignedBytevEXT(const Context *context,
angle::EntryPoint entryPoint,
GLenum pname,
const GLubyte *data)
{
UNIMPLEMENTED();
return false;
}
bool ValidateGetUnsignedBytei_vEXT(const Context *context,
angle::EntryPoint entryPoint,
GLenum target,
GLuint index,
const GLubyte *data)
{
UNIMPLEMENTED();
return false;
}
bool ValidateIsMemoryObjectEXT(const Context *context,
angle::EntryPoint entryPoint,
MemoryObjectID memoryObject)
{
return true;
}
bool ValidateMemoryObjectParameterivEXT(const Context *context,
angle::EntryPoint entryPoint,
MemoryObjectID memoryObject,
GLenum pname,
const GLint *params)
{
const MemoryObject *memory = context->getMemoryObject(memoryObject);
if (memory == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMemoryObject);
return false;
}
if (memory->isImmutable())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kImmutableMemoryObject);
return false;
}
if (!IsValidMemoryObjectParameter(context, entryPoint, pname))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidMemoryObjectParameter);
return false;
}
return true;
}
bool ValidateTexStorageMem2DEXT(const Context *context,
angle::EntryPoint entryPoint,
TextureType target,
GLsizei levels,
GLenum internalFormat,
GLsizei width,
GLsizei height,
MemoryObjectID memory,
GLuint64 offset)
{
if (context->getClientVersion() < ES_3_0)
{
return ValidateES2TexStorageParametersBase(context, entryPoint, target, levels,
internalFormat, width, height);
}
return ValidateES3TexStorage2DParameters(context, entryPoint, target, levels, internalFormat,
width, height, 1);
}
bool ValidateTexStorageMem3DEXT(const Context *context,
angle::EntryPoint entryPoint,
TextureType target,
GLsizei levels,
GLenum internalFormat,
GLsizei width,
GLsizei height,
GLsizei depth,
MemoryObjectID memory,
GLuint64 offset)
{
UNIMPLEMENTED();
return false;
}
bool ValidateImportMemoryFdEXT(const Context *context,
angle::EntryPoint entryPoint,
MemoryObjectID memory,
GLuint64 size,
HandleType handleType,
GLint fd)
{
switch (handleType)
{
case HandleType::OpaqueFd:
break;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidHandleType);
return false;
}
return true;
}
bool ValidateImportMemoryZirconHandleANGLE(const Context *context,
angle::EntryPoint entryPoint,
MemoryObjectID memory,
GLuint64 size,
HandleType handleType,
GLuint handle)
{
switch (handleType)
{
case HandleType::ZirconVmo:
break;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidHandleType);
return false;
}
return true;
}
bool ValidateDeleteSemaphoresEXT(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const SemaphoreID *semaphores)
{
return ValidateGenOrDelete(context, entryPoint, n, semaphores);
}
bool ValidateGenSemaphoresEXT(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const SemaphoreID *semaphores)
{
return ValidateGenOrDelete(context, entryPoint, n, semaphores);
}
bool ValidateGetSemaphoreParameterui64vEXT(const Context *context,
angle::EntryPoint entryPoint,
SemaphoreID semaphore,
GLenum pname,
const GLuint64 *params)
{
UNIMPLEMENTED();
return false;
}
bool ValidateIsSemaphoreEXT(const Context *context,
angle::EntryPoint entryPoint,
SemaphoreID semaphore)
{
return true;
}
bool ValidateSemaphoreParameterui64vEXT(const Context *context,
angle::EntryPoint entryPoint,
SemaphoreID semaphore,
GLenum pname,
const GLuint64 *params)
{
UNIMPLEMENTED();
return false;
}
bool ValidateSignalSemaphoreEXT(const Context *context,
angle::EntryPoint entryPoint,
SemaphoreID semaphore,
GLuint numBufferBarriers,
const BufferID *buffers,
GLuint numTextureBarriers,
const TextureID *textures,
const GLenum *dstLayouts)
{
for (GLuint i = 0; i < numBufferBarriers; ++i)
{
if (!context->getBuffer(buffers[i]))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidBufferName);
return false;
}
}
for (GLuint i = 0; i < numTextureBarriers; ++i)
{
if (!context->getTexture(textures[i]))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidTextureName);
return false;
}
if (!IsValidImageLayout(FromGLenum<ImageLayout>(dstLayouts[i])))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidImageLayout);
return false;
}
}
return true;
}
bool ValidateWaitSemaphoreEXT(const Context *context,
angle::EntryPoint entryPoint,
SemaphoreID semaphore,
GLuint numBufferBarriers,
const BufferID *buffers,
GLuint numTextureBarriers,
const TextureID *textures,
const GLenum *srcLayouts)
{
for (GLuint i = 0; i < numBufferBarriers; ++i)
{
if (!context->getBuffer(buffers[i]))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidBufferName);
return false;
}
}
for (GLuint i = 0; i < numTextureBarriers; ++i)
{
if (!context->getTexture(textures[i]))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidTextureName);
return false;
}
if (!IsValidImageLayout(FromGLenum<ImageLayout>(srcLayouts[i])))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidImageLayout);
return false;
}
}
return true;
}
bool ValidateImportSemaphoreFdEXT(const Context *context,
angle::EntryPoint entryPoint,
SemaphoreID semaphore,
HandleType handleType,
GLint fd)
{
switch (handleType)
{
case HandleType::OpaqueFd:
break;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidHandleType);
return false;
}
return true;
}
bool ValidateGetTexParameterIivOES(const Context *context,
angle::EntryPoint entryPoint,
TextureType target,
GLenum pname,
const GLint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateGetTexParameterBase(context, entryPoint, target, pname, nullptr);
}
bool ValidateGetTexParameterIuivOES(const Context *context,
angle::EntryPoint entryPoint,
TextureType target,
GLenum pname,
const GLuint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateGetTexParameterBase(context, entryPoint, target, pname, nullptr);
}
bool ValidateTexParameterIivOES(const Context *context,
angle::EntryPoint entryPoint,
TextureType target,
GLenum pname,
const GLint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateTexParameterBase(context, entryPoint, target, pname, -1, true, params);
}
bool ValidateTexParameterIuivOES(const Context *context,
angle::EntryPoint entryPoint,
TextureType target,
GLenum pname,
const GLuint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateTexParameterBase(context, entryPoint, target, pname, -1, true, params);
}
bool ValidateGetSamplerParameterIivOES(const Context *context,
angle::EntryPoint entryPoint,
SamplerID sampler,
GLenum pname,
const GLint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateGetSamplerParameterBase(context, entryPoint, sampler, pname, nullptr, params);
}
bool ValidateGetSamplerParameterIuivOES(const Context *context,
angle::EntryPoint entryPoint,
SamplerID sampler,
GLenum pname,
const GLuint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateGetSamplerParameterBase(context, entryPoint, sampler, pname, nullptr, params);
}
bool ValidateSamplerParameterIivOES(const Context *context,
angle::EntryPoint entryPoint,
SamplerID sampler,
GLenum pname,
const GLint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateSamplerParameterBase(context, entryPoint, sampler, pname, -1, true, params);
}
bool ValidateSamplerParameterIuivOES(const Context *context,
angle::EntryPoint entryPoint,
SamplerID sampler,
GLenum pname,
const GLuint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateSamplerParameterBase(context, entryPoint, sampler, pname, -1, true, params);
}
bool ValidateGetSamplerParameterIivEXT(const Context *context,
angle::EntryPoint entryPoint,
SamplerID samplerPacked,
GLenum pname,
const GLint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateGetSamplerParameterBase(context, entryPoint, samplerPacked, pname, nullptr,
params);
}
bool ValidateGetSamplerParameterIuivEXT(const Context *context,
angle::EntryPoint entryPoint,
SamplerID samplerPacked,
GLenum pname,
const GLuint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateGetSamplerParameterBase(context, entryPoint, samplerPacked, pname, nullptr,
params);
}
bool ValidateGetTexParameterIivEXT(const Context *context,
angle::EntryPoint entryPoint,
TextureType targetPacked,
GLenum pname,
const GLint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateGetTexParameterBase(context, entryPoint, targetPacked, pname, nullptr);
}
bool ValidateGetTexParameterIuivEXT(const Context *context,
angle::EntryPoint entryPoint,
TextureType targetPacked,
GLenum pname,
const GLuint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateGetTexParameterBase(context, entryPoint, targetPacked, pname, nullptr);
}
bool ValidateSamplerParameterIivEXT(const Context *context,
angle::EntryPoint entryPoint,
SamplerID samplerPacked,
GLenum pname,
const GLint *param)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateSamplerParameterBase(context, entryPoint, samplerPacked, pname, -1, true, param);
}
bool ValidateSamplerParameterIuivEXT(const Context *context,
angle::EntryPoint entryPoint,
SamplerID samplerPacked,
GLenum pname,
const GLuint *param)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateSamplerParameterBase(context, entryPoint, samplerPacked, pname, -1, true, param);
}
bool ValidateTexParameterIivEXT(const Context *context,
angle::EntryPoint entryPoint,
TextureType targetPacked,
GLenum pname,
const GLint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateTexParameterBase(context, entryPoint, targetPacked, pname, -1, true, params);
}
bool ValidateTexParameterIuivEXT(const Context *context,
angle::EntryPoint entryPoint,
TextureType targetPacked,
GLenum pname,
const GLuint *params)
{
if (context->getClientVersion() < ES_3_0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateTexParameterBase(context, entryPoint, targetPacked, pname, -1, true, params);
}
bool ValidateImportSemaphoreZirconHandleANGLE(const Context *context,
angle::EntryPoint entryPoint,
SemaphoreID semaphore,
HandleType handleType,
GLuint handle)
{
switch (handleType)
{
case HandleType::ZirconEvent:
break;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidHandleType);
return false;
}
return true;
}
namespace
{
enum class PLSExpectedStatus
{
Inactive,
Active,
Any
};
bool ValidatePLSCommon(const Context *context,
angle::EntryPoint entryPoint,
PLSExpectedStatus expectedStatus)
{
Framebuffer *framebuffer = context->getState().getDrawFramebuffer();
if (expectedStatus != PLSExpectedStatus::Active)
{
// INVALID_FRAMEBUFFER_OPERATION is generated if the default framebuffer object name 0 is
// bound to DRAW_FRAMEBUFFER.
if (framebuffer->id().value == 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_FRAMEBUFFER_OPERATION, kPLSDefaultFramebufferBound);
return false;
}
}
// INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the draw framebuffer is
// in an interrupted state.
const PixelLocalStorage *pls = framebuffer->peekPixelLocalStorage();
if (pls != nullptr && pls->interruptCount() != 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_FRAMEBUFFER_OPERATION, kPLSInterrupted);
return false;
}
if (expectedStatus == PLSExpectedStatus::Active)
{
// INVALID_OPERATION is generated if PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is zero.
if (context->getState().getPixelLocalStorageActivePlanes() == 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSInactive);
return false;
}
}
else if (expectedStatus == PLSExpectedStatus::Inactive)
{
// INVALID_OPERATION is generated if PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE is nonzero.
if (context->getState().getPixelLocalStorageActivePlanes() != 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSActive);
return false;
}
}
return true;
}
bool ValidatePLSCommon(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
PLSExpectedStatus expectedStatus)
{
if (!ValidatePLSCommon(context, entryPoint, expectedStatus))
{
return false;
}
// INVALID_VALUE is generated if <plane> < 0 or <plane> >= MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE.
if (plane < 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kPLSPlaneLessThanZero);
return false;
}
if (plane >= static_cast<GLint>(context->getCaps().maxPixelLocalStoragePlanes))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kPLSPlaneOutOfRange);
return false;
}
return true;
}
bool ValidateGetFramebufferPixelLocalStorageParameterCommon(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
GLenum pname,
const void *params)
{
if (context->getState().getDrawFramebuffer()->id().value == 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_FRAMEBUFFER_OPERATION, kPLSDefaultFramebufferBound);
return false;
}
if (plane < 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kPLSPlaneLessThanZero);
return false;
}
if (plane >= static_cast<GLint>(context->getCaps().maxPixelLocalStoragePlanes))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kPLSPlaneOutOfRange);
return false;
}
switch (pname)
{
case GL_PIXEL_LOCAL_FORMAT_ANGLE:
case GL_PIXEL_LOCAL_TEXTURE_NAME_ANGLE:
case GL_PIXEL_LOCAL_TEXTURE_LEVEL_ANGLE:
case GL_PIXEL_LOCAL_TEXTURE_LAYER_ANGLE:
case GL_PIXEL_LOCAL_CLEAR_VALUE_FLOAT_ANGLE:
case GL_PIXEL_LOCAL_CLEAR_VALUE_INT_ANGLE:
case GL_PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_ANGLE:
break;
default:
ANGLE_VALIDATION_ERRORF(GL_INVALID_ENUM, kEnumNotSupported, pname);
return false;
}
if (params == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kPLSParamsNULL);
return false;
}
return true;
}
bool ValidateGetFramebufferPixelLocalStorageParameterRobustCommon(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
GLenum pname,
GLsizei bufSize,
const void *params)
{
if (!ValidateGetFramebufferPixelLocalStorageParameterCommon(context, entryPoint, plane, pname,
params))
{
// Error already generated.
return false;
}
GLsizei paramCount = 1;
switch (pname)
{
case GL_PIXEL_LOCAL_CLEAR_VALUE_FLOAT_ANGLE:
case GL_PIXEL_LOCAL_CLEAR_VALUE_INT_ANGLE:
case GL_PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_ANGLE:
paramCount = 4;
break;
}
if (paramCount > bufSize)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInsufficientParams);
return false;
}
return true;
}
bool ValidatePLSInternalformat(const Context *context,
angle::EntryPoint entryPoint,
GLenum internalformat)
{
// INVALID_ENUM is generated if <internalformat> is not one of the acceptable values in Table
// X.2, or NONE.
switch (internalformat)
{
case GL_RGBA8:
case GL_RGBA8I:
case GL_RGBA8UI:
case GL_R32F:
case GL_R32UI:
return true;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kPLSInvalidInternalformat);
return false;
}
}
bool ValidatePLSTextureType(const Context *context,
angle::EntryPoint entryPoint,
Texture *tex,
size_t *textureDepth)
{
// INVALID_OPERATION is generated if <backingtexture> is nonzero
// and not of type TEXTURE_2D, TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP,
// or TEXTURE_CUBE_MAP_ARRAY.
switch (tex->getType())
{
case TextureType::_2D:
*textureDepth = 1;
return true;
case TextureType::_2DArray:
*textureDepth = tex->getDepth(TextureTarget::_2DArray, 0);
return true;
case TextureType::CubeMap:
*textureDepth = 6;
return true;
case TextureType::CubeMapArray:
*textureDepth = tex->getDepth(TextureTarget::CubeMapArray, 0);
return true;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSInvalidTextureType);
return false;
}
}
bool ValidatePLSActiveBlendFunc(const Context *context,
angle::EntryPoint entryPoint,
gl::BlendFactorType blendFunc)
{
// INVALID_OPERATION is generated if BLEND_DST_ALPHA, BLEND_DST_RGB, BLEND_SRC_ALPHA, or
// BLEND_SRC_RGB, for any draw buffer, is a blend function requiring the secondary color input,
// as specified in EXT_blend_func_extended.
ASSERT(context->getState().getExtensions().blendFuncExtendedEXT);
switch (blendFunc)
{
case gl::BlendFactorType::Src1Color:
case gl::BlendFactorType::OneMinusSrc1Color:
case gl::BlendFactorType::Src1Alpha:
case gl::BlendFactorType::OneMinusSrc1Alpha:
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSSecondaryBlendEnabled);
return false;
default:
return true;
}
}
bool ValidatePLSActiveBlendEquation(const Context *context,
angle::EntryPoint entryPoint,
gl::BlendEquationType blendEquation)
{
// INVALID_OPERATION is generated if BLEND_EQUATION_RGB and/or BLEND_EQUATION_ALPHA is an
// advanced blend equation defined in KHR_blend_equation_advanced.
ASSERT(context->getState().getExtensions().blendEquationAdvancedKHR ||
context->getClientVersion() >= ES_3_2);
switch (blendEquation)
{
case gl::BlendEquationType::Multiply:
case gl::BlendEquationType::Screen:
case gl::BlendEquationType::Overlay:
case gl::BlendEquationType::Darken:
case gl::BlendEquationType::Lighten:
case gl::BlendEquationType::Colordodge:
case gl::BlendEquationType::Colorburn:
case gl::BlendEquationType::Hardlight:
case gl::BlendEquationType::Softlight:
case gl::BlendEquationType::Difference:
case gl::BlendEquationType::Exclusion:
case gl::BlendEquationType::HslHue:
case gl::BlendEquationType::HslSaturation:
case gl::BlendEquationType::HslColor:
case gl::BlendEquationType::HslLuminosity:
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSAdvancedBlendEnabled);
return false;
default:
return true;
}
}
bool ValidatePLSLoadOperation(const Context *context, angle::EntryPoint entryPoint, GLenum loadop)
{
// INVALID_ENUM is generated if <loadops>[0..<n>-1] is not one of the Load Operations enumerated
// in Table X.1.
switch (loadop)
{
case GL_LOAD_OP_ZERO_ANGLE:
case GL_LOAD_OP_CLEAR_ANGLE:
case GL_LOAD_OP_LOAD_ANGLE:
case GL_DONT_CARE:
return true;
default:
ANGLE_VALIDATION_ERRORF(GL_INVALID_ENUM, kPLSInvalidLoadOperation, loadop);
return false;
}
}
bool ValidatePLSStoreOperation(const Context *context, angle::EntryPoint entryPoint, GLenum storeop)
{
// INVALID_ENUM is generated if <storeops>[0..PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE-1] is not
// one of the Store Operations enumerated in Table X.2.
switch (storeop)
{
case GL_STORE_OP_STORE_ANGLE:
case GL_DONT_CARE:
return true;
default:
ANGLE_VALIDATION_ERRORF(GL_INVALID_ENUM, kPLSInvalidStoreOperation, storeop);
return false;
}
}
} // namespace
bool ValidateFramebufferMemorylessPixelLocalStorageANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
GLenum internalformat)
{
if (!ValidatePLSCommon(context, entryPoint, plane, PLSExpectedStatus::Any))
{
return false;
}
// INVALID_ENUM is generated if <internalformat> is not one of the acceptable values in Table
// X.2, or NONE.
if (internalformat != GL_NONE)
{
if (!ValidatePLSInternalformat(context, entryPoint, internalformat))
{
return false;
}
}
return true;
}
bool ValidateFramebufferTexturePixelLocalStorageANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
TextureID backingtexture,
GLint level,
GLint layer)
{
if (!ValidatePLSCommon(context, entryPoint, plane, PLSExpectedStatus::Any))
{
return false;
}
if (backingtexture.value != 0)
{
Texture *tex = context->getTexture(backingtexture);
// INVALID_OPERATION is generated if <backingtexture> is not the name of an existing
// immutable texture object, or zero.
if (!tex)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidTextureName);
return false;
}
if (!tex->getImmutableFormat())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureIsNotImmutable);
return false;
}
// INVALID_OPERATION is generated if <backingtexture> is nonzero
// and not of type GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY, GL_TEXTURE_CUBE_MAP,
// or GL_TEXTURE_CUBE_MAP_ARRAY.
size_t textureDepth;
if (!ValidatePLSTextureType(context, entryPoint, tex, &textureDepth))
{
return false;
}
// INVALID_VALUE is generated if <backingtexture> is nonzero and <level> < 0.
if (level < 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeLevel);
return false;
}
// INVALID_VALUE is generated if <backingtexture> is nonzero and <level> >= the
// immutable number of mipmap levels in <backingtexture>.
if (static_cast<GLuint>(level) >= tex->getImmutableLevels())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kTextureLevelOutOfRange);
return false;
}
// INVALID_VALUE is generated if <backingtexture> is nonzero and <layer> < 0.
if (layer < 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeLayer);
return false;
}
// INVALID_VALUE is generated if <backingtexture> is nonzero and <layer> >= the immutable
// number of texture layers in <backingtexture>.
if ((size_t)layer >= textureDepth)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kTextureLayerOutOfRange);
return false;
}
// INVALID_ENUM is generated if <backingtexture> is nonzero and its internalformat is not
// one of the acceptable values in Table X.2.
ASSERT(tex->getImmutableFormat());
GLenum internalformat = tex->getState().getBaseLevelDesc().format.info->internalFormat;
if (!ValidatePLSInternalformat(context, entryPoint, internalformat))
{
return false;
}
}
return true;
}
bool ValidateFramebufferPixelLocalClearValuefvANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
const GLfloat[])
{
return ValidatePLSCommon(context, entryPoint, plane, PLSExpectedStatus::Inactive);
}
bool ValidateFramebufferPixelLocalClearValueivANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
const GLint[])
{
return ValidatePLSCommon(context, entryPoint, plane, PLSExpectedStatus::Inactive);
}
bool ValidateFramebufferPixelLocalClearValueuivANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
const GLuint[])
{
return ValidatePLSCommon(context, entryPoint, plane, PLSExpectedStatus::Inactive);
}
bool ValidateBeginPixelLocalStorageANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const GLenum loadops[])
{
if (!ValidatePLSCommon(context, entryPoint, PLSExpectedStatus::Inactive))
{
return false;
}
const State &state = context->getState();
const Framebuffer *framebuffer = state.getDrawFramebuffer();
// INVALID_OPERATION is generated if the value of SAMPLE_BUFFERS is 1 (i.e., if rendering to a
// multisampled framebuffer).
if (framebuffer->getSamples(context) != 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSMultisamplingEnabled);
return false;
}
// INVALID_OPERATION is generated if DITHER is enabled.
if (state.isDitherEnabled())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSDitherEnabled);
return false;
}
// INVALID_OPERATION is generated if TRANSFORM_FEEDBACK_ACTIVE is true.
if (state.isTransformFeedbackActive())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSTransformFeedbackActive);
return false;
}
// INVALID_OPERATION is generated if QCOM_tiled_rendering is active.
if (context->getPrivateState().isTiledRendering())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSTiledRenderingActive);
return false;
}
// INVALID_OPERATION is generated if BLEND_DST_ALPHA, BLEND_DST_RGB, BLEND_SRC_ALPHA, or
// BLEND_SRC_RGB, for any draw buffer, is a blend function requiring the secondary color input,
// as specified in EXT_blend_func_extended.
if (state.getExtensions().blendFuncExtendedEXT)
{
for (GLsizei i = 0; i < state.getCaps().maxDrawBuffers; ++i)
{
const BlendStateExt &blend = state.getBlendStateExt();
if (!ValidatePLSActiveBlendFunc(context, entryPoint, blend.getDstAlphaIndexed(i)) ||
!ValidatePLSActiveBlendFunc(context, entryPoint, blend.getDstColorIndexed(i)) ||
!ValidatePLSActiveBlendFunc(context, entryPoint, blend.getSrcAlphaIndexed(i)) ||
!ValidatePLSActiveBlendFunc(context, entryPoint, blend.getSrcColorIndexed(i)))
{
return false;
}
}
}
// INVALID_OPERATION is generated if BLEND_EQUATION_RGB and/or BLEND_EQUATION_ALPHA is an
// advanced blend equation defined in KHR_blend_equation_advanced.
if (state.getExtensions().blendEquationAdvancedKHR || context->getClientVersion() >= ES_3_2)
{
if (!ValidatePLSActiveBlendEquation(context, entryPoint,
state.getBlendStateExt().getEquationColorIndexed(0)) ||
!ValidatePLSActiveBlendEquation(context, entryPoint,
state.getBlendStateExt().getEquationAlphaIndexed(0)))
{
return false;
}
}
// INVALID_VALUE is generated if <n> < 1 or <n> > MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE.
if (n < 1)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kPLSPlanesLessThanOne);
return false;
}
if (n > static_cast<GLsizei>(context->getCaps().maxPixelLocalStoragePlanes))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kPLSPlanesOutOfRange);
return false;
}
// INVALID_FRAMEBUFFER_OPERATION is generated if the draw framebuffer has an image attached to
// any color attachment point on or after:
//
// COLOR_ATTACHMENT0 + MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES_ANGLE - <n>
//
const Caps &caps = context->getCaps();
for (int i = caps.maxCombinedDrawBuffersAndPixelLocalStoragePlanes - n; i < caps.maxDrawBuffers;
++i)
{
if (framebuffer->getColorAttachment(i))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_FRAMEBUFFER_OPERATION,
kPLSMaxCombinedDrawBuffersAndPlanesExceded);
return false;
}
}
// INVALID_VALUE is generated if <loadops> is NULL.
if (loadops == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kPLSLoadOpsNULL);
return false;
}
const PixelLocalStorage *pls = framebuffer->peekPixelLocalStorage();
bool hasTextureBackedPLSPlanes = false;
Extents textureBackedPLSExtents{};
for (GLsizei i = 0; i < n; ++i)
{
// INVALID_ENUM is generated if <loadops>[0..<n>-1] is not one of the Load Operations
// enumerated in Table X.1.
if (!ValidatePLSLoadOperation(context, entryPoint, loadops[i]))
{
return false;
}
// INVALID_OPERATION is generated if a pixel local storage plane at index [0..<n>-1] is in a
// deinitialized state.
if (pls == nullptr || pls->getPlane(i).isDeinitialized())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSEnablingDeinitializedPlane);
return false;
}
// [ANGLE_shader_pixel_local_storage] Section 4.4.2.X "Configuring Pixel Local Storage
// on a Framebuffer": When a texture object is deleted, any pixel local storage plane to
// which it was bound is automatically converted to a memoryless plane of matching
// internalformat.
const PixelLocalStoragePlane &plane = pls->getPlane(i);
Extents textureExtents;
if (plane.getTextureImageExtents(context, &textureExtents))
{
// INVALID_OPERATION is generated if all enabled, texture-backed pixel local storage
// planes do not have the same width and height.
if (!hasTextureBackedPLSPlanes)
{
textureBackedPLSExtents = textureExtents;
hasTextureBackedPLSPlanes = true;
}
else if (textureExtents != textureBackedPLSExtents)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSMismatchedBackingTextureSizes);
return false;
}
}
else
{
// INVALID_OPERATION is generated if <loadops>[0..<n>-1] is LOAD_OP_LOAD_ANGLE and the
// pixel local storage plane at that same index is memoryless.
if (loadops[i] == GL_LOAD_OP_LOAD_ANGLE)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSKeepingMemorylessPlane);
return false;
}
}
if (!plane.isMemoryless())
{
ASSERT(plane.getTextureID() != TextureID());
const ImageIndex &planeImageIdx = plane.getTextureImageIndex();
ASSERT(planeImageIdx.getLayerCount() == 1);
ASSERT(planeImageIdx.getLevelIndex() >= 0);
// INVALID_OPERATION is generated if, for any active backing texture, the mipmap level
// bound to pixel local storage is outside the effective base/max range of that texture.
const Texture *const backingTexture = plane.getBackingTexture(context);
if (planeImageIdx.getLevelIndex() <
static_cast<GLint>(backingTexture->getState().getEffectiveBaseLevel()) ||
planeImageIdx.getLevelIndex() >
static_cast<GLint>(backingTexture->getState().getEffectiveMaxLevel()))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSLevelIndexOutOfRange);
return false;
}
// INVALID_OPERATION is generated if a single texture slice is bound to more than one
// active pixel local storage plane.
for (GLsizei j = i + 1; j < n; ++j)
{
const PixelLocalStoragePlane &otherPlane = pls->getPlane(j);
if (!otherPlane.isMemoryless() &&
plane.getTextureID() == otherPlane.getTextureID() &&
planeImageIdx == otherPlane.getTextureImageIndex())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSSingleTexImageMultiplePlanes);
return false;
}
}
// INVALID_OPERATION is generated if a single texture slice is simultaneously bound to
// an active pixel local storage plane and attached to an enabled drawbuffer.
const GLuint maxDrawBuffersWithPLSPlanes = std::min<GLuint>(
caps.maxCombinedDrawBuffersAndPixelLocalStoragePlanes - n, caps.maxDrawBuffers);
for (GLuint j = 0; j < maxDrawBuffersWithPLSPlanes; ++j)
{
if (framebuffer->getDrawBufferMask().test(j) &&
framebuffer->getColorAttachment(j)->isTextureWithId(plane.getTextureID()))
{
// Compare the ImageIndex values for the PLS plane and framebuffer attachment
// manually; the framebuffer uses a layer index of -1 for texture2d attachments,
// whereas PLS uses a layer index of 0.
const ImageIndex &attachmentImageIdx =
framebuffer->getColorAttachment(j)->getTextureImageIndex();
ASSERT(attachmentImageIdx.getLayerCount() == 1);
if (planeImageIdx.getType() == attachmentImageIdx.getType() &&
planeImageIdx.getLevelIndex() == attachmentImageIdx.getLevelIndex() &&
planeImageIdx.getLayerIndex() ==
std::max(attachmentImageIdx.getLayerIndex(), 0))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION,
kPLSSingleTexImagePLSAndAttachment);
return false;
}
}
}
}
}
const FramebufferAttachment *firstAttachment =
framebuffer->getState().getFirstNonNullAttachment();
if (firstAttachment)
{
// INVALID_OPERATION is generated if the draw framebuffer has other attachments, and its
// enabled, texture-backed pixel local storage planes do not have identical dimensions
// with the rendering area.
if (hasTextureBackedPLSPlanes &&
textureBackedPLSExtents != framebuffer->getState().getAttachmentExtentsIntersection())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSDimensionsDontMatchRenderingArea);
return false;
}
}
else
{
// INVALID_OPERATION is generated if the draw framebuffer has no attachments and no
// enabled, texture-backed pixel local storage planes.
if (!hasTextureBackedPLSPlanes)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPLSNoAttachmentsNoTextureBacked);
return false;
}
}
return true;
}
bool ValidateEndPixelLocalStorageANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const GLenum storeops[])
{
if (!ValidatePLSCommon(context, entryPoint, PLSExpectedStatus::Active))
{
return false;
}
// INVALID_VALUE is generated if <n> != PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE.
if (n != context->getState().getPixelLocalStorageActivePlanes())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kPLSNNotEqualActivePlanes);
return false;
}
// INVALID_ENUM is generated if <storeops>[0..PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE-1] is not
// one of the Store Operations enumerated in Table X.2.
for (GLsizei i = 0; i < n; ++i)
{
if (!ValidatePLSStoreOperation(context, entryPoint, storeops[i]))
{
return false;
}
}
return true;
}
bool ValidatePixelLocalStorageBarrierANGLE(const Context *context, angle::EntryPoint entryPoint)
{
return ValidatePLSCommon(context, entryPoint, PLSExpectedStatus::Active);
}
bool ValidateFramebufferPixelLocalStorageInterruptANGLE(const Context *context,
angle::EntryPoint entryPoint)
{
// INVALID_FRAMEBUFFER_OPERATION is generated if the current interrupt count on the draw
// framebuffer is greater than or equal to 255.
const PixelLocalStorage *pls =
context->getState().getDrawFramebuffer()->peekPixelLocalStorage();
if (pls != nullptr && pls->interruptCount() >= 255)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_FRAMEBUFFER_OPERATION, kPLSInterruptOverflow);
return false;
}
return true;
}
bool ValidateFramebufferPixelLocalStorageRestoreANGLE(const Context *context,
angle::EntryPoint entryPoint)
{
// This command is ignored when the default framebuffer object name 0 is bound.
const Framebuffer *framebuffer = context->getState().getDrawFramebuffer();
if (context->getState().getDrawFramebuffer()->id().value == 0)
{
return true;
}
// INVALID_FRAMEBUFFER_OPERATION is generated if pixel local storage on the draw framebuffer is
// not in an interrupted state.
const PixelLocalStorage *pls = framebuffer->peekPixelLocalStorage();
if (pls == nullptr || pls->interruptCount() == 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_FRAMEBUFFER_OPERATION, kPLSNotInterrupted);
return false;
}
return true;
}
bool ValidateGetFramebufferPixelLocalStorageParameterfvANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
GLenum pname,
const GLfloat *params)
{
return ValidateGetFramebufferPixelLocalStorageParameterCommon(context, entryPoint, plane, pname,
params);
}
bool ValidateGetFramebufferPixelLocalStorageParameterivANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
GLenum pname,
const GLint *params)
{
return ValidateGetFramebufferPixelLocalStorageParameterCommon(context, entryPoint, plane, pname,
params);
}
bool ValidateGetFramebufferPixelLocalStorageParameterfvRobustANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
GLenum pname,
GLsizei bufSize,
const GLsizei *length,
const GLfloat *params)
{
if (!context->getExtensions().shaderPixelLocalStorageANGLE)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
return ValidateGetFramebufferPixelLocalStorageParameterRobustCommon(context, entryPoint, plane,
pname, bufSize, params);
}
bool ValidateGetFramebufferPixelLocalStorageParameterivRobustANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLint plane,
GLenum pname,
GLsizei bufSize,
const GLsizei *length,
const GLint *params)
{
if (!context->getExtensions().shaderPixelLocalStorageANGLE)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
return ValidateGetFramebufferPixelLocalStorageParameterRobustCommon(context, entryPoint, plane,
pname, bufSize, params);
}
bool ValidateFramebufferFetchBarrierEXT(const Context *context, angle::EntryPoint entryPoint)
{
return true;
}
bool ValidatePatchParameteriEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum pname,
GLint value)
{
return ValidatePatchParameteriBase(state, errors, entryPoint, pname, value);
}
bool ValidatePatchParameteriOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum pname,
GLint value)
{
return ValidatePatchParameteriBase(state, errors, entryPoint, pname, value);
}
bool ValidateTexStorageMemFlags2DANGLE(const Context *context,
angle::EntryPoint entryPoint,
TextureType targetPacked,
GLsizei levels,
GLenum internalFormat,
GLsizei width,
GLsizei height,
MemoryObjectID memoryPacked,
GLuint64 offset,
GLbitfield createFlags,
GLbitfield usageFlags,
const void *imageCreateInfoPNext)
{
if (!ValidateTexStorageMem2DEXT(context, entryPoint, targetPacked, levels, internalFormat,
width, height, memoryPacked, offset))
{
return false;
}
// |createFlags| and |usageFlags| must only have bits specified by the extension.
constexpr GLbitfield kAllCreateFlags =
GL_CREATE_SPARSE_BINDING_BIT_ANGLE | GL_CREATE_SPARSE_RESIDENCY_BIT_ANGLE |
GL_CREATE_SPARSE_ALIASED_BIT_ANGLE | GL_CREATE_MUTABLE_FORMAT_BIT_ANGLE |
GL_CREATE_CUBE_COMPATIBLE_BIT_ANGLE | GL_CREATE_ALIAS_BIT_ANGLE |
GL_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_ANGLE | GL_CREATE_2D_ARRAY_COMPATIBLE_BIT_ANGLE |
GL_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_ANGLE | GL_CREATE_EXTENDED_USAGE_BIT_ANGLE |
GL_CREATE_PROTECTED_BIT_ANGLE | GL_CREATE_DISJOINT_BIT_ANGLE |
GL_CREATE_CORNER_SAMPLED_BIT_ANGLE | GL_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_ANGLE |
GL_CREATE_SUBSAMPLED_BIT_ANGLE;
if ((createFlags & ~kAllCreateFlags) != 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidExternalCreateFlags);
return false;
}
constexpr GLbitfield kAllUsageFlags =
GL_USAGE_TRANSFER_SRC_BIT_ANGLE | GL_USAGE_TRANSFER_DST_BIT_ANGLE |
GL_USAGE_SAMPLED_BIT_ANGLE | GL_USAGE_STORAGE_BIT_ANGLE |
GL_USAGE_COLOR_ATTACHMENT_BIT_ANGLE | GL_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT_ANGLE |
GL_USAGE_TRANSIENT_ATTACHMENT_BIT_ANGLE | GL_USAGE_INPUT_ATTACHMENT_BIT_ANGLE |
GL_USAGE_SHADING_RATE_IMAGE_BIT_ANGLE | GL_USAGE_FRAGMENT_DENSITY_MAP_BIT_ANGLE;
if ((usageFlags & ~kAllUsageFlags) != 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidExternalUsageFlags);
return false;
}
return true;
}
bool ValidateTexStorageMemFlags2DMultisampleANGLE(const Context *context,
angle::EntryPoint entryPoint,
TextureType targetPacked,
GLsizei samples,
GLenum internalFormat,
GLsizei width,
GLsizei height,
GLboolean fixedSampleLocations,
MemoryObjectID memoryPacked,
GLuint64 offset,
GLbitfield createFlags,
GLbitfield usageFlags,
const void *imageCreateInfoPNext)
{
UNIMPLEMENTED();
return false;
}
bool ValidateTexStorageMemFlags3DANGLE(const Context *context,
angle::EntryPoint entryPoint,
TextureType targetPacked,
GLsizei levels,
GLenum internalFormat,
GLsizei width,
GLsizei height,
GLsizei depth,
MemoryObjectID memoryPacked,
GLuint64 offset,
GLbitfield createFlags,
GLbitfield usageFlags,
const void *imageCreateInfoPNext)
{
UNIMPLEMENTED();
return false;
}
bool ValidateTexStorageMemFlags3DMultisampleANGLE(const Context *context,
angle::EntryPoint entryPoint,
TextureType targetPacked,
GLsizei samples,
GLenum internalFormat,
GLsizei width,
GLsizei height,
GLsizei depth,
GLboolean fixedSampleLocations,
MemoryObjectID memoryPacked,
GLuint64 offset,
GLbitfield createFlags,
GLbitfield usageFlags,
const void *imageCreateInfoPNext)
{
UNIMPLEMENTED();
return false;
}
// GL_EXT_buffer_storage
bool ValidateBufferStorageEXT(const Context *context,
angle::EntryPoint entryPoint,
BufferBinding targetPacked,
GLsizeiptr size,
const void *data,
GLbitfield flags)
{
if (!context->isValidBufferBinding(targetPacked))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidBufferTypes);
return false;
}
if (size <= 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNonPositiveSize);
return false;
}
constexpr GLbitfield kAllUsageFlags =
(GL_DYNAMIC_STORAGE_BIT_EXT | GL_MAP_READ_BIT | GL_MAP_WRITE_BIT |
GL_MAP_PERSISTENT_BIT_EXT | GL_MAP_COHERENT_BIT_EXT | GL_CLIENT_STORAGE_BIT_EXT);
if ((flags & ~kAllUsageFlags) != 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidBufferUsageFlags);
return false;
}
if (((flags & GL_MAP_PERSISTENT_BIT_EXT) != 0) &&
((flags & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidBufferUsageFlags);
return false;
}
if (((flags & GL_MAP_COHERENT_BIT_EXT) != 0) && ((flags & GL_MAP_PERSISTENT_BIT_EXT) == 0))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidBufferUsageFlags);
return false;
}
Buffer *buffer = context->getState().getTargetBuffer(targetPacked);
if (buffer == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kBufferNotBound);
return false;
}
if (buffer->isImmutable())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kBufferImmutable);
return false;
}
return true;
}
// GL_EXT_clear_texture
bool ValidateClearTexImageEXT(const Context *context,
angle::EntryPoint entryPoint,
TextureID texturePacked,
GLint level,
GLenum format,
GLenum type,
const void *data)
{
return ValidateClearTexImageCommon(context, entryPoint, texturePacked, level, std::nullopt,
format, type, data);
}
bool ValidateClearTexSubImageEXT(const Context *context,
angle::EntryPoint entryPoint,
TextureID texturePacked,
GLint level,
GLint xoffset,
GLint yoffset,
GLint zoffset,
GLsizei width,
GLsizei height,
GLsizei depth,
GLenum format,
GLenum type,
const void *data)
{
return ValidateClearTexImageCommon(context, entryPoint, texturePacked, level,
Box(xoffset, yoffset, zoffset, width, height, depth), format,
type, data);
}
// GL_EXT_clip_control
bool ValidateClipControlEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
ClipOrigin originPacked,
ClipDepthMode depthPacked)
{
if (originPacked == ClipOrigin::InvalidEnum)
{
errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidOriginEnum);
return false;
}
if (depthPacked == ClipDepthMode::InvalidEnum)
{
errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidDepthEnum);
return false;
}
return true;
}
// GL_EXT_external_buffer
bool ValidateBufferStorageExternalEXT(const Context *context,
angle::EntryPoint entryPoint,
BufferBinding targetPacked,
GLintptr offset,
GLsizeiptr size,
GLeglClientBufferEXT clientBuffer,
GLbitfield flags)
{
if (!ValidateBufferStorageEXT(context, entryPoint, targetPacked, size, nullptr, flags))
{
return false;
}
if (offset != 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kExternalBufferInvalidOffset);
return false;
}
if (clientBuffer == nullptr && size > 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kClientBufferInvalid);
return false;
}
return true;
}
// GL_ANGLE_polygon_mode
bool ValidatePolygonModeANGLE(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum face,
PolygonMode modePacked)
{
if (face != GL_FRONT_AND_BACK)
{
errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidCullMode);
return false;
}
if (modePacked == PolygonMode::Point || modePacked == PolygonMode::InvalidEnum)
{
errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPolygonMode);
return false;
}
return true;
}
// GL_NV_polygon_mode
bool ValidatePolygonModeNV(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum face,
PolygonMode modePacked)
{
if (face != GL_FRONT_AND_BACK)
{
errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidCullMode);
return false;
}
if (modePacked == PolygonMode::InvalidEnum)
{
errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPolygonMode);
return false;
}
return true;
}
// GL_EXT_polygon_offset_clamp
bool ValidatePolygonOffsetClampEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLfloat factor,
GLfloat units,
GLfloat clamp)
{
return true;
}
// GL_EXT_primitive_bounding_box
bool ValidatePrimitiveBoundingBoxEXT(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLfloat minX,
GLfloat minY,
GLfloat minZ,
GLfloat minW,
GLfloat maxX,
GLfloat maxY,
GLfloat maxZ,
GLfloat maxW)
{
return true;
}
// GL_OES_primitive_bounding_box
bool ValidatePrimitiveBoundingBoxOES(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLfloat minX,
GLfloat minY,
GLfloat minZ,
GLfloat minW,
GLfloat maxX,
GLfloat maxY,
GLfloat maxZ,
GLfloat maxW)
{
return true;
}
// GL_OES_texture_storage_multisample_2d_array
bool ValidateTexStorage3DMultisampleOES(const Context *context,
angle::EntryPoint entryPoint,
TextureType target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLsizei depth,
GLboolean fixedsamplelocations)
{
return ValidateTexStorage3DMultisampleBase(context, entryPoint, target, samples, internalformat,
width, height, depth);
}
// GL_EXT_separate_shader_objects
bool ValidateActiveShaderProgramEXT(const Context *context,
angle::EntryPoint entryPoint,
ProgramPipelineID pipelinePacked,
ShaderProgramID programPacked)
{
return ValidateActiveShaderProgramBase(context, entryPoint, pipelinePacked, programPacked);
}
bool ValidateBindProgramPipelineEXT(const Context *context,
angle::EntryPoint entryPoint,
ProgramPipelineID pipelinePacked)
{
return ValidateBindProgramPipelineBase(context, entryPoint, pipelinePacked);
}
bool ValidateCreateShaderProgramvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderType typePacked,
GLsizei count,
const GLchar **strings)
{
return ValidateCreateShaderProgramvBase(context, entryPoint, typePacked, count, strings);
}
bool ValidateDeleteProgramPipelinesEXT(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const ProgramPipelineID *pipelinesPacked)
{
return ValidateDeleteProgramPipelinesBase(context, entryPoint, n, pipelinesPacked);
}
bool ValidateGenProgramPipelinesEXT(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const ProgramPipelineID *pipelinesPacked)
{
return ValidateGenProgramPipelinesBase(context, entryPoint, n, pipelinesPacked);
}
bool ValidateGetProgramPipelineInfoLogEXT(const Context *context,
angle::EntryPoint entryPoint,
ProgramPipelineID pipelinePacked,
GLsizei bufSize,
const GLsizei *length,
const GLchar *infoLog)
{
return ValidateGetProgramPipelineInfoLogBase(context, entryPoint, pipelinePacked, bufSize,
length, infoLog);
}
bool ValidateGetProgramPipelineivEXT(const Context *context,
angle::EntryPoint entryPoint,
ProgramPipelineID pipelinePacked,
GLenum pname,
const GLint *params)
{
return ValidateGetProgramPipelineivBase(context, entryPoint, pipelinePacked, pname, params);
}
bool ValidateIsProgramPipelineEXT(const Context *context,
angle::EntryPoint entryPoint,
ProgramPipelineID pipelinePacked)
{
return ValidateIsProgramPipelineBase(context, entryPoint, pipelinePacked);
}
bool ValidateProgramParameteriEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
GLenum pname,
GLint value)
{
return ValidateProgramParameteriBase(context, entryPoint, programPacked, pname, value);
}
bool ValidateProgramUniform1fEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLfloat v0)
{
return ValidateProgramUniform1fBase(context, entryPoint, programPacked, locationPacked, v0);
}
bool ValidateProgramUniform1fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLfloat *value)
{
return ValidateProgramUniform1fvBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform1iEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLint v0)
{
return ValidateProgramUniform1iBase(context, entryPoint, programPacked, locationPacked, v0);
}
bool ValidateProgramUniform1ivEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLint *value)
{
return ValidateProgramUniform1ivBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform1uiEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLuint v0)
{
return ValidateProgramUniform1uiBase(context, entryPoint, programPacked, locationPacked, v0);
}
bool ValidateProgramUniform1uivEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLuint *value)
{
return ValidateProgramUniform1uivBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform2fEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLfloat v0,
GLfloat v1)
{
return ValidateProgramUniform2fBase(context, entryPoint, programPacked, locationPacked, v0, v1);
}
bool ValidateProgramUniform2fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLfloat *value)
{
return ValidateProgramUniform2fvBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform2iEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLint v0,
GLint v1)
{
return ValidateProgramUniform2iBase(context, entryPoint, programPacked, locationPacked, v0, v1);
}
bool ValidateProgramUniform2ivEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLint *value)
{
return ValidateProgramUniform2ivBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform2uiEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLuint v0,
GLuint v1)
{
return ValidateProgramUniform2uiBase(context, entryPoint, programPacked, locationPacked, v0,
v1);
}
bool ValidateProgramUniform2uivEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLuint *value)
{
return ValidateProgramUniform2uivBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform3fEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLfloat v0,
GLfloat v1,
GLfloat v2)
{
return ValidateProgramUniform3fBase(context, entryPoint, programPacked, locationPacked, v0, v1,
v2);
}
bool ValidateProgramUniform3fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLfloat *value)
{
return ValidateProgramUniform3fvBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform3iEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLint v0,
GLint v1,
GLint v2)
{
return ValidateProgramUniform3iBase(context, entryPoint, programPacked, locationPacked, v0, v1,
v2);
}
bool ValidateProgramUniform3ivEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLint *value)
{
return ValidateProgramUniform3ivBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform3uiEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLuint v0,
GLuint v1,
GLuint v2)
{
return ValidateProgramUniform3uiBase(context, entryPoint, programPacked, locationPacked, v0, v1,
v2);
}
bool ValidateProgramUniform3uivEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLuint *value)
{
return ValidateProgramUniform3uivBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform4fEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLfloat v0,
GLfloat v1,
GLfloat v2,
GLfloat v3)
{
return ValidateProgramUniform4fBase(context, entryPoint, programPacked, locationPacked, v0, v1,
v2, v3);
}
bool ValidateProgramUniform4fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLfloat *value)
{
return ValidateProgramUniform4fvBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform4iEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLint v0,
GLint v1,
GLint v2,
GLint v3)
{
return ValidateProgramUniform4iBase(context, entryPoint, programPacked, locationPacked, v0, v1,
v2, v3);
}
bool ValidateProgramUniform4ivEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLint *value)
{
return ValidateProgramUniform4ivBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniform4uiEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLuint v0,
GLuint v1,
GLuint v2,
GLuint v3)
{
return ValidateProgramUniform4uiBase(context, entryPoint, programPacked, locationPacked, v0, v1,
v2, v3);
}
bool ValidateProgramUniform4uivEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
const GLuint *value)
{
return ValidateProgramUniform4uivBase(context, entryPoint, programPacked, locationPacked, count,
value);
}
bool ValidateProgramUniformMatrix2fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix2fvBase(context, entryPoint, programPacked, locationPacked,
count, transpose, value);
}
bool ValidateProgramUniformMatrix2x3fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix2x3fvBase(context, entryPoint, programPacked, locationPacked,
count, transpose, value);
}
bool ValidateProgramUniformMatrix2x4fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix2x4fvBase(context, entryPoint, programPacked, locationPacked,
count, transpose, value);
}
bool ValidateProgramUniformMatrix3fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix3fvBase(context, entryPoint, programPacked, locationPacked,
count, transpose, value);
}
bool ValidateProgramUniformMatrix3x2fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix3x2fvBase(context, entryPoint, programPacked, locationPacked,
count, transpose, value);
}
bool ValidateProgramUniformMatrix3x4fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix3x4fvBase(context, entryPoint, programPacked, locationPacked,
count, transpose, value);
}
bool ValidateProgramUniformMatrix4fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix4fvBase(context, entryPoint, programPacked, locationPacked,
count, transpose, value);
}
bool ValidateProgramUniformMatrix4x2fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix4x2fvBase(context, entryPoint, programPacked, locationPacked,
count, transpose, value);
}
bool ValidateProgramUniformMatrix4x3fvEXT(const Context *context,
angle::EntryPoint entryPoint,
ShaderProgramID programPacked,
UniformLocation locationPacked,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix4x3fvBase(context, entryPoint, programPacked, locationPacked,
count, transpose, value);
}
bool ValidateUseProgramStagesEXT(const Context *context,
angle::EntryPoint entryPoint,
ProgramPipelineID pipelinePacked,
GLbitfield stages,
ShaderProgramID programPacked)
{
return ValidateUseProgramStagesBase(context, entryPoint, pipelinePacked, stages, programPacked);
}
bool ValidateValidateProgramPipelineEXT(const Context *context,
angle::EntryPoint entryPoint,
ProgramPipelineID pipelinePacked)
{
return ValidateValidateProgramPipelineBase(context, entryPoint, pipelinePacked);
}
// GL_EXT_debug_label
bool ValidateGetObjectLabelEXT(const Context *context,
angle::EntryPoint entryPoint,
GLenum type,
GLuint object,
GLsizei bufSize,
const GLsizei *length,
const GLchar *label)
{
if (bufSize < 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeBufSize);
return false;
}
return ValidateObjectIdentifierAndName(context, entryPoint, type, object);
}
bool ValidateLabelObjectEXT(const Context *context,
angle::EntryPoint entryPoint,
GLenum type,
GLuint object,
GLsizei length,
const GLchar *label)
{
if (length < 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeLength);
return false;
}
return ValidateObjectIdentifierAndName(context, entryPoint, type, object);
}
bool ValidateEGLImageTargetTexStorageEXT(const Context *context,
angle::EntryPoint entryPoint,
GLenum target,
egl::ImageID image,
const GLint *attrib_list)
{
gl::TextureType targetType = FromGLenum<TextureType>(target);
switch (targetType)
{
case TextureType::External:
if (!context->getExtensions().EGLImageExternalOES)
{
ANGLE_VALIDATION_ERRORF(GL_INVALID_ENUM, kEnumNotSupported, ToGLenum(targetType));
return false;
}
break;
case TextureType::CubeMapArray:
if (!context->getExtensions().textureCubeMapArrayAny() &&
context->getClientVersion() < ES_3_2)
{
ANGLE_VALIDATION_ERRORF(GL_INVALID_ENUM, kEnumNotSupported, ToGLenum(targetType));
return false;
}
break;
case TextureType::_2D:
case TextureType::_2DArray:
case TextureType::_3D:
case TextureType::CubeMap:
break;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidTextureTarget);
return false;
}
// Validate egl source image is valid
egl::Image *imageObject = context->getDisplay()->getImage(image);
if (!ValidateEGLImageObject(context, entryPoint, targetType, image))
{
return false;
}
if (attrib_list != nullptr)
{
for (const GLint *attrib = attrib_list; attrib[0] != GL_NONE; attrib += 2)
{
switch (attrib[0])
{
case GL_SURFACE_COMPRESSION_EXT:
switch (attrib[1])
{
case GL_SURFACE_COMPRESSION_FIXED_RATE_NONE_EXT:
if (imageObject->isFixedRatedCompression(context))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kAttributeNotMatch);
return false;
}
break;
case GL_SURFACE_COMPRESSION_FIXED_RATE_DEFAULT_EXT:
break;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kAttributeNotValid);
return false;
}
break;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kAttributeNotValid);
return false;
}
}
}
GLsizei levelCount = imageObject->getLevelCount();
Extents size = imageObject->getExtents();
GLsizei width = static_cast<GLsizei>(size.width);
GLsizei height = static_cast<GLsizei>(size.height);
GLsizei depth = static_cast<GLsizei>(size.depth);
GLenum internalformat = imageObject->getFormat().info->sizedInternalFormat;
if (width < 1 || height < 1 || depth < 1 || levelCount < 1)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kTextureSizeTooSmall);
return false;
}
if (!ValidateES3TexStorageParametersLevel(context, entryPoint, targetType, levelCount, width,
height, depth))
{
// Error already generated.
return false;
}
if (targetType == TextureType::External)
{
const Caps &caps = context->getCaps();
if (width > caps.max2DTextureSize || height > caps.max2DTextureSize)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kResourceMaxTextureSize);
return false;
}
}
else if (!ValidateES3TexStorageParametersExtent(context, entryPoint, targetType, levelCount,
width, height, depth))
{
// Error already generated.
return false;
}
if (!ValidateES3TexStorageParametersTexObject(context, entryPoint, targetType))
{
// Error already generated.
return false;
}
if (!ValidateES3TexStorageParametersFormat(context, entryPoint, targetType, levelCount,
internalformat, width, height, depth))
{
// Error already generated.
return false;
}
return true;
}
bool ValidateAcquireTexturesANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLuint numTextures,
const TextureID *textures,
const GLenum *layouts)
{
for (GLuint i = 0; i < numTextures; ++i)
{
if (!context->getTexture(textures[i]))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidTextureName);
return false;
}
if (!IsValidImageLayout(FromGLenum<ImageLayout>(layouts[i])))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidImageLayout);
return false;
}
}
return true;
}
bool ValidateReleaseTexturesANGLE(const Context *context,
angle::EntryPoint entryPoint,
GLuint numTextures,
const TextureID *textures,
const GLenum *layouts)
{
for (GLuint i = 0; i < numTextures; ++i)
{
if (!context->getTexture(textures[i]))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidTextureName);
return false;
}
}
return true;
}
bool ValidateFramebufferParameteriMESA(const Context *context,
angle::EntryPoint entryPoint,
GLenum target,
GLenum pname,
GLint param)
{
if (pname != GL_FRAMEBUFFER_FLIP_Y_MESA)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidPname);
return false;
}
return ValidateFramebufferParameteriBase(context, entryPoint, target, pname, param);
}
bool ValidateGetFramebufferParameterivMESA(const Context *context,
angle::EntryPoint entryPoint,
GLenum target,
GLenum pname,
const GLint *params)
{
if (pname != GL_FRAMEBUFFER_FLIP_Y_MESA)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidPname);
return false;
}
return ValidateGetFramebufferParameterivBase(context, entryPoint, target, pname, params);
}
// GL_AMD_performance_monitor
bool ValidateBeginPerfMonitorAMD(const Context *context,
angle::EntryPoint entryPoint,
GLuint monitor)
{
return true;
}
bool ValidateDeletePerfMonitorsAMD(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const GLuint *monitors)
{
// Note: ANGLE does not really create monitor objects or track ids.
return true;
}
bool ValidateEndPerfMonitorAMD(const Context *context, angle::EntryPoint entryPoint, GLuint monitor)
{
if (!context->getState().isPerfMonitorActive())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kPerfMonitorNotActive);
return false;
}
return true;
}
bool ValidateGenPerfMonitorsAMD(const Context *context,
angle::EntryPoint entryPoint,
GLsizei n,
const GLuint *monitors)
{
return true;
}
bool ValidateGetPerfMonitorCounterDataAMD(const Context *context,
angle::EntryPoint entryPoint,
GLuint monitor,
GLenum pname,
GLsizei dataSize,
const GLuint *data,
const GLint *bytesWritten)
{
if (monitor != 0)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidPerfMonitor);
return false;
}
switch (pname)
{
case GL_PERFMON_RESULT_AVAILABLE_AMD:
case GL_PERFMON_RESULT_SIZE_AMD:
case GL_PERFMON_RESULT_AMD:
break;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidPname);
return false;
}
return true;
}
bool ValidateGetPerfMonitorCounterInfoAMD(const Context *context,
angle::EntryPoint entryPoint,
GLuint group,
GLuint counter,
GLenum pname,
const void *data)
{
const angle::PerfMonitorCounterGroups &groups = context->getPerfMonitorCounterGroups();
if (group >= groups.size())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidPerfMonitorGroup);
return false;
}
if (counter >= groups[group].counters.size())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidPerfMonitorCounter);
return false;
}
switch (pname)
{
case GL_COUNTER_TYPE_AMD:
case GL_COUNTER_RANGE_AMD:
break;
default:
ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidPname);
return false;
}
return true;
}
bool ValidateGetPerfMonitorCounterStringAMD(const Context *context,
angle::EntryPoint entryPoint,
GLuint group,
GLuint counter,
GLsizei bufSize,
const GLsizei *length,
const GLchar *counterString)
{
const angle::PerfMonitorCounterGroups &groups = context->getPerfMonitorCounterGroups();
if (group >= groups.size())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidPerfMonitorGroup);
return false;
}
if (counter >= groups[group].counters.size())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidPerfMonitorCounter);
return false;
}
return true;
}
bool ValidateGetPerfMonitorCountersAMD(const Context *context,
angle::EntryPoint entryPoint,
GLuint group,
const GLint *numCounters,
const GLint *maxActiveCounters,
GLsizei counterSize,
const GLuint *counters)
{
const angle::PerfMonitorCounterGroups &groups = context->getPerfMonitorCounterGroups();
if (group >= groups.size())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidPerfMonitorGroup);
return false;
}
return true;
}
bool ValidateGetPerfMonitorGroupStringAMD(const Context *context,
angle::EntryPoint entryPoint,
GLuint group,
GLsizei bufSize,
const GLsizei *length,
const GLchar *groupString)
{
const angle::PerfMonitorCounterGroups &groups = context->getPerfMonitorCounterGroups();
if (group >= groups.size())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidPerfMonitorGroup);
return false;
}
return true;
}
bool ValidateGetPerfMonitorGroupsAMD(const Context *context,
angle::EntryPoint entryPoint,
const GLint *numGroups,
GLsizei groupsSize,
const GLuint *groups)
{
return true;
}
bool ValidateSelectPerfMonitorCountersAMD(const Context *context,
angle::EntryPoint entryPoint,
GLuint monitor,
GLboolean enable,
GLuint group,
GLint numCounters,
const GLuint *counterList)
{
UNIMPLEMENTED();
return false;
}
bool ValidateShadingRateQCOM(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
GLenum rate)
{
gl::ShadingRate shadingRate = gl::FromGLenum<gl::ShadingRate>(rate);
if (shadingRate == gl::ShadingRate::Undefined || shadingRate == gl::ShadingRate::InvalidEnum)
{
errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidShadingRate);
return false;
}
return true;
}
bool ValidateLogicOpANGLE(const PrivateState &state,
ErrorSet *errors,
angle::EntryPoint entryPoint,
LogicalOperation opcodePacked)
{
return ValidateLogicOpCommon(state, errors, entryPoint, opcodePacked);
}
bool ValidateFramebufferFoveationConfigQCOM(const Context *context,
angle::EntryPoint entryPoint,
FramebufferID framebufferPacked,
GLuint numLayers,
GLuint focalPointsPerLayer,
GLuint requestedFeatures,
const GLuint *providedFeatures)
{
Framebuffer *framebuffer = context->getFramebuffer(framebufferPacked);
// INVALID_VALUE is generated by FramebufferFoveationConfigQCOM if 'fbo' is not a valid
// framebuffer.
if (framebuffer == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidFramebufferName);
return false;
}
// INVALID_VALUE is generated by FramebufferFoveationConfigQCOM if 'numLayers' is greater than
// GL_MAX_ARRAY_TEXTURE_LAYERS - 1.
if (numLayers > static_cast<GLuint>(context->getState().getCaps().maxArrayTextureLayers) - 1)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kFramebufferFoveationLayersExceedMaxArrayLayers);
return false;
}
// INVALID_VALUE is generated by FramebufferFoveationConfigQCOM if 'numFocalPoints' is greater
// than implementation can support.
if (focalPointsPerLayer > gl::IMPLEMENTATION_MAX_FOCAL_POINTS)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kFocalPointsExceedMaxFocalPoints);
return false;
}
// INVALID_OPERATION is generated by FramebufferFoveationConfigQCOM if it is called for a fbo
// that has already been cofigured for foveated rendering.
if (framebuffer->isFoveationConfigured())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kFramebufferFoveationAlreadyConfigured);
return false;
}
return true;
}
bool ValidateFramebufferFoveationParametersQCOM(const Context *context,
angle::EntryPoint entryPoint,
FramebufferID framebufferPacked,
GLuint layer,
GLuint focalPoint,
GLfloat focalX,
GLfloat focalY,
GLfloat gainX,
GLfloat gainY,
GLfloat foveaArea)
{
Framebuffer *framebuffer = context->getFramebuffer(framebufferPacked);
// INVALID_VALUE is generated by FramebufferFoveationParametersQCOM if 'fbo' is not a valid
// framebuffer.
if (framebuffer == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidFramebufferName);
return false;
}
// INVALID_OPERATION is generated by FramebufferFoveationParametersQCOM if 'fbo' has not been
// configured for foveated rendering.
if (!framebuffer->isFoveationConfigured())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kFramebufferFoveationNotConfigured);
return false;
}
// INVALID_VALUE is generated by FramebufferFoveationParametersQCOM if 'layer' is greater than
// or equal to the numLayers that the fbo was previously configured for in
// FramebufferFoveationConfigQCOM.
if (layer >= gl::IMPLEMENTATION_MAX_NUM_LAYERS)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kFramebufferFoveationLayersExceedMaxArrayLayers);
return false;
}
// INVALID_VALUE is generated by FramebufferFoveationParametersQCOM if 'numFocalPoints' is
// greater than implementation can support. INVALID_OPERATION is generated by
if (focalPoint >= gl::IMPLEMENTATION_MAX_FOCAL_POINTS)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kFocalPointsExceedMaxFocalPoints);
return false;
}
return true;
}
bool ValidateTextureFoveationParametersQCOM(const Context *context,
angle::EntryPoint entryPoint,
TextureID texturePacked,
GLuint layer,
GLuint focalPoint,
GLfloat focalX,
GLfloat focalY,
GLfloat gainX,
GLfloat gainY,
GLfloat foveaArea)
{
Texture *texture = context->getTexture(texturePacked);
// INVALID_VALUE is generated by TextureFoveationParametersQCOM if 'texture' is not a valid
// texture object.
if (texture == nullptr)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidTextureName);
return false;
}
// INVALID_OPERATION is generated by TextureFoveationParametersQCOM if 'texture' has not been
// set as foveated. i.e. 'texture's parameter TEXTURE_FOVEATED_FEATURE_BITS_QCOM does not
// contain FOVEATION_ENABLE_BIT_QCOM.
if (!texture->isFoveationEnabled())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureFoveationNotEnabled);
return false;
}
// INVALID_VALUE is generated by TextureFoveationParametersQCOM if 'focalPoint' is larger than
// TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM minus one.
if (focalPoint > texture->getNumFocalPoints() - 1)
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kFocalPointsExceedMaxFocalPoints);
return false;
}
return true;
}
bool ValidateEndTilingQCOM(const Context *context,
angle::EntryPoint entryPoint,
GLbitfield preserveMask)
{
const gl::PrivateState &privateState = context->getPrivateState();
if (!privateState.isTiledRendering())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTilingEndCalledWithoutStart);
return false;
}
// preserveMask does not need to be validated. The bitfield covers the entire 32 bits of
// GLbitfield and unbound attachments are siliently ignored like in glClear
return true;
}
bool ValidateStartTilingQCOM(const Context *context,
angle::EntryPoint entryPoint,
GLuint x,
GLuint y,
GLuint width,
GLuint height,
GLbitfield preserveMask)
{
const gl::PrivateState &privateState = context->getPrivateState();
if (privateState.isTiledRendering())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTilingStartCalledWithoutEnd);
return false;
}
Framebuffer *framebuffer = context->getState().getDrawFramebuffer();
const FramebufferStatus &framebufferStatus = framebuffer->checkStatus(context);
if (!framebufferStatus.isComplete())
{
ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, framebufferStatus.reason);
return false;
}
// preserveMask does not need to be validated. The bitfield covers the entire 32 bits of
// GLbitfield and unbound attachments are siliently ignored like in glClear
return true;
}
bool ValidateTexStorageAttribs(const GLint *attrib_list)
{
if (nullptr != attrib_list && GL_NONE != *attrib_list)
{
attrib_list++;
if (nullptr == attrib_list)
{
return false;
}
if (*attrib_list == GL_SURFACE_COMPRESSION_FIXED_RATE_NONE_EXT ||
*attrib_list == GL_SURFACE_COMPRESSION_FIXED_RATE_DEFAULT_EXT)
{
return true;
}
else if (*attrib_list >= GL_SURFACE_COMPRESSION_FIXED_RATE_1BPC_EXT &&
*attrib_list <= GL_SURFACE_COMPRESSION_FIXED_RATE_12BPC_EXT)
{
return true;
}
else
{
return false;
}
}
return true;
}
bool ValidateTexStorageAttribs2DEXT(const Context *context,
angle::EntryPoint entryPoint,
GLenum target,
GLsizei levels,
GLenum internalformat,
GLsizei width,
GLsizei height,
const GLint *attrib_list)
{
if (!ValidateTexStorageAttribs(attrib_list))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidAttribList);
return false;
}
return ValidateES3TexStorage2DParameters(context, entryPoint, FromGLenum<TextureType>(target),
levels, internalformat, width, height, 1);
}
bool ValidateTexStorageAttribs3DEXT(const Context *context,
angle::EntryPoint entryPoint,
GLenum target,
GLsizei levels,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLsizei depth,
const GLint *attrib_list)
{
if (!ValidateTexStorageAttribs(attrib_list))
{
ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidAttribList);
return false;
}
return ValidateES3TexStorage3DParameters(context, entryPoint, FromGLenum<TextureType>(target),
levels, internalformat, width, height, depth);
}
} // namespace gl