title: performance drops when using SKShader
body: <p>I've taken a look at SKShader to get some watery effects in an app where a some sprites are moving around.  Based on this tutorial <a href="http://www.ymc.ch/en/making-a-pixel-shader-for-ios8-with-sprite-kit" rel="nofollow">Making a Pixel Shader for iOS8 with Sprite Kit</a>, I've created an effect but my frame rate drops way down in the simulator and I get memory issues in an iPhone 5s.</p>
  
  <p>My code is shown below
  from GameScene:</p>
  
  <pre><code>override func didMoveToView(view: SKView) {
          super.didMoveToView(view)
  
          // MARK: BACKGROUND IMAGE &amp; SHADER
  
          let backgroundImage = SKSpriteNode(imageNamed: "Background")
          backgroundImage.size.width = frame.size.width
          backgroundImage.size.height = frame.size.height
          backgroundImage.position = CGPointMake(CGRectGetMidX(frame), CGRectGetMidY(frame))
          backgroundImage.zPosition = -1000
          addChild(backgroundImage)
  
          let shaderContainer = SKSpriteNode(color: SKColor(red: 1, green: 1, blue: 1, alpha: 0), size: (CGSizeMake(frame.width, frame.height)))
          shaderContainer.position = CGPointMake(self.frame.size.width/2, self.frame.size.height/2)
          shaderContainer.zPosition = 1000
          addChild(shaderContainer)
  
          let shader = SKShader(fileNamed: "shader_water.fsh")
          shader.uniforms = [
              SKUniform(name: "size", floatVector3:GLKVector3Make(Float(self.frame.size.width), Float(self.frame.size.height), 0)),
          ]
          shaderContainer.shader = shader
  </code></pre>
  
  <p>The .fsh file is taken straight from the tutorial.</p>
  
  <pre><code>void main( void )
  {
      float time = u_time * .5;
      vec2 sp = gl_FragCoord.xy / size.xy;
      vec2 p = sp * 6.0 - 20.0;
      vec2 i = p;
      float c = 1.0;
      float inten = .05;
  
      for (int n = 0; n &lt; 5; n++)
      {
          float t = time * (1.0 - (3.5 / float(n+1)));
          i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(t + i.x));
          c += 1.0/length(vec2(p.x / (sin(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));
      }
  
      c /= float(5);
      c = 1.55-sqrt(c);
      vec3 colour = vec3(pow(abs(c), 15.0));
  
      gl_FragColor = vec4(clamp(colour + vec3(0.0, 0.17, 0.3), 0.0, .5), 0.3);
  }
  </code></pre>
  
  <p>Does anyone know what might be going on and how I can get a shader to work more efficiently?</p>