public static GraphicsDeviceService AddRef(IntPtr windowHandle, int width, int height) { if (Interlocked.Increment(ref _refCount) == 1) { _instance = new GraphicsDeviceService(); _instance.CreateDevice(windowHandle, width, height); } return _instance; }