int ResizeTarget(IntPtr swapChainPtr, ref ModeDescription dwTargetParams)
        {
            SwapChain swapChain = (SwapChain)swapChainPtr;
            {

                if (_overlay != null) {
                    _overlay.Dispose();
                    _overlay = null;
                }
                swapChain.ResizeTarget(ref dwTargetParams);
                return Result.Ok.Code;
            }
        }
        int Present(IntPtr swapChainPtr, int syncInterval, PresentFlags dwFlags)
        {
            SwapChain swapChain = (SwapChain)swapChainPtr;

            try {
                if (swapChainPtr != swapChain.NativePointer || _overlay == null) {
                    if (_overlay != null)
                        _overlay.Dispose();

                    _overlay = new Renderer();
                    _overlay.Init(swapChain);

                    _swapChainPtr = swapChain.NativePointer;
                } else if (_overlay != null) {
                    _overlay.Render();
                }
            } catch(Exception ex) {
                Log.Write("Failed present: {0}", ex.Message);
            }

            swapChain.Present(syncInterval, dwFlags);
            return Result.Ok.Code;
        }