2

I have custom NSView class which I am porting from OpenGL to Metal for GPU rendering. A lot of places in the code, earlier we used to call setNeedsDisplayInRect with an invalidated rect on the NSView, which I queried during the call to drawRect for rendering final content to the screen.

For moving to Metal, I have added a CAMetalLayer to my custom NSView class. With the addition of this CAMetalLayer, getRectsBeingDrawn returns NULL.

  1. Are we saying that getRectsBeingDrawn only works for non-layer/non-metal layer backed NSViews?

Moreover, I also see a setNeedsDisplayInRect in CALayer, but I don't see a getter like getRectsBeingDrawn in CALayer.

  1. Should I move to setNeedsDisplayInRect in CALayer for dirty rects in case of layer backed views? But, then again how do I retrieve those dirty rects?
user007
  • 2,156
  • 2
  • 20
  • 35
  • hello, i have the same problem, porting my openGL app to metal and getRectsBeingDrawn returns NULL. https://stackoverflow.com/questions/60057910/why-my-mtkview-is-drawn-like-if-there-is-a-dark-overlay-on-the-top-of-it – zeus Feb 05 '20 at 19:21
  • @loki honestly, I still don't know what is the correct way to do it. – user007 Feb 07 '20 at 10:30

0 Answers0