Exemplo n.º 1
0
        /// <inheritdoc/>
        protected internal override void OnDestroyed()
        {
            if (ParentTexture != null || isNotOwningResources)
            {
                NativeImage  = VkImage.Null;
                NativeMemory = VkDeviceMemory.Null;
            }

            if (!isNotOwningResources)
            {
                if (NativeMemory != VkDeviceMemory.Null)
                {
                    GraphicsDevice.Collect(NativeMemory);
                    NativeMemory = VkDeviceMemory.Null;
                    SharedHandle = IntPtr.Zero;
                }

                if (NativeImage != VkImage.Null)
                {
                    GraphicsDevice.Collect(NativeImage);
                    NativeImage = VkImage.Null;
                }

                if (NativeBuffer != VkBuffer.Null)
                {
                    GraphicsDevice.Collect(NativeBuffer);
                    NativeBuffer = VkBuffer.Null;
                }

                if (NativeImageView != VkImageView.Null)
                {
                    GraphicsDevice.Collect(NativeImageView);
                    NativeImageView = VkImageView.Null;
                }

                if (NativeColorAttachmentView != VkImageView.Null)
                {
                    GraphicsDevice.Collect(NativeColorAttachmentView);
                    NativeColorAttachmentView = VkImageView.Null;
                }

                if (NativeDepthStencilView != VkImageView.Null)
                {
                    GraphicsDevice.Collect(NativeDepthStencilView);
                    NativeDepthStencilView = VkImageView.Null;
                }
            }

            base.OnDestroyed();
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        protected internal override void OnDestroyed()
        {
            if (ParentTexture != null || isNotOwningResources)
            {
                NativeImage  = SharpVulkan.Image.Null;
                NativeMemory = DeviceMemory.Null;
            }

            if (!isNotOwningResources)
            {
                if (NativeMemory != DeviceMemory.Null)
                {
                    GraphicsDevice.Collect(NativeMemory);
                    NativeMemory = DeviceMemory.Null;
                }

                if (NativeImage != SharpVulkan.Image.Null)
                {
                    GraphicsDevice.Collect(NativeImage);
                    NativeImage = SharpVulkan.Image.Null;
                }

                if (NativeBuffer != SharpVulkan.Buffer.Null)
                {
                    GraphicsDevice.Collect(NativeBuffer);
                    NativeBuffer = SharpVulkan.Buffer.Null;
                }

                if (NativeImageView != ImageView.Null)
                {
                    GraphicsDevice.Collect(NativeImageView);
                    NativeImageView = ImageView.Null;
                }

                if (NativeColorAttachmentView != ImageView.Null)
                {
                    GraphicsDevice.Collect(NativeColorAttachmentView);
                    NativeColorAttachmentView = ImageView.Null;
                }

                if (NativeDepthStencilView != ImageView.Null)
                {
                    GraphicsDevice.Collect(NativeDepthStencilView);
                    NativeDepthStencilView = ImageView.Null;
                }
            }

            base.OnDestroyed();
        }
Exemplo n.º 3
0
        /// <inheritdoc/>
        protected internal override void OnDestroyed()
        {
            GraphicsDevice.RegisterBufferMemoryUsage(-SizeInBytes);

            if (NativeBufferView != BufferView.Null)
            {
                GraphicsDevice.Collect(NativeBufferView);
                NativeBufferView = BufferView.Null;
            }

            if (NativeBuffer != SharpVulkan.Buffer.Null)
            {
                GraphicsDevice.Collect(NativeBuffer);
                NativeBuffer = SharpVulkan.Buffer.Null;
            }

            if (NativeMemory != DeviceMemory.Null)
            {
                GraphicsDevice.Collect(NativeMemory);
                NativeMemory = DeviceMemory.Null;
            }

            base.OnDestroyed();
        }