Implemented Vulkan
This commit is contained in:
parent
ba0f786ac7
commit
fc3898283f
20
.clang-format
Normal file
20
.clang-format
Normal file
@ -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
|
||||||
8
CMakeLists.txt
Normal file
8
CMakeLists.txt
Normal file
@ -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)
|
||||||
1
build/.cmake/api/v1/query/client-vscode/query.json
Normal file
1
build/.cmake/api/v1/query/client-vscode/query.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]}
|
||||||
1371
build/.cmake/api/v1/reply/cache-v2-75733dde282360676e09.json
Normal file
1371
build/.cmake/api/v1/reply/cache-v2-75733dde282360676e09.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
140
build/.cmake/api/v1/reply/codemodel-v2-b04972fb2a419ed848a5.json
Normal file
140
build/.cmake/api/v1/reply/codemodel-v2-b04972fb2a419ed848a5.json
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"backtraceGraph" :
|
||||||
|
{
|
||||||
|
"commands" : [],
|
||||||
|
"files" : [],
|
||||||
|
"nodes" : []
|
||||||
|
},
|
||||||
|
"installers" : [],
|
||||||
|
"paths" :
|
||||||
|
{
|
||||||
|
"build" : ".",
|
||||||
|
"source" : "."
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"backtraceGraph" :
|
||||||
|
{
|
||||||
|
"commands" : [],
|
||||||
|
"files" : [],
|
||||||
|
"nodes" : []
|
||||||
|
},
|
||||||
|
"installers" : [],
|
||||||
|
"paths" :
|
||||||
|
{
|
||||||
|
"build" : "core",
|
||||||
|
"source" : "core"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"backtraceGraph" :
|
||||||
|
{
|
||||||
|
"commands" : [],
|
||||||
|
"files" : [],
|
||||||
|
"nodes" : []
|
||||||
|
},
|
||||||
|
"installers" : [],
|
||||||
|
"paths" :
|
||||||
|
{
|
||||||
|
"build" : "graphics",
|
||||||
|
"source" : "graphics"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"backtraceGraph" :
|
||||||
|
{
|
||||||
|
"commands" : [],
|
||||||
|
"files" : [],
|
||||||
|
"nodes" : []
|
||||||
|
},
|
||||||
|
"installers" : [],
|
||||||
|
"paths" :
|
||||||
|
{
|
||||||
|
"build" : "studio",
|
||||||
|
"source" : "studio"
|
||||||
|
}
|
||||||
|
}
|
||||||
132
build/.cmake/api/v1/reply/index-2026-03-23T00-10-10-0479.json
Normal file
132
build/.cmake/api/v1/reply/index-2026-03-23T00-10-10-0479.json
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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"
|
||||||
|
}
|
||||||
@ -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"
|
||||||
|
}
|
||||||
@ -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"
|
||||||
|
}
|
||||||
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
build/core/libdeerith_core.a
Normal file
BIN
build/core/libdeerith_core.a
Normal file
Binary file not shown.
BIN
build/graphics/libdeerith_graphics.a
Normal file
BIN
build/graphics/libdeerith_graphics.a
Normal file
Binary file not shown.
BIN
build/studio/deerith_studio
Executable file
BIN
build/studio/deerith_studio
Executable file
Binary file not shown.
BIN
build/studio/shaders/frag.spv
Normal file
BIN
build/studio/shaders/frag.spv
Normal file
Binary file not shown.
9
build/studio/shaders/shader.frag
Normal file
9
build/studio/shaders/shader.frag
Normal file
@ -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);
|
||||||
|
}
|
||||||
20
build/studio/shaders/shader.vert
Normal file
20
build/studio/shaders/shader.vert
Normal file
@ -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];
|
||||||
|
}
|
||||||
BIN
build/studio/shaders/vert.spv
Normal file
BIN
build/studio/shaders/vert.spv
Normal file
Binary file not shown.
22
core/CMakeLists.txt
Normal file
22
core/CMakeLists.txt
Normal file
@ -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)
|
||||||
8
core/include/deerith/core/engine.h
Normal file
8
core/include/deerith/core/engine.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace deerith {
|
||||||
|
namespace engine {
|
||||||
|
void init();
|
||||||
|
void shutdown();
|
||||||
|
} // namespace engine
|
||||||
|
} // namespace deerith
|
||||||
36
core/include/deerith/core/log.h
Normal file
36
core/include/deerith/core/log.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
|
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(); \
|
||||||
|
}
|
||||||
12
core/include/deerith/core/memory.h
Normal file
12
core/include/deerith/core/memory.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace deerith {
|
||||||
|
template <typename T>
|
||||||
|
using Scope = std::unique_ptr<T>;
|
||||||
|
|
||||||
|
template <typename T, typename... Args>
|
||||||
|
constexpr auto make_scope(Args&&... args) {
|
||||||
|
return std::make_unique<T>(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
} // namespace deerith
|
||||||
2
core/include/deerith/core/types.h
Normal file
2
core/include/deerith/core/types.h
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
8
core/src/detail/log.h
Normal file
8
core/src/detail/log.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace deerith {
|
||||||
|
namespace log {
|
||||||
|
void init();
|
||||||
|
void shutdown();
|
||||||
|
} // namespace log
|
||||||
|
} // namespace deerith
|
||||||
16
core/src/engine.cpp
Normal file
16
core/src/engine.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include <deerith/core/engine.h>
|
||||||
|
#include <deerith/core/log.h>
|
||||||
|
|
||||||
|
#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
|
||||||
35
core/src/log.cpp
Normal file
35
core/src/log.cpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#include <deerith/core/log.h>
|
||||||
|
|
||||||
|
#include "detail/log.h"
|
||||||
|
|
||||||
|
namespace deerith {
|
||||||
|
namespace log {
|
||||||
|
std::shared_ptr<spdlog::logger> core_logger;
|
||||||
|
std::shared_ptr<spdlog::logger> 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
|
||||||
31
graphics/CMakeLists.txt
Normal file
31
graphics/CMakeLists.txt
Normal file
@ -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)
|
||||||
14
graphics/include/deerith/graphics/graphics.h
Normal file
14
graphics/include/deerith/graphics/graphics.h
Normal file
@ -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
|
||||||
89
graphics/src/detail/graphics.h
Normal file
89
graphics/src/detail/graphics.h
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <deerith/core/log.h>
|
||||||
|
#include <deerith/graphics/graphics.h>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#define GLFW_INCLUDE_VULKAN
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
|
#define ACTIVE_VALIDATION_LAYER true
|
||||||
|
|
||||||
|
class GLFWwindow;
|
||||||
|
|
||||||
|
namespace deerith {
|
||||||
|
namespace graphics {
|
||||||
|
struct QueueFamilyIndices {
|
||||||
|
std::optional<uint32_t> graphics_family;
|
||||||
|
std::optional<uint32_t> present_family;
|
||||||
|
|
||||||
|
inline bool is_complete() const {
|
||||||
|
return graphics_family.has_value() && present_family.has_value();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SwapChainSupportDetails {
|
||||||
|
VkSurfaceCapabilitiesKHR capabilities;
|
||||||
|
std::vector<VkSurfaceFormatKHR> formats;
|
||||||
|
std::vector<VkPresentModeKHR> present_modes;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern GraphicsConfig graphics_config;
|
||||||
|
extern GLFWwindow* window;
|
||||||
|
|
||||||
|
// Vulkan Specific
|
||||||
|
extern VkInstance instance;
|
||||||
|
extern const std::vector<const char*> validation_layers;
|
||||||
|
extern const std::vector<const char*> 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<VkImage> swap_chain_images;
|
||||||
|
extern VkFormat swap_chain_image_format;
|
||||||
|
extern VkExtent2D swap_chain_extent;
|
||||||
|
extern std::vector<VkImageView> swap_chain_image_views;
|
||||||
|
extern VkPipelineLayout pipeline_layout;
|
||||||
|
extern VkRenderPass render_pass;
|
||||||
|
extern VkPipeline graphics_pipeline;
|
||||||
|
extern std::vector<VkFramebuffer> 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
|
||||||
27
graphics/src/glfw.cpp
Normal file
27
graphics/src/glfw.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <deerith/core/log.h>
|
||||||
|
|
||||||
|
#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
|
||||||
22
graphics/src/graphics.cpp
Normal file
22
graphics/src/graphics.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include <deerith/core/log.h>
|
||||||
|
#include <deerith/graphics/graphics.h>
|
||||||
|
|
||||||
|
#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
|
||||||
34
graphics/src/variables.cpp
Normal file
34
graphics/src/variables.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "detail/graphics.h"
|
||||||
|
|
||||||
|
#define GLFW_INCLUDE_VULKAN
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
namespace deerith {
|
||||||
|
graphics::GraphicsConfig graphics::graphics_config;
|
||||||
|
GLFWwindow* graphics::window;
|
||||||
|
|
||||||
|
VkInstance graphics::instance;
|
||||||
|
const std::vector<const char*> graphics::validation_layers = {"VK_LAYER_KHRONOS_validation"};
|
||||||
|
const std::vector<const char*> 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<VkImage> graphics::swap_chain_images;
|
||||||
|
VkFormat graphics::swap_chain_image_format;
|
||||||
|
VkExtent2D graphics::swap_chain_extent;
|
||||||
|
std::vector<VkImageView> graphics::swap_chain_image_views;
|
||||||
|
VkPipelineLayout graphics::pipeline_layout;
|
||||||
|
VkRenderPass graphics::render_pass;
|
||||||
|
VkPipeline graphics::graphics_pipeline;
|
||||||
|
std::vector<VkFramebuffer> 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
|
||||||
44
graphics/src/vulkan.cpp
Normal file
44
graphics/src/vulkan.cpp
Normal file
@ -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
|
||||||
24
graphics/src/vulkan_frame_buffer.cpp
Normal file
24
graphics/src/vulkan_frame_buffer.cpp
Normal file
@ -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
|
||||||
163
graphics/src/vulkan_graphics_pipeline.cpp
Normal file
163
graphics/src/vulkan_graphics_pipeline.cpp
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
#include "detail/graphics.h"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
namespace deerith {
|
||||||
|
namespace graphics {
|
||||||
|
std::vector<char> read_file(const std::string& filename);
|
||||||
|
VkShaderModule create_shader_module(const std::vector<char>& 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<char>& code) {
|
||||||
|
VkShaderModuleCreateInfo create_info{};
|
||||||
|
create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||||
|
create_info.codeSize = code.size();
|
||||||
|
create_info.pCode = reinterpret_cast<const uint32_t*>(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<char> 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<char> buffer(fileSize);
|
||||||
|
|
||||||
|
file.seekg(0);
|
||||||
|
file.read(buffer.data(), fileSize);
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
} // namespace deerith
|
||||||
30
graphics/src/vulkan_image_view.cpp
Normal file
30
graphics/src/vulkan_image_view.cpp
Normal file
@ -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
|
||||||
58
graphics/src/vulkan_instance.cpp
Normal file
58
graphics/src/vulkan_instance.cpp
Normal file
@ -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<uint32_t>(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
|
||||||
48
graphics/src/vulkan_logical_device.cpp
Normal file
48
graphics/src/vulkan_logical_device.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include "detail/graphics.h"
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
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<VkDeviceQueueCreateInfo> queue_create_infos;
|
||||||
|
std::set<uint32_t> 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<uint32_t>(queue_create_infos.size());
|
||||||
|
create_info.pQueueCreateInfos = queue_create_infos.data();
|
||||||
|
create_info.pEnabledFeatures = &device_features;
|
||||||
|
create_info.enabledExtensionCount = static_cast<uint32_t>(device_extensions.size());
|
||||||
|
create_info.ppEnabledExtensionNames = device_extensions.data();
|
||||||
|
|
||||||
|
if (ACTIVE_VALIDATION_LAYER) {
|
||||||
|
create_info.enabledLayerCount = static_cast<uint32_t>(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
|
||||||
104
graphics/src/vulkan_phisical_device.cpp
Normal file
104
graphics/src/vulkan_phisical_device.cpp
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#include "detail/graphics.h"
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
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<VkPhysicalDevice> 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<VkQueueFamilyProperties> 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<VkExtensionProperties> availableExtensions(extensionCount);
|
||||||
|
vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, availableExtensions.data());
|
||||||
|
|
||||||
|
std::set<std::string> requiredExtensions(device_extensions.begin(), device_extensions.end());
|
||||||
|
|
||||||
|
for (const auto& extension : availableExtensions) {
|
||||||
|
requiredExtensions.erase(extension.extensionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return requiredExtensions.empty();
|
||||||
|
}
|
||||||
|
} // namespace deerith
|
||||||
12
graphics/src/vulkan_presentation.cpp
Normal file
12
graphics/src/vulkan_presentation.cpp
Normal file
@ -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
|
||||||
59
graphics/src/vulkan_render_command.cpp
Normal file
59
graphics/src/vulkan_render_command.cpp
Normal file
@ -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
|
||||||
39
graphics/src/vulkan_render_pass.cpp
Normal file
39
graphics/src/vulkan_render_pass.cpp
Normal file
@ -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
|
||||||
85
graphics/src/vulkan_rendering.cpp
Normal file
85
graphics/src/vulkan_rendering.cpp
Normal file
@ -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
|
||||||
104
graphics/src/vulkan_swap_chain.cpp
Normal file
104
graphics/src/vulkan_swap_chain.cpp
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#include "detail/graphics.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
|
namespace deerith {
|
||||||
|
namespace graphics {
|
||||||
|
VkSurfaceFormatKHR choose_swap_surface_format(const std::vector<VkSurfaceFormatKHR>& formats);
|
||||||
|
VkPresentModeKHR choose_swap_present_mode(const std::vector<VkPresentModeKHR>& 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<VkSurfaceFormatKHR>& 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<VkPresentModeKHR>& 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<uint32_t>::max()) {
|
||||||
|
return capabilities.currentExtent;
|
||||||
|
} else {
|
||||||
|
int width, height;
|
||||||
|
glfwGetFramebufferSize(window, &width, &height);
|
||||||
|
|
||||||
|
VkExtent2D actualExtent = {
|
||||||
|
static_cast<uint32_t>(width),
|
||||||
|
static_cast<uint32_t>(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
|
||||||
59
graphics/src/vulkan_validation.cpp
Normal file
59
graphics/src/vulkan_validation.cpp
Normal file
@ -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<VkLayerProperties> 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<const char*> get_required_extensions() {
|
||||||
|
uint32_t glfw_extension_count = 0;
|
||||||
|
const char** glfw_extensions;
|
||||||
|
glfw_extensions = glfwGetRequiredInstanceExtensions(&glfw_extension_count);
|
||||||
|
|
||||||
|
std::vector<const char*> 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
|
||||||
14
studio/CMakeLists.txt
Normal file
14
studio/CMakeLists.txt
Normal file
@ -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
|
||||||
|
)
|
||||||
BIN
studio/shaders/frag.spv
Normal file
BIN
studio/shaders/frag.spv
Normal file
Binary file not shown.
9
studio/shaders/shader.frag
Normal file
9
studio/shaders/shader.frag
Normal file
@ -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);
|
||||||
|
}
|
||||||
20
studio/shaders/shader.vert
Normal file
20
studio/shaders/shader.vert
Normal file
@ -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];
|
||||||
|
}
|
||||||
BIN
studio/shaders/vert.spv
Normal file
BIN
studio/shaders/vert.spv
Normal file
Binary file not shown.
17
studio/src/main.cpp
Normal file
17
studio/src/main.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <deerith/core/engine.h>
|
||||||
|
#include <deerith/core/log.h>
|
||||||
|
|
||||||
|
#include <deerith/graphics/graphics.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user