vulkan-node
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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}`);
}

Package Sidebar

Install

npm i vulkan-node

Weekly Downloads

16

Version

0.1.0

License

MIT

Unpacked Size

9.02 MB

Total Files

19

Last publish

Collaborators

  • achlubek