public ResourceReference(UIntObject resource, string creationStackTrace) { Assert.NotNull(resource); _reference = new WeakReference(resource); _handle = resource.Handle; _disposeAction = resource.GetDisposeAction(); _isAlive = true; _creationStackTrace = creationStackTrace; _resourceName = resource.ToString(); }
internal ResourceReference AddTrackedResource(UIntObject resource, string creationStackTrace) { Assert.True(IsActive); if (_isDisposed) { throw new ObjectDisposedException("ResourceTracker"); } var reference = new ResourceReference(resource, creationStackTrace); _trackedResources.Add(reference); return(reference); }
private void SaveAttachment(FramebufferAttachment attachmentPosition, UIntObject attachment) { switch (attachmentPosition) { case FramebufferAttachment.DepthAttachment: Disposer.Dispose(_depthAttachment); _depthAttachment = attachment; break; case FramebufferAttachment.ColorAttachment0: case FramebufferAttachment.ColorAttachment1: case FramebufferAttachment.ColorAttachment2: case FramebufferAttachment.ColorAttachment3: case FramebufferAttachment.ColorAttachment4: case FramebufferAttachment.ColorAttachment5: case FramebufferAttachment.ColorAttachment6: case FramebufferAttachment.ColorAttachment7: case FramebufferAttachment.ColorAttachment8: case FramebufferAttachment.ColorAttachment9: case FramebufferAttachment.ColorAttachment10: case FramebufferAttachment.ColorAttachment11: case FramebufferAttachment.ColorAttachment12: case FramebufferAttachment.ColorAttachment13: case FramebufferAttachment.ColorAttachment14: case FramebufferAttachment.ColorAttachment15: var index = attachmentPosition - FramebufferAttachment.ColorAttachment0; Disposer.Dispose(_colorAttachments[index]); _colorAttachments[index] = attachment; break; case FramebufferAttachment.StencilAttachement: throw new NotSupportedException(attachmentPosition.ToString()); default: throw new NotSupportedException(attachmentPosition.ToString()); } }