Пример #1
0
        protected override void Destroy()
        {
            for (int i = 0; i < VertexBufferCount; i++)
            {
                vertexBuffers[i].Dispose();
            }

            activeVertexBufferIndex = -1;

            mappedVertexBufferPointer = IntPtr.Zero;

            if (indexBuffer != null)
            {
                indexBuffer.Dispose();
                indexBuffer = null;
            }

            indexBufferBinding = null;
            pipelineState      = null;

            if (simpleEffect != null)
            {
                simpleEffect.Dispose();
                simpleEffect = null;
            }

            for (int i = 0; i < VertexBufferCount; i++)
            {
                inputElementDescriptions[i] = null;
            }

            charsToRenderCount = -1;

            base.Destroy();
        }
        private unsafe void ReleaseDevice()
        {
            EmptyTexelBuffer.Dispose();
            EmptyTexelBuffer = null;

            EmptyTexture.Dispose();
            EmptyTexture = null;

            // Wait for all queues to be idle
            nativeDevice.WaitIdle();

            // Destroy all remaining fences
            GetCompletedValue();

            // Mark upload buffer for destruction
            if (nativeUploadBuffer != SharpVulkan.Buffer.Null)
            {
                NativeDevice.UnmapMemory(nativeUploadBufferMemory);
                nativeResourceCollector.Add(lastCompletedFence, nativeUploadBuffer);
                nativeResourceCollector.Add(lastCompletedFence, nativeUploadBufferMemory);

                nativeUploadBuffer       = SharpVulkan.Buffer.Null;
                nativeUploadBufferMemory = DeviceMemory.Null;
            }

            // Release fenced resources
            nativeResourceCollector.Dispose();
            DescriptorPools.Dispose();

            nativeDevice.DestroyCommandPool(NativeCopyCommandPool);
            nativeDevice.Destroy();
        }
Пример #3
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public override void Dispose()
        {
            if (VertexBuffer != null && !VertexBuffer.IsDisposed)
            {
                VertexBuffer.Dispose();
            }

            if (effect != null && !effect.IsDisposed)
            {
                effect.Dispose();
            }
        }
        private bool NeedToRecreateBuffer(Xenko.Graphics.Buffer buf, int count)
        {
            if (buf == null || buf.ElementCount != count)
            {
                if (buf != null)
                {
                    buf.Dispose();
                }

                return(true);
            }
            return(false);
        }
Пример #5
0
        public static bool DisposeBufferBySpecs(Xenko.Graphics.Buffer buf, int count)
        {
            if (buf == null || buf.ElementCount != count)
            {
                if (buf != null)
                {
                    buf.Dispose();
                }

                return(true);
            }
            return(false);
        }
Пример #6
0
        public void Dispose()
        {
            performStage = null;

            if (_vertexBuffer != null)
            {
                _vertexBuffer.Dispose();
            }
            if (_indexBuffer != null)
            {
                _indexBuffer.Dispose();
            }

            _vertexBuffer = null;
            _indexBuffer  = null;
        }
Пример #7
0
        protected override void Destroy()
        {
            foreach (var renderFeature in RenderFeatures)
            {
                renderFeature.Dispose();
            }

            RenderFeatures.CollectionChanged -= RenderFeatures_CollectionChanged;

            descriptorSets.Dispose();

            emptyBuffer?.Dispose();
            emptyBuffer = null;

            base.Destroy();
        }
Пример #8
0
        public void Dispose()
        {
            performStage = null;

            if (_vertexBuffer != null)
            {
                _vertexBuffer.DestroyNow();
                _vertexBuffer.Dispose();
                Disposed++;
            }
            if (_indexBuffer != null)
            {
                _indexBuffer.DestroyNow();
                _indexBuffer.Dispose();
            }

            _vertexBuffer = null;
            _indexBuffer  = null;
        }