Vulkan context

Owns the Vulkan instance, the physical and logical device, the swapchain, queue families and synchronization primitives.

class VulkanContext
struct QueueFamilyIndices

Buffers

template<typename T>
class VulkanBuffer

Vulkan buffer of size elements of type T in host-visible, host-coherent memory.

The usage flags default to storage buffer and transfer destination. memcopyFrom() and memcopyTo() copy between host memory and the buffer; zero() sets it to zero.

Shader and asset files

Shaders are loaded by relative paths such as shaders/gsplat/gsplat_projection.comp.spv; see Building for how they are found.

std::vector<char> klartraum::readFile(const std::string &filename)

Reads a whole file into memory.

A relative path that does not exist relative to the current working directory is looked up relative to the asset root (see setAssetRoot()), so the library’s built-in shader paths such as shaders/gsplat/... resolve from any working directory.

void klartraum::setAssetRoot(const std::string &directory)

Sets the directory that relative paths passed to readFile() fall back to.

That is a directory with the compiled shaders in its shaders/ subdirectory. While it is empty (the default), the KLARTRAUM_ASSET_DIR environment variable is used, and without that the build directory of Klartraum.

std::string klartraum::getAssetRoot()

The asset root set by setAssetRoot(), else KLARTRAUM_ASSET_DIR, else the build directory of Klartraum.