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