public void SetDisplay(int width, int height) { ViewWidth = width; ViewHeight = height; if (_disposing) { return; } if ((_buffer?.Length ?? 0) != ViewWidth * ViewHeight) { _buffer = new int[ViewWidth * ViewHeight]; } if (!_session.KernelIsCompiled && _session.IsActive) { _session.InitGPU(ref _buffer, new int[2] { ViewWidth, ViewHeight }, new float[4] { Left, Right, Bottom, Top }, MaxIterations); _session.CompileKernel(); } }