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