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

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

Issue 1275853005: All child GrFragmentProcs' transforms and textures will be stored in the root GrFragmentProc in pre… (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: child procs keep copy of their arrays Created 5 years, 4 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 | « include/gpu/GrPaint.h ('k') | include/gpu/GrStagedProcessor.h » ('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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 * request to access the fragment position will be denied. 111 * request to access the fragment position will be denied.
112 */ 112 */
113 void setWillReadFragmentPosition() { fWillReadFragmentPosition = true; } 113 void setWillReadFragmentPosition() { fWillReadFragmentPosition = true; }
114 114
115 template <typename PROC_SUBCLASS> void initClassID() { 115 template <typename PROC_SUBCLASS> void initClassID() {
116 static uint32_t kClassID = GenClassID(); 116 static uint32_t kClassID = GenClassID();
117 fClassID = kClassID; 117 fClassID = kClassID;
118 } 118 }
119 119
120 uint32_t fClassID; 120 uint32_t fClassID;
121 SkSTArray<4, const GrTextureAccess*, true> fTextureAccesses;
121 122
122 private: 123 private:
123 static uint32_t GenClassID() { 124 static uint32_t GenClassID() {
124 // fCurrProcessorClassID has been initialized to kIllegalProcessorClassI D. The 125 // fCurrProcessorClassID has been initialized to kIllegalProcessorClassI D. The
125 // atomic inc returns the old value not the incremented value. So we add 126 // atomic inc returns the old value not the incremented value. So we add
126 // 1 to the returned value. 127 // 1 to the returned value.
127 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrProcessorClassID )) + 1; 128 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrProcessorClassID )) + 1;
128 if (!id) { 129 if (!id) {
129 SkFAIL("This should never wrap as it should only be called once for each GrProcessor " 130 SkFAIL("This should never wrap as it should only be called once for each GrProcessor "
130 "subclass."); 131 "subclass.");
131 } 132 }
132 return id; 133 return id;
133 } 134 }
134 135
135 enum { 136 enum {
136 kIllegalProcessorClassID = 0, 137 kIllegalProcessorClassID = 0,
137 }; 138 };
138 static int32_t gCurrProcessorClassID; 139 static int32_t gCurrProcessorClassID;
139 140
140 SkSTArray<4, const GrTextureAccess*, true> fTextureAccesses;
141 bool fWillReadFragmentPosition; 141 bool fWillReadFragmentPosition;
142 142
143 typedef GrProgramElement INHERITED; 143 typedef GrProgramElement INHERITED;
144 }; 144 };
145 145
146 /** 146 /**
147 * 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
148 * 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.
149 */ 149 */
150 #define GR_CREATE_STATIC_PROCESSOR(NAME, PROC_CLASS, ARGS) \ 150 #define GR_CREATE_STATIC_PROCESSOR(NAME, PROC_CLASS, ARGS) \
151 static SkAlignedSStorage<sizeof(PROC_CLASS)> g_##NAME##_Storage; \ 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); \ 152 static PROC_CLASS* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), PROC_CLAS S, ARGS); \
153 static SkAutoTDestroy<GrProcessor> NAME##_ad(NAME); 153 static SkAutoTDestroy<GrProcessor> NAME##_ad(NAME);
154 154
155 #endif 155 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrPaint.h ('k') | include/gpu/GrStagedProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698