Examples and Tests
A list of included examples and integration tests.
Examples
Examples showcasing the use of the Tephra library are present in the /examples
folder. They are packaged into a single executable that can switch between demos with a numeric command line parameter when ran.
The first example, chosen by default or with 1
as the sole parameter, is a reimplementation of the official Vulkan C++ cube demo, displaying a textured rotating cube.
The second example that runs when passed 2
as the command line parameter, is a ray tracing demo that implements a simple path tracer of a Cornell box. It uses the trace_ray_query.hlsl
compute shader that needs to be compiled to SPIR-V. If you are not using the VS solution, you will need to compile it yourself with DXC -HV 2021 -fvk-use-scalar-layout
and copy it to the target directory. Can't be bothered to learn enough cmake for this, sorry.
The examples do not use any third party windowing library, both for ease of distribution and to be a faithful recreation of the official cube demo. In your own code, you should preferably use something like GLFW instead, see the GLFW Vulkan guide for details. All the platform-dependent code and the window event loop is contained in /examples/window.hpp
. It is mainly tested on Windows, if you find issues on other platforms, please submit a PR :).
The /examples/examples_common.hpp
file contains an Example
abstract class with a number of virtual methods used to update and render images. This allows the windowing class to run any example that implements that interface. /examples/tephra-examples.cpp
then contains an entry point for the project that just dispatches one of the examples.
Integration Test Suite
Tephra also contains tests of its basic functionality, located in /tests
, using the Microsoft Unit Testing Framework for C++. The /tests/tests_common.hpp
file contains common setup for those tests - it creates a basic Tephra tp::
The tests are split up by category:
Setup Tests
Tests to verify the functionality of setting up a basic Tephra environment. That involves creating an tp::/tests/tests_common.hpp
to ensure it is functional for further tests.
Buffer Tests
Tests to verify the creation, memory allocation and use of tp::
Image Tests
Similar tests as above, but with tp::
General Job Tests
These tests verify the basic functionality of jobs, like creation, submission and synchronization. The number of barriers is checked to match expectations
Compute Tests
Tests for compute passes, inline and deferred recording of tp::
Complex Tests
More complex tests of specific behavior or use cases can also be added. For example, the streaming compute test checks the capability of asynchronously and continuously streaming data to the GPU, processing it there and reading the results back. It tests both for correctness and for minimal memory allocation.