You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.
I believe the Toolkit would benefit from a nice solution to the following problem:
There should be some quick way to unset UnorderedAccessViews from a GraphicsDevice. Something like device.ResetUnorderedAccessViews().
Of course, in current version someone can do it using code like
SharpDX.Direct3D11.DeviceContext dc = device;
dc.ComputeShader.SetUnorderedAccessView(0, null);
But a device.ResetUnorderedAccessViews() would be more handy.
Another alternative is to change EffectPass.ApplyInternal() so that it automatically unsets UnorderedAccessView from ComputeShader if you are trying to bind it as ShaderResourceView.
Typical usecase for this is pyramidal image reduction with compute shaders (e.g. for blur or similar image effects) on dx10 hardware profile using SharpDX Effects framework.
DirectX 10 hardware allows just one UnorderedAccessView to be bound to pipeline. In pyramidal image reduction, one UnorderedAccessView is used as a buffer for results from first stage. Second stage of image reduction algorithm needs to use the buffer from previous stage as input (while using another UnorderedAccessView fro output). If the buffer was bound as UnorderedAccessView, attempt to bind it as ShaderResourceView results in incorrect behavior - zero input for compute shader, but no error or exception. This is very confusing and hard to debug. Some SharpDX exception would be nice in this case. Or some automatic unsetting (inside EffectPass.ApplyInternal) of that UnorderedAccessView.
How should I proceed with possible enhancement? Should I suggest some code, or should I wait for core SharpDX developers to make a decision on this?
The text was updated successfully, but these errors were encountered:
It would be great if you could suggest some code via a pull request (ideally, with a sample in SharpDXToolkitSamples.sln, but this is not strictly necessary).
The functionality could have something like GraphicsDevice.SetUnorderedAccessView(<uaw's here..>) (similar to GraphicsDevice.SetRenderTargets(params RenderTargetView[] renderTargetViews)) and GraphicsDevice.ResetUnorderedAccessView() (similar to GraphicsDevice.ResetTargets()).
There is currently EffectPass.Unapply() that unbinds everything, it is probably not optimal but at least provide a way to do it with current API. But feel free to pull request a GraphicsDevice.ResetUnorderedAccessView() (specifying in the doc that it is for compute shaders only)
After double checking, actually the only way to correctly reset slots is to use EffectPass.Unapply() as dc.ComputeShader.SetUnorderedAccessView(0, null); is only going to remove the first UAV (but won't remove them on other slots if there are any). Unlike SetRenderTarget, SetUAV is working on per slot basis, so we must explicitly free the slots that were used. Using EffectPass.UnApply() is explicitly resetting these slots.
Hi all,
I believe the Toolkit would benefit from a nice solution to the following problem:
There should be some quick way to unset UnorderedAccessViews from a GraphicsDevice. Something like device.ResetUnorderedAccessViews().
Of course, in current version someone can do it using code like
But a device.ResetUnorderedAccessViews() would be more handy.
Another alternative is to change EffectPass.ApplyInternal() so that it automatically unsets UnorderedAccessView from ComputeShader if you are trying to bind it as ShaderResourceView.
Typical usecase for this is pyramidal image reduction with compute shaders (e.g. for blur or similar image effects) on dx10 hardware profile using SharpDX Effects framework.
DirectX 10 hardware allows just one UnorderedAccessView to be bound to pipeline. In pyramidal image reduction, one UnorderedAccessView is used as a buffer for results from first stage. Second stage of image reduction algorithm needs to use the buffer from previous stage as input (while using another UnorderedAccessView fro output). If the buffer was bound as UnorderedAccessView, attempt to bind it as ShaderResourceView results in incorrect behavior - zero input for compute shader, but no error or exception. This is very confusing and hard to debug. Some SharpDX exception would be nice in this case. Or some automatic unsetting (inside EffectPass.ApplyInternal) of that UnorderedAccessView.
How should I proceed with possible enhancement? Should I suggest some code, or should I wait for core SharpDX developers to make a decision on this?
The text was updated successfully, but these errors were encountered: