Added a flake

This commit is contained in:
Alexandre 2026-09-01 19:04:20 +02:00
parent 3844f654cb
commit cc53d411ef
2 changed files with 112 additions and 0 deletions

82
flake.nix Normal file
View File

@ -0,0 +1,82 @@
{
description = "General Vulkan dev environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in {
devShells.default = pkgs.mkShell {
name = "vulkan";
hardeningDisable = [ "fortify" ];
packages = with pkgs; [
# Shader compile
shader-slang
glslang
# Vulkan
vulkan-headers
vulkan-loader
vulkan-validation-layers
vulkan-tools
vulkan-utility-libraries
vk-bootstrap
vulkan-memory-allocator
vulkan-volk
# Wayland
wayland
wayland-protocols
wayland-scanner
libxkbcommon
# Miniaudio
libpulseaudio
libpulseaudio.dev
# Other libraries
glfw3
SDL2
sdl3
fmt
imgui
tinyobjloader
nlohmann_json
tinygltf
# fastgltf
stb
ktx-tools
glm
cmake
ninja
pkg-config
# Debug
gdb
renderdoc
# git
];
# Environment Variables
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.vulkan-loader
pkgs.shaderc.lib
pkgs.SDL2
pkgs.vk-bootstrap
#pkgs.sdl3
];
VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
VULKAN_SDK = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
GIT="${pkgs.git}";
shellHook = ''
echo "Vulkan loaded"
unset SOURCE_DATE_EPOCH
echo $LD_LIBRARY_PATH
'';
};
});
}

View File

@ -74,6 +74,36 @@ std::optional<std::vector<std::shared_ptr<MeshAsset>>> loadGltfMeshes(
std::vector<Vertex> vertices;
// Now, some gltf gymnastics to get data into the correct buffers.
/*
====================================
The following comments are notes,
to help me build the loader,
based on the new fastgltf api
(the vkguide is using an older api)
====================================
By reading the vkguide, I can see that
he's iterating on "gltf" which is an Asset.
In the official docs, it is stated we can get direct
references to the Asset class, using pointers (->)
For exemple with buffers: asset->buffers
But the guide is using asset.meshes ?
We'll need to validate if it's a real class member
Then, foreach meshes in the file, he creates a temporary mesh,
that he will fill with the model data.
He assign the model name from the big chunk (we'll call it the Origin)
He does some cleaning, to not merge meshes by error.
And...uh..another loop.
This time, it's using mesh.primitives, which is the iterator of the first loop.
It creates a new GeoSurface, foreach "primitives" ?
*/
// Debug things