public RenderWindow() : base(DefaultWidth, DefaultHeight, GraphicsMode.Default, MainTitle, GameWindowFlags.Default, DisplayDevice.Default, 0, 0, GraphicsContextFlags.ForwardCompatible) { _interop = new GraphicsInterop(); _input = new InputManager(Keyboard); _kernelManager = new KernelManager(_interop, _input, EmbeddedResourceManager.GetText("kernel.cl")); }
public KernelManager(GraphicsInterop interop, InputManager input, string source) { _input = input; var localSizeSingle = (long)Math.Sqrt(interop.Device.MaxWorkGroupSize); _localSize = new[] { localSizeSingle, localSizeSingle }; //_localSize = new[] { interop.Device.MaxWorkGroupSize, 1 }; _program = new ComputeProgram(interop.Context, source); try { _program.Build(new[] { interop.Device }, "", null, IntPtr.Zero); } catch (InvalidBinaryComputeException) { Console.WriteLine(_program.GetBuildLog(interop.Device)); return; } catch (BuildProgramFailureComputeException) { Console.WriteLine(_program.GetBuildLog(interop.Device)); return; } Console.WriteLine(_program.GetBuildLog(interop.Device)); _kernels = _program.CreateAllKernels().ToArray(); }