void OnResize() { Helpers.Dispose(ref depthBuffer); Helpers.Dispose(ref dsv); Helpers.Dispose(ref colorBuffer); Helpers.Dispose(ref rtv); var resolution = Surface.Resolution; TextBatcher.Resolution = resolution; UILineBatcher.Resolution = resolution; var sampleDescription = new SampleDescription(4, 0); depthBuffer = new Texture2D(Surface.Device, new Texture2DDescription { Format = Format.R32_Typeless, ArraySize = 1, MipLevels = 1, Width = resolution.X, Height = resolution.Y, SampleDescription = sampleDescription, Usage = ResourceUsage.Default, BindFlags = BindFlags.DepthStencil, CpuAccessFlags = CpuAccessFlags.None, OptionFlags = ResourceOptionFlags.None }); depthBuffer.DebugName = "Depth Buffer"; var depthStencilViewDescription = new DepthStencilViewDescription { Flags = DepthStencilViewFlags.None, Dimension = DepthStencilViewDimension.Texture2DMultisampled, Format = Format.D32_Float, Texture2D = { MipSlice = 0 } }; dsv = new DepthStencilView(Surface.Device, depthBuffer, depthStencilViewDescription); dsv.DebugName = "Depth DSV"; //Using a 64 bit texture in the demos for lighting is pretty silly. But we gon do it. var description = new Texture2DDescription { Format = Format.R16G16B16A16_Float, ArraySize = 1, MipLevels = 1, Width = resolution.X, Height = resolution.Y, SampleDescription = sampleDescription, Usage = ResourceUsage.Default, BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource, CpuAccessFlags = CpuAccessFlags.None, OptionFlags = ResourceOptionFlags.None }; colorBuffer = new Texture2D(Surface.Device, description); colorBuffer.DebugName = "Color Buffer"; rtv = new RenderTargetView(Surface.Device, colorBuffer); rtv.DebugName = "Color RTV"; description.SampleDescription = new SampleDescription(1, 0); resolvedColorBuffer = new Texture2D(Surface.Device, description); resolvedColorBuffer.DebugName = "Resolved Color Buffer"; resolvedSRV = new ShaderResourceView(Surface.Device, resolvedColorBuffer); resolvedSRV.DebugName = "Resolved Color SRV"; resolvedRTV = new RenderTargetView(Surface.Device, resolvedColorBuffer); resolvedRTV.DebugName = "Resolved Color RTV"; }