Jump to content
  • Advertisement
Sign in to follow this  

DX12 Resource synchronization

Recommended Posts

Hi guys!


I have to run custom pixel shader to clear RTV (draw call 1).

After that I run another pixel shader on that RTV to render objects (draw call 2).

Do I need to insert resource barrier between two draw calls provided that RTV is already in render target state?


The same thing with UAV. I run custom compute shader to clear UAV and then run another compute shader to do actual calculations.

Do I need resource barrier between these two draw calls?




Edited by _void_

Share this post

Link to post
Share on other sites

I might be wrong here but no resource barrier for the RTV and yes to a UAV barrier for the UAV's in consecutive compute shader invocations.

Someone correct me if I'm wrong.

Oh and the only reason I think its no to the RTV is because your using the graphic pipeline.

@MJP  Could you describe the ordering constraints on the regular graphic pipeline?  I remember you mentioning them once.

Edited by Infinisearch

Share this post

Link to post
Share on other sites

The only guaranteed synchronization points in the graphics pipeline are that stream output and the output merger (RTV/DSV writes) are guaranteed to happen in sequence (per pixel for OM) from draw to draw. So writing to an RTV in draw 1, and then again in draw 2, those render target writes are guaranteed to happen in order. But within the pixel shader itself, there's no guarantee of ordering - unless you use ROVs instead of UAVs.

To enforce ordering of UAVs from draw to draw, you can use a UAV barrier. This ensures ALL UAV writes from draw/dispatch 1 are done before draw/dispatch 2 can start, which is more heavyweight than ROVs.

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!