Skip to content

Commit 7e55028

Browse files
author
Thayer J Andrews
committed
CCEffectRenderer - Move pushGroup/popGroup into debug-only macros
They're only used in this context for debugging (by identifying which GL commands are connected to which effect passes) and they have a non-negligible impact on performance so I'm making them optional and disabled by default.
1 parent 8356941 commit 7e55028

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cocos2d/CCEffectRenderer.m

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@
1919

2020
#if CC_ENABLE_EXPERIMENTAL_EFFECTS
2121

22+
#define CCEFFECT_DEBUG_PASSES 0
23+
#if CCEFFECT_DEBUG_PASSES
24+
#define CCEFFECT_DEBUG_PUSH_GROUP(R) [(R) pushGroup]
25+
#define CCEFFECT_DEBUG_POP_GROUP(R, L) [(R) popGroupWithDebugLabel:(L) globalSortOrder:0]
26+
#else
27+
#define CCEFFECT_DEBUG_PUSH_GROUP(R)
28+
#define CCEFFECT_DEBUG_POP_GROUP(R, L)
29+
#endif
30+
31+
2232
@interface CCEffectRenderTarget : NSObject
2333

2434
@property (nonatomic, readonly) CCTexture *texture;
@@ -177,7 +187,7 @@ -(void)drawSprite:(CCSprite *)sprite withEffect:(CCEffect *)effect uniforms:(NSM
177187

178188
CCEffectRenderTarget *rt = nil;
179189

180-
[renderer pushGroup];
190+
CCEFFECT_DEBUG_PUSH_GROUP(renderer);
181191
if (directRendering)
182192
{
183193
renderPass.transform = *transform;
@@ -199,7 +209,7 @@ -(void)drawSprite:(CCSprite *)sprite withEffect:(CCEffect *)effect uniforms:(NSM
199209
[self restoreRenderTargetWithRenderer:renderer];
200210
[renderPass end];
201211
}
202-
[renderer popGroupWithDebugLabel:renderPass.debugLabel globalSortOrder:0];
212+
CCEFFECT_DEBUG_POP_GROUP(renderer, renderPass.debugLabel);
203213

204214
previousPassRT = rt;
205215
}

0 commit comments

Comments
 (0)