Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: src/gpu/GrContext.cpp

Issue 1261033005: Skip temp texture when config conversion test has already failed. (Closed) Base URL: https://skia.googlesource.com/skia.git@fix
Patch Set: Additional Comment Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 6b7f5528954e5161c6f89640f6608f55240ca4c0..b7f8ac19c2946ae3bed947856a82d38bbcc41a5d 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 {
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698