/// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public virtual void Dispose()
        {
            D3D11.ResourceView     view     = Interlocked.Exchange(ref _view, null);
            GorgonGraphicsResource resource = Interlocked.Exchange(ref _resource, null);

            if ((view == null) && (resource == null))
            {
                return;
            }

            if (resource != null)
            {
                Log.Print($"Resource View '{resource.Name}': Releasing D3D11 resource view.", LoggingLevel.Simple);

                if (OwnsResource)
                {
                    Log.Print($"Resource View '{resource.Name}': Releasing D3D11 Resource {resource.ResourceType} because it owns it.", LoggingLevel.Simple);
                    resource.Dispose();
                }
            }

            view?.Dispose();

            GC.SuppressFinalize(this);
        }
 /// <summary>
 /// Function to initialize the buffer view.
 /// </summary>
 internal void CreateNativeView()
 {
     _view = OnCreateNativeView();
     Debug.Assert(_view != null, "No view was created.");
 }