diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..4116e5c --- /dev/null +++ b/.clang-format @@ -0,0 +1,20 @@ +BasedOnStyle: LLVM +UseTab: ForIndentation +IndentWidth: 4 +TabWidth: 4 +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +AllowShortIfStatementsOnASingleLine: false +BreakBeforeBraces: Attach +NamespaceIndentation: All +PointerAlignment: Left +ColumnLimit: 0 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..498d2ce --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.20) +project(Deerith) + +set(CMAKE_CXX_STANDARD 20) + +add_subdirectory(core) +add_subdirectory(graphics) +add_subdirectory(studio) \ No newline at end of file diff --git a/build/.cmake/api/v1/query/client-vscode/query.json b/build/.cmake/api/v1/query/client-vscode/query.json new file mode 100644 index 0000000..82bb964 --- /dev/null +++ b/build/.cmake/api/v1/query/client-vscode/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]} \ No newline at end of file diff --git a/build/.cmake/api/v1/reply/cache-v2-75733dde282360676e09.json b/build/.cmake/api/v1/reply/cache-v2-75733dde282360676e09.json new file mode 100644 index 0000000..e48d87a --- /dev/null +++ b/build/.cmake/api/v1/reply/cache-v2-75733dde282360676e09.json @@ -0,0 +1,1371 @@ +{ + "entries" : + [ + { + "name" : "CMAKE_ADDR2LINE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/addr2line" + }, + { + "name" : "CMAKE_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/ar" + }, + { + "name" : "CMAKE_BUILD_TYPE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "No help, variable specified on the command line." + } + ], + "type" : "STRING", + "value" : "Debug" + }, + { + "name" : "CMAKE_CACHEFILE_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "This is the directory where this CMakeCache.txt was created" + } + ], + "type" : "INTERNAL", + "value" : "/home/chewico/Dev/Deerith/build" + }, + { + "name" : "CMAKE_CACHE_MAJOR_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Major version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "3" + }, + { + "name" : "CMAKE_CACHE_MINOR_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Minor version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "25" + }, + { + "name" : "CMAKE_CACHE_PATCH_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Patch version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_COLOR_MAKEFILE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Enable/Disable color output during build." + } + ], + "type" : "BOOL", + "value" : "ON" + }, + { + "name" : "CMAKE_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to CMake executable." + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/cmake" + }, + { + "name" : "CMAKE_CPACK_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to cpack program executable." + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/cpack" + }, + { + "name" : "CMAKE_CTEST_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to ctest program executable." + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/ctest" + }, + { + "name" : "CMAKE_CXX_COMPILER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "CXX compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/c++" + }, + { + "name" : "CMAKE_CXX_COMPILER_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ar-12" + }, + { + "name" : "CMAKE_CXX_COMPILER_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ranlib-12" + }, + { + "name" : "CMAKE_CXX_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_CXX_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "-g" + }, + { + "name" : "CMAKE_CXX_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "-Os -DNDEBUG" + }, + { + "name" : "CMAKE_CXX_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "-O3 -DNDEBUG" + }, + { + "name" : "CMAKE_CXX_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "-O2 -g -DNDEBUG" + }, + { + "name" : "CMAKE_C_COMPILER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "C compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/cc" + }, + { + "name" : "CMAKE_C_COMPILER_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ar-12" + }, + { + "name" : "CMAKE_C_COMPILER_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ranlib-12" + }, + { + "name" : "CMAKE_C_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_C_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "-g" + }, + { + "name" : "CMAKE_C_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "-Os -DNDEBUG" + }, + { + "name" : "CMAKE_C_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "-O3 -DNDEBUG" + }, + { + "name" : "CMAKE_C_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "-O2 -g -DNDEBUG" + }, + { + "name" : "CMAKE_DLLTOOL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "CMAKE_DLLTOOL-NOTFOUND" + }, + { + "name" : "CMAKE_EXECUTABLE_FORMAT", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Executable file format" + } + ], + "type" : "INTERNAL", + "value" : "ELF" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXPORT_COMPILE_COMMANDS", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "No help, variable specified on the command line." + } + ], + "type" : "BOOL", + "value" : "TRUE" + }, + { + "name" : "CMAKE_EXTRA_GENERATOR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of external makefile project generator." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_FIND_PACKAGE_REDIRECTS_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake." + } + ], + "type" : "STATIC", + "value" : "/home/chewico/Dev/Deerith/build/CMakeFiles/pkgRedirects" + }, + { + "name" : "CMAKE_GENERATOR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator." + } + ], + "type" : "INTERNAL", + "value" : "Unix Makefiles" + }, + { + "name" : "CMAKE_GENERATOR_INSTANCE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Generator instance identifier." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR_PLATFORM", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator platform." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR_TOOLSET", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator toolset." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_HAVE_LIBC_PTHREAD", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Test CMAKE_HAVE_LIBC_PTHREAD" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_HOME_DIRECTORY", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Source directory with the top level CMakeLists.txt file for this project" + } + ], + "type" : "INTERNAL", + "value" : "/home/chewico/Dev/Deerith" + }, + { + "name" : "CMAKE_INSTALL_PREFIX", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Install path prefix, prepended onto install directories." + } + ], + "type" : "PATH", + "value" : "/usr/local" + }, + { + "name" : "CMAKE_INSTALL_SO_NO_EXE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Install .so files without execute permission." + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_LINKER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/ld" + }, + { + "name" : "CMAKE_MAKE_PROGRAM", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gmake" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_NM", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/nm" + }, + { + "name" : "CMAKE_NUMBER_OF_MAKEFILES", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "number of local generators" + } + ], + "type" : "INTERNAL", + "value" : "4" + }, + { + "name" : "CMAKE_OBJCOPY", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/objcopy" + }, + { + "name" : "CMAKE_OBJDUMP", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/objdump" + }, + { + "name" : "CMAKE_PLATFORM_INFO_INITIALIZED", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Platform information initialized" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_PROJECT_DESCRIPTION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "" + }, + { + "name" : "CMAKE_PROJECT_HOMEPAGE_URL", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "" + }, + { + "name" : "CMAKE_PROJECT_NAME", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "Deerith" + }, + { + "name" : "CMAKE_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/ranlib" + }, + { + "name" : "CMAKE_READELF", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/readelf" + }, + { + "name" : "CMAKE_ROOT", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to CMake installation." + } + ], + "type" : "INTERNAL", + "value" : "/usr/share/cmake-3.25" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SKIP_INSTALL_RPATH", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If set, runtime paths are not added when installing shared libraries, but are added when building." + } + ], + "type" : "BOOL", + "value" : "NO" + }, + { + "name" : "CMAKE_SKIP_RPATH", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If set, runtime paths are not added when using shared libraries." + } + ], + "type" : "BOOL", + "value" : "NO" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STRIP", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/strip" + }, + { + "name" : "CMAKE_UNAME", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "uname command" + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/uname" + }, + { + "name" : "CMAKE_VERBOSE_MAKEFILE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo." + } + ], + "type" : "BOOL", + "value" : "FALSE" + }, + { + "name" : "Deerith_BINARY_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "/home/chewico/Dev/Deerith/build" + }, + { + "name" : "Deerith_IS_TOP_LEVEL", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "ON" + }, + { + "name" : "Deerith_SOURCE_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "/home/chewico/Dev/Deerith" + }, + { + "name" : "FIND_PACKAGE_MESSAGE_DETAILS_Threads", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Details about finding Threads" + } + ], + "type" : "INTERNAL", + "value" : "[TRUE][v()]" + }, + { + "name" : "FIND_PACKAGE_MESSAGE_DETAILS_Vulkan", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Details about finding Vulkan" + } + ], + "type" : "INTERNAL", + "value" : "[/usr/lib/x86_64-linux-gnu/libvulkan.so][/usr/include][cfound components: glslc missing components: glslangValidator][v1.3.239()]" + }, + { + "name" : "Vulkan_GLSLANG_VALIDATOR_EXECUTABLE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "Vulkan_GLSLANG_VALIDATOR_EXECUTABLE-NOTFOUND" + }, + { + "name" : "Vulkan_GLSLC_EXECUTABLE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/bin/glslc" + }, + { + "name" : "Vulkan_INCLUDE_DIR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a file." + } + ], + "type" : "PATH", + "value" : "/usr/include" + }, + { + "name" : "Vulkan_LIBRARY", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a library." + } + ], + "type" : "FILEPATH", + "value" : "/usr/lib/x86_64-linux-gnu/libvulkan.so" + }, + { + "name" : "_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "linker supports push/pop state" + } + ], + "type" : "INTERNAL", + "value" : "TRUE" + }, + { + "name" : "deerith_studio_BINARY_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "/home/chewico/Dev/Deerith/build/studio" + }, + { + "name" : "deerith_studio_IS_TOP_LEVEL", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "OFF" + }, + { + "name" : "deerith_studio_SOURCE_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "/home/chewico/Dev/Deerith/studio" + }, + { + "name" : "fmt_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "The directory containing a CMake configuration file for fmt." + } + ], + "type" : "PATH", + "value" : "/usr/lib/x86_64-linux-gnu/cmake/fmt" + }, + { + "name" : "glfw3_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "The directory containing a CMake configuration file for glfw3." + } + ], + "type" : "PATH", + "value" : "/usr/lib/x86_64-linux-gnu/cmake/glfw3" + }, + { + "name" : "glm_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "The directory containing a CMake configuration file for glm." + } + ], + "type" : "PATH", + "value" : "/usr/share/cmake/glm" + }, + { + "name" : "spdlog_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "The directory containing a CMake configuration file for spdlog." + } + ], + "type" : "PATH", + "value" : "/usr/lib/x86_64-linux-gnu/cmake/spdlog" + } + ], + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } +} diff --git a/build/.cmake/api/v1/reply/cmakeFiles-v1-d22641474942e201ae12.json b/build/.cmake/api/v1/reply/cmakeFiles-v1-d22641474942e201ae12.json new file mode 100644 index 0000000..3d73c31 --- /dev/null +++ b/build/.cmake/api/v1/reply/cmakeFiles-v1-d22641474942e201ae12.json @@ -0,0 +1,272 @@ +{ + "inputs" : + [ + { + "path" : "CMakeLists.txt" + }, + { + "isGenerated" : true, + "path" : "build/CMakeFiles/3.25.1/CMakeSystem.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeSystemSpecificInitialize.cmake" + }, + { + "isGenerated" : true, + "path" : "build/CMakeFiles/3.25.1/CMakeCCompiler.cmake" + }, + { + "isGenerated" : true, + "path" : "build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeSystemSpecificInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeGenericSystem.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeInitializeConfigs.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Platform/Linux.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Platform/UnixPaths.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeCInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeLanguageInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Compiler/GNU-C.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Compiler/GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Platform/Linux-GNU-C.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Platform/Linux-GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeCommonLanguageInclude.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeCXXInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeLanguageInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Compiler/GNU-CXX.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Compiler/GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Platform/Linux-GNU-CXX.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Platform/Linux-GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeCommonLanguageInclude.cmake" + }, + { + "path" : "core/CMakeLists.txt" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/spdlog/spdlogConfigVersion.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/spdlog/spdlogConfig.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/FindThreads.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CheckLibraryExists.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CheckIncludeFile.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CheckCSourceCompiles.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/Internal/CheckSourceCompiles.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/FindPackageMessage.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/CMakeFindDependencyMacro.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/fmt/fmt-config-version.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/fmt/fmt-config.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/fmt/fmt-targets.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/fmt/fmt-targets-none.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/spdlog/spdlogConfigTargets.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/spdlog/spdlogConfigTargets-none.cmake" + }, + { + "path" : "graphics/CMakeLists.txt" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/FindVulkan.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.25/Modules/FindPackageMessage.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3ConfigVersion.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Config.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets-none.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/share/cmake/glm/glmConfigVersion.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/share/cmake/glm/glmConfig.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/fmt/fmt-config-version.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/fmt/fmt-config.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/fmt/fmt-targets.cmake" + }, + { + "isExternal" : true, + "path" : "/usr/lib/x86_64-linux-gnu/cmake/fmt/fmt-targets-none.cmake" + }, + { + "path" : "studio/CMakeLists.txt" + } + ], + "kind" : "cmakeFiles", + "paths" : + { + "build" : "/home/chewico/Dev/Deerith/build", + "source" : "/home/chewico/Dev/Deerith" + }, + "version" : + { + "major" : 1, + "minor" : 0 + } +} diff --git a/build/.cmake/api/v1/reply/codemodel-v2-b04972fb2a419ed848a5.json b/build/.cmake/api/v1/reply/codemodel-v2-b04972fb2a419ed848a5.json new file mode 100644 index 0000000..78cab7b --- /dev/null +++ b/build/.cmake/api/v1/reply/codemodel-v2-b04972fb2a419ed848a5.json @@ -0,0 +1,140 @@ +{ + "configurations" : + [ + { + "directories" : + [ + { + "build" : ".", + "childIndexes" : + [ + 1, + 2, + 3 + ], + "jsonFile" : "directory-.-Debug-f5ebdc15457944623624.json", + "minimumCMakeVersion" : + { + "string" : "3.20" + }, + "projectIndex" : 0, + "source" : "." + }, + { + "build" : "core", + "jsonFile" : "directory-core-Debug-eac7e466be7743a8be0a.json", + "minimumCMakeVersion" : + { + "string" : "3.16" + }, + "parentIndex" : 0, + "projectIndex" : 0, + "source" : "core", + "targetIndexes" : + [ + 0 + ] + }, + { + "build" : "graphics", + "jsonFile" : "directory-graphics-Debug-cfad82a9484b3a41fe77.json", + "minimumCMakeVersion" : + { + "string" : "3.16" + }, + "parentIndex" : 0, + "projectIndex" : 0, + "source" : "graphics", + "targetIndexes" : + [ + 1 + ] + }, + { + "build" : "studio", + "jsonFile" : "directory-studio-Debug-22e42980ac3e541e162e.json", + "minimumCMakeVersion" : + { + "string" : "3.16" + }, + "parentIndex" : 0, + "projectIndex" : 1, + "source" : "studio", + "targetIndexes" : + [ + 2 + ] + } + ], + "name" : "Debug", + "projects" : + [ + { + "childIndexes" : + [ + 1 + ], + "directoryIndexes" : + [ + 0, + 1, + 2 + ], + "name" : "Deerith", + "targetIndexes" : + [ + 0, + 1 + ] + }, + { + "directoryIndexes" : + [ + 3 + ], + "name" : "deerith_studio", + "parentIndex" : 0, + "targetIndexes" : + [ + 2 + ] + } + ], + "targets" : + [ + { + "directoryIndex" : 1, + "id" : "deerith_core::@57760688d1f824db5d9c", + "jsonFile" : "target-deerith_core-Debug-9b2b313bbcf2d1c0ee4e.json", + "name" : "deerith_core", + "projectIndex" : 0 + }, + { + "directoryIndex" : 2, + "id" : "deerith_graphics::@708b9b26fb9b6631b242", + "jsonFile" : "target-deerith_graphics-Debug-a92ca704fa96f44b76c6.json", + "name" : "deerith_graphics", + "projectIndex" : 0 + }, + { + "directoryIndex" : 3, + "id" : "deerith_studio::@aed54e8c6d911c004f13", + "jsonFile" : "target-deerith_studio-Debug-1a9ce65a2e41589dca21.json", + "name" : "deerith_studio", + "projectIndex" : 1 + } + ] + } + ], + "kind" : "codemodel", + "paths" : + { + "build" : "/home/chewico/Dev/Deerith/build", + "source" : "/home/chewico/Dev/Deerith" + }, + "version" : + { + "major" : 2, + "minor" : 4 + } +} diff --git a/build/.cmake/api/v1/reply/directory-.-Debug-f5ebdc15457944623624.json b/build/.cmake/api/v1/reply/directory-.-Debug-f5ebdc15457944623624.json new file mode 100644 index 0000000..3a67af9 --- /dev/null +++ b/build/.cmake/api/v1/reply/directory-.-Debug-f5ebdc15457944623624.json @@ -0,0 +1,14 @@ +{ + "backtraceGraph" : + { + "commands" : [], + "files" : [], + "nodes" : [] + }, + "installers" : [], + "paths" : + { + "build" : ".", + "source" : "." + } +} diff --git a/build/.cmake/api/v1/reply/directory-core-Debug-eac7e466be7743a8be0a.json b/build/.cmake/api/v1/reply/directory-core-Debug-eac7e466be7743a8be0a.json new file mode 100644 index 0000000..9fe17c9 --- /dev/null +++ b/build/.cmake/api/v1/reply/directory-core-Debug-eac7e466be7743a8be0a.json @@ -0,0 +1,14 @@ +{ + "backtraceGraph" : + { + "commands" : [], + "files" : [], + "nodes" : [] + }, + "installers" : [], + "paths" : + { + "build" : "core", + "source" : "core" + } +} diff --git a/build/.cmake/api/v1/reply/directory-graphics-Debug-cfad82a9484b3a41fe77.json b/build/.cmake/api/v1/reply/directory-graphics-Debug-cfad82a9484b3a41fe77.json new file mode 100644 index 0000000..34968c2 --- /dev/null +++ b/build/.cmake/api/v1/reply/directory-graphics-Debug-cfad82a9484b3a41fe77.json @@ -0,0 +1,14 @@ +{ + "backtraceGraph" : + { + "commands" : [], + "files" : [], + "nodes" : [] + }, + "installers" : [], + "paths" : + { + "build" : "graphics", + "source" : "graphics" + } +} diff --git a/build/.cmake/api/v1/reply/directory-studio-Debug-22e42980ac3e541e162e.json b/build/.cmake/api/v1/reply/directory-studio-Debug-22e42980ac3e541e162e.json new file mode 100644 index 0000000..447b2f9 --- /dev/null +++ b/build/.cmake/api/v1/reply/directory-studio-Debug-22e42980ac3e541e162e.json @@ -0,0 +1,14 @@ +{ + "backtraceGraph" : + { + "commands" : [], + "files" : [], + "nodes" : [] + }, + "installers" : [], + "paths" : + { + "build" : "studio", + "source" : "studio" + } +} diff --git a/build/.cmake/api/v1/reply/index-2026-03-23T00-10-10-0479.json b/build/.cmake/api/v1/reply/index-2026-03-23T00-10-10-0479.json new file mode 100644 index 0000000..5536b41 --- /dev/null +++ b/build/.cmake/api/v1/reply/index-2026-03-23T00-10-10-0479.json @@ -0,0 +1,132 @@ +{ + "cmake" : + { + "generator" : + { + "multiConfig" : false, + "name" : "Unix Makefiles" + }, + "paths" : + { + "cmake" : "/usr/bin/cmake", + "cpack" : "/usr/bin/cpack", + "ctest" : "/usr/bin/ctest", + "root" : "/usr/share/cmake-3.25" + }, + "version" : + { + "isDirty" : false, + "major" : 3, + "minor" : 25, + "patch" : 1, + "string" : "3.25.1", + "suffix" : "" + } + }, + "objects" : + [ + { + "jsonFile" : "codemodel-v2-b04972fb2a419ed848a5.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 4 + } + }, + { + "jsonFile" : "cache-v2-75733dde282360676e09.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "jsonFile" : "cmakeFiles-v1-d22641474942e201ae12.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 0 + } + }, + { + "jsonFile" : "toolchains-v1-a68c232ca45b00aa6bba.json", + "kind" : "toolchains", + "version" : + { + "major" : 1, + "minor" : 0 + } + } + ], + "reply" : + { + "client-vscode" : + { + "query.json" : + { + "requests" : + [ + { + "kind" : "cache", + "version" : 2 + }, + { + "kind" : "codemodel", + "version" : 2 + }, + { + "kind" : "toolchains", + "version" : 1 + }, + { + "kind" : "cmakeFiles", + "version" : 1 + } + ], + "responses" : + [ + { + "jsonFile" : "cache-v2-75733dde282360676e09.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "jsonFile" : "codemodel-v2-b04972fb2a419ed848a5.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 4 + } + }, + { + "jsonFile" : "toolchains-v1-a68c232ca45b00aa6bba.json", + "kind" : "toolchains", + "version" : + { + "major" : 1, + "minor" : 0 + } + }, + { + "jsonFile" : "cmakeFiles-v1-d22641474942e201ae12.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 0 + } + } + ] + } + } + } +} diff --git a/build/.cmake/api/v1/reply/target-deerith_core-Debug-9b2b313bbcf2d1c0ee4e.json b/build/.cmake/api/v1/reply/target-deerith_core-Debug-9b2b313bbcf2d1c0ee4e.json new file mode 100644 index 0000000..90ec942 --- /dev/null +++ b/build/.cmake/api/v1/reply/target-deerith_core-Debug-9b2b313bbcf2d1c0ee4e.json @@ -0,0 +1,148 @@ +{ + "archive" : {}, + "artifacts" : + [ + { + "path" : "core/libdeerith_core.a" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_library", + "target_link_libraries", + "target_include_directories", + "target_compile_features" + ], + "files" : + [ + "core/CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 7, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 18, + "parent" : 0 + }, + { + "command" : 2, + "file" : 0, + "line" : 9, + "parent" : 0 + }, + { + "command" : 3, + "file" : 0, + "line" : 14, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-g" + }, + { + "fragment" : "-std=gnu++20" + } + ], + "defines" : + [ + { + "backtrace" : 2, + "define" : "FMT_SHARED" + }, + { + "backtrace" : 2, + "define" : "SPDLOG_COMPILED_LIB" + }, + { + "backtrace" : 2, + "define" : "SPDLOG_FMT_EXTERNAL" + }, + { + "backtrace" : 2, + "define" : "SPDLOG_SHARED_LIB" + } + ], + "includes" : + [ + { + "backtrace" : 3, + "path" : "/home/chewico/Dev/Deerith/core/include" + }, + { + "backtrace" : 3, + "path" : "/home/chewico/Dev/Deerith/core/src" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 4, + 2 + ], + "standard" : "20" + }, + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "id" : "deerith_core::@57760688d1f824db5d9c", + "name" : "deerith_core", + "nameOnDisk" : "libdeerith_core.a", + "paths" : + { + "build" : "core", + "source" : "core" + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "core/src/engine.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "core/src/log.cpp", + "sourceGroupIndex" : 0 + } + ], + "type" : "STATIC_LIBRARY" +} diff --git a/build/.cmake/api/v1/reply/target-deerith_graphics-Debug-a92ca704fa96f44b76c6.json b/build/.cmake/api/v1/reply/target-deerith_graphics-Debug-a92ca704fa96f44b76c6.json new file mode 100644 index 0000000..b977fa2 --- /dev/null +++ b/build/.cmake/api/v1/reply/target-deerith_graphics-Debug-a92ca704fa96f44b76c6.json @@ -0,0 +1,271 @@ +{ + "archive" : {}, + "artifacts" : + [ + { + "path" : "graphics/libdeerith_graphics.a" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_library", + "target_link_libraries", + "target_include_directories", + "target_compile_features" + ], + "files" : + [ + "graphics/CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 7, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 21, + "parent" : 0 + }, + { + "command" : 2, + "file" : 0, + "line" : 9, + "parent" : 0 + }, + { + "command" : 3, + "file" : 0, + "line" : 14, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-g" + }, + { + "fragment" : "-std=gnu++20" + } + ], + "defines" : + [ + { + "backtrace" : 2, + "define" : "FMT_SHARED" + }, + { + "backtrace" : 2, + "define" : "SPDLOG_COMPILED_LIB" + }, + { + "backtrace" : 2, + "define" : "SPDLOG_FMT_EXTERNAL" + }, + { + "backtrace" : 2, + "define" : "SPDLOG_SHARED_LIB" + } + ], + "includes" : + [ + { + "backtrace" : 3, + "path" : "/home/chewico/Dev/Deerith/graphics/include" + }, + { + "backtrace" : 3, + "path" : "/home/chewico/Dev/Deerith/graphics/src" + }, + { + "backtrace" : 2, + "path" : "/home/chewico/Dev/Deerith/core/include" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 4, + 2 + ], + "standard" : "20" + }, + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15 + ] + } + ], + "dependencies" : + [ + { + "backtrace" : 2, + "id" : "deerith_core::@57760688d1f824db5d9c" + } + ], + "id" : "deerith_graphics::@708b9b26fb9b6631b242", + "name" : "deerith_graphics", + "nameOnDisk" : "libdeerith_graphics.a", + "paths" : + { + "build" : "graphics", + "source" : "graphics" + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/glfw.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/graphics.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/variables.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_frame_buffer.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_graphics_pipeline.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_image_view.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_instance.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_logical_device.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_phisical_device.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_presentation.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_render_command.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_render_pass.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_rendering.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_swap_chain.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "graphics/src/vulkan_validation.cpp", + "sourceGroupIndex" : 0 + } + ], + "type" : "STATIC_LIBRARY" +} diff --git a/build/.cmake/api/v1/reply/target-deerith_studio-Debug-1a9ce65a2e41589dca21.json b/build/.cmake/api/v1/reply/target-deerith_studio-Debug-1a9ce65a2e41589dca21.json new file mode 100644 index 0000000..d400a05 --- /dev/null +++ b/build/.cmake/api/v1/reply/target-deerith_studio-Debug-1a9ce65a2e41589dca21.json @@ -0,0 +1,242 @@ +{ + "artifacts" : + [ + { + "path" : "studio/deerith_studio" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "target_link_libraries", + "set_target_properties", + "include", + "find_package" + ], + "files" : + [ + "studio/CMakeLists.txt", + "core/CMakeLists.txt", + "/usr/lib/x86_64-linux-gnu/cmake/spdlog/spdlogConfigTargets.cmake", + "/usr/lib/x86_64-linux-gnu/cmake/spdlog/spdlogConfig.cmake", + "graphics/CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 8, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 10, + "parent" : 0 + }, + { + "file" : 1 + }, + { + "command" : 1, + "file" : 1, + "line" : 18, + "parent" : 3 + }, + { + "command" : 4, + "file" : 1, + "line" : 16, + "parent" : 3 + }, + { + "file" : 3, + "parent" : 5 + }, + { + "command" : 3, + "file" : 3, + "line" : 52, + "parent" : 6 + }, + { + "file" : 2, + "parent" : 7 + }, + { + "command" : 2, + "file" : 2, + "line" : 71, + "parent" : 8 + }, + { + "file" : 4 + }, + { + "command" : 1, + "file" : 4, + "line" : 21, + "parent" : 10 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : "-g" + }, + { + "fragment" : "-std=gnu++20" + } + ], + "defines" : + [ + { + "backtrace" : 2, + "define" : "FMT_SHARED" + }, + { + "backtrace" : 2, + "define" : "SPDLOG_COMPILED_LIB" + }, + { + "backtrace" : 2, + "define" : "SPDLOG_FMT_EXTERNAL" + }, + { + "backtrace" : 2, + "define" : "SPDLOG_SHARED_LIB" + } + ], + "includes" : + [ + { + "backtrace" : 2, + "path" : "/home/chewico/Dev/Deerith/core/include" + }, + { + "backtrace" : 2, + "path" : "/home/chewico/Dev/Deerith/graphics/include" + } + ], + "language" : "CXX", + "languageStandard" : + { + "backtraces" : + [ + 2, + 2 + ], + "standard" : "20" + }, + "sourceIndexes" : + [ + 0 + ] + } + ], + "dependencies" : + [ + { + "backtrace" : 2, + "id" : "deerith_core::@57760688d1f824db5d9c" + }, + { + "backtrace" : 2, + "id" : "deerith_graphics::@708b9b26fb9b6631b242" + } + ], + "id" : "deerith_studio::@aed54e8c6d911c004f13", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "-g", + "role" : "flags" + }, + { + "fragment" : "", + "role" : "flags" + }, + { + "backtrace" : 2, + "fragment" : "../core/libdeerith_core.a", + "role" : "libraries" + }, + { + "backtrace" : 2, + "fragment" : "../graphics/libdeerith_graphics.a", + "role" : "libraries" + }, + { + "backtrace" : 2, + "fragment" : "../core/libdeerith_core.a", + "role" : "libraries" + }, + { + "backtrace" : 4, + "fragment" : "/usr/lib/x86_64-linux-gnu/libspdlog.so.1.10.0", + "role" : "libraries" + }, + { + "backtrace" : 9, + "fragment" : "/usr/lib/x86_64-linux-gnu/libfmt.so.9.1.0", + "role" : "libraries" + }, + { + "backtrace" : 11, + "fragment" : "/usr/lib/x86_64-linux-gnu/libvulkan.so", + "role" : "libraries" + }, + { + "backtrace" : 11, + "fragment" : "/usr/lib/x86_64-linux-gnu/libglfw.so.3.3", + "role" : "libraries" + }, + { + "backtrace" : 11, + "fragment" : "/usr/lib/x86_64-linux-gnu/libfmt.so.9.1.0", + "role" : "libraries" + } + ], + "language" : "CXX" + }, + "name" : "deerith_studio", + "nameOnDisk" : "deerith_studio", + "paths" : + { + "build" : "studio", + "source" : "studio" + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "studio/src/main.cpp", + "sourceGroupIndex" : 0 + } + ], + "type" : "EXECUTABLE" +} diff --git a/build/.cmake/api/v1/reply/toolchains-v1-a68c232ca45b00aa6bba.json b/build/.cmake/api/v1/reply/toolchains-v1-a68c232ca45b00aa6bba.json new file mode 100644 index 0000000..d98e41f --- /dev/null +++ b/build/.cmake/api/v1/reply/toolchains-v1-a68c232ca45b00aa6bba.json @@ -0,0 +1,107 @@ +{ + "kind" : "toolchains", + "toolchains" : + [ + { + "compiler" : + { + "id" : "GNU", + "implicit" : + { + "includeDirectories" : + [ + "/usr/lib/gcc/x86_64-linux-gnu/12/include", + "/usr/local/include", + "/usr/include/x86_64-linux-gnu", + "/usr/include" + ], + "linkDirectories" : + [ + "/usr/lib/gcc/x86_64-linux-gnu/12", + "/usr/lib/x86_64-linux-gnu", + "/usr/lib", + "/lib/x86_64-linux-gnu", + "/lib" + ], + "linkFrameworkDirectories" : [], + "linkLibraries" : + [ + "gcc", + "gcc_s", + "c", + "gcc", + "gcc_s" + ] + }, + "path" : "/usr/bin/cc", + "version" : "12.2.0" + }, + "language" : "C", + "sourceFileExtensions" : + [ + "c", + "m" + ] + }, + { + "compiler" : + { + "id" : "GNU", + "implicit" : + { + "includeDirectories" : + [ + "/usr/include/c++/12", + "/usr/include/x86_64-linux-gnu/c++/12", + "/usr/include/c++/12/backward", + "/usr/lib/gcc/x86_64-linux-gnu/12/include", + "/usr/local/include", + "/usr/include/x86_64-linux-gnu", + "/usr/include" + ], + "linkDirectories" : + [ + "/usr/lib/gcc/x86_64-linux-gnu/12", + "/usr/lib/x86_64-linux-gnu", + "/usr/lib", + "/lib/x86_64-linux-gnu", + "/lib" + ], + "linkFrameworkDirectories" : [], + "linkLibraries" : + [ + "stdc++", + "m", + "gcc_s", + "gcc", + "c", + "gcc_s", + "gcc" + ] + }, + "path" : "/usr/bin/c++", + "version" : "12.2.0" + }, + "language" : "CXX", + "sourceFileExtensions" : + [ + "C", + "M", + "c++", + "cc", + "cpp", + "cxx", + "mm", + "mpp", + "CPP", + "ixx", + "cppm" + ] + } + ], + "version" : + { + "major" : 1, + "minor" : 0 + } +} diff --git a/build/core/libdeerith_core.a b/build/core/libdeerith_core.a new file mode 100644 index 0000000..3c5e3a9 Binary files /dev/null and b/build/core/libdeerith_core.a differ diff --git a/build/graphics/libdeerith_graphics.a b/build/graphics/libdeerith_graphics.a new file mode 100644 index 0000000..2a01d3c Binary files /dev/null and b/build/graphics/libdeerith_graphics.a differ diff --git a/build/studio/deerith_studio b/build/studio/deerith_studio new file mode 100755 index 0000000..1c48fc7 Binary files /dev/null and b/build/studio/deerith_studio differ diff --git a/build/studio/shaders/frag.spv b/build/studio/shaders/frag.spv new file mode 100644 index 0000000..da37f7e Binary files /dev/null and b/build/studio/shaders/frag.spv differ diff --git a/build/studio/shaders/shader.frag b/build/studio/shaders/shader.frag new file mode 100644 index 0000000..13009da --- /dev/null +++ b/build/studio/shaders/shader.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) in vec3 fragColor; + +layout(location = 0) out vec4 outColor; + +void main() { + outColor = vec4(fragColor, 1.0); +} \ No newline at end of file diff --git a/build/studio/shaders/shader.vert b/build/studio/shaders/shader.vert new file mode 100644 index 0000000..f5b2f8d --- /dev/null +++ b/build/studio/shaders/shader.vert @@ -0,0 +1,20 @@ +#version 450 + +layout(location = 0) out vec3 fragColor; + +vec2 positions[3] = vec2[]( + vec2(0.0, -0.5), + vec2(0.5, 0.5), + vec2(-0.5, 0.5) +); + +vec3 colors[3] = vec3[]( + vec3(1.0, 0.0, 0.0), + vec3(0.0, 1.0, 0.0), + vec3(0.0, 0.0, 1.0) +); + +void main() { + gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0); + fragColor = colors[gl_VertexIndex]; +} diff --git a/build/studio/shaders/vert.spv b/build/studio/shaders/vert.spv new file mode 100644 index 0000000..a41dd2c Binary files /dev/null and b/build/studio/shaders/vert.spv differ diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt new file mode 100644 index 0000000..efcb50e --- /dev/null +++ b/core/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.16) + +file(GLOB_RECURSE CORE_SOURCES CONFIGURE_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp +) + +add_library(deerith_core ${CORE_SOURCES}) + +target_include_directories(deerith_core + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) + +target_compile_features(deerith_core PUBLIC cxx_std_20) + +find_package(spdlog REQUIRED) + +target_link_libraries(deerith_core + PUBLIC spdlog::spdlog +) + +add_library(deerith::core ALIAS deerith_core) \ No newline at end of file diff --git a/core/include/deerith/core/engine.h b/core/include/deerith/core/engine.h new file mode 100644 index 0000000..488bc65 --- /dev/null +++ b/core/include/deerith/core/engine.h @@ -0,0 +1,8 @@ +#pragma once + +namespace deerith { + namespace engine { + void init(); + void shutdown(); + } // namespace engine +} // namespace deerith \ No newline at end of file diff --git a/core/include/deerith/core/log.h b/core/include/deerith/core/log.h new file mode 100644 index 0000000..96ab1b5 --- /dev/null +++ b/core/include/deerith/core/log.h @@ -0,0 +1,36 @@ +#pragma once +#include +#include + +namespace spdlog { + class logger; +} + +namespace deerith { + namespace log { + spdlog::logger* get_core_logger(); + spdlog::logger* get_graphics_logger(); + }; // namespace log +} // namespace deerith + +#define deerith_core_trace(...) deerith::log::get_core_logger()->trace(__VA_ARGS__) +#define deerith_core_info(...) deerith::log::get_core_logger()->info(__VA_ARGS__) +#define deerith_core_warn(...) deerith::log::get_core_logger()->warn(__VA_ARGS__) +#define deerith_core_error(...) deerith::log::get_core_logger()->error(__VA_ARGS__) + +#define deerith_graphics_trace(...) deerith::log::get_graphics_logger()->trace(__VA_ARGS__) +#define deerith_graphics_info(...) deerith::log::get_graphics_logger()->info(__VA_ARGS__) +#define deerith_graphics_warn(...) deerith::log::get_graphics_logger()->warn(__VA_ARGS__) +#define deerith_graphics_error(...) deerith::log::get_graphics_logger()->error(__VA_ARGS__) + +#define deerith_core_assert(condition, ...) \ + if (!(condition)) { \ + deerith::log::get_core_logger()->error(__VA_ARGS__); \ + __builtin_trap(); \ + } + +#define deerith_graphics_assert(condition, ...) \ + if (!(condition)) { \ + deerith::log::get_graphics_logger()->error(__VA_ARGS__); \ + __builtin_trap(); \ + } diff --git a/core/include/deerith/core/memory.h b/core/include/deerith/core/memory.h new file mode 100644 index 0000000..cee2881 --- /dev/null +++ b/core/include/deerith/core/memory.h @@ -0,0 +1,12 @@ +#pragma once +#include + +namespace deerith { + template + using Scope = std::unique_ptr; + + template + constexpr auto make_scope(Args&&... args) { + return std::make_unique(std::forward(args)...); + } +} // namespace deerith diff --git a/core/include/deerith/core/types.h b/core/include/deerith/core/types.h new file mode 100644 index 0000000..6d2e52b --- /dev/null +++ b/core/include/deerith/core/types.h @@ -0,0 +1,2 @@ +#pragma once +#include \ No newline at end of file diff --git a/core/src/detail/log.h b/core/src/detail/log.h new file mode 100644 index 0000000..31cf909 --- /dev/null +++ b/core/src/detail/log.h @@ -0,0 +1,8 @@ +#pragma once + +namespace deerith { + namespace log { + void init(); + void shutdown(); + } // namespace log +} // namespace deerith \ No newline at end of file diff --git a/core/src/engine.cpp b/core/src/engine.cpp new file mode 100644 index 0000000..f8f1225 --- /dev/null +++ b/core/src/engine.cpp @@ -0,0 +1,16 @@ +#include +#include + +#include "detail/log.h" + +namespace deerith { + void engine::init() { + log::init(); + deerith_core_trace("Initializing deerith core"); + } + + void engine::shutdown() { + deerith_core_trace("Shutting deerith core"); + log::shutdown(); + } +} // namespace deerith diff --git a/core/src/log.cpp b/core/src/log.cpp new file mode 100644 index 0000000..64cc29a --- /dev/null +++ b/core/src/log.cpp @@ -0,0 +1,35 @@ +#include + +#include "detail/log.h" + +namespace deerith { + namespace log { + std::shared_ptr core_logger; + std::shared_ptr graphics_logger; + } // namespace log + + void log::init() { + spdlog::set_pattern("%^[%T] %n: %v%$"); + + core_logger = spdlog::stdout_color_mt("core"); + graphics_logger = spdlog::stdout_color_mt("graphics"); + + core_logger->set_level(spdlog::level::level_enum::trace); + graphics_logger->set_level(spdlog::level::level_enum::trace); + } + + void log::shutdown() { + core_logger.reset(); + graphics_logger.reset(); + + spdlog::drop_all(); + } + + spdlog::logger* log::get_core_logger() { + return core_logger.get(); + } + + spdlog::logger* log::get_graphics_logger() { + return graphics_logger.get(); + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/CMakeLists.txt b/graphics/CMakeLists.txt new file mode 100644 index 0000000..069f368 --- /dev/null +++ b/graphics/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.16) + +file(GLOB_RECURSE GRAPHICS_SOURCES CONFIGURE_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp +) + +add_library(deerith_graphics ${GRAPHICS_SOURCES}) + +target_include_directories(deerith_graphics + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src +) + +target_compile_features(deerith_graphics PUBLIC cxx_std_20) + +find_package(Vulkan REQUIRED) +find_package(glfw3 REQUIRED) +find_package(glm REQUIRED) +find_package(fmt REQUIRED) + +target_link_libraries(deerith_graphics + PUBLIC + deerith::core + PRIVATE + Vulkan::Vulkan + glfw + glm::glm + fmt::fmt +) + +add_library(deerith::graphics ALIAS deerith_graphics) \ No newline at end of file diff --git a/graphics/include/deerith/graphics/graphics.h b/graphics/include/deerith/graphics/graphics.h new file mode 100644 index 0000000..17c7ef1 --- /dev/null +++ b/graphics/include/deerith/graphics/graphics.h @@ -0,0 +1,14 @@ +#pragma once + +namespace deerith { + namespace graphics { + struct GraphicsConfig { + const char* window_title = ""; + int window_width = 800; + int window_height = 600; + }; + + void init(const GraphicsConfig& config); + void shutdown(); + } // namespace graphics +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/detail/graphics.h b/graphics/src/detail/graphics.h new file mode 100644 index 0000000..9774329 --- /dev/null +++ b/graphics/src/detail/graphics.h @@ -0,0 +1,89 @@ +#pragma once +#include +#include + +#include +#include + +#define GLFW_INCLUDE_VULKAN +#include +#include + +#define ACTIVE_VALIDATION_LAYER true + +class GLFWwindow; + +namespace deerith { + namespace graphics { + struct QueueFamilyIndices { + std::optional graphics_family; + std::optional present_family; + + inline bool is_complete() const { + return graphics_family.has_value() && present_family.has_value(); + } + }; + + struct SwapChainSupportDetails { + VkSurfaceCapabilitiesKHR capabilities; + std::vector formats; + std::vector present_modes; + }; + + extern GraphicsConfig graphics_config; + extern GLFWwindow* window; + + // Vulkan Specific + extern VkInstance instance; + extern const std::vector validation_layers; + extern const std::vector device_extensions; + extern VkPhysicalDevice physical_device; + extern QueueFamilyIndices queue_family_indices; + extern SwapChainSupportDetails swap_chain_support_details; + extern VkDevice device; + extern VkQueue graphics_queue; + extern VkQueue pressent_queue; + extern VkSurfaceKHR surface; + extern VkSwapchainKHR swap_chain; + extern std::vector swap_chain_images; + extern VkFormat swap_chain_image_format; + extern VkExtent2D swap_chain_extent; + extern std::vector swap_chain_image_views; + extern VkPipelineLayout pipeline_layout; + extern VkRenderPass render_pass; + extern VkPipeline graphics_pipeline; + extern std::vector swap_chain_frame_buffers; + extern VkCommandPool command_pool; + extern VkCommandBuffer command_buffer; + + extern VkSemaphore image_available_semaphore; + extern VkSemaphore render_finished_semaphore; + extern VkFence in_flight_fence; + + void init_glfw(); + void shutdown_glfw(); + + void init_vulkan(); + void shutdown_vulkan(); + + void create_vulkan_instance(); + void create_vulkan_validation_layer(); + void create_vulkan_surface(); + void create_vulkan_phisical_device(); + void create_vulkan_logical_device(); + void create_vulkan_swap_chain(); + void create_vulkan_image_view(); + void create_vulkan_render_pass(); + void create_vulkan_graphics_pipeline(); + void create_vulkan_frame_buffer(); + void create_vulkan_command_buffer(); + void create_vulkan_sync_objects(); + + void vulkan_test_loop(); + + QueueFamilyIndices find_queue_families(VkPhysicalDevice device); + SwapChainSupportDetails query_swap_chain_support(VkPhysicalDevice device); + void record_command_buffer(VkCommandBuffer commandBuffer, uint32_t imageIndex); + + } // namespace graphics +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/glfw.cpp b/graphics/src/glfw.cpp new file mode 100644 index 0000000..d9e5383 --- /dev/null +++ b/graphics/src/glfw.cpp @@ -0,0 +1,27 @@ +#include + +#include "detail/graphics.h" + +namespace deerith { + void graphics::init_glfw() { + deerith_graphics_trace("Initializing glfw"); + + glfwInit(); + + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); + glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); + + window = glfwCreateWindow(graphics_config.window_width, graphics_config.window_height, graphics_config.window_title, nullptr, nullptr); + + if (!window) { + deerith_graphics_error("failed to init glfw window"); + } + } + + void graphics::shutdown_glfw() { + deerith_graphics_trace("Shutting down glfw"); + + glfwDestroyWindow(window); + glfwTerminate(); + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/graphics.cpp b/graphics/src/graphics.cpp new file mode 100644 index 0000000..7864144 --- /dev/null +++ b/graphics/src/graphics.cpp @@ -0,0 +1,22 @@ +#include +#include + +#include "detail/graphics.h" + +namespace deerith { + void graphics::init(const GraphicsConfig& config) { + deerith_graphics_trace("Initializing deerith graphics"); + graphics_config = config; + + init_glfw(); + init_vulkan(); + } + + void graphics::shutdown() { + deerith_graphics_trace("Shutting down deerith graphics"); + + shutdown_vulkan(); + shutdown_glfw(); + } + +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/variables.cpp b/graphics/src/variables.cpp new file mode 100644 index 0000000..7d55259 --- /dev/null +++ b/graphics/src/variables.cpp @@ -0,0 +1,34 @@ +#include "detail/graphics.h" + +#define GLFW_INCLUDE_VULKAN +#include + +namespace deerith { + graphics::GraphicsConfig graphics::graphics_config; + GLFWwindow* graphics::window; + + VkInstance graphics::instance; + const std::vector graphics::validation_layers = {"VK_LAYER_KHRONOS_validation"}; + const std::vector graphics::device_extensions = {VK_KHR_SWAPCHAIN_EXTENSION_NAME}; + VkPhysicalDevice graphics::physical_device = VK_NULL_HANDLE; + graphics::QueueFamilyIndices graphics::queue_family_indices; + graphics::SwapChainSupportDetails graphics::swap_chain_support_details; + VkDevice graphics::device; + VkQueue graphics::graphics_queue; + VkQueue graphics::pressent_queue; + VkSurfaceKHR graphics::surface; + VkSwapchainKHR graphics::swap_chain; + std::vector graphics::swap_chain_images; + VkFormat graphics::swap_chain_image_format; + VkExtent2D graphics::swap_chain_extent; + std::vector graphics::swap_chain_image_views; + VkPipelineLayout graphics::pipeline_layout; + VkRenderPass graphics::render_pass; + VkPipeline graphics::graphics_pipeline; + std::vector graphics::swap_chain_frame_buffers; + VkCommandPool graphics::command_pool; + VkCommandBuffer graphics::command_buffer; + VkSemaphore graphics::image_available_semaphore; + VkSemaphore graphics::render_finished_semaphore; + VkFence graphics::in_flight_fence; +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan.cpp b/graphics/src/vulkan.cpp new file mode 100644 index 0000000..83d7a83 --- /dev/null +++ b/graphics/src/vulkan.cpp @@ -0,0 +1,44 @@ +#include "detail/graphics.h" + +namespace deerith { + void graphics::init_vulkan() { + deerith_graphics_trace("Initializing Vulkan"); + + create_vulkan_validation_layer(); + create_vulkan_instance(); + create_vulkan_surface(); + create_vulkan_phisical_device(); + create_vulkan_logical_device(); + create_vulkan_swap_chain(); + create_vulkan_image_view(); + create_vulkan_render_pass(); + create_vulkan_graphics_pipeline(); + create_vulkan_frame_buffer(); + create_vulkan_command_buffer(); + create_vulkan_sync_objects(); + vulkan_test_loop(); + } + + void graphics::shutdown_vulkan() { + deerith_graphics_trace("Shutting Vulkan"); + + vkDeviceWaitIdle(device); + vkDestroyCommandPool(device, command_pool, nullptr); + for (auto framebuffer : swap_chain_frame_buffers) { + vkDestroyFramebuffer(device, framebuffer, nullptr); + } + + vkDestroyPipeline(device, graphics_pipeline, nullptr); + vkDestroyRenderPass(device, render_pass, nullptr); + vkDestroyPipelineLayout(device, pipeline_layout, nullptr); + + for (auto image_view : swap_chain_image_views) { + vkDestroyImageView(device, image_view, nullptr); + } + + vkDestroySwapchainKHR(device, swap_chain, nullptr); + vkDestroySurfaceKHR(instance, surface, nullptr); + vkDestroyDevice(device, nullptr); + vkDestroyInstance(instance, nullptr); + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_frame_buffer.cpp b/graphics/src/vulkan_frame_buffer.cpp new file mode 100644 index 0000000..7ec449a --- /dev/null +++ b/graphics/src/vulkan_frame_buffer.cpp @@ -0,0 +1,24 @@ +#include "detail/graphics.h" + +namespace deerith { + void graphics::create_vulkan_frame_buffer() { + swap_chain_frame_buffers.resize(swap_chain_image_views.size()); + + for (size_t i = 0; i < swap_chain_image_views.size(); i++) { + VkImageView attachments[] = {swap_chain_image_views[i]}; + + VkFramebufferCreateInfo framebufferInfo{}; + framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; + framebufferInfo.renderPass = render_pass; + framebufferInfo.attachmentCount = 1; + framebufferInfo.pAttachments = attachments; + framebufferInfo.width = swap_chain_extent.width; + framebufferInfo.height = swap_chain_extent.height; + framebufferInfo.layers = 1; + + if (vkCreateFramebuffer(device, &framebufferInfo, nullptr, &swap_chain_frame_buffers[i]) != VK_SUCCESS) { + deerith_graphics_error("failed to create framebuffer!"); + } + } + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_graphics_pipeline.cpp b/graphics/src/vulkan_graphics_pipeline.cpp new file mode 100644 index 0000000..71667a2 --- /dev/null +++ b/graphics/src/vulkan_graphics_pipeline.cpp @@ -0,0 +1,163 @@ +#include "detail/graphics.h" + +#include + +namespace deerith { + namespace graphics { + std::vector read_file(const std::string& filename); + VkShaderModule create_shader_module(const std::vector& code); + } // namespace graphics + + void graphics::create_vulkan_graphics_pipeline() { + auto vertShaderCode = read_file("shaders/vert.spv"); + auto fragShaderCode = read_file("shaders/frag.spv"); + + VkShaderModule vertShaderModule = create_shader_module(vertShaderCode); + VkShaderModule fragShaderModule = create_shader_module(fragShaderCode); + + VkPipelineShaderStageCreateInfo vertShaderStageInfo{}; + vertShaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + vertShaderStageInfo.stage = VK_SHADER_STAGE_VERTEX_BIT; + vertShaderStageInfo.module = vertShaderModule; + vertShaderStageInfo.pName = "main"; + + VkPipelineShaderStageCreateInfo fragShaderStageInfo{}; + fragShaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + fragShaderStageInfo.stage = VK_SHADER_STAGE_FRAGMENT_BIT; + fragShaderStageInfo.module = fragShaderModule; + fragShaderStageInfo.pName = "main"; + + VkPipelineShaderStageCreateInfo shaderStages[] = {vertShaderStageInfo, fragShaderStageInfo}; + + VkPipelineVertexInputStateCreateInfo vertexInputInfo{}; + vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; + vertexInputInfo.vertexBindingDescriptionCount = 0; + vertexInputInfo.pVertexBindingDescriptions = nullptr; // Optional + vertexInputInfo.vertexAttributeDescriptionCount = 0; + vertexInputInfo.pVertexAttributeDescriptions = nullptr; // Optional + + VkPipelineInputAssemblyStateCreateInfo inputAssembly{}; + inputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; + inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; + inputAssembly.primitiveRestartEnable = VK_FALSE; + + VkViewport viewport{}; + viewport.x = 0.0f; + viewport.y = 0.0f; + viewport.width = (float)swap_chain_extent.width; + viewport.height = (float)swap_chain_extent.height; + viewport.minDepth = 0.0f; + viewport.maxDepth = 1.0f; + + VkRect2D scissor{}; + scissor.offset = {0, 0}; + scissor.extent = swap_chain_extent; + + VkPipelineViewportStateCreateInfo viewportState{}; + viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; + viewportState.viewportCount = 1; + viewportState.pViewports = &viewport; + viewportState.scissorCount = 1; + viewportState.pScissors = &scissor; + + VkPipelineRasterizationStateCreateInfo rasterizer{}; + rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; + rasterizer.depthClampEnable = VK_FALSE; + rasterizer.polygonMode = VK_POLYGON_MODE_FILL; + rasterizer.depthBiasEnable = VK_FALSE; + rasterizer.lineWidth = 1.0f; + rasterizer.depthBiasConstantFactor = 0.0f; // Optional + rasterizer.depthBiasClamp = 0.0f; // Optional + rasterizer.depthBiasSlopeFactor = 0.0f; // Optional + + VkPipelineColorBlendAttachmentState colorBlendAttachment{}; + colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; + colorBlendAttachment.blendEnable = VK_FALSE; + + VkPipelineLayoutCreateInfo pipelineLayoutInfo{}; + pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; + pipelineLayoutInfo.setLayoutCount = 0; // Optional + pipelineLayoutInfo.pSetLayouts = nullptr; // Optional + pipelineLayoutInfo.pushConstantRangeCount = 0; // Optional + pipelineLayoutInfo.pPushConstantRanges = nullptr; // Optional + + VkPipelineMultisampleStateCreateInfo multisampling{}; + multisampling.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; + multisampling.sampleShadingEnable = VK_FALSE; + multisampling.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; + multisampling.minSampleShading = 1.0f; // Optional + multisampling.pSampleMask = nullptr; // Optional + multisampling.alphaToCoverageEnable = VK_FALSE; // Optional + multisampling.alphaToOneEnable = VK_FALSE; // Optional + + VkPipelineColorBlendStateCreateInfo colorBlending{}; + colorBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; + colorBlending.logicOpEnable = VK_FALSE; + colorBlending.logicOp = VK_LOGIC_OP_COPY; // Optional + colorBlending.attachmentCount = 1; + colorBlending.pAttachments = &colorBlendAttachment; + colorBlending.blendConstants[0] = 0.0f; // Optional + colorBlending.blendConstants[1] = 0.0f; // Optional + colorBlending.blendConstants[2] = 0.0f; // Optional + colorBlending.blendConstants[3] = 0.0f; // Optional + + if (vkCreatePipelineLayout(device, &pipelineLayoutInfo, nullptr, &pipeline_layout) != VK_SUCCESS) { + deerith_graphics_error("failed to create pipeline layout!"); + } + + VkGraphicsPipelineCreateInfo pipelineInfo{}; + pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; + pipelineInfo.stageCount = 2; + pipelineInfo.pStages = shaderStages; + + pipelineInfo.pVertexInputState = &vertexInputInfo; + pipelineInfo.pInputAssemblyState = &inputAssembly; + pipelineInfo.pViewportState = &viewportState; + pipelineInfo.pRasterizationState = &rasterizer; + pipelineInfo.pMultisampleState = &multisampling; + pipelineInfo.pDepthStencilState = nullptr; // Optional + pipelineInfo.pColorBlendState = &colorBlending; + pipelineInfo.pDynamicState = nullptr; + pipelineInfo.layout = pipeline_layout; + pipelineInfo.renderPass = render_pass; + pipelineInfo.subpass = 0; + + if (vkCreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &graphics_pipeline) != VK_SUCCESS) { + deerith_graphics_error("failed to create graphics pipeline!"); + } + + vkDestroyShaderModule(device, fragShaderModule, nullptr); + vkDestroyShaderModule(device, vertShaderModule, nullptr); + } + + VkShaderModule graphics::create_shader_module(const std::vector& code) { + VkShaderModuleCreateInfo create_info{}; + create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; + create_info.codeSize = code.size(); + create_info.pCode = reinterpret_cast(code.data()); + + VkShaderModule shader_module; + if (vkCreateShaderModule(device, &create_info, nullptr, &shader_module) != VK_SUCCESS) { + deerith_graphics_error("failed to create shader module!"); + } + + return shader_module; + } + + std::vector graphics::read_file(const std::string& filename) { + std::ifstream file(filename, std::ios::ate | std::ios::binary); + + if (!file.is_open()) { + deerith_graphics_error("failed to open file!"); + } + + size_t fileSize = (size_t)file.tellg(); + std::vector buffer(fileSize); + + file.seekg(0); + file.read(buffer.data(), fileSize); + + file.close(); + return buffer; + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_image_view.cpp b/graphics/src/vulkan_image_view.cpp new file mode 100644 index 0000000..7b3284c --- /dev/null +++ b/graphics/src/vulkan_image_view.cpp @@ -0,0 +1,30 @@ +#include "detail/graphics.h" + +namespace deerith { + void graphics::create_vulkan_image_view() { + swap_chain_image_views.resize(swap_chain_images.size()); + + for (size_t i = 0; i < swap_chain_images.size(); i++) { + VkImageViewCreateInfo create_info{}; + create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; + create_info.image = swap_chain_images[i]; + create_info.viewType = VK_IMAGE_VIEW_TYPE_2D; + create_info.format = swap_chain_image_format; + + create_info.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; + create_info.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; + create_info.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; + create_info.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; + + create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + create_info.subresourceRange.baseMipLevel = 0; + create_info.subresourceRange.levelCount = 1; + create_info.subresourceRange.baseArrayLayer = 0; + create_info.subresourceRange.layerCount = 1; + + if (vkCreateImageView(device, &create_info, nullptr, &swap_chain_image_views[i]) != VK_SUCCESS) { + deerith_graphics_error("failed to create image views!"); + } + } + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_instance.cpp b/graphics/src/vulkan_instance.cpp new file mode 100644 index 0000000..971725c --- /dev/null +++ b/graphics/src/vulkan_instance.cpp @@ -0,0 +1,58 @@ +#include "detail/graphics.h" + +namespace deerith { + void graphics::create_vulkan_instance() { + deerith_graphics_trace("Initializing Vulkan instance"); + + VkApplicationInfo app_info{}; + app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; + app_info.pApplicationName = graphics_config.window_title; + app_info.applicationVersion = VK_MAKE_VERSION(1, 0, 0); + app_info.pEngineName = "Deerith"; + app_info.engineVersion = VK_MAKE_VERSION(1, 0, 0); + app_info.apiVersion = VK_API_VERSION_1_0; + + VkInstanceCreateInfo create_info{}; + create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + create_info.pApplicationInfo = &app_info; + + uint32_t glfw_extension_count = 0; + const char** glfw_extensions; + glfw_extensions = glfwGetRequiredInstanceExtensions(&glfw_extension_count); + + create_info.enabledExtensionCount = glfw_extension_count; + create_info.ppEnabledExtensionNames = glfw_extensions; + + if (ACTIVE_VALIDATION_LAYER) { + create_info.enabledLayerCount = static_cast(validation_layers.size()); + create_info.ppEnabledLayerNames = validation_layers.data(); + } else { + create_info.enabledLayerCount = 0; + } + + if (vkCreateInstance(&create_info, nullptr, &instance) != VK_SUCCESS) { + deerith_graphics_error("Error creating vulkan instance"); + } + } + + graphics::SwapChainSupportDetails graphics::query_swap_chain_support(VkPhysicalDevice device) { + SwapChainSupportDetails details; + vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device, surface, &details.capabilities); + + uint32_t format_count; + vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &format_count, nullptr); + if (format_count != 0) { + details.formats.resize(format_count); + vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &format_count, details.formats.data()); + } + + uint32_t pressent_mode_count; + vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &pressent_mode_count, nullptr); + if (pressent_mode_count != 0) { + details.present_modes.resize(pressent_mode_count); + vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &pressent_mode_count, details.present_modes.data()); + } + + return details; + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_logical_device.cpp b/graphics/src/vulkan_logical_device.cpp new file mode 100644 index 0000000..db0959d --- /dev/null +++ b/graphics/src/vulkan_logical_device.cpp @@ -0,0 +1,48 @@ +#include "detail/graphics.h" + +#include + +namespace deerith { + void graphics::create_vulkan_logical_device() { + deerith_graphics_trace("Initializing Vulkan logical device"); + + QueueFamilyIndices indices = find_queue_families(physical_device); + + VkPhysicalDeviceFeatures device_features{}; + + std::vector queue_create_infos; + std::set unique_queue_families = {indices.graphics_family.value(), indices.present_family.value()}; + + float queuePriority = 1.0f; + for (uint32_t queueFamily : unique_queue_families) { + VkDeviceQueueCreateInfo queue_create_info{}; + queue_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; + queue_create_info.queueFamilyIndex = queueFamily; + queue_create_info.queueCount = 1; + queue_create_info.pQueuePriorities = &queuePriority; + queue_create_infos.push_back(queue_create_info); + } + + VkDeviceCreateInfo create_info{}; + create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; + create_info.queueCreateInfoCount = static_cast(queue_create_infos.size()); + create_info.pQueueCreateInfos = queue_create_infos.data(); + create_info.pEnabledFeatures = &device_features; + create_info.enabledExtensionCount = static_cast(device_extensions.size()); + create_info.ppEnabledExtensionNames = device_extensions.data(); + + if (ACTIVE_VALIDATION_LAYER) { + create_info.enabledLayerCount = static_cast(validation_layers.size()); + create_info.ppEnabledLayerNames = validation_layers.data(); + } else { + create_info.enabledLayerCount = 0; + } + + if (vkCreateDevice(physical_device, &create_info, nullptr, &device) != VK_SUCCESS) { + deerith_graphics_error("failed to create logical device"); + } + + vkGetDeviceQueue(device, indices.graphics_family.value(), 0, &graphics_queue); + vkGetDeviceQueue(device, indices.present_family.value(), 0, &pressent_queue); + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_phisical_device.cpp b/graphics/src/vulkan_phisical_device.cpp new file mode 100644 index 0000000..9b7538d --- /dev/null +++ b/graphics/src/vulkan_phisical_device.cpp @@ -0,0 +1,104 @@ +#include "detail/graphics.h" + +#include + +namespace deerith { + namespace graphics { + bool is_device_suitable(VkPhysicalDevice device); + bool check_device_extension_support(VkPhysicalDevice device); + } // namespace graphics + + void graphics::create_vulkan_phisical_device() { + deerith_graphics_trace("Initializing Vulkan phisical device"); + + uint32_t deviceCount = 0; + vkEnumeratePhysicalDevices(instance, &deviceCount, nullptr); + + if (deviceCount == 0) { + deerith_graphics_error("failed to find GPUs with Vulkan support!"); + return; + } + + std::vector devices(deviceCount); + vkEnumeratePhysicalDevices(instance, &deviceCount, devices.data()); + + for (const auto& device : devices) { + if (is_device_suitable(device)) { + physical_device = device; + break; + } + } + + if (physical_device == VK_NULL_HANDLE) { + deerith_graphics_error("failed to find GPUs"); + } + + queue_family_indices = find_queue_families(physical_device); + } + + bool graphics::is_device_suitable(VkPhysicalDevice device) { + VkPhysicalDeviceProperties deviceProperties; + vkGetPhysicalDeviceProperties(device, &deviceProperties); + + VkPhysicalDeviceFeatures deviceFeatures; + vkGetPhysicalDeviceFeatures(device, &deviceFeatures); + + QueueFamilyIndices indices = find_queue_families(device); + + SwapChainSupportDetails swap_chainSupport = query_swap_chain_support(device); + bool swap_chain_adequate = !swap_chainSupport.formats.empty() && !swap_chainSupport.present_modes.empty(); + + return deviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU && + deviceFeatures.geometryShader && + indices.is_complete() && + swap_chain_adequate; + } + + graphics::QueueFamilyIndices graphics::find_queue_families(VkPhysicalDevice device) { + graphics::QueueFamilyIndices indices; + + uint32_t queue_familty_count = 0; + vkGetPhysicalDeviceQueueFamilyProperties(device, &queue_familty_count, nullptr); + + std::vector queueFamilies(queue_familty_count); + vkGetPhysicalDeviceQueueFamilyProperties(device, &queue_familty_count, queueFamilies.data()); + + int i = 0; + for (const auto& queueFamily : queueFamilies) { + if (queueFamily.queueFlags & VK_QUEUE_GRAPHICS_BIT) { + indices.graphics_family = i; + } + + VkBool32 presentSupport = false; + vkGetPhysicalDeviceSurfaceSupportKHR(device, i, surface, &presentSupport); + + if (presentSupport) { + indices.present_family = i; + } + + if (indices.is_complete()) { + break; + } + + i++; + } + + return indices; + } + + bool graphics::check_device_extension_support(VkPhysicalDevice device) { + uint32_t extensionCount; + vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, nullptr); + + std::vector availableExtensions(extensionCount); + vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, availableExtensions.data()); + + std::set requiredExtensions(device_extensions.begin(), device_extensions.end()); + + for (const auto& extension : availableExtensions) { + requiredExtensions.erase(extension.extensionName); + } + + return requiredExtensions.empty(); + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_presentation.cpp b/graphics/src/vulkan_presentation.cpp new file mode 100644 index 0000000..5e9a6db --- /dev/null +++ b/graphics/src/vulkan_presentation.cpp @@ -0,0 +1,12 @@ +#include "detail/graphics.h" + +namespace deerith { + void graphics::create_vulkan_surface() { + deerith_graphics_trace("Initializing Vulkan pressentation/surface"); + + if (glfwCreateWindowSurface(instance, window, nullptr, &surface) != VK_SUCCESS) { + deerith_graphics_error("failed to create window surface!"); + return; + } + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_render_command.cpp b/graphics/src/vulkan_render_command.cpp new file mode 100644 index 0000000..d0e1223 --- /dev/null +++ b/graphics/src/vulkan_render_command.cpp @@ -0,0 +1,59 @@ +#include "detail/graphics.h" + +namespace deerith { + void graphics::create_vulkan_command_buffer() { + QueueFamilyIndices queueFamilyIndices = find_queue_families(physical_device); + + VkCommandPoolCreateInfo poolInfo{}; + poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; + poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; + poolInfo.queueFamilyIndex = queueFamilyIndices.graphics_family.value(); + + if (vkCreateCommandPool(device, &poolInfo, nullptr, &command_pool) != VK_SUCCESS) { + deerith_graphics_error("failed to create command pool!"); + } + + VkCommandBufferAllocateInfo allocInfo{}; + allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; + allocInfo.commandPool = command_pool; + allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + allocInfo.commandBufferCount = 1; + + if (vkAllocateCommandBuffers(device, &allocInfo, &command_buffer) != VK_SUCCESS) { + deerith_graphics_error("failed to allocate command buffers!"); + } + } + + void graphics::record_command_buffer(VkCommandBuffer commandBuffer, uint32_t imageIndex) { + VkCommandBufferBeginInfo beginInfo{}; + beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; + beginInfo.flags = 0; // Optional + beginInfo.pInheritanceInfo = nullptr; // Optional + + if (vkBeginCommandBuffer(commandBuffer, &beginInfo) != VK_SUCCESS) { + deerith_graphics_error("failed to begin recording command buffer!"); + } + + VkRenderPassBeginInfo renderPassInfo{}; + renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; + renderPassInfo.renderPass = render_pass; + renderPassInfo.framebuffer = swap_chain_frame_buffers[imageIndex]; + renderPassInfo.renderArea.offset = {0, 0}; + renderPassInfo.renderArea.extent = swap_chain_extent; + + VkClearValue clearColor = {{{0.0f, 0.0f, 0.0f, 1.0f}}}; + renderPassInfo.clearValueCount = 1; + renderPassInfo.pClearValues = &clearColor; + + vkCmdBeginRenderPass(commandBuffer, &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE); + vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline); + + vkCmdDraw(commandBuffer, 3, 1, 0, 0); + + vkCmdEndRenderPass(commandBuffer); + + if (vkEndCommandBuffer(commandBuffer) != VK_SUCCESS) { + deerith_graphics_error("failed to record command buffer!"); + } + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_render_pass.cpp b/graphics/src/vulkan_render_pass.cpp new file mode 100644 index 0000000..b96466d --- /dev/null +++ b/graphics/src/vulkan_render_pass.cpp @@ -0,0 +1,39 @@ +#include "detail/graphics.h" + +namespace deerith { + void graphics::create_vulkan_render_pass() { + VkAttachmentDescription colorAttachment{}; + colorAttachment.format = swap_chain_image_format; + colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT; + + colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; + colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; + + colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; + colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; + + colorAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + colorAttachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + + VkAttachmentReference colorAttachmentRef{}; + colorAttachmentRef.attachment = 0; + colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + + VkSubpassDescription subpass{}; + subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; + + subpass.colorAttachmentCount = 1; + subpass.pColorAttachments = &colorAttachmentRef; + + VkRenderPassCreateInfo renderPassInfo{}; + renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; + renderPassInfo.attachmentCount = 1; + renderPassInfo.pAttachments = &colorAttachment; + renderPassInfo.subpassCount = 1; + renderPassInfo.pSubpasses = &subpass; + + if (vkCreateRenderPass(device, &renderPassInfo, nullptr, &render_pass) != VK_SUCCESS) { + deerith_graphics_error("failed to create render pass!"); + } + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_rendering.cpp b/graphics/src/vulkan_rendering.cpp new file mode 100644 index 0000000..3fc0325 --- /dev/null +++ b/graphics/src/vulkan_rendering.cpp @@ -0,0 +1,85 @@ +#include "detail/graphics.h" + +namespace deerith { + namespace graphics { + void drawFrame(); + } // namespace graphics + + void graphics::vulkan_test_loop() { + while (!glfwWindowShouldClose(window)) { + glfwPollEvents(); + drawFrame(); + } + } + + void graphics::create_vulkan_sync_objects() { + VkSemaphoreCreateInfo semaphoreInfo{}; + semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + + VkFenceCreateInfo fenceInfo{}; + fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; + fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT; + + if (vkCreateSemaphore(device, &semaphoreInfo, nullptr, &image_available_semaphore) != VK_SUCCESS || + vkCreateSemaphore(device, &semaphoreInfo, nullptr, &render_finished_semaphore) != VK_SUCCESS || + vkCreateFence(device, &fenceInfo, nullptr, &in_flight_fence) != VK_SUCCESS) { + deerith_graphics_error("failed to create semaphores!"); + } + } + + void graphics::drawFrame() { + vkWaitForFences(device, 1, &in_flight_fence, VK_TRUE, UINT64_MAX); + vkResetFences(device, 1, &in_flight_fence); + + uint32_t imageIndex; + vkAcquireNextImageKHR(device, swap_chain, UINT64_MAX, image_available_semaphore, VK_NULL_HANDLE, &imageIndex); + + vkResetCommandBuffer(command_buffer, 0); + + record_command_buffer(command_buffer, imageIndex); + + VkSubmitInfo submitInfo{}; + submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; + + VkSemaphore waitSemaphores[] = {image_available_semaphore}; + VkPipelineStageFlags waitStages[] = {VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT}; + submitInfo.waitSemaphoreCount = 1; + submitInfo.pWaitSemaphores = waitSemaphores; + submitInfo.pWaitDstStageMask = waitStages; + + submitInfo.commandBufferCount = 1; + submitInfo.pCommandBuffers = &command_buffer; + + VkSemaphore signalSemaphores[] = {render_finished_semaphore}; + submitInfo.signalSemaphoreCount = 1; + submitInfo.pSignalSemaphores = signalSemaphores; + + if (vkQueueSubmit(graphics_queue, 1, &submitInfo, in_flight_fence) != VK_SUCCESS) { + deerith_graphics_error("failed to submit draw command buffer!"); + } + + VkSubpassDependency dependency{}; + dependency.srcSubpass = VK_SUBPASS_EXTERNAL; + dependency.dstSubpass = 0; + + dependency.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; + dependency.srcAccessMask = 0; + + dependency.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; + dependency.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; + + VkPresentInfoKHR presentInfo{}; + presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; + + presentInfo.waitSemaphoreCount = 1; + presentInfo.pWaitSemaphores = signalSemaphores; + + VkSwapchainKHR swapChains[] = {swap_chain}; + presentInfo.swapchainCount = 1; + presentInfo.pSwapchains = swapChains; + presentInfo.pImageIndices = &imageIndex; + presentInfo.pResults = nullptr; // Optional + + vkQueuePresentKHR(pressent_queue, &presentInfo); + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_swap_chain.cpp b/graphics/src/vulkan_swap_chain.cpp new file mode 100644 index 0000000..fd72e34 --- /dev/null +++ b/graphics/src/vulkan_swap_chain.cpp @@ -0,0 +1,104 @@ +#include "detail/graphics.h" + +#include +#include +#include + +namespace deerith { + namespace graphics { + VkSurfaceFormatKHR choose_swap_surface_format(const std::vector& formats); + VkPresentModeKHR choose_swap_present_mode(const std::vector& modes); + VkExtent2D choose_swap_extent(const VkSurfaceCapabilitiesKHR& capabilities); + } // namespace graphics + + void graphics::create_vulkan_swap_chain() { + SwapChainSupportDetails swap_chain_support = query_swap_chain_support(physical_device); + + VkSurfaceFormatKHR surface_format = choose_swap_surface_format(swap_chain_support.formats); + VkPresentModeKHR presentMode = choose_swap_present_mode(swap_chain_support.present_modes); + VkExtent2D extent = choose_swap_extent(swap_chain_support.capabilities); + + uint32_t image_count = swap_chain_support.capabilities.minImageCount; + if (swap_chain_support.capabilities.maxImageCount > 0 && image_count > swap_chain_support.capabilities.maxImageCount) { + image_count = swap_chain_support.capabilities.maxImageCount; + } + + VkSwapchainCreateInfoKHR create_info{}; + create_info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; + create_info.surface = surface; + create_info.minImageCount = image_count; + create_info.imageFormat = surface_format.format; + create_info.imageColorSpace = surface_format.colorSpace; + create_info.imageExtent = extent; + create_info.imageArrayLayers = 1; + create_info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + + QueueFamilyIndices indices = find_queue_families(physical_device); + uint32_t queueFamilyIndices[] = {indices.graphics_family.value(), indices.present_family.value()}; + + if (indices.graphics_family != indices.present_family) { + create_info.imageSharingMode = VK_SHARING_MODE_CONCURRENT; + create_info.queueFamilyIndexCount = 2; + create_info.pQueueFamilyIndices = queueFamilyIndices; + } else { + create_info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; + create_info.queueFamilyIndexCount = 0; + create_info.pQueueFamilyIndices = nullptr; + } + + create_info.preTransform = swap_chain_support.capabilities.currentTransform; + create_info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; + create_info.presentMode = presentMode; + create_info.clipped = VK_TRUE; + create_info.oldSwapchain = VK_NULL_HANDLE; + + if (vkCreateSwapchainKHR(device, &create_info, nullptr, &swap_chain) != VK_SUCCESS) { + deerith_graphics_error("failed to create swap chain!"); + } + + vkGetSwapchainImagesKHR(device, swap_chain, &image_count, nullptr); + swap_chain_images.resize(image_count); + vkGetSwapchainImagesKHR(device, swap_chain, &image_count, swap_chain_images.data()); + + swap_chain_image_format = surface_format.format; + swap_chain_extent = extent; + } + + VkSurfaceFormatKHR graphics::choose_swap_surface_format(const std::vector& formats) { + for (const auto& available_format : formats) { + if (available_format.format == VK_FORMAT_B8G8R8A8_SRGB && available_format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) { + return available_format; + } + } + + return formats[0]; + } + + VkPresentModeKHR graphics::choose_swap_present_mode(const std::vector& modes) { + for (const auto& available_present_mode : modes) { + if (available_present_mode == VK_PRESENT_MODE_MAILBOX_KHR) { + return available_present_mode; + } + } + + return VK_PRESENT_MODE_FIFO_KHR; + } + + VkExtent2D graphics::choose_swap_extent(const VkSurfaceCapabilitiesKHR& capabilities) { + if (capabilities.currentExtent.width != std::numeric_limits::max()) { + return capabilities.currentExtent; + } else { + int width, height; + glfwGetFramebufferSize(window, &width, &height); + + VkExtent2D actualExtent = { + static_cast(width), + static_cast(height)}; + + actualExtent.width = std::clamp(actualExtent.width, capabilities.minImageExtent.width, capabilities.maxImageExtent.width); + actualExtent.height = std::clamp(actualExtent.height, capabilities.minImageExtent.height, capabilities.maxImageExtent.height); + + return actualExtent; + } + } +} // namespace deerith \ No newline at end of file diff --git a/graphics/src/vulkan_validation.cpp b/graphics/src/vulkan_validation.cpp new file mode 100644 index 0000000..788db96 --- /dev/null +++ b/graphics/src/vulkan_validation.cpp @@ -0,0 +1,59 @@ +#include "detail/graphics.h" + +namespace deerith { + namespace graphics { + bool check_validation_layer_support(); + } // namespace graphics + + void graphics::create_vulkan_validation_layer() { + if (!ACTIVE_VALIDATION_LAYER) + return; + + deerith_graphics_trace("Initializing Vulkan validation layer"); + + if (!check_validation_layer_support()) { + deerith_graphics_error("Vulkan validation layer is not aviable"); + return; + } + } + + bool graphics::check_validation_layer_support() { + uint32_t layer_count; + vkEnumerateInstanceLayerProperties(&layer_count, nullptr); + + std::vector available_layers(layer_count); + vkEnumerateInstanceLayerProperties(&layer_count, available_layers.data()); + + for (const char* layerName : validation_layers) { + bool layerFound = false; + + for (const auto& layerProperties : available_layers) { + if (strcmp(layerName, layerProperties.layerName) == 0) { + layerFound = true; + break; + } + } + + if (!layerFound) { + return false; + } + } + + return true; + } + + std::vector get_required_extensions() { + uint32_t glfw_extension_count = 0; + const char** glfw_extensions; + glfw_extensions = glfwGetRequiredInstanceExtensions(&glfw_extension_count); + + std::vector extensions(glfw_extensions, glfw_extensions + glfw_extension_count); + + if (ACTIVE_VALIDATION_LAYER) { + extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); + } + + return extensions; + } + +} // namespace deerith \ No newline at end of file diff --git a/studio/CMakeLists.txt b/studio/CMakeLists.txt new file mode 100644 index 0000000..37b75e7 --- /dev/null +++ b/studio/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.16) +project(deerith_studio LANGUAGES CXX) + +file(GLOB_RECURSE STUDIO_SOURCES CONFIGURE_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp +) + +add_executable(deerith_studio ${STUDIO_SOURCES}) + +target_link_libraries(deerith_studio + PUBLIC + deerith::core + deerith::graphics +) diff --git a/studio/shaders/frag.spv b/studio/shaders/frag.spv new file mode 100644 index 0000000..da37f7e Binary files /dev/null and b/studio/shaders/frag.spv differ diff --git a/studio/shaders/shader.frag b/studio/shaders/shader.frag new file mode 100644 index 0000000..13009da --- /dev/null +++ b/studio/shaders/shader.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) in vec3 fragColor; + +layout(location = 0) out vec4 outColor; + +void main() { + outColor = vec4(fragColor, 1.0); +} \ No newline at end of file diff --git a/studio/shaders/shader.vert b/studio/shaders/shader.vert new file mode 100644 index 0000000..66d6766 --- /dev/null +++ b/studio/shaders/shader.vert @@ -0,0 +1,20 @@ +#version 450 + +layout(location = 0) out vec3 fragColor; + +vec2 positions[3] = vec2[]( + vec2(0.0, -0.5), + vec2(0.5, 0.5), + vec2(-0.5, 0.5) +); + +vec3 colors[3] = vec3[]( + vec3(1.0, 0.0, 0.0), + vec3(0.0, 1.0, 0.0), + vec3(0.0, 0.0, 1.0) +); + +void main() { + gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0); + fragColor = colors[gl_VertexIndex]; +} \ No newline at end of file diff --git a/studio/shaders/vert.spv b/studio/shaders/vert.spv new file mode 100644 index 0000000..a41dd2c Binary files /dev/null and b/studio/shaders/vert.spv differ diff --git a/studio/src/main.cpp b/studio/src/main.cpp new file mode 100644 index 0000000..a213948 --- /dev/null +++ b/studio/src/main.cpp @@ -0,0 +1,17 @@ +#include +#include + +#include + +int main() { + deerith::engine::init(); + + deerith::graphics::GraphicsConfig graphics_config{}; + graphics_config.window_title = "Deerith Studio"; + + deerith::graphics::init(graphics_config); + + deerith::graphics::shutdown(); + deerith::engine::shutdown(); + return 0; +} \ No newline at end of file