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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 fClassID = kClassID; | 348 fClassID = kClassID; |
349 } | 349 } |
350 | 350 |
351 uint32_t fClassID; | 351 uint32_t fClassID; |
352 | 352 |
353 private: | 353 private: |
354 virtual GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, | 354 virtual GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, |
355 const GrPipelineOptimizations
& optimizations, | 355 const GrPipelineOptimizations
& optimizations, |
356 bool hasMixedSamples, | 356 bool hasMixedSamples, |
357 const DstTexture*) const = 0; | 357 const DstTexture*) const = 0; |
358 | |
359 virtual bool onIsEqual(const GrXPFactory&) const = 0; | |
360 | |
361 bool willReadDstColor(const GrCaps& caps, | |
362 const GrPipelineOptimizations& optimizations, | |
363 bool hasMixedSamples) const; | |
364 /** | 358 /** |
365 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment | 359 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment |
366 * shader. | 360 * shader. |
367 */ | 361 */ |
368 virtual bool onWillReadDstColor(const GrCaps& caps, | 362 virtual bool willReadDstColor(const GrCaps& caps, |
369 const GrPipelineOptimizations& optimizations
, | 363 const GrPipelineOptimizations& optimizations, |
370 bool hasMixedSamples) const = 0; | 364 bool hasMixedSamples) const = 0; |
| 365 |
| 366 virtual bool onIsEqual(const GrXPFactory&) const = 0; |
371 | 367 |
372 static uint32_t GenClassID() { | 368 static uint32_t GenClassID() { |
373 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The | 369 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The |
374 // atomic inc returns the old value not the incremented value. So we add | 370 // atomic inc returns the old value not the incremented value. So we add |
375 // 1 to the returned value. | 371 // 1 to the returned value. |
376 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; | 372 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; |
377 if (!id) { | 373 if (!id) { |
378 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " | 374 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " |
379 "subclass."); | 375 "subclass."); |
380 } | 376 } |
381 return id; | 377 return id; |
382 } | 378 } |
383 | 379 |
384 enum { | 380 enum { |
385 kIllegalXPFClassID = 0, | 381 kIllegalXPFClassID = 0, |
386 }; | 382 }; |
387 static int32_t gCurrXPFClassID; | 383 static int32_t gCurrXPFClassID; |
388 | 384 |
389 typedef GrProgramElement INHERITED; | 385 typedef GrProgramElement INHERITED; |
390 }; | 386 }; |
391 | 387 |
392 #endif | 388 #endif |
393 | 389 |
OLD | NEW |