private void dispose() { if (com != null) { com.Dispose(); com = null; } }
public DepthStencil(IDisposableResource parent, int width, int height, DepthStencilFormats depthStencilFormats) : base(parent) { try { var video = parent.FindParentOrSelfWithException <Video>(); Size = new Size2(width, height); SizeF = Size.ToVector2(); int depthBit = 16, stencilBit = 0; switch (depthStencilFormats) { case DepthStencilFormats.Defualt: depthBit = 24; stencilBit = 0; break; case DepthStencilFormats.Depth24Stencil8: depthBit = 24; stencilBit = 8; break; case DepthStencilFormats.Depth16: depthBit = 16; stencilBit = 0; break; case DepthStencilFormats.Depth24: depthBit = 24; stencilBit = 0; break; case DepthStencilFormats.Depth32: depthBit = 32; stencilBit = 0; break; default: Debug.ThrowError("Video", "Unsuported DepthStencilFormat type"); break; } com = new DepthStencilCom(); var error = com.Init(video.com, width, height, depthBit, stencilBit); switch (error) { case DepthStencilErrors.Textrue: Debug.ThrowError("DepthStencil", "Failed to create Texture2D"); break; case DepthStencilErrors.DepthStencilView: Debug.ThrowError("DepthStencil", "Failed to create DepthStencilView"); break; } } catch (Exception e) { Dispose(); throw e; } }
public DepthStencil(IDisposableResource parent, int width, int height, DepthStencilFormats depthStencilFormats) : base(parent) { try { var video = parent.FindParentOrSelfWithException<Video>(); Size = new Size2(width, height); SizeF = Size.ToVector2(); int depthBit = 16, stencilBit = 0; switch (depthStencilFormats) { case DepthStencilFormats.Defualt: depthBit = 24; stencilBit = 0; break; case DepthStencilFormats.Depth24Stencil8: depthBit = 24; stencilBit = 8; break; case DepthStencilFormats.Depth16: depthBit = 16; stencilBit = 0; break; case DepthStencilFormats.Depth24: depthBit = 24; stencilBit = 0; break; case DepthStencilFormats.Depth32: depthBit = 32; stencilBit = 0; break; default: Debug.ThrowError("Video", "Unsuported DepthStencilFormat type"); break; } com = new DepthStencilCom(); var error = com.Init(video.com, width, height, depthBit, stencilBit); switch (error) { case DepthStencilErrors.Textrue: Debug.ThrowError("DepthStencil", "Failed to create Texture2D"); break; case DepthStencilErrors.DepthStencilView: Debug.ThrowError("DepthStencil", "Failed to create DepthStencilView"); break; } } catch (Exception e) { Dispose(); throw e; } }
public override void Dispose() { disposeChilderen(); if (com != null) { com.Dispose(); com = null; } base.Dispose(); }
private void init(IDisposableResource parent, int width, int height, DepthStencilFormats depthStencilFormats) { try { this.width = width; this.height = height; this.depthStencilFormats = depthStencilFormats; video = parent.FindParentOrSelfWithException <Video>(); Size = new Size2(width, height); SizeF = Size.ToVector2(); int depthBit = 16, stencilBit = 0; switch (depthStencilFormats) { case DepthStencilFormats.Defualt: depthBit = 24; stencilBit = 0; break; case DepthStencilFormats.Depth24Stencil8: depthBit = 24; stencilBit = 8; break; case DepthStencilFormats.Depth16: depthBit = 16; stencilBit = 0; break; case DepthStencilFormats.Depth24: depthBit = 24; stencilBit = 0; break; case DepthStencilFormats.Depth32: depthBit = 32; stencilBit = 0; break; default: Debug.ThrowError("Video", "Unsuported DepthStencilFormat type"); break; } com = new DepthStencilCom(); var error = com.Init(video.com, width, height, depthBit, stencilBit); switch (error) { case DepthStencilErrors.DepthStencilSurface: Debug.ThrowError("DepthStencil", "Failed to create DepthStencil Surface"); break; } if (!video.Caps.ExDevice && !video.deviceReseting) { video.DeviceLost += deviceLost; video.DeviceReset += deviceReset; } } catch (Exception e) { Dispose(); throw e; } }
private void init(IDisposableResource parent, int width, int height, DepthStencilFormats depthStencilFormats) { try { this.width = width; this.height = height; this.depthStencilFormats = depthStencilFormats; video = parent.FindParentOrSelfWithException<Video>(); Size = new Size2(width, height); SizeF = Size.ToVector2(); int depthBit = 16, stencilBit = 0; switch (depthStencilFormats) { case DepthStencilFormats.Defualt: depthBit = 24; stencilBit = 0; break; case DepthStencilFormats.Depth24Stencil8: depthBit = 24; stencilBit = 8; break; case DepthStencilFormats.Depth16: depthBit = 16; stencilBit = 0; break; case DepthStencilFormats.Depth24: depthBit = 24; stencilBit = 0; break; case DepthStencilFormats.Depth32: depthBit = 32; stencilBit = 0; break; default: Debug.ThrowError("Video", "Unsuported DepthStencilFormat type"); break; } com = new DepthStencilCom(); var error = com.Init(video.com, width, height, depthBit, stencilBit); switch (error) { case DepthStencilErrors.DepthStencilSurface: Debug.ThrowError("DepthStencil", "Failed to create DepthStencil Surface"); break; } if (!video.Caps.ExDevice && !video.deviceReseting) { video.DeviceLost += deviceLost; video.DeviceReset += deviceReset; } } catch (Exception e) { Dispose(); throw e; } }