sharpdx / SharpDX

SharpDX GitHub Repository

Home Page:http://sharpdx.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OutputMerger.SetUnorderedAccessView resets all previously bound UAVs

Raveler opened this issue · comments

There are a couple of functions in SharpDX that have a similar signature:

Context.VertexShader.SetShaderResource(slot, view);
Context.PixelShader.SetShaderResource(slot, view);
Context.ComputerShader.SetUnorderedAccessView(slot, view);
Context.OutputMerger.SetUnorderedAccessView(slot, view);

However, OutputMerger.SetUnorderedAccessView is the ONLY method that resets all previously bound UAVs and SRVs! This is because internally, that method is just a wrapper around a call to SetRenderTargetsAndUnorderedAccessViews, which resets all the bound resources according to the comments in the source file:

https://github.com/sharpdx/SharpDX/blob/master/Source/SharpDX.Direct3D11/DeviceContext.OutputMergerStage.cs

This is extremely confusing. It took me days to figure out why my UAVs weren't all bound correctly. I suggest removing that method entirely, forcing people to use SetUnorderedAccessViews instead. That method is more obvious because you give it all the UAVs at once.