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

Unified Diff: gpu/command_buffer/common/gles2_cmd_utils.cc

Issue 1309333003: Get ReadPixels to work with INT and UNSIGNED_INT format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/common/gles2_cmd_utils.cc
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index e0ca1ecc650ab81fa3746dde630b9dbb7297c856..94692c10b63a1cf7c5683d4e2b4b8b29b02b0035 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -453,6 +453,7 @@ int BytesPerElement(int type) {
case GL_FLOAT:
case GL_UNSIGNED_INT_24_8_OES:
case GL_UNSIGNED_INT:
+ case GL_INT:
case GL_UNSIGNED_INT_2_10_10_10_REV:
case GL_UNSIGNED_INT_10F_11F_11F_REV:
case GL_UNSIGNED_INT_5_9_9_9_REV:
@@ -1085,6 +1086,49 @@ uint32_t GLES2Util::MapBufferTargetToBindingEnum(uint32_t target) {
}
}
+// static
+bool GLES2Util::IsUnsignedIntegerFormat(uint32_t internal_format) {
+ switch (internal_format) {
+ case GL_R8UI:
+ case GL_R16UI:
+ case GL_R32UI:
+ case GL_RG8UI:
+ case GL_RG16UI:
+ case GL_RG32UI:
+ case GL_RGBA8UI:
+ case GL_RGB10_A2UI:
+ case GL_RGBA16UI:
+ case GL_RGBA32UI:
+ return true;
+ default:
+ return false;
+ }
+}
+
+// static
+bool GLES2Util::IsSignedIntegerFormat(uint32_t internal_format) {
+ switch (internal_format) {
+ case GL_R8I:
+ case GL_R16I:
+ case GL_R32I:
+ case GL_RG8I:
+ case GL_RG16I:
+ case GL_RG32I:
+ case GL_RGBA8I:
+ case GL_RGBA16I:
+ case GL_RGBA32I:
+ return true;
+ default:
+ return false;
+ }
+}
+
+// static
+bool GLES2Util::IsIntegerFormat(uint32_t internal_format) {
+ return (IsUnsignedIntegerFormat(internal_format) ||
+ IsSignedIntegerFormat(internal_format));
+}
+
namespace {

Powered by Google App Engine
This is Rietveld 408576698