/shvulkan

A lightweight and flexible wrapper around the Vulkan API written in C. The library handles part of the boilerplate code expected to be set up by the Vulkan API.

Primary LanguageCGNU General Public License v3.0GPL-3.0

shvulkan

[TOC]

shvulkan is a lightweight and flexible wrapper around the Vulkan API written completely in C, that makes it easier to work with graphics efficiently without writing thousands of lines of code.

Scene example: alfa blending, instancing and indexed draw calls example.

Headless scene example using vulkan-virtual-outputs: alfa blending, instancing and indexed draw calls also here, but the images are streamed in an http server.


Build status

The examples are frequently being tested on Windows 11, Linux Mint (virtual machine and pc) with different compilers (MSVC, gcc), and hardware configurations (RX580 4GB GDDR5, Radeon V Carrizo 500MB).

Clone and Build

Open the terminal and run the following commands:

git clone --recursive https://github.com/mrsinho/shvulkan.git
cd shvulkan
mkdir build
cd build
cmake -DSH_VULKAN_BUILD_EXAMPLES=ON ..
cmake --build .

CMake targets and variables

CMake Target Type Configure Flags
shvulkan library /
shvulkan-docs Doxygen outputs /
shvulkan-clear-color executable SH_VULKAN_BUILD_EXAMPLES=ON
shvulkan-scene executable SH_VULKAN_BUILD_EXAMPLES=ON
shvulkan-compute-example executable SH_VULKAN_BUILD_EXAMPLES=ON

If the cmake option SH_VULKAN_BUILD_EXAMPLES is enabled, the additional glfw target will be generated as a static library.

CMake Variable About
SH_VULKAN_VERSION Version of the shvulkan library
SH_VULKAN_ROOT_DIR Absolute path to the root of the repository directory
SH_VULKAN_BINARIES_DIR Absolute path to the output binaries directory

Embed shvulkan with your C/C++ projects

To link to the shvulkan library with CMake:

if (NOT TARGET shvulkan)

set(SH_VULKAN_ROOT_DIR     path/to/shvulkan/root/directory)
set(SH_VULKAN_BINARIES_DIR path/your/binaries/directory)

include(${SH_VULKAN_ROOT_DIR}/shvulkan/shvulkan.cmake)
build_shvulkan()

endif()

# [...]

target_link_libraries(app PUBLIC shvulkan)

Then, include the shVulkan.h header file:

#include <shvulkan/shVulkan.h">

Examples

shvulkan ships with one compute example, one graphics clear color example, one graphics scene example and a headless scene graphics example, which instead of presenting images to the screen it streams the graphics output with an http server.