vulkan-node
v0.1.0
Published
Vulkan API wrapper for Node.js with TypeScript support
Downloads
6
Maintainers
Readme
Vulkan-Node - Vulkan API wrapper for Node
+ TypeScript support!
This project is a generated wrapper for Vulkan API for use in Node.js. Features full typing for TypeScript as well.
Specification version: 1.3.250.1
Generated by: https://github.com/achlubek/parsing-vulkan-spec
Generated with version commit: 90c13b99d2226129b684cfc200410a5c936659e6
Generated at: Wed, 30 Aug 2023 19:19:51 GMT
How to use
There are a lot of usage examples here: https://github.com/achlubek/aero-graphics/tree/master/src/vulkan
Here is a very simple example showing how to create an instance:
import * as vk from "vulkan-node";
const appInfo: vk.VkApplicationInfo = {
pApplicationName: "Hello World",
applicationVersion: vk.VK_MAKE_VERSION(1, 0, 0),
pEngineName: "My Engine",
engineVersion: vk.VK_MAKE_VERSION(1, 0, 0),
apiVersion: vk.VK_API_VERSION_1_0,
};
const instanceExtensionsWithValidation: string[] = [
//
];
const layersWithValidation: string[] = [
//
];
const instanceCreateInfo: vk.VkInstanceCreateInfo = {
pApplicationInfo: appInfo,
enabledExtensionCount: instanceExtensionsWithValidation.length,
ppEnabledExtensionNames: instanceExtensionsWithValidation,
enabledLayerCount: layersWithValidation.length,
ppEnabledLayerNames: layersWithValidation,
};
const instance = new vk.VkInstance(); // handle will be stored here
const res = vk.vkCreateInstance({
pCreateInfo: instanceCreateInfo,
pInstance: instance,
});
if (res !== vk.VkResult.VK_SUCCESS) {
throw new Error(`Instance initialization failed with error ${res}`);
}