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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 /** | 317 /** |
318 * Returns information about the output color, produced by XPs from this fac
tory, that will be | 318 * Returns information about the output color, produced by XPs from this fac
tory, that will be |
319 * known after blending. Note that we can conflate coverage and color, so th
e actual values | 319 * known after blending. Note that we can conflate coverage and color, so th
e actual values |
320 * written to pixels with partial coverage may not always seem consistent wi
th the invariant | 320 * written to pixels with partial coverage may not always seem consistent wi
th the invariant |
321 * information returned by this function. | 321 * information returned by this function. |
322 */ | 322 */ |
323 virtual void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, | 323 virtual void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, |
324 InvariantBlendedColor*) const = 0; | 324 InvariantBlendedColor*) const = 0; |
325 | 325 |
326 bool willNeedDstTexture(const GrCaps& caps, const GrPipelineOptimizations& o
ptimizations, | 326 bool willNeedDstTexture(const GrCaps& caps, const GrPipelineOptimizations& o
ptimizations) const; |
327 bool hasMixedSamples) const; | |
328 | 327 |
329 bool isEqual(const GrXPFactory& that) const { | 328 bool isEqual(const GrXPFactory& that) const { |
330 if (this->classID() != that.classID()) { | 329 if (this->classID() != that.classID()) { |
331 return false; | 330 return false; |
332 } | 331 } |
333 return this->onIsEqual(that); | 332 return this->onIsEqual(that); |
334 } | 333 } |
335 | 334 |
336 /** | 335 /** |
337 * Helper for down-casting to a GrXPFactory subclass | 336 * Helper for down-casting to a GrXPFactory subclass |
(...skipping 13 matching lines...) Expand all Loading... |
351 uint32_t fClassID; | 350 uint32_t fClassID; |
352 | 351 |
353 private: | 352 private: |
354 virtual GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, | 353 virtual GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, |
355 const GrPipelineOptimizations
& optimizations, | 354 const GrPipelineOptimizations
& optimizations, |
356 bool hasMixedSamples, | 355 bool hasMixedSamples, |
357 const DstTexture*) const = 0; | 356 const DstTexture*) const = 0; |
358 | 357 |
359 virtual bool onIsEqual(const GrXPFactory&) const = 0; | 358 virtual bool onIsEqual(const GrXPFactory&) const = 0; |
360 | 359 |
361 bool willReadDstColor(const GrCaps& caps, | 360 bool willReadDstColor(const GrCaps&, const GrPipelineOptimizations&) const; |
362 const GrPipelineOptimizations& optimizations, | |
363 bool hasMixedSamples) const; | |
364 /** | 361 /** |
365 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment | 362 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment |
366 * shader. | 363 * shader. |
367 */ | 364 */ |
368 virtual bool onWillReadDstColor(const GrCaps& caps, | 365 virtual bool onWillReadDstColor(const GrCaps&, const GrPipelineOptimizations
&) const = 0; |
369 const GrPipelineOptimizations& optimizations
, | |
370 bool hasMixedSamples) const = 0; | |
371 | 366 |
372 static uint32_t GenClassID() { | 367 static uint32_t GenClassID() { |
373 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The | 368 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The |
374 // atomic inc returns the old value not the incremented value. So we add | 369 // atomic inc returns the old value not the incremented value. So we add |
375 // 1 to the returned value. | 370 // 1 to the returned value. |
376 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; | 371 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; |
377 if (!id) { | 372 if (!id) { |
378 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " | 373 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " |
379 "subclass."); | 374 "subclass."); |
380 } | 375 } |
381 return id; | 376 return id; |
382 } | 377 } |
383 | 378 |
384 enum { | 379 enum { |
385 kIllegalXPFClassID = 0, | 380 kIllegalXPFClassID = 0, |
386 }; | 381 }; |
387 static int32_t gCurrXPFClassID; | 382 static int32_t gCurrXPFClassID; |
388 | 383 |
389 typedef GrProgramElement INHERITED; | 384 typedef GrProgramElement INHERITED; |
390 }; | 385 }; |
391 | 386 |
392 #endif | 387 #endif |
393 | 388 |
OLD | NEW |