title: cicontext drawImage:inRect:fromRect crashes in ios6
body: <p>I'm trying to get an video from camera and render it using CoreImage and OpenGL.
  When I'm running it I see my picture on screen as I expect and then I get EXEC_BAD_ACCESS.
  I'm using ARC. iOS6 Beta1.
  Please help me to fix it.</p>
  
  <p>Update: it works in 5.1 but crashes in 6.0.
  I've raised All Exception Breakpoint but I only see that EXEC_BAD_ACESS happens in presentRendedBuffer > gpus_ReturnGuiltyForHardwareRestart</p>
  
  <p>Update2: I've removed camera-related code and it's still crashes.</p>
  
  <p>Update 3: When I commented out glClearColor &amp; glClear commands my app stopped crashing. But I still want to know how to use OpenGL together with Core Image simultaneously.</p>
  
  <p>my new code as simple as:</p>
  
  <pre><code>@interface MGViewController () {
  ...
  }
  @property (strong, nonatomic) EAGLContext *glcontext;
  @property (strong, nonatomic) CIContext *cicontext;
  @property (strong, nonatomic) CIImage *ciimage;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  
      self.glcontext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
  
      if (!self.glcontext) {
          NSLog(@"Failed to create ES context");
      } else {
          self.cicontext = [CIContext contextWithEAGLContext:self.glcontext];
  
          if (!self.cicontext){
              NSLog(@"Failed to create CI context");
          }
      }
  
      GLKView *view = (GLKView *)self.view;
      view.context = self.glcontext;
      view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
  
      self.ciimage = [[CIImage alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"roomphoto" withExtension:@"png"]];
  }
  
  - (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
  {
  
          glClearColor(0.0, 0.5, 0.0, 1.0);
          glClear(GL_COLOR_BUFFER_BIT);
  
          [self.cicontext drawImage:self.ciimage
                             inRect:self.ciimage.extent
                           fromRect:self.ciimage.extent];
  }
  </code></pre>
  
  <p>This code works on iPhone &amp; iPad 6.0 simulator; crashes with EXEC_BAD_ACCESS on iPad2 iOS 6.0 Beta2; and it gives me just green screen on iPad 1 &amp; iPhone 4S iOS 5.1.1 with messages in the console:</p>
  
  <pre><code>Invalid shader program, probably due to exceeding hardware resourcesCould not load the kernel!Could not load the kernel! ...
  </code></pre>
  
  <p>What can be wrong?</p>