From 9764c40cd31c11c82686c8b8dbbeaea9fa4de05d Mon Sep 17 00:00:00 2001 From: "joel.liang" Date: Thu, 9 Jul 2015 19:46:18 -0700 Subject: [PATCH] Workaround for blacklist KHR_blend_equation_advanced on ARM GPU ARM driver will check the fragment shader compatiblity for KHR_blend_equation_advanced even if blending is disabled. Workaround: Set blending equation to any basic equation when we disable blending. https://code.google.com/p/skia/issues/detail?id=3943 BUG=skia:3943 Review URL: https://codereview.chromium.org/1216963004 --- src/gpu/gl/GrGLCaps.cpp | 7 +++++-- src/gpu/gl/GrGLGpu.cpp | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 539212c3a5..22ad05746a 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -888,8 +888,7 @@ void GrGLCaps::initBlendEqationSupport(const GrGLContextInfo& ctxInfo) { // for now until its own blacklists can be updated. if (kAdreno4xx_GrGLRenderer == ctxInfo.renderer() || kIntel_GrGLDriver == ctxInfo.driver() || - kChromium_GrGLDriver == ctxInfo.driver() || - kARM_GrGLVendor == ctxInfo.vendor()) { + kChromium_GrGLDriver == ctxInfo.driver()) { return; } @@ -922,6 +921,10 @@ void GrGLCaps::initBlendEqationSupport(const GrGLContextInfo& ctxInfo) { fAdvBlendEqBlacklist |= (1 << kColorDodge_GrBlendEquation) | (1 << kColorBurn_GrBlendEquation); } + if (kARM_GrGLVendor == ctxInfo.vendor()) { + // Blacklist color-burn on ARM until the fix is released. + fAdvBlendEqBlacklist |= (1 << kColorBurn_GrBlendEquation); + } } namespace { diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 20669b8e78..626a72f936 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -2158,6 +2158,18 @@ void GrGLGpu::flushBlend(const GrXferProcessor::BlendInfo& blendInfo) { if (blendOff) { if (kNo_TriState != fHWBlendState.fEnabled) { GL_CALL(Disable(GR_GL_BLEND)); + + // Workaround for the ARM KHR_blend_equation_advanced blacklist issue + // https://code.google.com/p/skia/issues/detail?id=3943 + if (kARM_GrGLVendor == this->ctxInfo().vendor() && + GrBlendEquationIsAdvanced(fHWBlendState.fEquation)) { + SkASSERT(this->caps()->advancedBlendEquationSupport()); + // Set to any basic blending equation. + GrBlendEquation blend_equation = kAdd_GrBlendEquation; + GL_CALL(BlendEquation(gXfermodeEquation2Blend[blend_equation])); + fHWBlendState.fEquation = blend_equation; + } + fHWBlendState.fEnabled = kNo_TriState; } return; -- 2.34.1