Add RGBA half float texture format.

BUG=skia:3829

Review URL: https://codereview.chromium.org/1148243002
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 2d80bcc..847e497 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -734,6 +734,7 @@
         "ASTC12x12",// kASTC_12x12_GrPixelConfig,
         "RGBAFloat",// kRGBA_float_GrPixelConfig
         "AlphaHalf",// kAlpha_half_GrPixelConfig
+        "RGBAHalf", // kRGBA_half_GrPixelConfig
     };
     GR_STATIC_ASSERT(0  == kUnknown_GrPixelConfig);
     GR_STATIC_ASSERT(1  == kAlpha_8_GrPixelConfig);
@@ -749,6 +750,7 @@
     GR_STATIC_ASSERT(11 == kASTC_12x12_GrPixelConfig);
     GR_STATIC_ASSERT(12 == kRGBA_float_GrPixelConfig);
     GR_STATIC_ASSERT(13 == kAlpha_half_GrPixelConfig);
+    GR_STATIC_ASSERT(14 == kRGBA_half_GrPixelConfig);
     GR_STATIC_ASSERT(SK_ARRAY_COUNT(kConfigNames) == kGrPixelConfigCnt);
 
     SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig][0]);
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 7d9c50d..ea6b83f 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -483,7 +483,7 @@
                 fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = false;
             }
             // for now we don't support floating point MSAA on ES
-            fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
+            fConfigRenderSupport[kRGBA_float_GrPixelConfig][kYes_MSAA] = false;
         }
     }
 
@@ -506,6 +506,25 @@
         }
     }
     
+    if (this->isConfigTexturable(kRGBA_half_GrPixelConfig)) {
+        if (kGL_GrGLStandard == standard) {
+            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kNo_MSAA] = true;
+            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kYes_MSAA] = true;
+        } else if (ctxInfo.version() >= GR_GL_VER(3, 0)) {
+            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kNo_MSAA] = true;
+            // for now we don't support floating point MSAA on ES
+            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kYes_MSAA] = false;
+        } else {
+            if (ctxInfo.hasExtension("GL_EXT_color_buffer_half_float")) {
+                fConfigRenderSupport[kRGBA_half_GrPixelConfig][kNo_MSAA] = true;
+            } else {
+                fConfigRenderSupport[kRGBA_half_GrPixelConfig][kNo_MSAA] = false;
+            }
+            // for now we don't support floating point MSAA on ES
+            fConfigRenderSupport[kRGBA_half_GrPixelConfig][kYes_MSAA] = false;
+        }
+    }
+
     // If we don't support MSAA then undo any places above where we set a config as renderable with
     // msaa.
     if (kNone_MSFBOType == fMSFBOType) {
@@ -663,6 +682,7 @@
                              ctxInfo.hasExtension("GL_OES_texture_half_float"));
     }
     fConfigTextureSupport[kAlpha_half_GrPixelConfig] = hasHalfFPTextures;
+    fConfigTextureSupport[kRGBA_half_GrPixelConfig] = hasHalfFPTextures;
 }
 
 bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf,
diff --git a/src/gpu/gl/GrGLDefines.h b/src/gpu/gl/GrGLDefines.h
index 349e3c4..4c479ed 100644
--- a/src/gpu/gl/GrGLDefines.h
+++ b/src/gpu/gl/GrGLDefines.h
@@ -404,6 +404,7 @@
 
 #define GR_GL_R8                             0x8229
 #define GR_GL_R16F                           0x822D
+#define GR_GL_RGBA16F                        0x881A
 #define GR_GL_ALPHA16F                       0x881C
 
 /* PixelType */
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index df3a5e6..6a8d83b 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2493,6 +2493,16 @@
             }
             break;
             
+        case kRGBA_half_GrPixelConfig:
+            *internalFormat = GR_GL_RGBA16F;
+            *externalFormat = GR_GL_RGBA;
+            if (kGL_GrGLStandard == this->glStandard() || this->glVersion() >= GR_GL_VER(3, 0)) {
+                *externalType = GR_GL_HALF_FLOAT;
+            } else {
+                *externalType = GR_GL_HALF_FLOAT_OES;
+            }
+            break;
+
         default:
             return false;
     }