• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By lubbe75
      As far as I understand there is no real random or noise function in HLSL. 
      I have a big water polygon, and I'd like to fake water wave normals in my pixel shader. I know it's not efficient and the standard way is really to use a pre-calculated noise texture, but anyway...
      Does anyone have any quick and dirty HLSL shader code that fakes water normals, and that doesn't look too repetitious? 
    • By turanszkij
      Hi,
      I finally managed to get the DX11 emulating Vulkan device working but everything is flipped vertically now because Vulkan has a different clipping space. What are the best practices out there to keep these implementation consistent? I tried using a vertically flipped viewport, and while it works on Nvidia 1050, the Vulkan debug layer is throwing error messages that this is not supported in the spec so it might not work on others. There is also the possibility to flip the clip scpace position Y coordinate before writing out with vertex shader, but that requires changing and recompiling every shader. I could also bake it into the camera projection matrices, though I want to avoid that because then I need to track down for the whole engine where I upload matrices... Any chance of an easy extension or something? If not, I will probably go with changing the vertex shaders.
    • By NikiTo
      Some people say "discard" has not a positive effect on optimization. Other people say it will at least spare the fetches of textures.
       
      if (color.A < 0.1f) { //discard; clip(-1); } // tons of reads of textures following here // and loops too
      Some people say that "discard" will only mask out the output of the pixel shader, while still evaluates all the statements after the "discard" instruction.

      MSN>
      discard: Do not output the result of the current pixel.
      clip: Discards the current pixel..
      <MSN

      As usual it is unclear, but it suggests that "clip" could discard the whole pixel(maybe stopping execution too)

      I think, that at least, because of termal and energy consuming reasons, GPU should not evaluate the statements after "discard", but some people on internet say that GPU computes the statements anyways. What I am more worried about, are the texture fetches after discard/clip.

      (what if after discard, I have an expensive branch decision that makes the approved cheap branch neighbor pixels stall for nothing? this is crazy)
    • By NikiTo
      I have a problem. My shaders are huge, in the meaning that they have lot of code inside. Many of my pixels should be completely discarded. I could use in the very beginning of the shader a comparison and discard, But as far as I understand, discard statement does not save workload at all, as it has to stale until the long huge neighbor shaders complete.
      Initially I wanted to use stencil to discard pixels before the execution flow enters the shader. Even before the GPU distributes/allocates resources for this shader, avoiding stale of pixel shaders execution flow, because initially I assumed that Depth/Stencil discards pixels before the pixel shader, but I see now that it happens inside the very last Output Merger state. It seems extremely inefficient to render that way a little mirror in a scene with big viewport. Why they've put the stencil test in the output merger anyway? Handling of Stencil is so limited compared to other resources. Does people use Stencil functionality at all for games, or they prefer discard/clip?

      Will GPU stale the pixel if I issue a discard in the very beginning of the pixel shader, or GPU will already start using the freed up resources to render another pixel?!?!



       
    • By Axiverse
      I'm wondering when upload buffers are copied into the GPU. Basically I want to pool buffers and want to know when I can reuse and write new data into the buffers.
  • Advertisement
  • Advertisement
Sign in to follow this  

DX12 Questions about D3D12_GPU_VIRTUAL_ADDRESS, D3D12_CPU_DESCRIPTOR_HANDLE, and D3D12_GPU_dESCRIPTOR_HANDLE

This topic is 746 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