• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Threaded drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threaded drawing


  • Subject: Re: Threaded drawing
  • From: David Duncan <email@hidden>
  • Date: Mon, 09 Dec 2013 08:45:16 -0800

On Dec 9, 2013, at 8:36 AM, Jens Alfke <email@hidden> wrote:

>
> On Dec 9, 2013, at 7:47 AM, Graham Cox <email@hidden> wrote:
>
>> This last step is where it all falls down, because this one call, to CGContextDrawImage, takes a whopping 67% of the overall time for drawRect: to run, and normal drawing doesn’t need this call (this is testing in a ‘light’ view, but nevertheless, it makes the view very noticeably laggy).
>
> A few months ago I saw a great presentation given by Apple engineer Andy Matuschak about the way rendering works on iOS, the whole pipeline all the way from the app’s API calls to the pixels appearing onscreen. Its purpose was to teach some intuition about what rendering techniques will perform better than others. [This specific talk doesn’t seem to be online, but he has a WWDC talk* that I think covers similar topics.]
>
> The big picture is that the actual rendering pipeline is
> 	[your app] —> [graphics server process] —> [OpenGL] —> [GPU] —> [Screen]
> and the earlier the graphics calls get converted into pixels, the less efficient the drawing will be, because it’s more expensive to push pixmaps through the pipeline than lists of drawing commands.
>
> So if you can avoid it, you shouldn’t be doing your own rendering into images. I haven’t been following the details of this thread, but my guess is you’ll get better performance by drawing the tiles directly to the view, just setting a clipping rect beforehand so the drawing is limited to the tile your thread is working on.

One major impediment to this is that you cannot use the same graphics context between multiple threads, and as such using the graphics context that AppKit gives you forces you into a single threaded model.

If you have a buffer to draw into, then you can easily slice that buffer to use between multiple graphics contexts, but you will fundamentally have to draw them all into the source context at the end.

>
> —Jens
>
> * “Understanding UIKit Rendering”: https://developer.apple.com/itunes/?destination=adc.apple.com.8270634034.08270634040.8367260927?i=1122536585
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

--
David Duncan


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Threaded drawing
      • From: Jens Alfke <email@hidden>
    • Re: Threaded drawing
      • From: Graham Cox <email@hidden>
References: 
 >Threaded drawing (From: Graham Cox <email@hidden>)
 >Re: Threaded drawing (From: Graham Cox <email@hidden>)
 >Re: Threaded drawing (From: Roland King <email@hidden>)
 >Re: Threaded drawing (From: Graham Cox <email@hidden>)
 >Re: Threaded drawing (From: Roland King <email@hidden>)
 >Re: Threaded drawing (From: Graham Cox <email@hidden>)
 >Re: Threaded drawing (From: Graham Cox <email@hidden>)
 >Re: Threaded drawing (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Threaded drawing
  • Next by Date: Re: Threaded drawing
  • Previous by thread: Re: Threaded drawing
  • Next by thread: Re: Threaded drawing
  • Index(es):
    • Date
    • Thread