Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: include/gpu/GrProcessor.h

Issue 1314763009: Remove overly complicated GR_CREATE_STATIC_PROCESSOR macro (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 private: 46 private:
47 SkTArray<uint8_t, true>* fData; // unowned ptr to the larger key. 47 SkTArray<uint8_t, true>* fData; // unowned ptr to the larger key.
48 int fCount; // number of uint32_ts added to fData by the processor. 48 int fCount; // number of uint32_ts added to fData by the processor.
49 }; 49 };
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.
56 static processor use the helper macro GR_CREATE_STATIC_PROCESSOR declared be low.
57 */ 56 */
58 class GrProcessor : public GrProgramElement { 57 class GrProcessor : public GrProgramElement {
59 public: 58 public:
60 virtual ~GrProcessor(); 59 virtual ~GrProcessor();
61 60
62 /** Human-meaningful string to identify this prcoessor; may be embedded 61 /** Human-meaningful string to identify this prcoessor; may be embedded
63 in generated shader code. */ 62 in generated shader code. */
64 virtual const char* name() const = 0; 63 virtual const char* name() const = 0;
65 64
66 int numTextures() const { return fTextureAccesses.count(); } 65 int numTextures() const { return fTextureAccesses.count(); }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 enum { 135 enum {
137 kIllegalProcessorClassID = 0, 136 kIllegalProcessorClassID = 0,
138 }; 137 };
139 static int32_t gCurrProcessorClassID; 138 static int32_t gCurrProcessorClassID;
140 139
141 bool fWillReadFragmentPosition; 140 bool fWillReadFragmentPosition;
142 141
143 typedef GrProgramElement INHERITED; 142 typedef GrProgramElement INHERITED;
144 }; 143 };
145 144
146 /**
147 * This creates a processor outside of the memory pool. The processor's destruct or will be called
148 * at global destruction time. NAME will be the name of the created instance.
149 */
150 #define GR_CREATE_STATIC_PROCESSOR(NAME, PROC_CLASS, ARGS) \
151 static SkAlignedSStorage<sizeof(PROC_CLASS)> g_##NAME##_Storage; \
152 static PROC_CLASS* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), PROC_CLAS S, ARGS); \
153 static SkAutoTDestroy<GrProcessor> NAME##_ad(NAME);
154
155 #endif 145 #endif
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698