Hi,
I'm still trying to draw large gridmap terrains on the 360 and so far am having a lot of success. Performance seems to be a lot higher than my 6800GT, perhaps by about a factor of about 4. The issue I'm having though is really rather strange and I've been wondering for the last couple of hours quite how it could be happening.
I create a huge vertex buffer (as big as XNA allows before throwing an UnauthorizedAccessException at me) for the gridmap and draw the entire world (4million polygons) in a single draw call. Except the frame rate is good under some circumstances and bad under others, and the factors that make the frame rate plummet really shouldn't affect the frame rate at all. If I create only this one VertexBuffer and try drawing, I get a measly framerate of 31fps, but this is a very solid frame rate almost as if it is locked there.
So what is the cure for this 31fps Well, create another huge 64MB vertexbuffer, fill it with data or not, it still has the same good effect. Simply by making a second, huge vertex buffer, the framerate more than doubles up to 61-62fps, exactly what you'd expect as it is synched to go 60fps. Why does creating a huge extra vertex buffer and not doing anything with it increase the frame rate so much
The other cure to the "31fps" lock I seem to hit is intercepting the PresentationInterval on device creation and setting it to Immediate. With this set, the frame rate jumps to about 69-70, only limited by the performance of the 360 now rather than the 60fps synching. With smaller worlds that push the 360 far less, the frame rate increases to 100, 200 fps depending on the world size (as you'd expect).
My understanding was that PresentationInterval.One should try and display a frame once for every time the display refreshes, ie, 60 times per second on a 60hz monitor. Of course, even if I was completely mistaken, it still doesn't explain how this extra vertex buffer magically helps the frame rate to over 60.
I've uploaded/zipped up my project "TT360" and it should just deploy if anyone would like to try it. I've commented a couple of areas within the code where you can try commenting/uncommenting the creation of this extra vertex buffer, and also where to intercept the PresentationInterval. The frame rate is output to the console one per second along with the PresentationInterval being used. I also draw a piece of road in each corner of the map to illustrate that all the primitives of the grid are infact being drawn. Frame rate is best when looking down towards the world rather than up, I guess DirectX does some of it's own culling best when looking down ( ).
Controls are fairly simple, dual analog sticks for moving around, triggers move vertically up and down, holding the right bumper/shoulder will increase movement speed by a factor of 10 for when you want to move around quickly. Pressing A will go to wireframe mode, B back to solid fill. "Back" will quit the 'game'.
http://aj.uwcs.co.uk/TT360/TT360_Test.zip
My problem basically then is that I don't want to use .Immediate, as this causes tearing, and so leaves me with .One, except the only way to get 60fps is to declare a 64MB vertexbuffer into memory and do nothing with it... crazy.
If anyone has any comments about either the problem or my code (don't be too harsh!) then I'd be glad to hear :)
Thanks,
Adam Miles