maierfelix/nvk

Drop Vk and VK_ prefixes?

frzi opened this issue ยท 1 comments

frzi commented

I fully understand this can be considered a controversial idea. ๐Ÿ˜…

In the examples I see the following code used quite often:

import nvk from 'nvk';

Object.assign(global, nvk);

By dropping the Vk and VK_ prefixes the following code might be considered more clean to Javascript (and Typescript) users:

import * as vk from 'nvk';

const buffer = new vk.Buffer();

const bufferInfo = new vk.bufferCreateInfo();
bufferInfo.sType = vk.STRUCTURE_TYPE_BUFFER_CREATE_INFO;

The above code shares the same fashion as WebGL's often used terminology, where everything is housed under a gl namespace:

const buffer = gl.createBuffer(gl.ARRAY_BUFFER)

Not only that, this should also help IDEs (e.g. Visual Studio Code and Atom) with autocomplete and error checking, making the library more accessible to everyone.

--
Thanks for your time bringing Vulkan to the Javascript audience with nvk!

This project's goal is to be as close as possible to Vulkan. Any kind of abstraction can be done in a separate library