{"id":13731775,"url":"https://github.com/mackron/vkbind","last_synced_at":"2025-04-05T05:08:39.415Z","repository":{"id":48142914,"uuid":"155969099","full_name":"mackron/vkbind","owner":"mackron","description":"Single file Vulkan API loader.","archived":false,"fork":false,"pushed_at":"2025-03-24T02:32:16.000Z","size":3187,"stargazers_count":168,"open_issues_count":0,"forks_count":7,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-29T04:11:17.435Z","etag":null,"topics":["android","apple","binding","examples","linux","loader","moltenvk","public-domain","single-file","vulkan","win32","windows"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mackron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-11-03T09:36:48.000Z","updated_at":"2025-03-24T02:32:19.000Z","dependencies_parsed_at":"2024-12-14T15:05:38.418Z","dependency_job_id":"ef38032a-b1d2-4d8d-9a7a-dbc11a7b6f06","html_url":"https://github.com/mackron/vkbind","commit_stats":null,"previous_names":["dr-soft/vkbind"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackron%2Fvkbind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackron%2Fvkbind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackron%2Fvkbind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackron%2Fvkbind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mackron","download_url":"https://codeload.github.com/mackron/vkbind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289428,"owners_count":20914464,"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":["android","apple","binding","examples","linux","loader","moltenvk","public-domain","single-file","vulkan","win32","windows"],"created_at":"2024-08-03T02:01:38.175Z","updated_at":"2025-04-05T05:08:39.392Z","avatar_url":"https://github.com/mackron.png","language":"C","readme":"\n\u003ch4 align=\"center\"\u003eA single file Vulkan header and API loader.\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://discord.gg/9vpqbjU\"\u003e\u003cimg src=\"https://img.shields.io/discord/712952679415939085?label=discord\u0026logo=discord\u0026style=flat-square\" alt=\"discord\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://fosstodon.org/@mackron\"\u003e\u003cimg src=\"https://img.shields.io/mastodon/follow/109293691403797709?color=blue\u0026domain=https%3A%2F%2Ffosstodon.org\u0026label=mastodon\u0026logo=mastodon\u0026style=flat-square\" alt=\"mastodon\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nvkbind is a Vulkan API loader and includes a full implementation of the Vulkan headers (auto-generated from the\nVulkan spec) so there's no need for the offical headers or SDK. Unlike the official headers, the platform-specific\nsections are all contained within the same file.\n\n\nUsage\n=====\nFor platforms that statically expose all Vulkan APIs you can use vkbind like so:\n```c\n#define VKBIND_IMPLEMENTATION\n#include \"vkbind.h\"\n\nint main()\n{\n    VkResult result = vkbInit(NULL);\n    if (result != VK_SUCCESS) {\n        printf(\"Failed to initialize vkbind.\");\n        return -1;\n    }\n\n    // Do stuff here.\n\n    vkbUninit();\n    return 0;\n}\n```\nFor those platforms that do not statically expose all Vulkan APIs, you should do something like this:\n```c\n#define VKBIND_IMPLEMENTATION\n#include \"vkbind.h\"\n\nint main()\n{\n    VkbAPI api;\n    VkResult result = vkbInit(\u0026api);\n    if (result != VK_SUCCESS) {\n        printf(\"Failed to initialize vkbind.\");\n        return -1;\n    }\n    \n    // ... Create your Vulkan instance here (vkCreateInstance) ...\n\n    result = vkbInitInstanceAPI(instance, \u0026api);\n    if (result != VK_SUCCESS) {\n        printf(\"Failed to initialize instance API.\");\n        return -2;\n    }\n\n    result = vkbBindAPI(\u0026api);  // \u003c-- Optional. Can call APIs directly like api.vkDestroyInstance().\n    if (result != VK_SUCCESS) {\n        printf(\"Failed to bind instance API.\");\n        return -3;\n    }\n\n    // Do stuff here.\n\n    vkbUninit();\n    return 0;\n}\n```\nThe code above uses the `VkbAPI` structure which contains function pointers to all Vulkan APIs. The idea is that you\nfirst initialize with `vkbInit()`, then call `vkbInitInstanceAPI()` after you've created your Vulkan instance. The\n`VkbAPI` object will be filled with usable function pointers at this point (so long as they're supported by the platform).\nIn this example, the instance APIs are bound to global scope using `vkbBindAPI()`, however if you have multiple\ninstances running at the same time, you should instead invoke the functions directly from the `VkbAPI` object.\n\nYou can also initialize the `VkbAPI` object from a Vulkan device. This is optional, and is intended as an optimization\nto avoid the cost of internal dispatching. To use this, you first initialize your `VkbAPI` object with\n`vkbInitializeInstanceAPI()`, then call `vkbInitializeDeviceAPI()`, passing in the same `VkbAPI` object.\n```c\nVkbAPI api;\nvkbInitInstanceAPI(instance, \u0026api);\nvkbInitDeviceAPI(device, \u0026api);\nvkbBindAPI(\u0026api);\n```\n\n\nExamples\n========\nYou can find some general Vulkan examples in the \"examples\" folder. The first example, 01_Fundamentals, is completely\nflat and self contained in a single code file. This is unlike most of the other popular example projects out there which\nare full of abstractions which make things too hard to follow. It covers most (all?) of the fundamentals any real Vulkan\nprogram is going to need, and tries to explain how things like vertex layouts and descriptor sets interact with shaders\nwhich I think is something other examples seem to overlook.\n\nFor practicality, future examples will not be entirely flat, but should still be significantly better than other\npopular examples out there in terms of readability. \n\nNote that shaders are pre-compiled with glslangValidator (GLSL to SPIR-V compiler) and embedded into a source file for\neach example. This is just to avoid the need to worry about file IO for shaders and to focus on Vulkan itself.\n\n\nLicense\n=======\nPublic domain or MIT-0 (No Attribution). Choose whichever you prefer.","funding_links":[],"categories":["Graphics"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackron%2Fvkbind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmackron%2Fvkbind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackron%2Fvkbind/lists"}