diff options
author | egdaniel <egdaniel@google.com> | 2014-12-30 09:42:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-30 09:42:49 -0800 |
commit | be9588ade8e3dac0adc8e038c46de006ca21af48 (patch) | |
tree | f3adcb4a929b5bc117f767f21723dc1eef24eca2 /src | |
parent | ee2af95db72152dfa61c841875df0594ca93437d (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/effects/GrDisableColorXP.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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 {} |