Work around for nexus 6 TexSubImage issue

BUG=skia:

Review URL: https://codereview.chromium.org/1173203005
This commit is contained in:
joshualitt 2015-06-18 11:07:09 -07:00 committed by Commit bot
parent 1e23736f59
commit c69fe20ef3
5 changed files with 30 additions and 13 deletions

View File

@ -133,6 +133,9 @@ public:
bool textureBarrierSupport() const { return fTextureBarrierSupport; }
bool useDrawInsteadOfClear() const { return fUseDrawInsteadOfClear; }
bool useDrawInsteadOfPartialTextureWrite() const {
return fUseDrawInsteadOfPartialTextureWrite;
}
/**
* 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 fUseDrawInsteadOfPartialTextureWrite : 1;
BlendEquationSupport fBlendEquationSupport;
uint32_t fAdvBlendEqBlacklist;

View File

@ -17,7 +17,8 @@ struct GrContextOptions {
, fMaxTextureSizeOverride(SK_MaxS32)
, fMinTextureSizeOverride(0)
, fSuppressDualSourceBlending(false)
, fGeometryBufferMapThreshold(-1) {}
, fGeometryBufferMapThreshold(-1)
, fUseDrawInsteadOfPartialTextureWrite(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 texture writes */
bool fUseDrawInsteadOfPartialTextureWrite;
};
#endif

View File

@ -109,6 +109,7 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fSupressPrints = options.fSuppressPrints;
fDrawPathMasksToCompressedTextureSupport = options.fDrawPathToCompressedTexture;
fGeometryBufferMapThreshold = options.fGeometryBufferMapThreshold;
fUseDrawInsteadOfPartialTextureWrite = options.fUseDrawInsteadOfPartialTextureWrite;
}
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[fUseDrawInsteadOfPartialTextureWrite]);
if (this->advancedBlendEquationSupport()) {
r.appendf("Advanced Blend Equation Blacklist : 0x%x\n", fAdvBlendEqBlacklist);
}

View File

@ -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->useDrawInsteadOfPartialTextureWrite() ||
(width == texture->width() && height == texture->height()))) {
if (!(kDontFlush_PixelOpsFlag & pixelOpsFlags) &&
surface->surfacePriv().hasPendingIO()) {

View File

@ -421,6 +421,10 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fUseDrawInsteadOfClear = true;
}
if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer()) {
fUseDrawInsteadOfPartialTextureWrite = true;
}
if (kGL_GrGLStandard == standard) {
// ARB allows mixed size FBO attachments, EXT does not.
if (ctxInfo.version() >= GR_GL_VER(3, 0) ||