| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrProcessor_DEFINED | 8 #ifndef GrProcessor_DEFINED |
| 9 #define GrProcessor_DEFINED | 9 #define GrProcessor_DEFINED |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 /** Provides custom shader code to the Ganesh shading pipeline. GrProcessor obje
cts *must* be | 51 /** Provides custom shader code to the Ganesh shading pipeline. GrProcessor obje
cts *must* be |
| 52 immutable: after being constructed, their fields may not change. | 52 immutable: after being constructed, their fields may not change. |
| 53 | 53 |
| 54 Dynamically allocated GrProcessors are managed by a per-thread memory pool.
The ref count of an | 54 Dynamically allocated GrProcessors are managed by a per-thread memory pool.
The ref count of an |
| 55 processor must reach 0 before the thread terminates and the pool is destroye
d. To create a | 55 processor must reach 0 before the thread terminates and the pool is destroye
d. To create a |
| 56 static processor use the helper macro GR_CREATE_STATIC_PROCESSOR declared be
low. | 56 static processor use the helper macro GR_CREATE_STATIC_PROCESSOR declared be
low. |
| 57 */ | 57 */ |
| 58 class GrProcessor : public GrProgramElement { | 58 class GrProcessor : public GrProgramElement { |
| 59 public: | 59 public: |
| 60 SK_DECLARE_INST_COUNT(GrProcessor) | |
| 61 | |
| 62 virtual ~GrProcessor(); | 60 virtual ~GrProcessor(); |
| 63 | 61 |
| 64 /** Human-meaningful string to identify this prcoessor; may be embedded | 62 /** Human-meaningful string to identify this prcoessor; may be embedded |
| 65 in generated shader code. */ | 63 in generated shader code. */ |
| 66 virtual const char* name() const = 0; | 64 virtual const char* name() const = 0; |
| 67 | 65 |
| 68 int numTextures() const { return fTextureAccesses.count(); } | 66 int numTextures() const { return fTextureAccesses.count(); } |
| 69 | 67 |
| 70 /** Returns the access pattern for the texture at index. index must be valid
according to | 68 /** Returns the access pattern for the texture at index. index must be valid
according to |
| 71 numTextures(). */ | 69 numTextures(). */ |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 /** | 146 /** |
| 149 * This creates a processor outside of the memory pool. The processor's destruct
or will be called | 147 * This creates a processor outside of the memory pool. The processor's destruct
or will be called |
| 150 * at global destruction time. NAME will be the name of the created instance. | 148 * at global destruction time. NAME will be the name of the created instance. |
| 151 */ | 149 */ |
| 152 #define GR_CREATE_STATIC_PROCESSOR(NAME, PROC_CLASS, ARGS)
\ | 150 #define GR_CREATE_STATIC_PROCESSOR(NAME, PROC_CLASS, ARGS)
\ |
| 153 static SkAlignedSStorage<sizeof(PROC_CLASS)> g_##NAME##_Storage;
\ | 151 static SkAlignedSStorage<sizeof(PROC_CLASS)> g_##NAME##_Storage;
\ |
| 154 static PROC_CLASS* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), PROC_CLAS
S, ARGS); \ | 152 static PROC_CLASS* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), PROC_CLAS
S, ARGS); \ |
| 155 static SkAutoTDestroy<GrProcessor> NAME##_ad(NAME); | 153 static SkAutoTDestroy<GrProcessor> NAME##_ad(NAME); |
| 156 | 154 |
| 157 #endif | 155 #endif |
| OLD | NEW |