aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-06-18 14:18:02 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-18 14:18:03 -0700
commit83bc22970364f1ff94751b99c4b4048b3c66e1a2 (patch)
treed20e70f1ff856b36208486f8cc8481ee1b86649e
parent35a5261085ca96f97deb59ec5515db250b53e82c (diff)
Work around for nexus 6 TexSubImage issue
-rw-r--r--include/gpu/GrCaps.h26
-rw-r--r--include/gpu/GrContextOptions.h6
-rw-r--r--src/gpu/GrCaps.cpp3
-rwxr-xr-xsrc/gpu/GrContext.cpp4
-rw-r--r--src/gpu/gl/GrGLCaps.cpp4
5 files changed, 30 insertions, 13 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index 54969c5933..10e100f8aa 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -133,6 +133,9 @@ public:
bool textureBarrierSupport() const { return fTextureBarrierSupport; }
bool useDrawInsteadOfClear() const { return fUseDrawInsteadOfClear; }
+ bool useDrawInsteadOfPartialRenderTargetWrite() const {
+ return fUseDrawInsteadOfPartialRenderTargetWrite;
+ }
/**
* Indicates the capabilities of the fixed function blend unit.
@@ -220,18 +223,19 @@ protected:
SkAutoTUnref<GrShaderCaps> fShaderCaps;
- bool fNPOTTextureTileSupport : 1;
- bool fMipMapSupport : 1;
- bool fTwoSidedStencilSupport : 1;
- bool fStencilWrapOpsSupport : 1;
- bool fDiscardRenderTargetSupport : 1;
- bool fReuseScratchTextures : 1;
- bool fGpuTracingSupport : 1;
- bool fCompressedTexSubImageSupport : 1;
- bool fOversizedStencilSupport : 1;
- bool fTextureBarrierSupport : 1;
+ bool fNPOTTextureTileSupport : 1;
+ bool fMipMapSupport : 1;
+ bool fTwoSidedStencilSupport : 1;
+ bool fStencilWrapOpsSupport : 1;
+ bool fDiscardRenderTargetSupport : 1;
+ bool fReuseScratchTextures : 1;
+ bool fGpuTracingSupport : 1;
+ bool fCompressedTexSubImageSupport : 1;
+ bool fOversizedStencilSupport : 1;
+ bool fTextureBarrierSupport : 1;
// Driver workaround
- bool fUseDrawInsteadOfClear : 1;
+ bool fUseDrawInsteadOfClear : 1;
+ bool fUseDrawInsteadOfPartialRenderTargetWrite : 1;
BlendEquationSupport fBlendEquationSupport;
uint32_t fAdvBlendEqBlacklist;
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 057bc83d19..7c723a8434 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -17,7 +17,8 @@ struct GrContextOptions {
, fMaxTextureSizeOverride(SK_MaxS32)
, fMinTextureSizeOverride(0)
, fSuppressDualSourceBlending(false)
- , fGeometryBufferMapThreshold(-1) {}
+ , fGeometryBufferMapThreshold(-1)
+ , fUseDrawInsteadOfPartialRenderTargetWrite(false) {}
// EXPERIMENTAL
// May be removed in the future, or may become standard depending
@@ -39,6 +40,9 @@ struct GrContextOptions {
buffers to CPU memory in order to update them. A value of -1 means the GrContext should
deduce the optimal value for this platform. */
int fGeometryBufferMapThreshold;
+
+ /** some gpus have problems with partial writes of the rendertarget */
+ bool fUseDrawInsteadOfPartialRenderTargetWrite;
};
#endif
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index ba4e10430d..f2e88b01c4 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -109,6 +109,7 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fSupressPrints = options.fSuppressPrints;
fDrawPathMasksToCompressedTextureSupport = options.fDrawPathToCompressedTexture;
fGeometryBufferMapThreshold = options.fGeometryBufferMapThreshold;
+ fUseDrawInsteadOfPartialRenderTargetWrite = options.fUseDrawInsteadOfPartialRenderTargetWrite;
}
void GrCaps::applyOptionsOverrides(const GrContextOptions& options) {
@@ -150,6 +151,8 @@ SkString GrCaps::dump() const {
r.appendf("Oversized Stencil Support : %s\n", gNY[fOversizedStencilSupport]);
r.appendf("Texture Barrier Support : %s\n", gNY[fTextureBarrierSupport]);
r.appendf("Draw Instead of Clear [workaround] : %s\n", gNY[fUseDrawInsteadOfClear]);
+ r.appendf("Draw Instead of TexSubImage [workaround] : %s\n",
+ gNY[fUseDrawInsteadOfPartialRenderTargetWrite]);
if (this->advancedBlendEquationSupport()) {
r.appendf("Advanced Blend Equation Blacklist : 0x%x\n", fAdvBlendEqBlacklist);
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 03aeaa8fcd..7aaf6afe7e 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -334,7 +334,9 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
{
GrTexture* texture = NULL;
if (!(kUnpremul_PixelOpsFlag & pixelOpsFlags) && (texture = surface->asTexture()) &&
- fGpu->canWriteTexturePixels(texture, srcConfig)) {
+ fGpu->canWriteTexturePixels(texture, srcConfig) &&
+ (!fCaps->useDrawInsteadOfPartialRenderTargetWrite() || !surface->asRenderTarget() ||
+ (width == texture->width() && height == texture->height()))) {
if (!(kDontFlush_PixelOpsFlag & pixelOpsFlags) &&
surface->surfacePriv().hasPendingIO()) {
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index dad21977b2..c7dc862864 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -421,6 +421,10 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fUseDrawInsteadOfClear = true;
}
+ if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer()) {
+ fUseDrawInsteadOfPartialRenderTargetWrite = true;
+ }
+
if (kGL_GrGLStandard == standard) {
// ARB allows mixed size FBO attachments, EXT does not.
if (ctxInfo.version() >= GR_GL_VER(3, 0) ||