From f45414e83e88f944eb7e83d1e21bd4b75a1640c2 Mon Sep 17 00:00:00 2001 From: Mathew Benson Date: Tue, 12 Aug 2025 21:28:09 +0300 Subject: [PATCH 1/2] CMake fetchcontent and CMake Install Workflow - CI Error when no files found - make libraries static - install tests and vulkan lib - Introduce CPack - Fix Clang-format issue moving to LLVM 21, which is now default on several platforms - simplify testing due to install workflow - Initialize SwapchainImages with the size parameter added as the creation of the swap chains was happening successfully but the size was not getting updated giving an index error. - Fix error on linux where Wayland was not being initialized properly. Wayland is the default for glfw in version 3.4 and in many desktop environments. GLFW_EXPOSE_NATIVE_* macro was defined for windows but not for the other Operating Systems --- .github/workflows/job-cmakebuild-linux.yml | 18 +- .github/workflows/job-cmakebuild-macOS.yml | 11 +- .github/workflows/job-cmakebuild-windows.yml | 23 +- .github/workflows/job-deploy-linux.yml | 7 +- .github/workflows/job-deploy-macOS.yml | 5 +- .github/workflows/job-deploy-windows.yml | 4 +- .github/workflows/job-test-linux.yml | 14 +- .github/workflows/job-test-macOS.yml | 11 +- .github/workflows/job-test-windows.yml | 16 +- .github/workflows/windows-build.yml | 7 +- .gitignore | 3 + .gitmodules | 66 ---- CMakeLists.txt | 63 +--- CMakePresets.json | 38 ++- Obelisk/CMakeLists.txt | 20 +- Obelisk/EntryPoint.cpp | 3 +- Panzerfaust/CMakeLists.txt | 14 +- Panzerfaust/Panzerfaust.csproj | 11 +- Panzerfaust/Service/EngineService.cs | 4 +- Scripts/BuildEngine.ps1 | 43 ++- Scripts/PostBuild.ps1 | 2 +- Scripts/RunTests.ps1 | 18 +- Tetragrama/CMakeLists.txt | 5 +- .../Components/DockspaceUIComponent.cpp | 2 +- .../Helpers/UIComponentDrawerHelper.cpp | 16 +- Tetragrama/Helpers/UIComponentDrawerHelper.h | 2 +- ZEngine/ZEngine/CMakeLists.txt | 33 +- ZEngine/ZEngine/Core/CoroutineScheduler.h | 3 +- ZEngine/ZEngine/Core/Memory/MemoryManager.h | 6 +- .../ZEngine/Hardwares/AsyncResourceLoader.cpp | 2 +- ZEngine/ZEngine/Hardwares/VulkanDevice.cpp | 43 ++- ZEngine/ZEngine/Hardwares/VulkanDevice.h | 7 +- .../Shaders/Compilers/CompilationStage.cpp | 1 - ZEngine/ZEngine/Rendering/Shaders/Shader.cpp | 14 +- .../Specifications/ShaderSpecification.h | 4 +- ZEngine/ZEngine/Windows/GameWindow.h | 1 - ZEngine/ZEngine/Windows/Inputs/KeyCode.h | 7 +- ZEngine/ZEngine/pch.h | 4 +- ZEngine/tests/CMakeLists.txt | 5 + ZEngine/tests/Memory/allocator_test.cpp | 10 +- ZEngine/tests/Memory/handleManager_test.cpp | 4 +- __externals/CLI11 | 1 - __externals/ImGuizmo | 1 - __externals/SPIRV-Cross | 1 - __externals/SPIRV-Tools | 1 - __externals/SPIRV-headers | 1 - __externals/Vulkan-Headers | 1 - __externals/Vulkan-Loader | 1 - __externals/VulkanMemoryAllocator | 1 - __externals/assimp | 1 - __externals/entt | 1 - __externals/fmt | 1 - __externals/glfw | 1 - __externals/glslang | 1 - __externals/gtest | 1 - __externals/imgui/CMakeLists.txt | 28 -- __externals/imgui/src | 1 - __externals/nlohmann_json | 1 - __externals/rapidhash/CMakeLists.txt | 11 - __externals/rapidhash/src | 1 - __externals/spdlog | 1 - __externals/stb | 1 - __externals/stduuid | 1 - __externals/tlsf/CMakeLists.txt | 18 -- __externals/tlsf/src | 1 - __externals/yaml-cpp | 1 - dependencies.cmake | 281 +++++++++++++++++- repoConfiguration.json | 2 +- 68 files changed, 506 insertions(+), 426 deletions(-) delete mode 160000 __externals/CLI11 delete mode 160000 __externals/ImGuizmo delete mode 160000 __externals/SPIRV-Cross delete mode 160000 __externals/SPIRV-Tools delete mode 160000 __externals/SPIRV-headers delete mode 160000 __externals/Vulkan-Headers delete mode 160000 __externals/Vulkan-Loader delete mode 160000 __externals/VulkanMemoryAllocator delete mode 160000 __externals/assimp delete mode 160000 __externals/entt delete mode 160000 __externals/fmt delete mode 160000 __externals/glfw delete mode 160000 __externals/glslang delete mode 160000 __externals/gtest delete mode 100644 __externals/imgui/CMakeLists.txt delete mode 160000 __externals/imgui/src delete mode 160000 __externals/nlohmann_json delete mode 100644 __externals/rapidhash/CMakeLists.txt delete mode 160000 __externals/rapidhash/src delete mode 160000 __externals/spdlog delete mode 160000 __externals/stb delete mode 160000 __externals/stduuid delete mode 100644 __externals/tlsf/CMakeLists.txt delete mode 160000 __externals/tlsf/src delete mode 160000 __externals/yaml-cpp diff --git a/.github/workflows/job-cmakebuild-linux.yml b/.github/workflows/job-cmakebuild-linux.yml index 86c5e3cd..04227d86 100644 --- a/.github/workflows/job-cmakebuild-linux.yml +++ b/.github/workflows/job-cmakebuild-linux.yml @@ -31,11 +31,10 @@ jobs: chmod +x llvm.sh sudo ./llvm.sh 20 - - name: Update the list of packages + - name: Update the list of packages after we added packages.microsoft.com run: sudo apt-get update - - - name: Install Dependencies - run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake apt-transport-https software-properties-common gcc g++ powershell clang-format-20 glslang-tools libwayland-dev libxkbcommon-dev + - name: Install development library + run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake apt-transport-https software-properties-common gcc g++ powershell clang-format-20 libwayland-dev libxkbcommon-dev dotnet-sdk-8.0 - name: CMake Build run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}} @@ -45,11 +44,8 @@ jobs: uses: actions/upload-artifact@v4 with: name: Build-linux-${{inputs.configuration}} + if-no-files-found: error path: | - Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/publish/ - Result.Linux.x64.${{inputs.configuration}}/__externals/Vulkan-Loader/loader/ - Result.Linux.x64.${{inputs.configuration}}/ZEngine/tests/ZEngineTests - Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.resources.dll - !Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll - !Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.resources.dll - !Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.Scripting.resources.dll + Result.Linux.x64.${{inputs.configuration}}/bin + Result.Linux.x64.${{inputs.configuration}}/lib/*vulkan* + Result.Linux.x64.${{inputs.configuration}}/tests diff --git a/.github/workflows/job-cmakebuild-macOS.yml b/.github/workflows/job-cmakebuild-macOS.yml index 66b9698f..e077c0c1 100644 --- a/.github/workflows/job-cmakebuild-macOS.yml +++ b/.github/workflows/job-cmakebuild-macOS.yml @@ -34,11 +34,8 @@ jobs: uses: actions/upload-artifact@v4 with: name: Build-macOS-${{ inputs.architecture }}-${{inputs.configuration}} + if-no-files-found: error path: | - Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/osx-${{ inputs.architecture }}/publish/ - Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/__externals/Vulkan-Loader/loader/${{ inputs.configuration }}/ - Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/ZEngine/tests/${{inputs.configuration}}/ - !Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.resources.dll - !Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll - !Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.resources.dll - !Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.Scripting.resources.dll + Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/bin/ + Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/lib/*vulkan* + Result.Darwin.${{inputs.architecture}}.${{inputs.configuration}}/tests diff --git a/.github/workflows/job-cmakebuild-windows.yml b/.github/workflows/job-cmakebuild-windows.yml index 7109e838..4e7012c0 100644 --- a/.github/workflows/job-cmakebuild-windows.yml +++ b/.github/workflows/job-cmakebuild-windows.yml @@ -2,6 +2,9 @@ # name: Windows Build Workflow +permissions: + packages: write + on: workflow_call: inputs: @@ -28,20 +31,8 @@ jobs: uses: actions/upload-artifact@v4 with: name: Build-Windows-x64-${{inputs.configuration}} + if-no-files-found: error path: | - Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/win-x64/publish/ - Result.Windows.x64.MultiConfig/ZEngine/tests/${{inputs.configuration}}/ - !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.resources.dll - !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll - !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.resources.dll - !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.Scripting.resources.dll - !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/${{inputs.targetFramework}}/**/createdump.exe - - - name: Publish Vulkan Build Artifacts - uses: actions/upload-artifact@v4 - with: - name: Vulkan-build-x64-${{inputs.configuration}} - path: | - Result.Windows.x64.MultiConfig/__externals/Vulkan-Loader/loader/${{inputs.configuration}}/vulkan-1.dll - Result.Windows.x64.MultiConfig/__externals/Vulkan-Loader/loader/${{inputs.configuration}}/vulkan-1.exp - Result.Windows.x64.MultiConfig/__externals/Vulkan-Loader/loader/${{inputs.configuration}}/vulkan-1.lib + Result.Windows.x64.MultiConfig/bin/ + Result.Windows.x64.MultiConfig/lib/*vulkan* + Result.Windows.x64.MultiConfig/tests/ZEngineTests.exe diff --git a/.github/workflows/job-deploy-linux.yml b/.github/workflows/job-deploy-linux.yml index 10741db4..8b493d59 100644 --- a/.github/workflows/job-deploy-linux.yml +++ b/.github/workflows/job-deploy-linux.yml @@ -19,11 +19,14 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - path: Result.Linux.x64.${{ inputs.configuration }} name: Build-linux-Release + path: Result.Linux.x64.${{ inputs.configuration }} - name: Publish Artifacts uses: actions/upload-artifact@v4 with: name: linux-${{ inputs.configuration }} - path: Result.Linux.x64.${{inputs.configuration}}/Panzerfaust/${{ inputs.configuration }}/${{inputs.targetFramework}}/publish/ + if-no-files-found: error + path: | + Result.Linux.x64.${{inputs.configuration}}/bin + Result.Linux.x64.${{inputs.configuration}}/lib diff --git a/.github/workflows/job-deploy-macOS.yml b/.github/workflows/job-deploy-macOS.yml index 36164624..c0e7c481 100644 --- a/.github/workflows/job-deploy-macOS.yml +++ b/.github/workflows/job-deploy-macOS.yml @@ -29,4 +29,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: macOS-${{ inputs.architecture }}-${{ inputs.configuration }} - path: Result.Darwin.${{inputs.architecture}}.${{ inputs.configuration }}/Panzerfaust/${{ inputs.configuration }}/${{inputs.targetFramework}}/osx-${{ inputs.architecture }}/publish/ + if-no-files-found: error + path: | + Result.Darwin.${{inputs.architecture}}.${{ inputs.configuration }}/bin/ + Result.Darwin.${{inputs.architecture}}.${{ inputs.configuration }}/lib/ diff --git a/.github/workflows/job-deploy-windows.yml b/.github/workflows/job-deploy-windows.yml index d5a3e938..5fb5c953 100644 --- a/.github/workflows/job-deploy-windows.yml +++ b/.github/workflows/job-deploy-windows.yml @@ -26,4 +26,6 @@ jobs: uses: actions/upload-artifact@v4 with: name: Windows-x64-${{ inputs.configuration }} - path: Result.Windows.x64.MultiConfig/Panzerfaust/${{ inputs.configuration }}/${{inputs.targetFramework}}/win-x64/publish/ + if-no-files-found: error + path: | + Result.Windows.x64.MultiConfig/bin diff --git a/.github/workflows/job-test-linux.yml b/.github/workflows/job-test-linux.yml index 7b4cbfbd..35c978cc 100644 --- a/.github/workflows/job-test-linux.yml +++ b/.github/workflows/job-test-linux.yml @@ -8,24 +8,24 @@ on: configuration: type: string default: 'Debug' + architecture: + type: string + default: 'x64' jobs: test: name: test-linux-${{ inputs.configuration }} runs-on: ubuntu-24.04 steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Download Artifacts uses: actions/download-artifact@v4 with: name: Build-linux-${{ inputs.configuration }} - path: Result.Linux.x64.${{ inputs.configuration }} - name: Update access permission of ZEngineTests - run: chmod +x ./Result.Linux.x64.${{ inputs.configuration }}/ZEngine/tests/ZEngineTests + run: chmod +x ${{github.workspace}}/tests/ZEngineTests - name: Run Tests - run: .\Scripts\RunTests.ps1 -Configurations ${{ inputs.configuration }} - shell: pwsh + env: + LD_LIBRARY_PATH: ${{github.workspace}}/lib + run: ${{github.workspace}}/tests/ZEngineTests diff --git a/.github/workflows/job-test-macOS.yml b/.github/workflows/job-test-macOS.yml index ba272c82..5744fe4a 100644 --- a/.github/workflows/job-test-macOS.yml +++ b/.github/workflows/job-test-macOS.yml @@ -17,18 +17,15 @@ jobs: name: test-macOS-${{ inputs.architecture }}-${{ inputs.configuration }} runs-on: ${{ inputs.architecture == 'x64' && 'macos-15-intel' || 'macos-latest' }} steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Download Artifacts uses: actions/download-artifact@v4 with: name: Build-macOS-${{ inputs.architecture }}-${{ inputs.configuration }} - path: Result.Darwin.${{inputs.architecture}}.${{ inputs.configuration }} - name: Update access permission of ZEngineTests - run: chmod +x ./Result.Darwin.${{inputs.architecture}}.${{ inputs.configuration }}/ZEngine/tests/${{ inputs.configuration }}/ZEngineTests + run: chmod +x ${{github.workspace}}/tests/ZEngineTests - name: Run Tests - run: .\Scripts\RunTests.ps1 -Configurations ${{ inputs.configuration }} -Architecture ${{ inputs.architecture }} - shell: pwsh + env: + DYLD_LIBRARY_PATH: ${{github.workspace}}/lib + run: ${{github.workspace}}/tests/ZEngineTests diff --git a/.github/workflows/job-test-windows.yml b/.github/workflows/job-test-windows.yml index 36a9f638..30bfb29a 100644 --- a/.github/workflows/job-test-windows.yml +++ b/.github/workflows/job-test-windows.yml @@ -14,23 +14,13 @@ jobs: name: test-windows-${{ inputs.configuration }} runs-on: windows-2022 steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Download All Artifacts uses: actions/download-artifact@v4 with: - path: Result.Windows.x64.MultiConfig name: Build-Windows-x64-${{ inputs.configuration }} - - name: Download Vulkan Artifacts - uses: actions/download-artifact@v4 - with: - path: vulkan-build - name: Vulkan-build-x64-${{inputs.configuration}} - - name: Run Tests shell: pwsh - run: | - $env:PATH = ".\vulkan-build\;$env:PATH" - .\Scripts\RunTests.ps1 -Configurations ${{ inputs.configuration }} + env: + PATH: ${{github.workspace}}\lib + run: ${{github.workspace}}\tests\ZEngineTests.exe diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 04f0eb03..ab1540aa 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -19,16 +19,13 @@ jobs: test: needs: cmake-build - strategy: - matrix: - testConfiguration: [Debug, Release] uses: ./.github/workflows/job-test-windows.yml with: - configuration: ${{matrix.testConfiguration}} + configuration: Release deploy: needs: test uses: ./.github/workflows/job-deploy-windows.yml with: configuration: Release - targetFramework: ${{inputs.targetFramework}} \ No newline at end of file + targetFramework: ${{inputs.targetFramework}} diff --git a/.gitignore b/.gitignore index cc998b75..ad1b8f70 100644 --- a/.gitignore +++ b/.gitignore @@ -424,3 +424,6 @@ CMakeSettings.json # MacOS files .DS_Store + +# Vcpkg Install Directory +vcpkg_installed/ diff --git a/.gitmodules b/.gitmodules index 1ab3bb18..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,66 +0,0 @@ -[submodule "__externals/fmt"] - path = __externals/fmt - url = https://github.com/fmtlib/fmt -[submodule "__externals/stb"] - path = __externals/stb - url = https://github.com/nothings/stb -[submodule "__externals/imgui/src"] - path = __externals/imgui/src - url = https://github.com/ocornut/imgui -[submodule "__externals/spdlog"] - path = __externals/spdlog - url = https://github.com/gabime/spdlog -[submodule "__externals/glfw"] - path = __externals/glfw - url = https://github.com/glfw/glfw -[submodule "__externals/entt"] - path = __externals/entt - url = https://github.com/skypjack/entt -[submodule "__externals/assimp"] - path = __externals/assimp - url = https://github.com/assimp/assimp -[submodule "__externals/stduuid"] - path = __externals/stduuid - url = https://github.com/mariusbancila/stduuid -[submodule "__externals/yaml-cpp"] - path = __externals/yaml-cpp - url = https://github.com/jbeder/yaml-cpp -[submodule "__externals/ImGuizmo"] - path = __externals/ImGuizmo - url = https://github.com/CedricGuillemet/ImGuizmo -[submodule "__externals/SPIRV-Cross"] - path = __externals/SPIRV-Cross - url = https://github.com/KhronosGroup/SPIRV-Cross -[submodule "__externals/gtest"] - path = __externals/gtest - url = https://github.com/google/googletest -[submodule "__externals/VulkanMemoryAllocator"] - path = __externals/VulkanMemoryAllocator - url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator -[submodule "__externals/nlohmann_json"] - path = __externals/nlohmann_json - url = https://github.com/nlohmann/json -[submodule "__externals/glslang"] - path = __externals/glslang - url = https://github.com/khronosGroup/glslang.git -[submodule "__externals/SPIRV-headers"] - path = __externals/SPIRV-headers - url = https://github.com/khronosGroup/SPIRV-headers.git -[submodule "__externals/SPIRV-Tools"] - path = __externals/SPIRV-Tools - url = https://github.com/khronosGroup/SPIRV-Tools -[submodule "__externals/Vulkan-Loader"] - path = __externals/Vulkan-Loader - url = https://github.com/KhronosGroup/Vulkan-Loader -[submodule "__externals/Vulkan-Headers"] - path = __externals/Vulkan-Headers - url = https://github.com/KhronosGroup/Vulkan-Headers -[submodule "__externals/tlsf/src"] - path = __externals/tlsf/src - url = https://github.com/mattconte/tlsf -[submodule "__externals/CLI11"] - path = __externals/CLI11 - url = https://github.com/CLIUtils/CLI11 -[submodule "__externals/rapidhash/src"] - path = __externals/rapidhash/src - url = https://github.com/Nicoshev/rapidhash diff --git a/CMakeLists.txt b/CMakeLists.txt index f53d932b..054dd184 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,14 +10,9 @@ set_property (GLOBAL PROPERTY USE_FOLDERS ON) # Core invariants # -get_filename_component (ENLISTMENT_ROOT "." ABSOLUTE CACHE) -get_filename_component (EXTERNAL_DIR "${ENLISTMENT_ROOT}/__externals" ABSOLUTE CACHE) -get_filename_component (EXTERNAL_NUGET_DIR "${ENLISTMENT_ROOT}/__externals/nuget" ABSOLUTE CACHE) - -include(${ENLISTMENT_ROOT}/Scripts/CMake/NuGet.cmake) -include(${ENLISTMENT_ROOT}/Scripts/CMake/CppWinRT.cmake) -include(${ENLISTMENT_ROOT}/dependencies.cmake) +include(Scripts/CMake/NuGet.cmake) +include(Scripts/CMake/CppWinRT.cmake) option (COPY_EXAMPLE_PROJECT "Copy example projects that show how to use Launcher" ON) option (LAUNCHER_ONLY "Build Launcher only" OFF) @@ -39,30 +34,14 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") add_compile_definitions(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING) # Fix Warning from VS 2022 + endif() +list( APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib ) + # Externals dependencies # if (NOT LAUNCHER_ONLY) - add_subdirectory (${EXTERNAL_DIR}/Vulkan-Headers) - add_subdirectory (${EXTERNAL_DIR}/Vulkan-Loader) - add_subdirectory (${EXTERNAL_DIR}/fmt) - add_subdirectory (${EXTERNAL_DIR}/imgui) - add_subdirectory (${EXTERNAL_DIR}/glfw) - add_subdirectory (${EXTERNAL_DIR}/spdlog) - add_subdirectory (${EXTERNAL_DIR}/entt) - add_subdirectory (${EXTERNAL_DIR}/assimp) - add_subdirectory (${EXTERNAL_DIR}/stduuid) - add_subdirectory (${EXTERNAL_DIR}/yaml-cpp) - add_subdirectory (${EXTERNAL_DIR}/SPIRV-headers) - add_subdirectory (${EXTERNAL_DIR}/SPIRV-Tools) - add_subdirectory (${EXTERNAL_DIR}/glslang) - add_subdirectory (${EXTERNAL_DIR}/SPIRV-Cross) - add_subdirectory (${EXTERNAL_DIR}/gtest) - add_subdirectory (${EXTERNAL_DIR}/VulkanMemoryAllocator) - add_subdirectory (${EXTERNAL_DIR}/tlsf) - add_subdirectory (${EXTERNAL_DIR}/rapidhash) - add_subdirectory (${EXTERNAL_DIR}/CLI11) - add_subdirectory (${EXTERNAL_DIR}/nlohmann_json) + ## Setup Dependencies + include(dependencies.cmake) # Core engine lib is here # @@ -85,32 +64,4 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set_property (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Panzerfaust) endif () -# Post build operation -# -set (SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) -if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set (SYSTEM_ARCHITECTURE "x64") -elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set (SYSTEM_ARCHITECTURE "x64") -elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - if (MACOSX_ARCHITECTURE_ARM64) - set (SYSTEM_ARCHITECTURE "arm64") - else () - set (SYSTEM_ARCHITECTURE "x64") - endif () -endif () - -add_custom_target (AssembleContent ALL - COMMENT "Copying assets and resources contents" - COMMAND pwsh ${CMAKE_CURRENT_SOURCE_DIR}/Scripts/PostBuild.ps1 -SystemName ${SYSTEM_NAME} -Architecture ${SYSTEM_ARCHITECTURE} -Configurations $,Debug,Release> $<$:-LauncherOnly> -) - -if (NOT LAUNCHER_ONLY) - add_dependencies(AssembleContent zEngineLib tetragrama Obelisk) -endif () - -if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - add_dependencies(AssembleContent Panzerfaust-WinBuild) -else () - add_dependencies(AssembleContent Panzerfaust) -endif () +include(CPack) diff --git a/CMakePresets.json b/CMakePresets.json index 315462b2..bedb0bad 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -10,6 +10,11 @@ "name": "BaseOptions", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_CXX_STANDARD": "20", + "CMAKE_CXX_STANDARD_REQUIRED": "ON", + "CMAKE_CXX_EXTENSIONS": "OFF", + "BUILD_SHARED_LIBS": "OFF", + "FETCHCONTENT_QUIET": "OFF", "VULKAN_HEADERS_ENABLE_INSTALL": "ON", "ENTT_INCLUDE_HEADERS": "ON", @@ -20,7 +25,6 @@ "GLFW_BUILD_DOCS": "OFF", "GLFW_BUILD_EXAMPLES": "OFF", - "GLFW_INSTALL": "OFF", "ASSIMP_BUILD_TESTS": "OFF", "ASSIMP_INSTALL": "OFF", @@ -40,13 +44,12 @@ "YAML_CPP_FORMAT_SOURCE": "OFF", "YAML_BUILD_SHARED_LIBS": "OFF", - "USE_MASM": "OFF", "USE_GAS": "OFF", "SPIRV_SKIP_EXECUTABLES": "ON", "SPIRV_SKIP_TESTS": "ON", "GLSLANG_ENABLE_INSTALL": "ON", - "ALLOW_EXTERNAL_SPIRV_TOOLS": "OFF", + "ALLOW_EXTERNAL_SPIRV_TOOLS": "ON", "SPIRV_CROSS_ENABLE_TESTS": "OFF", "CMAKE_POLICY_VERSION_MINIMUM": "3.5" @@ -60,8 +63,8 @@ "binaryDir": "Result.Windows.x64.MultiConfig", "architecture": "x64", "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CONFIGURATION_TYPES": "Debug" + "CMAKE_CONFIGURATION_TYPES": "Debug", + "CMAKE_INSTALL_PREFIX": "Result.Windows.x64.MultiConfig" } }, @@ -70,7 +73,6 @@ "displayName": "Windows Visual Studio Release", "inherits": "Windows_x64_Debug", "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", "CMAKE_CONFIGURATION_TYPES": "Release" } }, @@ -82,7 +84,9 @@ "binaryDir": "Result.Darwin.x64.Debug", "generator": "Xcode", "cacheVariables": { - "BUILD_FRAMEWORK": "ON" + "BUILD_FRAMEWORK": "ON", + "CMAKE_INSTALL_PREFIX": "Result.Darwin.x64.Debug", + "CMAKE_CONFIGURATION_TYPES": "Debug" } }, { @@ -91,7 +95,9 @@ "displayName": "Darwin XCode Release", "binaryDir": "Result.Darwin.x64.Release", "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "Result.Darwin.x64.Release", + "CMAKE_CONFIGURATION_TYPES": "Release" } }, @@ -99,14 +105,20 @@ "name": "Darwin_arm64_Debug", "inherits": "Darwin_x64_Debug", "binaryDir": "Result.Darwin.arm64.Debug", - "displayName": "Darwin ARM XCode Debug" + "displayName": "Darwin ARM XCode Debug", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "Result.Darwin.arm64.Debug" + } }, { "name": "Darwin_arm64_Release", "inherits": "Darwin_x64_Release", "binaryDir": "Result.Darwin.arm64.Release", - "displayName": "Darwin ARM XCode Release" + "displayName": "Darwin ARM XCode Release", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "Result.Darwin.arm64.Release" + } }, { @@ -114,7 +126,10 @@ "inherits": "BaseOptions", "displayName": "Linux Ninja Debug", "binaryDir": "Result.Linux.x64.Debug", - "generator": "Ninja" + "generator": "Ninja", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "Result.Linux.x64.Debug" + } }, { "name": "Linux_x64_Release", @@ -123,6 +138,7 @@ "binaryDir": "Result.Linux.x64.Release", "generator": "Ninja", "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "Result.Linux.x64.Release", "CMAKE_BUILD_TYPE": "Release" } } diff --git a/Obelisk/CMakeLists.txt b/Obelisk/CMakeLists.txt index 488cb8d2..2429ce50 100644 --- a/Obelisk/CMakeLists.txt +++ b/Obelisk/CMakeLists.txt @@ -26,8 +26,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set_target_properties(${TARGET_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(ProjectDir)$(Configuration)") endif () -include(${EXTERNAL_DIR}/externals.cmake) - target_include_directories (${TARGET_NAME} PRIVATE . @@ -44,8 +42,20 @@ target_compile_definitions(${TARGET_NAME} _UNICODE ) -target_link_libraries(${TARGET_NAME} PRIVATE - zEngineLib +target_link_libraries(${TARGET_NAME} PUBLIC tetragrama imported::External_obeliskLibs -) \ No newline at end of file +) + +set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) + +install(TARGETS ${TARGET_NAME} + DESTINATION bin +) + +install(DIRECTORY ../Resources/Editor/Settings DESTINATION bin) + +install(DIRECTORY ../Resources/Shaders DESTINATION bin) + + + diff --git a/Obelisk/EntryPoint.cpp b/Obelisk/EntryPoint.cpp index 412f4207..fdc247cc 100644 --- a/Obelisk/EntryPoint.cpp +++ b/Obelisk/EntryPoint.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -18,7 +19,7 @@ int applicationEntryPoint(int argc, char* argv[]) MemoryManager manager = {}; MemoryConfiguration config = {.DefaultSize = ZGiga(3u)}; manager.Initialize(config); - auto arena = &(manager.Allocator); + auto arena = &(manager.ArenaAllocatorValue); LoggerConfiguration logger_cfg = {}; Logger::Initialize(arena, logger_cfg); diff --git a/Panzerfaust/CMakeLists.txt b/Panzerfaust/CMakeLists.txt index 37d73d15..b211abbe 100644 --- a/Panzerfaust/CMakeLists.txt +++ b/Panzerfaust/CMakeLists.txt @@ -23,11 +23,13 @@ if ((APPLE) OR (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")) endif () endif() -set (BUILD_CONFIGURATION -c $,Debug,Release>) +set (BUILD_CONFIGURATION $,Debug,Release>) if (APPLE) - set (RUNTIME_IDENTIFIER -r $,osx-arm64,osx-x64>) + set (RUNTIME_IDENTIFIER $,osx-arm64,osx-x64>) elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set (RUNTIME_IDENTIFIER -r win-x64) + set (RUNTIME_IDENTIFIER win-x64) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set (RUNTIME_IDENTIFIER linux-x64) endif () set (CUSTOM_TARGET_NAME ${CSPROJ}) @@ -38,7 +40,9 @@ add_custom_target (${CUSTOM_TARGET_NAME} ALL) add_custom_command (TARGET ${CUSTOM_TARGET_NAME} POST_BUILD COMMENT "Building and Publishing Panzerfaust" - COMMAND dotnet build ${CSPROJ_SOURCE_FILE} ${RUNTIME_IDENTIFIER} ${BUILD_CONFIGURATION} -v n - COMMAND dotnet publish ${CSPROJ_SOURCE_FILE} ${RUNTIME_IDENTIFIER} ${BUILD_CONFIGURATION} + COMMAND dotnet build ${CSPROJ_SOURCE_FILE} -r ${RUNTIME_IDENTIFIER} -c ${BUILD_CONFIGURATION} -v n + COMMAND dotnet publish ${CSPROJ_SOURCE_FILE} -r ${RUNTIME_IDENTIFIER} -c ${BUILD_CONFIGURATION} -o bin VERBATIM ) + +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin DESTINATION ${CMAKE_INSTALL_PREFIX}) diff --git a/Panzerfaust/Panzerfaust.csproj b/Panzerfaust/Panzerfaust.csproj index c90f4ec7..61226db1 100644 --- a/Panzerfaust/Panzerfaust.csproj +++ b/Panzerfaust/Panzerfaust.csproj @@ -8,7 +8,8 @@ true ./Assets/avalonia-logo.ico ..\Result.Windows.x64.MultiConfig - ..\Result.Darwin.x64.$(Configuration) + ..\Result.Darwin.arm64.$(Configuration) + ..\Result.Darwin.x64.$(Configuration) ..\Result.Linux.x64.$(Configuration) x64;arm64 @@ -17,14 +18,12 @@ true portable false - $(BaseOutputPath)\Panzerfaust\$(Configuration) TRACE;DEBUG;_WIN32 x64 pdbonly true - $(BaseOutputPath)\Panzerfaust\$(Configuration) TRACE;_WIN32 @@ -32,14 +31,12 @@ true full false - $(BaseOutputPath)\Panzerfaust\$(Configuration) TRACE;DEBUG;__MACOS__ arm64 pdbonly true - $(BaseOutputPath)\Panzerfaust\$(Configuration) TRACE;__MACOS__ @@ -47,14 +44,12 @@ true full false - $(BaseOutputPath)\Panzerfaust\$(Configuration) TRACE;DEBUG;__MACOS__ x64 pdbonly true - $(BaseOutputPath)\Panzerfaust\$(Configuration) TRACE;__MACOS__ @@ -62,14 +57,12 @@ true full false - $(BaseOutputPath)\Panzerfaust\$(Configuration) TRACE;DEBUG x64 pdbonly true - $(BaseOutputPath)\Panzerfaust\$(Configuration) TRACE diff --git a/Panzerfaust/Service/EngineService.cs b/Panzerfaust/Service/EngineService.cs index b44634c0..dd958a6a 100644 --- a/Panzerfaust/Service/EngineService.cs +++ b/Panzerfaust/Service/EngineService.cs @@ -24,8 +24,8 @@ public EngineService() #if _WIN32 engineExtension = ".exe"; #endif - _enginePath = Path.Combine(Environment.CurrentDirectory, "Editor", $"{_launcherCLIAppName}{engineExtension}"); - _workingDirectory = Path.Combine(Environment.CurrentDirectory, "Editor"); + _enginePath = Path.Combine(Environment.CurrentDirectory, $"{_launcherCLIAppName}{engineExtension}"); + _workingDirectory = Environment.CurrentDirectory; } public async Task StartAsync(string path) diff --git a/Scripts/BuildEngine.ps1 b/Scripts/BuildEngine.ps1 index d11a0802..6f831b1f 100644 --- a/Scripts/BuildEngine.ps1 +++ b/Scripts/BuildEngine.ps1 @@ -87,16 +87,6 @@ if ($IsWindows) { } -if(-Not $LauncherOnly) { - $RepoRoot = [IO.Path]::Combine($PSScriptRoot, "..") - Write-Host "Ensuring submodules are initialized and updated..." - & git -C $RepoRoot submodule update --init --recursive - -} else { - Write-Host "Skipping submodules initialization..." -} - - function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { # Check if the system supports multiple configurations @@ -116,7 +106,7 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { throw 'The OS is not supported' } - Write-Host "Building $systemName $architecture $configuration" + Write-Host "Configuring $systemName $architecture $configuration" [string]$cMakeCacheVariableOverride = "" @@ -142,17 +132,38 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { # CMake Build Process # + + Write-Host "Building $systemName $architecture $configuration" + $buildArguments = "--build --preset $configName" $buildProcess = Start-Process $cMakeProgram -ArgumentList $buildArguments -NoNewWindow -PassThru - # Grab the process handle. When using `-NoNewWindow`, retrieving the ExitCode can return null once the process - # has exited. See: - # https://stackoverflow.com/questions/44057728/start-process-system-diagnostics-process-exitcode-is-null-with-nonewwindow +# Grab the process handle. When using `-NoNewWindow`, retrieving the ExitCode can return null once the process +# has exited. See: +# https://stackoverflow.com/questions/44057728/start-process-system-diagnostics-process-exitcode-is-null-with-nonewwindow $processHandle = $buildProcess.Handle $buildProcess.WaitForExit(); - if ($buildProcess.ExitCode -ne 0) { - throw "cmake failed build for '$buildArguments' with exit code '$buildProcess.ExitCode'" + if ($buildProcess.ExitCode -ne 0) { + throw "cmake failed build for '$buildArguments' with exit code '$buildProcess.ExitCode'" + } + + $install_directory ="" + + if($IsWindows){ + $install_directory = "Result.$systemName.$architecture.MultiConfig" + } + + else{ + $install_directory = "Result.$systemName.$architecture.$configuration" + } + + $installProcess = Start-Process $cMakeProgram -ArgumentList "--install $install_directory --prefix $install_directory" -NoNewWindow -PassThru + + $installProcess.WaitForExit(); + + if($installProcess.ExitCode -ne 0){ + throw "cmake failed to install to '$install_directory'" } } diff --git a/Scripts/PostBuild.ps1 b/Scripts/PostBuild.ps1 index 755e0f2b..6253d843 100644 --- a/Scripts/PostBuild.ps1 +++ b/Scripts/PostBuild.ps1 @@ -104,7 +104,7 @@ $ContentsToProcess = @( } "Linux" { @{ From = "$OuputBuildDirectory\Obelisk"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"} - @{ From = "$OuputBuildDirectory\Obelisk"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\publish\Editor"} + @{ From = "$OuputBuildDirectory\Obelisk"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"} } Default { throw 'This system is not supported' diff --git a/Scripts/RunTests.ps1 b/Scripts/RunTests.ps1 index a435a19f..57b91f44 100644 --- a/Scripts/RunTests.ps1 +++ b/Scripts/RunTests.ps1 @@ -62,22 +62,9 @@ function RunTests { param ( [string]$Configuration ) + + [string] $testExecutablePath = Join-Path $OutputBuildDirectory -ChildPath "tests/ZEngineTests") - [string]$testExecutablePath = "" - switch ($SystemName) { - "Windows" { - $testExecutablePath = [IO.Path]::Combine($OutputBuildDirectory, "ZEngine", "tests", $Configuration, "ZEngineTests.exe") - } - "Darwin" { - $testExecutablePath = Join-Path $OutputBuildDirectory -ChildPath "ZEngine/tests/$Configuration/ZEngineTests" - } - "Linux" { - $testExecutablePath = Join-Path $OutputBuildDirectory -ChildPath "ZEngine/tests/ZEngineTests" - } - Default { - throw 'This system is not supported' - } - } # Check if the executable exists if (Test-Path $testExecutablePath) { @@ -88,7 +75,6 @@ function RunTests { Write-Error "Test executable does not exist: $testExecutablePath" } } - # Run tests for each configuration foreach ($config in $Configurations) { RunTests -Configuration $config diff --git a/Tetragrama/CMakeLists.txt b/Tetragrama/CMakeLists.txt index a0d2e1e0..39f3dd52 100644 --- a/Tetragrama/CMakeLists.txt +++ b/Tetragrama/CMakeLists.txt @@ -27,8 +27,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set_target_properties(${TARGET_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(ProjectDir)$(Configuration)") endif () -include(${EXTERNAL_DIR}/externals.cmake) - target_include_directories (${TARGET_NAME} PUBLIC . @@ -54,4 +52,5 @@ target_compile_definitions(${TARGET_NAME} _UNICODE ) -target_link_libraries(${TARGET_NAME} PRIVATE zEngineLib) \ No newline at end of file +target_link_libraries(${TARGET_NAME} PUBLIC zEngineLib) + diff --git a/Tetragrama/Components/DockspaceUIComponent.cpp b/Tetragrama/Components/DockspaceUIComponent.cpp index f5ad34cc..c44a9914 100644 --- a/Tetragrama/Components/DockspaceUIComponent.cpp +++ b/Tetragrama/Components/DockspaceUIComponent.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include namespace fs = std::filesystem; diff --git a/Tetragrama/Helpers/UIComponentDrawerHelper.cpp b/Tetragrama/Helpers/UIComponentDrawerHelper.cpp index ce34015c..acc74390 100644 --- a/Tetragrama/Helpers/UIComponentDrawerHelper.cpp +++ b/Tetragrama/Helpers/UIComponentDrawerHelper.cpp @@ -13,7 +13,7 @@ namespace Tetragrama::Helpers ImGui::Columns(2); ImGui::SetColumnWidth(0, column_width); - ImGui::Text(label.data()); + ImGui::Text("%s", label.data()); ImGui::NextColumn(); ImGui::PushMultiItemsWidths(4, ImGui::CalcItemWidth()); @@ -140,7 +140,7 @@ namespace Tetragrama::Helpers ImGui::Columns(2); ImGui::SetColumnWidth(0, column_width); - ImGui::Text(label.data()); + ImGui::Text("%s", label.data()); ImGui::NextColumn(); ImGui::PushMultiItemsWidths(5, ImGui::CalcItemWidth()); @@ -243,7 +243,7 @@ namespace Tetragrama::Helpers ImGui::Columns(2); ImGui::SetColumnWidth(0, column_width); - ImGui::Text(label.data()); + ImGui::Text("%s", label.data()); ImGui::NextColumn(); ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth()); @@ -314,7 +314,7 @@ namespace Tetragrama::Helpers ImGui::Columns(2); ImGui::SetColumnWidth(0, column_width); - ImGui::Text(label.data()); + ImGui::Text("%s", label.data()); ImGui::NextColumn(); ImGui::PushMultiItemsWidths(1, ImGui::CalcItemWidth() + 60.f); @@ -349,7 +349,7 @@ namespace Tetragrama::Helpers ImGui::Columns(2); ImGui::SetColumnWidth(0, column_width); - ImGui::Text(label.data()); + ImGui::Text("%s", label.data()); ImGui::NextColumn(); ImGui::PushMultiItemsWidths(1, ImGui::CalcItemWidth() + 60.f); @@ -402,7 +402,7 @@ namespace Tetragrama::Helpers ImGui::Columns(2); ImGui::SetColumnWidth(0, column_width); - ImGui::Text(label.data()); + ImGui::Text("%s", label.data()); ImGui::NextColumn(); ImGui::PushMultiItemsWidths(1, ImGui::CalcItemWidth() + 60.f); @@ -429,7 +429,7 @@ namespace Tetragrama::Helpers ImGui::Columns(2); ImGui::SetColumnWidth(0, column_width); - ImGui::Text(label.data()); + ImGui::Text("%s", label.data()); ImGui::NextColumn(); ImGui::PushMultiItemsWidths(1, ImGui::CalcItemWidth() + 60.f); @@ -455,7 +455,7 @@ namespace Tetragrama::Helpers ImGui::Columns(2); ImGui::SetColumnWidth(0, column_width); - ImGui::Text(label.data()); + ImGui::Text("%s", label.data()); ImGui::NextColumn(); ImGui::PushMultiItemsWidths(1, ImGui::CalcItemWidth() + 60.f); diff --git a/Tetragrama/Helpers/UIComponentDrawerHelper.h b/Tetragrama/Helpers/UIComponentDrawerHelper.h index b66a5295..4c602ade 100644 --- a/Tetragrama/Helpers/UIComponentDrawerHelper.h +++ b/Tetragrama/Helpers/UIComponentDrawerHelper.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace Tetragrama::Helpers { diff --git a/ZEngine/ZEngine/CMakeLists.txt b/ZEngine/ZEngine/CMakeLists.txt index 5242a54e..a6d259bb 100644 --- a/ZEngine/ZEngine/CMakeLists.txt +++ b/ZEngine/ZEngine/CMakeLists.txt @@ -1,5 +1,3 @@ -include(${EXTERNAL_DIR}/externals.cmake) - file (GLOB_RECURSE HEADER_FILES_LIST CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.h) file (GLOB_RECURSE CPP_FILES_LIST CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) file (GLOB_RECURSE RESOURCE_FILES_LIST CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/../Resources/Shaders/*.*) @@ -9,17 +7,13 @@ source_group (TREE ${PROJECT_SOURCE_DIR}/../Resources PREFIX "Resources Files" F # ZEngine source files # -add_library (zEngineLib - STATIC - ${HEADER_FILES_LIST} - ${CPP_FILES_LIST} - ${RESOURCE_FILES_LIST} - ${EXTERNAL_DIR}/ImGuizmo/ImGuizmo.h - ${EXTERNAL_DIR}/ImGuizmo/ImGuizmo.cpp -) +add_library (zEngineLib STATIC) + +target_sources(zEngineLib PRIVATE ${CPP_FILES_LIST}) target_include_directories (zEngineLib PUBLIC + .. . ./Applications ./Core @@ -55,15 +49,16 @@ target_include_directories (zEngineLib ./Windows/Layers ./Managers ./Serializers - ${EXTERNAL_DIR} - ${EXTERNAL_INCLUDE_DIRS} ) target_precompile_headers(zEngineLib PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/pch.h) +target_compile_definitions(zEngineLib PUBLIC GLM_ENABLE_EXPERIMENTAL) + if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") target_compile_definitions (zEngineLib PUBLIC ENABLE_VULKAN_VALIDATION_LAYER) endif() + target_compile_definitions (zEngineLib PUBLIC ZENGINE_PLATFORM @@ -71,16 +66,14 @@ target_compile_definitions (zEngineLib YAML_CPP_STATIC_DEFINE ) +target_link_libraries (zEngineLib PUBLIC imported::ZEngine_External_Dependencies) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - target_compile_definitions (zEngineLib PUBLIC VK_USE_PLATFORM_WIN32_KHR) + target_link_libraries (zEngineLib PUBLIC imported::cppwinrt_headers WindowsApp.lib) + target_compile_definitions(zEngineLib PUBLIC NOMINMAX) endif() if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - target_link_libraries(zEngineLib PRIVATE stdc++fs) + target_link_libraries(zEngineLib PUBLIC stdc++fs) + target_compile_definitions(zEngineLib PUBLIC GLFW_EXPOSE_NATIVE_WAYLAND) endif () - -target_link_libraries (zEngineLib PUBLIC imported::External_libs) - -if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - target_link_libraries (zEngineLib PUBLIC imported::cppwinrt_headers WindowsApp.lib) -endif() \ No newline at end of file diff --git a/ZEngine/ZEngine/Core/CoroutineScheduler.h b/ZEngine/ZEngine/Core/CoroutineScheduler.h index 6ffa8952..6f37c2d0 100644 --- a/ZEngine/ZEngine/Core/CoroutineScheduler.h +++ b/ZEngine/ZEngine/Core/CoroutineScheduler.h @@ -14,11 +14,12 @@ namespace ZEngine::Core ReadyCallback Ready = nullptr; ExecuteCallback Action = nullptr; - + // clang-format off operator bool() noexcept { return (Ready && Action); } + // clang-format on }; struct CoroutineScheduler diff --git a/ZEngine/ZEngine/Core/Memory/MemoryManager.h b/ZEngine/ZEngine/Core/Memory/MemoryManager.h index b0836c51..78d5bca3 100644 --- a/ZEngine/ZEngine/Core/Memory/MemoryManager.h +++ b/ZEngine/ZEngine/Core/Memory/MemoryManager.h @@ -12,14 +12,14 @@ namespace ZEngine::Core::Memory { void Initialize(const MemoryConfiguration& config) { - this->Allocator.Initialize(config.DefaultSize); + this->ArenaAllocatorValue.Initialize(config.DefaultSize); } void Shutdowm() { - Allocator.Shutdown(); + ArenaAllocatorValue.Shutdown(); } - ArenaAllocator Allocator = {}; + ArenaAllocator ArenaAllocatorValue = {}; }; } // namespace ZEngine::Core::Memory diff --git a/ZEngine/ZEngine/Hardwares/AsyncResourceLoader.cpp b/ZEngine/ZEngine/Hardwares/AsyncResourceLoader.cpp index dbc5cbf5..3a4f79c1 100644 --- a/ZEngine/ZEngine/Hardwares/AsyncResourceLoader.cpp +++ b/ZEngine/ZEngine/Hardwares/AsyncResourceLoader.cpp @@ -11,7 +11,7 @@ #define STB_IMAGE_WRITE_IMPLEMENTATION #define STB_IMAGE_RESIZE_IMPLEMENTATION -#include +#include #include using namespace ZEngine::Helpers; diff --git a/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp b/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp index 160a352d..d638389b 100644 --- a/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp +++ b/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp @@ -596,17 +596,17 @@ namespace ZEngine::Hardwares ZENGINE_CORE_ERROR("{}", pCallbackData->pMessage) } - if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) == VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) + if ((messageSeverity & static_cast(VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)) == VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) { ZENGINE_CORE_WARN("{}", pCallbackData->pMessage) } - if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) == VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) + if ((messageSeverity & static_cast(VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT)) == VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) { ZENGINE_CORE_WARN("{}", pCallbackData->pMessage) } - if ((messageSeverity & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) == VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) + if ((messageSeverity & static_cast(VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT)) == VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) { ZENGINE_CORE_WARN("{}", pCallbackData->pMessage) } @@ -831,6 +831,8 @@ namespace ZEngine::Hardwares dst_access_mask = VK_ACCESS_INDIRECT_COMMAND_READ_BIT; dst_pipeline_stage = VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT; break; + case UNKNOWN: + break; } VkBufferMemoryBarrier bufMemBarrier2 = {VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER}; @@ -1058,13 +1060,10 @@ namespace ZEngine::Hardwares { VkSurfaceCapabilitiesKHR capabilities{}; vkGetPhysicalDeviceSurfaceCapabilitiesKHR(PhysicalDevice, Surface, &capabilities); - if (capabilities.currentExtent.width != std::numeric_limits::max()) - { - SwapchainImageWidth = capabilities.currentExtent.width; - SwapchainImageHeight = capabilities.currentExtent.height; - } + SwapchainImageWidth = std::clamp(CurrentWindow->GetWidth(), capabilities.minImageExtent.width, capabilities.maxImageExtent.width); + SwapchainImageHeight = std::clamp(CurrentWindow->GetHeight(), capabilities.minImageExtent.height, capabilities.maxImageExtent.height); - auto min_image_count = std::clamp(capabilities.minImageCount, capabilities.minImageCount + 1, capabilities.maxImageCount); + auto min_image_count = SwapchainImageCount < capabilities.minImageCount ? capabilities.minImageCount : SwapchainImageCount; VkSwapchainCreateInfoKHR swapchain_create_info = { .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, .pNext = nullptr, .surface = Surface, .minImageCount = min_image_count, .imageFormat = SurfaceFormat.format, .imageColorSpace = SurfaceFormat.colorSpace, .imageExtent = VkExtent2D{.width = SwapchainImageWidth, .height = SwapchainImageHeight}, .imageArrayLayers = 1, .imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT, .preTransform = capabilities.currentTransform, .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, .presentMode = PresentMode, .clipped = VK_TRUE @@ -1072,12 +1071,12 @@ namespace ZEngine::Hardwares if (SwapchainImageViews.capacity() <= 0) { - SwapchainImageViews.init(Arena, SwapchainImageCount, SwapchainImageCount); + SwapchainImageViews.init(Arena, SwapchainImageCount); } if (SwapchainFramebuffers.capacity() <= 0) { - SwapchainFramebuffers.init(Arena, SwapchainImageCount, SwapchainImageCount); + SwapchainFramebuffers.init(Arena, SwapchainImageCount); } auto scratch = ZGetScratch(Arena); @@ -1096,18 +1095,12 @@ namespace ZEngine::Hardwares ZENGINE_VALIDATE_ASSERT(vkCreateSwapchainKHR(LogicalDevice, &swapchain_create_info, nullptr, &SwapchainHandle) == VK_SUCCESS, "Failed to create Swapchain") - uint32_t image_count = 0; - ZENGINE_VALIDATE_ASSERT(vkGetSwapchainImagesKHR(LogicalDevice, SwapchainHandle, &image_count, nullptr) == VK_SUCCESS, "Failed to get Images count from Swapchain") - - if (image_count < SwapchainImageCount) - { - ZENGINE_CORE_WARN("Max Swapchain image count supported is {}, but requested {}", image_count, SwapchainImageCount); - SwapchainImageCount = image_count; - ZENGINE_CORE_WARN("Swapchain image count has changed from {} to {}", SwapchainImageCount, image_count); - } + ZENGINE_VALIDATE_ASSERT(vkGetSwapchainImagesKHR(LogicalDevice, SwapchainHandle, &SwapchainImageCount, nullptr) == VK_SUCCESS, "Failed to get Images count from Swapchain") Array SwapchainImages = {}; + SwapchainImages.init(scratch.Arena, SwapchainImageCount, SwapchainImageCount); + ZENGINE_VALIDATE_ASSERT(vkGetSwapchainImagesKHR(LogicalDevice, SwapchainHandle, &SwapchainImageCount, SwapchainImages.data()) == VK_SUCCESS, "Failed to get VkImages from Swapchain") /*Transition Image from Undefined to Present_src*/ @@ -1134,12 +1127,12 @@ namespace ZEngine::Hardwares for (int i = 0; i < SwapchainImageCount; ++i) { - SwapchainImageViews[i] = CreateImageView(SwapchainImages[i], SurfaceFormat.format, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT); + SwapchainImageViews.push(CreateImageView(SwapchainImages[i], SurfaceFormat.format, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT)); Array fb_images_views; fb_images_views.init(scratch.Arena, 1); fb_images_views.push(SwapchainImageViews[i]); - SwapchainFramebuffers[i] = CreateFramebuffer(ArrayView{fb_images_views}, SwapchainAttachment->GetHandle(), SwapchainImageWidth, SwapchainImageHeight); + SwapchainFramebuffers.push(CreateFramebuffer(ArrayView{fb_images_views}, SwapchainAttachment->GetHandle(), SwapchainImageWidth, SwapchainImageHeight)); } ZReleaseScratch(scratch); @@ -1418,6 +1411,8 @@ namespace ZEngine::Hardwares vkFreeDescriptorSets(LogicalDevice, reinterpret_cast(res_handle.Data1), 1, &ds); break; } + case DeviceResourceType::RESOURCE_COUNT: + break; } DirtyResources.Remove(handle); @@ -2095,7 +2090,7 @@ namespace ZEngine::Hardwares void Image2DBuffer::Dispose() { - if (this && m_buffer_image) + if (m_buffer_image) { Device->EnqueueBufferImageForDeletion(m_buffer_image); m_buffer_image = {}; @@ -2233,6 +2228,8 @@ namespace ZEngine::Hardwares dst_access_mask = VK_ACCESS_INDIRECT_COMMAND_READ_BIT; dst_pipeline_stage = VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT; break; + case UNKNOWN: + break; } auto command_buffer = m_device->GetInstantCommandBuffer(Rendering::QueueType::GRAPHIC_QUEUE); diff --git a/ZEngine/ZEngine/Hardwares/VulkanDevice.h b/ZEngine/ZEngine/Hardwares/VulkanDevice.h index 5b200fea..734b50d1 100644 --- a/ZEngine/ZEngine/Hardwares/VulkanDevice.h +++ b/ZEngine/ZEngine/Hardwares/VulkanDevice.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include // clang-format on @@ -75,11 +76,12 @@ namespace ZEngine::Hardwares BufferType Type = BufferType::UNKNOWN; VkBuffer Handle = VK_NULL_HANDLE; VmaAllocation Allocation = nullptr; - + // clang-format off operator bool() const { return (Handle != VK_NULL_HANDLE); } + // clang-format on }; struct BufferImage @@ -89,11 +91,12 @@ namespace ZEngine::Hardwares VkImageView ViewHandle{VK_NULL_HANDLE}; VkSampler Sampler{VK_NULL_HANDLE}; VmaAllocation Allocation{nullptr}; - + // clang-format off operator bool() const { return (Handle != VK_NULL_HANDLE); } + // clang-format on }; struct IGraphicBuffer diff --git a/ZEngine/ZEngine/Rendering/Shaders/Compilers/CompilationStage.cpp b/ZEngine/ZEngine/Rendering/Shaders/Compilers/CompilationStage.cpp index de9d4406..a67e6de2 100644 --- a/ZEngine/ZEngine/Rendering/Shaders/Compilers/CompilationStage.cpp +++ b/ZEngine/ZEngine/Rendering/Shaders/Compilers/CompilationStage.cpp @@ -1,4 +1,3 @@ -#pragma once #include #include #include diff --git a/ZEngine/ZEngine/Rendering/Shaders/Shader.cpp b/ZEngine/ZEngine/Rendering/Shaders/Shader.cpp index c411aca2..2797583f 100644 --- a/ZEngine/ZEngine/Rendering/Shaders/Shader.cpp +++ b/ZEngine/ZEngine/Rendering/Shaders/Shader.cpp @@ -98,7 +98,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name, .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::VERTEX}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::VERTEX}); } for (const auto& SB_resource : vertex_resources.storage_buffers) @@ -111,7 +111,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name, .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::VERTEX}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::VERTEX}); } for (const auto& pushConstant_resource : vertex_resources.push_constant_buffers) @@ -127,7 +127,7 @@ namespace ZEngine::Rendering::Shaders uint32_t memberSize = spirv_compiler->get_declared_struct_member_size(type, i); struct_total_size += memberSize; } - PushConstantSpecifications.push(PushConstantSpecification{.Name = pushConstant_resource.name, .Size = struct_total_size, .Offset = struct_offset, .Flags = ShaderStageFlags::VERTEX}); + PushConstantSpecifications.push(PushConstantSpecification{.Name = pushConstant_resource.name.c_str(), .Size = struct_total_size, .Offset = struct_offset, .Flags = ShaderStageFlags::VERTEX}); /* * We update the offset for next iteration */ @@ -167,7 +167,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name, .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::FRAGMENT}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::FRAGMENT}); } for (const auto& SB_resource : fragment_resources.storage_buffers) @@ -180,7 +180,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name, .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::FRAGMENT}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::FRAGMENT}); } for (const auto& pushConstant_resource : fragment_resources.push_constant_buffers) @@ -196,7 +196,7 @@ namespace ZEngine::Rendering::Shaders uint32_t memberSize = spirv_compiler->get_declared_struct_member_size(type, i); struct_total_size += memberSize; } - PushConstantSpecifications.push(PushConstantSpecification{.Name = pushConstant_resource.name, .Size = struct_total_size, .Offset = struct_offset, .Flags = ShaderStageFlags::FRAGMENT}); + PushConstantSpecifications.push(PushConstantSpecification{.Name = pushConstant_resource.name.c_str(), .Size = struct_total_size, .Offset = struct_offset, .Flags = ShaderStageFlags::FRAGMENT}); /* * We update the offset for next iteration */ @@ -225,7 +225,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Count = count, .Name = SI_resource.name, .DescriptorTypeValue = DescriptorType::COMBINED_IMAGE_SAMPLER, .Flags = ShaderStageFlags::FRAGMENT}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Count = count, .Name = SI_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::COMBINED_IMAGE_SAMPLER, .Flags = ShaderStageFlags::FRAGMENT}); } } } diff --git a/ZEngine/ZEngine/Rendering/Specifications/ShaderSpecification.h b/ZEngine/ZEngine/Rendering/Specifications/ShaderSpecification.h index 12ec27b2..aa9739c6 100644 --- a/ZEngine/ZEngine/Rendering/Specifications/ShaderSpecification.h +++ b/ZEngine/ZEngine/Rendering/Specifications/ShaderSpecification.h @@ -38,14 +38,14 @@ namespace ZEngine::Rendering::Specifications uint32_t Set{0xFFFFFFFF}; uint32_t Binding{0xFFFFFFFF}; uint32_t Count{1}; - std::string Name; + const char* Name; DescriptorType DescriptorTypeValue; ShaderStageFlags Flags; }; struct PushConstantSpecification { - std::string Name; + const char* Name; uint32_t Size; uint32_t Offset; ShaderStageFlags Flags; diff --git a/ZEngine/ZEngine/Windows/GameWindow.h b/ZEngine/ZEngine/Windows/GameWindow.h index 326e9473..d84b5bcc 100644 --- a/ZEngine/ZEngine/Windows/GameWindow.h +++ b/ZEngine/ZEngine/Windows/GameWindow.h @@ -1,5 +1,4 @@ #pragma once -#define GLFW_INCLUDE_VULKAN #include #include #include diff --git a/ZEngine/ZEngine/Windows/Inputs/KeyCode.h b/ZEngine/ZEngine/Windows/Inputs/KeyCode.h index 8bf5095f..7a8663e1 100644 --- a/ZEngine/ZEngine/Windows/Inputs/KeyCode.h +++ b/ZEngine/ZEngine/Windows/Inputs/KeyCode.h @@ -1,6 +1,6 @@ #pragma once +#include #include -#include namespace ZEngine::Windows::Inputs { @@ -138,9 +138,8 @@ namespace ZEngine::Windows::Inputs } GlfwKey; - inline std::ostream& operator<<(std::ostream& stream, GlfwKeyCode f) + inline auto format_as(GlfwKey f) { - stream << static_cast(f); - return stream; + return fmt::underlying(f); } } // namespace ZEngine::Windows::Inputs diff --git a/ZEngine/ZEngine/pch.h b/ZEngine/ZEngine/pch.h index e2153cbd..8a31136f 100644 --- a/ZEngine/ZEngine/pch.h +++ b/ZEngine/ZEngine/pch.h @@ -1,6 +1,4 @@ #pragma once -#include -#include #include #include #include @@ -8,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -15,4 +14,5 @@ #include #include #include +#include #include diff --git a/ZEngine/tests/CMakeLists.txt b/ZEngine/tests/CMakeLists.txt index 79ced67e..b9449a38 100644 --- a/ZEngine/tests/CMakeLists.txt +++ b/ZEngine/tests/CMakeLists.txt @@ -12,3 +12,8 @@ target_link_libraries(ZEngineTests PRIVATE zEngineLib GTest::gtest_main ) + +set_target_properties(ZEngineTests PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) + +install(TARGETS ZEngineTests + RUNTIME DESTINATION tests) diff --git a/ZEngine/tests/Memory/allocator_test.cpp b/ZEngine/tests/Memory/allocator_test.cpp index c81f8ad3..05bf42d1 100644 --- a/ZEngine/tests/Memory/allocator_test.cpp +++ b/ZEngine/tests/Memory/allocator_test.cpp @@ -82,14 +82,14 @@ TEST(AllocatorTest, ArenaMemoryManager) void Func() {} }; - int* intPtr = ZPushArray(&(manager.Allocator), int, 1); - auto structPtr = ZPushStruct(&(manager.Allocator), Foo); + int* intPtr = ZPushArray(&(manager.ArenaAllocatorValue), int, 1); + auto structPtr = ZPushStruct(&(manager.ArenaAllocatorValue), Foo); *intPtr = 12; structPtr->x = 12; structPtr->y = 798.0f; - char* str = ZPushString(&(manager.Allocator), 12); + char* str = ZPushString(&(manager.ArenaAllocatorValue), 12); Helpers::secure_memmove(str, 12, "hello", 5); EXPECT_EQ(*intPtr, 12); @@ -121,7 +121,7 @@ TEST(AllocatorTest, ArenaMemoryTemp) { MemoryManager manager{}; manager.Initialize({.DefaultSize = ZKilo(10)}); - auto arena = &(manager.Allocator); + auto arena = &(manager.ArenaAllocatorValue); { auto fooPtr = ZPushStruct(arena, Foo); fooPtr->x = 10; @@ -142,7 +142,7 @@ TEST(AllocatorTest, ArenaMemoryPool) { MemoryManager manager{}; manager.Initialize({.DefaultSize = ZKilo(10)}); - auto arena = &(manager.Allocator); + auto arena = &(manager.ArenaAllocatorValue); { PoolAllocator pool; pool.Initialize(arena, sizeof(Foo) * 100, sizeof(Foo)); diff --git a/ZEngine/tests/Memory/handleManager_test.cpp b/ZEngine/tests/Memory/handleManager_test.cpp index 6508127f..f6566122 100644 --- a/ZEngine/tests/Memory/handleManager_test.cpp +++ b/ZEngine/tests/Memory/handleManager_test.cpp @@ -10,7 +10,7 @@ class HandleManagerTest : public ::testing::Test void SetUp() override { manager.Initialize({.DefaultSize = ZKilo(10)}); - auto arena = &(manager.Allocator); + auto arena = &(manager.ArenaAllocatorValue); handle_manager.Initialize(arena, 10); } @@ -114,7 +114,7 @@ TEST_F(HandleManagerTest, ReuseSlot) TEST_F(HandleManagerTest, ConcurrentAccess) { ZEngine::Helpers::HandleManager h_manager; - h_manager.Initialize(&(manager.Allocator), 40); + h_manager.Initialize(&(manager.ArenaAllocatorValue), 40); const int numThreads = 4; const int numOperationsPerThread = 10; std::vector threads; diff --git a/__externals/CLI11 b/__externals/CLI11 deleted file mode 160000 index f75fd22b..00000000 --- a/__externals/CLI11 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f75fd22ba323bbb3b6621ed9beaf8f52f24796fd diff --git a/__externals/ImGuizmo b/__externals/ImGuizmo deleted file mode 160000 index e3174578..00000000 --- a/__externals/ImGuizmo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e3174578bdc99c715e51c5ad88e7d50b4eeb19b0 diff --git a/__externals/SPIRV-Cross b/__externals/SPIRV-Cross deleted file mode 160000 index 4818f7e7..00000000 --- a/__externals/SPIRV-Cross +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4818f7e7ef7b7078a3a7a5a52c4a338e0dda22f4 diff --git a/__externals/SPIRV-Tools b/__externals/SPIRV-Tools deleted file mode 160000 index dda7731e..00000000 --- a/__externals/SPIRV-Tools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dda7731e91c130e64980d987a02f5c75356400cc diff --git a/__externals/SPIRV-headers b/__externals/SPIRV-headers deleted file mode 160000 index 7d500c4d..00000000 --- a/__externals/SPIRV-headers +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7d500c4d75ae3fbd37e1d5a20008ca9c8ee3c860 diff --git a/__externals/Vulkan-Headers b/__externals/Vulkan-Headers deleted file mode 160000 index b379292b..00000000 --- a/__externals/Vulkan-Headers +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b379292b2ab6df5771ba9870d53cf8b2c9295daf diff --git a/__externals/Vulkan-Loader b/__externals/Vulkan-Loader deleted file mode 160000 index 40b8e6ee..00000000 --- a/__externals/Vulkan-Loader +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 40b8e6eeead809a62c708cb48fdd9f8f2eab3f15 diff --git a/__externals/VulkanMemoryAllocator b/__externals/VulkanMemoryAllocator deleted file mode 160000 index 1d8f600f..00000000 --- a/__externals/VulkanMemoryAllocator +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1d8f600fd424278486eade7ed3e877c99f0846b1 diff --git a/__externals/assimp b/__externals/assimp deleted file mode 160000 index 70f5cca9..00000000 --- a/__externals/assimp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 70f5cca9c3ebd84b89c5775852ac9aa2449f6c5b diff --git a/__externals/entt b/__externals/entt deleted file mode 160000 index 41aab920..00000000 --- a/__externals/entt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 41aab920b083aa424ac1d27666ce287eeaff6ceb diff --git a/__externals/fmt b/__externals/fmt deleted file mode 160000 index e41ac1f8..00000000 --- a/__externals/fmt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e41ac1f875b7a1c419beaf7ddf431a01fb530a92 diff --git a/__externals/glfw b/__externals/glfw deleted file mode 160000 index fb0f2f92..00000000 --- a/__externals/glfw +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fb0f2f92a38c1d6a776ffeb253329f8d1c65694c diff --git a/__externals/glslang b/__externals/glslang deleted file mode 160000 index 32257786..00000000 --- a/__externals/glslang +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3225778615fd9d7e23fd11b71a05097d59ba0247 diff --git a/__externals/gtest b/__externals/gtest deleted file mode 160000 index b10fad38..00000000 --- a/__externals/gtest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b10fad38c4026a29ea6561ab15fc4818170d1c10 diff --git a/__externals/imgui/CMakeLists.txt b/__externals/imgui/CMakeLists.txt deleted file mode 100644 index ac832140..00000000 --- a/__externals/imgui/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -set(CMAKE_CXX_STANDARD 11) - -list (APPEND IMGUI_SOURCE - src/imgui.cpp - src/imgui_tables.cpp - src/imgui_widgets.cpp - src/imgui_demo.cpp - src/imgui_draw.cpp - src/backends/imgui_impl_vulkan.cpp - src/backends/imgui_impl_glfw.cpp -) - -# Source files -# -add_library (imgui STATIC ) - -target_sources(imgui PRIVATE ${IMGUI_SOURCE}) - -# include directories -# -target_include_directories (imgui - PUBLIC - ./src - ./src/backends -) - -target_link_libraries(imgui PUBLIC glfw Vulkan::Headers Vulkan::Loader) - diff --git a/__externals/imgui/src b/__externals/imgui/src deleted file mode 160000 index c191faf0..00000000 --- a/__externals/imgui/src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c191faf0ba478e9c58a69c63306986a21ebfb6e4 diff --git a/__externals/nlohmann_json b/__externals/nlohmann_json deleted file mode 160000 index 0457de21..00000000 --- a/__externals/nlohmann_json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0457de21cffb298c22b629e538036bfeb96130b7 diff --git a/__externals/rapidhash/CMakeLists.txt b/__externals/rapidhash/CMakeLists.txt deleted file mode 100644 index 44218ca0..00000000 --- a/__externals/rapidhash/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.12) -project(rapidhash) - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_library(rapidhash INTERFACE) - -target_include_directories(rapidhash INTERFACE - $ -) diff --git a/__externals/rapidhash/src b/__externals/rapidhash/src deleted file mode 160000 index c1f35e3a..00000000 --- a/__externals/rapidhash/src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c1f35e3a44010bf90a9008013d8ab7c7b9aaae2c diff --git a/__externals/spdlog b/__externals/spdlog deleted file mode 160000 index 6491abb5..00000000 --- a/__externals/spdlog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6491abb519a6a15792c1c6717270ce6c9ba4d72e diff --git a/__externals/stb b/__externals/stb deleted file mode 160000 index 8e51be04..00000000 --- a/__externals/stb +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8e51be04dc7dcee462e1f09e410faceab52cc6d2 diff --git a/__externals/stduuid b/__externals/stduuid deleted file mode 160000 index 5c538cca..00000000 --- a/__externals/stduuid +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5c538cca02932aa0266659661d5b4726f3a317c7 diff --git a/__externals/tlsf/CMakeLists.txt b/__externals/tlsf/CMakeLists.txt deleted file mode 100644 index 2ea24439..00000000 --- a/__externals/tlsf/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -set(CMAKE_CXX_STANDARD 11) - -list (APPEND TLSF_SOURCE - src/tlsf.h - src/tlsf.c -) - -# Source files -# -add_library (tlsf STATIC ${TLSF_SOURCE}) - -# include directories -# -target_include_directories (tlsf - PUBLIC - ./src -) - diff --git a/__externals/tlsf/src b/__externals/tlsf/src deleted file mode 160000 index deff9ab5..00000000 --- a/__externals/tlsf/src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit deff9ab509341f264addbd3c8ada533678591905 diff --git a/__externals/yaml-cpp b/__externals/yaml-cpp deleted file mode 160000 index c73ee347..00000000 --- a/__externals/yaml-cpp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c73ee34704c512ebe915b283645aefa9f424a22f diff --git a/dependencies.cmake b/dependencies.cmake index 9f729772..2f9f221f 100644 --- a/dependencies.cmake +++ b/dependencies.cmake @@ -1,3 +1,282 @@ +include(FetchContent) + +FetchContent_Declare( + fmt + GIT_REPOSITORY https://github.com/fmtlib/fmt.git + GIT_SHALLOW TRUE + ) + +FetchContent_Declare( + imgui + GIT_REPOSITORY https://github.com/ocornut/imgui.git + GIT_SHALLOW TRUE + GIT_TAG v1.89.9-docking + SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/imgui" + ) + +FetchContent_Declare( + imguizmo + GIT_REPOSITORY https://github.com/CedricGuillemet/ImGuizmo.git + GIT_SHALLOW TRUE + GIT_TAG 1.83 + SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/ImGuizmo" + ) + +FetchContent_Declare( + stb + GIT_REPOSITORY https://github.com/nothings/stb.git + GIT_SHALLOW TRUE + SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/stb + ) + +FetchContent_Declare( + glfw3 + GIT_REPOSITORY https://github.com/glfw/glfw.git + GIT_SHALLOW TRUE + GIT_TAG 3.4 + ) + +FetchContent_Declare( + spdlog + GIT_REPOSITORY https://github.com/gabime/spdlog.git + GIT_SHALLOW TRUE + GIT_TAG v1.15.3 + ) + +FetchContent_Declare( + EnTT + GIT_REPOSITORY https://github.com/skypjack/entt.git + GIT_SHALLOW TRUE + + ) + +FetchContent_Declare( + assimp + GIT_REPOSITORY https://github.com/assimp/assimp.git + GIT_SHALLOW TRUE + + ) + +FetchContent_Declare( + stduuid + GIT_REPOSITORY https://github.com/mariusbancila/stduuid.git + GIT_SHALLOW TRUE + + ) + +FetchContent_Declare( + yaml-cpp + GIT_REPOSITORY https://github.com/jbeder/yaml-cpp + GIT_SHALLOW TRUE + + ) + + +FetchContent_Declare( + spirv_cross_core + GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Cross.git + GIT_TAG vulkan-sdk-1.3.296.0 + GIT_SHALLOW TRUE + ) + +FetchContent_Declare( + VulkanMemoryAllocator + GIT_REPOSITORY https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator + GIT_SHALLOW TRUE + GIT_TAG v3.3.0 +) + +FetchContent_Declare( + SPIRV-Headers + GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Headers.git + GIT_SHALLOW TRUE + GIT_TAG vulkan-sdk-1.3.296.0 +) + +FetchContent_Declare( + glslang + GIT_REPOSITORY https://github.com/KhronosGroup/glslang.git + GIT_SHALLOW TRUE + GIT_TAG 14.3.0 + SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/glslang" + +) + + +FetchContent_Declare( + SPIRV-Tools + GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Tools.git + GIT_SHALLOW TRUE + GIT_TAG vulkan-sdk-1.3.296.0 +) + + +Fetchcontent_Declare( + GTest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_SHALLOW TRUE + GIT_TAG main +) + +Fetchcontent_Declare( + nlohmann_json + GIT_REPOSITORY https://github.com/nlohmann/json.git + GIT_SHALLOW TRUE + +) + +Fetchcontent_Declare( + tlsf + GIT_REPOSITORY https://github.com/mattconte/tlsf + GIT_SHALLOW TRUE + SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/tlsf + +) + +Fetchcontent_Declare( + CLI11 + GIT_REPOSITORY https://github.com/CLIUtils/CLI11 + GIT_SHALLOW TRUE + GIT_TAG main + SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/CLI11 + +) + + +Fetchcontent_Declare( + rapidhash + GIT_REPOSITORY https://github.com/Nicoshev/rapidhash + GIT_SHALLOW TRUE + SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/rapidhash + +) + +FetchContent_Declare(Vulkan-Headers + GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Headers + GIT_SHALLOW TRUE + GIT_TAG vulkan-sdk-1.3.296.0 +) + +FetchContent_Declare(Vulkan-Loader + GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Loader + GIT_SHALLOW TRUE + GIT_TAG vulkan-sdk-1.3.296.0 +) + + +FetchContent_MakeAvailable( + fmt + Vulkan-Headers + Vulkan-Loader + imgui + ImGuizmo + stb + glfw3 + spdlog + EnTT + assimp + stduuid + yaml-cpp + VulkanMemoryAllocator + SPIRV-Headers + SPIRV-Tools + glslang + spirv_cross_core + GTest + nlohmann_json + tlsf + CLI11 + rapidhash + ) + +set(IMGUIDIR ${FETCHCONTENT_BASE_DIR}/imgui) + +add_library(imgui STATIC) + +target_sources( + imgui + PRIVATE ${IMGUIDIR}/imgui.cpp + ${IMGUIDIR}/imgui_demo.cpp + ${IMGUIDIR}/imgui_draw.cpp + ${IMGUIDIR}/imgui_tables.cpp + ${IMGUIDIR}/imgui_widgets.cpp + ${IMGUIDIR}/misc/cpp/imgui_stdlib.cpp + ${IMGUIDIR}/backends/imgui_impl_glfw.cpp + ${IMGUIDIR}/backends/imgui_impl_vulkan.cpp) + + target_include_directories(imgui + PUBLIC ${FETCHCONTENT_BASE_DIR} + PUBLIC ${FETCHCONTENT_BASE_DIR}/imgui + ) + +target_compile_definitions(imgui PUBLIC GLFW_INCLUDE_VULKAN IMGUI_DEFINE_MATH_OPERATORS) + +target_link_libraries(imgui PUBLIC glfw Vulkan::Headers Vulkan::Loader) + +add_library(imguizmo STATIC) + +target_sources(imguizmo + PRIVATE ${FETCHCONTENT_BASE_DIR}/ImGuizmo/ImGuizmo.cpp) + +target_include_directories(imguizmo + PUBLIC ${FETCHCONTENT_BASE_DIR}/imguizmo-src) + +target_link_libraries(imguizmo PUBLIC imgui) + +add_library(External_libs INTERFACE) + +target_include_directories(External_libs + INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} + ${FETCHCONTENT_BASE_DIR} + ${FETCHCONTENT_BASE_DIR}/rapidhash + ${FETCHCONTENT_BASE_DIR}/stb + ${FETCHCONTENT_BASE_DIR}/CLI11 + ${FETCHCONTENT_BASE_DIR}/tlsf + ) + + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + target_link_libraries(External_libs INTERFACE SPIRV-Tools-static) +else() + target_link_libraries(External_libs INTERFACE SPIRV-Tools) + +endif() + + +target_link_libraries(External_libs + INTERFACE + fmt::fmt + imguizmo + spdlog::spdlog + EnTT::EnTT + assimp::assimp + stduuid + yaml-cpp::yaml-cpp + spirv-cross-core + SPIRV-Tools-opt + glslang::glslang + glslang::glslang-default-resource-limits + glslang::SPIRV + glslang::SPVRemapper + GPUOpen::VulkanMemoryAllocator + nlohmann_json::nlohmann_json +) + + +add_library(imported::ZEngine_External_Dependencies ALIAS External_libs) + +add_library(External_obeliskLibs INTERFACE) +target_link_libraries(External_obeliskLibs + INTERFACE + CLI11::CLI11 +) + +add_library(imported::External_obeliskLibs ALIAS External_obeliskLibs) + +include(${CMAKE_CURRENT_SOURCE_DIR}/Scripts/CMake/NuGet.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/Scripts/CMake/CppWinRT.cmake) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") # Install necessary NuGet dependencies install_nuget_package(Microsoft.Windows.CppWinRT 2.0.240405.15 CPPWINRT_NUGET_PATH) @@ -17,4 +296,4 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") target_include_directories(imported::cppwinrt_headers INTERFACE ${CMAKE_BINARY_DIR}/__winrt ) -endif() \ No newline at end of file +endif() diff --git a/repoConfiguration.json b/repoConfiguration.json index b279be33..4e2c5507 100644 --- a/repoConfiguration.json +++ b/repoConfiguration.json @@ -24,7 +24,7 @@ }, "LLVM": { "Version": "20.1.7", - "MaximumVersion": "20.2.0" + "MaximumVersion": "21.2.0" } } } From e7ea056099d66ef1e8e559c7ba2ed0bfb09bf1c6 Mon Sep 17 00:00:00 2001 From: Mathew Benson Date: Sun, 30 Nov 2025 23:52:31 +0300 Subject: [PATCH 2/2] Revert Swapchain Related Changes to VulkanDevice.cpp - Being worked on by another branch. --- ZEngine/ZEngine/Hardwares/VulkanDevice.cpp | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp b/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp index d638389b..4f069a1a 100644 --- a/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp +++ b/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp @@ -1060,10 +1060,13 @@ namespace ZEngine::Hardwares { VkSurfaceCapabilitiesKHR capabilities{}; vkGetPhysicalDeviceSurfaceCapabilitiesKHR(PhysicalDevice, Surface, &capabilities); - SwapchainImageWidth = std::clamp(CurrentWindow->GetWidth(), capabilities.minImageExtent.width, capabilities.maxImageExtent.width); - SwapchainImageHeight = std::clamp(CurrentWindow->GetHeight(), capabilities.minImageExtent.height, capabilities.maxImageExtent.height); + if (capabilities.currentExtent.width != std::numeric_limits::max()) + { + SwapchainImageWidth = capabilities.currentExtent.width; + SwapchainImageHeight = capabilities.currentExtent.height; + } - auto min_image_count = SwapchainImageCount < capabilities.minImageCount ? capabilities.minImageCount : SwapchainImageCount; + auto min_image_count = std::clamp(capabilities.minImageCount, capabilities.minImageCount + 1, capabilities.maxImageCount); VkSwapchainCreateInfoKHR swapchain_create_info = { .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, .pNext = nullptr, .surface = Surface, .minImageCount = min_image_count, .imageFormat = SurfaceFormat.format, .imageColorSpace = SurfaceFormat.colorSpace, .imageExtent = VkExtent2D{.width = SwapchainImageWidth, .height = SwapchainImageHeight}, .imageArrayLayers = 1, .imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT, .preTransform = capabilities.currentTransform, .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, .presentMode = PresentMode, .clipped = VK_TRUE @@ -1071,12 +1074,12 @@ namespace ZEngine::Hardwares if (SwapchainImageViews.capacity() <= 0) { - SwapchainImageViews.init(Arena, SwapchainImageCount); + SwapchainImageViews.init(Arena, SwapchainImageCount, SwapchainImageCount); } if (SwapchainFramebuffers.capacity() <= 0) { - SwapchainFramebuffers.init(Arena, SwapchainImageCount); + SwapchainFramebuffers.init(Arena, SwapchainImageCount, SwapchainImageCount); } auto scratch = ZGetScratch(Arena); @@ -1095,12 +1098,18 @@ namespace ZEngine::Hardwares ZENGINE_VALIDATE_ASSERT(vkCreateSwapchainKHR(LogicalDevice, &swapchain_create_info, nullptr, &SwapchainHandle) == VK_SUCCESS, "Failed to create Swapchain") - ZENGINE_VALIDATE_ASSERT(vkGetSwapchainImagesKHR(LogicalDevice, SwapchainHandle, &SwapchainImageCount, nullptr) == VK_SUCCESS, "Failed to get Images count from Swapchain") + uint32_t image_count = 0; + ZENGINE_VALIDATE_ASSERT(vkGetSwapchainImagesKHR(LogicalDevice, SwapchainHandle, &image_count, nullptr) == VK_SUCCESS, "Failed to get Images count from Swapchain") - Array SwapchainImages = {}; + if (image_count < SwapchainImageCount) + { + ZENGINE_CORE_WARN("Max Swapchain image count supported is {}, but requested {}", image_count, SwapchainImageCount); + SwapchainImageCount = image_count; + ZENGINE_CORE_WARN("Swapchain image count has changed from {} to {}", SwapchainImageCount, image_count); + } + Array SwapchainImages = {}; SwapchainImages.init(scratch.Arena, SwapchainImageCount, SwapchainImageCount); - ZENGINE_VALIDATE_ASSERT(vkGetSwapchainImagesKHR(LogicalDevice, SwapchainHandle, &SwapchainImageCount, SwapchainImages.data()) == VK_SUCCESS, "Failed to get VkImages from Swapchain") /*Transition Image from Undefined to Present_src*/ @@ -1127,12 +1136,12 @@ namespace ZEngine::Hardwares for (int i = 0; i < SwapchainImageCount; ++i) { - SwapchainImageViews.push(CreateImageView(SwapchainImages[i], SurfaceFormat.format, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT)); + SwapchainImageViews[i] = CreateImageView(SwapchainImages[i], SurfaceFormat.format, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT); Array fb_images_views; fb_images_views.init(scratch.Arena, 1); fb_images_views.push(SwapchainImageViews[i]); - SwapchainFramebuffers.push(CreateFramebuffer(ArrayView{fb_images_views}, SwapchainAttachment->GetHandle(), SwapchainImageWidth, SwapchainImageHeight)); + SwapchainFramebuffers[i] = CreateFramebuffer(ArrayView{fb_images_views}, SwapchainAttachment->GetHandle(), SwapchainImageWidth, SwapchainImageHeight); } ZReleaseScratch(scratch);