Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/stuart6854/VkMana
Browse files Browse the repository at this point in the history
  • Loading branch information
stuart6854 committed Nov 30, 2023
2 parents 59ea5f9 + 5095ca5 commit 9630342
Show file tree
Hide file tree
Showing 26 changed files with 74 additions and 62 deletions.
18 changes: 9 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
[submodule "third_party/sdl2"]
path = third_party/sdl2
path = samples/extern/sdl2
url = https://github.com/libsdl-org/SDL.git
[submodule "third_party/glm"]
path = third_party/glm
path = samples/extern/glm
url = https://github.com/g-truc/glm.git
[submodule "third_party/glslang"]
path = third_party/glslang
path = extern/glslang
url = https://github.com/KhronosGroup/glslang.git
[submodule "third_party/SPIRV-Tools"]
path = third_party/SPIRV-Tools
path = extern/SPIRV-Tools
url = https://github.com/KhronosGroup/SPIRV-Tools.git
[submodule "third_party/SPIRV-Headers"]
path = third_party/SPIRV-Headers
path = extern/SPIRV-Headers
url = https://github.com/KhronosGroup/SPIRV-Headers.git
[submodule "third_party/shaderc"]
path = third_party/shaderc
path = extern/shaderc
url = https://github.com/google/shaderc.git
[submodule "third_party/vma-hpp"]
path = third_party/vma-hpp
path = extern/vma-hpp
url = https://github.com/stuart6854/VulkanMemoryAllocator-Hpp.git
[submodule "third_party/Vulkan-Headers"]
path = third_party/Vulkan-Headers
path = extern/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
[submodule "third_party/fmt"]
path = third_party/fmt
path = extern/fmt
url = https://github.com/fmtlib/fmt.git
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ project(VkMana VERSION 0.1.0 LANGUAGES C CXX)

option(VKMANA_BUILD_SAMPLES "Build the sample projects" ON)

add_subdirectory(third_party)
add_subdirectory(extern)

add_subdirectory(src)

if(VKMANA_BUILD_SAMPLES)
add_subdirectory(samples)
add_subdirectory(samples EXCLUDE_FROM_ALL)
endif ()
22 changes: 22 additions & 0 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
add_subdirectory(Vulkan-Headers)

add_subdirectory(SPIRV-Headers)
add_subdirectory(SPIRV-Tools)
add_subdirectory(glslang)

# vma-hpp
add_subdirectory(vma-hpp)

# ShaderC
option(SHADERC_SKIP_INSTALL "Skip installation" ON)
option(SHADERC_SKIP_TESTS "Skip building tests" ON)
option(SHADERC_SKIP_EXAMPLES "Skip building examples" ON)
option(SHADERC_SKIP_COPYRIGHT_CHECK "Skip copyright check" ON)
option(SHADERC_ENABLE_SHARED_CRT "Use the shared CRT instead of the static CRT" ON)
add_subdirectory(shaderc)

# FmtLib
if (NOT TARGET fmt)
option(FMT_INSTALL "Generate the install target." OFF)
add_subdirectory(fmt)
endif ()
4 changes: 4 additions & 0 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.10)

project(samples LANGUAGES C CXX)

# Dependencies
add_subdirectory(extern)

# Samples
add_subdirectory(hello_triangle)
add_subdirectory(model_loading)
add_subdirectory(sandbox)
32 changes: 32 additions & 0 deletions samples/extern/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# sdl2
option(SDL2_DISABLE_SDL2MAIN ON)
option(SDL2_DISABLE_INSTALL ON)
option(SDL2_DISABLE_UNINSTALL ON)
option(SDL_SHARED OFF)
option(SDL_TEST OFF)
option(SDL_TESTS OFF)
option(SDL_OPENGL OFF)
option(SDL_OPENGLES OFF)
option(SDL_DIRECTX OFF)
option(SDL_METAL OFF)
option(SDL_AUDIO OFF)
option(SDL_HAPTIC OFF)
option(SDL_Hidapi OFF)
option(SDL_Sensor OFF)
option(SDL_Locale OFF)
add_subdirectory(sdl2)
set_property(TARGET SDL2-static PROPERTY FOLDER "ThirdParty")

# GLM
if (NOT TARGET glm)
add_subdirectory(glm)
endif ()

#stb
add_subdirectory(stb)

# tinygltf
add_subdirectory(tinygltf)

# tinyobjloader
add_subdirectory(tinyobjloader)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion samples/sandbox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ add_executable(sample_sandbox
src/ModelLoader.hpp
)

target_link_libraries(sample_sandbox PRIVATE VkMana glm tinygltf tinyobjloader stb)
target_link_libraries(sample_sandbox PRIVATE VkMana glm SDL2-static stb tinygltf tinyobjloader)

target_compile_features(sample_sandbox PRIVATE cxx_std_20)
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ add_library(VkMana
target_include_directories(VkMana PRIVATE "./")
target_include_directories(VkMana SYSTEM INTERFACE "./")

target_link_libraries(VkMana PRIVATE shaderc shaderc_util PUBLIC fmt::fmt Vulkan::Headers VulkanMemoryAllocator-Hpp SDL2-static)
target_link_libraries(VkMana PRIVATE shaderc shaderc_util PUBLIC fmt::fmt Vulkan::Headers VulkanMemoryAllocator-Hpp)

target_compile_features(VkMana PUBLIC cxx_std_20)

target_compile_options(VkMana PRIVATE
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Werror -pedantic-errors -Wall -Wno-unused -Wno-sign-compare>
$<$<CXX_COMPILER_ID:MSVC>:/WX /W4 /external:anglebrackets /external:W0>
$<$<CXX_COMPILER_ID:MSVC>:/WX /W4 /external:anglebrackets /external:W0 /wd4100>
)
2 changes: 1 addition & 1 deletion src/VkMana/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ namespace VkMana
auto mipWidth = int32_t(info.Width);
auto mipHeight = int32_t(info.Height);

for (uint32_t i = 1u; i < info.MipLevels; ++i)
for (auto i = 1u; i < uint32_t(info.MipLevels); ++i)
{
// Transition src mip to TransferSrc
ImageTransitionInfo srcTransition{
Expand Down
2 changes: 1 addition & 1 deletion src/VkMana/Image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace VkMana
return ImageCreateInfo{
.Width = width,
.Height = height,
.MipLevels = -1,
.MipLevels = mipLevels,
.Format = vk::Format::eR8G8B8A8Unorm,
.Usage = vk::ImageUsageFlagBits::eSampled | vk::ImageUsageFlagBits::eTransferDst | vk::ImageUsageFlagBits::eTransferSrc,
.Flags = ImageCreateFlags_GenMipMaps,
Expand Down
46 changes: 0 additions & 46 deletions third_party/CMakeLists.txt

This file was deleted.

0 comments on commit 9630342

Please sign in to comment.