CALayer doesn't draw in OpenGL 3.2 or OpenGL 4.1

Originator:wil.shipley
Number:rdar://22277918 Date Originated:August 13, 2015
Status:Open Resolved:
Product:OS X Product Version:all
Classification:crasher / data loss Reproducible:always
 
This bug affects SceneKit and SpriteKit.

For example, if I create an SCNView with 

         let sceneKitView = SCNView(frame: CGRect.zeroRect, options: [SCNPreferredRenderingAPIKey : SCNRenderingAPI.OpenGLCore32.rawValue])

And then I set the contents of one of its objects to be a test CALayer, like so:

        let floor = SCNPlane(width: 10, height: 10)
        let layer = CALayer()
        layer.bounds = CGRect(x: 0, y: 0, width: 10, height: 10)
        layer.backgroundColor = NSColor.yellowColor().CGColor
        floor.firstMaterial?.diffuse.contents = layer

Then CoreAnimation reports the following:

> CoreAnimation: unsupported graphics hardware; need three or more texture units; need ARB_texture_rectangle extension; need EXT_framebuffer_object extension; need ARB shader extensions
> CoreAnimation: rendering error 500

This is nuts because of course OpenGL 3.2+ supports rectangular textures and and frame buffers and shaders. It appears that someone is just making a simple existence call and testing only the for the ancient ARB_texture_rectangle (which is from 2005!) and ignoring that rectangular textures are built into every machine going back to 10.7.5.

Check this page, for instance: https://developer.apple.com/opengl/capabilities/GLInfo_1075_Core.html

While I appreciate that Metal is coming and that CoreImage and CoreAnimation will work with Metal buffers, it's not clear that all machines running Yosemite will be able to run Metal. So, we'll end up with a HUGE gap in capabilities, where some machines run Metal and can use CoreAnimation and CoreImage with SceneKit and SpriteKit, and older machines will be stuck on OpenGL 3.2 and cannot.

This makes programmers' jobs a nightmare. It's bad enough to have to support both OpenGL and Metal, but having to write workarounds to get CoreAnimation and CoreImage working as well is crazy (and will be very slow, on machines that are already slow).

I'd like to point out OpenGL 3.2 was released in 2009, so this bug has existed for 6 years now. It's much worse for us now than it was then, since back then we didn't have SceneKit and SpriteKit, which integrate so nicely (sort of!) with CoreAnimation and CoreImage.

Steps to Reproduce:
1. Create a OpenGL 3.2 or OpenGl 4.1 SCNView.
2. Add an object with a valid, drawing CALayer as its material contents.


Expected Results:
Should work!

Actual Results:
CoreAnimation: unsupported graphics hardware; need three or more texture units; need ARB_texture_rectangle extension; need EXT_framebuffer_object extension; need ARB shader extensions
CoreAnimation: rendering error 500


Version:
[true on ALL OS X versions]
OS X 10.11 Beta (15A244d)

Notes:


Configuration:
MacBook Pro (13-inch, Early 2015)
3.1 GHz Intel Core i7
16 GB 1867 MHz DDR3
Intel Iris Graphics 6100 1536 MB

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!