CustomMetalView sample uses deprecated functions - update?

The sample code here, has code like:

// Create a display link capable of being used with all active displays
cvReturn = CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);

But that function's doc says it's deprecated and to use NSView/NSWindow/NSScreen displayLink instead. That returns CADisplayLink, not CVDisplayLink.

Also the documentation for that displayLink method is completely empty. I'm not sure if I'm supposed to add it to run loop, or what, after I get it.

It would be nice to get an updated version of this sample project and/or have some documentation in NSView.displayLink

Answered by DTS Engineer in 847462022

All of the new functions suggested in the deprecation message return a CADisplayLink. For information about adding that to the run loop and other details, please see the CADisplayLink documentation here:

Core Animation: CADisplayLink

All of the new functions suggested in the deprecation message return a CADisplayLink. For information about adding that to the run loop and other details, please see the CADisplayLink documentation here:

Core Animation: CADisplayLink

Hello,

Creating a Custom Metal View is indeed an older sample in need of updates. You can request an update using the Feedback Assistant.

Check out Achieving smooth frame rates with a Metal display link for a contemporary approach to building a custom Metal view with CAMetalDisplayLink, a redesigned successor to CADisplayLink and CVDisplayLink.

CustomMetalView sample uses deprecated functions - update?
 
 
Q