OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file is here so other GLES2 related files can have a common set of | 5 // This file is here so other GLES2 related files can have a common set of |
6 // includes where appropriate. | 6 // includes where appropriate. |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 case GL_STENCIL_INDEX8: | 615 case GL_STENCIL_INDEX8: |
616 return kStencil; | 616 return kStencil; |
617 case GL_DEPTH_STENCIL_OES: | 617 case GL_DEPTH_STENCIL_OES: |
618 case GL_DEPTH24_STENCIL8_OES: | 618 case GL_DEPTH24_STENCIL8_OES: |
619 return kDepth | kStencil; | 619 return kDepth | kStencil; |
620 default: | 620 default: |
621 return 0x0000; | 621 return 0x0000; |
622 } | 622 } |
623 } | 623 } |
624 | 624 |
625 uint32 GLES2Util::GetChannelsNeededForAttachmentType(int type) { | 625 uint32 GLES2Util::GetChannelsNeededForAttachmentType( |
| 626 int type, uint32 max_color_attachments) { |
626 switch (type) { | 627 switch (type) { |
627 case GL_COLOR_ATTACHMENT0: | |
628 return kRGBA; | |
629 case GL_DEPTH_ATTACHMENT: | 628 case GL_DEPTH_ATTACHMENT: |
630 return kDepth; | 629 return kDepth; |
631 case GL_STENCIL_ATTACHMENT: | 630 case GL_STENCIL_ATTACHMENT: |
632 return kStencil; | 631 return kStencil; |
633 default: | 632 default: |
| 633 if (type >= GL_COLOR_ATTACHMENT0 && |
| 634 type < static_cast<int>( |
| 635 GL_COLOR_ATTACHMENT0 + max_color_attachments)) { |
| 636 return kRGBA; |
| 637 } |
634 return 0x0000; | 638 return 0x0000; |
635 } | 639 } |
636 } | 640 } |
637 | 641 |
638 std::string GLES2Util::GetStringEnum(uint32 value) { | 642 std::string GLES2Util::GetStringEnum(uint32 value) { |
639 const EnumToString* entry = enum_to_string_table_; | 643 const EnumToString* entry = enum_to_string_table_; |
640 const EnumToString* end = entry + enum_to_string_table_len_; | 644 const EnumToString* end = entry + enum_to_string_table_len_; |
641 for (;entry < end; ++entry) { | 645 for (;entry < end; ++entry) { |
642 if (value == entry->value) { | 646 if (value == entry->value) { |
643 return entry->name; | 647 return entry->name; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 } | 796 } |
793 | 797 |
794 return true; | 798 return true; |
795 } | 799 } |
796 | 800 |
797 #include "../common/gles2_cmd_utils_implementation_autogen.h" | 801 #include "../common/gles2_cmd_utils_implementation_autogen.h" |
798 | 802 |
799 } // namespace gles2 | 803 } // namespace gles2 |
800 } // namespace gpu | 804 } // namespace gpu |
801 | 805 |
OLD | NEW |