Advertisement

opinion on size of constant ring buffer

Started by February 10, 2019 03:41 PM
2 comments, last by MJP 5 years, 11 months ago

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? ?

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. 

Advertisement

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.

This topic is closed to new replies.

Advertisement