optimizing dynamic geometry

Posts: 5,143
Joined: 2002.04
Post: #16
Quote:Originally posted by arekkusu
This one I'm not familiar with (still PPC newbie.) The only reason I've got it split up into separate functions (should be inlined) like this is so the client can still change color/texture/probably linewidth between vertices. Globals avoid resending all the vertex1 info & temp values in the later vertex call(s).

... and I'm sure the globals are a win in this situation.

The problem is, though, that every read from a global causes a load, whether the same global has been read earlier in the function or not (thread-safety; possible side effects in other function calls).

In order to work around this, you have to explicitly tell the compiler when you want to read the globals and when it's OK to use a cached value, by storing the value of the global in a local variable.

Global variables can't live in registers by definition.

WRT. APPLE_var, the extension lets you specify one block of memory which should hold all your arrays (vertex, color, texture, normal, even index if you use APPLE_index_array). They can be interleaved or not; that doesn't matter. What matters is that they all lie within that range, which gets wired down and can then be used for speedy transfers to the card.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  GLSL geometry- and multipass-shaders (nogo?) mcMike 3 5,593 May 2, 2008 05:51 AM
Last Post: mcMike
  geometry intersact with rendering volume stella1016 0 2,102 Oct 3, 2007 12:44 PM
Last Post: stella1016
  Smoothing geometry via subdivision TomorrowPlusX 1 2,715 Aug 30, 2007 02:46 PM
Last Post: OneSadCookie
  Optimizing CGLFlushDrawable Nick 3 3,708 Nov 27, 2006 06:48 PM
Last Post: OneSadCookie
  Geometry instancing and vertex streams Puzzler183 2 2,694 Apr 16, 2005 11:00 PM
Last Post: Puzzler183