| 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 |
| 99 /** | 103 /** |
| 100 * Fragment procs with child procs should call these functions before/after
calling emitCode | 104 * Fragment procs with child procs should call these functions before/after
calling emitCode |
| 101 * on a child proc. | 105 * on a child proc. |
| 102 */ | 106 */ |
| 103 virtual void onBeforeChildProcEmitCode() = 0; | 107 virtual void onBeforeChildProcEmitCode() = 0; |
| 104 virtual void onAfterChildProcEmitCode() = 0; | 108 virtual void onAfterChildProcEmitCode() = 0; |
| 105 | 109 |
| 106 virtual const SkString& getMangleString() const = 0; | 110 virtual const SkString& getMangleString() const = 0; |
| 107 }; | 111 }; |
| 108 | 112 |
| (...skipping 50 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 |