Chromium Code Reviews| 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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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::GetPreferredGLReadPixelsFormat(uint32 internal_format) { |
| 813 switch (internal_format) { | 813 switch (internal_format) { |
| 814 case GL_RGB16F_EXT: | 814 case GL_R8: |
| 815 case GL_RGB32F_EXT: | 815 case GL_R16F: |
| 816 case GL_R32F: | |
| 817 return GL_RED; | |
| 818 case GL_R8UI: | |
| 819 case GL_R8I: | |
| 820 case GL_R16UI: | |
| 821 case GL_R16I: | |
| 822 case GL_R32UI: | |
| 823 case GL_R32I: | |
| 824 return GL_RED_INTEGER; | |
| 825 case GL_RG8: | |
| 826 case GL_RG16F: | |
| 827 case GL_RG32F: | |
| 828 return GL_RG; | |
| 829 case GL_RG8UI: | |
| 830 case GL_RG8I: | |
| 831 case GL_RG16UI: | |
| 832 case GL_RG16I: | |
| 833 case GL_RG32UI: | |
| 834 case GL_RG32I: | |
| 835 return GL_RG_INTEGER; | |
| 836 case GL_RGB: | |
| 837 case GL_RGB8: | |
| 838 case GL_RGB565: | |
| 839 case GL_RGB16F: | |
| 840 case GL_RGB32F: | |
| 841 case GL_RGBA8: | |
|
Ken Russell (switch to Gerrit)
2015/08/26 01:00:44
Is the GL_RGBA8 intended? Looks like an accident.
Zhenyao Mo
2015/08/26 01:11:05
It is intended to allow RGB readback for RGBA8 as
Ken Russell (switch to Gerrit)
2015/08/26 01:53:32
OK. In that case "GetPreferredGLReadPixelsFormat"
Zhenyao Mo
2015/08/26 21:21:25
Switched to a different name.
| |
| 816 return GL_RGB; | 842 return GL_RGB; |
| 817 case GL_RGBA16F_EXT: | 843 case GL_RGBA8UI: |
| 818 case GL_RGBA32F_EXT: | 844 case GL_RGBA8I: |
| 819 return GL_RGBA; | 845 case GL_RGB10_A2UI: |
| 846 case GL_RGBA16UI: | |
| 847 case GL_RGBA16I: | |
| 848 case GL_RGBA32UI: | |
| 849 case GL_RGBA32I: | |
| 850 return GL_RGB_INTEGER; | |
| 820 default: | 851 default: |
| 821 return GL_RGBA; | 852 return GL_RGBA; |
| 822 } | 853 } |
| 823 } | 854 } |
| 824 | 855 |
| 825 uint32 GLES2Util::GetPreferredGLReadPixelsType( | 856 uint32 GLES2Util::GetPreferredGLReadPixelsType( |
| 826 uint32 internal_format, uint32 texture_type) { | 857 uint32 internal_format, uint32 texture_type) { |
| 827 switch (internal_format) { | 858 switch (internal_format) { |
| 828 case GL_RGBA32F_EXT: | 859 case GL_R16UI: |
| 829 case GL_RGB32F_EXT: | 860 case GL_RG16UI: |
| 861 case GL_RGBA16UI: | |
| 862 case GL_RGB10_A2: | |
| 863 case GL_RGB10_A2UI: | |
| 864 return GL_UNSIGNED_SHORT; | |
| 865 case GL_R32UI: | |
| 866 case GL_RG32UI: | |
| 867 case GL_RGBA32UI: | |
| 868 return GL_UNSIGNED_INT; | |
| 869 case GL_R8I: | |
| 870 case GL_RG8I: | |
| 871 case GL_RGBA8I: | |
| 872 return GL_BYTE; | |
| 873 case GL_R16I: | |
| 874 case GL_RG16I: | |
| 875 case GL_RGBA16I: | |
| 876 return GL_SHORT; | |
| 877 case GL_R32I: | |
| 878 case GL_RG32I: | |
| 879 case GL_RGBA32I: | |
| 880 return GL_INT; | |
| 881 case GL_R32F: | |
| 882 case GL_RG32F: | |
| 883 case GL_RGB32F: | |
| 884 case GL_RGBA32F: | |
| 830 return GL_FLOAT; | 885 return GL_FLOAT; |
| 831 case GL_RGBA16F_EXT: | 886 case GL_R16F: |
| 832 case GL_RGB16F_EXT: | 887 case GL_RG16F: |
| 888 case GL_RGB16F: | |
| 889 case GL_RGBA16F: | |
| 890 // TODO(zmo): Return GL_HALF_FLOAT on ES3. | |
|
Ken Russell (switch to Gerrit)
2015/08/26 01:00:44
Additionally -- I think that EXT_color_buffer_floa
Zhenyao Mo
2015/08/26 01:11:05
Then the original code is a bug?
Ken Russell (switch to Gerrit)
2015/08/26 01:53:33
For ES 3.0, yes -- I think this is something that
Zhenyao Mo
2015/08/26 21:21:24
OK, I think I will return GL_FLOAT so the renderbu
| |
| 833 return GL_HALF_FLOAT_OES; | 891 return GL_HALF_FLOAT_OES; |
| 834 case GL_RGBA: | 892 case GL_RGBA: |
| 835 case GL_RGB: | 893 case GL_RGB: |
| 836 // Unsized internal format, check the type | 894 // Unsized internal format, check the type |
| 837 switch (texture_type) { | 895 switch (texture_type) { |
| 838 case GL_FLOAT: | 896 case GL_FLOAT: |
| 839 case GL_HALF_FLOAT_OES: | 897 case GL_HALF_FLOAT_OES: |
| 840 return GL_FLOAT; | 898 return GL_FLOAT; |
| 841 default: | 899 default: |
| 842 return GL_UNSIGNED_BYTE; | 900 return GL_UNSIGNED_BYTE; |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1284 } | 1342 } |
| 1285 | 1343 |
| 1286 return true; | 1344 return true; |
| 1287 } | 1345 } |
| 1288 | 1346 |
| 1289 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" | 1347 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" |
| 1290 | 1348 |
| 1291 } // namespace gles2 | 1349 } // namespace gles2 |
| 1292 } // namespace gpu | 1350 } // namespace gpu |
| 1293 | 1351 |
| OLD | NEW |