Compare commits

..

No commits in common. "8b1aa6332715e5370b865a709fb6b44689ad40f5" and "fc3898283f40e62215a8095c9b8093ce46acf52e" have entirely different histories.

30 changed files with 2952 additions and 172 deletions

15
.gitignore vendored
View File

@ -1 +1,14 @@
/build # ---> CMake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
CMakeUserPresets.json

View File

@ -0,0 +1 @@
{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]}

File diff suppressed because it is too large Load Diff

View File

@ -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
}
}

View 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
}
}

View File

@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : ".",
"source" : "."
}
}

View File

@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "core",
"source" : "core"
}
}

View File

@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "graphics",
"source" : "graphics"
}
}

View File

@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "studio",
"source" : "studio"
}
}

View 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
}
}
]
}
}
}
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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
}
}

Binary file not shown.

Binary file not shown.

BIN
build/studio/deerith_studio Executable file

Binary file not shown.

Binary file not shown.

View 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);
}

View 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];
}

Binary file not shown.

View File

@ -83,7 +83,7 @@ namespace deerith {
QueueFamilyIndices find_queue_families(VkPhysicalDevice device); QueueFamilyIndices find_queue_families(VkPhysicalDevice device);
SwapChainSupportDetails query_swap_chain_support(VkPhysicalDevice device); SwapChainSupportDetails query_swap_chain_support(VkPhysicalDevice device);
void record_command_buffer(VkCommandBuffer command_buffer, uint32_t image_index); void record_command_buffer(VkCommandBuffer commandBuffer, uint32_t imageIndex);
} // namespace graphics } // namespace graphics
} // namespace deerith } // namespace deerith

View File

@ -7,16 +7,16 @@ namespace deerith {
for (size_t i = 0; i < swap_chain_image_views.size(); i++) { for (size_t i = 0; i < swap_chain_image_views.size(); i++) {
VkImageView attachments[] = {swap_chain_image_views[i]}; VkImageView attachments[] = {swap_chain_image_views[i]};
VkFramebufferCreateInfo frame_buffer_info{}; VkFramebufferCreateInfo framebufferInfo{};
frame_buffer_info.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
frame_buffer_info.renderPass = render_pass; framebufferInfo.renderPass = render_pass;
frame_buffer_info.attachmentCount = 1; framebufferInfo.attachmentCount = 1;
frame_buffer_info.pAttachments = attachments; framebufferInfo.pAttachments = attachments;
frame_buffer_info.width = swap_chain_extent.width; framebufferInfo.width = swap_chain_extent.width;
frame_buffer_info.height = swap_chain_extent.height; framebufferInfo.height = swap_chain_extent.height;
frame_buffer_info.layers = 1; framebufferInfo.layers = 1;
if (vkCreateFramebuffer(device, &frame_buffer_info, nullptr, &swap_chain_frame_buffers[i]) != VK_SUCCESS) { if (vkCreateFramebuffer(device, &framebufferInfo, nullptr, &swap_chain_frame_buffers[i]) != VK_SUCCESS) {
deerith_graphics_error("failed to create framebuffer!"); deerith_graphics_error("failed to create framebuffer!");
} }
} }

View File

@ -9,37 +9,37 @@ namespace deerith {
} // namespace graphics } // namespace graphics
void graphics::create_vulkan_graphics_pipeline() { void graphics::create_vulkan_graphics_pipeline() {
auto vert_shader_code = read_file("shaders/vert.spv"); auto vertShaderCode = read_file("shaders/vert.spv");
auto frag_shader_code = read_file("shaders/frag.spv"); auto fragShaderCode = read_file("shaders/frag.spv");
VkShaderModule vert_shader_module = create_shader_module(vert_shader_code); VkShaderModule vertShaderModule = create_shader_module(vertShaderCode);
VkShaderModule frag_shader_module = create_shader_module(frag_shader_code); VkShaderModule fragShaderModule = create_shader_module(fragShaderCode);
VkPipelineShaderStageCreateInfo vert_shader_stage_info{}; VkPipelineShaderStageCreateInfo vertShaderStageInfo{};
vert_shader_stage_info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; vertShaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
vert_shader_stage_info.stage = VK_SHADER_STAGE_VERTEX_BIT; vertShaderStageInfo.stage = VK_SHADER_STAGE_VERTEX_BIT;
vert_shader_stage_info.module = vert_shader_module; vertShaderStageInfo.module = vertShaderModule;
vert_shader_stage_info.pName = "main"; vertShaderStageInfo.pName = "main";
VkPipelineShaderStageCreateInfo frag_shader_stage_info{}; VkPipelineShaderStageCreateInfo fragShaderStageInfo{};
frag_shader_stage_info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; fragShaderStageInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
frag_shader_stage_info.stage = VK_SHADER_STAGE_FRAGMENT_BIT; fragShaderStageInfo.stage = VK_SHADER_STAGE_FRAGMENT_BIT;
frag_shader_stage_info.module = frag_shader_module; fragShaderStageInfo.module = fragShaderModule;
frag_shader_stage_info.pName = "main"; fragShaderStageInfo.pName = "main";
VkPipelineShaderStageCreateInfo shader_stages[] = {vert_shader_stage_info, frag_shader_stage_info}; VkPipelineShaderStageCreateInfo shaderStages[] = {vertShaderStageInfo, fragShaderStageInfo};
VkPipelineVertexInputStateCreateInfo vertex_input_info{}; VkPipelineVertexInputStateCreateInfo vertexInputInfo{};
vertex_input_info.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
vertex_input_info.vertexBindingDescriptionCount = 0; vertexInputInfo.vertexBindingDescriptionCount = 0;
vertex_input_info.pVertexBindingDescriptions = nullptr; // Optional vertexInputInfo.pVertexBindingDescriptions = nullptr; // Optional
vertex_input_info.vertexAttributeDescriptionCount = 0; vertexInputInfo.vertexAttributeDescriptionCount = 0;
vertex_input_info.pVertexAttributeDescriptions = nullptr; // Optional vertexInputInfo.pVertexAttributeDescriptions = nullptr; // Optional
VkPipelineInputAssemblyStateCreateInfo input_assembly{}; VkPipelineInputAssemblyStateCreateInfo inputAssembly{};
input_assembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; inputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
input_assembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
input_assembly.primitiveRestartEnable = VK_FALSE; inputAssembly.primitiveRestartEnable = VK_FALSE;
VkViewport viewport{}; VkViewport viewport{};
viewport.x = 0.0f; viewport.x = 0.0f;
@ -53,12 +53,12 @@ namespace deerith {
scissor.offset = {0, 0}; scissor.offset = {0, 0};
scissor.extent = swap_chain_extent; scissor.extent = swap_chain_extent;
VkPipelineViewportStateCreateInfo viewport_state{}; VkPipelineViewportStateCreateInfo viewportState{};
viewport_state.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewport_state.viewportCount = 1; viewportState.viewportCount = 1;
viewport_state.pViewports = &viewport; viewportState.pViewports = &viewport;
viewport_state.scissorCount = 1; viewportState.scissorCount = 1;
viewport_state.pScissors = &scissor; viewportState.pScissors = &scissor;
VkPipelineRasterizationStateCreateInfo rasterizer{}; VkPipelineRasterizationStateCreateInfo rasterizer{};
rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
@ -70,16 +70,16 @@ namespace deerith {
rasterizer.depthBiasClamp = 0.0f; // Optional rasterizer.depthBiasClamp = 0.0f; // Optional
rasterizer.depthBiasSlopeFactor = 0.0f; // Optional rasterizer.depthBiasSlopeFactor = 0.0f; // Optional
VkPipelineColorBlendAttachmentState color_blend_attachment{}; VkPipelineColorBlendAttachmentState colorBlendAttachment{};
color_blend_attachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
color_blend_attachment.blendEnable = VK_FALSE; colorBlendAttachment.blendEnable = VK_FALSE;
VkPipelineLayoutCreateInfo pipeline_layout_info{}; VkPipelineLayoutCreateInfo pipelineLayoutInfo{};
pipeline_layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
pipeline_layout_info.setLayoutCount = 0; // Optional pipelineLayoutInfo.setLayoutCount = 0; // Optional
pipeline_layout_info.pSetLayouts = nullptr; // Optional pipelineLayoutInfo.pSetLayouts = nullptr; // Optional
pipeline_layout_info.pushConstantRangeCount = 0; // Optional pipelineLayoutInfo.pushConstantRangeCount = 0; // Optional
pipeline_layout_info.pPushConstantRanges = nullptr; // Optional pipelineLayoutInfo.pPushConstantRanges = nullptr; // Optional
VkPipelineMultisampleStateCreateInfo multisampling{}; VkPipelineMultisampleStateCreateInfo multisampling{};
multisampling.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; multisampling.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
@ -90,44 +90,44 @@ namespace deerith {
multisampling.alphaToCoverageEnable = VK_FALSE; // Optional multisampling.alphaToCoverageEnable = VK_FALSE; // Optional
multisampling.alphaToOneEnable = VK_FALSE; // Optional multisampling.alphaToOneEnable = VK_FALSE; // Optional
VkPipelineColorBlendStateCreateInfo color_blending{}; VkPipelineColorBlendStateCreateInfo colorBlending{};
color_blending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; colorBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
color_blending.logicOpEnable = VK_FALSE; colorBlending.logicOpEnable = VK_FALSE;
color_blending.logicOp = VK_LOGIC_OP_COPY; // Optional colorBlending.logicOp = VK_LOGIC_OP_COPY; // Optional
color_blending.attachmentCount = 1; colorBlending.attachmentCount = 1;
color_blending.pAttachments = &color_blend_attachment; colorBlending.pAttachments = &colorBlendAttachment;
color_blending.blendConstants[0] = 0.0f; // Optional colorBlending.blendConstants[0] = 0.0f; // Optional
color_blending.blendConstants[1] = 0.0f; // Optional colorBlending.blendConstants[1] = 0.0f; // Optional
color_blending.blendConstants[2] = 0.0f; // Optional colorBlending.blendConstants[2] = 0.0f; // Optional
color_blending.blendConstants[3] = 0.0f; // Optional colorBlending.blendConstants[3] = 0.0f; // Optional
if (vkCreatePipelineLayout(device, &pipeline_layout_info, nullptr, &pipeline_layout) != VK_SUCCESS) { if (vkCreatePipelineLayout(device, &pipelineLayoutInfo, nullptr, &pipeline_layout) != VK_SUCCESS) {
deerith_graphics_error("failed to create pipeline layout!"); deerith_graphics_error("failed to create pipeline layout!");
} }
VkGraphicsPipelineCreateInfo pipline_info{}; VkGraphicsPipelineCreateInfo pipelineInfo{};
pipline_info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
pipline_info.stageCount = 2; pipelineInfo.stageCount = 2;
pipline_info.pStages = shader_stages; pipelineInfo.pStages = shaderStages;
pipline_info.pVertexInputState = &vertex_input_info; pipelineInfo.pVertexInputState = &vertexInputInfo;
pipline_info.pInputAssemblyState = &input_assembly; pipelineInfo.pInputAssemblyState = &inputAssembly;
pipline_info.pViewportState = &viewport_state; pipelineInfo.pViewportState = &viewportState;
pipline_info.pRasterizationState = &rasterizer; pipelineInfo.pRasterizationState = &rasterizer;
pipline_info.pMultisampleState = &multisampling; pipelineInfo.pMultisampleState = &multisampling;
pipline_info.pDepthStencilState = nullptr; // Optional pipelineInfo.pDepthStencilState = nullptr; // Optional
pipline_info.pColorBlendState = &color_blending; pipelineInfo.pColorBlendState = &colorBlending;
pipline_info.pDynamicState = nullptr; pipelineInfo.pDynamicState = nullptr;
pipline_info.layout = pipeline_layout; pipelineInfo.layout = pipeline_layout;
pipline_info.renderPass = render_pass; pipelineInfo.renderPass = render_pass;
pipline_info.subpass = 0; pipelineInfo.subpass = 0;
if (vkCreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &pipline_info, nullptr, &graphics_pipeline) != VK_SUCCESS) { if (vkCreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &graphics_pipeline) != VK_SUCCESS) {
deerith_graphics_error("failed to create graphics pipeline!"); deerith_graphics_error("failed to create graphics pipeline!");
} }
vkDestroyShaderModule(device, frag_shader_module, nullptr); vkDestroyShaderModule(device, fragShaderModule, nullptr);
vkDestroyShaderModule(device, vert_shader_module, nullptr); vkDestroyShaderModule(device, vertShaderModule, nullptr);
} }
VkShaderModule graphics::create_shader_module(const std::vector<char>& code) { VkShaderModule graphics::create_shader_module(const std::vector<char>& code) {
@ -151,11 +151,11 @@ namespace deerith {
deerith_graphics_error("failed to open file!"); deerith_graphics_error("failed to open file!");
} }
size_t file_size = (size_t)file.tellg(); size_t fileSize = (size_t)file.tellg();
std::vector<char> buffer(file_size); std::vector<char> buffer(fileSize);
file.seekg(0); file.seekg(0);
file.read(buffer.data(), file_size); file.read(buffer.data(), fileSize);
file.close(); file.close();
return buffer; return buffer;

View File

@ -37,21 +37,19 @@ namespace deerith {
} }
bool graphics::is_device_suitable(VkPhysicalDevice device) { bool graphics::is_device_suitable(VkPhysicalDevice device) {
VkPhysicalDeviceProperties device_properties; VkPhysicalDeviceProperties deviceProperties;
vkGetPhysicalDeviceProperties(device, &device_properties); vkGetPhysicalDeviceProperties(device, &deviceProperties);
VkPhysicalDeviceFeatures device_features; VkPhysicalDeviceFeatures deviceFeatures;
vkGetPhysicalDeviceFeatures(device, &device_features); vkGetPhysicalDeviceFeatures(device, &deviceFeatures);
QueueFamilyIndices indices = find_queue_families(device); QueueFamilyIndices indices = find_queue_families(device);
SwapChainSupportDetails swap_chainSupport = query_swap_chain_support(device); SwapChainSupportDetails swap_chainSupport = query_swap_chain_support(device);
bool swap_chain_adequate = !swap_chainSupport.formats.empty() && !swap_chainSupport.present_modes.empty(); bool swap_chain_adequate = !swap_chainSupport.formats.empty() && !swap_chainSupport.present_modes.empty();
bool is_gpu = device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU || return deviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU &&
device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; deviceFeatures.geometryShader &&
return is_gpu && device_features.geometryShader &&
indices.is_complete() && indices.is_complete() &&
swap_chain_adequate; swap_chain_adequate;
} }
@ -71,10 +69,10 @@ namespace deerith {
indices.graphics_family = i; indices.graphics_family = i;
} }
VkBool32 present_support = false; VkBool32 presentSupport = false;
vkGetPhysicalDeviceSurfaceSupportKHR(device, i, surface, &present_support); vkGetPhysicalDeviceSurfaceSupportKHR(device, i, surface, &presentSupport);
if (present_support) { if (presentSupport) {
indices.present_family = i; indices.present_family = i;
} }
@ -89,18 +87,18 @@ namespace deerith {
} }
bool graphics::check_device_extension_support(VkPhysicalDevice device) { bool graphics::check_device_extension_support(VkPhysicalDevice device) {
uint32_t extension_count; uint32_t extensionCount;
vkEnumerateDeviceExtensionProperties(device, nullptr, &extension_count, nullptr); vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, nullptr);
std::vector<VkExtensionProperties> available_extensions(extension_count); std::vector<VkExtensionProperties> availableExtensions(extensionCount);
vkEnumerateDeviceExtensionProperties(device, nullptr, &extension_count, available_extensions.data()); vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, availableExtensions.data());
std::set<std::string> required_extensions(device_extensions.begin(), device_extensions.end()); std::set<std::string> requiredExtensions(device_extensions.begin(), device_extensions.end());
for (const auto& extension : available_extensions) { for (const auto& extension : availableExtensions) {
required_extensions.erase(extension.extensionName); requiredExtensions.erase(extension.extensionName);
} }
return required_extensions.empty(); return requiredExtensions.empty();
} }
} // namespace deerith } // namespace deerith

View File

@ -2,57 +2,57 @@
namespace deerith { namespace deerith {
void graphics::create_vulkan_command_buffer() { void graphics::create_vulkan_command_buffer() {
QueueFamilyIndices queue_family_indices = find_queue_families(physical_device); QueueFamilyIndices queueFamilyIndices = find_queue_families(physical_device);
VkCommandPoolCreateInfo pool_info{}; VkCommandPoolCreateInfo poolInfo{};
pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
pool_info.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
pool_info.queueFamilyIndex = queue_family_indices.graphics_family.value(); poolInfo.queueFamilyIndex = queueFamilyIndices.graphics_family.value();
if (vkCreateCommandPool(device, &pool_info, nullptr, &command_pool) != VK_SUCCESS) { if (vkCreateCommandPool(device, &poolInfo, nullptr, &command_pool) != VK_SUCCESS) {
deerith_graphics_error("failed to create command pool!"); deerith_graphics_error("failed to create command pool!");
} }
VkCommandBufferAllocateInfo alloc_info{}; VkCommandBufferAllocateInfo allocInfo{};
alloc_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
alloc_info.commandPool = command_pool; allocInfo.commandPool = command_pool;
alloc_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
alloc_info.commandBufferCount = 1; allocInfo.commandBufferCount = 1;
if (vkAllocateCommandBuffers(device, &alloc_info, &command_buffer) != VK_SUCCESS) { if (vkAllocateCommandBuffers(device, &allocInfo, &command_buffer) != VK_SUCCESS) {
deerith_graphics_error("failed to allocate command buffers!"); deerith_graphics_error("failed to allocate command buffers!");
} }
} }
void graphics::record_command_buffer(VkCommandBuffer command_buffer, uint32_t image_index) { void graphics::record_command_buffer(VkCommandBuffer commandBuffer, uint32_t imageIndex) {
VkCommandBufferBeginInfo begin_info{}; VkCommandBufferBeginInfo beginInfo{};
begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
begin_info.flags = 0; // Optional beginInfo.flags = 0; // Optional
begin_info.pInheritanceInfo = nullptr; // Optional beginInfo.pInheritanceInfo = nullptr; // Optional
if (vkBeginCommandBuffer(command_buffer, &begin_info) != VK_SUCCESS) { if (vkBeginCommandBuffer(commandBuffer, &beginInfo) != VK_SUCCESS) {
deerith_graphics_error("failed to begin recording command buffer!"); deerith_graphics_error("failed to begin recording command buffer!");
} }
VkRenderPassBeginInfo render_pass_info{}; VkRenderPassBeginInfo renderPassInfo{};
render_pass_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
render_pass_info.renderPass = render_pass; renderPassInfo.renderPass = render_pass;
render_pass_info.framebuffer = swap_chain_frame_buffers[image_index]; renderPassInfo.framebuffer = swap_chain_frame_buffers[imageIndex];
render_pass_info.renderArea.offset = {0, 0}; renderPassInfo.renderArea.offset = {0, 0};
render_pass_info.renderArea.extent = swap_chain_extent; renderPassInfo.renderArea.extent = swap_chain_extent;
VkClearValue clear_color = {{{0.0f, 0.0f, 0.0f, 1.0f}}}; VkClearValue clearColor = {{{0.0f, 0.0f, 0.0f, 1.0f}}};
render_pass_info.clearValueCount = 1; renderPassInfo.clearValueCount = 1;
render_pass_info.pClearValues = &clear_color; renderPassInfo.pClearValues = &clearColor;
vkCmdBeginRenderPass(command_buffer, &render_pass_info, VK_SUBPASS_CONTENTS_INLINE); vkCmdBeginRenderPass(commandBuffer, &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
vkCmdBindPipeline(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline); vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline);
vkCmdDraw(command_buffer, 3, 1, 0, 0); vkCmdDraw(commandBuffer, 3, 1, 0, 0);
vkCmdEndRenderPass(command_buffer); vkCmdEndRenderPass(commandBuffer);
if (vkEndCommandBuffer(command_buffer) != VK_SUCCESS) { if (vkEndCommandBuffer(commandBuffer) != VK_SUCCESS) {
deerith_graphics_error("failed to record command buffer!"); deerith_graphics_error("failed to record command buffer!");
} }
} }

View File

@ -2,37 +2,37 @@
namespace deerith { namespace deerith {
void graphics::create_vulkan_render_pass() { void graphics::create_vulkan_render_pass() {
VkAttachmentDescription color_attachment{}; VkAttachmentDescription colorAttachment{};
color_attachment.format = swap_chain_image_format; colorAttachment.format = swap_chain_image_format;
color_attachment.samples = VK_SAMPLE_COUNT_1_BIT; colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
color_attachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
color_attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
color_attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
color_attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
color_attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; colorAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
color_attachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; colorAttachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
VkAttachmentReference color_attachmentRef{}; VkAttachmentReference colorAttachmentRef{};
color_attachmentRef.attachment = 0; colorAttachmentRef.attachment = 0;
color_attachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
VkSubpassDescription subpass{}; VkSubpassDescription subpass{};
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpass.colorAttachmentCount = 1; subpass.colorAttachmentCount = 1;
subpass.pColorAttachments = &color_attachmentRef; subpass.pColorAttachments = &colorAttachmentRef;
VkRenderPassCreateInfo render_pass_info{}; VkRenderPassCreateInfo renderPassInfo{};
render_pass_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
render_pass_info.attachmentCount = 1; renderPassInfo.attachmentCount = 1;
render_pass_info.pAttachments = &color_attachment; renderPassInfo.pAttachments = &colorAttachment;
render_pass_info.subpassCount = 1; renderPassInfo.subpassCount = 1;
render_pass_info.pSubpasses = &subpass; renderPassInfo.pSubpasses = &subpass;
if (vkCreateRenderPass(device, &render_pass_info, nullptr, &render_pass) != VK_SUCCESS) { if (vkCreateRenderPass(device, &renderPassInfo, nullptr, &render_pass) != VK_SUCCESS) {
deerith_graphics_error("failed to create render pass!"); deerith_graphics_error("failed to create render pass!");
} }
} }

View File

@ -31,30 +31,30 @@ namespace deerith {
vkWaitForFences(device, 1, &in_flight_fence, VK_TRUE, UINT64_MAX); vkWaitForFences(device, 1, &in_flight_fence, VK_TRUE, UINT64_MAX);
vkResetFences(device, 1, &in_flight_fence); vkResetFences(device, 1, &in_flight_fence);
uint32_t image_index; uint32_t imageIndex;
vkAcquireNextImageKHR(device, swap_chain, UINT64_MAX, image_available_semaphore, VK_NULL_HANDLE, &image_index); vkAcquireNextImageKHR(device, swap_chain, UINT64_MAX, image_available_semaphore, VK_NULL_HANDLE, &imageIndex);
vkResetCommandBuffer(command_buffer, 0); vkResetCommandBuffer(command_buffer, 0);
record_command_buffer(command_buffer, image_index); record_command_buffer(command_buffer, imageIndex);
VkSubmitInfo submit_info{}; VkSubmitInfo submitInfo{};
submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
VkSemaphore waitSemaphores[] = {image_available_semaphore}; VkSemaphore waitSemaphores[] = {image_available_semaphore};
VkPipelineStageFlags waitStages[] = {VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT}; VkPipelineStageFlags waitStages[] = {VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT};
submit_info.waitSemaphoreCount = 1; submitInfo.waitSemaphoreCount = 1;
submit_info.pWaitSemaphores = waitSemaphores; submitInfo.pWaitSemaphores = waitSemaphores;
submit_info.pWaitDstStageMask = waitStages; submitInfo.pWaitDstStageMask = waitStages;
submit_info.commandBufferCount = 1; submitInfo.commandBufferCount = 1;
submit_info.pCommandBuffers = &command_buffer; submitInfo.pCommandBuffers = &command_buffer;
VkSemaphore signalSemaphores[] = {render_finished_semaphore}; VkSemaphore signalSemaphores[] = {render_finished_semaphore};
submit_info.signalSemaphoreCount = 1; submitInfo.signalSemaphoreCount = 1;
submit_info.pSignalSemaphores = signalSemaphores; submitInfo.pSignalSemaphores = signalSemaphores;
if (vkQueueSubmit(graphics_queue, 1, &submit_info, in_flight_fence) != VK_SUCCESS) { if (vkQueueSubmit(graphics_queue, 1, &submitInfo, in_flight_fence) != VK_SUCCESS) {
deerith_graphics_error("failed to submit draw command buffer!"); deerith_graphics_error("failed to submit draw command buffer!");
} }
@ -77,7 +77,7 @@ namespace deerith {
VkSwapchainKHR swapChains[] = {swap_chain}; VkSwapchainKHR swapChains[] = {swap_chain};
presentInfo.swapchainCount = 1; presentInfo.swapchainCount = 1;
presentInfo.pSwapchains = swapChains; presentInfo.pSwapchains = swapChains;
presentInfo.pImageIndices = &image_index; presentInfo.pImageIndices = &imageIndex;
presentInfo.pResults = nullptr; // Optional presentInfo.pResults = nullptr; // Optional
vkQueuePresentKHR(pressent_queue, &presentInfo); vkQueuePresentKHR(pressent_queue, &presentInfo);

View File

@ -34,12 +34,12 @@ namespace deerith {
create_info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; create_info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
QueueFamilyIndices indices = find_queue_families(physical_device); QueueFamilyIndices indices = find_queue_families(physical_device);
uint32_t queue_family_indices[] = {indices.graphics_family.value(), indices.present_family.value()}; uint32_t queueFamilyIndices[] = {indices.graphics_family.value(), indices.present_family.value()};
if (indices.graphics_family != indices.present_family) { if (indices.graphics_family != indices.present_family) {
create_info.imageSharingMode = VK_SHARING_MODE_CONCURRENT; create_info.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
create_info.queueFamilyIndexCount = 2; create_info.queueFamilyIndexCount = 2;
create_info.pQueueFamilyIndices = queue_family_indices; create_info.pQueueFamilyIndices = queueFamilyIndices;
} else { } else {
create_info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; create_info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
create_info.queueFamilyIndexCount = 0; create_info.queueFamilyIndexCount = 0;

View File

@ -27,8 +27,8 @@ namespace deerith {
for (const char* layerName : validation_layers) { for (const char* layerName : validation_layers) {
bool layerFound = false; bool layerFound = false;
for (const auto& layer_properties : available_layers) { for (const auto& layerProperties : available_layers) {
if (strcmp(layerName, layer_properties.layerName) == 0) { if (strcmp(layerName, layerProperties.layerName) == 0) {
layerFound = true; layerFound = true;
break; break;
} }