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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 * Subtracts sample coverage from the fragment. Any sample whose correspondi
ng bit is not found | 89 * Subtracts sample coverage from the fragment. Any sample whose correspondi
ng bit is not found |
90 * in the mask will not be written out to the framebuffer. | 90 * in the mask will not be written out to the framebuffer. |
91 * | 91 * |
92 * @param mask int that contains the sample mask. Bit N corresponds to
the Nth sample. | 92 * @param mask int that contains the sample mask. Bit N corresponds to
the Nth sample. |
93 * @param invert perform a bit-wise NOT on the provided mask before apply
ing it? | 93 * @param invert perform a bit-wise NOT on the provided mask before apply
ing it? |
94 * | 94 * |
95 * Requires GLSL support for sample variables. | 95 * Requires GLSL support for sample variables. |
96 */ | 96 */ |
97 virtual void maskSampleCoverage(const char* mask, bool invert = false) = 0; | 97 virtual void maskSampleCoverage(const char* mask, bool invert = false) = 0; |
98 | 98 |
99 /** Returns a variable name that represents a vector to the nearest edge of
the shape, in source | |
100 space coordinates. */ | |
101 virtual const char* distanceVectorName() const = 0; | |
102 | |
103 /** | 99 /** |
104 * Fragment procs with child procs should call these functions before/after
calling emitCode | 100 * Fragment procs with child procs should call these functions before/after
calling emitCode |
105 * on a child proc. | 101 * on a child proc. |
106 */ | 102 */ |
107 virtual void onBeforeChildProcEmitCode() = 0; | 103 virtual void onBeforeChildProcEmitCode() = 0; |
108 virtual void onAfterChildProcEmitCode() = 0; | 104 virtual void onAfterChildProcEmitCode() = 0; |
109 | 105 |
110 virtual const SkString& getMangleString() const = 0; | 106 virtual const SkString& getMangleString() const = 0; |
111 }; | 107 }; |
112 | 108 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 use the fragment position and/or sample locations. */ | 159 use the fragment position and/or sample locations. */ |
164 static uint8_t KeyForSurfaceOrigin(GrSurfaceOrigin); | 160 static uint8_t KeyForSurfaceOrigin(GrSurfaceOrigin); |
165 | 161 |
166 GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program); | 162 GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program); |
167 | 163 |
168 // Shared GrGLSLFragmentBuilder interface. | 164 // Shared GrGLSLFragmentBuilder interface. |
169 bool enableFeature(GLSLFeature) override; | 165 bool enableFeature(GLSLFeature) override; |
170 virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords
, | 166 virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords
, |
171 int index) override; | 167 int index) override; |
172 const char* fragmentPosition() override; | 168 const char* fragmentPosition() override; |
173 const char* distanceVectorName() const override; | |
174 | 169 |
175 // GrGLSLFPFragmentBuilder interface. | 170 // GrGLSLFPFragmentBuilder interface. |
176 void appendOffsetToSample(const char* sampleIdx, Coordinates) override; | 171 void appendOffsetToSample(const char* sampleIdx, Coordinates) override; |
177 void maskSampleCoverage(const char* mask, bool invert = false) override; | 172 void maskSampleCoverage(const char* mask, bool invert = false) override; |
178 void overrideSampleCoverage(const char* mask) override; | 173 void overrideSampleCoverage(const char* mask) override; |
179 const SkString& getMangleString() const override { return fMangleString; } | 174 const SkString& getMangleString() const override { return fMangleString; } |
180 void onBeforeChildProcEmitCode() override; | 175 void onBeforeChildProcEmitCode() override; |
181 void onAfterChildProcEmitCode() override; | 176 void onAfterChildProcEmitCode() override; |
182 | 177 |
183 // GrGLSLXPFragmentBuilder interface. | 178 // GrGLSLXPFragmentBuilder interface. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 * 1st child's 2nd child". | 228 * 1st child's 2nd child". |
234 */ | 229 */ |
235 SkString fMangleString; | 230 SkString fMangleString; |
236 | 231 |
237 bool fSetupFragPosition; | 232 bool fSetupFragPosition; |
238 bool fHasCustomColorOutput; | 233 bool fHasCustomColorOutput; |
239 int fCustomColorOutputIndex; | 234 int fCustomColorOutputIndex; |
240 bool fHasSecondaryOutput; | 235 bool fHasSecondaryOutput; |
241 uint8_t fUsedSampleOffsetArrays; | 236 uint8_t fUsedSampleOffsetArrays; |
242 bool fHasInitializedSampleMask; | 237 bool fHasInitializedSampleMask; |
243 SkString fDistanceVectorOutput; | |
244 | 238 |
245 #ifdef SK_DEBUG | 239 #ifdef SK_DEBUG |
246 // some state to verify shaders and effects are consistent, this is reset be
tween effects by | 240 // some state to verify shaders and effects are consistent, this is reset be
tween effects by |
247 // the program creator | 241 // the program creator |
248 GrProcessor::RequiredFeatures fUsedProcessorFeatures; | 242 GrProcessor::RequiredFeatures fUsedProcessorFeatures; |
249 bool fHasReadDstColor; | 243 bool fHasReadDstColor; |
250 #endif | 244 #endif |
251 | 245 |
252 friend class GrGLSLProgramBuilder; | 246 friend class GrGLSLProgramBuilder; |
253 friend class GrGLProgramBuilder; | 247 friend class GrGLProgramBuilder; |
254 }; | 248 }; |
255 | 249 |
256 #endif | 250 #endif |
OLD | NEW |