Sign in to follow this  
joystick-hero

Creating resources in D3D11 with alignment constraints

Recommended Posts

joystick-hero    148

This might be a newbie question but I was wondering if there's a way or some kind of convention regarding resource's allocation alignment in memory.

 

For instance, when I create a new texture2d via ID3D11Device::CreateTexture2D method with a DXGI_FORMAT_R32G32B32A32_FLOAT format, how can I tell directx that I want the resource to have a X-byte alignment?

 

I'm interested in this because when and if I need to read the texture2d in a compute shader, in order to do it the most efficient way possible (when memory coalescing works), the starting address of the resource must be a multiple of the region size I'm reading. According to page number 9 of this pdf slide

Share this post


Link to post
Share on other sites
Jason Z    6434

There is no way to do this through the Direct3D 11 API - the actual memory location and alignment of the resource is up to the driver / runtime to determine, and you don't have access to it directly.  I assume that slide is talking about the use of CUDA, rather than D3D11.

 

This is likely to change with Direct3D 12, which is supposed to give you significantly more robust control over the memory resources used by the API.

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