Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1206)

Side by Side Diff: gpu/command_buffer/common/gles2_cmd_utils.cc

Issue 1308313008: Fix ReadPixels implementation specific read format/type on desktop GL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clear
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(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_R11F_G11F_B10F:
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_RGBA_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::GetGLReadPixelsImplementationType(
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:
833 return GL_HALF_FLOAT_OES; 888 case GL_RGB16F:
889 case GL_RGBA16F:
890 // TODO(zmo): Consider return GL_HALF_FLOAT on ES3.
891 return GL_FLOAT;
892 case GL_R11F_G11F_B10F:
893 // TODO(zmo): Consider return GL_UNSIGNED_INT_10F_11F_11F_REV.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698