using SDL2_gpuCS; using System; namespace MoonWorks.Graphics { /// /// Compute pipelines perform arbitrary parallel processing on input data. /// public class ComputePipeline : SDL_GpuResource { protected override Action ReleaseFunction => SDL_Gpu.SDL_GpuReleaseComputePipeline; public ComputePipelineResourceInfo ResourceInfo { get; } public unsafe ComputePipeline( GraphicsDevice device, Shader computeShader, ComputePipelineResourceInfo resourceInfo ) : base(device) { var sdlComputePipelineCreateInfo = new SDL_Gpu.ComputePipelineCreateInfo { ComputeShader = computeShader.Handle, PipelineResourceInfo = resourceInfo.ToSDL() }; Handle = SDL_Gpu.SDL_GpuCreateComputePipeline( device.Handle, sdlComputePipelineCreateInfo ); if (Handle == IntPtr.Zero) { throw new Exception("Could not create compute pipeline!"); } ResourceInfo = resourceInfo; } } }