Compare commits

..

3 Commits

Author SHA1 Message Date
8b1aa63327 Refactor for correct naming 2026-03-23 11:31:55 +01:00
10175d92b3 updated git ignore 2026-03-23 10:58:16 +01:00
a72b8e43a3 Removed build data 2026-03-23 10:57:31 +01:00
30 changed files with 172 additions and 2952 deletions

15
.gitignore vendored
View File

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

View File

@ -1 +0,0 @@
{"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

@ -1,272 +0,0 @@
{
"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

@ -1,140 +0,0 @@
{
"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

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

View File

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

View File

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

View File

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

View File

@ -1,132 +0,0 @@
{
"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

@ -1,148 +0,0 @@
{
"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

@ -1,271 +0,0 @@
{
"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

@ -1,242 +0,0 @@
{
"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

@ -1,107 +0,0 @@
{
"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.

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +0,0 @@
#version 450
layout(location = 0) in vec3 fragColor;
layout(location = 0) out vec4 outColor;
void main() {
outColor = vec4(fragColor, 1.0);
}

View File

@ -1,20 +0,0 @@
#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);
SwapChainSupportDetails query_swap_chain_support(VkPhysicalDevice device);
void record_command_buffer(VkCommandBuffer commandBuffer, uint32_t imageIndex);
void record_command_buffer(VkCommandBuffer command_buffer, uint32_t image_index);
} // namespace graphics
} // namespace deerith

View File

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

View File

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

View File

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

View File

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

View File

@ -2,37 +2,37 @@
namespace deerith {
void graphics::create_vulkan_render_pass() {
VkAttachmentDescription colorAttachment{};
colorAttachment.format = swap_chain_image_format;
colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
VkAttachmentDescription color_attachment{};
color_attachment.format = swap_chain_image_format;
color_attachment.samples = VK_SAMPLE_COUNT_1_BIT;
colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
color_attachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
color_attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
color_attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
color_attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
colorAttachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
colorAttachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
color_attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
color_attachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
VkAttachmentReference colorAttachmentRef{};
colorAttachmentRef.attachment = 0;
colorAttachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
VkAttachmentReference color_attachmentRef{};
color_attachmentRef.attachment = 0;
color_attachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
VkSubpassDescription subpass{};
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpass.colorAttachmentCount = 1;
subpass.pColorAttachments = &colorAttachmentRef;
subpass.pColorAttachments = &color_attachmentRef;
VkRenderPassCreateInfo renderPassInfo{};
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
renderPassInfo.attachmentCount = 1;
renderPassInfo.pAttachments = &colorAttachment;
renderPassInfo.subpassCount = 1;
renderPassInfo.pSubpasses = &subpass;
VkRenderPassCreateInfo render_pass_info{};
render_pass_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
render_pass_info.attachmentCount = 1;
render_pass_info.pAttachments = &color_attachment;
render_pass_info.subpassCount = 1;
render_pass_info.pSubpasses = &subpass;
if (vkCreateRenderPass(device, &renderPassInfo, nullptr, &render_pass) != VK_SUCCESS) {
if (vkCreateRenderPass(device, &render_pass_info, nullptr, &render_pass) != VK_SUCCESS) {
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);
vkResetFences(device, 1, &in_flight_fence);
uint32_t imageIndex;
vkAcquireNextImageKHR(device, swap_chain, UINT64_MAX, image_available_semaphore, VK_NULL_HANDLE, &imageIndex);
uint32_t image_index;
vkAcquireNextImageKHR(device, swap_chain, UINT64_MAX, image_available_semaphore, VK_NULL_HANDLE, &image_index);
vkResetCommandBuffer(command_buffer, 0);
record_command_buffer(command_buffer, imageIndex);
record_command_buffer(command_buffer, image_index);
VkSubmitInfo submitInfo{};
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
VkSubmitInfo submit_info{};
submit_info.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;
submit_info.waitSemaphoreCount = 1;
submit_info.pWaitSemaphores = waitSemaphores;
submit_info.pWaitDstStageMask = waitStages;
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &command_buffer;
submit_info.commandBufferCount = 1;
submit_info.pCommandBuffers = &command_buffer;
VkSemaphore signalSemaphores[] = {render_finished_semaphore};
submitInfo.signalSemaphoreCount = 1;
submitInfo.pSignalSemaphores = signalSemaphores;
submit_info.signalSemaphoreCount = 1;
submit_info.pSignalSemaphores = signalSemaphores;
if (vkQueueSubmit(graphics_queue, 1, &submitInfo, in_flight_fence) != VK_SUCCESS) {
if (vkQueueSubmit(graphics_queue, 1, &submit_info, in_flight_fence) != VK_SUCCESS) {
deerith_graphics_error("failed to submit draw command buffer!");
}
@ -77,7 +77,7 @@ namespace deerith {
VkSwapchainKHR swapChains[] = {swap_chain};
presentInfo.swapchainCount = 1;
presentInfo.pSwapchains = swapChains;
presentInfo.pImageIndices = &imageIndex;
presentInfo.pImageIndices = &image_index;
presentInfo.pResults = nullptr; // Optional
vkQueuePresentKHR(pressent_queue, &presentInfo);

View File

@ -34,12 +34,12 @@ namespace deerith {
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()};
uint32_t queue_family_indices[] = {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;
create_info.pQueueFamilyIndices = queue_family_indices;
} else {
create_info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
create_info.queueFamilyIndexCount = 0;

View File

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