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
This commit is contained in:
egdaniel 2014-12-30 09:42:49 -08:00 committed by Commit bot
parent ee2af95db7
commit be9588ade8

View File

@ -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 {}