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 <sstream> | 8 #include <sstream> |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: | 802 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
803 return 4; | 803 return 4; |
804 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: | 804 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
805 return 5; | 805 return 5; |
806 default: | 806 default: |
807 NOTREACHED(); | 807 NOTREACHED(); |
808 return 0; | 808 return 0; |
809 } | 809 } |
810 } | 810 } |
811 | 811 |
812 uint32 GLES2Util::GetPreferredGLReadPixelsFormat(uint32 internal_format) { | 812 uint32 GLES2Util::GetGLReadPixelsImplementationFormat( |
| 813 uint32 internal_format) { |
813 switch (internal_format) { | 814 switch (internal_format) { |
814 case GL_RGB16F_EXT: | 815 case GL_R8: |
815 case GL_RGB32F_EXT: | 816 case GL_R16F: |
| 817 case GL_R32F: |
| 818 return GL_RED; |
| 819 case GL_R8UI: |
| 820 case GL_R8I: |
| 821 case GL_R16UI: |
| 822 case GL_R16I: |
| 823 case GL_R32UI: |
| 824 case GL_R32I: |
| 825 return GL_RED_INTEGER; |
| 826 case GL_RG8: |
| 827 case GL_RG16F: |
| 828 case GL_RG32F: |
| 829 return GL_RG; |
| 830 case GL_RG8UI: |
| 831 case GL_RG8I: |
| 832 case GL_RG16UI: |
| 833 case GL_RG16I: |
| 834 case GL_RG32UI: |
| 835 case GL_RG32I: |
| 836 return GL_RG_INTEGER; |
| 837 case GL_RGB: |
| 838 case GL_RGB8: |
| 839 case GL_RGB565: |
| 840 case GL_R11F_G11F_B10F: |
| 841 case GL_RGB16F: |
| 842 case GL_RGB32F: |
816 return GL_RGB; | 843 return GL_RGB; |
817 case GL_RGBA16F_EXT: | 844 case GL_RGBA8UI: |
818 case GL_RGBA32F_EXT: | 845 case GL_RGBA8I: |
819 return GL_RGBA; | 846 case GL_RGB10_A2UI: |
| 847 case GL_RGBA16UI: |
| 848 case GL_RGBA16I: |
| 849 case GL_RGBA32UI: |
| 850 case GL_RGBA32I: |
| 851 return GL_RGBA_INTEGER; |
820 default: | 852 default: |
821 return GL_RGBA; | 853 return GL_RGBA; |
822 } | 854 } |
823 } | 855 } |
824 | 856 |
825 uint32 GLES2Util::GetPreferredGLReadPixelsType( | 857 uint32 GLES2Util::GetGLReadPixelsImplementationType( |
826 uint32 internal_format, uint32 texture_type) { | 858 uint32 internal_format, uint32 texture_type) { |
827 switch (internal_format) { | 859 switch (internal_format) { |
828 case GL_RGBA32F_EXT: | 860 case GL_R16UI: |
829 case GL_RGB32F_EXT: | 861 case GL_RG16UI: |
| 862 case GL_RGBA16UI: |
| 863 case GL_RGB10_A2: |
| 864 case GL_RGB10_A2UI: |
| 865 return GL_UNSIGNED_SHORT; |
| 866 case GL_R32UI: |
| 867 case GL_RG32UI: |
| 868 case GL_RGBA32UI: |
| 869 return GL_UNSIGNED_INT; |
| 870 case GL_R8I: |
| 871 case GL_RG8I: |
| 872 case GL_RGBA8I: |
| 873 return GL_BYTE; |
| 874 case GL_R16I: |
| 875 case GL_RG16I: |
| 876 case GL_RGBA16I: |
| 877 return GL_SHORT; |
| 878 case GL_R32I: |
| 879 case GL_RG32I: |
| 880 case GL_RGBA32I: |
| 881 return GL_INT; |
| 882 case GL_R32F: |
| 883 case GL_RG32F: |
| 884 case GL_RGB32F: |
| 885 case GL_RGBA32F: |
830 return GL_FLOAT; | 886 return GL_FLOAT; |
831 case GL_RGBA16F_EXT: | 887 case GL_R16F: |
832 case GL_RGB16F_EXT: | 888 case GL_RG16F: |
833 return GL_HALF_FLOAT_OES; | 889 case GL_R11F_G11F_B10F: |
| 890 case GL_RGB16F: |
| 891 case GL_RGBA16F: |
| 892 // TODO(zmo): Consider return GL_UNSIGNED_INT_10F_11F_11F_REV and |
| 893 // GL_HALF_FLOAT. |
| 894 return GL_FLOAT; |
834 case GL_RGBA: | 895 case GL_RGBA: |
835 case GL_RGB: | 896 case GL_RGB: |
836 // Unsized internal format, check the type | 897 // Unsized internal format, check the type |
837 switch (texture_type) { | 898 switch (texture_type) { |
838 case GL_FLOAT: | 899 case GL_FLOAT: |
839 case GL_HALF_FLOAT_OES: | 900 case GL_HALF_FLOAT_OES: |
840 return GL_FLOAT; | 901 return GL_FLOAT; |
| 902 // TODO(zmo): Consider return GL_UNSIGNED_SHORT_5_6_5, |
| 903 // GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_5_5_5_1, and |
| 904 // GL_UNSIGNED_INT_2_10_10_10_REV. |
841 default: | 905 default: |
842 return GL_UNSIGNED_BYTE; | 906 return GL_UNSIGNED_BYTE; |
843 } | 907 } |
844 default: | 908 default: |
845 return GL_UNSIGNED_BYTE; | 909 return GL_UNSIGNED_BYTE; |
846 } | 910 } |
847 } | 911 } |
848 | 912 |
849 uint32 GLES2Util::GetChannelsForFormat(int format) { | 913 uint32 GLES2Util::GetChannelsForFormat(int format) { |
850 switch (format) { | 914 switch (format) { |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 } | 1348 } |
1285 | 1349 |
1286 return true; | 1350 return true; |
1287 } | 1351 } |
1288 | 1352 |
1289 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" | 1353 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" |
1290 | 1354 |
1291 } // namespace gles2 | 1355 } // namespace gles2 |
1292 } // namespace gpu | 1356 } // namespace gpu |
1293 | 1357 |
OLD | NEW |