SNEK is an experimental rendering library that utilises Vulkan and GLFW to enable cross-platform 2D and 3D rendering.
The intention of SNEK is to serve as a learning platform for Vulkan and high performance rendering concepts.
OS | Default Compiler | Last Manual Build | Compile Status |
---|---|---|---|
macOS | Clang++ | Monterey 12.3.1 |
|
Linux | G++ | Ubuntu-20.04.2.0 |
|
Windows | MinGW (G++) | Windows 10 19041 |
The following are dependencies for building and running SNEK:
- Cmake (all platforms)
- GNU Make (linux & macos)
- MingW32-make (windows)
- Python (all platforms)
Linux: For linux environments the following packages are required for building the dependencies.
libx11-xcb-dev
libxkbcommon-dev
libwayland-dev
libxrandr-dev
libasound2-dev
mesa-common-dev
libx11-dev
libxrandr-dev
libxi-dev
xorg-dev
libgl1-mesa-dev
libglu1-mesa-dev
These can be installed using apt-get
or an equivalent package manager for your OS distribution:
// Only required if not building with the Vulkan SDK
$ sudo apt-get update
$ sudo apt-get install git build-essential libx11-xcb-dev libxkbcommon-dev libwayland-dev libxrandr-dev
// Required for building GLFW
$ sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev
There are three ways to build the project:
- Using the Vulkan SDK.
- Building without the Vulkan SDK.
- Building without the Vulkan SDK with validation layers.
Building and running SNEK with the Vulkan SDK is the quickest way to get started. Doing so involves the following steps:
-
Download the Vulkan SDK from the LunarG website.
-
Install the SDK to your machine.
-
Export an environmental variable called
VULKAN_SDK
and point it to the install location of the Vulkan SDK. -
Run the install script for your platform:
// Linux & macos $ ./scripts/<PLATFORM>/install.sh // Windows > ./scripts<PLATFORM>/install.bat
-
Duplicate the
.env.template
file and rename it to.env
. -
Uncomment and fill in the following variables. Each variable should point to a directory or file:
VK_LAYER_PATH
- if you're using validation layers, set this to the directory where they're located.VK_ICD_FILENAMES
- if using MacOS, set this to the path that the MoltenVK ICD is located. This usually points to a file calledMoltenVK_icd.json
.VULKAN_INCLUDE_DIR
- point this to the directory where the vulkan headers are located.GLSLC
- point this to theglslangValidator
binary. This is generally located in thebin
directory in the SDK.
-
Save the .env file. This should be enough to build the project.
-
Navigate to the project root.
-
Run the install script for your platform:
// Linux & macos $ ./scripts/setup.sh // Windows > ./scripts/setup.bat
-
This should install all required dependencies. Once completed a
.env
file will be generated with all required variables. If the build is completed with no issue then you can proceed to build the project.
Building validation layers
If you want to build validation layers then the install scripts should be run by passing the --include-validation-layers
flag to the install
script:
// Linux & macos
$ ./scripts/install.sh --include-validation-layers
// Windows
> ./scripts/setup.bat --include-validation-layers
NOTE: Building with this option can take some time to complete. Please be patient while the project builds the required validation layers.
Once all dependencies have been set up, the project can be build and run using the following command:
// linux and macos
$ make bin/app; make execute
// linux and macos (with validation layers)
$ make CXXFLAGS="-DENABLE_VALIDATION_LAYERS=1" bin/app; make execute
// windows
> mingw32-make bin/app && mingw32-make execute
// windows - DEBUG
> mingw32-make CXXFLAGS="-DENABLE_VALIDATION_LAYERS=1" bin/app && mingw32-make execute
These commands should build the project and immediately run executable.
To build the project separately, you can call the bin/app
target separately. The same can be done for the execute
target.
Once these are done the project should be built and ready to go. Enjoy!
[root]
├─[scripts] <- all utility scripts
│
├─[shaders] <- space for storing GLSL shaders
│
├─[src]
│ └─[Renderer]
│ ├─[Device]
│ │ ├─[Utils] <- Device utilities
│ │
│ ├─[Model] <- Custom 3D model class
│ ├─[Pipeline] <- Graphics pipeline
│ ├─[RenderPass] <- RenderPass class
│ │ ├─[Utils] <- Swapchain Utilities
│ ├─[Swapchain] <- Swapchain functions
│ ├─[Utils] <- Utility classes (data structures)
│
├─[Window] <- Windowing library functions
│
├─[vendor] <- library install location
├─[vulkan] <- Vulkan related libraries
It's pretty simple actually:
- Fork it from here
- Create your feature branch (git checkout -b cool-new-feature)
- Commit your changes (git commit -m "Added some feature")
- Push to the branch (git push origin cool-new-feature)
- Create a new pull request for it!
This project is licenced under an unmodified zlib/libpng licence, which is an OSI-certified, BSD-like licence that allows static linking with closed source software. Check LICENCE
for further details.