From cc53d411ef38331356f7c179d192cebecbcd4fcb Mon Sep 17 00:00:00 2001 From: Alexandre Date: Tue, 1 Sep 2026 19:04:20 +0200 Subject: [PATCH] Added a flake --- flake.nix | 82 ++++++++++++++++++++++++++++++++++++++ src/Engine/engine/loader.h | 30 ++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..99d0f30 --- /dev/null +++ b/flake.nix @@ -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 + ''; + }; + }); +} diff --git a/src/Engine/engine/loader.h b/src/Engine/engine/loader.h index 9060fe1..c354929 100644 --- a/src/Engine/engine/loader.h +++ b/src/Engine/engine/loader.h @@ -74,6 +74,36 @@ std::optional>> loadGltfMeshes( std::vector 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