Reland "Check that the GrBackendFormat of a promise image is textureable."
This is a reland of commit 866bd64c1bddeb856fde212f2d92d7f5eaf23a0d
Original change's description:
> Check that the GrBackendFormat of a promise image is textureable.
>
> Bug: chromium:1311844
> Change-Id: I13bae71305ae9520851cd1ea38a1da737b934dd1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/532196
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
Bug: chromium:1311844
Change-Id: I01e2d0e4eb01ee7d97798db6eeff73fec76bf521
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/532408
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ganesh/GrProxyProvider.cpp b/src/gpu/ganesh/GrProxyProvider.cpp
index 6901325..5c37211 100644
--- a/src/gpu/ganesh/GrProxyProvider.cpp
+++ b/src/gpu/ganesh/GrProxyProvider.cpp
@@ -757,6 +757,9 @@
         dimensions.fHeight > threadSafeProxy->priv().caps()->maxTextureSize()) {
         return nullptr;
     }
+    if (!threadSafeProxy->priv().caps()->isFormatTexturable(format, format.textureType())) {
+        return nullptr;
+    }
     // Ganesh assumes that, when wrapping a mipmapped backend texture from a client, that its
     // mipmaps are fully fleshed out.
     GrMipmapStatus mipmapStatus = (GrMipmapped::kYes == mipmapped) ? GrMipmapStatus::kValid
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp
index 357f940..70335e9 100644
--- a/tests/DeferredDisplayListTest.cpp
+++ b/tests/DeferredDisplayListTest.cpp
@@ -1204,6 +1204,10 @@
                 REPORTER_ASSERT(reporter, !image);
                 continue;
             }
+            if (!context->priv().caps()->isFormatTexturable(format, format.textureType())) {
+                REPORTER_ASSERT(reporter, !image);
+                continue;
+            }
             REPORTER_ASSERT(reporter, image);
 
             GrTextureProxy* backingProxy = sk_gpu_test::GetTextureImageProxy(image.get(), context);