# vulkan_bun_helloworld

> Vulkan example in Bun with GLFW.

Latest version **0.1.0** (published 2022-12-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install vulkan_bun_helloworld
pnpm add vulkan_bun_helloworld
yarn add vulkan_bun_helloworld
bun add vulkan_bun_helloworld
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2022-12-17 |
| First published | 2022-12-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 49.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | David M. |
| Maintainers | davidmanzanares |
| Keywords | bun, vulkan, glfw, helloworld |

## Links

- npm: https://www.npmjs.com/package/vulkan_bun_helloworld
- npm.io page: https://npm.io/package/vulkan_bun_helloworld

## Dependencies (2)

- [glfw4bun](https://npm.io/package/glfw4bun.md) 0.1.0
- [vulkan4bun](https://npm.io/package/vulkan4bun.md) 0.1.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2022-12-17

## README

# vulkan_bun_helloworld

*vulkan_bun_helloworld* is a [Vulkan](https://www.vulkan.org/) helloworld program that runs in [Bun](https://bun.sh/).

*vulkan_bun_helloworld* uses:
- [*vulkan4bun*](https://github.com/davidmanzanares/vulkan4bun)
- [*glfw4bun*](https://github.com/davidmanzanares/glfw4bun)

Which are bindings generated with [makebindingsforbun](https://github.com/davidmanzanares/makebindingsforbun).

The code is a simplification of the [Vulkan tutorial](https://vulkan-tutorial.com/).

## Running

`
bun install
bun helloworld.ts
`

If everything works you will see a colored static triangle, FPS and logs will be shown in the terminal:

![working example](https://github.com/davidmanzanares/vulkan_bun_helloworld/blob/master/result.png?raw=true)


## Dependencies

*vulkan4bun* and *glfw4bun* are pure javascript libraries that use Bun FFI to dynamically load necessary Vulkan and GLFW symbols. Therefore, the only requirements are:
- Bun
- vulkan4bun and glfw4bun
- Vulkan loader (vulkan.so.1) in the expected path (`/usr/lib/x86_64-linux-gnu/libvulkan.so.1`)
- A Vulkan-enabling GPU driver

## Limitations

*makebindingsforbun* is experimental, making generated bindings experimental too. Only Linux and the AMD64 arch are supported. Ergonomics could be improved if *makebindingsforbun* generated typescript definitions.

## Why

Apart from because it's fun, Javascript under Bun is probably the fastest runtime for a scripting language. Bun also promises a very low cost on making FFI calls.

Additionally, GPU intensive programs can easily be bottlenecked in the GPU, reducing the real cost of using slower languages than C/C++/Rust.

---
_Source: https://npm.io/package/vulkan_bun_helloworld · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
