| 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 GrXferProcessor_DEFINED | 8 #ifndef GrXferProcessor_DEFINED | 
| 9 #define GrXferProcessor_DEFINED | 9 #define GrXferProcessor_DEFINED | 
| 10 | 10 | 
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 138      * the draw with this xfer processor. If this function is called, the xfer p
     rocessor may change | 138      * the draw with this xfer processor. If this function is called, the xfer p
     rocessor may change | 
| 139      * its state to reflected the given blend optimizations. If the XP needs to 
     see a specific input | 139      * its state to reflected the given blend optimizations. If the XP needs to 
     see a specific input | 
| 140      * color to blend correctly, it will set the OverrideColor flag and the outp
     ut parameter | 140      * color to blend correctly, it will set the OverrideColor flag and the outp
     ut parameter | 
| 141      * overrideColor will be the required value that should be passed into the X
     P. | 141      * overrideColor will be the required value that should be passed into the X
     P. | 
| 142      * A caller who calls this function on a XP is required to honor the returne
     d OptFlags | 142      * A caller who calls this function on a XP is required to honor the returne
     d OptFlags | 
| 143      * and color values for its draw. | 143      * and color values for its draw. | 
| 144      */ | 144      */ | 
| 145     OptFlags getOptimizations(const GrPipelineOptimizations& optimizations, | 145     OptFlags getOptimizations(const GrPipelineOptimizations& optimizations, | 
| 146                               bool doesStencilWrite, | 146                               bool doesStencilWrite, | 
| 147                               GrColor* overrideColor, | 147                               GrColor* overrideColor, | 
| 148                               const GrCaps& caps); | 148                               const GrCaps& caps) const; | 
| 149 | 149 | 
| 150     /** | 150     /** | 
| 151      * Returns whether this XP will require an Xfer barrier on the given rt. If 
     true, outBarrierType | 151      * Returns whether this XP will require an Xfer barrier on the given rt. If 
     true, outBarrierType | 
| 152      * is updated to contain the type of barrier needed. | 152      * is updated to contain the type of barrier needed. | 
| 153      */ | 153      */ | 
| 154     GrXferBarrierType xferBarrierType(const GrRenderTarget* rt, const GrCaps& ca
     ps) const; | 154     GrXferBarrierType xferBarrierType(const GrRenderTarget* rt, const GrCaps& ca
     ps) const; | 
| 155 | 155 | 
| 156     struct BlendInfo { | 156     struct BlendInfo { | 
| 157         void reset() { | 157         void reset() { | 
| 158             fEquation = kAdd_GrBlendEquation; | 158             fEquation = kAdd_GrBlendEquation; | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 192     } | 192     } | 
| 193 | 193 | 
| 194     /** | 194     /** | 
| 195      * If we are performing a dst read, returns whether the base class will use 
     mixed samples to | 195      * If we are performing a dst read, returns whether the base class will use 
     mixed samples to | 
| 196      * antialias the shader's final output. If not doing a dst read, the subclas
     s is responsible | 196      * antialias the shader's final output. If not doing a dst read, the subclas
     s is responsible | 
| 197      * for antialiasing and this returns false. | 197      * for antialiasing and this returns false. | 
| 198      */ | 198      */ | 
| 199     bool dstReadUsesMixedSamples() const { return fDstReadUsesMixedSamples; } | 199     bool dstReadUsesMixedSamples() const { return fDstReadUsesMixedSamples; } | 
| 200 | 200 | 
| 201     /** | 201     /** | 
| 202      * Returns whether or not the XP will look at coverage when doing its blendi
     ng. |  | 
| 203      */ |  | 
| 204     bool readsCoverage() const { return fReadsCoverage; } |  | 
| 205 |  | 
| 206     /** |  | 
| 207      * Returns whether or not this xferProcossor will set a secondary output to 
     be used with dual | 202      * Returns whether or not this xferProcossor will set a secondary output to 
     be used with dual | 
| 208      * source blending. | 203      * source blending. | 
| 209      */ | 204      */ | 
| 210     bool hasSecondaryOutput() const; | 205     bool hasSecondaryOutput() const; | 
| 211 | 206 | 
| 212     /** Returns true if this and other processor conservatively draw identically
     . It can only return | 207     /** Returns true if this and other processor conservatively draw identically
     . It can only return | 
| 213         true when the two processor are of the same subclass (i.e. they return t
     he same object from | 208         true when the two processor are of the same subclass (i.e. they return t
     he same object from | 
| 214         from getFactory()). | 209         from getFactory()). | 
| 215 | 210 | 
| 216         A return value of true from isEqual() should not be used to test whether
      the processor would | 211         A return value of true from isEqual() should not be used to test whether
      the processor would | 
| 217         generate the same shader code. To test for identical code generation use
      getGLSLProcessorKey | 212         generate the same shader code. To test for identical code generation use
      getGLSLProcessorKey | 
| 218       */ | 213       */ | 
| 219 | 214 | 
| 220     bool isEqual(const GrXferProcessor& that) const { | 215     bool isEqual(const GrXferProcessor& that) const { | 
| 221         if (this->classID() != that.classID()) { | 216         if (this->classID() != that.classID()) { | 
| 222             return false; | 217             return false; | 
| 223         } | 218         } | 
| 224         if (this->fWillReadDstColor != that.fWillReadDstColor) { | 219         if (this->fWillReadDstColor != that.fWillReadDstColor) { | 
| 225             return false; | 220             return false; | 
| 226         } | 221         } | 
| 227         if (this->fReadsCoverage != that.fReadsCoverage) { |  | 
| 228             return false; |  | 
| 229         } |  | 
| 230         if (this->fDstTexture.getTexture() != that.fDstTexture.getTexture()) { | 222         if (this->fDstTexture.getTexture() != that.fDstTexture.getTexture()) { | 
| 231             return false; | 223             return false; | 
| 232         } | 224         } | 
| 233         if (this->fDstTextureOffset != that.fDstTextureOffset) { | 225         if (this->fDstTextureOffset != that.fDstTextureOffset) { | 
| 234             return false; | 226             return false; | 
| 235         } | 227         } | 
| 236         if (this->fDstReadUsesMixedSamples != that.fDstReadUsesMixedSamples) { | 228         if (this->fDstReadUsesMixedSamples != that.fDstReadUsesMixedSamples) { | 
| 237             return false; | 229             return false; | 
| 238         } | 230         } | 
| 239         return this->onIsEqual(that); | 231         return this->onIsEqual(that); | 
| 240     } | 232     } | 
| 241 | 233 | 
| 242 protected: | 234 protected: | 
| 243     GrXferProcessor(); | 235     GrXferProcessor(); | 
| 244     GrXferProcessor(const DstTexture*, bool willReadDstColor, bool hasMixedSampl
     es); | 236     GrXferProcessor(const DstTexture*, bool willReadDstColor, bool hasMixedSampl
     es); | 
| 245 | 237 | 
| 246 private: | 238 private: | 
| 247     void notifyRefCntIsZero() const final {} | 239     void notifyRefCntIsZero() const final {} | 
| 248 | 240 | 
| 249     virtual OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizat
     ions, | 241     virtual OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizat
     ions, | 
| 250                                         bool doesStencilWrite, | 242                                         bool doesStencilWrite, | 
| 251                                         GrColor* overrideColor, | 243                                         GrColor* overrideColor, | 
| 252                                         const GrCaps& caps) = 0; | 244                                         const GrCaps& caps) const = 0; | 
| 253 | 245 | 
| 254     /** | 246     /** | 
| 255      * Sets a unique key on the GrProcessorKeyBuilder that is directly associate
     d with this xfer | 247      * Sets a unique key on the GrProcessorKeyBuilder that is directly associate
     d with this xfer | 
| 256      * processor's GL backend implementation. | 248      * processor's GL backend implementation. | 
| 257      */ | 249      */ | 
| 258     virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, | 250     virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, | 
| 259                                        GrProcessorKeyBuilder* b) const = 0; | 251                                        GrProcessorKeyBuilder* b) const = 0; | 
| 260 | 252 | 
| 261     /** | 253     /** | 
| 262      * Determines the type of barrier (if any) required by the subclass. Note th
     at the possibility | 254      * Determines the type of barrier (if any) required by the subclass. Note th
     at the possibility | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 278      * If we are not performing a dst read, retrieves the fixed-function blend s
     tate required by the | 270      * If we are not performing a dst read, retrieves the fixed-function blend s
     tate required by the | 
| 279      * subclass. When using dst reads, the base class controls the fixed-functio
     n blend state and | 271      * subclass. When using dst reads, the base class controls the fixed-functio
     n blend state and | 
| 280      * this method will not be called. The BlendInfo struct comes initialized to
      "no blending". | 272      * this method will not be called. The BlendInfo struct comes initialized to
      "no blending". | 
| 281      */ | 273      */ | 
| 282     virtual void onGetBlendInfo(BlendInfo*) const {} | 274     virtual void onGetBlendInfo(BlendInfo*) const {} | 
| 283 | 275 | 
| 284     virtual bool onIsEqual(const GrXferProcessor&) const = 0; | 276     virtual bool onIsEqual(const GrXferProcessor&) const = 0; | 
| 285 | 277 | 
| 286     bool                    fWillReadDstColor; | 278     bool                    fWillReadDstColor; | 
| 287     bool                    fDstReadUsesMixedSamples; | 279     bool                    fDstReadUsesMixedSamples; | 
| 288     bool                    fReadsCoverage; |  | 
| 289     SkIPoint                fDstTextureOffset; | 280     SkIPoint                fDstTextureOffset; | 
| 290     GrTextureAccess         fDstTexture; | 281     GrTextureAccess         fDstTexture; | 
| 291 | 282 | 
| 292     typedef GrFragmentProcessor INHERITED; | 283     typedef GrFragmentProcessor INHERITED; | 
| 293 }; | 284 }; | 
| 294 | 285 | 
| 295 GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags); | 286 GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags); | 
| 296 | 287 | 
| 297 /////////////////////////////////////////////////////////////////////////////// | 288 /////////////////////////////////////////////////////////////////////////////// | 
| 298 | 289 | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 389     enum { | 380     enum { | 
| 390         kIllegalXPFClassID = 0, | 381         kIllegalXPFClassID = 0, | 
| 391     }; | 382     }; | 
| 392     static int32_t gCurrXPFClassID; | 383     static int32_t gCurrXPFClassID; | 
| 393 | 384 | 
| 394     typedef GrProgramElement INHERITED; | 385     typedef GrProgramElement INHERITED; | 
| 395 }; | 386 }; | 
| 396 | 387 | 
| 397 #endif | 388 #endif | 
| 398 | 389 | 
| OLD | NEW | 
|---|