Workaround for bug in Tegra 3 when uploading to a render target

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1703603002

Review URL: https://codereview.chromium.org/1703603002
This commit is contained in:
bsalomon 2016-02-16 11:36:47 -08:00 committed by Commit bot
parent 8e84a1ed07
commit babafcc681
4 changed files with 19 additions and 4 deletions

View File

@ -151,6 +151,10 @@ public:
return fUseDrawInsteadOfPartialRenderTargetWrite;
}
bool useDrawInsteadOfAllRenderTargetWrites() const {
return fUseDrawInsteadOfAllRenderTargetWrites;
}
bool preferVRAMUseOverFlushes() const { return fPreferVRAMUseOverFlushes; }
/**
@ -280,6 +284,7 @@ protected:
// Driver workaround
bool fUseDrawInsteadOfClear : 1;
bool fUseDrawInsteadOfPartialRenderTargetWrite : 1;
bool fUseDrawInsteadOfAllRenderTargetWrites : 1;
// ANGLE workaround
bool fPreferVRAMUseOverFlushes : 1;

View File

@ -115,6 +115,7 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fDrawPathMasksToCompressedTextureSupport = options.fDrawPathToCompressedTexture;
fGeometryBufferMapThreshold = options.fGeometryBufferMapThreshold;
fUseDrawInsteadOfPartialRenderTargetWrite = options.fUseDrawInsteadOfPartialRenderTargetWrite;
fUseDrawInsteadOfAllRenderTargetWrites = false;
fPreferVRAMUseOverFlushes = true;
}

View File

@ -280,10 +280,13 @@ bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, siz
return false;
}
if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() &&
SkToBool(dstSurface->asRenderTarget()) &&
(width < dstSurface->width() || height < dstSurface->height())) {
ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference);
if (SkToBool(dstSurface->asRenderTarget())) {
if (this->caps()->useDrawInsteadOfAllRenderTargetWrites()) {
ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference);
} else if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() &&
(width < dstSurface->width() || height < dstSurface->height())) {
ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference);
}
}
if (!this->onGetWritePixelsInfo(dstSurface, width, height, rowBytes, srcConfig, drawPreference,

View File

@ -456,6 +456,12 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fUseDrawInsteadOfPartialRenderTargetWrite = true;
}
// Texture uploads sometimes seem to be ignored to textures bound to FBOS on Tegra3.
if (kTegra3_GrGLRenderer == ctxInfo.renderer()) {
fUseDrawInsteadOfPartialRenderTargetWrite = true;
fUseDrawInsteadOfAllRenderTargetWrites = true;
}
#ifdef SK_BUILD_FOR_WIN
// On ANGLE deferring flushes can lead to GPU starvation
fPreferVRAMUseOverFlushes = !isANGLE;