Re: Catch CoreAnimation layer size vs. GPU errors?
Re: Catch CoreAnimation layer size vs. GPU errors?
- Subject: Re: Catch CoreAnimation layer size vs. GPU errors?
- From: John Harper <email@hidden>
- Date: Fri, 22 Feb 2008 18:12:55 -0800
On Feb 22, 2008, at 5:28 PM, Nathan Vander Wilt wrote:
In the course of this, I discovered that a CALayer's
bounds seem to directly correspond to the OpenGL
texture size, and so Core Animation assumes any large
bounds are accidental:
-[<CALayer: 0x1947e340> display]: Ignoring bogus layer
size (879999.937500, 581999.937500)
that's not quite what is happening, this warning is logged when you
try to _draw_ into a layer with bounds greater than something we think
any system will support (currently 16Kx16K). You can still have layers
larger than this, you just can't draw into them directly. (e.g. they
can have sublayers)
...and even misfires on slightly large bounds. For
example, if I set my root layer scale to 0.5 and
maximize my window, the constrained-to-fit sublayer's
size causes:
CoreAnimation: 2480 by 1290 image is too large for
GPU, ignoring
This is the OpenGL maximum texture size for your graphics card.
Currently across all graphics cards supported by 10.5 the "safe"
maximum size is 2046x2046 (since all cards will support images up to
that size.)
If you need images larger than this we recommend you look at the
CATiledLayer class and see if that supports what you need (it tiles
the contents of large layers into smaller images for you by asking you
to draw subregions individually as they are required)
At this stage in the design, I can try figure out an
architecture that avoids the "bogus" layer sizes, but
I'm worried about the slightly-too-large layers
occurring in the wild (eg someone with an older
Macbook and a larger external monitor making the
window bigger relative to the GPU than I could). Is
there a way to detect these errors programatically so
that some sort of fallback can be done?
Not currently through CA (though we are considering this for a future
release.) Currently the only way to query these limits is via OpenGL
directly. If you have a GL context, query the GL_MAX_TEXTURE_SIZE and
GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB properties and use the minimum of
the two.
John
_______________________________________________
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