Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Interleaved Arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interleaved Arrays



Hi Y'all,

What I have heard (this all goes in the rumor catagory, I am an app developer not a driver writer :-) is that a lot of modern hardware will recognize contiguous vertices without using the interleaved OGL APIs.

In other words, imagine you have 32-byte vertices (XYZ, normal, ST tex coords) in an interleavde memory format.

If you simply set up client arrays separately for vetex, normal, and one texture, using the stride parameter to tell OpenGL that they are interleaved in memory, the hardware _will_ figure out that this is the optimum case and stream the buffer linearly.

It is my understanding that interleaving is good because it allows the hardware to fetch one "chunk" of data and get all of its info from the same place. It is also my understanding that caches in modern hardware are 32-bytes these days, so having 32-byte vertices is a good thing.

I have not done detailed enough profiling to confirm this stuff, but I can tell you that our company's app uses separate arrays that happen to be interleaved in memory (as opposed to formal interleaved arrays) and vertex performance is very good.

We don't use interleaved arrays because often the interleaving format we want isn't available.

*Cheers*
Ben


Kent Miller wrote:
I messed around this a while ago and the answer I found was that it depends :).

The size of the interleaved array elements does have something to do with it - if it is a round cache line size (it has to agree with both the CPU and the graphics card cache line size). Even wasting a few bytes between elements can matter there if it rounds the data up such that every element starts on a cache line.

I don't think there is a rule of thumb here - you just have to see what works best on your configuration.

Regards,

Kent

On Nov 14, 2006, at 8:13 AM, Richard S. Wright Jr. wrote:

Can someone at Apple comment on the wisdom of using Interleaved Arrays vs. separate vertex arrays? I have seen a few speakers/articles extolling the caching virtues of having all the data in one array. I recall distinctly an Intel presentation many years ago where the speaker said NOT to use interleaved arrays (also quoting caching characteristics). Nobody seems to give the details of why this is better/worse. It seems a lot of people are repeating things they've heard elsewhere, but not supporting the argument.

When in doubt, ask your IHV... Apple?

Richard




_______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




-- Scenery Home Page: http://scenery.x-plane.com/ Scenery blog: http://xplanescenery.blogspot.com/ Plugin SDK: http://www.xsquawkbox.net/xpsdk/ Scenery mailing list: email@hidden Developer mailing list: email@hidden _______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Is APPLE_ycbcr_422 supposed to work with ReadPixels (Intel Mac) (From: Mark Munte <email@hidden>)
 >Interleaved Arrays (From: "Richard S. Wright Jr." <email@hidden>)
 >Re: Interleaved Arrays (From: Kent Miller <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.