All Projects → vulkan-go → Vulkan

vulkan-go / Vulkan

Licence: mit
Vulkan API bindings for Go programming language

Programming Languages

c
50402 projects - #5 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Vulkan

Liblava
🌋 A modern and easy-to-use library for the Vulkan API
Stars: ✭ 275 (-50.81%)
Mutual labels:  framework, graphics, vulkan, vulkan-api
Diligentcore
Core functionality of Diligent Engine
Stars: ✭ 263 (-52.95%)
Mutual labels:  graphics, vulkan, vulkan-api
Vktk
Vulkan Toolkit
Stars: ✭ 32 (-94.28%)
Mutual labels:  graphics, vulkan, vulkan-api
Bgfx
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
Stars: ✭ 10,252 (+1733.99%)
Mutual labels:  graphics, vulkan, vulkan-api
Renderdoc
RenderDoc is a stand-alone graphics debugging tool.
Stars: ✭ 5,969 (+967.8%)
Mutual labels:  graphics, vulkan, vulkan-api
Vulkan Samples
One stop solution for all Vulkan samples
Stars: ✭ 2,009 (+259.39%)
Mutual labels:  graphics, vulkan, vulkan-api
Silk.net
The high-speed OpenAL, OpenGL, Vulkan, and GLFW bindings library your mother warned you about.
Stars: ✭ 534 (-4.47%)
Mutual labels:  graphics, vulkan
makma
Makma is a deferred Vulkan renderer written in C++.
Stars: ✭ 77 (-86.23%)
Mutual labels:  vulkan, vulkan-api
Vuh
Vulkan compute for people
Stars: ✭ 264 (-52.77%)
Mutual labels:  framework, vulkan
Magnum
Lightweight and modular C++11 graphics middleware for games and data visualization
Stars: ✭ 3,728 (+566.91%)
Mutual labels:  graphics, vulkan
Yggdrasil-Legacy
Experimental Vulkan Renderer / Game Engine written in C++20.
Stars: ✭ 20 (-96.42%)
Mutual labels:  vulkan, vulkan-api
Bansheeengine
Modern C++14 game engine with Vulkan support, fully featured editor and C# scripting
Stars: ✭ 2,906 (+419.86%)
Mutual labels:  graphics, vulkan
Dxut
DXUT is a "GLUT"-like framework for Direct3D 11.x Win32 desktop applications; primarily samples, demos, and prototypes.
Stars: ✭ 341 (-39%)
Mutual labels:  framework, graphics
Pumex
Vulkan library oriented on high speed rendering
Stars: ✭ 259 (-53.67%)
Mutual labels:  vulkan, vulkan-api
SFE-Engine
A real time renderer based on Vulkan(LWJGL).
Stars: ✭ 20 (-96.42%)
Mutual labels:  vulkan, vulkan-api
Agi
Android GPU Inspector
Stars: ✭ 327 (-41.5%)
Mutual labels:  graphics, vulkan
Vulkan best practice for mobile developers
Vulkan best practice for mobile developers
Stars: ✭ 424 (-24.15%)
Mutual labels:  graphics, vulkan
Shadergen
Proof-of-concept library for generating HLSL, GLSL, and Metal shader code from C#,
Stars: ✭ 395 (-29.34%)
Mutual labels:  graphics, vulkan
Oreon Engine
OpenGL/Vulkan Java 3D Engine
Stars: ✭ 431 (-22.9%)
Mutual labels:  vulkan, vulkan-api
Gfx
[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
Stars: ✭ 5,045 (+802.5%)
Mutual labels:  graphics, vulkan

Golang Bindings for Vulkan API version-1.1.88 GoDoc

Package vulkan provides Go bindings for Vulkan — a low-overhead, cross-platform 3D graphics and compute API. Updated October 13, 2018 — Vulkan 1.1.88.

Introduction

Vulkan API is the result of 18 months in an intense collaboration between leading hardware, game engine and platform vendors, built on significant contributions from multiple Khronos members. Vulkan is designed for portability across multiple platforms with desktop and mobile GPU architectures.

Read the brief: https://developer.nvidia.com/engaging-voyage-vulkan

The binding allows one to use Vulkan API directly within Go code, avoiding adding lots of C/C++ in the projects, also can be used to study Vulkan without diving too deep into C/C++ language semantics. For me it's just a matter of taste, writing Go code is simply more pleasant experience.

Project history timeline

  • 2016-02-16 Vulkan API publicly released.

  • 2016-03-06 vulkan-go initial commit and first binding.

  • 2016-05-14 Finally received my NVIDIA Shield Tablet K1 (DHL lost the first parcel), I decided to use tablet because it was the first device supporting Vulkan out of the box. And that was a really good implementation, much wow very reference.

  • 2016-05-17 Created android-go project in order to run Vulkan on the android platform.

  • 2016-05-23 First android-go + vulkan program runs on Tablet K1 (screenshot).

  • 2016-05-24 Improved VulkanInfo example runs on Tablet K1 (screenshot).

  • 2016-05-28 android-go released into public (Reddit post) with plenty of examples including GLES/EGL.

  • 2016-08-13 Finished an app that should draw triangle (ported from tri.c from LunarG demos). Draws nothing instead.

  • 2016-08-13 First unsuccessful attempt to write a spinning cube example. More than 25 hours spent, 2.5k lines of C code rewritten into 900 lines of Go code. The reference code was found in some very old LunarG demo, it seems I should've used the latest one.. At least got the validation layers working and found some bugs in the triangle app code.

  • 2016-08-16 First Vulkan API program in Go that draws triangle runs on Tablet K1 (photo), validaton layers work perfectly too.

  • 2016-08-16 Public announce of this project (Reddit post). Reaction was "Meh".

  • 2016-11-01 MoltenVK driver merged into GLFW (see GLFW issue #870) and this made possible to use Vulkan API under Apple OS X or macOS.

  • 2016-11-06 VulkanInfo and VulkanDraw both ported to desktop OS X and use GLFW to initialize Vulkan (screen #1 and screen #2)

  • 2016-11-07 VulkanInfo and VulkanDraw run fine on NVIDIA GTX980 initialized through GLFW under Windows 10 (screen #1 and screen #2).

  • 2016-11-08 VulkanInfo runs in headless (a.k.a computing) mode in Amazon AWS cloud on P2 Instance equipped Tesla K80 (screenshot).

  • 2016-11-09 ios-go project started, it's very easy to run Golang apps on iOS that use custom surface, for my case it was Metal surface.

  • 2016-11-11 VulkanInfo runs fine on my iPhone under iOS (screenshot), and so does VulkanDraw (photo also GPU report from XCode)

  • 2016-11-13 Second unsuccessful attempt to write spinning cube. 25 hours spent. The approach was highly inspired by Mali Vulkan SDK for Android 1.0 and I created initial version of vulkan-go/asche — a higher level framework to simplify Vulkan initialization for new apps.

  • 2016-11-29 Generic Linux support added in using GLFW (Issue #2) thanks @jfreymuth.

  • 2017-05-06 Third, successful attempt to write spining cube example. 16 hours spent, 4K LOC of C code rewritten from cube.c of LunarG demos. The whole process has been screencasted, maybe I will release it one day.

  • 2017-05-06 vulkan-go/asche complete.

  • 2018-10-13 Updated to Vulkan 1.1.88 spec.

vulkan cube golang

See all demos in vulkan-go/demos.

How to use

Usage of this project is straightforward due to the stateless nature of Vulkan API. Just import the package like this:

import vk "github.com/vulkan-go/vulkan"

Set the GetProcAddress pointer (used to look up Vulkan functions) using SetGetInstanceProcAddr or SetDefaultGetInstanceProcAddr. After that you can call Init to initialise the library. For example:

// Using SDL2:
vk.SetGetInstanceProcAddr(sdl.VulkanGetVkGetInstanceProcAddr())

// OR using GLFW:
vk.SetGetInstanceProcAddr(glfw.GetVulkanGetInstanceProcAddress())

// OR without using a windowing library (Linux only, recommended for compute-only tasks)
if err := vk.SetDefaultGetInstanceProcAddr(); err != nil {
    panic(err)
}

if err := vk.Init(); err != nil {
    panic(err)
}

And you're set. I must warn you that using the API properly is not an easy task at all, so beware and follow the official documentation: https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html

In order to simplify development, I created a high-level framework that manages Vulkan platform state and initialization. It is called asche because when you throw a gopher into volcano you get a pile of ash. Currently it's used in VulkanCube demo app.

Validation Layers

A good brief of the current state of Vulkan validation layers: Explore the Vulkan Loader and Validation Layers (PDF).

There is a full support of validation layers with custom callbacks in Go. For my Android experiments I got the standard pack of layers from https://github.com/LunarG/VulkanTools and built them like this:

$ cd build-android
$ ./update_external_sources_android.sh
$ ./android-generate.sh
$ ndk-build

After that you'd copy the objects to android/jni/libs in your project and activate the ValidationLayers.mk in your Android.mk so when building APK they will be copied alongside with your shared library. It just works then:

[INFO] Instance extensions: [VK_KHR_surface VK_KHR_android_surface]
[INFO] Instance layers: [VK_LAYER_LUNARG_screenshot VK_LAYER_GOOGLE_unique_objects VK_LAYER_LUNARG_api_dump VK_LAYER_LUNARG_image VK_LAYER_LUNARG_core_validation VK_LAYER_LUNARG_object_tracker VK_LAYER_GOOGLE_threading VK_LAYER_LUNARG_parameter_validation VK_LAYER_LUNARG_swapchain]

[Layer Swapchain][ERROR 4] The surface in pCreateInfo->surface, that was given to vkCreateSwapchainKHR(), must be a surface that is supported by the device as determined by vkGetPhysicalDeviceSurfaceSupportKHR().  However, vkGetPhysicalDeviceSurfaceSupportKHR() was never called with this surface.

[Layer Swapchain][ERROR 10] vkCreateSwapchainKHR() called with a non-supported pCreateInfo->compositeAlpha (i.e. VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR).  Supported values are:
     VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR

[Layer DS][ERROR 8] Attempt to set lineWidth to 0.000000 but physical device wideLines feature not supported/enabled so lineWidth must be 1.0f!

[Layer DS][ERROR 22] Unable to allocate 2 descriptors of type VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER from pool 0x1c. This pool only has 1 descriptors of this type remaining.

Useful links

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].