Support glDrawElements with GL_UNSIGNED_INT in the encoder

Currently glDrawElements with type GL_UNSIGNED_INT is not supported by
our encoder and decoder. The emulator will crash if someone uses it.
This patch add the support in the encoder side.

The related issue is here: b.android.com/200338
The patch on the decoder:
https://android-review.googlesource.com/#/c/202101

Change-Id: I9a6cde9983d34f39cfcc8c66a7ccf021dd5963eb
(cherry picked from commit e988586a6db9c7c3a7e6805f693d3a40913841a1)
diff --git a/opengl/shared/OpenglCodecCommon/glUtils.cpp b/opengl/shared/OpenglCodecCommon/glUtils.cpp
index eb4ba94..a61f76f 100644
--- a/opengl/shared/OpenglCodecCommon/glUtils.cpp
+++ b/opengl/shared/OpenglCodecCommon/glUtils.cpp
@@ -31,6 +31,7 @@
     case GL_HALF_FLOAT_OES:
         retval = 2;
         break;
+    case GL_UNSIGNED_INT:
     case GL_INT:
     case GL_FLOAT:
     case GL_FIXED:
diff --git a/opengl/system/GLESv1_enc/GLEncoder.cpp b/opengl/system/GLESv1_enc/GLEncoder.cpp
index b6e5be1..58877f6 100644
--- a/opengl/system/GLESv1_enc/GLEncoder.cpp
+++ b/opengl/system/GLESv1_enc/GLEncoder.cpp
@@ -580,6 +580,16 @@
                                                  count, -minIndex);
             }
             break;
+        case GL_INT:
+        case GL_UNSIGNED_INT:
+            GLUtils::minmax<unsigned int>((unsigned int *)indices, count, &minIndex, &maxIndex);
+            if (minIndex != 0) {
+                adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count);
+                GLUtils::shiftIndices<unsigned int>((unsigned int *)indices,
+                                                 (unsigned int *)adjustedIndices,
+                                                 count, -minIndex);
+            }
+            break;
         default:
             ALOGE("unsupported index buffer type %d\n", type);
         }
diff --git a/opengl/system/GLESv2_enc/GL2Encoder.cpp b/opengl/system/GLESv2_enc/GL2Encoder.cpp
index bfe208c..32aca15 100755
--- a/opengl/system/GLESv2_enc/GL2Encoder.cpp
+++ b/opengl/system/GLESv2_enc/GL2Encoder.cpp
@@ -623,6 +623,16 @@
                                                   count, -minIndex);
             }
             break;
+        case GL_INT:
+        case GL_UNSIGNED_INT:
+            GLUtils::minmax<unsigned int>((unsigned int *)indices, count, &minIndex, &maxIndex);
+            if (minIndex != 0) {
+                adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count);
+                GLUtils::shiftIndices<unsigned int>((unsigned int *)indices,
+                                                 (unsigned int *)adjustedIndices,
+                                                 count, -minIndex);
+            }
+            break;
         default:
             ALOGE("unsupported index buffer type %d\n", type);
         }