Revert "Revert "Add integer texture support.""

This reverts commit 9c7edb8311409a141b0dc1d5e480c68c629f1997.

Fixes ASAN errors

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4736

Change-Id: I1b1dae754d357b01da7169c8e7c59d7d8d8a10f6
Reviewed-on: https://skia-review.googlesource.com/4736
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/gl/GrGLDefines.h b/src/gpu/gl/GrGLDefines.h
index 8dc7af1..8f739cc 100644
--- a/src/gpu/gl/GrGLDefines.h
+++ b/src/gpu/gl/GrGLDefines.h
@@ -408,24 +408,112 @@
 #define GR_GL_LINE_WIDTH_GRANULARITY         0x0B23
 #define GR_GL_LINE_WIDTH_RANGE               0x0B22
 
-/* PixelFormat */
+/* Unsized formats */
+#define GR_GL_STENCIL_INDEX                  0x1901
 #define GR_GL_DEPTH_COMPONENT                0x1902
+#define GR_GL_DEPTH_STENCIL                  0x84F9
 #define GR_GL_RED                            0x1903
+#define GR_GL_RED_INTEGER                    0x8D94
 #define GR_GL_GREEN                          0x1904
 #define GR_GL_BLUE                           0x1905
 #define GR_GL_ALPHA                          0x1906
-#define GR_GL_RGB                            0x1907
-#define GR_GL_RGBA                           0x1908
-#define GR_GL_BGRA                           0x80E1
 #define GR_GL_LUMINANCE                      0x1909
 #define GR_GL_LUMINANCE_ALPHA                0x190A
-#define GR_GL_PALETTE8_RGBA8                 0x8B96
-#define GR_GL_ALPHA8                         0x803C
+#define GR_GL_RG_INTEGER                     0x8228
+#define GR_GL_RGB                            0x1907
+#define GR_GL_RGB_INTEGER                    0x8D98
+#define GR_GL_SRGB                           0x8C40
+#define GR_GL_RGBA                           0x1908
+#define GR_GL_SRGB_ALPHA                     0x8C42
+#define GR_GL_RGBA_INTEGER                   0x8D99
+#define GR_GL_BGRA                           0x80E1
 
+/* Stencil index sized formats */
+#define GR_GL_STENCIL_INDEX4                 0x8D47
+#define GR_GL_STENCIL_INDEX8                 0x8D48
+#define GR_GL_STENCIL_INDEX16                0x8D49
+
+/* Depth component sized formats */
+#define GR_GL_DEPTH_COMPONENT16              0x81A5
+
+/* Depth stencil sized formats */
+#define GR_GL_DEPTH24_STENCIL8               0x88F0
+
+/* Red sized formats */
 #define GR_GL_R8                             0x8229
+#define GR_GL_R16                            0x822A
 #define GR_GL_R16F                           0x822D
-#define GR_GL_RGBA16F                        0x881A
+#define GR_GL_R32F                           0x822E
+
+/* Red integer sized formats */
+#define GR_GL_R8I                            0x8231
+#define GR_GL_R8UI                           0x8232
+#define GR_GL_R16I                           0x8233
+#define GR_GL_R16UI                          0x8234
+#define GR_GL_R32I                           0x8235
+#define GR_GL_R32UI                          0x8236
+
+/* Alpha sized formats */
+#define GR_GL_ALPHA8                         0x803C
+#define GR_GL_ALPHA16                        0x803E
 #define GR_GL_ALPHA16F                       0x881C
+#define GR_GL_ALPHA32F                       0x8816
+
+/* Alpha integer sized formats */
+#define GR_GL_ALPHA8I                        0x8D90
+#define GR_GL_ALPHA8UI                       0x8D7E
+#define GR_GL_ALPHA16I                       0x8D8A
+#define GR_GL_ALPHA16UI                      0x8D78
+#define GR_GL_ALPHA32I                       0x8D84
+#define GR_GL_ALPHA32UI                      0x8D72
+
+/* RG sized formats */
+#define GR_GL_RG8                            0x822B
+#define GR_GL_RG16                           0x822C
+#define GR_GL_R16F                           0x822D
+#define GR_GL_R32F                           0x822E
+
+/* RG sized integer formats */
+#define GR_GL_RG8I                           0x8237
+#define GR_GL_RG8UI                          0x8238
+#define GR_GL_RG16I                          0x8239
+#define GR_GL_RG16UI                         0x823A
+#define GR_GL_RG32I                          0x823B
+#define GR_GL_RG32UI                         0x823C
+
+/* RGB sized formats */
+#define GR_GL_RGB5                           0x8050
+#define GR_GL_RGB565                         0x8D62
+#define GR_GL_RGB8                           0x8051
+#define GR_GL_SRGB8                          0x8C41
+
+/* RGB integer sized formats */
+#define GR_GL_RGB8I                          0x8D8F
+#define GR_GL_RGB8UI                         0x8D7D
+#define GR_GL_RGB16I                         0x8D89
+#define GR_GL_RGB16UI                        0x8D77
+#define GR_GL_RGB32I                         0x8D83
+#define GR_GL_RGB32UI                        0x8D71
+
+/* RGBA sized formats */
+#define GR_GL_RGBA4                          0x8056
+#define GR_GL_RGB5_A1                        0x8057
+#define GR_GL_PALETTE8_RGBA8                 0x8B96
+#define GR_GL_RGBA8                          0x8058
+#define GR_GL_SRGB8_ALPHA8                   0x8C43
+#define GR_GL_RGBA16F                        0x881A
+#define GR_GL_RGBA32F                        0x8814
+
+/* RGBA integer sized formats */
+#define GR_GL_RGBA8I                         0x8D8E
+#define GR_GL_RGBA8UI                        0x8D7C
+#define GR_GL_RGBA16I                        0x8D88
+#define GR_GL_RGBA16UI                       0x8D76
+#define GR_GL_RGBA32I                        0x8D82
+#define GR_GL_RGBA32UI                       0x8D70
+
+/* BGRA sized formats */
+#define GR_GL_BGRA8                          0x93A1
 
 /* PixelType */
 /*      GL_UNSIGNED_BYTE */
@@ -782,26 +870,6 @@
 
 #define GR_GL_RENDERBUFFER                   0x8D41
 
-#define GR_GL_RGBA4                          0x8056
-#define GR_GL_RGB5_A1                        0x8057
-#define GR_GL_RGB565                         0x8D62
-#define GR_GL_RGBA8                          0x8058
-#define GR_GL_RGBA32F                        0x8814
-#define GR_GL_RGB5                           0x8050
-#define GR_GL_RGB8                           0x8051
-#define GR_GL_BGRA8                          0x93A1
-#define GR_GL_SRGB                           0x8C40
-#define GR_GL_SRGB8                          0x8C41
-#define GR_GL_SRGB_ALPHA                     0x8C42
-#define GR_GL_SRGB8_ALPHA8                   0x8C43
-#define GR_GL_DEPTH_COMPONENT16              0x81A5
-#define GR_GL_STENCIL_INDEX                  0x1901
-#define GR_GL_STENCIL_INDEX4                 0x8D47
-#define GR_GL_STENCIL_INDEX8                 0x8D48
-#define GR_GL_STENCIL_INDEX16                0x8D49
-#define GR_GL_DEPTH_STENCIL                  0x84F9
-#define GR_GL_DEPTH24_STENCIL8               0x88F0
-
 #define GR_GL_MAX_SAMPLES                    0x8D57
 // GL_IMG_multisampled_render_to_texture uses a different value for GL_MAX_SAMPLES
 #define GR_GL_MAX_SAMPLES_IMG                0x9135