I tried to combine a SKEffectNode with a CIFilter and a child SKSpriteNode and while its seems to work for a few moments, the result is that all device memory is consumed and my iPad Retina (A7 GPU) just reboots. I also sometime see "Message from debugger: Terminated due to memory issue" printed to the debugger log. The full source is on github at SKEffectNodeFiltered.
I am creating the filter like so:
// Pixelate CoreImage filter
CIFilter *pixellateFilter = [CIFilter filterWithName:@"CIPixellate"];
[pixellateFilter setDefaults]; // Remember to setDefaults...
[pixellateFilter setValue:@(25.0) forKey:@"inputScale"];
SKEffectNode *effectNode = [[SKEffectNode alloc] init];
effectNode.shouldEnableEffects = TRUE; // enable CoreImage filtering
effectNode.shouldRasterize = FALSE; // generate and then discard tmp framebuffer
effectNode.shouldCenterFilter = TRUE;
effectNode.filter = pixellateFilter;
self.effectNode = effectNode;
[effectNode addChild:background];
[self addChild:effectNode];
effectNode.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
I looked at the allocations tool, I do see a triple buffered set of CoreSurface objects, but there is not an obvious memory leak. The memory usage is quite large at around 140 Megs total, this is large but this is testing the use of a very large input image at 4096x4096 which is the max texture size. What is going on here? If I did not use a filter, then performance is 60 FPS and there is no problem with memory usage.