예제 #1
0
        private static ShaderGenerator CreateShaderGeneratorWithDelegate(GraphicsBuffer <float> sourceBuffer, GraphicsBuffer <float> destinationBuffer)
        {
            StructuredBufferResource <float>   source      = sourceBuffer.GetStructuredBuffer();
            RWStructuredBufferResource <float> destination = destinationBuffer.GetRWStructuredBuffer();

            Action <CSInput> action = input =>
            {
                destination[input.DispatchThreadId.X] = Math.Max(source[input.DispatchThreadId.X], 45);
            };

            return(new ShaderGenerator(action, new ShaderAttribute("compute"), new NumThreadsAttribute(100, 1, 1)));
        }