🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

[D3D12] Barrier

Started by
2 comments, last by MJP 3 years, 9 months ago

I knew what is barrier for in DX12, but I don't know what situation that resource hazard will occur.

For example, I have a command list that consists of two command.

  1. Write data to resource R
  2. Read data from resource R

If the GPU will execute the command list in sequence (1 before 2), why I need barrier between 1 and 2 ?

None

Advertisement

After searching on Internet, This is because GPU has so many shader cores to process a single write command.

None

There are a few main reasons a barrier is needed for read-after-write situation:

  • Ensuring that all pending threads/work items have actually run to completion, like you mentioned
  • Making sure that non-coherent caches are flushed
  • The resource might need to be decompressed in order to be read by a particular stage of the pipeline
  • Some operations may be deferred until the resource is being read, for instance a clear operation may only end up happening for pixels that weren't written to

I wrote a whole series on my blog that gets into a lot of the details of barriers.

This topic is closed to new replies.

Advertisement