From be9588ade8e3dac0adc8e038c46de006ca21af48 Mon Sep 17 00:00:00 2001 From: egdaniel Date: Tue, 30 Dec 2014 09:42:49 -0800 Subject: Fix for disabled color writes xp on n6 The N6 has some driver bug that is required us to give some value to gl_FragColor. The disabledColorWriteXP should not need to set any value in its shader, but to fix this crash this cl sets gl_FragColor to 0. BUG=445377 Review URL: https://codereview.chromium.org/823053003 --- src/gpu/effects/GrDisableColorXP.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/gpu') diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp index ba6a45b780..9383385192 100644 --- a/src/gpu/effects/GrDisableColorXP.cpp +++ b/src/gpu/effects/GrDisableColorXP.cpp @@ -8,6 +8,8 @@ #include "effects/GrDisableColorXP.h" #include "GrProcessor.h" #include "gl/GrGLXferProcessor.h" +#include "gl/builders/GrGLFragmentShaderBuilder.h" +#include "gl/builders/GrGLProgramBuilder.h" class GrGLDisableColorXP : public GrGLXferProcessor { public: @@ -15,7 +17,13 @@ public: ~GrGLDisableColorXP() SK_OVERRIDE {} - void emitCode(const EmitArgs& args) SK_OVERRIDE {} + void emitCode(const EmitArgs& args) SK_OVERRIDE { + // This emit code should be empty. However, on the nexus 6 there is a driver bug where if + // you do not give gl_FragColor a value, the gl context is lost and we end up drawing + // nothing. So this fix just sets the gl_FragColor arbitrarily to 0. + GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); + fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary); + } void setData(const GrGLProgramDataManager&, const GrXferProcessor&) SK_OVERRIDE {} -- cgit v1.2.3