Jump to content
  • Advertisement
Sign in to follow this  
ZachBethel

DX12 ID3D12Device::GetResourceAllocationInfo

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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)?

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites
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 ?

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
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!