1 // GENERATED FILE - DO NOT EDIT. 2 // Generated by gen_format_map.py using data from format_map_data.json. 3 // ES3 format info from es3_format_type_combinations.json. 4 // 5 // Copyright 2016 The ANGLE Project Authors. All rights reserved. 6 // Use of this source code is governed by a BSD-style license that can be 7 // found in the LICENSE file. 8 // 9 // format_map: 10 // Determining the sized internal format from a (format,type) pair. 11 // Also check es3 format combinations for validity. 12 13 #include "angle_gl.h" 14 #include "common/debug.h" 15 16 namespace gl 17 { 18 GetSizedFormatInternal(GLenum format,GLenum type)19GLenum GetSizedFormatInternal(GLenum format, GLenum type) 20 { 21 switch (format) 22 { 23 case GL_ALPHA: 24 switch (type) 25 { 26 case GL_FLOAT: 27 return GL_ALPHA32F_EXT; 28 case GL_HALF_FLOAT: 29 return GL_ALPHA16F_EXT; 30 case GL_HALF_FLOAT_OES: 31 return GL_ALPHA16F_EXT; 32 case GL_UNSIGNED_BYTE: 33 return GL_ALPHA8_EXT; 34 default: 35 break; 36 } 37 break; 38 39 case GL_BGRA_EXT: 40 switch (type) 41 { 42 case GL_UNSIGNED_BYTE: 43 return GL_BGRA8_EXT; 44 case GL_UNSIGNED_INT_2_10_10_10_REV: 45 return GL_BGR10_A2_ANGLEX; 46 case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: 47 return GL_BGR5_A1_ANGLEX; 48 case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: 49 return GL_BGRA4_ANGLEX; 50 case GL_UNSIGNED_SHORT_5_6_5: 51 return GL_BGR565_ANGLEX; 52 default: 53 break; 54 } 55 break; 56 57 case GL_COMPRESSED_RED_GREEN_RGTC2_EXT: 58 switch (type) 59 { 60 case GL_UNSIGNED_BYTE: 61 return GL_COMPRESSED_RED_GREEN_RGTC2_EXT; 62 default: 63 break; 64 } 65 break; 66 67 case GL_COMPRESSED_RED_RGTC1_EXT: 68 switch (type) 69 { 70 case GL_UNSIGNED_BYTE: 71 return GL_COMPRESSED_RED_RGTC1_EXT; 72 default: 73 break; 74 } 75 break; 76 77 case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT: 78 switch (type) 79 { 80 case GL_UNSIGNED_BYTE: 81 return GL_COMPRESSED_RGBA_BPTC_UNORM_EXT; 82 default: 83 break; 84 } 85 break; 86 87 case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 88 switch (type) 89 { 90 case GL_UNSIGNED_BYTE: 91 return GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; 92 default: 93 break; 94 } 95 break; 96 97 case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 98 switch (type) 99 { 100 case GL_UNSIGNED_BYTE: 101 return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; 102 default: 103 break; 104 } 105 break; 106 107 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: 108 switch (type) 109 { 110 case GL_UNSIGNED_BYTE: 111 return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; 112 default: 113 break; 114 } 115 break; 116 117 case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: 118 switch (type) 119 { 120 case GL_UNSIGNED_BYTE: 121 return GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE; 122 default: 123 break; 124 } 125 break; 126 127 case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: 128 switch (type) 129 { 130 case GL_UNSIGNED_BYTE: 131 return GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE; 132 default: 133 break; 134 } 135 break; 136 137 case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: 138 switch (type) 139 { 140 case GL_UNSIGNED_BYTE: 141 return GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT; 142 default: 143 break; 144 } 145 break; 146 147 case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: 148 switch (type) 149 { 150 case GL_UNSIGNED_BYTE: 151 return GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT; 152 default: 153 break; 154 } 155 break; 156 157 case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 158 switch (type) 159 { 160 case GL_UNSIGNED_BYTE: 161 return GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG; 162 default: 163 break; 164 } 165 break; 166 167 case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 168 switch (type) 169 { 170 case GL_UNSIGNED_BYTE: 171 return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; 172 default: 173 break; 174 } 175 break; 176 177 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: 178 switch (type) 179 { 180 case GL_UNSIGNED_BYTE: 181 return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; 182 default: 183 break; 184 } 185 break; 186 187 case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 188 switch (type) 189 { 190 case GL_UNSIGNED_BYTE: 191 return GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT; 192 default: 193 break; 194 } 195 break; 196 197 case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: 198 switch (type) 199 { 200 case GL_UNSIGNED_BYTE: 201 return GL_COMPRESSED_SIGNED_RED_RGTC1_EXT; 202 default: 203 break; 204 } 205 break; 206 207 case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: 208 switch (type) 209 { 210 case GL_UNSIGNED_BYTE: 211 return GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT; 212 default: 213 break; 214 } 215 break; 216 217 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT: 218 switch (type) 219 { 220 case GL_UNSIGNED_BYTE: 221 return GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT; 222 default: 223 break; 224 } 225 break; 226 227 case GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT: 228 switch (type) 229 { 230 case GL_UNSIGNED_BYTE: 231 return GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT; 232 default: 233 break; 234 } 235 break; 236 237 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 238 switch (type) 239 { 240 case GL_UNSIGNED_BYTE: 241 return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; 242 default: 243 break; 244 } 245 break; 246 247 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 248 switch (type) 249 { 250 case GL_UNSIGNED_BYTE: 251 return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; 252 default: 253 break; 254 } 255 break; 256 257 case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 258 switch (type) 259 { 260 case GL_UNSIGNED_BYTE: 261 return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; 262 default: 263 break; 264 } 265 break; 266 267 case GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT: 268 switch (type) 269 { 270 case GL_UNSIGNED_BYTE: 271 return GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT; 272 default: 273 break; 274 } 275 break; 276 277 case GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT: 278 switch (type) 279 { 280 case GL_UNSIGNED_BYTE: 281 return GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT; 282 default: 283 break; 284 } 285 break; 286 287 case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: 288 switch (type) 289 { 290 case GL_UNSIGNED_BYTE: 291 return GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; 292 default: 293 break; 294 } 295 break; 296 297 case GL_DEPTH_COMPONENT: 298 switch (type) 299 { 300 case GL_FLOAT: 301 return GL_DEPTH_COMPONENT32F; 302 case GL_UNSIGNED_INT: 303 return GL_DEPTH_COMPONENT32_OES; 304 case GL_UNSIGNED_INT_24_8: 305 return GL_DEPTH24_STENCIL8; 306 case GL_UNSIGNED_SHORT: 307 return GL_DEPTH_COMPONENT16; 308 default: 309 break; 310 } 311 break; 312 313 case GL_DEPTH_STENCIL: 314 switch (type) 315 { 316 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: 317 return GL_DEPTH32F_STENCIL8; 318 case GL_UNSIGNED_INT_24_8: 319 return GL_DEPTH24_STENCIL8; 320 default: 321 break; 322 } 323 break; 324 325 case GL_LUMINANCE: 326 switch (type) 327 { 328 case GL_FLOAT: 329 return GL_LUMINANCE32F_EXT; 330 case GL_HALF_FLOAT: 331 return GL_LUMINANCE16F_EXT; 332 case GL_HALF_FLOAT_OES: 333 return GL_LUMINANCE16F_EXT; 334 case GL_UNSIGNED_BYTE: 335 return GL_LUMINANCE8_EXT; 336 default: 337 break; 338 } 339 break; 340 341 case GL_LUMINANCE_ALPHA: 342 switch (type) 343 { 344 case GL_FLOAT: 345 return GL_LUMINANCE_ALPHA32F_EXT; 346 case GL_HALF_FLOAT: 347 return GL_LUMINANCE_ALPHA16F_EXT; 348 case GL_HALF_FLOAT_OES: 349 return GL_LUMINANCE_ALPHA16F_EXT; 350 case GL_UNSIGNED_BYTE: 351 return GL_LUMINANCE8_ALPHA8_EXT; 352 default: 353 break; 354 } 355 break; 356 357 case GL_RED: 358 switch (type) 359 { 360 case GL_BYTE: 361 return GL_R8_SNORM; 362 case GL_FLOAT: 363 return GL_R32F; 364 case GL_HALF_FLOAT: 365 return GL_R16F; 366 case GL_HALF_FLOAT_OES: 367 return GL_R16F; 368 case GL_SHORT: 369 return GL_R16_SNORM_EXT; 370 case GL_UNSIGNED_BYTE: 371 return GL_R8; 372 case GL_UNSIGNED_SHORT: 373 return GL_R16_EXT; 374 default: 375 break; 376 } 377 break; 378 379 case GL_RED_INTEGER: 380 switch (type) 381 { 382 case GL_BYTE: 383 return GL_R8I; 384 case GL_INT: 385 return GL_R32I; 386 case GL_SHORT: 387 return GL_R16I; 388 case GL_UNSIGNED_BYTE: 389 return GL_R8UI; 390 case GL_UNSIGNED_INT: 391 return GL_R32UI; 392 case GL_UNSIGNED_SHORT: 393 return GL_R16UI; 394 default: 395 break; 396 } 397 break; 398 399 case GL_RG: 400 switch (type) 401 { 402 case GL_BYTE: 403 return GL_RG8_SNORM; 404 case GL_FLOAT: 405 return GL_RG32F; 406 case GL_HALF_FLOAT: 407 return GL_RG16F; 408 case GL_HALF_FLOAT_OES: 409 return GL_RG16F; 410 case GL_SHORT: 411 return GL_RG16_SNORM_EXT; 412 case GL_UNSIGNED_BYTE: 413 return GL_RG8; 414 case GL_UNSIGNED_SHORT: 415 return GL_RG16_EXT; 416 default: 417 break; 418 } 419 break; 420 421 case GL_RGB: 422 switch (type) 423 { 424 case GL_BYTE: 425 return GL_RGB8_SNORM; 426 case GL_FLOAT: 427 return GL_RGB32F; 428 case GL_HALF_FLOAT: 429 return GL_RGB16F; 430 case GL_HALF_FLOAT_OES: 431 return GL_RGB16F; 432 case GL_SHORT: 433 return GL_RGB16_SNORM_EXT; 434 case GL_UNSIGNED_BYTE: 435 return GL_RGB8; 436 case GL_UNSIGNED_INT_10F_11F_11F_REV: 437 return GL_R11F_G11F_B10F; 438 case GL_UNSIGNED_INT_2_10_10_10_REV: 439 return GL_RGB10_UNORM_ANGLEX; 440 case GL_UNSIGNED_INT_5_9_9_9_REV: 441 return GL_RGB9_E5; 442 case GL_UNSIGNED_SHORT: 443 return GL_RGB16_EXT; 444 case GL_UNSIGNED_SHORT_5_6_5: 445 return GL_RGB565; 446 default: 447 break; 448 } 449 break; 450 451 case GL_RGBA: 452 switch (type) 453 { 454 case GL_BYTE: 455 return GL_RGBA8_SNORM; 456 case GL_FLOAT: 457 return GL_RGBA32F; 458 case GL_HALF_FLOAT: 459 return GL_RGBA16F; 460 case GL_HALF_FLOAT_OES: 461 return GL_RGBA16F; 462 case GL_SHORT: 463 return GL_RGBA16_SNORM_EXT; 464 case GL_UNSIGNED_BYTE: 465 return GL_RGBA8; 466 case GL_UNSIGNED_INT_2_10_10_10_REV: 467 return GL_RGB10_A2; 468 case GL_UNSIGNED_SHORT: 469 return GL_RGBA16_EXT; 470 case GL_UNSIGNED_SHORT_4_4_4_4: 471 return GL_RGBA4; 472 case GL_UNSIGNED_SHORT_5_5_5_1: 473 return GL_RGB5_A1; 474 default: 475 break; 476 } 477 break; 478 479 case GL_RGBA_INTEGER: 480 switch (type) 481 { 482 case GL_BYTE: 483 return GL_RGBA8I; 484 case GL_INT: 485 return GL_RGBA32I; 486 case GL_SHORT: 487 return GL_RGBA16I; 488 case GL_UNSIGNED_BYTE: 489 return GL_RGBA8UI; 490 case GL_UNSIGNED_INT: 491 return GL_RGBA32UI; 492 case GL_UNSIGNED_INT_2_10_10_10_REV: 493 return GL_RGB10_A2UI; 494 case GL_UNSIGNED_SHORT: 495 return GL_RGBA16UI; 496 default: 497 break; 498 } 499 break; 500 501 case GL_RGB_INTEGER: 502 switch (type) 503 { 504 case GL_BYTE: 505 return GL_RGB8I; 506 case GL_INT: 507 return GL_RGB32I; 508 case GL_SHORT: 509 return GL_RGB16I; 510 case GL_UNSIGNED_BYTE: 511 return GL_RGB8UI; 512 case GL_UNSIGNED_INT: 513 return GL_RGB32UI; 514 case GL_UNSIGNED_SHORT: 515 return GL_RGB16UI; 516 default: 517 break; 518 } 519 break; 520 521 case GL_RG_INTEGER: 522 switch (type) 523 { 524 case GL_BYTE: 525 return GL_RG8I; 526 case GL_INT: 527 return GL_RG32I; 528 case GL_SHORT: 529 return GL_RG16I; 530 case GL_UNSIGNED_BYTE: 531 return GL_RG8UI; 532 case GL_UNSIGNED_INT: 533 return GL_RG32UI; 534 case GL_UNSIGNED_SHORT: 535 return GL_RG16UI; 536 default: 537 break; 538 } 539 break; 540 541 case GL_SRGB_ALPHA_EXT: 542 switch (type) 543 { 544 case GL_UNSIGNED_BYTE: 545 return GL_SRGB8_ALPHA8; 546 default: 547 break; 548 } 549 break; 550 551 case GL_SRGB_EXT: 552 switch (type) 553 { 554 case GL_UNSIGNED_BYTE: 555 return GL_SRGB8; 556 default: 557 break; 558 } 559 break; 560 561 case GL_STENCIL_INDEX: 562 switch (type) 563 { 564 case GL_UNSIGNED_BYTE: 565 return GL_STENCIL_INDEX8; 566 default: 567 break; 568 } 569 break; 570 571 case GL_NONE: 572 return GL_NONE; 573 574 default: 575 break; 576 } 577 578 return GL_NONE; 579 } 580 ValidES3Format(GLenum format)581bool ValidES3Format(GLenum format) 582 { 583 switch (format) 584 { 585 case GL_ALPHA: 586 case GL_BGRA_EXT: 587 case GL_DEPTH_COMPONENT: 588 case GL_DEPTH_STENCIL: 589 case GL_LUMINANCE: 590 case GL_LUMINANCE_ALPHA: 591 case GL_RED: 592 case GL_RED_INTEGER: 593 case GL_RG: 594 case GL_RGB: 595 case GL_RGBA: 596 case GL_RGBA_INTEGER: 597 case GL_RGB_INTEGER: 598 case GL_RG_INTEGER: 599 case GL_SRGB_ALPHA_EXT: 600 case GL_SRGB_EXT: 601 case GL_STENCIL_INDEX: 602 return true; 603 604 default: 605 return false; 606 } 607 } 608 ValidES3Type(GLenum type)609bool ValidES3Type(GLenum type) 610 { 611 switch (type) 612 { 613 case GL_BYTE: 614 case GL_FLOAT: 615 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: 616 case GL_HALF_FLOAT: 617 case GL_HALF_FLOAT_OES: 618 case GL_INT: 619 case GL_SHORT: 620 case GL_UNSIGNED_BYTE: 621 case GL_UNSIGNED_INT: 622 case GL_UNSIGNED_INT_10F_11F_11F_REV: 623 case GL_UNSIGNED_INT_24_8: 624 case GL_UNSIGNED_INT_2_10_10_10_REV: 625 case GL_UNSIGNED_INT_5_9_9_9_REV: 626 case GL_UNSIGNED_SHORT: 627 case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: 628 case GL_UNSIGNED_SHORT_4_4_4_4: 629 case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: 630 case GL_UNSIGNED_SHORT_5_5_5_1: 631 case GL_UNSIGNED_SHORT_5_6_5: 632 return true; 633 634 default: 635 return false; 636 } 637 } 638 ValidES3FormatCombination(GLenum format,GLenum type,GLenum internalFormat)639bool ValidES3FormatCombination(GLenum format, GLenum type, GLenum internalFormat) 640 { 641 ASSERT(ValidES3Format(format) && ValidES3Type(type)); 642 643 switch (format) 644 { 645 case GL_ALPHA: 646 switch (type) 647 { 648 case GL_FLOAT: 649 { 650 switch (internalFormat) 651 { 652 case GL_ALPHA: 653 case GL_ALPHA32F_EXT: 654 return true; 655 default: 656 break; 657 } 658 break; 659 } 660 case GL_HALF_FLOAT: 661 { 662 switch (internalFormat) 663 { 664 case GL_ALPHA: 665 case GL_ALPHA16F_EXT: 666 return true; 667 default: 668 break; 669 } 670 break; 671 } 672 case GL_HALF_FLOAT_OES: 673 { 674 switch (internalFormat) 675 { 676 case GL_ALPHA: 677 case GL_ALPHA16F_EXT: 678 return true; 679 default: 680 break; 681 } 682 break; 683 } 684 case GL_UNSIGNED_BYTE: 685 { 686 switch (internalFormat) 687 { 688 case GL_ALPHA: 689 case GL_ALPHA8_EXT: 690 return true; 691 default: 692 break; 693 } 694 break; 695 } 696 default: 697 break; 698 } 699 break; 700 701 case GL_BGRA_EXT: 702 switch (type) 703 { 704 case GL_UNSIGNED_BYTE: 705 { 706 switch (internalFormat) 707 { 708 case GL_BGRA_EXT: 709 case GL_BGRA8_EXT: 710 case GL_BGRA4_ANGLEX: 711 case GL_BGR5_A1_ANGLEX: 712 return true; 713 default: 714 break; 715 } 716 break; 717 } 718 case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: 719 { 720 switch (internalFormat) 721 { 722 case GL_BGR5_A1_ANGLEX: 723 return true; 724 default: 725 break; 726 } 727 break; 728 } 729 case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: 730 { 731 switch (internalFormat) 732 { 733 case GL_BGRA4_ANGLEX: 734 return true; 735 default: 736 break; 737 } 738 break; 739 } 740 default: 741 break; 742 } 743 break; 744 745 case GL_DEPTH_COMPONENT: 746 switch (type) 747 { 748 case GL_FLOAT: 749 { 750 switch (internalFormat) 751 { 752 case GL_DEPTH_COMPONENT32F: 753 return true; 754 default: 755 break; 756 } 757 break; 758 } 759 case GL_UNSIGNED_INT: 760 { 761 switch (internalFormat) 762 { 763 case GL_DEPTH_COMPONENT24: 764 case GL_DEPTH_COMPONENT16: 765 case GL_DEPTH_COMPONENT: 766 return true; 767 default: 768 break; 769 } 770 break; 771 } 772 case GL_UNSIGNED_INT_24_8: 773 { 774 switch (internalFormat) 775 { 776 case GL_DEPTH_COMPONENT32_OES: 777 return true; 778 default: 779 break; 780 } 781 break; 782 } 783 case GL_UNSIGNED_SHORT: 784 { 785 switch (internalFormat) 786 { 787 case GL_DEPTH_COMPONENT16: 788 case GL_DEPTH_COMPONENT: 789 return true; 790 default: 791 break; 792 } 793 break; 794 } 795 default: 796 break; 797 } 798 break; 799 800 case GL_DEPTH_STENCIL: 801 switch (type) 802 { 803 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: 804 { 805 switch (internalFormat) 806 { 807 case GL_DEPTH32F_STENCIL8: 808 return true; 809 default: 810 break; 811 } 812 break; 813 } 814 case GL_UNSIGNED_INT_24_8: 815 { 816 switch (internalFormat) 817 { 818 case GL_DEPTH_STENCIL: 819 case GL_DEPTH24_STENCIL8: 820 return true; 821 default: 822 break; 823 } 824 break; 825 } 826 default: 827 break; 828 } 829 break; 830 831 case GL_LUMINANCE: 832 switch (type) 833 { 834 case GL_FLOAT: 835 { 836 switch (internalFormat) 837 { 838 case GL_LUMINANCE: 839 case GL_LUMINANCE32F_EXT: 840 return true; 841 default: 842 break; 843 } 844 break; 845 } 846 case GL_HALF_FLOAT: 847 { 848 switch (internalFormat) 849 { 850 case GL_LUMINANCE: 851 case GL_LUMINANCE16F_EXT: 852 return true; 853 default: 854 break; 855 } 856 break; 857 } 858 case GL_HALF_FLOAT_OES: 859 { 860 switch (internalFormat) 861 { 862 case GL_LUMINANCE: 863 case GL_LUMINANCE16F_EXT: 864 return true; 865 default: 866 break; 867 } 868 break; 869 } 870 case GL_UNSIGNED_BYTE: 871 { 872 switch (internalFormat) 873 { 874 case GL_LUMINANCE: 875 case GL_LUMINANCE8_EXT: 876 return true; 877 default: 878 break; 879 } 880 break; 881 } 882 default: 883 break; 884 } 885 break; 886 887 case GL_LUMINANCE_ALPHA: 888 switch (type) 889 { 890 case GL_FLOAT: 891 { 892 switch (internalFormat) 893 { 894 case GL_LUMINANCE_ALPHA: 895 case GL_LUMINANCE_ALPHA32F_EXT: 896 return true; 897 default: 898 break; 899 } 900 break; 901 } 902 case GL_HALF_FLOAT: 903 { 904 switch (internalFormat) 905 { 906 case GL_LUMINANCE_ALPHA: 907 case GL_LUMINANCE_ALPHA16F_EXT: 908 return true; 909 default: 910 break; 911 } 912 break; 913 } 914 case GL_HALF_FLOAT_OES: 915 { 916 switch (internalFormat) 917 { 918 case GL_LUMINANCE_ALPHA: 919 case GL_LUMINANCE_ALPHA16F_EXT: 920 return true; 921 default: 922 break; 923 } 924 break; 925 } 926 case GL_UNSIGNED_BYTE: 927 { 928 switch (internalFormat) 929 { 930 case GL_LUMINANCE_ALPHA: 931 case GL_LUMINANCE8_ALPHA8_EXT: 932 return true; 933 default: 934 break; 935 } 936 break; 937 } 938 default: 939 break; 940 } 941 break; 942 943 case GL_RED: 944 switch (type) 945 { 946 case GL_BYTE: 947 { 948 switch (internalFormat) 949 { 950 case GL_R8_SNORM: 951 return true; 952 default: 953 break; 954 } 955 break; 956 } 957 case GL_FLOAT: 958 { 959 switch (internalFormat) 960 { 961 case GL_R32F: 962 case GL_R16F: 963 case GL_RED: 964 return true; 965 default: 966 break; 967 } 968 break; 969 } 970 case GL_HALF_FLOAT: 971 { 972 switch (internalFormat) 973 { 974 case GL_R16F: 975 case GL_RED: 976 return true; 977 default: 978 break; 979 } 980 break; 981 } 982 case GL_HALF_FLOAT_OES: 983 { 984 switch (internalFormat) 985 { 986 case GL_R16F: 987 case GL_RED: 988 return true; 989 default: 990 break; 991 } 992 break; 993 } 994 case GL_SHORT: 995 { 996 switch (internalFormat) 997 { 998 case GL_R16_SNORM_EXT: 999 return true; 1000 default: 1001 break; 1002 } 1003 break; 1004 } 1005 case GL_UNSIGNED_BYTE: 1006 { 1007 switch (internalFormat) 1008 { 1009 case GL_R8: 1010 case GL_RED: 1011 case GL_SR8_EXT: 1012 return true; 1013 default: 1014 break; 1015 } 1016 break; 1017 } 1018 case GL_UNSIGNED_SHORT: 1019 { 1020 switch (internalFormat) 1021 { 1022 case GL_R16_EXT: 1023 return true; 1024 default: 1025 break; 1026 } 1027 break; 1028 } 1029 default: 1030 break; 1031 } 1032 break; 1033 1034 case GL_RED_INTEGER: 1035 switch (type) 1036 { 1037 case GL_BYTE: 1038 { 1039 switch (internalFormat) 1040 { 1041 case GL_R8I: 1042 return true; 1043 default: 1044 break; 1045 } 1046 break; 1047 } 1048 case GL_INT: 1049 { 1050 switch (internalFormat) 1051 { 1052 case GL_R32I: 1053 return true; 1054 default: 1055 break; 1056 } 1057 break; 1058 } 1059 case GL_SHORT: 1060 { 1061 switch (internalFormat) 1062 { 1063 case GL_R16I: 1064 return true; 1065 default: 1066 break; 1067 } 1068 break; 1069 } 1070 case GL_UNSIGNED_BYTE: 1071 { 1072 switch (internalFormat) 1073 { 1074 case GL_R8UI: 1075 return true; 1076 default: 1077 break; 1078 } 1079 break; 1080 } 1081 case GL_UNSIGNED_INT: 1082 { 1083 switch (internalFormat) 1084 { 1085 case GL_R32UI: 1086 return true; 1087 default: 1088 break; 1089 } 1090 break; 1091 } 1092 case GL_UNSIGNED_SHORT: 1093 { 1094 switch (internalFormat) 1095 { 1096 case GL_R16UI: 1097 return true; 1098 default: 1099 break; 1100 } 1101 break; 1102 } 1103 default: 1104 break; 1105 } 1106 break; 1107 1108 case GL_RG: 1109 switch (type) 1110 { 1111 case GL_BYTE: 1112 { 1113 switch (internalFormat) 1114 { 1115 case GL_RG8_SNORM: 1116 return true; 1117 default: 1118 break; 1119 } 1120 break; 1121 } 1122 case GL_FLOAT: 1123 { 1124 switch (internalFormat) 1125 { 1126 case GL_RG32F: 1127 case GL_RG16F: 1128 case GL_RG: 1129 return true; 1130 default: 1131 break; 1132 } 1133 break; 1134 } 1135 case GL_HALF_FLOAT: 1136 { 1137 switch (internalFormat) 1138 { 1139 case GL_RG16F: 1140 case GL_RG: 1141 return true; 1142 default: 1143 break; 1144 } 1145 break; 1146 } 1147 case GL_HALF_FLOAT_OES: 1148 { 1149 switch (internalFormat) 1150 { 1151 case GL_RG16F: 1152 case GL_RG: 1153 return true; 1154 default: 1155 break; 1156 } 1157 break; 1158 } 1159 case GL_SHORT: 1160 { 1161 switch (internalFormat) 1162 { 1163 case GL_RG16_SNORM_EXT: 1164 return true; 1165 default: 1166 break; 1167 } 1168 break; 1169 } 1170 case GL_UNSIGNED_BYTE: 1171 { 1172 switch (internalFormat) 1173 { 1174 case GL_RG8: 1175 case GL_RG: 1176 case GL_SRG8_EXT: 1177 return true; 1178 default: 1179 break; 1180 } 1181 break; 1182 } 1183 case GL_UNSIGNED_SHORT: 1184 { 1185 switch (internalFormat) 1186 { 1187 case GL_RG16_EXT: 1188 return true; 1189 default: 1190 break; 1191 } 1192 break; 1193 } 1194 default: 1195 break; 1196 } 1197 break; 1198 1199 case GL_RGB: 1200 switch (type) 1201 { 1202 case GL_BYTE: 1203 { 1204 switch (internalFormat) 1205 { 1206 case GL_RGB8_SNORM: 1207 return true; 1208 default: 1209 break; 1210 } 1211 break; 1212 } 1213 case GL_FLOAT: 1214 { 1215 switch (internalFormat) 1216 { 1217 case GL_RGB32F: 1218 case GL_RGB16F: 1219 case GL_R11F_G11F_B10F: 1220 case GL_RGB9_E5: 1221 case GL_RGB: 1222 return true; 1223 default: 1224 break; 1225 } 1226 break; 1227 } 1228 case GL_HALF_FLOAT: 1229 { 1230 switch (internalFormat) 1231 { 1232 case GL_RGB16F: 1233 case GL_R11F_G11F_B10F: 1234 case GL_RGB9_E5: 1235 return true; 1236 default: 1237 break; 1238 } 1239 break; 1240 } 1241 case GL_HALF_FLOAT_OES: 1242 { 1243 switch (internalFormat) 1244 { 1245 case GL_RGB16F: 1246 case GL_R11F_G11F_B10F: 1247 case GL_RGB9_E5: 1248 case GL_RGB: 1249 return true; 1250 default: 1251 break; 1252 } 1253 break; 1254 } 1255 case GL_SHORT: 1256 { 1257 switch (internalFormat) 1258 { 1259 case GL_RGB16_SNORM_EXT: 1260 return true; 1261 default: 1262 break; 1263 } 1264 break; 1265 } 1266 case GL_UNSIGNED_BYTE: 1267 { 1268 switch (internalFormat) 1269 { 1270 case GL_RGB8: 1271 case GL_RGB565: 1272 case GL_SRGB8: 1273 case GL_RGB: 1274 case GL_RGBX8_ANGLE: 1275 return true; 1276 default: 1277 break; 1278 } 1279 break; 1280 } 1281 case GL_UNSIGNED_INT_10F_11F_11F_REV: 1282 { 1283 switch (internalFormat) 1284 { 1285 case GL_R11F_G11F_B10F: 1286 return true; 1287 default: 1288 break; 1289 } 1290 break; 1291 } 1292 case GL_UNSIGNED_INT_2_10_10_10_REV: 1293 { 1294 switch (internalFormat) 1295 { 1296 case GL_RGB: 1297 return true; 1298 default: 1299 break; 1300 } 1301 break; 1302 } 1303 case GL_UNSIGNED_INT_5_9_9_9_REV: 1304 { 1305 switch (internalFormat) 1306 { 1307 case GL_RGB9_E5: 1308 return true; 1309 default: 1310 break; 1311 } 1312 break; 1313 } 1314 case GL_UNSIGNED_SHORT: 1315 { 1316 switch (internalFormat) 1317 { 1318 case GL_RGB16_EXT: 1319 return true; 1320 default: 1321 break; 1322 } 1323 break; 1324 } 1325 case GL_UNSIGNED_SHORT_5_6_5: 1326 { 1327 switch (internalFormat) 1328 { 1329 case GL_RGB565: 1330 case GL_RGB: 1331 return true; 1332 default: 1333 break; 1334 } 1335 break; 1336 } 1337 default: 1338 break; 1339 } 1340 break; 1341 1342 case GL_RGBA: 1343 switch (type) 1344 { 1345 case GL_BYTE: 1346 { 1347 switch (internalFormat) 1348 { 1349 case GL_RGBA8_SNORM: 1350 return true; 1351 default: 1352 break; 1353 } 1354 break; 1355 } 1356 case GL_FLOAT: 1357 { 1358 switch (internalFormat) 1359 { 1360 case GL_RGBA32F: 1361 case GL_RGBA16F: 1362 case GL_RGBA: 1363 return true; 1364 default: 1365 break; 1366 } 1367 break; 1368 } 1369 case GL_HALF_FLOAT: 1370 { 1371 switch (internalFormat) 1372 { 1373 case GL_RGBA16F: 1374 return true; 1375 default: 1376 break; 1377 } 1378 break; 1379 } 1380 case GL_HALF_FLOAT_OES: 1381 { 1382 switch (internalFormat) 1383 { 1384 case GL_RGBA16F: 1385 case GL_RGBA: 1386 return true; 1387 default: 1388 break; 1389 } 1390 break; 1391 } 1392 case GL_SHORT: 1393 { 1394 switch (internalFormat) 1395 { 1396 case GL_RGBA16_SNORM_EXT: 1397 return true; 1398 default: 1399 break; 1400 } 1401 break; 1402 } 1403 case GL_UNSIGNED_BYTE: 1404 { 1405 switch (internalFormat) 1406 { 1407 case GL_RGBA8: 1408 case GL_RGB5_A1: 1409 case GL_RGBA4: 1410 case GL_SRGB8_ALPHA8: 1411 case GL_RGBA: 1412 return true; 1413 default: 1414 break; 1415 } 1416 break; 1417 } 1418 case GL_UNSIGNED_INT_2_10_10_10_REV: 1419 { 1420 switch (internalFormat) 1421 { 1422 case GL_RGB10_A2: 1423 case GL_RGB5_A1: 1424 case GL_RGBA: 1425 return true; 1426 default: 1427 break; 1428 } 1429 break; 1430 } 1431 case GL_UNSIGNED_SHORT: 1432 { 1433 switch (internalFormat) 1434 { 1435 case GL_RGBA16_EXT: 1436 return true; 1437 default: 1438 break; 1439 } 1440 break; 1441 } 1442 case GL_UNSIGNED_SHORT_4_4_4_4: 1443 { 1444 switch (internalFormat) 1445 { 1446 case GL_RGBA4: 1447 case GL_RGBA: 1448 return true; 1449 default: 1450 break; 1451 } 1452 break; 1453 } 1454 case GL_UNSIGNED_SHORT_5_5_5_1: 1455 { 1456 switch (internalFormat) 1457 { 1458 case GL_RGB5_A1: 1459 case GL_RGBA: 1460 return true; 1461 default: 1462 break; 1463 } 1464 break; 1465 } 1466 default: 1467 break; 1468 } 1469 break; 1470 1471 case GL_RGBA_INTEGER: 1472 switch (type) 1473 { 1474 case GL_BYTE: 1475 { 1476 switch (internalFormat) 1477 { 1478 case GL_RGBA8I: 1479 return true; 1480 default: 1481 break; 1482 } 1483 break; 1484 } 1485 case GL_INT: 1486 { 1487 switch (internalFormat) 1488 { 1489 case GL_RGBA32I: 1490 return true; 1491 default: 1492 break; 1493 } 1494 break; 1495 } 1496 case GL_SHORT: 1497 { 1498 switch (internalFormat) 1499 { 1500 case GL_RGBA16I: 1501 return true; 1502 default: 1503 break; 1504 } 1505 break; 1506 } 1507 case GL_UNSIGNED_BYTE: 1508 { 1509 switch (internalFormat) 1510 { 1511 case GL_RGBA8UI: 1512 return true; 1513 default: 1514 break; 1515 } 1516 break; 1517 } 1518 case GL_UNSIGNED_INT: 1519 { 1520 switch (internalFormat) 1521 { 1522 case GL_RGBA32UI: 1523 return true; 1524 default: 1525 break; 1526 } 1527 break; 1528 } 1529 case GL_UNSIGNED_INT_2_10_10_10_REV: 1530 { 1531 switch (internalFormat) 1532 { 1533 case GL_RGB10_A2UI: 1534 return true; 1535 default: 1536 break; 1537 } 1538 break; 1539 } 1540 case GL_UNSIGNED_SHORT: 1541 { 1542 switch (internalFormat) 1543 { 1544 case GL_RGBA16UI: 1545 return true; 1546 default: 1547 break; 1548 } 1549 break; 1550 } 1551 default: 1552 break; 1553 } 1554 break; 1555 1556 case GL_RGB_INTEGER: 1557 switch (type) 1558 { 1559 case GL_BYTE: 1560 { 1561 switch (internalFormat) 1562 { 1563 case GL_RGB8I: 1564 return true; 1565 default: 1566 break; 1567 } 1568 break; 1569 } 1570 case GL_INT: 1571 { 1572 switch (internalFormat) 1573 { 1574 case GL_RGB32I: 1575 return true; 1576 default: 1577 break; 1578 } 1579 break; 1580 } 1581 case GL_SHORT: 1582 { 1583 switch (internalFormat) 1584 { 1585 case GL_RGB16I: 1586 return true; 1587 default: 1588 break; 1589 } 1590 break; 1591 } 1592 case GL_UNSIGNED_BYTE: 1593 { 1594 switch (internalFormat) 1595 { 1596 case GL_RGB8UI: 1597 return true; 1598 default: 1599 break; 1600 } 1601 break; 1602 } 1603 case GL_UNSIGNED_INT: 1604 { 1605 switch (internalFormat) 1606 { 1607 case GL_RGB32UI: 1608 return true; 1609 default: 1610 break; 1611 } 1612 break; 1613 } 1614 case GL_UNSIGNED_SHORT: 1615 { 1616 switch (internalFormat) 1617 { 1618 case GL_RGB16UI: 1619 return true; 1620 default: 1621 break; 1622 } 1623 break; 1624 } 1625 default: 1626 break; 1627 } 1628 break; 1629 1630 case GL_RG_INTEGER: 1631 switch (type) 1632 { 1633 case GL_BYTE: 1634 { 1635 switch (internalFormat) 1636 { 1637 case GL_RG8I: 1638 return true; 1639 default: 1640 break; 1641 } 1642 break; 1643 } 1644 case GL_INT: 1645 { 1646 switch (internalFormat) 1647 { 1648 case GL_RG32I: 1649 return true; 1650 default: 1651 break; 1652 } 1653 break; 1654 } 1655 case GL_SHORT: 1656 { 1657 switch (internalFormat) 1658 { 1659 case GL_RG16I: 1660 return true; 1661 default: 1662 break; 1663 } 1664 break; 1665 } 1666 case GL_UNSIGNED_BYTE: 1667 { 1668 switch (internalFormat) 1669 { 1670 case GL_RG8UI: 1671 return true; 1672 default: 1673 break; 1674 } 1675 break; 1676 } 1677 case GL_UNSIGNED_INT: 1678 { 1679 switch (internalFormat) 1680 { 1681 case GL_RG32UI: 1682 return true; 1683 default: 1684 break; 1685 } 1686 break; 1687 } 1688 case GL_UNSIGNED_SHORT: 1689 { 1690 switch (internalFormat) 1691 { 1692 case GL_RG16UI: 1693 return true; 1694 default: 1695 break; 1696 } 1697 break; 1698 } 1699 default: 1700 break; 1701 } 1702 break; 1703 1704 case GL_SRGB_ALPHA_EXT: 1705 switch (type) 1706 { 1707 case GL_UNSIGNED_BYTE: 1708 { 1709 switch (internalFormat) 1710 { 1711 case GL_SRGB_ALPHA_EXT: 1712 case GL_SRGB8_ALPHA8_EXT: 1713 return true; 1714 default: 1715 break; 1716 } 1717 break; 1718 } 1719 default: 1720 break; 1721 } 1722 break; 1723 1724 case GL_SRGB_EXT: 1725 switch (type) 1726 { 1727 case GL_UNSIGNED_BYTE: 1728 { 1729 switch (internalFormat) 1730 { 1731 case GL_SRGB_EXT: 1732 case GL_SRGB8: 1733 return true; 1734 default: 1735 break; 1736 } 1737 break; 1738 } 1739 default: 1740 break; 1741 } 1742 break; 1743 1744 case GL_STENCIL_INDEX: 1745 switch (type) 1746 { 1747 case GL_UNSIGNED_BYTE: 1748 { 1749 switch (internalFormat) 1750 { 1751 case GL_STENCIL_INDEX8: 1752 return true; 1753 default: 1754 break; 1755 } 1756 break; 1757 } 1758 default: 1759 break; 1760 } 1761 break; 1762 1763 default: 1764 UNREACHABLE(); 1765 break; 1766 } 1767 1768 return false; 1769 } 1770 1771 } // namespace gl 1772