Optimising my renderer

Started by
41 comments, last by Hodgman 9 years, 12 months ago

I'll try the double-buffering and see what happens.

Double-buffering doesn’t do anything unless you are updating the buffers every frame.Most of the advice you have gotten has been under the assumption that you are.If you aren’t, as I said, go back to static buffers and draw all the sprites in a single call. Your bottleneck would be only the fact that you make 1,000 render calls instead of 1.L. Spiro

I will be updating sprites every frame, just trying to get the renderer performing as fast as I can first.

And I not making 1,000 render calls now as per my previous post. I am only doing one.

As I said that single line is all that is in my render loop. No 'for' loops, nothing but a single reference to drawindexedprimative, as I was advised to do.
Advertisement
I just found that if I enable the z-buffer and draw the objects from back to front my framerate has just increased more than ten fold smile.png
I don't think this link has been posted in thread yet (appologise if I has). It covers the no-overwrite buffer strategy: https://developer.nvidia.com/sites/default/files/akamai/gamedev/files/gdc12/Efficient_Buffer_Management_McDonald.pdf

We use double-buffering at work, and they did (not I) profile it on Xbox 360.These days it may be very similar in performance, but it is more likely to be similar to orphaning in OpenGL (which is slower than double-buffering, and I have tested that, as others have) because they are basically the same process, and if the driver tries to secretly double-buffer behind the scenes then the magic that makes that happen is implicitly more cycles than manually double-buffering.L. Spiro

yeah both D3D and GL will perform automagic double buffering (orphaning/renaming) whenever you map a buffer with any mode other than no-overwrite.
IIRC, the 360 (and pretty much every other console) don't implement this for you, so an engine would have to do it themselves (if required).

The automagic D3D/GLversions don't just cover double/tripple buffering (allowing you to map it once a frame / twice per two frames / thrice per three frames), but also have to cover the general purpose (expensive) N-buffering that's required when you map a buffer many times per frame.

It's also interesting that AFAIK, D3D12 isn't going to implement orphaning/renaming, so everyone will have to implement double-buffering themselves in the future.

This topic is closed to new replies.

Advertisement