{"id":23118780,"url":"https://github.com/jpbruyere/vkhelpers","last_synced_at":"2025-08-16T23:31:48.360Z","repository":{"id":27355167,"uuid":"113581581","full_name":"jpbruyere/vkhelpers","owner":"jpbruyere","description":"Vulkan c helper library","archived":false,"fork":false,"pushed_at":"2025-08-04T09:58:22.000Z","size":562,"stargazers_count":33,"open_issues_count":5,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-04T13:47:11.539Z","etag":null,"topics":["c","helper","multiplatform","vulkan"],"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/jpbruyere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2017-12-08T14:14:09.000Z","updated_at":"2025-04-23T23:04:05.000Z","dependencies_parsed_at":"2022-09-20T07:11:16.957Z","dependency_job_id":"836f775e-a277-4ed9-aa8d-44da021a573c","html_url":"https://github.com/jpbruyere/vkhelpers","commit_stats":{"total_commits":124,"total_committers":4,"mean_commits":31.0,"dds":"0.040322580645161255","last_synced_commit":"3b64b87a871cd7652a4b6abc97d26f766c532e82"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jpbruyere/vkhelpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpbruyere%2Fvkhelpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpbruyere%2Fvkhelpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpbruyere%2Fvkhelpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpbruyere%2Fvkhelpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpbruyere","download_url":"https://codeload.github.com/jpbruyere/vkhelpers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpbruyere%2Fvkhelpers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269781085,"owners_count":24474784,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c","helper","multiplatform","vulkan"],"created_at":"2024-12-17T05:21:31.930Z","updated_at":"2025-08-16T23:31:48.091Z","avatar_url":"https://github.com/jpbruyere.png","language":"C++","funding_links":["https://www.paypal.me/GrandTetraSoftware"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  Vulkan Helpers\n  \u003cbr\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.paypal.me/GrandTetraSoftware\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Donate-PayPal-green.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003c/h1\u003e\n\nSmall personal helper library for [Vulkan](https://www.khronos.org/vulkan/) usage in **c**.\nSimplify several common tasks, as image or buffers handling, swapchain initialization, etc.\n\n**vkh**  is used by [vkvg] internally and also to speed up vulkan context creation in samples.\n\n### Building from source\n\n```bash\ngit clone https://github.com/jpbruyere/vkhelpers.git\ncd vkhelpers\nmkdir build\ncd build\ncmake ..\nmake \u0026\u0026 make install\n```\n\n### Adding vkh to your CMake project\n\n- clone vkh as a subdirectory of your root dir.\n- in your main CMakeFile, add `add_subdirectory (vkhelpers)`\n- add to your **TARGET_INCLUDE_DIRECTORIES** `${CMAKE_CURRENT_SOURCE_DIR}/vkhelpers/include` and if you want to bypass opaque pointers and be able to address\nfields of internal structures, add also `${CMAKE_CURRENT_SOURCE_DIR}/vkhelpers/src`.\n- to link vkh staticaly, add to **TARGET_LINK_LIBRARIES** `vkh_static` or `vkh_shared` to link it as a shared library.\n\n### Quick howto:\n\n##### Create instance\n```c\n#include \"vkh.h\"\n#include \"vkh_phyinfo.h\"\n\nvoid init_vulkan () {\n  const char* layers [] = {\"VK_LAYER_KHRONOS_validation\"};\n  const char* exts [] = {\"VK_EXT_debug_utils\"};\n\t\n  VkhApp app = vkh_app_create (\"appname\", 1, layers, 1, exts);\n```\n##### Select physical device\n\n**VkhPhyInfo** is an helper structure that will store common usefull physical device informations, queues flags, memory properties in a single call for all the devices present on the machine.\n```c\n   VkhPhyInfo* phys = vkh_app_get_phyinfos (e-\u003eapp, \u0026phyCount, surf);\n```\nOnce you have an array of VkhPhyInfo's, you have several functions to inspect available devices:\n```c\nfor (uint i=0; i\u003cphyCount; i++) {\n  //check VkPhysicalDeviceProperties\n  VkPhysicalDeviceProperties pdp = vkh_phyinfo_get_properties (phys[i]);\n  //get VkPhysicalDeviceMemoryProperties\n  VkPhysicalDeviceMemoryProperties mp = vkh_phyinfo_get_memory_properties (phys[i]);\n  //get queue properties\n  VkQueueFamilyProperties* vkh_phyinfo_get_queues_props(phys[i], \u0026qCount);\n}\n```\nVkhPhyInfo structure has the array of **VkQueueFamilyProperties** that has already been parsed two times to detect available queues types. First vkh will try to find a dedicated queue for each queue type (Graphics, Transfer, Compute) and if a type has no dedicated candidate, it will try to find a queue with the requested flag among others. Also, if you submit a valid **VkSurfaceKHR** to `vkh_app_get_phyinfos`, presentation support will be queried for all graphics queues. The result of this search may be fetched with:\n```c\nvkh_phyinfo_get_queue_fam_indices (phy, \u0026presentQ, \u0026graphQ, \u0026transQ, \u0026compQ);\n```\nvkh has one function per queue type that uses the result of this search. They may be safely called for checking queue availability, they will return false on failure. On success, the queue count of the `VkQueueFamilyProperties` of PhyInfo will be decreased.\n```c\n\tif (vkh_phyinfo_create_presentable_queues (pi, 1, qPriorities, \u0026pQueueInfos[qCount]))\n\t\tqCount++;\n\tif (vkh_phyinfo_create_compute_queues (pi, 1, qPriorities, \u0026pQueueInfos[qCount]))\n\t\tqCount++;\n\tif (vkh_phyinfo_create_transfer_queues (pi, 1, qPriorities, \u0026pQueueInfos[qCount]))\n\t\tqCount++;\n```\nTo override the vkh default queue selection, create queues with your own family index:\n```c\nvkh_phyinfo_create_queues (phy, qFam, queueCount, priorities, \u0026qInfo);\n```\nBe aware that the queue count of the vkhinfo structure is decreased to keep track of remaining queues.\nPhyInfo pointer has to be freed when no longuer in use. Usualy at the end of the vulkan initialization.\n```c\nvkh_app_free_phyinfos  (phyCount, phys);\n```\n##### Create Logical Device\n\n```c\nchar const * dex [] = {\"VK_KHR_swapchain\"};\nVkPhysicalDeviceFeatures enabledFeatures = { .fillModeNonSolid = true };\nVkDeviceCreateInfo device_info = {\n  .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,\n  .queueCreateInfoCount = qCount,\n  .pQueueCreateInfos = (VkDeviceQueueCreateInfo*)\u0026pQueueInfos,\n  .enabledExtensionCount = enabledExtsCount,\n  .ppEnabledExtensionNames = dex,\n  .pEnabledFeatures = \u0026enabledFeatures};\nVkhDevice dev = vkh_device_create(e-\u003eapp, pi, \u0026device_info);\n```\n##### The Presenter\nVkhPresenter will help getting rapidly something on screen, it handles the swapchain.\n```c\nVkhPresenter present = vkh_presenter_create (dev, pi-\u003epQueue, surf, width, height, VK_FORMAT_B8G8R8A8_UNORM, VK_PRESENT_MODE_MAILBOX_KHR);\n//create a blitting command buffer per swapchain images with\nvkh_presenter_build_blit_cmd (present, vkvg_surface_get_vk_image(surf), width, height);\nwhile (running) {\n  if (!vkh_presenter_draw (present))\n    //on draw failed, swapchain is automatically rebuilt\n    vkh_presenter_build_blit_cmd (present, vkvg_surface_get_vk_image(surf), width, height);\n}\n```\n##### Creating Images\nTODO\n##### Creating Buffers\nTODO\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpbruyere%2Fvkhelpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpbruyere%2Fvkhelpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpbruyere%2Fvkhelpers/lists"}