/// <summary> /// Called when [create render target and depth buffers]. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <returns></returns> protected override ShaderResourceViewProxy OnCreateBackBuffer(int width, int height) { if (swapChain == null || swapChain.IsDisposed) { swapChain = CreateSwapChain(surfacePtr); } else { swapChain.ResizeBuffers(swapChain.Description1.BufferCount, TargetWidth, TargetHeight, swapChain.Description.ModeDescription.Format, swapChain.Description.Flags); } var backBuffer = Collect(new ShaderResourceViewProxy(Device, Texture2D.FromSwapChain <Texture2D>(swapChain, 0))); var sampleDesc = swapChain.Description1.SampleDescription; ColorBuffer.CreateRenderTargetView(); d2dTarget = Collect(new D2DTargetProxy()); d2dTarget.Initialize(swapChain, DeviceContext2D); return(backBuffer); }