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 #ifndef GrGLSLFragmentShaderBuilder_DEFINED | 8 #ifndef GrGLSLFragmentShaderBuilder_DEFINED |
9 #define GrGLSLFragmentShaderBuilder_DEFINED | 9 #define GrGLSLFragmentShaderBuilder_DEFINED |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 /* | 61 /* |
62 * This class is used by fragment processors to build their fragment code. | 62 * This class is used by fragment processors to build their fragment code. |
63 */ | 63 */ |
64 class GrGLSLFPFragmentBuilder : virtual public GrGLSLFragmentBuilder { | 64 class GrGLSLFPFragmentBuilder : virtual public GrGLSLFragmentBuilder { |
65 public: | 65 public: |
66 /** Appease the compiler; the derived class initializes GrGLSLFragmentBuilde
r. */ | 66 /** Appease the compiler; the derived class initializes GrGLSLFragmentBuilde
r. */ |
67 GrGLSLFPFragmentBuilder() : GrGLSLFragmentBuilder(nullptr) {} | 67 GrGLSLFPFragmentBuilder() : GrGLSLFragmentBuilder(nullptr) {} |
68 | 68 |
69 /** | 69 /** |
| 70 * Appends the offset, in device space, from the center of the pixel to a sp
ecified sample. |
| 71 * |
| 72 * @param sampleIdx GLSL expression of the sample index. |
| 73 * |
| 74 * Requires a pipeline with sample locations enabled. |
| 75 */ |
| 76 virtual void appendSampleOffset(const char* sampleIdx) = 0; |
| 77 |
| 78 /** |
70 * Subtracts sample coverage from the fragment. Any sample whose correspondi
ng bit is not found | 79 * Subtracts sample coverage from the fragment. Any sample whose correspondi
ng bit is not found |
71 * in the mask will not be written out to the framebuffer. | 80 * in the mask will not be written out to the framebuffer. |
72 * | 81 * |
73 * @param mask int that contains the sample mask. Bit N corresponds to
the Nth sample. | 82 * @param mask int that contains the sample mask. Bit N corresponds to
the Nth sample. |
74 * @param invert perform a bit-wise NOT on the provided mask before apply
ing it? | 83 * @param invert perform a bit-wise NOT on the provided mask before apply
ing it? |
75 * | 84 * |
76 * Requires GLSL support for sample variables. | 85 * Requires GLSL support for sample variables. |
77 */ | 86 */ |
78 virtual void maskSampleCoverage(const char* mask, bool invert = false) = 0; | 87 virtual void maskSampleCoverage(const char* mask, bool invert = false) = 0; |
79 | 88 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 154 |
146 GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program, uint8_t fragPosKe
y); | 155 GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program, uint8_t fragPosKe
y); |
147 | 156 |
148 // Shared GrGLSLFragmentBuilder interface. | 157 // Shared GrGLSLFragmentBuilder interface. |
149 bool enableFeature(GLSLFeature) override; | 158 bool enableFeature(GLSLFeature) override; |
150 virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords
, | 159 virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords
, |
151 int index) override; | 160 int index) override; |
152 const char* fragmentPosition() override; | 161 const char* fragmentPosition() override; |
153 | 162 |
154 // GrGLSLFPFragmentBuilder interface. | 163 // GrGLSLFPFragmentBuilder interface. |
| 164 void appendSampleOffset(const char* sampleIdx) override; |
155 void maskSampleCoverage(const char* mask, bool invert = false) override; | 165 void maskSampleCoverage(const char* mask, bool invert = false) override; |
156 void overrideSampleCoverage(const char* mask) override; | 166 void overrideSampleCoverage(const char* mask) override; |
157 const SkString& getMangleString() const override { return fMangleString; } | 167 const SkString& getMangleString() const override { return fMangleString; } |
158 void onBeforeChildProcEmitCode() override; | 168 void onBeforeChildProcEmitCode() override; |
159 void onAfterChildProcEmitCode() override; | 169 void onAfterChildProcEmitCode() override; |
160 | 170 |
161 // GrGLSLXPFragmentBuilder interface. | 171 // GrGLSLXPFragmentBuilder interface. |
162 bool hasCustomColorOutput() const override { return fHasCustomColorOutput; } | 172 bool hasCustomColorOutput() const override { return fHasCustomColorOutput; } |
163 bool hasSecondaryOutput() const override { return fHasSecondaryOutput; } | 173 bool hasSecondaryOutput() const override { return fHasSecondaryOutput; } |
164 const char* dstColor() override; | 174 const char* dstColor() override; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // some state to verify shaders and effects are consistent, this is reset be
tween effects by | 239 // some state to verify shaders and effects are consistent, this is reset be
tween effects by |
230 // the program creator | 240 // the program creator |
231 bool fHasReadDstColor; | 241 bool fHasReadDstColor; |
232 bool fHasReadFragmentPosition; | 242 bool fHasReadFragmentPosition; |
233 | 243 |
234 friend class GrGLSLProgramBuilder; | 244 friend class GrGLSLProgramBuilder; |
235 friend class GrGLProgramBuilder; | 245 friend class GrGLProgramBuilder; |
236 }; | 246 }; |
237 | 247 |
238 #endif | 248 #endif |
OLD | NEW |