From 6df8188bb831686920db07e55fd7f2486994a173 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Wed, 30 Sep 2026 21:49:38 +0200 Subject: [PATCH] Oops, forgot to stage, see last commit message --- .gitignore | 3 +- CMakeLists.txt | 7 +++-- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++ flake.nix | 5 ++-- src/Engine/engine/engine.h | 12 +++++--- 5 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 flake.lock diff --git a/.gitignore b/.gitignore index a0513fe..e225d32 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,8 @@ Thumbs.db .direnv/ # cache -.cache/ +.cache +.cache/* # Nix flakes result diff --git a/CMakeLists.txt b/CMakeLists.txt index e026fea..b00f917 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ find_package( glfw3 REQUIRED ) find_package( glm REQUIRED ) find_package( VulkanMemoryAllocator CONFIG REQUIRED ) find_package( fmt REQUIRED ) +find_package( CLI11 REQUIRED ) # Shader compilers add_executable (glslang::validator IMPORTED) find_program ( @@ -42,7 +43,7 @@ set_property ( find_program(SLANGC_EXECUTABLE slangc HINTS $ENV{VULKAN_SDK}/bin REQUIRED) # CL11 -add_subdirectory(include/CLI11) +#add_subdirectory(include/CLI11) # fastgltf because it's not in nixpkgs @@ -129,6 +130,7 @@ function ( addBinary BINARY_NAME ) # Exposes versions BUILD_ID="${ENGINE_VERSION}" ) + if(BINARY_IMGUI) target_include_directories(${BINARY_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include/imgui @@ -149,6 +151,7 @@ function ( addBinary BINARY_NAME ) ) endif() + if(BINARY_LICENSE) file(COPY ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_BINARY_DIR}/${BINARY_NAME}) endif() @@ -227,7 +230,7 @@ list( lib_list # Libs used glfw - fmt + fmt::fmt vk-bootstrap vulkan CLI11::CLI11 diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..dae6554 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1790689126, + "narHash": "sha256-ilerN1WLSvF+HMjziC/Wv99J5y02maDH+6hZPwsORKg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b4fd65b198c599cbe814fcb9f42d25d021595ec9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 729c0dd..9c96588 100644 --- a/flake.nix +++ b/flake.nix @@ -44,13 +44,14 @@ SDL2 sdl3 fmt - imgui + cli11 + #imgui tinyobjloader nlohmann_json tinygltf # fastgltf stb - ktx-tools + #ktx-tools glm cmake ninja diff --git a/src/Engine/engine/engine.h b/src/Engine/engine/engine.h index 8968dcf..1d0ee67 100644 --- a/src/Engine/engine/engine.h +++ b/src/Engine/engine/engine.h @@ -5,6 +5,8 @@ // Current progress // 3 - Graphics Pipeline - Blending // Currently rewriting render images +// Todo: +// Switch C style types to C++ ones (vk::) #include "descriptors.h" // Required for public interface custom allocator #include "Common/Types.h" @@ -125,6 +127,7 @@ class Engine { // Sum things int prevID = 0; + int meshIndex = 0; // Mesh VkPipelineLayout _meshPipelineLayout; @@ -1535,7 +1538,7 @@ AllocatedBuffer Engine::createBuffer( VmaMemoryUsage memoryUsage ) { #ifdef DEBUG - _logger.logRAM(ENGINE, EINIT, "Creating a buffer with memory usage {} KiB", (float)allocSize/1024.0f); + _logger.logRAM(ENGINE, EINIT, "Creating a buffer with memory usage {} KiB and usage: {}", (float)allocSize/1024.0f, string_VkBufferUsageFlags(usage)); _gpuMemusage += allocSize; #endif // Allocate the buffer @@ -1820,6 +1823,7 @@ void Engine::buildImgui() { ComputeEffect& selected = backgroundEffects[currentBackgroundEffect]; ImGui::SliderFloat("Render scale", &renderScale, 0.3f, 1.0f); + ImGui::SliderInt("Mesh Index", &meshIndex, 0, 2); ImGui::Text( "Selected effect: %s", @@ -2080,16 +2084,16 @@ void Engine::drawGeometry( ); vkCmdBindIndexBuffer( cmd, - testMeshes[2]->meshBuffers.indexBuffer.buffer, + testMeshes[meshIndex]->meshBuffers.indexBuffer.buffer, 0, VK_INDEX_TYPE_UINT32 ); vkCmdDrawIndexed( cmd, - testMeshes[2]->surfaces[0].count, + testMeshes[meshIndex]->surfaces[0].count, 1, - testMeshes[2]->surfaces[0].startIndex, + testMeshes[meshIndex]->surfaces[0].startIndex, 0, 0 );