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: 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_STENCIL_INDEX_OES: 572 switch (type) 573 { 574 case GL_UNSIGNED_BYTE: 575 return GL_STENCIL_INDEX8; 576 default: 577 break; 578 } 579 break; 580 581 case GL_NONE: 582 return GL_NONE; 583 584 default: 585 break; 586 } 587 588 return GL_NONE; 589 } 590 ValidES3Format(GLenum format)591bool ValidES3Format(GLenum format) 592 { 593 switch (format) 594 { 595 case GL_ALPHA: 596 case GL_BGRA_EXT: 597 case GL_DEPTH_COMPONENT: 598 case GL_DEPTH_STENCIL: 599 case GL_LUMINANCE: 600 case GL_LUMINANCE_ALPHA: 601 case GL_RED: 602 case GL_RED_INTEGER: 603 case GL_RG: 604 case GL_RGB: 605 case GL_RGBA: 606 case GL_RGBA_INTEGER: 607 case GL_RGB_INTEGER: 608 case GL_RG_INTEGER: 609 case GL_SRGB_ALPHA_EXT: 610 case GL_SRGB_EXT: 611 case GL_STENCIL_INDEX: 612 return true; 613 614 default: 615 return false; 616 } 617 } 618 ValidES3Type(GLenum type)619bool ValidES3Type(GLenum type) 620 { 621 switch (type) 622 { 623 case GL_BYTE: 624 case GL_FLOAT: 625 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: 626 case GL_HALF_FLOAT: 627 case GL_HALF_FLOAT_OES: 628 case GL_INT: 629 case GL_SHORT: 630 case GL_UNSIGNED_BYTE: 631 case GL_UNSIGNED_INT: 632 case GL_UNSIGNED_INT_10F_11F_11F_REV: 633 case GL_UNSIGNED_INT_24_8: 634 case GL_UNSIGNED_INT_2_10_10_10_REV: 635 case GL_UNSIGNED_INT_5_9_9_9_REV: 636 case GL_UNSIGNED_SHORT: 637 case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: 638 case GL_UNSIGNED_SHORT_4_4_4_4: 639 case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: 640 case GL_UNSIGNED_SHORT_5_5_5_1: 641 case GL_UNSIGNED_SHORT_5_6_5: 642 return true; 643 644 default: 645 return false; 646 } 647 } 648 ValidES3FormatCombination(GLenum format,GLenum type,GLenum internalFormat)649bool ValidES3FormatCombination(GLenum format, GLenum type, GLenum internalFormat) 650 { 651 ASSERT(ValidES3Format(format) && ValidES3Type(type)); 652 653 switch (format) 654 { 655 case GL_ALPHA: 656 switch (type) 657 { 658 case GL_FLOAT: 659 { 660 switch (internalFormat) 661 { 662 case GL_ALPHA: 663 case GL_ALPHA32F_EXT: 664 return true; 665 default: 666 break; 667 } 668 break; 669 } 670 case GL_HALF_FLOAT: 671 { 672 switch (internalFormat) 673 { 674 case GL_ALPHA: 675 case GL_ALPHA16F_EXT: 676 return true; 677 default: 678 break; 679 } 680 break; 681 } 682 case GL_HALF_FLOAT_OES: 683 { 684 switch (internalFormat) 685 { 686 case GL_ALPHA: 687 case GL_ALPHA16F_EXT: 688 return true; 689 default: 690 break; 691 } 692 break; 693 } 694 case GL_UNSIGNED_BYTE: 695 { 696 switch (internalFormat) 697 { 698 case GL_ALPHA: 699 case GL_ALPHA8_EXT: 700 return true; 701 default: 702 break; 703 } 704 break; 705 } 706 default: 707 break; 708 } 709 break; 710 711 case GL_BGRA_EXT: 712 switch (type) 713 { 714 case GL_UNSIGNED_BYTE: 715 { 716 switch (internalFormat) 717 { 718 case GL_BGRA_EXT: 719 case GL_BGRA8_EXT: 720 case GL_BGRA4_ANGLEX: 721 case GL_BGR5_A1_ANGLEX: 722 return true; 723 default: 724 break; 725 } 726 break; 727 } 728 case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: 729 { 730 switch (internalFormat) 731 { 732 case GL_BGR5_A1_ANGLEX: 733 return true; 734 default: 735 break; 736 } 737 break; 738 } 739 case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: 740 { 741 switch (internalFormat) 742 { 743 case GL_BGRA4_ANGLEX: 744 return true; 745 default: 746 break; 747 } 748 break; 749 } 750 default: 751 break; 752 } 753 break; 754 755 case GL_DEPTH_COMPONENT: 756 switch (type) 757 { 758 case GL_FLOAT: 759 { 760 switch (internalFormat) 761 { 762 case GL_DEPTH_COMPONENT32F: 763 return true; 764 default: 765 break; 766 } 767 break; 768 } 769 case GL_UNSIGNED_INT: 770 { 771 switch (internalFormat) 772 { 773 case GL_DEPTH_COMPONENT24: 774 case GL_DEPTH_COMPONENT16: 775 case GL_DEPTH_COMPONENT: 776 return true; 777 default: 778 break; 779 } 780 break; 781 } 782 case GL_UNSIGNED_INT_24_8: 783 { 784 switch (internalFormat) 785 { 786 case GL_DEPTH_COMPONENT32_OES: 787 return true; 788 default: 789 break; 790 } 791 break; 792 } 793 case GL_UNSIGNED_SHORT: 794 { 795 switch (internalFormat) 796 { 797 case GL_DEPTH_COMPONENT16: 798 case GL_DEPTH_COMPONENT: 799 return true; 800 default: 801 break; 802 } 803 break; 804 } 805 default: 806 break; 807 } 808 break; 809 810 case GL_DEPTH_STENCIL: 811 switch (type) 812 { 813 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: 814 { 815 switch (internalFormat) 816 { 817 case GL_DEPTH32F_STENCIL8: 818 return true; 819 default: 820 break; 821 } 822 break; 823 } 824 case GL_UNSIGNED_INT_24_8: 825 { 826 switch (internalFormat) 827 { 828 case GL_DEPTH_STENCIL: 829 case GL_DEPTH24_STENCIL8: 830 return true; 831 default: 832 break; 833 } 834 break; 835 } 836 default: 837 break; 838 } 839 break; 840 841 case GL_LUMINANCE: 842 switch (type) 843 { 844 case GL_FLOAT: 845 { 846 switch (internalFormat) 847 { 848 case GL_LUMINANCE: 849 case GL_LUMINANCE32F_EXT: 850 return true; 851 default: 852 break; 853 } 854 break; 855 } 856 case GL_HALF_FLOAT: 857 { 858 switch (internalFormat) 859 { 860 case GL_LUMINANCE: 861 case GL_LUMINANCE16F_EXT: 862 return true; 863 default: 864 break; 865 } 866 break; 867 } 868 case GL_HALF_FLOAT_OES: 869 { 870 switch (internalFormat) 871 { 872 case GL_LUMINANCE: 873 case GL_LUMINANCE16F_EXT: 874 return true; 875 default: 876 break; 877 } 878 break; 879 } 880 case GL_UNSIGNED_BYTE: 881 { 882 switch (internalFormat) 883 { 884 case GL_LUMINANCE: 885 case GL_LUMINANCE8_EXT: 886 return true; 887 default: 888 break; 889 } 890 break; 891 } 892 default: 893 break; 894 } 895 break; 896 897 case GL_LUMINANCE_ALPHA: 898 switch (type) 899 { 900 case GL_FLOAT: 901 { 902 switch (internalFormat) 903 { 904 case GL_LUMINANCE_ALPHA: 905 case GL_LUMINANCE_ALPHA32F_EXT: 906 return true; 907 default: 908 break; 909 } 910 break; 911 } 912 case GL_HALF_FLOAT: 913 { 914 switch (internalFormat) 915 { 916 case GL_LUMINANCE_ALPHA: 917 case GL_LUMINANCE_ALPHA16F_EXT: 918 return true; 919 default: 920 break; 921 } 922 break; 923 } 924 case GL_HALF_FLOAT_OES: 925 { 926 switch (internalFormat) 927 { 928 case GL_LUMINANCE_ALPHA: 929 case GL_LUMINANCE_ALPHA16F_EXT: 930 return true; 931 default: 932 break; 933 } 934 break; 935 } 936 case GL_UNSIGNED_BYTE: 937 { 938 switch (internalFormat) 939 { 940 case GL_LUMINANCE_ALPHA: 941 case GL_LUMINANCE8_ALPHA8_EXT: 942 return true; 943 default: 944 break; 945 } 946 break; 947 } 948 default: 949 break; 950 } 951 break; 952 953 case GL_RED: 954 switch (type) 955 { 956 case GL_BYTE: 957 { 958 switch (internalFormat) 959 { 960 case GL_R8_SNORM: 961 return true; 962 default: 963 break; 964 } 965 break; 966 } 967 case GL_FLOAT: 968 { 969 switch (internalFormat) 970 { 971 case GL_R32F: 972 case GL_R16F: 973 case GL_RED: 974 return true; 975 default: 976 break; 977 } 978 break; 979 } 980 case GL_HALF_FLOAT: 981 { 982 switch (internalFormat) 983 { 984 case GL_R16F: 985 case GL_RED: 986 return true; 987 default: 988 break; 989 } 990 break; 991 } 992 case GL_HALF_FLOAT_OES: 993 { 994 switch (internalFormat) 995 { 996 case GL_R16F: 997 case GL_RED: 998 return true; 999 default: 1000 break; 1001 } 1002 break; 1003 } 1004 case GL_SHORT: 1005 { 1006 switch (internalFormat) 1007 { 1008 case GL_R16_SNORM_EXT: 1009 return true; 1010 default: 1011 break; 1012 } 1013 break; 1014 } 1015 case GL_UNSIGNED_BYTE: 1016 { 1017 switch (internalFormat) 1018 { 1019 case GL_R8: 1020 case GL_RED: 1021 case GL_SR8_EXT: 1022 return true; 1023 default: 1024 break; 1025 } 1026 break; 1027 } 1028 case GL_UNSIGNED_SHORT: 1029 { 1030 switch (internalFormat) 1031 { 1032 case GL_R16_EXT: 1033 return true; 1034 default: 1035 break; 1036 } 1037 break; 1038 } 1039 default: 1040 break; 1041 } 1042 break; 1043 1044 case GL_RED_INTEGER: 1045 switch (type) 1046 { 1047 case GL_BYTE: 1048 { 1049 switch (internalFormat) 1050 { 1051 case GL_R8I: 1052 return true; 1053 default: 1054 break; 1055 } 1056 break; 1057 } 1058 case GL_INT: 1059 { 1060 switch (internalFormat) 1061 { 1062 case GL_R32I: 1063 return true; 1064 default: 1065 break; 1066 } 1067 break; 1068 } 1069 case GL_SHORT: 1070 { 1071 switch (internalFormat) 1072 { 1073 case GL_R16I: 1074 return true; 1075 default: 1076 break; 1077 } 1078 break; 1079 } 1080 case GL_UNSIGNED_BYTE: 1081 { 1082 switch (internalFormat) 1083 { 1084 case GL_R8UI: 1085 return true; 1086 default: 1087 break; 1088 } 1089 break; 1090 } 1091 case GL_UNSIGNED_INT: 1092 { 1093 switch (internalFormat) 1094 { 1095 case GL_R32UI: 1096 return true; 1097 default: 1098 break; 1099 } 1100 break; 1101 } 1102 case GL_UNSIGNED_SHORT: 1103 { 1104 switch (internalFormat) 1105 { 1106 case GL_R16UI: 1107 return true; 1108 default: 1109 break; 1110 } 1111 break; 1112 } 1113 default: 1114 break; 1115 } 1116 break; 1117 1118 case GL_RG: 1119 switch (type) 1120 { 1121 case GL_BYTE: 1122 { 1123 switch (internalFormat) 1124 { 1125 case GL_RG8_SNORM: 1126 return true; 1127 default: 1128 break; 1129 } 1130 break; 1131 } 1132 case GL_FLOAT: 1133 { 1134 switch (internalFormat) 1135 { 1136 case GL_RG32F: 1137 case GL_RG16F: 1138 case GL_RG: 1139 return true; 1140 default: 1141 break; 1142 } 1143 break; 1144 } 1145 case GL_HALF_FLOAT: 1146 { 1147 switch (internalFormat) 1148 { 1149 case GL_RG16F: 1150 case GL_RG: 1151 return true; 1152 default: 1153 break; 1154 } 1155 break; 1156 } 1157 case GL_HALF_FLOAT_OES: 1158 { 1159 switch (internalFormat) 1160 { 1161 case GL_RG16F: 1162 case GL_RG: 1163 return true; 1164 default: 1165 break; 1166 } 1167 break; 1168 } 1169 case GL_SHORT: 1170 { 1171 switch (internalFormat) 1172 { 1173 case GL_RG16_SNORM_EXT: 1174 return true; 1175 default: 1176 break; 1177 } 1178 break; 1179 } 1180 case GL_UNSIGNED_BYTE: 1181 { 1182 switch (internalFormat) 1183 { 1184 case GL_RG8: 1185 case GL_RG: 1186 case GL_SRG8_EXT: 1187 return true; 1188 default: 1189 break; 1190 } 1191 break; 1192 } 1193 case GL_UNSIGNED_SHORT: 1194 { 1195 switch (internalFormat) 1196 { 1197 case GL_RG16_EXT: 1198 return true; 1199 default: 1200 break; 1201 } 1202 break; 1203 } 1204 default: 1205 break; 1206 } 1207 break; 1208 1209 case GL_RGB: 1210 switch (type) 1211 { 1212 case GL_BYTE: 1213 { 1214 switch (internalFormat) 1215 { 1216 case GL_RGB8_SNORM: 1217 return true; 1218 default: 1219 break; 1220 } 1221 break; 1222 } 1223 case GL_FLOAT: 1224 { 1225 switch (internalFormat) 1226 { 1227 case GL_RGB32F: 1228 case GL_RGB16F: 1229 case GL_R11F_G11F_B10F: 1230 case GL_RGB9_E5: 1231 case GL_RGB: 1232 return true; 1233 default: 1234 break; 1235 } 1236 break; 1237 } 1238 case GL_HALF_FLOAT: 1239 { 1240 switch (internalFormat) 1241 { 1242 case GL_RGB16F: 1243 case GL_R11F_G11F_B10F: 1244 case GL_RGB9_E5: 1245 return true; 1246 default: 1247 break; 1248 } 1249 break; 1250 } 1251 case GL_HALF_FLOAT_OES: 1252 { 1253 switch (internalFormat) 1254 { 1255 case GL_RGB16F: 1256 case GL_R11F_G11F_B10F: 1257 case GL_RGB9_E5: 1258 case GL_RGB: 1259 return true; 1260 default: 1261 break; 1262 } 1263 break; 1264 } 1265 case GL_SHORT: 1266 { 1267 switch (internalFormat) 1268 { 1269 case GL_RGB16_SNORM_EXT: 1270 return true; 1271 default: 1272 break; 1273 } 1274 break; 1275 } 1276 case GL_UNSIGNED_BYTE: 1277 { 1278 switch (internalFormat) 1279 { 1280 case GL_RGB8: 1281 case GL_RGB565: 1282 case GL_SRGB8: 1283 case GL_RGB: 1284 return true; 1285 default: 1286 break; 1287 } 1288 break; 1289 } 1290 case GL_UNSIGNED_INT_10F_11F_11F_REV: 1291 { 1292 switch (internalFormat) 1293 { 1294 case GL_R11F_G11F_B10F: 1295 return true; 1296 default: 1297 break; 1298 } 1299 break; 1300 } 1301 case GL_UNSIGNED_INT_2_10_10_10_REV: 1302 { 1303 switch (internalFormat) 1304 { 1305 case GL_RGB: 1306 return true; 1307 default: 1308 break; 1309 } 1310 break; 1311 } 1312 case GL_UNSIGNED_INT_5_9_9_9_REV: 1313 { 1314 switch (internalFormat) 1315 { 1316 case GL_RGB9_E5: 1317 return true; 1318 default: 1319 break; 1320 } 1321 break; 1322 } 1323 case GL_UNSIGNED_SHORT: 1324 { 1325 switch (internalFormat) 1326 { 1327 case GL_RGB16_EXT: 1328 return true; 1329 default: 1330 break; 1331 } 1332 break; 1333 } 1334 case GL_UNSIGNED_SHORT_5_6_5: 1335 { 1336 switch (internalFormat) 1337 { 1338 case GL_RGB565: 1339 case GL_RGB: 1340 return true; 1341 default: 1342 break; 1343 } 1344 break; 1345 } 1346 default: 1347 break; 1348 } 1349 break; 1350 1351 case GL_RGBA: 1352 switch (type) 1353 { 1354 case GL_BYTE: 1355 { 1356 switch (internalFormat) 1357 { 1358 case GL_RGBA8_SNORM: 1359 return true; 1360 default: 1361 break; 1362 } 1363 break; 1364 } 1365 case GL_FLOAT: 1366 { 1367 switch (internalFormat) 1368 { 1369 case GL_RGBA32F: 1370 case GL_RGBA16F: 1371 case GL_RGBA: 1372 return true; 1373 default: 1374 break; 1375 } 1376 break; 1377 } 1378 case GL_HALF_FLOAT: 1379 { 1380 switch (internalFormat) 1381 { 1382 case GL_RGBA16F: 1383 return true; 1384 default: 1385 break; 1386 } 1387 break; 1388 } 1389 case GL_HALF_FLOAT_OES: 1390 { 1391 switch (internalFormat) 1392 { 1393 case GL_RGBA16F: 1394 case GL_RGBA: 1395 return true; 1396 default: 1397 break; 1398 } 1399 break; 1400 } 1401 case GL_SHORT: 1402 { 1403 switch (internalFormat) 1404 { 1405 case GL_RGBA16_SNORM_EXT: 1406 return true; 1407 default: 1408 break; 1409 } 1410 break; 1411 } 1412 case GL_UNSIGNED_BYTE: 1413 { 1414 switch (internalFormat) 1415 { 1416 case GL_RGBA8: 1417 case GL_RGB5_A1: 1418 case GL_RGBA4: 1419 case GL_SRGB8_ALPHA8: 1420 case GL_RGBA: 1421 return true; 1422 default: 1423 break; 1424 } 1425 break; 1426 } 1427 case GL_UNSIGNED_INT_2_10_10_10_REV: 1428 { 1429 switch (internalFormat) 1430 { 1431 case GL_RGB10_A2: 1432 case GL_RGB5_A1: 1433 case GL_RGBA: 1434 return true; 1435 default: 1436 break; 1437 } 1438 break; 1439 } 1440 case GL_UNSIGNED_SHORT: 1441 { 1442 switch (internalFormat) 1443 { 1444 case GL_RGBA16_EXT: 1445 return true; 1446 default: 1447 break; 1448 } 1449 break; 1450 } 1451 case GL_UNSIGNED_SHORT_4_4_4_4: 1452 { 1453 switch (internalFormat) 1454 { 1455 case GL_RGBA4: 1456 case GL_RGBA: 1457 return true; 1458 default: 1459 break; 1460 } 1461 break; 1462 } 1463 case GL_UNSIGNED_SHORT_5_5_5_1: 1464 { 1465 switch (internalFormat) 1466 { 1467 case GL_RGB5_A1: 1468 case GL_RGBA: 1469 return true; 1470 default: 1471 break; 1472 } 1473 break; 1474 } 1475 default: 1476 break; 1477 } 1478 break; 1479 1480 case GL_RGBA_INTEGER: 1481 switch (type) 1482 { 1483 case GL_BYTE: 1484 { 1485 switch (internalFormat) 1486 { 1487 case GL_RGBA8I: 1488 return true; 1489 default: 1490 break; 1491 } 1492 break; 1493 } 1494 case GL_INT: 1495 { 1496 switch (internalFormat) 1497 { 1498 case GL_RGBA32I: 1499 return true; 1500 default: 1501 break; 1502 } 1503 break; 1504 } 1505 case GL_SHORT: 1506 { 1507 switch (internalFormat) 1508 { 1509 case GL_RGBA16I: 1510 return true; 1511 default: 1512 break; 1513 } 1514 break; 1515 } 1516 case GL_UNSIGNED_BYTE: 1517 { 1518 switch (internalFormat) 1519 { 1520 case GL_RGBA8UI: 1521 return true; 1522 default: 1523 break; 1524 } 1525 break; 1526 } 1527 case GL_UNSIGNED_INT: 1528 { 1529 switch (internalFormat) 1530 { 1531 case GL_RGBA32UI: 1532 return true; 1533 default: 1534 break; 1535 } 1536 break; 1537 } 1538 case GL_UNSIGNED_INT_2_10_10_10_REV: 1539 { 1540 switch (internalFormat) 1541 { 1542 case GL_RGB10_A2UI: 1543 return true; 1544 default: 1545 break; 1546 } 1547 break; 1548 } 1549 case GL_UNSIGNED_SHORT: 1550 { 1551 switch (internalFormat) 1552 { 1553 case GL_RGBA16UI: 1554 return true; 1555 default: 1556 break; 1557 } 1558 break; 1559 } 1560 default: 1561 break; 1562 } 1563 break; 1564 1565 case GL_RGB_INTEGER: 1566 switch (type) 1567 { 1568 case GL_BYTE: 1569 { 1570 switch (internalFormat) 1571 { 1572 case GL_RGB8I: 1573 return true; 1574 default: 1575 break; 1576 } 1577 break; 1578 } 1579 case GL_INT: 1580 { 1581 switch (internalFormat) 1582 { 1583 case GL_RGB32I: 1584 return true; 1585 default: 1586 break; 1587 } 1588 break; 1589 } 1590 case GL_SHORT: 1591 { 1592 switch (internalFormat) 1593 { 1594 case GL_RGB16I: 1595 return true; 1596 default: 1597 break; 1598 } 1599 break; 1600 } 1601 case GL_UNSIGNED_BYTE: 1602 { 1603 switch (internalFormat) 1604 { 1605 case GL_RGB8UI: 1606 return true; 1607 default: 1608 break; 1609 } 1610 break; 1611 } 1612 case GL_UNSIGNED_INT: 1613 { 1614 switch (internalFormat) 1615 { 1616 case GL_RGB32UI: 1617 return true; 1618 default: 1619 break; 1620 } 1621 break; 1622 } 1623 case GL_UNSIGNED_SHORT: 1624 { 1625 switch (internalFormat) 1626 { 1627 case GL_RGB16UI: 1628 return true; 1629 default: 1630 break; 1631 } 1632 break; 1633 } 1634 default: 1635 break; 1636 } 1637 break; 1638 1639 case GL_RG_INTEGER: 1640 switch (type) 1641 { 1642 case GL_BYTE: 1643 { 1644 switch (internalFormat) 1645 { 1646 case GL_RG8I: 1647 return true; 1648 default: 1649 break; 1650 } 1651 break; 1652 } 1653 case GL_INT: 1654 { 1655 switch (internalFormat) 1656 { 1657 case GL_RG32I: 1658 return true; 1659 default: 1660 break; 1661 } 1662 break; 1663 } 1664 case GL_SHORT: 1665 { 1666 switch (internalFormat) 1667 { 1668 case GL_RG16I: 1669 return true; 1670 default: 1671 break; 1672 } 1673 break; 1674 } 1675 case GL_UNSIGNED_BYTE: 1676 { 1677 switch (internalFormat) 1678 { 1679 case GL_RG8UI: 1680 return true; 1681 default: 1682 break; 1683 } 1684 break; 1685 } 1686 case GL_UNSIGNED_INT: 1687 { 1688 switch (internalFormat) 1689 { 1690 case GL_RG32UI: 1691 return true; 1692 default: 1693 break; 1694 } 1695 break; 1696 } 1697 case GL_UNSIGNED_SHORT: 1698 { 1699 switch (internalFormat) 1700 { 1701 case GL_RG16UI: 1702 return true; 1703 default: 1704 break; 1705 } 1706 break; 1707 } 1708 default: 1709 break; 1710 } 1711 break; 1712 1713 case GL_SRGB_ALPHA_EXT: 1714 switch (type) 1715 { 1716 case GL_UNSIGNED_BYTE: 1717 { 1718 switch (internalFormat) 1719 { 1720 case GL_SRGB_ALPHA_EXT: 1721 case GL_SRGB8_ALPHA8_EXT: 1722 return true; 1723 default: 1724 break; 1725 } 1726 break; 1727 } 1728 default: 1729 break; 1730 } 1731 break; 1732 1733 case GL_SRGB_EXT: 1734 switch (type) 1735 { 1736 case GL_UNSIGNED_BYTE: 1737 { 1738 switch (internalFormat) 1739 { 1740 case GL_SRGB_EXT: 1741 case GL_SRGB8: 1742 return true; 1743 default: 1744 break; 1745 } 1746 break; 1747 } 1748 default: 1749 break; 1750 } 1751 break; 1752 1753 case GL_STENCIL_INDEX: 1754 switch (type) 1755 { 1756 case GL_UNSIGNED_BYTE: 1757 { 1758 switch (internalFormat) 1759 { 1760 case GL_STENCIL_INDEX8: 1761 return true; 1762 default: 1763 break; 1764 } 1765 break; 1766 } 1767 default: 1768 break; 1769 } 1770 break; 1771 1772 default: 1773 UNREACHABLE(); 1774 break; 1775 } 1776 1777 return false; 1778 } 1779 1780 } // namespace gl 1781