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" | 11 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
12 #include "gl/builders/GrGLProgramBuilder.h" | 12 #include "glsl/GrGLSLProgramBuilder.h" |
13 #include "glsl/GrGLSLProgramDataManager.h" | 13 #include "glsl/GrGLSLProgramDataManager.h" |
14 | 14 |
15 /** | 15 /** |
16 * This xfer processor disables color writing. Thus color and coverage and ignor
ed and no blending | 16 * This xfer processor disables color writing. Thus color and coverage and ignor
ed and no blending |
17 * occurs. This XP is usful for things like stenciling. | 17 * occurs. This XP is usful for things like stenciling. |
18 */ | 18 */ |
19 class DisableColorXP : public GrXferProcessor { | 19 class DisableColorXP : public GrXferProcessor { |
20 public: | 20 public: |
21 static GrXferProcessor* Create() { return new DisableColorXP; } | 21 static GrXferProcessor* Create() { return new DisableColorXP; } |
22 | 22 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 ~GLDisableColorXP() override {} | 57 ~GLDisableColorXP() override {} |
58 | 58 |
59 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil
der*) {} | 59 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil
der*) {} |
60 | 60 |
61 private: | 61 private: |
62 void emitOutputsForBlendState(const EmitArgs& args) override { | 62 void emitOutputsForBlendState(const EmitArgs& args) override { |
63 // This emit code should be empty. However, on the nexus 6 there is a dr
iver bug where if | 63 // This emit code should be empty. However, on the nexus 6 there is a dr
iver bug where if |
64 // you do not give gl_FragColor a value, the gl context is lost and we e
nd up drawing | 64 // you do not give gl_FragColor a value, the gl context is lost and we e
nd up drawing |
65 // nothing. So this fix just sets the gl_FragColor arbitrarily to 0. | 65 // nothing. So this fix just sets the gl_FragColor arbitrarily to 0. |
66 GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); | 66 GrGLSLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(
); |
67 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary); | 67 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary); |
68 } | 68 } |
69 | 69 |
70 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over
ride {} | 70 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over
ride {} |
71 | 71 |
72 typedef GrGLXferProcessor INHERITED; | 72 typedef GrGLXferProcessor INHERITED; |
73 }; | 73 }; |
74 | 74 |
75 /////////////////////////////////////////////////////////////////////////////// | 75 /////////////////////////////////////////////////////////////////////////////// |
76 | 76 |
(...skipping 25 matching lines...) Expand all Loading... |
102 const DstTexture* dst) const { | 102 const DstTexture* dst) const { |
103 return DisableColorXP::Create(); | 103 return DisableColorXP::Create(); |
104 } | 104 } |
105 | 105 |
106 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); | 106 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); |
107 | 107 |
108 const GrXPFactory* GrDisableColorXPFactory::TestCreate(GrProcessorTestData*) { | 108 const GrXPFactory* GrDisableColorXPFactory::TestCreate(GrProcessorTestData*) { |
109 return GrDisableColorXPFactory::Create(); | 109 return GrDisableColorXPFactory::Create(); |
110 } | 110 } |
111 | 111 |
OLD | NEW |