Propagate GrRenderable flag to GrCaps::getBackendFormatFromColorType

This makes calling GrCaps::getBackendFormatFromColorType equivalent to calling GrContext::defaultBackendFormat

Change-Id: Ic402245fa0502920c47c2a29aadc4e559abdc09b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230416
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 64f4a40..d3a550f 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -176,7 +176,7 @@
         GrSurfaceOrigin origin,
         SkBudgeted budgeted,
         GrProtected isProtected) {
-    auto format = this->caps()->getBackendFormatFromColorType(colorType);
+    auto format = this->caps()->getDefaultBackendFormat(colorType, GrRenderable::kNo);
     if (!format.isValid()) {
         return nullptr;
     }
@@ -225,7 +225,7 @@
         return nullptr;
     }
 
-    auto format = this->caps()->getBackendFormatFromColorType(colorType);
+    auto format = this->caps()->getDefaultBackendFormat(colorType, GrRenderable::kYes);
     if (!format.isValid()) {
         return nullptr;
     }
@@ -409,19 +409,13 @@
 
     GrColorType grColorType = SkColorTypeToGrColorType(skColorType);
 
-    // TODO: pass the 'renderable' parameter into getBackendFormatFromColorType and change
-    // the texturabilit and renderability tests below into asserts
-    GrBackendFormat format = caps->getBackendFormatFromColorType(grColorType);
-    if (!caps->isFormatTexturable(grColorType, format)) {
+    GrBackendFormat format = caps->getDefaultBackendFormat(grColorType, renderable);
+    if (!format.isValid()) {
         return GrBackendFormat();
     }
 
-    if (renderable == GrRenderable::kYes) {
-        if (!caps->isFormatRenderable(grColorType, format)) {
-            return GrBackendFormat();
-        }
-    }
+    SkASSERT(caps->isFormatTexturable(grColorType, format));
+    SkASSERT(renderable == GrRenderable::kNo || caps->isFormatRenderable(grColorType, format));
 
     return format;
 }
-