百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

vkbind

> 编程语言
开源

单文件 Vulkan API 加载器。

198 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

单文件 Vulkan API 加载器。

A single file Vulkan header and API loader.

vkbind is a Vulkan API loader and includes a full implementation of the Vulkan headers (auto-generated from the Vulkan spec) so there's no need for the offical headers or SDK. Unlike the official headers, the platform-specific sections are all contained within the same file.

Usage

For platforms that statically expose all Vulkan APIs you can use vkbind like so:

c
#define VKBIND_IMPLEMENTATION
#include "vkbind.h"

int main()
{
    VkResult result = vkbInit(NULL);
    if (result != VK_SUCCESS) {
        printf("Failed to initialize vkbind.");
        return -1;
    }

    // Do stuff here.

    vkbUninit();
    return 0;
}

For those platforms that do not statically expose all Vulkan APIs, you should do something like this:

…

The code above uses the VkbAPI structure which contains function pointers to all Vulkan APIs. The idea is that you first initialize with vkbInit(), then call vkbInitInstanceAPI() after you've created your Vulkan instance. The VkbAPI object will be filled with usable function pointers at this point (so long as they're supported by the platform). In this example, the instance APIs are bound to global scope using vkbBindAPI(), however if you have multiple instances running at the same time, you should instead invoke the functions directly from the VkbAPI object.

You can also initialize the VkbAPI object from a Vulkan device. This is optional, and is intended as an optimization to avoid the cost of internal dispatching. To use this, you first initialize your VkbAPI object with vkbInitializeInstanceAPI(), then call vkbInitializeDeviceAPI(), passing in the same VkbAPI object.

c
VkbAPI api;
vkbInitInstanceAPI(instance, &api);
vkbInitDeviceAPI(device, &api);
vkbBindAPI(&api);

Examples

You can find some general Vulkan examples in the "examples" folder. The first example, 01_Fundamentals, is completely flat and self contained in a single code file. This is unlike most of the other popular example projects out there which are full of abstractions which make things too hard to follow. It covers most (all?) of the fundamentals any real Vulkan program is going to need, and tries to explain how things like vertex layouts and descriptor sets interact with shaders which I think is something other examples seem to overlook.

For practicality, future examples will not be entirely flat, but should still be significantly better than other popular examples out there in terms of readability.

Note that shaders are pre-compiled with glslangValidator (GLSL to SPIR-V compiler) and embedded into a source file for each example. This is just to avoid the need to worry about file IO for shaders and to focus on Vulkan itself.

License

Public domain or MIT-0 (No Attribution). Choose whichever you prefer.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Candroidapplebindingexamples

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言