Advertisement

ID3D12Device::GetResourceAllocationInfo

Started by November 28, 2017 12:17 AM
3 comments, last by galop1n 7 years, 2 months ago

Hey,

I'm working on a placed resource system, and I need a way to determine the size and alignement of image resources before placing them on the heap. This is used for transient resources within a frame. The appropriate method on ID3D12Device is GetResourceAllocationInfo. Unfortunately, this method is quite slow and eats up a pretty significant chunk of time. Way more than I would expect for just returning a size and alignment (I'm using a single D3D12_RESOURCE_DESC) each time.

Is there a way I can conservatively estimate this value for certain texture resources (i.e. ones without mip chains or something)?

Thanks.

1 hour ago, ZachBethel said:

Is there a way I can conservatively estimate this value for certain texture resources (i.e. ones without mip chains or something)?

I don't think so.

Can't you call it once for each type of transient resource, and then reuse the results every frame (instead of re-calling it every frame with the same inputs)?

Advertisement

That's what I thought. The solution I went with is to keep a map of image descriptor hash to resource allocation info. It cut down on the cost by 3x. Thanks!

10 hours ago, ZachBethel said:

That's what I thought. The solution I went with is to keep a map of image descriptor hash to resource allocation info. It cut down on the cost by 3x. Thanks!

You probably mean an hash table ? You can also populate the most common cases at the init in a flat structure for better cache coherency. But does this really matters ?

This topic is closed to new replies.

Advertisement