public override void Dispose() { this.d3d11Device?.Dispose(); this.d3d11Device = null; this.dxgiDevice?.Dispose(); this.dxgiDevice = null; this.swapChain?.Dispose(); this.swapChain = null; this.swapChainBuffer?.Dispose(); d2dDevice3.Dispose(); deviceContext3.Dispose(); swapChainBuffer.Dispose(); }
partial void ReleaseMediaImpl() { mediaEngine?.Shutdown(); mediaEngine?.Dispose(); mediaEngine = null; // Randomly crashes in sharpDX and the native code when disabling this // The stream is problably accessed after disposal due to communication latency // Unfortunately we don't receive any events after the call to Shutdown where we could dispose those //videoDataStream?.Dispose(); //videoDataStream = null; //videoFileStream?.Dispose(); //videoFileStream = null; videoOutputSurface?.Dispose(); videoOutputSurface = null; videoOutputTexture?.Dispose(); videoOutputTexture = null; }
public void Resize(int width, int height) { if (this.width == width && this.height == height) { return; } this.width = width; this.height = height; mappableTexture.Dispose(); webTex.Tex.Dispose(); mappableSurface.Dispose(); webView.Resize(width, height); //webView.Reload(false); //descHM descHM.Usage = ResourceUsage.Staging; descHM.CpuAccessFlags = CpuAccessFlags.Write; descHM.BindFlags = BindFlags.None; descHM.Width = width; descHM.Height = height; mappableTexture = new Texture2D(Display.device, descHM); mappableSurface = mappableTexture.QueryInterface <SharpDX.DXGI.Surface>(); descHM.Usage = ResourceUsage.Default; descHM.CpuAccessFlags = CpuAccessFlags.None; descHM.BindFlags = BindFlags.ShaderResource; Texture2D webTexture = new Texture2D(Display.device, descHM); webTex.Tex = webTexture; webTex.Width = width; webTex.Height = height; webTex.RecreateSRV(); }