Jump to content
  • Advertisement
Sign in to follow this  
Mr_Fox

DX12 Questions about D3D12_GPU_VIRTUAL_ADDRESS, D3D12_CPU_DESCRIPTOR_HANDLE, and D3D12_GPU_dESCRIPTOR_HANDLE

This topic is 988 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

After looking through docs about dx12 resource binding for awhile, I felt I still get confused when the following term come together:

 

D3D12_GPU_VIRTUAL_ADDRESS,

D3D12_CPU_DESCRIPTOR_HANDLE,

D3D12_GPU_DESCRIPTOR_HANDLE

 

From what I know, D3D12_GPU_VIRTUAL_ADDRESS works as GPU pointers point to actual GPU resource ( in vram ), once you got that pointer you can get access to the real data (you may need info about the memory layout .etc though)

 

 

D3D12_CPU_DESCRIPTOR_HANDLE,

D3D12_GPU_DESCRIPTOR_HANDLE

are handles for your resource descriptor (one for CPU, one for GPU and reside in descriptor heap only), which describes your gpu resource (include your resource layout, config, and always get linked to one ID3DResource by calling API CreateXXXView, through which you can essentially get D3D12_GPU_VIRTUAL_ADDRESS)

 

The first question I have is: why we have different versions of descriptor handle(one for CPU, and one for GPU). My guessing (from dx12 sample code) is: if you want to use handles in a cmdlist, you need to use GPU version, otherwise, use CPU version (but why they are designed like this? will it be easier and more straight forward if the driver maintains a map between the CPU version and GPU version handle, so the developer can only focus on one descriptor handle? what's the catch?). 

 

Also from DX12 resource bounding API, I found they only use D3D12_GPU_DESCRIPTOR_HANDLE when setting descriptor tables. So if I understand correctly, I can safely ignore all descriptor stuff if I don't use descriptor table ( I mean for real simple demo, theoretically), for example I don't even need to call SetDescriptorHeaps even...

 

 

Sorry for all these mess, I just not very clear on all these stuff. It will be greatly appreciated if someone could elaborate on that both from the API design perspective view, and from application benefits point of view .

 

Thanks

Edited by Mr_Fox

Share this post


Link to post
Share on other sites
Advertisement

It's because the GPU and CPU may not use the same virtual addresses.

 

To build on what vlj is saying under the hood the GPU most likely runs in GPUMMU mode where gpu has it's own page tables, this means that the gpu virtual address and cpu va will be different. A newer GPU may also run in IOMMU mode where GPU and CPU share the same page tables so in this case the GPU and CPU va will be the same. It all depends on how the driver is implemented under the hood.

 

Edit: So to answer OP's question, anything on the command list will use the GPU descriptor handle.

Edited by afroviking

Share this post


Link to post
Share on other sites

It's because the GPU and CPU may not use the same virtual addresses.

 

To build on what vlj is saying under the hood the GPU most likely runs in GPUMMU mode where gpu has it's own page tables, this means that the gpu virtual address and cpu va will be different. A newer GPU may also run in IOMMU mode where GPU and CPU share the same page tables so in this case the GPU and CPU va will be the same. It all depends on how the driver is implemented under the hood.

 

Edit: So to answer OP's question, anything on the command list will use the GPU descriptor handle.

For API like SetGraphicsRootXXXView, it requires D3D12_GPU_VIRTUAL_ADDRESS, instead of D3D12_GPU_DESCRIPTOR_HANDLE. so what is the different from GPU point of view then?  Sorry for being annoying, but I just want to know what under the hood 

 

Thanks

Share this post


Link to post
Share on other sites

 

It's because the GPU and CPU may not use the same virtual addresses.

 

To build on what vlj is saying under the hood the GPU most likely runs in GPUMMU mode where gpu has it's own page tables, this means that the gpu virtual address and cpu va will be different. A newer GPU may also run in IOMMU mode where GPU and CPU share the same page tables so in this case the GPU and CPU va will be the same. It all depends on how the driver is implemented under the hood.

 

Edit: So to answer OP's question, anything on the command list will use the GPU descriptor handle.

For API like SetGraphicsRootXXXView, it requires D3D12_GPU_VIRTUAL_ADDRESS, instead of D3D12_GPU_DESCRIPTOR_HANDLE. so what is the different from GPU point of view then?  Sorry for being annoying, but I just want to know what under the hood 

 

Thanks

 

These "root views" are different to a normal view object. 

Normally a view descriptor contains a pointer (virtual address), and information about the view such as the format and size.

A "root view" is thinner and more dangerous -- it's just the pointer with no information about the format or size of the data. This means that it can't be used for all situations, but when it can be used, it's more efficient.

To begin with, you should probably avoid these "root views" due to this complexity / danger.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!