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/GrCaps.cpp b/src/gpu/GrCaps.cpp
index b6fd67f..32714b8 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -422,3 +422,19 @@
return compatible;
}
#endif
+
+GrBackendFormat GrCaps::getDefaultBackendFormat(GrColorType grColorType,
+ GrRenderable renderable) const {
+ GrBackendFormat format = this->onGetDefaultBackendFormat(grColorType, renderable);
+ if (!this->isFormatTexturable(grColorType, format)) {
+ return {};
+ }
+
+ if (renderable == GrRenderable::kYes) {
+ if (!this->isFormatRenderable(grColorType, format)) {
+ return {};
+ }
+ }
+
+ return format;
+}