diff options
author | Robert Phillips <robertphillips@google.com> | 2018-03-30 13:57:00 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-30 19:12:26 +0000 |
commit | 6b6fcc78620270ec2dcd57bd520ec500f60f4505 (patch) | |
tree | 4a08bccfd3485a582aa4e10c1e73047ef705fdac /src/gpu/GrContext.cpp | |
parent | 26339bf9a86b5f06747afe8e8bd92e3e6d8b703f (diff) |
Add SkSurface factory that takes an SkSurfaceCharacterization
TBR=bsalomon@google.com
Change-Id: Ie38123dc7c35005bfe8500bf4a16e0d16bbf36bd
Reviewed-on: https://skia-review.googlesource.com/117236
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r-- | src/gpu/GrContext.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index db13931b2b..1112b5705f 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -33,6 +33,7 @@ #include "SkImageInfoPriv.h" #include "SkJSONWriter.h" #include "SkMakeUnique.h" +#include "SkSurface_Gpu.h" #include "SkTaskGroup.h" #include "SkUnPreMultiplyPriv.h" #include "effects/GrConfigConversionEffect.h" @@ -172,8 +173,9 @@ SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization( return SkSurfaceCharacterization(); // return an invalid characterization } - // We're assuming GrFSAAType::kMixedSamples will never be specified via this code path - GrFSAAType FSAAType = sampleCnt > 1 ? GrFSAAType::kUnifiedMSAA : GrFSAAType::kNone; + if (!SkSurface_Gpu::Valid(ii)) { + return SkSurfaceCharacterization(); // return an invalid characterization + } if (!fCaps->mipMapSupport()) { isMipMapped = false; @@ -184,6 +186,16 @@ SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization( return SkSurfaceCharacterization(); // return an invalid characterization } + sampleCnt = fCaps->getRenderTargetSampleCount(sampleCnt, config); + if (!sampleCnt) { + return SkSurfaceCharacterization(); // return an invalid characterization + } + + GrFSAAType FSAAType = GrFSAAType::kNone; + if (sampleCnt > 1) { + FSAAType = fCaps->usesMixedSamples() ? GrFSAAType::kMixedSamples : GrFSAAType::kUnifiedMSAA; + } + // This surface characterization factory assumes that the resulting characterization is // textureable. if (!fCaps->isConfigTexturable(config)) { |