Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recreate render target if EndDraw fails #1194

Closed
rajsesh opened this issue Oct 20, 2016 · 0 comments
Closed

Recreate render target if EndDraw fails #1194

rajsesh opened this issue Oct 20, 2016 · 0 comments

Comments

@rajsesh
Copy link
Contributor

rajsesh commented Oct 20, 2016

This is necessary before we switch CALayer to hw render target, so this doesn't block CGD2D merge to develop.

https://msdn.microsoft.com/en-us/library/windows/desktop/dd371766(v=vs.85).aspx,

@rajsesh rajsesh added this to the 1701 milestone Oct 20, 2016
@rajsesh rajsesh modified the milestones: 1702, 1701 Jan 6, 2017
@rajsesh rajsesh modified the milestones: 1702, 1703 Feb 28, 2017
DHowett-MSFT pushed a commit that referenced this issue Mar 3, 2017
…2119)

Direct2D can emit a failure or remove the backing hardware device from your
render target at the end of any drawing operation. However, CoreGraphics does
not natively have support for communicating failure states out to interested
consumers.

Enhanced Error Handling, when enabled, allows a sufficiently motivated
developer to become part of CGContext's rendering lifecycle.

The error of first and foremost importance is `D2DERR_RECREATE_TARGET`: It is
not an error, but a plea to retry the last rendering operation after
regenerating the render target. While CoreGraphics could batch up a list of
pending drawing operations and replay them on a new target, it opts instead to
report this to an Enhanced Error Handling consumer through
`kCGContextErrorDeviceReset`.

All other failing drawing operations result in
`kCGContextErrorInvalidParameter`.

In this pull request, **CALayer** has been augmented (in a bid to better
prepare us for a hardware-accelerated future) to retry its rendering up to
three (3) times if the device goes away. Since a layer can draw itself from
start to finish, `-display` is the best point at which to handle the
newly-minted CGContext errors.

Fixes #1194.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants