| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "effects/GrDisableColorXP.h" | 8 #include "effects/GrDisableColorXP.h" |
| 9 #include "GrProcessor.h" | 9 #include "GrProcessor.h" |
| 10 #include "gl/GrGLXferProcessor.h" | 10 #include "gl/GrGLXferProcessor.h" |
| 11 #include "gl/builders/GrGLFragmentShaderBuilder.h" |
| 12 #include "gl/builders/GrGLProgramBuilder.h" |
| 11 | 13 |
| 12 class GrGLDisableColorXP : public GrGLXferProcessor { | 14 class GrGLDisableColorXP : public GrGLXferProcessor { |
| 13 public: | 15 public: |
| 14 GrGLDisableColorXP(const GrProcessor&) {} | 16 GrGLDisableColorXP(const GrProcessor&) {} |
| 15 | 17 |
| 16 ~GrGLDisableColorXP() SK_OVERRIDE {} | 18 ~GrGLDisableColorXP() SK_OVERRIDE {} |
| 17 | 19 |
| 18 void emitCode(const EmitArgs& args) SK_OVERRIDE {} | 20 void emitCode(const EmitArgs& args) SK_OVERRIDE { |
| 21 // This emit code should be empty. However, on the nexus 6 there is a dr
iver bug where if |
| 22 // you do not give gl_FragColor a value, the gl context is lost and we e
nd up drawing |
| 23 // nothing. So this fix just sets the gl_FragColor arbitrarily to 0. |
| 24 GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); |
| 25 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary); |
| 26 } |
| 19 | 27 |
| 20 void setData(const GrGLProgramDataManager&, const GrXferProcessor&) SK_OVERR
IDE {} | 28 void setData(const GrGLProgramDataManager&, const GrXferProcessor&) SK_OVERR
IDE {} |
| 21 | 29 |
| 22 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde
r*) {} | 30 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde
r*) {} |
| 23 | 31 |
| 24 private: | 32 private: |
| 25 typedef GrGLXferProcessor INHERITED; | 33 typedef GrGLXferProcessor INHERITED; |
| 26 }; | 34 }; |
| 27 | 35 |
| 28 /////////////////////////////////////////////////////////////////////////////// | 36 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 27 matching lines...) Expand all Loading... |
| 56 | 64 |
| 57 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); | 65 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); |
| 58 | 66 |
| 59 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, | 67 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, |
| 60 GrContext*, | 68 GrContext*, |
| 61 const GrDrawTargetCaps&, | 69 const GrDrawTargetCaps&, |
| 62 GrTexture*[]) { | 70 GrTexture*[]) { |
| 63 return GrDisableColorXPFactory::Create(); | 71 return GrDisableColorXPFactory::Create(); |
| 64 } | 72 } |
| 65 | 73 |
| OLD | NEW |