From abb019ce1e8ae0610dfd6f82519b233d29ad5369 Mon Sep 17 00:00:00 2001 From: shg8 <38004233+shg8@users.noreply.github.com> Date: Wed, 14 Feb 2024 22:02:22 -0600 Subject: [PATCH 1/8] Add Vulkan SDK directory to CMake configure --- .github/workflows/cmake-multi-platform.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index ca05f28..13950c5 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -53,6 +53,7 @@ jobs: shell: bash run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + echo "vulkan-sdk-dir=${{ github.workspace }}/VULKAN_SDK" >> "$GITHUB_OUTPUT" - name: Prepare Vulkan SDK uses: humbletim/setup-vulkan-sdk@v1.2.0 @@ -66,6 +67,7 @@ jobs: # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: > cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DVULKAN_SDK=${{ steps.strings.outputs.vulkan-sdk-dir }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} From 11614ccedb8175560fb6730fff6254544ff7d405 Mon Sep 17 00:00:00 2001 From: shg8 <38004233+shg8@users.noreply.github.com> Date: Wed, 14 Feb 2024 22:44:11 -0600 Subject: [PATCH 2/8] Remove tests --- .github/workflows/cmake-multi-platform.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 13950c5..d8a7097 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -76,9 +76,3 @@ jobs: - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} - - - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }} - # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest --build-config ${{ matrix.build_type }} From 0a25da0ee174523039db13825afeb32e4b624bd2 Mon Sep 17 00:00:00 2001 From: shg8 <38004233+shg8@users.noreply.github.com> Date: Wed, 14 Feb 2024 22:46:50 -0600 Subject: [PATCH 3/8] Trigger actions on current branch --- .github/workflows/cmake-multi-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index d8a7097..9a2e258 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -4,7 +4,7 @@ name: CMake on multiple platforms on: push: - branches: [ "main" ] + branches: [ "main", "bugfix/workflow" ] pull_request: branches: [ "main" ] From 89d089b6c6203016c905021690f88e22a57bebd0 Mon Sep 17 00:00:00 2001 From: shg8 Date: Wed, 14 Feb 2024 23:23:38 -0600 Subject: [PATCH 4/8] Fix workflow --- .github/workflows/cmake-multi-platform.yml | 4 ++++ CMakeLists.txt | 4 ++-- README.md | 12 +++++++++--- shaders/precomp_cov3d.comp | 1 + shaders/prefix_sum.comp | 1 + shaders/preprocess.comp | 1 + shaders/preprocess_sort.comp | 1 + shaders/render.comp | 1 + shaders/tile_boundary.comp | 1 + 9 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 9a2e258..8346a92 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -55,6 +55,10 @@ jobs: echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" echo "vulkan-sdk-dir=${{ github.workspace }}/VULKAN_SDK" >> "$GITHUB_OUTPUT" + - name: Install dependencies + if: matrix.os == 'ubuntu-latest' + run: sudo apt-get update && sudo apt-get install -y libglfw3-dev libglm-dev + - name: Prepare Vulkan SDK uses: humbletim/setup-vulkan-sdk@v1.2.0 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 68bde6e..afa2c27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ include(FetchContent) set(CMAKE_CXX_STANDARD 20) -find_package(Vulkan COMPONENTS glslc) +find_package(Vulkan COMPONENTS glslangValidator) if (WIN32) FetchContent_Declare( @@ -72,7 +72,7 @@ foreach (GLSL ${GLSL_SOURCE_FILES}) add_custom_command( OUTPUT ${SPIRV} COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_BINARY_DIR}/shaders/" - COMMAND ${Vulkan_GLSLC_EXECUTABLE} ${GLSL} -o ${SPIRV} ${GLSLC_DEFINE} "--target-env=vulkan1.2" + COMMAND ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} "--target-env" "vulkan1.2" -V ${GLSL} -o ${SPIRV} ${GLSLC_DEFINE} DEPENDS ${GLSL}) list(APPEND SPIRV_BINARY_FILES ${SPIRV}) endforeach (GLSL) diff --git a/README.md b/README.md index b0a20d4..bc59317 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,22 @@ VulkanSplatting is an (not-yet-highly-) optimized, cross-platform implementation ## Building ### Linux VulkanSplatting requires the following dependencies: -`Vulkan headers, Vulkan validation layers, glslc, glfw, glm` -The easiest way to install them is through the [LunarG Vulkan SDK](https://www.lunarg.com/vulkan-sdk/). Alternatively, there shouldn't be any problems using these packages from your distro as long as they're reasonably update-to-date. +`Vulkan headers, Vulkan validation layers, glslangValidator, glfw, glm` + +The easiest way to install the first three is through the [LunarG Vulkan SDK](https://www.lunarg.com/vulkan-sdk/). Alternatively, you can install the corresponding packages from your distro. For Ubuntu, the packages to install are `vulkan-headers, vulkan-validationlayers, glslang-dev, libglfw3-dev, libglm-dev`. + ### Windows -After installing [LunarG Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) with all the required components (see the Linux section), set the `VULKAN_SDK` environmental variable to the install path. Alternatively, pass "-DVULKAN_SDK=\INSTALL\LOCATION\OF\YOUR\SDK" to CMake. A full CMake configure command is as follows: +After installing [LunarG Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) with all the required components (see the Linux section), set the `VULKAN_SDK` environmental variable to the install path. Alternatively, pass "-DVULKAN_SDK=\INSTALL\LOCATION\OF\YOUR\SDK" to CMake. + +A full CMake configure command is as follows: ``` mkdir .\VulkanSplatting\build cmake -DCMAKE_BUILD_TYPE=Release -DVULKAN_SDK=\INSTALL\LOCATION\OF\YOUR\SDK -S .\VulkanSplatting -B .\VulkanSplatting\build ``` + Only Ninja has been tested as a generator on Windows, but other generators should work as well. To use ninja, add `-G Ninja` to the configure command and make sure that the binary is available in your PATH. + ## Command Line Usage ``` ./vulkan_splatting [options] diff --git a/shaders/precomp_cov3d.comp b/shaders/precomp_cov3d.comp index 64bb1f7..f776b8c 100644 --- a/shaders/precomp_cov3d.comp +++ b/shaders/precomp_cov3d.comp @@ -1,4 +1,5 @@ #version 450 +#extension GL_GOOGLE_include_directive : enable #include "./common.glsl" #ifdef DEBUG diff --git a/shaders/prefix_sum.comp b/shaders/prefix_sum.comp index e12a62b..dec1f85 100644 --- a/shaders/prefix_sum.comp +++ b/shaders/prefix_sum.comp @@ -1,4 +1,5 @@ #version 450 +#extension GL_GOOGLE_include_directive : enable #include "./common.glsl" #ifdef DEBUG diff --git a/shaders/preprocess.comp b/shaders/preprocess.comp index 7529cd5..e46e3f0 100644 --- a/shaders/preprocess.comp +++ b/shaders/preprocess.comp @@ -1,4 +1,5 @@ #version 450 +#extension GL_GOOGLE_include_directive : enable #include "./common.glsl" diff --git a/shaders/preprocess_sort.comp b/shaders/preprocess_sort.comp index f793d3c..265d802 100644 --- a/shaders/preprocess_sort.comp +++ b/shaders/preprocess_sort.comp @@ -1,4 +1,5 @@ #version 450 +#extension GL_GOOGLE_include_directive : enable #include "./common.glsl" #extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable diff --git a/shaders/render.comp b/shaders/render.comp index e24f720..96e94ec 100644 --- a/shaders/render.comp +++ b/shaders/render.comp @@ -1,4 +1,5 @@ #version 450 +#extension GL_GOOGLE_include_directive : enable #include "./common.glsl" #extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable diff --git a/shaders/tile_boundary.comp b/shaders/tile_boundary.comp index 3c1fd1a..bfe7ba4 100644 --- a/shaders/tile_boundary.comp +++ b/shaders/tile_boundary.comp @@ -1,4 +1,5 @@ #version 450 +#extension GL_GOOGLE_include_directive : enable #include "./common.glsl" #extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable From 810eaa5196bc73f8d2a60e46495e50d68075e2e0 Mon Sep 17 00:00:00 2001 From: shg8 Date: Wed, 14 Feb 2024 23:25:35 -0600 Subject: [PATCH 5/8] Update Vulkan SDK dependencies --- .github/workflows/cmake-multi-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 8346a92..899e477 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -63,7 +63,7 @@ jobs: uses: humbletim/setup-vulkan-sdk@v1.2.0 with: vulkan-query-version: 1.3.204.0 - vulkan-components: Vulkan-Headers, Vulkan-Loader, Glslang, SPIRV-Tools + vulkan-components: Vulkan-Headers, Vulkan-Loader, Glslang vulkan-use-cache: true - name: Configure CMake From dbfd6c3d80d2b042bf178c7503889d7fa23f8775 Mon Sep 17 00:00:00 2001 From: shg8 Date: Wed, 14 Feb 2024 23:38:54 -0600 Subject: [PATCH 6/8] Add explicit conversions <-> C types --- 3dgs/Renderer.cpp | 2 +- vulkan/Buffer.cpp | 8 ++++---- vulkan/Buffer.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/3dgs/Renderer.cpp b/3dgs/Renderer.cpp index 5cad722..8524309 100644 --- a/3dgs/Renderer.cpp +++ b/3dgs/Renderer.cpp @@ -66,7 +66,7 @@ void Renderer::initializeVulkan() { configuration.enableVulkanValidationLayers); context->createInstance(); - auto surface = vk::SurfaceKHR{window->createSurface(context)}; + auto surface = static_cast(window->createSurface(context)); context->selectPhysicalDevice(configuration.physicalDeviceId, surface); vk::PhysicalDeviceFeatures pdf{}; diff --git a/vulkan/Buffer.cpp b/vulkan/Buffer.cpp index bf65e44..3abbd46 100644 --- a/vulkan/Buffer.cpp +++ b/vulkan/Buffer.cpp @@ -5,7 +5,7 @@ #include "Utils.h" Buffer::Buffer(const std::shared_ptr& _context, uint32_t size, vk::BufferUsageFlags usage, - VmaMemoryUsage vmaUsage, VmaAllocationCreateFlags flags, bool shared, VkDeviceSize alignment) + VmaMemoryUsage vmaUsage, VmaAllocationCreateFlags flags, bool shared, vk::DeviceSize alignment) : context(_context), size(size), usage(usage), @@ -23,7 +23,7 @@ Buffer::Buffer(const std::shared_ptr& _context, uint32_t size, vk bufferInfo.setQueueFamilyIndexCount(2).setPQueueFamilyIndices(queueFamilyIndices); } - VkBufferCreateInfo vkBufferInfo = bufferInfo; + auto vkBufferInfo = static_cast(bufferInfo); VmaAllocationCreateInfo allocInfo = {}; allocInfo.usage = vmaUsage; @@ -40,7 +40,7 @@ Buffer::Buffer(const std::shared_ptr& _context, uint32_t size, vk if (res != VK_SUCCESS) { throw std::runtime_error("Failed to create buffer"); } - buffer = vkBuffer; + buffer = static_cast(vkBuffer); } Buffer Buffer::createStagingBuffer(uint32_t size) { @@ -119,7 +119,7 @@ std::shared_ptr Buffer::staging(std::shared_ptr context, false); } -std::shared_ptr Buffer::storage(std::shared_ptr context, uint64_t size, bool concurrentSharing, VkDeviceSize alignment) { +std::shared_ptr Buffer::storage(std::shared_ptr context, uint64_t size, bool concurrentSharing, vk::DeviceSize alignment) { return std::make_shared(context, size, vk::BufferUsageFlagBits::eStorageBuffer | vk::BufferUsageFlagBits::eTransferDst | vk::BufferUsageFlagBits::eTransferSrc, VMA_MEMORY_USAGE_GPU_ONLY, VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT, concurrentSharing, alignment); diff --git a/vulkan/Buffer.h b/vulkan/Buffer.h index 788c8fa..e94908d 100644 --- a/vulkan/Buffer.h +++ b/vulkan/Buffer.h @@ -25,7 +25,7 @@ class Buffer : public std::enable_shared_from_this { static std::shared_ptr staging(std::shared_ptr context, unsigned long size); - static std::shared_ptr storage(std::shared_ptr context, uint64_t size, bool concurrentSharing = false, VkDeviceSize alignment = 0); + static std::shared_ptr storage(std::shared_ptr context, uint64_t size, bool concurrentSharing = false, vk::DeviceSize alignment = 0); void upload(const void *data, uint32_t size, uint32_t offset = 0); From c95c34a642d140d14583bdec4e1c41f670fe6a6e Mon Sep 17 00:00:00 2001 From: shg8 Date: Wed, 14 Feb 2024 23:46:48 -0600 Subject: [PATCH 7/8] Fix glm error for MSBuild --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index afa2c27..2c5565a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,7 @@ add_executable(vulkan_splatting main.cpp add_dependencies(vulkan_splatting Shaders) -target_include_directories(vulkan_splatting PUBLIC ${Vulkan_INCLUDE_DIRS} ${GLM_INCLUDE_DIRS}) +target_include_directories(vulkan_splatting PUBLIC ${Vulkan_INCLUDE_DIRS} ${GLM_INCLUDE_DIRS} ${glm_SOURCE_DIR}) target_link_libraries(vulkan_splatting PUBLIC glfw libenvpp::libenvpp) target_link_libraries(vulkan_splatting PUBLIC Vulkan::Vulkan) From 16085b22d2956d705e150627b28be22ea73c1625 Mon Sep 17 00:00:00 2001 From: shg8 Date: Wed, 14 Feb 2024 23:56:48 -0600 Subject: [PATCH 8/8] Add badge to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bc59317..c56da2e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # VulkanSplatting VulkanSplatting is an (not-yet-highly-) optimized, cross-platform implementation of [Gaussian Splatting](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/) using the [Vulkan API](https://www.khronos.org/vulkan/) and compute pipelines. +[![Windows + Linux](https://github.com/shg8/VulkanSplatting/actions/workflows/cmake-multi-platform.yml/badge.svg?branch=main)](https://github.com/shg8/VulkanSplatting/actions/workflows/cmake-multi-platform.yml) + ## Building ### Linux VulkanSplatting requires the following dependencies: