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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 GrXPFactory() : fClassID(kIllegalXPFClassID) {} | 254 GrXPFactory() : fClassID(kIllegalXPFClassID) {} |
255 | 255 |
256 template <typename XPF_SUBCLASS> void initClassID() { | 256 template <typename XPF_SUBCLASS> void initClassID() { |
257 static uint32_t kClassID = GenClassID(); | 257 static uint32_t kClassID = GenClassID(); |
258 fClassID = kClassID; | 258 fClassID = kClassID; |
259 } | 259 } |
260 | 260 |
261 uint32_t fClassID; | 261 uint32_t fClassID; |
262 | 262 |
263 private: | 263 private: |
264 virtual GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI
, | 264 virtual GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, |
| 265 const GrProcOptInfo& colorPOI
, |
265 const GrProcOptInfo& coverage
POI, | 266 const GrProcOptInfo& coverage
POI, |
266 const GrDeviceCoordTexture* d
stCopy) const = 0; | 267 const GrDeviceCoordTexture* d
stCopy) const = 0; |
267 /** | 268 /** |
268 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment | 269 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment |
269 * shader. | 270 * shader. |
270 */ | 271 */ |
271 virtual bool willReadDstColor(const GrProcOptInfo& colorPOI, | 272 virtual bool willReadDstColor(const GrDrawTargetCaps& caps, |
| 273 const GrProcOptInfo& colorPOI, |
272 const GrProcOptInfo& coveragePOI) const = 0; | 274 const GrProcOptInfo& coveragePOI) const = 0; |
273 | 275 |
274 virtual bool onIsEqual(const GrXPFactory&) const = 0; | 276 virtual bool onIsEqual(const GrXPFactory&) const = 0; |
275 | 277 |
276 static uint32_t GenClassID() { | 278 static uint32_t GenClassID() { |
277 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The | 279 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The |
278 // atomic inc returns the old value not the incremented value. So we add | 280 // atomic inc returns the old value not the incremented value. So we add |
279 // 1 to the returned value. | 281 // 1 to the returned value. |
280 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; | 282 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; |
281 if (!id) { | 283 if (!id) { |
282 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " | 284 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " |
283 "subclass."); | 285 "subclass."); |
284 } | 286 } |
285 return id; | 287 return id; |
286 } | 288 } |
287 | 289 |
288 enum { | 290 enum { |
289 kIllegalXPFClassID = 0, | 291 kIllegalXPFClassID = 0, |
290 }; | 292 }; |
291 static int32_t gCurrXPFClassID; | 293 static int32_t gCurrXPFClassID; |
292 | 294 |
293 typedef GrProgramElement INHERITED; | 295 typedef GrProgramElement INHERITED; |
294 }; | 296 }; |
295 | 297 |
296 #endif | 298 #endif |
297 | 299 |
OLD | NEW |