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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 * the fragment shader. If the coordinates at index are 3-dimensional, it im mediately emits a | 46 * the fragment shader. If the coordinates at index are 3-dimensional, it im mediately emits a |
47 * perspective divide into the fragment shader (xy / z) to convert them to 2 D. | 47 * perspective divide into the fragment shader (xy / z) to convert them to 2 D. |
48 */ | 48 */ |
49 virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords , int index) = 0; | 49 virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords , int index) = 0; |
50 | 50 |
51 | 51 |
52 /** Returns a variable name that represents the position of the fragment in the FS. The position | 52 /** Returns a variable name that represents the position of the fragment in the FS. The position |
53 is in device space (e.g. 0,0 is the top left and pixel centers are at ha lf-integers). */ | 53 is in device space (e.g. 0,0 is the top left and pixel centers are at ha lf-integers). */ |
54 virtual const char* fragmentPosition() = 0; | 54 virtual const char* fragmentPosition() = 0; |
55 | 55 |
56 /** Returns a variable name that represents a vector to the nearest edge of the shape, in source | |
57 space coordinates. */ | |
58 virtual const char* distanceVectorName() const = 0; | |
egdaniel
2016/07/14 02:47:47
I think we can drop this down one level to grglslf
dvonbeck
2016/07/14 13:40:34
Done.
| |
59 | |
56 // TODO: remove this method. | 60 // TODO: remove this method. |
57 void declAppendf(const char* fmt, ...); | 61 void declAppendf(const char* fmt, ...); |
58 | 62 |
59 private: | 63 private: |
60 typedef GrGLSLShaderBuilder INHERITED; | 64 typedef GrGLSLShaderBuilder INHERITED; |
61 }; | 65 }; |
62 | 66 |
63 /* | 67 /* |
64 * This class is used by fragment processors to build their fragment code. | 68 * This class is used by fragment processors to build their fragment code. |
65 */ | 69 */ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 use the fragment position and/or sample locations. */ | 163 use the fragment position and/or sample locations. */ |
160 static uint8_t KeyForSurfaceOrigin(GrSurfaceOrigin); | 164 static uint8_t KeyForSurfaceOrigin(GrSurfaceOrigin); |
161 | 165 |
162 GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program); | 166 GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program); |
163 | 167 |
164 // Shared GrGLSLFragmentBuilder interface. | 168 // Shared GrGLSLFragmentBuilder interface. |
165 bool enableFeature(GLSLFeature) override; | 169 bool enableFeature(GLSLFeature) override; |
166 virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords , | 170 virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords , |
167 int index) override; | 171 int index) override; |
168 const char* fragmentPosition() override; | 172 const char* fragmentPosition() override; |
173 const char* distanceVectorName() const override; | |
169 | 174 |
170 // GrGLSLFPFragmentBuilder interface. | 175 // GrGLSLFPFragmentBuilder interface. |
171 void appendOffsetToSample(const char* sampleIdx, Coordinates) override; | 176 void appendOffsetToSample(const char* sampleIdx, Coordinates) override; |
172 void maskSampleCoverage(const char* mask, bool invert = false) override; | 177 void maskSampleCoverage(const char* mask, bool invert = false) override; |
173 void overrideSampleCoverage(const char* mask) override; | 178 void overrideSampleCoverage(const char* mask) override; |
174 const SkString& getMangleString() const override { return fMangleString; } | 179 const SkString& getMangleString() const override { return fMangleString; } |
175 void onBeforeChildProcEmitCode() override; | 180 void onBeforeChildProcEmitCode() override; |
176 void onAfterChildProcEmitCode() override; | 181 void onAfterChildProcEmitCode() override; |
177 | 182 |
178 // GrGLSLXPFragmentBuilder interface. | 183 // GrGLSLXPFragmentBuilder interface. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 * 1st child's 2nd child". | 233 * 1st child's 2nd child". |
229 */ | 234 */ |
230 SkString fMangleString; | 235 SkString fMangleString; |
231 | 236 |
232 bool fSetupFragPosition; | 237 bool fSetupFragPosition; |
233 bool fHasCustomColorOutput; | 238 bool fHasCustomColorOutput; |
234 int fCustomColorOutputIndex; | 239 int fCustomColorOutputIndex; |
235 bool fHasSecondaryOutput; | 240 bool fHasSecondaryOutput; |
236 uint8_t fUsedSampleOffsetArrays; | 241 uint8_t fUsedSampleOffsetArrays; |
237 bool fHasInitializedSampleMask; | 242 bool fHasInitializedSampleMask; |
243 SkString fDistanceVectorOutput; | |
238 | 244 |
239 #ifdef SK_DEBUG | 245 #ifdef SK_DEBUG |
240 // some state to verify shaders and effects are consistent, this is reset be tween effects by | 246 // some state to verify shaders and effects are consistent, this is reset be tween effects by |
241 // the program creator | 247 // the program creator |
242 GrProcessor::RequiredFeatures fUsedProcessorFeatures; | 248 GrProcessor::RequiredFeatures fUsedProcessorFeatures; |
243 bool fHasReadDstColor; | 249 bool fHasReadDstColor; |
244 #endif | 250 #endif |
245 | 251 |
246 friend class GrGLSLProgramBuilder; | 252 friend class GrGLSLProgramBuilder; |
247 friend class GrGLProgramBuilder; | 253 friend class GrGLProgramBuilder; |
248 }; | 254 }; |
249 | 255 |
250 #endif | 256 #endif |
OLD | NEW |