Rework maxRenderTargetSampleCount and isFormatRenderable in GrCaps.
With this maxRenderTargetSampleCount only takes a GrBackendFormat and
returns a sample count based on that only. If a caller wants to know if
a given Format and GrColorType pair is renderable they should use
isFormatRenderable which now also takes a desired sample count.
This change also allows the removal of GrPixelConfig version of
maxRenderTargetSampleCount and internalMultisampleCount.
Bug: skia:6718
Change-Id: I563c61f8349e56f6681378170a45f33ac5cddfa9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231558
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 63a7780..0d24f41 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -238,8 +238,10 @@
}
int GrContext::maxSurfaceSampleCountForColorType(SkColorType colorType) const {
- GrPixelConfig config = SkColorType2GrPixelConfig(colorType);
- return this->caps()->maxRenderTargetSampleCount(config);
+ GrBackendFormat format =
+ this->caps()->getDefaultBackendFormat(SkColorTypeToGrColorType(colorType),
+ GrRenderable::kYes);
+ return this->caps()->maxRenderTargetSampleCount(format);
}
////////////////////////////////////////////////////////////////////////////////