using Dashboard.Drawing; using Dashboard.Pal; using OpenTK.Graphics.OpenGL; namespace Dashboard.OpenGL.Drawing { public class DirectRendering : IDirectRendering { public DeviceContext Context { get; private set; } = null!; public string DriverName { get; } = "Dashboard OpenGL"; public string DriverVendor { get; } = "Dashboard"; public Version DriverVersion { get; } = new Version(0, 1); IContextBase IContextExtensionBase.Context => Context; public void Dispose() { GC.SuppressFinalize(this); throw new NotImplementedException(); } public void Require(DeviceContext context) => Context = context; public void Require(IContextBase context) => Require((DeviceContext)context); public void Begin() { } public void End() { } public IShader CreatePipeline(T createInfo) where T : IShaderCreateInfo { int program = createInfo switch { GlslShaderCreateInfo glsl => glsl.CreateProgram(), GlslComputeShaderCreateInfo compute => compute.CreateProgram(), SpirvShaderCreateInfo spirv => spirv.CreateProgram(), _ => throw new Exception($"Unsupported shader pipeline type {createInfo.GetType()}."), }; return new GLShader((GLDeviceContext)Context, program); } public IBuffer CreateBuffer(BufferAccessPattern pattern, long size) { return GLBuffer.Create((GLDeviceContext)Context, pattern, size); } public void Draw(DrawCall drawCall) { throw new NotImplementedException(); } } }