Advertisement

Buffers and SubAllocation

Started by November 18, 2018 05:31 PM
3 comments, last by Adam Miles 6 years, 2 months ago

In d3d12 the docs seem to push you to allocate large buffers that can store multiple resources (suballocation), whereas in d3d11 you might do one allocation per texture/mesh.  Is there a performance benefit to this?  It seems with the fast resource binding model of d3d12 you could do an allocation per texture/mesh and still have good performance over d3d11.  Why does the GPU care if the memory is from one large buffer or scattered?

-----Quat

The GPU doesn't care particularly whether a series of buffers form one allocation or not. The main reason is that memory is allocated at the granularity of a 64KB page. That is also true of the granularity at which heaps are Evicted and made Resident - pages, not individual allocations.

Of course, generally you want buffers much smaller than 64KB, in which case you'll be wasting a lot of memory per allocation unless you use it for multiple things.

Also, since allocating memory is expensive, it's better to do this as infrequently as possible and therefore grabbing larger amounts of memory and sub-allocating it yourself is going to be faster than asking Windows and IHV's driver to do this thousands of times for very small amounts.

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

Advertisement

Thanks for the reply.  Is this the 64KB page true in d3d11 too?  Is the driver just doing the suballocation for us?

-----Quat

Yeah, it's all driver managed on D3D11 and done for you transparently. The ethos of D3D12 is to move expensive logic out of the driver and into your title where you know what your title's particular patterns are.

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

This topic is closed to new replies.

Advertisement