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

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

Issue 1938493002: [Reland] Fix ReadPixels from float fbo buffer in ES2/WebGL1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 case GL_RGBA16I: 1060 case GL_RGBA16I:
1061 return GL_SHORT; 1061 return GL_SHORT;
1062 case GL_R32I: 1062 case GL_R32I:
1063 case GL_RG32I: 1063 case GL_RG32I:
1064 case GL_RGBA32I: 1064 case GL_RGBA32I:
1065 return GL_INT; 1065 return GL_INT;
1066 case GL_R32F: 1066 case GL_R32F:
1067 case GL_RG32F: 1067 case GL_RG32F:
1068 case GL_RGB32F: 1068 case GL_RGB32F:
1069 case GL_RGBA32F: 1069 case GL_RGBA32F:
1070 return GL_FLOAT; 1070 case GL_R11F_G11F_B10F:
1071 return GL_UNSIGNED_BYTE;
1071 case GL_R16F: 1072 case GL_R16F:
1072 case GL_RG16F: 1073 case GL_RG16F:
1073 case GL_R11F_G11F_B10F:
1074 case GL_RGB16F: 1074 case GL_RGB16F:
1075 case GL_RGBA16F: 1075 case GL_RGBA16F:
1076 // TODO(zmo): Consider return GL_UNSIGNED_INT_10F_11F_11F_REV and 1076 return GL_HALF_FLOAT;
1077 // GL_HALF_FLOAT.
1078 return GL_FLOAT;
1079 case GL_RGBA:
1080 case GL_RGB:
1081 // Unsized internal format, check the type
1082 switch (texture_type) {
1083 case GL_FLOAT:
1084 case GL_HALF_FLOAT_OES:
1085 return GL_FLOAT;
1086 // TODO(zmo): Consider return GL_UNSIGNED_SHORT_5_6_5,
1087 // GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_5_5_5_1, and
1088 // GL_UNSIGNED_INT_2_10_10_10_REV.
1089 default:
1090 return GL_UNSIGNED_BYTE;
1091 }
1092 default: 1077 default:
1093 return GL_UNSIGNED_BYTE; 1078 // Unsized internal format.
1079 return texture_type;
1094 } 1080 }
1095 } 1081 }
1096 1082
1097 uint32_t GLES2Util::GetChannelsForFormat(int format) { 1083 uint32_t GLES2Util::GetChannelsForFormat(int format) {
1098 switch (format) { 1084 switch (format) {
1099 case GL_ALPHA: 1085 case GL_ALPHA:
1100 case GL_ALPHA16F_EXT: 1086 case GL_ALPHA16F_EXT:
1101 case GL_ALPHA32F_EXT: 1087 case GL_ALPHA32F_EXT:
1102 return kAlpha; 1088 return kAlpha;
1103 case GL_LUMINANCE: 1089 case GL_LUMINANCE:
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 } 1530 }
1545 1531
1546 return true; 1532 return true;
1547 } 1533 }
1548 1534
1549 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" 1535 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h"
1550 1536
1551 } // namespace gles2 1537 } // namespace gles2
1552 } // namespace gpu 1538 } // namespace gpu
1553 1539
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698