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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 GrXPFactory() : fClassID(kIllegalXPFClassID) {} | 286 GrXPFactory() : fClassID(kIllegalXPFClassID) {} |
287 | 287 |
288 template <typename XPF_SUBCLASS> void initClassID() { | 288 template <typename XPF_SUBCLASS> void initClassID() { |
289 static uint32_t kClassID = GenClassID(); | 289 static uint32_t kClassID = GenClassID(); |
290 fClassID = kClassID; | 290 fClassID = kClassID; |
291 } | 291 } |
292 | 292 |
293 uint32_t fClassID; | 293 uint32_t fClassID; |
294 | 294 |
295 private: | 295 private: |
296 virtual GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI
, | 296 virtual GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, |
| 297 const GrProcOptInfo& colorPOI
, |
297 const GrProcOptInfo& coverage
POI, | 298 const GrProcOptInfo& coverage
POI, |
298 const GrDeviceCoordTexture* d
stCopy) const = 0; | 299 const GrDeviceCoordTexture* d
stCopy) const = 0; |
299 /** | 300 /** |
300 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment | 301 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment |
301 * shader. | 302 * shader. |
302 */ | 303 */ |
303 virtual bool willReadDstColor(const GrProcOptInfo& colorPOI, | 304 virtual bool willReadDstColor(const GrDrawTargetCaps& caps, |
| 305 const GrProcOptInfo& colorPOI, |
304 const GrProcOptInfo& coveragePOI) const = 0; | 306 const GrProcOptInfo& coveragePOI) const = 0; |
305 | 307 |
306 virtual bool onIsEqual(const GrXPFactory&) const = 0; | 308 virtual bool onIsEqual(const GrXPFactory&) const = 0; |
307 | 309 |
308 static uint32_t GenClassID() { | 310 static uint32_t GenClassID() { |
309 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The | 311 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The |
310 // atomic inc returns the old value not the incremented value. So we add | 312 // atomic inc returns the old value not the incremented value. So we add |
311 // 1 to the returned value. | 313 // 1 to the returned value. |
312 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; | 314 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; |
313 if (!id) { | 315 if (!id) { |
314 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " | 316 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " |
315 "subclass."); | 317 "subclass."); |
316 } | 318 } |
317 return id; | 319 return id; |
318 } | 320 } |
319 | 321 |
320 enum { | 322 enum { |
321 kIllegalXPFClassID = 0, | 323 kIllegalXPFClassID = 0, |
322 }; | 324 }; |
323 static int32_t gCurrXPFClassID; | 325 static int32_t gCurrXPFClassID; |
324 | 326 |
325 typedef GrProgramElement INHERITED; | 327 typedef GrProgramElement INHERITED; |
326 }; | 328 }; |
327 | 329 |
328 #endif | 330 #endif |
329 | 331 |
OLD | NEW |