private static void CreateBuffers(GraphicsDevice device, float[] array, out StructuredBuffer <float> sourceBufferView, out WriteableStructuredBuffer <float> destinationBufferView) { GraphicsResource sourceBuffer = GraphicsResource.CreateBuffer <float>(device, array, ResourceFlags.None); GraphicsResource destinationBuffer = GraphicsResource.CreateBuffer <float>(device, array.Length * 2, ResourceFlags.AllowUnorderedAccess); sourceBufferView = new StructuredBuffer <float>(ShaderResourceView.FromBuffer <float>(sourceBuffer)); destinationBufferView = new WriteableStructuredBuffer <float>(UnorderedAccessView.FromBuffer <float>(destinationBuffer)); }
private static TestShader CreateTestShader(GraphicsDevice device, int sumCount) { GraphicsResource buffer = GraphicsResource.CreateBuffer <float>(device, sumCount, ResourceFlags.AllowUnorderedAccess); WriteableStructuredBuffer <float> bufferView = new WriteableStructuredBuffer <float>(UnorderedAccessView.FromBuffer <float>(buffer)); TestShader shader = new TestShader(bufferView, Sigmoid); return(shader); }