The engine now displays a blue flashing square

This commit is contained in:
Alexandre 2026-04-19 20:37:16 +02:00
parent 0e1c4da452
commit 83c5c0bde4
34 changed files with 729 additions and 1184 deletions

7
.clangd Normal file
View File

@ -0,0 +1,7 @@
CompileFlags:
CompilationDatabase: bin/debug
Add:
- -DENGINE_IMPL
- -DIMAGES_IMPL
- -DINITIALIZERS_IMPL
- -DPIPELINES_IMPL

View File

@ -1,17 +1,28 @@
cmake_minimum_required (VERSION 3.29) cmake_minimum_required (VERSION 3.29)
include(FetchContent)
#LTO
include(CheckIPOSupported)
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT LTO_ERROR)
project(VulkanEngine) project(VulkanEngine)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
find_program(GCC_AR NAMES gcc-ar REQUIRED)
find_program(GCC_RANLIB NAMES gcc-ranlib REQUIRED)
set(CMAKE_AR "${GCC_AR}")
set(CMAKE_RANLIB "${GCC_RANLIB}")
endif()
# Find all package dependencies # Find all package dependencies
find_package( glfw3 REQUIRED ) find_package( glfw3 REQUIRED )
find_package( glm REQUIRED ) find_package( glm REQUIRED )
find_package( VulkanMemoryAllocator CONFIG REQUIRED ) find_package( VulkanMemoryAllocator CONFIG REQUIRED )
find_package( fmt REQUIRED ) find_package( fmt REQUIRED )
# fastgltf because it's not in nixpkgs # fastgltf because it's not in nixpkgs
include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
fastgltf fastgltf
@ -20,28 +31,35 @@ FetchContent_Declare(
) )
FetchContent_MakeAvailable(fastgltf) FetchContent_MakeAvailable(fastgltf)
# Enables LTO # vk-bootstrap because CMAKE can't find it on NixOS
include(CheckIPOSupported) FetchContent_Declare(
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT LTO_ERROR) vk-bootstrap
GIT_REPOSITORY https://github.com/charles-lunarg/vk-bootstrap.git
if(LTO_SUPPORTED AND CMAKE_BUILD_TYPE STREQUAL "Release") GIT_TAG v1.3.295
message(STATUS "LTO activated") )
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) FetchContent_MakeAvailable(vk-bootstrap)
else()
message(WARNING "LTO not supported : ${LTO_ERROR}")
endif()
# A function to automate executables aditions # A function to automate executables aditions
function ( addBinary BINARY_NAME ) function ( addBinary BINARY_NAME )
cmake_parse_arguments ( BINARY "" "SHADER" "LIBS;TEXTURES;MODELS" ${ARGN} ) cmake_parse_arguments ( BINARY "" "SHADER" "LIBS;TEXTURES;MODELS" ${ARGN} )
add_executable ( ${BINARY_NAME} src/${BINARY_NAME}.cpp ) add_executable ( ${BINARY_NAME} src/${BINARY_NAME}.cpp )
# Sets the output dir to have clear separation between binaries # Sets the output dir to have clear separation between binaries
set_target_properties ( ${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BINARY_NAME} ) set_target_properties ( ${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BINARY_NAME} )
set_target_properties ( ${BINARY_NAME} PROPERTIES CXX_STANDARD 20 ) # Uses C++20 set_target_properties ( ${BINARY_NAME} PROPERTIES CXX_STANDARD 20 ) # Uses C++20
# Sets per binary LTO
if(LTO_SUPPORTED AND CMAKE_BUILD_TYPE STREQUAL "Release")
set_target_properties(${BINARY_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
message("Enabled LTO")
endif()
set_target_properties(${BINARY_NAME} PROPERTIES CXX_SCAN_FOR_MODULES OFF)
# Define VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS to treat VK_ERROR_OUT_OF_DATE_KHR as a success code # Define VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS to treat VK_ERROR_OUT_OF_DATE_KHR as a success code
target_compile_definitions ( ${BINARY_NAME} PRIVATE "VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS" ) target_compile_definitions (
${BINARY_NAME}
PRIVATE
"VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS"
$<$<CONFIG:Debug>:DEBUG> # So CMAKE expose a #define DEBUG for debug builds
)
@ -83,5 +101,5 @@ endfunction()
addBinary ( addBinary (
main main
LIBS glfw fmt LIBS glfw fmt vk-bootstrap vulkan
) )

65
CMakePresets.json Normal file
View File

@ -0,0 +1,65 @@
{
"version": 6,
"cmakeMinimumRequired": { "major": 3 },
"configurePresets": [
{
"name": "base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/bin/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "debug",
"displayName": "Debug",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS_DEBUG": "-g"
}
},
{
"name": "debug-san",
"displayName": "Debug + Sanitizers",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=address,undefined"
}
},
{
"name": "release",
"displayName": "Release",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS_RELEASE": "-O3 -march=native -flto"
}
},
{
"name": "release-fast",
"displayName": "Release (Ofast, non-conformant)",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS_RELEASE": "-Ofast -march=native -flto"
}
}
],
"buildPresets": [
{
"name": "debug",
"displayName": "Build Debug",
"configurePreset": "debug"
},
{
"name": "release",
"displayName": "Build Release",
"configurePreset": "release"
}
]
}

Binary file not shown.

View File

@ -1,12 +0,0 @@
# ninja log v7
2 427 1776550681641674341 CMakeFiles/main.dir/src/main.cpp.o.ddi 2c0b378e41ca85e7
427 439 1776550682079111060 CMakeFiles/main.dir/CXX.dd 64625a41e7cb2d24
427 439 1776550682079111060 CMakeFiles/main.dir/CXXModules.json 64625a41e7cb2d24
427 439 1776550682079111060 CMakeFiles/main.dir/src/main.cpp.o.modmap 64625a41e7cb2d24
4 3253 1776550681644433449 _deps/fastgltf-build/CMakeFiles/fastgltf.dir/src/io.cpp.o 55102a173727ecf5
3 3477 1776550681643892334 _deps/fastgltf-build/CMakeFiles/fastgltf.dir/src/base64.cpp.o 24783971ab3df401
440 3482 1776550682079675167 CMakeFiles/main.dir/src/main.cpp.o a3ec966cb9dd3537
3482 3662 1776550685121680911 main/main c71c2a00f8b47f97
5 3711 1776550681644674346 _deps/fastgltf-build/CMakeFiles/fastgltf.dir/deps/simdjson/simdjson.cpp.o 81bd726d153d0dba
3 7925 1776550681642674342 _deps/fastgltf-build/CMakeFiles/fastgltf.dir/src/fastgltf.cpp.o 808ecdb040f91506
7925 8045 1776550689564689298 _deps/fastgltf-build/libfastgltf.a 35ed20c53ec12f4b

View File

@ -1,21 +0,0 @@
# ninja log v7
0 15 1776550664112641249 fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-mkdir e7b554f212059804
0 15 1776550664112641249 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-mkdir e7b554f212059804
15 1596 1776550665693644234 fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-download d6b057c3f4523864
15 1596 1776550665693644234 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-download d6b057c3f4523864
1596 1615 1776550665694644236 fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-update 18ab84be450bf721
1596 1615 1776550665694644236 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-update 18ab84be450bf721
1615 1633 1776550665730644304 fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch 4ddfc104a209a355
1615 1633 1776550665730644304 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch 4ddfc104a209a355
1633 1652 1776550665749644340 fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-configure f003ba6b94beeb51
1633 1652 1776550665749644340 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-configure f003ba6b94beeb51
1652 1670 1776550665767644374 fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-build 94eddf46f8205f82
1652 1670 1776550665767644374 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-build 94eddf46f8205f82
1670 1688 1776550665786644410 fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install 8ab81e46393e391c
1670 1688 1776550665786644410 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install 8ab81e46393e391c
1688 1707 1776550665804644443 fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-test 985ab92c32343512
1688 1707 1776550665804644443 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-test 985ab92c32343512
1707 1733 1776550665831644495 CMakeFiles/fastgltf-populate-complete 4f7c559732830105
1707 1733 1776550665831644495 fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-done 4f7c559732830105
1707 1733 1776550665831644495 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/CMakeFiles/fastgltf-populate-complete 4f7c559732830105
1707 1733 1776550665831644495 /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-done 4f7c559732830105

View File

@ -1,42 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION 4.1.2)
# Reject any attempt to use a toolchain file. We must not use one because
# we could be downloading it here. If the CMAKE_TOOLCHAIN_FILE environment
# variable is set, the cache variable will have been initialized from it.
unset(CMAKE_TOOLCHAIN_FILE CACHE)
unset(ENV{CMAKE_TOOLCHAIN_FILE})
# We name the project and the target for the ExternalProject_Add() call
# to something that will highlight to the user what we are working on if
# something goes wrong and an error message is produced.
project(fastgltf-populate NONE)
# Pass through things we've already detected in the main project to avoid
# paying the cost of redetecting them again in ExternalProject_Add()
set(GIT_EXECUTABLE [==[/etc/profiles/per-user/alex/bin/git]==])
set(GIT_VERSION_STRING [==[2.53.0]==])
set_property(GLOBAL PROPERTY _CMAKE_FindGit_GIT_EXECUTABLE_VERSION
[==[/etc/profiles/per-user/alex/bin/git;2.53.0]==]
)
include(ExternalProject)
ExternalProject_Add(fastgltf-populate
"UPDATE_DISCONNECTED" "False" "GIT_REPOSITORY" "https://github.com/spnda/fastgltf.git" "EXTERNALPROJECT_INTERNAL_ARGUMENT_SEPARATOR" "GIT_TAG" "v0.8.0"
SOURCE_DIR "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
BINARY_DIR "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
USES_TERMINAL_DOWNLOAD YES
USES_TERMINAL_UPDATE YES
USES_TERMINAL_PATCH YES
)

View File

@ -1,208 +0,0 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Ninja" Generator, CMake Version 4.1
# This file contains all the build statements describing the
# compilation DAG.
# =============================================================================
# Write statements declared in CMakeLists.txt:
#
# Which is the root file.
# =============================================================================
# =============================================================================
# Project: fastgltf-populate
# Configurations:
# =============================================================================
#############################################
# Minimal version of Ninja required by this file
ninja_required_version = 1.5
# =============================================================================
# Include auxiliary files.
#############################################
# Include rules file.
include CMakeFiles/rules.ninja
# =============================================================================
#############################################
# Logical path to working directory; prefix for absolute paths.
cmake_ninja_workdir = /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/
#############################################
# Utility command for fastgltf-populate
build fastgltf-populate: phony CMakeFiles/fastgltf-populate CMakeFiles/fastgltf-populate-complete fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-done fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-configure fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-download fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-mkdir fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-test fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-update
#############################################
# Utility command for edit_cache
build CMakeFiles/edit_cache.util: CUSTOM_COMMAND
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
DESC = No interactive CMake dialog available...
restat = 1
build edit_cache: phony CMakeFiles/edit_cache.util
#############################################
# Utility command for rebuild_cache
build CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake --regenerate-during-build -S/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild -B/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild
DESC = Running CMake to regenerate build system...
pool = console
restat = 1
build rebuild_cache: phony CMakeFiles/rebuild_cache.util
#############################################
# Phony custom command for CMakeFiles/fastgltf-populate
build CMakeFiles/fastgltf-populate | ${cmake_ninja_workdir}CMakeFiles/fastgltf-populate: phony CMakeFiles/fastgltf-populate-complete
#############################################
# Custom command for CMakeFiles/fastgltf-populate-complete
build CMakeFiles/fastgltf-populate-complete fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-done | ${cmake_ninja_workdir}CMakeFiles/fastgltf-populate-complete ${cmake_ninja_workdir}fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-done: CUSTOM_COMMAND fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-mkdir fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-download fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-update fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-configure fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-test
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E make_directory /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/CMakeFiles && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E touch /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/CMakeFiles/fastgltf-populate-complete && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E touch /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-done
DESC = Completed 'fastgltf-populate'
restat = 1
#############################################
# Custom command for fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-build
build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-build | ${cmake_ninja_workdir}fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-build: CUSTOM_COMMAND fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-configure
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E echo_append && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E touch /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-build
DESC = No build step for 'fastgltf-populate'
restat = 1
#############################################
# Custom command for fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-configure
build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-configure | ${cmake_ninja_workdir}fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-configure: CUSTOM_COMMAND fastgltf-populate-prefix/tmp/fastgltf-populate-cfgcmd.txt fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E echo_append && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E touch /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-configure
DESC = No configure step for 'fastgltf-populate'
restat = 1
#############################################
# Custom command for fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-download
build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-download | ${cmake_ninja_workdir}fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-download: CUSTOM_COMMAND fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-gitinfo.txt fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-mkdir
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE -P /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/tmp/fastgltf-populate-gitclone.cmake && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E touch /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-download
DESC = Performing download step (git clone) for 'fastgltf-populate'
pool = console
restat = 1
#############################################
# Custom command for fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install
build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install | ${cmake_ninja_workdir}fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install: CUSTOM_COMMAND fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-build
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E echo_append && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E touch /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install
DESC = No install step for 'fastgltf-populate'
restat = 1
#############################################
# Custom command for fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-mkdir
build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-mkdir | ${cmake_ninja_workdir}fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-mkdir: CUSTOM_COMMAND
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -Dcfgdir= -P /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/tmp/fastgltf-populate-mkdirs.cmake && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E touch /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-mkdir
DESC = Creating directories for 'fastgltf-populate'
restat = 1
#############################################
# Custom command for fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch
build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch | ${cmake_ninja_workdir}fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch: CUSTOM_COMMAND fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch-info.txt fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-update
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E echo_append && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E touch /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-patch
DESC = No patch step for 'fastgltf-populate'
pool = console
restat = 1
#############################################
# Custom command for fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-test
build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-test | ${cmake_ninja_workdir}fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-test: CUSTOM_COMMAND fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-install
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E echo_append && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -E touch /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-test
DESC = No test step for 'fastgltf-populate'
restat = 1
#############################################
# Custom command for fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-update
build fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-update | ${cmake_ninja_workdir}fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-update: CUSTOM_COMMAND fastgltf-populate-prefix/tmp/fastgltf-populate-gitupdate.cmake fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-update-info.txt fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-download
COMMAND = cd /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src && /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake -Dcan_fetch=YES -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE -P /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/tmp/fastgltf-populate-gitupdate.cmake
DESC = Performing update step for 'fastgltf-populate'
pool = console
# =============================================================================
# Target aliases.
# =============================================================================
# Folder targets.
# =============================================================================
#############################################
# Folder: /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild
build codegen: phony
# =============================================================================
#############################################
# Folder: /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild
build all: phony fastgltf-populate
# =============================================================================
# Built-in targets
#############################################
# Re-run CMake if any of its inputs changed.
build build.ninja /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/cmake_install.cmake: RERUN_CMAKE | /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeDetermineSystem.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeGenericSystem.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeInitializeConfigs.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeSystem.cmake.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeSystemSpecificInformation.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeSystemSpecificInitialize.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/PatchInfo.txt.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/RepositoryInfo.txt.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/UpdateInfo.txt.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/cfgcmd.txt.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/gitclone.cmake.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/gitupdate.cmake.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/mkdirs.cmake.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/shared_internal_commands.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/Platform/Linux-Initialize.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/Platform/Linux.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/4.1.2/CMakeSystem.cmake CMakeLists.txt fastgltf-populate-prefix/tmp/fastgltf-populate-mkdirs.cmake
pool = console
#############################################
# A missing CMake input file is not an error.
build /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeDetermineSystem.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeGenericSystem.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeInitializeConfigs.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeSystem.cmake.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeSystemSpecificInformation.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/CMakeSystemSpecificInitialize.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/PatchInfo.txt.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/RepositoryInfo.txt.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/UpdateInfo.txt.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/cfgcmd.txt.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/gitclone.cmake.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/gitupdate.cmake.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/mkdirs.cmake.in /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/ExternalProject/shared_internal_commands.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/Platform/Linux-Initialize.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/Platform/Linux.cmake /nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/share/cmake-4.1/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/4.1.2/CMakeSystem.cmake CMakeLists.txt fastgltf-populate-prefix/tmp/fastgltf-populate-mkdirs.cmake: phony
#############################################
# Clean all the built files.
build clean: CLEAN
#############################################
# Print all primary targets available.
build help: HELP
#############################################
# Make the all target the default.
default all

View File

@ -1,15 +0,0 @@
# This is a generated file and its contents are an internal implementation detail.
# The download step will be re-executed if anything in this file changes.
# No other meaning or use of this file is supported.
method=git
command=/nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake;-DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE;-P;/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/tmp/fastgltf-populate-gitclone.cmake
source_dir=/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src
work_dir=/home/alex/Developer/Code/Vulkan/bin/_deps
repository=https://github.com/spnda/fastgltf.git
remote=origin
init_submodules=TRUE
recurse_submodules=--recursive
submodules=
CMP0097=NEW

View File

@ -1,15 +0,0 @@
# This is a generated file and its contents are an internal implementation detail.
# The download step will be re-executed if anything in this file changes.
# No other meaning or use of this file is supported.
method=git
command=/nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake;-DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE;-P;/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/tmp/fastgltf-populate-gitclone.cmake
source_dir=/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src
work_dir=/home/alex/Developer/Code/Vulkan/bin/_deps
repository=https://github.com/spnda/fastgltf.git
remote=origin
init_submodules=TRUE
recurse_submodules=--recursive
submodules=
CMP0097=NEW

View File

@ -1,6 +0,0 @@
# This is a generated file and its contents are an internal implementation detail.
# The update step will be re-executed if anything in this file changes.
# No other meaning or use of this file is supported.
command=
work_dir=

View File

@ -1,7 +0,0 @@
# This is a generated file and its contents are an internal implementation detail.
# The patch step will be re-executed if anything in this file changes.
# No other meaning or use of this file is supported.
command (connected)=/nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake;-Dcan_fetch=YES;-DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE;-P;/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/tmp/fastgltf-populate-gitupdate.cmake
command (disconnected)=/nix/store/lxkvigfj5xy6w2bs7h4xwr3d7wb7piqb-cmake-4.1.2/bin/cmake;-Dcan_fetch=NO;-DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE;-P;/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/tmp/fastgltf-populate-gitupdate.cmake
work_dir=/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src

View File

@ -1,87 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
if(EXISTS "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-gitclone-lastrun.txt" AND EXISTS "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-gitinfo.txt" AND
"/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-gitclone-lastrun.txt" IS_NEWER_THAN "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-gitinfo.txt")
message(VERBOSE
"Avoiding repeated git clone, stamp file is up to date: "
"'/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-gitclone-lastrun.txt'"
)
return()
endif()
# Even at VERBOSE level, we don't want to see the commands executed, but
# enabling them to be shown for DEBUG may be useful to help diagnose problems.
cmake_language(GET_MESSAGE_LOG_LEVEL active_log_level)
if(active_log_level MATCHES "DEBUG|TRACE")
set(maybe_show_command COMMAND_ECHO STDOUT)
else()
set(maybe_show_command "")
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E rm -rf "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
RESULT_VARIABLE error_code
${maybe_show_command}
)
if(error_code)
message(FATAL_ERROR "Failed to remove directory: '/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src'")
endif()
# try the clone 3 times in case there is an odd git clone issue
set(error_code 1)
set(number_of_tries 0)
while(error_code AND number_of_tries LESS 3)
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git"
clone --no-checkout --config "advice.detachedHead=false" "https://github.com/spnda/fastgltf.git" "fastgltf-src"
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps"
RESULT_VARIABLE error_code
${maybe_show_command}
)
math(EXPR number_of_tries "${number_of_tries} + 1")
endwhile()
if(number_of_tries GREATER 1)
message(NOTICE "Had to git clone more than once: ${number_of_tries} times.")
endif()
if(error_code)
message(FATAL_ERROR "Failed to clone repository: 'https://github.com/spnda/fastgltf.git'")
endif()
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git"
checkout "v0.8.0" --
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
RESULT_VARIABLE error_code
${maybe_show_command}
)
if(error_code)
message(FATAL_ERROR "Failed to checkout tag: 'v0.8.0'")
endif()
set(init_submodules TRUE)
if(init_submodules)
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git"
submodule update --recursive --init
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
RESULT_VARIABLE error_code
${maybe_show_command}
)
endif()
if(error_code)
message(FATAL_ERROR "Failed to update submodules in: '/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src'")
endif()
# Complete success, update the script-last-run stamp file:
#
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-gitinfo.txt" "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-gitclone-lastrun.txt"
RESULT_VARIABLE error_code
${maybe_show_command}
)
if(error_code)
message(FATAL_ERROR "Failed to copy script-last-run stamp file: '/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/fastgltf-populate-gitclone-lastrun.txt'")
endif()

View File

@ -1,317 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
# Even at VERBOSE level, we don't want to see the commands executed, but
# enabling them to be shown for DEBUG may be useful to help diagnose problems.
cmake_language(GET_MESSAGE_LOG_LEVEL active_log_level)
if(active_log_level MATCHES "DEBUG|TRACE")
set(maybe_show_command COMMAND_ECHO STDOUT)
else()
set(maybe_show_command "")
endif()
function(do_fetch)
message(VERBOSE "Fetching latest from the remote origin")
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git fetch --tags --force "origin"
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
COMMAND_ERROR_IS_FATAL LAST
${maybe_show_command}
)
endfunction()
function(get_hash_for_ref ref out_var err_var)
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git rev-parse "${ref}^0"
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
RESULT_VARIABLE error_code
OUTPUT_VARIABLE ref_hash
ERROR_VARIABLE error_msg
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(error_code)
set(${out_var} "" PARENT_SCOPE)
else()
set(${out_var} "${ref_hash}" PARENT_SCOPE)
endif()
set(${err_var} "${error_msg}" PARENT_SCOPE)
endfunction()
get_hash_for_ref(HEAD head_sha error_msg)
if(head_sha STREQUAL "")
message(FATAL_ERROR "Failed to get the hash for HEAD:\n${error_msg}")
endif()
if("${can_fetch}" STREQUAL "")
set(can_fetch "YES")
endif()
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git show-ref "v0.8.0"
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
OUTPUT_VARIABLE show_ref_output
)
if(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/remotes/")
# Given a full remote/branch-name and we know about it already. Since
# branches can move around, we should always fetch, if permitted.
if(can_fetch)
do_fetch()
endif()
set(checkout_name "v0.8.0")
elseif(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/tags/")
# Given a tag name that we already know about. We don't know if the tag we
# have matches the remote though (tags can move), so we should fetch. As a
# special case to preserve backward compatibility, if we are already at the
# same commit as the tag we hold locally, don't do a fetch and assume the tag
# hasn't moved on the remote.
# FIXME: We should provide an option to always fetch for this case
get_hash_for_ref("v0.8.0" tag_sha error_msg)
if(tag_sha STREQUAL head_sha)
message(VERBOSE "Already at requested tag: v0.8.0")
return()
endif()
if(can_fetch)
do_fetch()
endif()
set(checkout_name "v0.8.0")
elseif(show_ref_output MATCHES "^[a-z0-9]+[ \\t]+refs/heads/")
# Given a branch name without any remote and we already have a branch by that
# name. We might already have that branch checked out or it might be a
# different branch. It isn't fully safe to use a bare branch name without the
# remote, so do a fetch (if allowed) and replace the ref with one that
# includes the remote.
if(can_fetch)
do_fetch()
endif()
set(checkout_name "origin/v0.8.0")
else()
get_hash_for_ref("v0.8.0" tag_sha error_msg)
if(tag_sha STREQUAL head_sha)
# Have the right commit checked out already
message(VERBOSE "Already at requested ref: ${tag_sha}")
return()
elseif(tag_sha STREQUAL "")
# We don't know about this ref yet, so we have no choice but to fetch.
if(NOT can_fetch)
message(FATAL_ERROR
"Requested git ref \"v0.8.0\" is not present locally, and not "
"allowed to contact remote due to UPDATE_DISCONNECTED setting."
)
endif()
# We deliberately swallow any error message at the default log level
# because it can be confusing for users to see a failed git command.
# That failure is being handled here, so it isn't an error.
if(NOT error_msg STREQUAL "")
message(DEBUG "${error_msg}")
endif()
do_fetch()
set(checkout_name "v0.8.0")
else()
# We have the commit, so we know we were asked to find a commit hash
# (otherwise it would have been handled further above), but we don't
# have that commit checked out yet. We don't need to fetch from the remote.
set(checkout_name "v0.8.0")
if(NOT error_msg STREQUAL "")
message(WARNING "${error_msg}")
endif()
endif()
endif()
set(git_update_strategy "REBASE")
if(git_update_strategy STREQUAL "")
# Backward compatibility requires REBASE as the default behavior
set(git_update_strategy REBASE)
endif()
if(git_update_strategy MATCHES "^REBASE(_CHECKOUT)?$")
# Asked to potentially try to rebase first, maybe with fallback to checkout.
# We can't if we aren't already on a branch and we shouldn't if that local
# branch isn't tracking the one we want to checkout.
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git symbolic-ref -q HEAD
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
OUTPUT_VARIABLE current_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
# Don't test for an error. If this isn't a branch, we get a non-zero error
# code but empty output.
)
if(current_branch STREQUAL "")
# Not on a branch, checkout is the only sensible option since any rebase
# would always fail (and backward compatibility requires us to checkout in
# this situation)
set(git_update_strategy CHECKOUT)
else()
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git for-each-ref "--format=%(upstream:short)" "${current_branch}"
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
OUTPUT_VARIABLE upstream_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY # There is no error if no upstream is set
)
if(NOT upstream_branch STREQUAL checkout_name)
# Not safe to rebase when asked to checkout a different branch to the one
# we are tracking. If we did rebase, we could end up with arbitrary
# commits added to the ref we were asked to checkout if the current local
# branch happens to be able to rebase onto the target branch. There would
# be no error message and the user wouldn't know this was occurring.
set(git_update_strategy CHECKOUT)
endif()
endif()
elseif(NOT git_update_strategy STREQUAL "CHECKOUT")
message(FATAL_ERROR "Unsupported git update strategy: ${git_update_strategy}")
endif()
# Check if stash is needed
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git status --porcelain
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
RESULT_VARIABLE error_code
OUTPUT_VARIABLE repo_status
)
if(error_code)
message(FATAL_ERROR "Failed to get the status")
endif()
string(LENGTH "${repo_status}" need_stash)
# If not in clean state, stash changes in order to be able to perform a
# rebase or checkout without losing those changes permanently
if(need_stash)
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git stash save --quiet;--include-untracked
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
COMMAND_ERROR_IS_FATAL ANY
${maybe_show_command}
)
endif()
if(git_update_strategy STREQUAL "CHECKOUT")
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git checkout "${checkout_name}"
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
COMMAND_ERROR_IS_FATAL ANY
${maybe_show_command}
)
else()
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git rebase "${checkout_name}"
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
RESULT_VARIABLE error_code
OUTPUT_VARIABLE rebase_output
ERROR_VARIABLE rebase_output
)
if(error_code)
# Rebase failed, undo the rebase attempt before continuing
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git rebase --abort
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
${maybe_show_command}
)
if(NOT git_update_strategy STREQUAL "REBASE_CHECKOUT")
# Not allowed to do a checkout as a fallback, so cannot proceed
if(need_stash)
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git stash pop --index --quiet
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
${maybe_show_command}
)
endif()
message(FATAL_ERROR "\nFailed to rebase in: '/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src'."
"\nOutput from the attempted rebase follows:"
"\n${rebase_output}"
"\n\nYou will have to resolve the conflicts manually")
endif()
# Fall back to checkout. We create an annotated tag so that the user
# can manually inspect the situation and revert if required.
# We can't log the failed rebase output because MSVC sees it and
# intervenes, causing the build to fail even though it completes.
# Write it to a file instead.
string(TIMESTAMP tag_timestamp "%Y%m%dT%H%M%S" UTC)
set(tag_name _cmake_ExternalProject_moved_from_here_${tag_timestamp}Z)
set(error_log_file ${CMAKE_CURRENT_LIST_DIR}/rebase_error_${tag_timestamp}Z.log)
file(WRITE ${error_log_file} "${rebase_output}")
message(WARNING "Rebase failed, output has been saved to ${error_log_file}"
"\nFalling back to checkout, previous commit tagged as ${tag_name}")
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git tag -a
-m "ExternalProject attempting to move from here to ${checkout_name}"
${tag_name}
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
COMMAND_ERROR_IS_FATAL ANY
${maybe_show_command}
)
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git checkout "${checkout_name}"
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
COMMAND_ERROR_IS_FATAL ANY
${maybe_show_command}
)
endif()
endif()
if(need_stash)
# Put back the stashed changes
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git stash pop --index --quiet
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
RESULT_VARIABLE error_code
${maybe_show_command}
)
if(error_code)
# Stash pop --index failed: Try again dropping the index
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git reset --hard --quiet
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
${maybe_show_command}
)
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git stash pop --quiet
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
RESULT_VARIABLE error_code
${maybe_show_command}
)
if(error_code)
# Stash pop failed: Restore previous state.
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git reset --hard --quiet ${head_sha}
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
${maybe_show_command}
)
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git" --git-dir=.git stash pop --index --quiet
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
${maybe_show_command}
)
message(FATAL_ERROR "\nFailed to unstash changes in: '/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src'."
"\nYou will have to resolve the conflicts manually")
endif()
endif()
endif()
set(init_submodules "TRUE")
if(init_submodules)
execute_process(
COMMAND "/etc/profiles/per-user/alex/bin/git"
--git-dir=.git
submodule update --recursive --init
WORKING_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src"
COMMAND_ERROR_IS_FATAL ANY
${maybe_show_command}
)
endif()

View File

@ -1,27 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
# If CMAKE_DISABLE_SOURCE_CHANGES is set to true and the source directory is an
# existing directory in our source tree, calling file(MAKE_DIRECTORY) on it
# would cause a fatal error, even though it would be a no-op.
if(NOT EXISTS "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src")
file(MAKE_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src")
endif()
file(MAKE_DIRECTORY
"/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build"
"/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix"
"/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/tmp"
"/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp"
"/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src"
"/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp"
)
set(configSubDirs )
foreach(subDir IN LISTS configSubDirs)
file(MAKE_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp/${subDir}")
endforeach()
if(cfgdir)
file(MAKE_DIRECTORY "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-subbuild/fastgltf-populate-prefix/src/fastgltf-populate-stamp${cfgdir}") # cfgdir has leading slash
endif()

File diff suppressed because one or more lines are too long

View File

@ -1,32 +0,0 @@
[
{
"directory": "/home/alex/Developer/Code/Vulkan/bin",
"command": "/nix/store/a245z3cvf9x9sn0xlk6k8j9xhxbhda1z-gcc-wrapper-15.2.0/bin/g++ -DVULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS -g -std=gnu++20 -fmodules-ts -fmodule-mapper=CMakeFiles/main.dir/src/main.cpp.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o CMakeFiles/main.dir/src/main.cpp.o -c /home/alex/Developer/Code/Vulkan/src/main.cpp",
"file": "/home/alex/Developer/Code/Vulkan/src/main.cpp",
"output": "/home/alex/Developer/Code/Vulkan/bin/CMakeFiles/main.dir/src/main.cpp.o"
},
{
"directory": "/home/alex/Developer/Code/Vulkan/bin",
"command": "/nix/store/a245z3cvf9x9sn0xlk6k8j9xhxbhda1z-gcc-wrapper-15.2.0/bin/g++ -DFASTGLTF_DISABLE_CUSTOM_MEMORY_POOL=0 -DFASTGLTF_ENABLE_DEPRECATED_EXT=0 -DFASTGLTF_USE_64BIT_FLOAT=0 -DFASTGLTF_USE_CUSTOM_SMALLVECTOR=0 -DSIMDJSON_TARGET_VERSION=\\\"3.9.4\\\" -I/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/include -I/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/deps/simdjson -g -Wall -Wno-unknown-pragmas -flax-vector-conversions -fpermissive -finline-functions -o _deps/fastgltf-build/CMakeFiles/fastgltf.dir/src/fastgltf.cpp.o -c /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/src/fastgltf.cpp",
"file": "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/src/fastgltf.cpp",
"output": "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build/CMakeFiles/fastgltf.dir/src/fastgltf.cpp.o"
},
{
"directory": "/home/alex/Developer/Code/Vulkan/bin",
"command": "/nix/store/a245z3cvf9x9sn0xlk6k8j9xhxbhda1z-gcc-wrapper-15.2.0/bin/g++ -DFASTGLTF_DISABLE_CUSTOM_MEMORY_POOL=0 -DFASTGLTF_ENABLE_DEPRECATED_EXT=0 -DFASTGLTF_USE_64BIT_FLOAT=0 -DFASTGLTF_USE_CUSTOM_SMALLVECTOR=0 -DSIMDJSON_TARGET_VERSION=\\\"3.9.4\\\" -I/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/include -I/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/deps/simdjson -g -Wall -Wno-unknown-pragmas -flax-vector-conversions -fpermissive -finline-functions -o _deps/fastgltf-build/CMakeFiles/fastgltf.dir/src/base64.cpp.o -c /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/src/base64.cpp",
"file": "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/src/base64.cpp",
"output": "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build/CMakeFiles/fastgltf.dir/src/base64.cpp.o"
},
{
"directory": "/home/alex/Developer/Code/Vulkan/bin",
"command": "/nix/store/a245z3cvf9x9sn0xlk6k8j9xhxbhda1z-gcc-wrapper-15.2.0/bin/g++ -DFASTGLTF_DISABLE_CUSTOM_MEMORY_POOL=0 -DFASTGLTF_ENABLE_DEPRECATED_EXT=0 -DFASTGLTF_USE_64BIT_FLOAT=0 -DFASTGLTF_USE_CUSTOM_SMALLVECTOR=0 -DSIMDJSON_TARGET_VERSION=\\\"3.9.4\\\" -I/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/include -I/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/deps/simdjson -g -Wall -Wno-unknown-pragmas -flax-vector-conversions -fpermissive -finline-functions -o _deps/fastgltf-build/CMakeFiles/fastgltf.dir/src/io.cpp.o -c /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/src/io.cpp",
"file": "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/src/io.cpp",
"output": "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build/CMakeFiles/fastgltf.dir/src/io.cpp.o"
},
{
"directory": "/home/alex/Developer/Code/Vulkan/bin",
"command": "/nix/store/a245z3cvf9x9sn0xlk6k8j9xhxbhda1z-gcc-wrapper-15.2.0/bin/g++ -DFASTGLTF_DISABLE_CUSTOM_MEMORY_POOL=0 -DFASTGLTF_ENABLE_DEPRECATED_EXT=0 -DFASTGLTF_USE_64BIT_FLOAT=0 -DFASTGLTF_USE_CUSTOM_SMALLVECTOR=0 -DSIMDJSON_TARGET_VERSION=\\\"3.9.4\\\" -I/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/include -I/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/deps/simdjson -g -Wall -Wno-unknown-pragmas -flax-vector-conversions -fpermissive -finline-functions -o _deps/fastgltf-build/CMakeFiles/fastgltf.dir/deps/simdjson/simdjson.cpp.o -c /home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/deps/simdjson/simdjson.cpp",
"file": "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-src/deps/simdjson/simdjson.cpp",
"output": "/home/alex/Developer/Code/Vulkan/bin/_deps/fastgltf-build/CMakeFiles/fastgltf.dir/deps/simdjson/simdjson.cpp.o"
}
]

Binary file not shown.

View File

@ -1,4 +1,5 @@
#pragma once #ifndef CALLBACK_H
#define CALLBACK_H
// Header // Header
// Other includes // Other includes
#include "types.h" #include "types.h"
@ -8,10 +9,17 @@ class Callback {
static void keyboardCallback(GLFWwindow* window, int key, int scancode, int action, int mods); static void keyboardCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
}; };
#endif
#ifdef CALLBACK_IMPL #ifdef CALLBACK_IMPL
#ifndef CALLBACK_IMPL_H
#define CALLBACK_IMPL_H
void Callback::keyboardCallback(GLFWwindow* window, int key, int scancode, int action, int mods) { void Callback::keyboardCallback(GLFWwindow* window, int key, int scancode, int action, int mods) {
#ifndef NDEBUG #ifdef DEBUG
fmt::println("Key pressed: {}", scancode); fmt::println("Key pressed, key {}", key);
#endif #endif
} }
#endif
#endif #endif

View File

@ -1,16 +1,49 @@
#pragma once #ifndef ENGINE_H
#define ENGINE_H
// Normal header // Normal header
#include "types.h" #include "types.h"
struct FrameData {
VkCommandPool _commandPool;
VkCommandBuffer _mainCommandBuffer;
VkSemaphore _swapchainSemaphore, _renderSemaphore;
VkFence _renderFence;
};
constexpr uint32_t FRAME_OVERLAP = 2;
class Engine { class Engine {
public: public:
//========== Class Members ==========
bool _isInitialized { false }; bool _isInitialized { false };
int _frameNumber { 0 }; int _frameNumber { 0 };
VkExtent2D _windowExtent { 1700, 900 }; VkExtent2D _windowExtent { 1700, 900 };
GLFWwindow *window { nullptr }; GLFWwindow *window { nullptr };
// Vulkan specific class members
VkInstance _instance;
VkDebugUtilsMessengerEXT _debugMessenger;
VkPhysicalDevice _choosenGPU;
VkDevice _device;
VkSurfaceKHR _surface;
VkSwapchainKHR _swapchain;
VkFormat _swapchainImageFormat;
std::vector<VkImage> _swapchainImages;
std::vector<VkImageView> _swapchainImageViews;
VkExtent2D _swapchainExtent;
FrameData _frames[FRAME_OVERLAP];
FrameData& getCurrentFrame() { return _frames[_frameNumber % FRAME_OVERLAP]; };
VkQueue _graphicsQueue;
uint32_t _graphicsQueueFamily;
void init(); void init();
void cleanup(); void cleanup();
@ -18,17 +51,55 @@ class Engine {
void draw(); void draw();
void run(); void run();
private:
void initRender();
void initVulkan();
void initSwapchain();
void initCommands();
void initSyncStructures();
void createSwapchain(uint32_t width, uint32_t height);
void destroySwapchain();
}; };
#ifdef ENGINE_IMPL #endif
// Implementation
#ifdef ENGINE_IMPL
#ifndef ENGINE_IMPL_H
#define ENGINE_IMPL_H
//========== Implementation ==========
#define IMAGES_IMPL
#include "images.h"
#define INITIALIZERS_IMPL
#include "initializers.h" #include "initializers.h"
#include "VkBootstrap.h"
#define CALLBACK_IMPL #define CALLBACK_IMPL
#include "callbacks.h" #include "callbacks.h"
#ifndef DEBUG
constexpr bool bUseValidationLayers = false;
#else
constexpr bool bUseValidationLayers = true;
#endif
// Abort when there is an error
// Todo : Give an error message or crash dump
using namespace std;
#define VK_CHECK(x) \
do { \
VkResult err = x; \
if (err) { \
fmt::println("Vulkan error : {}", string_VkResult(err)); \
abort(); \
} \
} while (0) \
void Engine::init() { void Engine::init() {
#ifndef NDEBUG #ifdef DEBUG
fmt::println("Initializing the engine..."); fmt::println("Initializing the engine...");
#endif #endif
@ -49,23 +120,125 @@ void Engine::init() {
_isInitialized = true; _isInitialized = true;
#ifndef NDEBUG initRender();
#ifdef DEBUG
fmt::println("Engine Initialized !"); fmt::println("Engine Initialized !");
#endif #endif
} }
void Engine::cleanup() { void Engine::cleanup() {
#ifdef DEBUG
fmt::println("Cleaning up...");
#endif
if (_isInitialized) { if (_isInitialized) {
// Wait for the GPU to stop working
vkDeviceWaitIdle(_device);
for (int i = 0; i < FRAME_OVERLAP; i++) {
vkDestroyCommandPool(_device, _frames[i]._commandPool, nullptr);
// Destroy sync objects
vkDestroyFence(_device, _frames[i]._renderFence, nullptr);
vkDestroySemaphore(_device, _frames[i]._renderSemaphore, nullptr);
vkDestroySemaphore(_device, _frames[i]._swapchainSemaphore, nullptr);
}
destroySwapchain();
vkDestroySurfaceKHR(_instance, _surface, nullptr);
vkDestroyDevice(_device, nullptr);
vkb::destroy_debug_utils_messenger(_instance, _debugMessenger);
vkDestroyInstance(_instance, nullptr);
/*
vkDestroyCommandPool(_device, _commandPool, nullptr);
vkDestroySwapchainKHR(_device, _swapchain, nullptr);
// Change to use dynamic rendering
vkDestroyRenderPass(_device, _renderPass, nullptr);
// Destroy swapchain ressources
for (uint32_t i = 0; i < _framebuffers.size(); i++) {
vkDestroyFramebuffer(_device, _framebuffers[i], nullptr);
vkDestroyImageView(_device, _swapchainImageViews[i], nullptr);
}
*/
// Destroy the window (at the end)
glfwDestroyWindow(window); glfwDestroyWindow(window);
glfwTerminate(); glfwTerminate();
} }
#ifdef DEBUG
fmt::println("Engine cleaned up !");
#endif
} }
void Engine::draw() { void Engine::draw() {
// Todo // wait until the gpu has finished rendering the last frame. Timeout of 1s
VK_CHECK(vkWaitForFences(_device, 1, &getCurrentFrame()._renderFence, true, 1000000000));
VK_CHECK(vkResetFences(_device, 1, &getCurrentFrame()._renderFence));
// Request image from the swapchain
uint32_t swapchainImageIndex;
VK_CHECK(vkAcquireNextImageKHR(_device, _swapchain, 1000000000, getCurrentFrame()._swapchainSemaphore, nullptr, &swapchainImageIndex));
VkCommandBuffer cmd = getCurrentFrame()._mainCommandBuffer;
VK_CHECK(vkResetCommandBuffer(cmd, 0));
VkCommandBufferBeginInfo cmdBeginInfo = vkinit::commandBufferBeginInfo(VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
VK_CHECK(vkBeginCommandBuffer(cmd, &cmdBeginInfo));
vkutil::transitionImage(cmd, _swapchainImages[swapchainImageIndex], VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL);
VkClearColorValue clearValue;
float flash = std::abs(std::sin(_frameNumber / 120.f));
clearValue = { { 0.0f, 0.0f, flash, 1.0f } };
VkImageSubresourceRange clearRange = vkinit::imageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT);
vkCmdClearColorImage(cmd, _swapchainImages[swapchainImageIndex], VK_IMAGE_LAYOUT_GENERAL, &clearValue, 1, &clearRange);
vkutil::transitionImage(cmd, _swapchainImages[swapchainImageIndex],VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR);
VK_CHECK(vkEndCommandBuffer(cmd));
VkCommandBufferSubmitInfo cmdinfo = vkinit::commandBufferSubmitInfo(cmd);
VkSemaphoreSubmitInfo waitInfo = vkinit::semaphoreSubmitInfo(VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR,getCurrentFrame()._swapchainSemaphore);
VkSemaphoreSubmitInfo signalInfo = vkinit::semaphoreSubmitInfo(VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT, getCurrentFrame()._renderSemaphore);
VkSubmitInfo2 submit = vkinit::submitInfo(&cmdinfo,&signalInfo,&waitInfo);
VK_CHECK(vkQueueSubmit2(_graphicsQueue, 1, &submit, getCurrentFrame()._renderFence));
VkPresentInfoKHR presentInfo = {};
presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
presentInfo.pNext = nullptr;
presentInfo.pSwapchains = &_swapchain;
presentInfo.swapchainCount = 1;
presentInfo.pWaitSemaphores = &getCurrentFrame()._renderSemaphore;
presentInfo.waitSemaphoreCount = 1;
presentInfo.pImageIndices = &swapchainImageIndex;
VK_CHECK(vkQueuePresentKHR(_graphicsQueue, &presentInfo));
_frameNumber++;
} }
void Engine::run() { void Engine::run() {
#ifdef DEBUG
fmt::println("Running...");
auto runTimeStart = std::chrono::system_clock::now();
#endif
bool stopRendering = false; bool stopRendering = false;
while (!glfwWindowShouldClose(window)) { while (!glfwWindowShouldClose(window)) {
@ -84,8 +257,193 @@ void Engine::run() {
} }
draw(); draw();
} }
#ifdef DEBUG
auto runTimeEnd = std::chrono::system_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::seconds>(runTimeEnd - runTimeStart);
fmt::println("Engine has finished running after {} seconds!", elapsed.count());
#endif
} }
void Engine::initRender() {
initVulkan();
initSwapchain();
//initDefaultRenderpass();
//initFramebuffers();
initCommands();
initSyncStructures();
}
void Engine::initVulkan() {
#ifdef DEBUG
fmt::println("Initializing Vulkan...");
#endif
vkb::InstanceBuilder builder;
// Create a basic VK instance, with debuging features
auto instRet = builder.set_app_name("Engine")
.request_validation_layers(bUseValidationLayers)
.use_default_debug_messenger()
.require_api_version(1, 3, 0)
.build();
vkb::Instance vkbInst = instRet.value();
// Grab the instance
_instance = vkbInst.instance;
_debugMessenger = vkbInst.debug_messenger;
// Create the surface
if (glfwCreateWindowSurface(_instance, window, nullptr, & _surface) != VK_SUCCESS) {
throw std::runtime_error("Failed to create window surface !\nAborting...");
}
// Features
// Vulkan 1.3
VkPhysicalDeviceVulkan13Features features13 {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES,
.synchronization2 = true,
.dynamicRendering = true
};
VkPhysicalDeviceVulkan12Features features12 {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
.descriptorIndexing = true,
.bufferDeviceAddress = true
};
// Use vkBootstrap to select the GPU
vkb::PhysicalDeviceSelector selector { vkbInst };
vkb::PhysicalDevice physicalDevice = selector
.set_minimum_version(1, 3)
.set_required_features_13(features13)
.set_required_features_12(features12)
.set_surface(_surface)
.select()
.value();
vkb::DeviceBuilder deviceBuilder { physicalDevice };
#ifdef DEBUG
fmt::println("Device {}", physicalDevice.name);
#endif
vkb::Device vkbDevice { deviceBuilder.build().value() };
_device = { vkbDevice.device };
_choosenGPU = { physicalDevice.physical_device };
_graphicsQueue = { vkbDevice.get_queue(vkb::QueueType::graphics).value() };
_graphicsQueueFamily = { vkbDevice.get_queue_index(vkb::QueueType::graphics).value() };
#ifdef DEBUG
fmt::println("Vulkan initialized !");
#endif
}
void Engine::initSwapchain() {
#ifdef DEBUG
fmt::println("Initializing the swapchain...");
#endif
createSwapchain(_windowExtent.width, _windowExtent.height);
#ifdef DEBUG
fmt::println("Swapchain initialized !");
#endif
}
void Engine::initCommands() {
#ifdef DEBUG
fmt::println("Initializing vulkan commands..");
#endif
VkCommandPoolCreateInfo commandPoolInfo = { vkinit::commandPoolCreateInfo(_graphicsQueueFamily, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT) };
for (uint32_t i = 0; i < FRAME_OVERLAP; i++) {
VK_CHECK(vkCreateCommandPool(_device, &commandPoolInfo, nullptr, &_frames[i]._commandPool));
VkCommandBufferAllocateInfo cmdAllocInfo = vkinit::commandBufferAllocateInfo(_frames[i]._commandPool, 1);
VK_CHECK(vkAllocateCommandBuffers(_device, &cmdAllocInfo, &_frames[i]._mainCommandBuffer));
}
#ifdef DEBUG
fmt::println("Vulan commands initialized !");
#endif
}
void Engine::initSyncStructures() {
#ifdef DEBUG
fmt::println("Creating sync structures...");
#endif
VkFenceCreateInfo fenceCreateInfo = vkinit::fenceCreateInfo(VK_FENCE_CREATE_SIGNALED_BIT);
VkSemaphoreCreateInfo semaphoreCreateInfo = vkinit::semaphoreCreateInfo();
for (int i = 0; i < FRAME_OVERLAP; i++) {
VK_CHECK(vkCreateFence(_device, &fenceCreateInfo, nullptr, &_frames[i]._renderFence));
VK_CHECK(vkCreateSemaphore(_device, &semaphoreCreateInfo, nullptr, &_frames[i]._swapchainSemaphore));
VK_CHECK(vkCreateSemaphore(_device, &semaphoreCreateInfo, nullptr, &_frames[i]._renderSemaphore));
}
#ifdef DEBUG
fmt::println("Sync structures created !");
#endif
}
void Engine::createSwapchain(
uint32_t width,
uint32_t height
) {
#ifdef DEBUG
fmt::println("Creating the Swapchain...");
#endif
vkb::SwapchainBuilder swapchainBuilder {
_choosenGPU,
_device,
_surface
};
_swapchainImageFormat = VK_FORMAT_B8G8R8A8_UNORM;
vkb::Swapchain vkbSwapchain = swapchainBuilder
.set_desired_format(
VkSurfaceFormatKHR {
.format = _swapchainImageFormat,
.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
}
)
.set_desired_present_mode(VK_PRESENT_MODE_FIFO_KHR) // VSync
.set_desired_extent(width, height)
.add_image_usage_flags(VK_IMAGE_USAGE_TRANSFER_DST_BIT)
.build()
.value();
_swapchainExtent = { vkbSwapchain.extent };
// Store swapchain and it's related images
_swapchain = { vkbSwapchain.swapchain };
_swapchainImages = { vkbSwapchain.get_images().value() };
_swapchainImageViews = { vkbSwapchain.get_image_views().value() };
#ifdef DEBUG
fmt::println("Swapchain created with dimentions {} by {}", vkbSwapchain.extent.width, vkbSwapchain.extent.height);
#endif
}
void Engine::destroySwapchain() {
#ifdef DEBUG
fmt::println("Destroying the swapchain...");
#endif
vkDestroySwapchainKHR(_device, _swapchain, nullptr);
for (uint32_t i = 0; i < _swapchainImageViews.size(); i++) {
vkDestroyImageView(_device, _swapchainImageViews[i], nullptr);
}
#ifdef DEBUG
fmt::println("Swapchain destroyed !");
#endif
}
#endif
#endif #endif

View File

@ -1,7 +1,57 @@
#pragma once #ifndef IMAGES_H
#define IMAGES_H
// Normal header // Normal header
#include "types.h"
#ifdef IMAGES_IMPL namespace vkutil {
// Implementation void transitionImage(
VkCommandBuffer cmd,
VkImage image,
VkImageLayout currentLayout,
VkImageLayout newLayout
);
}
#endif #endif
#ifdef IMAGES_IMPL
#ifndef IMAGES_IMPL_H
#define IMAGES_IMPL_H
// Implementation
#include "initializers.h"
namespace vkutil {
void transitionImage(
VkCommandBuffer cmd,
VkImage image,
VkImageLayout currentLayout,
VkImageLayout newLayout
) {
VkImageMemoryBarrier2 imageBarrier {.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2};
imageBarrier.pNext = nullptr;
imageBarrier.srcStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT;
imageBarrier.srcAccessMask = VK_ACCESS_2_MEMORY_WRITE_BIT;
imageBarrier.dstStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT;
imageBarrier.dstAccessMask = VK_ACCESS_2_MEMORY_WRITE_BIT | VK_ACCESS_2_MEMORY_READ_BIT;
imageBarrier.oldLayout = currentLayout;
imageBarrier.newLayout = newLayout;
VkImageAspectFlags aspectMask = (newLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL) ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT;
imageBarrier.subresourceRange = vkinit::imageSubresourceRange(aspectMask);
imageBarrier.image = image;
VkDependencyInfo depInfo {};
depInfo.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO;
depInfo.pNext = nullptr;
depInfo.imageMemoryBarrierCount = 1;
depInfo.pImageMemoryBarriers = &imageBarrier;
vkCmdPipelineBarrier2(cmd, &depInfo);
}
}
#endif
#endif

View File

@ -1,7 +1,178 @@
#pragma once #ifndef INITIALIZERS_H
#define INITIALIZERS_H
// Normal header // Normal header
#include "types.h"
namespace vkinit {
VkCommandPoolCreateInfo commandPoolCreateInfo(
uint32_t queueFamilyIndex,
VkCommandPoolCreateFlags flags = 0
);
VkCommandBufferAllocateInfo commandBufferAllocateInfo(
VkCommandPool pool,
uint32_t count
);
VkFenceCreateInfo fenceCreateInfo(
VkFenceCreateFlags flags = 0
);
VkSemaphoreCreateInfo semaphoreCreateInfo (
VkSemaphoreCreateFlags flags = 0
);
VkCommandBufferBeginInfo commandBufferBeginInfo (
VkCommandBufferUsageFlags flags = 0
);
VkImageSubresourceRange imageSubresourceRange(
VkImageAspectFlags aspectMask
);
VkSemaphoreSubmitInfo semaphoreSubmitInfo(
VkPipelineStageFlags2 stageMask,
VkSemaphore semaphore
);
VkCommandBufferSubmitInfo commandBufferSubmitInfo (
VkCommandBuffer cmd
);
VkSubmitInfo2 submitInfo(
VkCommandBufferSubmitInfo* cmd,
VkSemaphoreSubmitInfo* signalSemaphoreInfo,
VkSemaphoreSubmitInfo* waitSemaphoreInfo
);
}
#ifdef INITIALIZERS_IMPL
// Implementation
#endif #endif
#ifdef INITIALIZERS_IMPL
#ifndef INITIALIZERS_IMPL_H
#define INITIALIZERS_IMPL_H
// Implementation
namespace vkinit {
VkCommandPoolCreateInfo commandPoolCreateInfo(
uint32_t queueFamilyIndex,
VkCommandPoolCreateFlags flags
) {
VkCommandPoolCreateInfo info = {};
info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
info.pNext = nullptr;
info.queueFamilyIndex = queueFamilyIndex;
info.flags = flags;
return info;
}
VkCommandBufferAllocateInfo commandBufferAllocateInfo(
VkCommandPool pool,
uint32_t count
) {
VkCommandBufferAllocateInfo info = {};
info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
info.pNext = nullptr;
info.commandPool = pool;
info.commandBufferCount = count;
info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
return info;
}
VkFenceCreateInfo fenceCreateInfo(
VkFenceCreateFlags flags /*= 0 */
) {
VkFenceCreateInfo info = {};
info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
info.pNext = nullptr;
info.flags = flags;
return info;
}
VkSemaphoreCreateInfo semaphoreCreateInfo (
VkSemaphoreCreateFlags flags /*= 0*/
) {
VkSemaphoreCreateInfo info = {};
info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
info.pNext = nullptr;
info.flags = flags;
return info;
}
VkCommandBufferBeginInfo commandBufferBeginInfo (
VkCommandBufferUsageFlags flags /*= 0*/
) {
VkCommandBufferBeginInfo info = {};
info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
info.pNext = nullptr;
info.pInheritanceInfo = nullptr;
info.flags = flags;
return info;
}
VkImageSubresourceRange imageSubresourceRange(
VkImageAspectFlags aspectMask
) {
VkImageSubresourceRange subImage {};
subImage.aspectMask = aspectMask;
subImage.baseMipLevel = 0;
subImage.levelCount = VK_REMAINING_MIP_LEVELS;
subImage.baseArrayLayer = 0;
subImage.layerCount = VK_REMAINING_ARRAY_LAYERS;
return subImage;
}
VkSemaphoreSubmitInfo semaphoreSubmitInfo(
VkPipelineStageFlags2 stageMask,
VkSemaphore semaphore
) {
VkSemaphoreSubmitInfo submitInfo{};
submitInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO;
submitInfo.pNext = nullptr;
submitInfo.semaphore = semaphore;
submitInfo.stageMask = stageMask;
submitInfo.deviceIndex = 0;
submitInfo.value = 1;
return submitInfo;
}
VkCommandBufferSubmitInfo commandBufferSubmitInfo (
VkCommandBuffer cmd
) {
VkCommandBufferSubmitInfo info {};
info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO;
info.pNext = nullptr;
info.commandBuffer = cmd;
info.deviceMask = 0;
return info;
}
VkSubmitInfo2 submitInfo(
VkCommandBufferSubmitInfo* cmd,
VkSemaphoreSubmitInfo* signalSemaphoreInfo,
VkSemaphoreSubmitInfo* waitSemaphoreInfo
) {
VkSubmitInfo2 info = {};
info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
info.pNext = nullptr;
info.waitSemaphoreInfoCount = waitSemaphoreInfo == nullptr ? 0 : 1;
info.pWaitSemaphoreInfos = waitSemaphoreInfo;
info.signalSemaphoreInfoCount = signalSemaphoreInfo == nullptr ? 0 : 1;
info.pSignalSemaphoreInfos = signalSemaphoreInfo;
info.commandBufferInfoCount = 1;
info.pCommandBufferInfos = cmd;
return info;
}
}
#endif
#endif

View File

@ -1,7 +1,13 @@
#pragma once #ifndef PIPELINES_H
#define PIPELINES_H
// Normal header // Normal header
#endif
#ifdef PIPELINES_IMPL #ifdef PIPELINES_IMPL
#ifndef PIPELINES_IMPL_H
#define PIPELINES_IMPL_H
// Implementation // Implementation
#endif #endif
#endif

View File

@ -1,4 +1,5 @@
#pragma once #ifndef TYPES_H
#define TYPES_H
// Normal header // Normal header
#include <memory> #include <memory>
#include <optional> #include <optional>
@ -10,7 +11,9 @@
#include <deque> #include <deque>
#include <chrono> #include <chrono>
#include <thread> #include <thread>
#include <fmt/base.h>
#include <stdexcept>
#include <cstdint>
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h> #include <vulkan/vulkan_core.h>
@ -20,15 +23,19 @@
#define GLFW_INCLUDE_VULKAN #define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <fmt/core.h>
#include <glm/mat4x4.hpp> #include <glm/mat4x4.hpp>
#include <glm/vec4.hpp> #include <glm/vec4.hpp>
// Custom headers // Custom headers
//#include "callbacks.h" //#include "callbacks.h"
#endif
#ifdef TYPES_IMPL #ifdef TYPES_IMPL
#ifndef TYPES_IMPL_H
#define TYPES_IMPL_H
// Implementation // Implementation
#endif #endif
#endif

View File

@ -7,5 +7,9 @@ int main(int argc, char* argv[]) {
engine.init(); engine.init();
engine.run();
engine.cleanup();
return 0; return 0;
} }