Jump to content
  • Advertisement
John321

opinion on size of constant ring buffer

Recommended Posts

Hi,  So I am curious on what other peole would allocate normally for constant buffer managed by a ring buffer. I have assumed a case for my maximum allowable constants and I found myself needing upto 1GB for a constant buffer with tripple buffering, this assumption says I can approximately draw close to upto a million objects. What are some of your maximum sizes or do you generaly  use an upload heap to also support stuff like VBs and uploadable buffers for all scenarios? 🙂

Share this post


Link to post
Share on other sites
Advertisement
6 hours ago, John321 said:

I found myself needing upto 1GB for a constant buffer with tripple buffering

Assuming 60fps, then that's around 20GBps of PCIe traffic. That's near the limit for a lot of PC's! 

I'd probably aim for below 100MB per frame...

6 hours ago, John321 said:

this assumption says I can approximately draw close to upto a million objects

The minimum cbuffer size is 256B, so yeah, one per object, times a million objects, times 3 frames = 0.72GB... But... If you're drawing a million objects, you probably really want to be using instancing or indirect drawing or some kind of batching system where you don't need to make a million draw calls each using its own cbuffer. Possibly also using a system where most of the per-object data is stored and calculated on GPU, so that you don't need to triple buffer it. 

Share this post


Link to post
Share on other sites

1 GB of constant buffers is crazy, assuming we're talking about the type of "fire and forget" constant buffers that are written to by the CPU and read by the GPU, and don't live longer than a frame. I've shipped multiple PS4 games that used < 4 MB per-frame (although there was no annoying 256 byte alignment to deal with on that platform, which helped). I would echo what Hodgman said: you'll want to thing carefully about your instancing/batching systems, and figure out which data actually needs to change every frame. If it changes infrequently, you'll definitely want to keep it in a more permanent location that lives in GPU memory. Even if it does need to change every frame, if you need to read the data more than once you'll also want to consider uploading it to GPU memory to improve access times for reading that buffer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!