diff options
author | bsalomon <bsalomon@google.com> | 2015-07-29 06:08:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-29 06:08:46 -0700 |
commit | 636e8024f8df8df7b89813c8b2b1ea04d7481497 (patch) | |
tree | fd120472f7b1e861020d3dde383f0911bf49bafa /src/gpu | |
parent | 125960152dfd7f2aba4c2239131bdf75d9ac2705 (diff) |
Skip temp texture when config conversion test has already failed.
Review URL: https://codereview.chromium.org/1261033005
Diffstat (limited to 'src/gpu')
-rwxr-xr-x | src/gpu/GrContext.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 6b7f552895..b7f8ac19c2 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -345,9 +345,14 @@ bool GrContext::writeSurfacePixels(GrSurface* surface, } applyPremulToSrc = true; } - GrGpu::DrawPreference drawPreference = applyPremulToSrc ? - GrGpu::kCallerPrefersDraw_DrawPreference : - GrGpu::kNoDraw_DrawPreference; + + GrGpu::DrawPreference drawPreference = GrGpu::kNoDraw_DrawPreference; + // Don't prefer to draw for the conversion (and thereby access a texture from the cache) when + // we've already determined that there isn't a roundtrip preserving conversion processor pair. + if (applyPremulToSrc && !this->didFailPMUPMConversionTest()) { + drawPreference = GrGpu::kCallerPrefersDraw_DrawPreference; + } + GrGpu::WritePixelTempDrawInfo tempDrawInfo; if (!fGpu->getWritePixelsInfo(surface, width, height, rowBytes, srcConfig, &drawPreference, &tempDrawInfo)) { @@ -476,8 +481,13 @@ bool GrContext::readSurfacePixels(GrSurface* src, return false; } - GrGpu::DrawPreference drawPreference = unpremul ? GrGpu::kCallerPrefersDraw_DrawPreference : - GrGpu::kNoDraw_DrawPreference; + GrGpu::DrawPreference drawPreference = GrGpu::kNoDraw_DrawPreference; + // Don't prefer to draw for the conversion (and thereby access a texture from the cache) when + // we've already determined that there isn't a roundtrip preserving conversion processor pair. + if (unpremul && !this->didFailPMUPMConversionTest()) { + drawPreference = GrGpu::kCallerPrefersDraw_DrawPreference; + } + GrGpu::ReadPixelTempDrawInfo tempDrawInfo; if (!fGpu->getReadPixelsInfo(src, width, height, rowBytes, dstConfig, &drawPreference, &tempDrawInfo)) { @@ -719,6 +729,12 @@ const GrFragmentProcessor* GrContext::createUPMToPMEffect(GrProcessorDataManager } } +bool GrContext::didFailPMUPMConversionTest() const { + // The PM<->UPM tests fail or succeed together so we only need to check one. + return fDidTestPMConversions && + GrConfigConversionEffect::kNone_PMConversion == fPMToUPMConversion; +} + ////////////////////////////////////////////////////////////////////////////// void GrContext::getResourceCacheLimits(int* maxTextures, size_t* maxTextureBytes) const { |