/// <summary> /// Frees all graphics resources used by the renderer. /// </summary> public void Dispose() { _vertexBuffer.Dispose(); _indexBuffer.Dispose(); _projMatrixBuffer.Dispose(); _fontTexture.Dispose(); _fontTextureView.Dispose(); _vertexShader.Dispose(); _fragmentShader.Dispose(); _layout.Dispose(); _pipeline.Dispose(); _resourceSet.Dispose(); }
public static void DisposeResources() { if (!initialized) { return; } try { RenderUtilities.DisposeAllUtils(); uniform0.Dispose(); graphicsDevice.Dispose(); initialized = false; } catch (Exception ex) { Console.WriteLine(ex); } }
internal void Write <T>(string v, T mYBuffer) where T : struct { var Value = myIDsToItems[v]; var MVPBuffer = new UniformBuffer <T>(mYBuffer); WriteDescriptorSet mySet = new WriteDescriptorSet(); mySet.DescriptorType = DescriptorType.UniformBuffer; mySet.DescriptorCount = Value.DescriptorCount; mySet.DstBinding = Value.Binding; mySet.DstSet = myDSet[Value.Binding]; unsafe { mySet.BufferInfo = new DescriptorBufferInfo[] { new DescriptorBufferInfo { Buffer = MVPBuffer, Offset = 0, Range = MVPBuffer.SizeOfBuffer } }; } VulkanRenderer.SelectedLogicalDevice.UpdateDescriptorSet(mySet, null); MVPBuffer.Dispose(); mySet.Dispose(); }
/// <summary> /// Dispose resources allocated by <see cref="Create(GraphicsContext, ShaderProgram)"/>. /// </summary> public override void Delete() { if (_UniformBuffer != null) { _UniformBuffer.Dispose(); _UniformBuffer = null; } Dictionary <string, UniformStateMember> uniformState = UniformState; foreach (KeyValuePair <string, UniformStateMember> pair in uniformState) { if (pair.Value.GetUniformType().GetInterface("IGraphicsResource") == null) { continue; } IGraphicsResource graphicsResource = pair.Value.GetUniformValue(this) as IGraphicsResource; if (graphicsResource == null) { continue; } } }