Skip to content
/ vkpp Public

vkpp is a low-level, header-only Vulkan C++ bindings.

License

Notifications You must be signed in to change notification settings

po2xel/vkpp

Repository files navigation

vkpp: C++ Bindings for Vulkan

vkpp is a header only C++ bindings for the Vulkan C API aiming to improve the developers' experience and efficiency without introducing extra runtime costs.

A Visual Studio 2017 solution file for compiling all examples is included with the repository.
Both the vkpp library and the examples use C++17 new features.

Coming soon.

Coming soon.

Examples

The examples are used to verify and demonstrate the correctness, efficiency and effectiveness of vkpp.
They are also used as baselines to prevent regressions.

Note: The examples below are originally created by SaschaWillems. I rewrite some of the examples in order to verify vkpp's correctness, efficiency and effectiveness.

Draw a simple gradient triangle using staging buffers.

Vertex and index data are mapped to host visible memory (staging buffers) before they are transferred to device local memory.

Three different pipeline state objects are used here for rendering the same scene with different visual effects.

Texture data, including all mip-levels, is mapped to host visible memory (staging buffer) before it is transferred to device local optimal image memory.

A cube map is a special type of image that allows groups of six layers of an array image to be interpreted as the side of a cube.
The faces are ofter noted as the -X, +X, -Y, +Y, -Z and +Z faces. These are the six faces of a cube map and a group of six consecutive array layers can be interpreted in that order.

Note that the number of layers in the array doesn't have to be a multiple of 6, but it has to be at least 6.

Texture arrays allow storing of multiple images in different layers without any interpolation among the layers.
2D array texture is different from a 3D texture in that linear filtering can be performed in the z direction in a 3D texture, whereas filtering cannot be performed across multiple layers in an array image.

Uses assimp to load a mesh from a common 3D format. The mesh data is then converted to a fixed layout matching the shader vertex attribute bindings.<br

Voyager 1 and 2 are the most distant human-made objects. They are exploring where nothing from Earth has flown before.

Demonstrates the use of dynamic uniform buffers for rendering multiple objects with different matrices from one big uniform buffer object. Sets up one bug uniform buffer that contains multiple model matrices that are dynamically addressed upon descriptor binding time.
This minimizes the number of descriptor sets required and may help in optimizing memory writes by e.g. only doing partial updates to that memory.
It is very practical to use when sub-allocating uniform buffers from a larger buffer allocation.

Push Constants are uniform values that are stored within the CommandBuffer and can be accessed from the shaders similar to a single global uniform buffer. They provide enough bytes to hold some matrices or index values and the interpretation of the raw data is up the shader. The values are recorded with the CommandBuffer and cannot be altered afterwards.

Specialization Constants are used to specify shader constants at pipeline creation time.
Shader bindings based on specialization constants are marked by the new constant_id layout qualifier. For example:

    layout (constant_id = 0) const int LightModel = 0;

Specialization info is assigned as part of the shader stage and must be set after creating the shader module and before creating the pipeline.

Demonstrates the use of offscreen framebuffer with color and depth attachments. The color attachment of the first render pass is used as the sampler texture of the second render pass.

Demonstrates the basics of a fullscreen (fragment) shader effect. The scene is rendered into a low resolution offscreen first and blended on top of the scene in a second pass. The fragment shader also applies a radial blur to it.

Renders a 2D Text overlay on top of an existing 3D scene. The example implements a text rendering class with seperate descriptor sets, layouts, pipelines and render pass to detach it from the rendering of the 3D scene. The font is generated by loading glyph data from a stb font file into a buffer that's copied to the font image.

After rendering the scene, the sceond render pass of the text render class loads the contents of the first render pass and displays the text on top of it using blending.

CPU based point sprite particle system simulatiing a fire. Particles and their attributes are stored in a host visible vertex buffer which is updated on the CPU on each frame. Demostrates how to update vertex buffer per frame.

Also makes use of pre-multipled alpha for rendering particles with different blending modes (smoke and fire) in one single pass.

Credits

Thanks to the authors of these libraries:

License

vkpp is provided under MIT license that can be found in the LICENSE.txt file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.

About

vkpp is a low-level, header-only Vulkan C++ bindings.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published