CVOpenGLESTextureCacheCreateTextureFromImage crashes app when GPU Frame Capture is enabled

Originator:yaron
Number:rdar://22008643 Date Originated:
Status:Open Resolved:
Product:Xcode Product Version:6.4
Classification: Reproducible:
 
Summary:
When running an iOS app on device, CVOpenGLESTextureCacheCreateTextureFromImage crashes in EAGLContext_texImageIOSurface_target_internalFormat_width_height_format_type_plane_invert when GPU Frame Capture is enabled. Disabling the GPU Frame Capture solves the issue.

Running the app with the debugger detached solves the problem. This happens in Xcode 6.4 and above, including Xcode 7 beta 4.

Steps to Reproduce:
1. Create a texture cache.
2. Create a pixel buffer.
3. Create a texture using CVOpenGLESTextureCacheCreateTextureFromImage.
4. Run the code on device while debugger is attached and GPU Frame Capture is enabled.
5. Code will crash in EAGLContext_texImageIOSurface_target_internalFormat_width_height_format_type_plane_invert.

Expected Results:
Code should not crash and behave similarly to the execution without a debugger.

Actual Results:
Code crashes with the following stack trace:
* thread #1: tid = 0x11f2, 0x022870e6 libglInterpose.dylib`EAGLContext_texImageIOSurface_target_internalFormat_width_height_format_type_plane_invert(EAGLContext*, objc_selector*, __IOSurface*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, signed char) + 442, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xeb950e4b)
  * frame #0: 0x022870e6 libglInterpose.dylib`EAGLContext_texImageIOSurface_target_internalFormat_width_height_format_type_plane_invert(EAGLContext*, objc_selector*, __IOSurface*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, signed char) + 442
    frame #1: 0x2870ff66 CoreVideo`CVOpenGLESContext::texImageIOSurface(unsigned int, unsigned int, int, int, unsigned int, unsigned int, __IOSurface*, unsigned int) + 58
    frame #2: 0x287211c8 CoreVideo`CVPixelBufferOpenGLESTextureBacking::createStandardTexture(CVImageBuffer*) + 508
    frame #3: 0x287214aa CoreVideo`CVPixelBufferOpenGLESTextureBacking::initWithPixelBackingContext(CVPixelBufferBacking*, CVOpenGLESContext*, __CFDictionary const*, CVImageBuffer*, int*) + 182
    frame #4: 0x2871eeac CoreVideo`CVPixelBufferBacking::createTextureBackingForContext(__CFAllocator const*, CVOpenGLESContext*, __CFDictionary const*, CVImageBuffer*, int*) + 68
    frame #5: 0x2871ce72 CoreVideo`CVOpenGLESTextureCache::createTextureBackingFromImageBacking(__CFAllocator const*, CVImageBacking*, CVImageBuffer*, __CFDictionary const*, int*) + 362
    frame #6: 0x2871cc7c CoreVideo`CVOpenGLESTextureCache::createTextureFromImageWithParams(__CFAllocator const*, CVImageBuffer*, unsigned int, int, int, int, unsigned int, unsigned int, unsigned long, int*) + 232
    frame #7: 0x2871b220 CoreVideo`CVOpenGLESTextureCacheCreateTextureFromImage + 132

Version:
Xcode 6.4, Xcode 7 beta 4.

Notes:


Configuration:
Reproduces on Xcode 6.4, Xcode 7 beta 4 on OSX Yosemite 10.10.4. Devices included iPad 3 (iOS 8.3), iPhone 6 and 6 Plus (iOS 8.4)

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!