Fix some GPU image filter code to preserve precision and color space

On the pure-GPU path, we just have an SkSpecialImage (that's definitely
texture backed), and we need a renderable config for the draw context we
make. Added a helper function to pick - this is basically the high
precision analog of what we were doing before (always using 8888).

The assert that I added catches many other problems in image filter code,
but those fixes are coming in subsequent CLs.

12 GMs render correctly (or more correctly) in gpusrgb and gpuf16
configs. In most cases, they were drawing previously nothing.

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

Review-Url: https://codereview.chromium.org/2359443003
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 4e6032f..f6d4001 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -22,6 +22,7 @@
 #include "GrInvariantOutput.h"
 #include "GrTexture.h"
 #include "SkGr.h"
+#include "SkGrPriv.h"
 #include "effects/Gr1DKernelEffect.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
@@ -476,6 +477,7 @@
     sk_sp<GrTexture> srcTexture(input->asTextureRef(context));
     SkASSERT(srcTexture);
     sk_sp<SkColorSpace> colorSpace = sk_ref_sp(input->getColorSpace());
+    GrPixelConfig config = GrRenderableConfigForColorSpace(colorSpace.get());
 
     // setup new clip
     const GrFixedClip clip(SkIRect::MakeWH(srcTexture->width(), srcTexture->height()));
@@ -488,8 +490,7 @@
     if (radius.fWidth > 0) {
         sk_sp<GrDrawContext> dstDrawContext(context->makeDrawContext(SkBackingFit::kApprox,
                                                                      rect.width(), rect.height(),
-                                                                     kSkia8888_GrPixelConfig,
-                                                                     colorSpace));
+                                                                     config, colorSpace));
         if (!dstDrawContext) {
             return nullptr;
         }
@@ -510,8 +511,7 @@
     if (radius.fHeight > 0) {
         sk_sp<GrDrawContext> dstDrawContext(context->makeDrawContext(SkBackingFit::kApprox,
                                                                      rect.width(), rect.height(),
-                                                                     kSkia8888_GrPixelConfig,
-                                                                     colorSpace));
+                                                                     config, colorSpace));
         if (!dstDrawContext) {
             return nullptr;
         }