Workaround for blacklist KHR_blend_equation_advanced on ARM GPU
authorjoel.liang <joel.liang@arm.com>
Fri, 10 Jul 2015 02:46:18 +0000 (19:46 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 10 Jul 2015 02:46:18 +0000 (19:46 -0700)
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
src/gpu/gl/GrGLGpu.cpp

index 539212c3a516336f977ce64680cf1c2ba04d15c6..22ad05746a8205941311dc7b22ad6c644ebaf71b 100644 (file)
@@ -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 {
index 20669b8e78bfcd7677cce97ff2a8575cb8516622..626a72f9362a32ad9887f3eb6bbd26c0b19aefa6 100644 (file)
@@ -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;