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