{"id":21182475,"url":"https://github.com/ab4d/vma-cs","last_synced_at":"2025-04-13T17:04:47.037Z","repository":{"id":144216818,"uuid":"206175441","full_name":"ab4d/VMA-CS","owner":"ab4d","description":"C# wrapper for the Vulkan Memory Allocator library","archived":false,"fork":false,"pushed_at":"2020-06-23T08:28:09.000Z","size":412,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T17:04:13.629Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ab4d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-03T21:28:20.000Z","updated_at":"2024-05-08T22:21:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"a40e9bf3-6c03-46ba-8e0f-cb64504e8f9d","html_url":"https://github.com/ab4d/VMA-CS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ab4d%2FVMA-CS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ab4d%2FVMA-CS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ab4d%2FVMA-CS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ab4d%2FVMA-CS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ab4d","download_url":"https://codeload.github.com/ab4d/VMA-CS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750074,"owners_count":21155685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T17:57:08.302Z","updated_at":"2025-04-13T17:04:47.031Z","avatar_url":"https://github.com/ab4d.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VMA-CS\nC# wrapper for the Vulkan Memory Allocator (VMA) library\n(https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)\n\nThe Vulkan Memory Allocator (VMA) library provides a simple and easy to integrate API to help you allocate memory for Vulkan buffer and image storage.\n\nThis project contains a VMA.cs file that can be included in your project and provides a .Net wrapper for the native VMA library.\n\n\n## Native VMA library\n\nVMA library is originally defined in a single C++ header file (vk_mem_alloc.h). To use it in a .Net project, the library needs to be compiled into a native dll. \n\nThis project comes with a precompiled library for win-x86 and win-x64 (**see compile-vma folder**).\nThere are also instructions and windows bat files to compile newer versions of the library or versions with different #define options.\n\n\n## Usage\n\nTo use the VMA library in a .Net project, copy the VMA.cs file from this project to your project.\nThen add the native vk_mem_alloc.dll to the output path of your project (use the version for your target platform).\n\nThe following code shows a usage sample with VulkanSharp library (https://github.com/mono/VulkanSharp):\n\n```csharp\nprivate void TestVma(Device vulkanDevice, PhysicalDevice physicalDevice)\n{\n    var vmaAllocatorCreateInfo = new VMA.VmaAllocatorCreateInfo()\n    {\n        device         = ((IMarshalling)vulkanDevice).Handle,\n        physicalDevice = ((IMarshalling)physicalDevice).Handle\n    };\n\n    var result = (Vulkan.Result)VMA.vmaCreateAllocator(ref vmaAllocatorCreateInfo, out var allocatorPtr);\n\n    if (result != Result.Success)\n    {\n        // Cannot create VMA allocator\n    }\n\n\n    var allocatorCreateInfo = new VMA.VmaAllocationCreateInfo()\n    {\n        usage = VMA.VmaMemoryUsage.VMA_MEMORY_USAGE_GPU_ONLY\n    };\n\n    var bufferCreateInfo = new BufferCreateInfo()\n    {\n        Size = 65536,\n        Usage = BufferUsageFlags.VertexBuffer | BufferUsageFlags.TransferDst\n    };\n\n    result = (Vulkan.Result)VMA.vmaCreateBuffer(allocatorPtr, ((IMarshalling)bufferCreateInfo).Handle, ref allocatorCreateInfo, out var pBuffer, out var pAllocation, IntPtr.Zero);\n\n\n    if (result == Result.Success)\n    {\n        // Use the pBuffer ...\n\n        VMA.vmaDestroyBuffer(allocatorPtr, pBuffer, pAllocation); // Dispose pBuffer and pAllocation\n    }\n\n    VMA.vmaDestroyAllocator(allocatorPtr);\n}\n```\n\n\n## Contributors\n\nThis project was created by Caleb Cornett (TheSpydog) - https://github.com/TheSpydog\n\nThe development is continued by Andrej Benedik (AB4D) - https://github.com/ab4d\n\nAB4D company works on advanced 3D visualizations for .Net. See https://www.ab4d.com for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fab4d%2Fvma-cs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fab4d%2Fvma-cs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fab4d%2Fvma-cs/lists"}