Derek Nedelman

I'm working on a geometry instancing demo and I noticed in the XML documentation for GraphicsDevice.SetFrequency() that the method (and related methods) are "Windows Only". Is this a mistake



Re: XNA Framework Geometry instancing support on 360?

neogir

I think the reason is that for  the GPU band games (most of the big XBOX 360 games are of),  the instancing gives no performance benefit at all. Also if you have a modern PC with Core2Duo you'll generally hurt your performance with this technique. And  R2VB does not supported by XNA yet.



Re: XNA Framework Geometry instancing support on 360?

Derek Nedelman

That's interesting. It's the first time I've ever heard anything like that (about performance being hurt with geometry instancing). Do you have any online references of articles/tests I could read





Re: XNA Framework Geometry instancing support on 360?

neogir

I haven't the link by hand now, but you can read the NVidia SDK 9.5 documentation with a performance comparision diagram and the recommendations. Probably the techique has been greatly improved in the newest Direct3D10, I have no info but
http://www.nvidia.com/object/dx10-instancing-gdc-2006.html




Re: XNA Framework Geometry instancing support on 360?

neogir

Here are the  NVidia thoughts:

"Use of instancing isn¡¯t free. There is a small amount of per instance overhead in the driver
(luckily this is much less than normal draw calls). Also, since we are passing down extra
instance data in the vertex stream, all the instance data adds to our vertex stride, which will
reduce our vertex cache efficiency. As well, the instance data may require that we do extra
math ops per-vertex when we could be doing that math per-instance. Since with instancing,
you might pass down the world transform, you may have to do a matrix multiply to obtain
the WorldViewProjection matrix in the vertex shader. None of these concerns are too bad,
and in many situations, instancing is a win.

When to use instancing
It, of course, depends. The most general statement is that if your application is CPU bound,
and you have many copies of the same source mesh placed around your world, then you
should use instancing.
Empirical performance testing indicates that there is a ¡°sweet spot¡± for the use of instancing.
First we assume that your scene poly count is bound to some upper bound by the transform
speed of the hardware. Over the general range of possible graphics applications, as the size
of an instanced mesh gets larger, the number of draw calls per scene will in general be going
down. This means that as the size of the instanced mesh gets larger, the total amount of
time spent in the overhead of each draw call goes down. Since instancing has a higher per
poly overhead, as the per-poly overhead becomes the limiting factor, the benefit from
instancing vanishes. In fact, if your application is not CPU and draw call bound, then you
may not see any benefit from instancing at all.
When to NOT use instancing
If your application is heavily GPU bound or you have all unique mesh objects in your world.
Instancing has the benefit of spending less time in DX and in the driver preparing data for a
begin/end pair. Instancing reduces this overhead; however, if you have plenty of CPU to
spare, then instancing won¡¯t help you. Currently, not many applications are GPU bound."

But it all was witten a long ago. I think the tripple-core XBOX 360 CPU can manage a lot of objects with no instancing.

 





Re: XNA Framework Geometry instancing support on 360?

Derek Nedelman

Thanks a lot for the link. Slide 7 was especially interesting.

Hopefully someone from Microsoft will have something to add to this discussion on Monday.





Re: XNA Framework Geometry instancing support on 360?

Shawn Hargreaves - MSFT

Hardware instancing on Xbox works in a totally different way to on Windows. It is all done in the vertex shader, and actually much more flexible than the Windows DX9 approach.

We don't currently have any public docs on this aspect of the Xbox hardware, but are working through the process of figuring out how we can (legally :-) release this information.