Incorporate sample count into RTC fallback color type.
Formats can be renderable but not support MSAA. Change-Id: I33fd295cce0b4b11a0c132c40a85fc7a7d4973b5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281477 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
613deb07a7
commit
0029db021a
@ -34,7 +34,8 @@ static bool clip_bounds_quick_reject(const SkIRect& clipBounds, const SkIRect& r
|
||||
static constexpr auto kMaskOrigin = kTopLeft_GrSurfaceOrigin;
|
||||
|
||||
static GrSurfaceProxyView find_filtered_mask(GrProxyProvider* provider, const GrUniqueKey& key) {
|
||||
return provider->findCachedProxyWithColorTypeFallback(key, kMaskOrigin, GrColorType::kAlpha_8);
|
||||
return provider->findCachedProxyWithColorTypeFallback(key, kMaskOrigin, GrColorType::kAlpha_8,
|
||||
1);
|
||||
}
|
||||
|
||||
// Draw a mask using the supplied paint. Since the coverage/geometry
|
||||
|
@ -355,7 +355,8 @@ static void add_invalidate_on_pop_message(GrRecordingContext* context,
|
||||
static constexpr auto kMaskOrigin = kTopLeft_GrSurfaceOrigin;
|
||||
|
||||
static GrSurfaceProxyView find_mask(GrProxyProvider* provider, const GrUniqueKey& key) {
|
||||
return provider->findCachedProxyWithColorTypeFallback(key, kMaskOrigin, GrColorType::kAlpha_8);
|
||||
return provider->findCachedProxyWithColorTypeFallback(key, kMaskOrigin, GrColorType::kAlpha_8,
|
||||
1);
|
||||
}
|
||||
|
||||
GrSurfaceProxyView GrClipStackClip::createAlphaClipMask(GrRecordingContext* context,
|
||||
|
@ -232,7 +232,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::findOrCreateProxyByUniqueKey(const GrUniq
|
||||
|
||||
GrSurfaceProxyView GrProxyProvider::findCachedProxyWithColorTypeFallback(const GrUniqueKey& key,
|
||||
GrSurfaceOrigin origin,
|
||||
GrColorType ct) {
|
||||
GrColorType ct,
|
||||
int sampleCnt) {
|
||||
auto proxy = this->findOrCreateProxyByUniqueKey(key);
|
||||
if (!proxy) {
|
||||
return {};
|
||||
@ -241,7 +242,7 @@ GrSurfaceProxyView GrProxyProvider::findCachedProxyWithColorTypeFallback(const G
|
||||
if (proxy->asRenderTargetProxy()) {
|
||||
GrBackendFormat expectedFormat;
|
||||
std::tie(ct, expectedFormat) =
|
||||
GrRenderTargetContext::GetFallbackColorTypeAndFormat(fImageContext, ct);
|
||||
GrRenderTargetContext::GetFallbackColorTypeAndFormat(fImageContext, ct, sampleCnt);
|
||||
SkASSERT(expectedFormat == proxy->backendFormat());
|
||||
}
|
||||
GrSwizzle swizzle = fImageContext->priv().caps()->getReadSwizzle(proxy->backendFormat(), ct);
|
||||
|
@ -67,7 +67,8 @@ public:
|
||||
*/
|
||||
GrSurfaceProxyView findCachedProxyWithColorTypeFallback(const GrUniqueKey&,
|
||||
GrSurfaceOrigin,
|
||||
GrColorType);
|
||||
GrColorType,
|
||||
int sampleCnt);
|
||||
|
||||
/*
|
||||
* Creates a new texture proxy for the bitmap, optionally with mip levels generated by the cpu.
|
||||
|
@ -244,11 +244,13 @@ static inline GrColorType color_type_fallback(GrColorType ct) {
|
||||
}
|
||||
|
||||
std::tuple<GrColorType, GrBackendFormat> GrRenderTargetContext::GetFallbackColorTypeAndFormat(
|
||||
GrImageContext* context, GrColorType colorType) {
|
||||
GrImageContext* context, GrColorType colorType, int sampleCnt) {
|
||||
auto caps = context->priv().caps();
|
||||
do {
|
||||
auto format =
|
||||
context->priv().caps()->getDefaultBackendFormat(colorType, GrRenderable::kYes);
|
||||
if (format.isValid()) {
|
||||
auto format = caps->getDefaultBackendFormat(colorType, GrRenderable::kYes);
|
||||
// We continue to the fallback color type if there no default renderable format or we
|
||||
// requested msaa and the format doesn't support msaa.
|
||||
if (format.isValid() && caps->isFormatRenderable(format, sampleCnt)) {
|
||||
return {colorType, format};
|
||||
}
|
||||
colorType = color_type_fallback(colorType);
|
||||
@ -268,7 +270,7 @@ std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeWithFallback(
|
||||
GrSurfaceOrigin origin,
|
||||
SkBudgeted budgeted,
|
||||
const SkSurfaceProps* surfaceProps) {
|
||||
auto [ct, format] = GetFallbackColorTypeAndFormat(context, colorType);
|
||||
auto [ct, format] = GetFallbackColorTypeAndFormat(context, colorType, sampleCnt);
|
||||
if (ct == GrColorType::kUnknown) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -90,7 +90,8 @@ public:
|
||||
const SkSurfaceProps* = nullptr);
|
||||
|
||||
static std::tuple<GrColorType, GrBackendFormat> GetFallbackColorTypeAndFormat(GrImageContext*,
|
||||
GrColorType);
|
||||
GrColorType,
|
||||
int sampleCnt);
|
||||
|
||||
// Same as previous factory but will try to use fallback GrColorTypes if the one passed in
|
||||
// fails. The fallback GrColorType will have at least the number of channels and precision per
|
||||
|
@ -51,7 +51,7 @@ uniform half blurRadius;
|
||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||
|
||||
if (auto view = proxyProvider->findCachedProxyWithColorTypeFallback(
|
||||
key, kMaskOrigin, GrColorType::kAlpha_8)) {
|
||||
key, kMaskOrigin, GrColorType::kAlpha_8, 1)) {
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||
|
||||
if (auto view = proxyProvider->findCachedProxyWithColorTypeFallback(
|
||||
key, kMaskOrigin, GrColorType::kAlpha_8)) {
|
||||
key, kMaskOrigin, GrColorType::kAlpha_8, 1)) {
|
||||
return view;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user