test: use volk rather than Vulkan linkage

This commit is contained in:
PancakeTAS 2025-07-24 17:43:22 +02:00 committed by Pancake
parent 308c5789b7
commit f24263b83b
34 changed files with 103 additions and 61 deletions

3
.gitmodules vendored
View file

@ -7,3 +7,6 @@
[submodule "thirdparty/toml11"] [submodule "thirdparty/toml11"]
path = thirdparty/toml11 path = thirdparty/toml11
url = https://github.com/ToruNiina/toml11 url = https://github.com/ToruNiina/toml11
[submodule "thirdparty/volk"]
path = thirdparty/volk
url = https://github.com/zeux/volk

View file

@ -19,6 +19,7 @@ set(GLFW_BUILD_X11 ON)
add_subdirectory(thirdparty/dxbc EXCLUDE_FROM_ALL) add_subdirectory(thirdparty/dxbc EXCLUDE_FROM_ALL)
add_subdirectory(thirdparty/pe-parse/pe-parser-library EXCLUDE_FROM_ALL) add_subdirectory(thirdparty/pe-parse/pe-parser-library EXCLUDE_FROM_ALL)
add_subdirectory(thirdparty/toml11 EXCLUDE_FROM_ALL) add_subdirectory(thirdparty/toml11 EXCLUDE_FROM_ALL)
add_subdirectory(thirdparty/volk EXCLUDE_FROM_ALL)
add_subdirectory(framegen) add_subdirectory(framegen)
# main project # main project
@ -45,7 +46,7 @@ target_include_directories(lsfg-vk
PRIVATE include) PRIVATE include)
target_link_libraries(lsfg-vk PRIVATE target_link_libraries(lsfg-vk PRIVATE
pe-parse dxbc toml11 SPIRV-Headers pe-parse dxbc toml11 SPIRV-Headers
lsfg-vk-framegen vulkan lsfg-vk-framegen
-static-libstdc++ -static-libgcc) -static-libstdc++ -static-libgcc)
get_target_property(TOML11_INCLUDE_DIRS toml11 INTERFACE_INCLUDE_DIRECTORIES) get_target_property(TOML11_INCLUDE_DIRS toml11 INTERFACE_INCLUDE_DIRECTORIES)

View file

@ -34,7 +34,7 @@ target_include_directories(lsfg-vk-framegen
PRIVATE v3.1_include PRIVATE v3.1_include
PRIVATE v3.1p_include) PRIVATE v3.1p_include)
target_link_libraries(lsfg-vk-framegen target_link_libraries(lsfg-vk-framegen
PUBLIC vulkan) PUBLIC volk)
if(CMAKE_BUILD_TYPE STREQUAL "Release") if(CMAKE_BUILD_TYPE STREQUAL "Release")
set_target_properties(lsfg-vk-framegen PROPERTIES set_target_properties(lsfg-vk-framegen PROPERTIES

View file

@ -1,3 +1,6 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/buffer.hpp" #include "core/buffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
@ -6,8 +9,6 @@
#include "core/fence.hpp" #include "core/fence.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <cstdint> #include <cstdint>
#include <cerrno> #include <cerrno>
#include <cstdlib> #include <cstdlib>

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/buffer.hpp" #include "core/buffer.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <algorithm> #include <algorithm>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>

View file

@ -1,3 +1,6 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "core/commandpool.hpp" #include "core/commandpool.hpp"
@ -5,8 +8,6 @@
#include "core/semaphore.hpp" #include "core/semaphore.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <memory> #include <memory>
#include <stdexcept> #include <stdexcept>
#include <cstdint> #include <cstdint>

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/commandpool.hpp" #include "core/commandpool.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <memory> #include <memory>
using namespace LSFG::Core; using namespace LSFG::Core;

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/descriptorpool.hpp" #include "core/descriptorpool.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <array> #include <array>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>

View file

@ -1,3 +1,6 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/descriptorset.hpp" #include "core/descriptorset.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "core/descriptorpool.hpp" #include "core/descriptorpool.hpp"
@ -9,8 +12,6 @@
#include "core/buffer.hpp" #include "core/buffer.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <memory> #include <memory>
#include <cstdint> #include <cstdint>

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/device.hpp" #include "core/device.hpp"
#include "core/instance.hpp" #include "core/instance.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <optional> #include <optional>
@ -97,6 +98,8 @@ Device::Device(const Instance& instance, uint64_t deviceUUID) {
if (res != VK_SUCCESS | deviceHandle == VK_NULL_HANDLE) if (res != VK_SUCCESS | deviceHandle == VK_NULL_HANDLE)
throw LSFG::vulkan_error(res, "Failed to create logical device"); throw LSFG::vulkan_error(res, "Failed to create logical device");
volkLoadDevice(deviceHandle);
// get compute queue // get compute queue
VkQueue queueHandle{}; VkQueue queueHandle{};
vkGetDeviceQueue(deviceHandle, *computeFamilyIdx, 0, &queueHandle); vkGetDeviceQueue(deviceHandle, *computeFamilyIdx, 0, &queueHandle);

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/fence.hpp" #include "core/fence.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <memory> #include <memory>
#include <cstdint> #include <cstdint>

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/image.hpp" #include "core/image.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <optional> #include <optional>

View file

@ -1,10 +1,12 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/instance.hpp" #include "core/instance.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <vulkan/vulkan_core.h>
using namespace LSFG::Core; using namespace LSFG::Core;
@ -13,6 +15,8 @@ const std::vector<const char*> requiredExtensions = {
}; };
Instance::Instance() { Instance::Instance() {
volkInitialize();
// create Vulkan instance // create Vulkan instance
const VkApplicationInfo appInfo{ const VkApplicationInfo appInfo{
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
@ -33,6 +37,8 @@ Instance::Instance() {
if (res != VK_SUCCESS) if (res != VK_SUCCESS)
throw LSFG::vulkan_error(res, "Failed to create Vulkan instance"); throw LSFG::vulkan_error(res, "Failed to create Vulkan instance");
volkLoadInstance(instanceHandle);
// store in shared ptr // store in shared ptr
this->instance = std::shared_ptr<VkInstance>( this->instance = std::shared_ptr<VkInstance>(
new VkInstance(instanceHandle), new VkInstance(instanceHandle),

View file

@ -1,11 +1,12 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/pipeline.hpp" #include "core/pipeline.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "core/shadermodule.hpp" #include "core/shadermodule.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <memory> #include <memory>
using namespace LSFG::Core; using namespace LSFG::Core;

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/sampler.hpp" #include "core/sampler.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <memory> #include <memory>
using namespace LSFG::Core; using namespace LSFG::Core;

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/semaphore.hpp" #include "core/semaphore.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <optional> #include <optional>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "core/shadermodule.hpp" #include "core/shadermodule.hpp"
#include "core/device.hpp" #include "core/device.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <vector> #include <vector>
#include <cstdint> #include <cstdint>
#include <utility> #include <utility>

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1/context.hpp" #include "v3_1/context.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <vector> #include <vector>
#include <cstddef> #include <cstddef>
#include <algorithm> #include <algorithm>

View file

@ -1,3 +1,6 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "lsfg_3_1.hpp" #include "lsfg_3_1.hpp"
#include "v3_1/context.hpp" #include "v3_1/context.hpp"
#include "core/commandpool.hpp" #include "core/commandpool.hpp"
@ -7,8 +10,6 @@
#include "common/exception.hpp" #include "common/exception.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include <vulkan/vulkan_core.h>
#include <cstdint> #include <cstdint>
#include <optional> #include <optional>
#include <cstdlib> #include <cstdlib>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1/shaders/alpha.hpp" #include "v3_1/shaders/alpha.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <utility> #include <utility>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1/shaders/beta.hpp" #include "v3_1/shaders/beta.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <array> #include <array>
#include <utility> #include <utility>
#include <cstddef> #include <cstddef>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1/shaders/delta.hpp" #include "v3_1/shaders/delta.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <array> #include <array>
#include <optional> #include <optional>
#include <utility> #include <utility>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1/shaders/gamma.hpp" #include "v3_1/shaders/gamma.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <array> #include <array>
#include <optional> #include <optional>
#include <utility> #include <utility>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1/shaders/generate.hpp" #include "v3_1/shaders/generate.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <vector> #include <vector>
#include <utility> #include <utility>
#include <cstddef> #include <cstddef>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1/shaders/mipmaps.hpp" #include "v3_1/shaders/mipmaps.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include <vulkan/vulkan_core.h>
#include <utility> #include <utility>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>

View file

@ -1,9 +1,10 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1p/context.hpp" #include "v3_1p/context.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "common/exception.hpp" #include "common/exception.hpp"
#include <vulkan/vulkan_core.h>
#include <vector> #include <vector>
#include <cstddef> #include <cstddef>
#include <algorithm> #include <algorithm>

View file

@ -1,3 +1,6 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "lsfg_3_1p.hpp" #include "lsfg_3_1p.hpp"
#include "v3_1p/context.hpp" #include "v3_1p/context.hpp"
#include "core/commandpool.hpp" #include "core/commandpool.hpp"
@ -7,8 +10,6 @@
#include "common/exception.hpp" #include "common/exception.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include <vulkan/vulkan_core.h>
#include <cstdint> #include <cstdint>
#include <optional> #include <optional>
#include <cstdlib> #include <cstdlib>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1p/shaders/alpha.hpp" #include "v3_1p/shaders/alpha.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <utility> #include <utility>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1p/shaders/beta.hpp" #include "v3_1p/shaders/beta.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <array> #include <array>
#include <utility> #include <utility>
#include <cstddef> #include <cstddef>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1p/shaders/delta.hpp" #include "v3_1p/shaders/delta.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <array> #include <array>
#include <optional> #include <optional>
#include <utility> #include <utility>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1p/shaders/gamma.hpp" #include "v3_1p/shaders/gamma.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <array> #include <array>
#include <optional> #include <optional>
#include <utility> #include <utility>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1p/shaders/generate.hpp" #include "v3_1p/shaders/generate.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include <vulkan/vulkan_core.h>
#include <vector> #include <vector>
#include <utility> #include <utility>
#include <cstddef> #include <cstddef>

View file

@ -1,10 +1,11 @@
#include <volk.h>
#include <vulkan/vulkan_core.h>
#include "v3_1p/shaders/mipmaps.hpp" #include "v3_1p/shaders/mipmaps.hpp"
#include "common/utils.hpp" #include "common/utils.hpp"
#include "core/image.hpp" #include "core/image.hpp"
#include "core/commandbuffer.hpp" #include "core/commandbuffer.hpp"
#include <vulkan/vulkan_core.h>
#include <utility> #include <utility>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>

1
thirdparty/volk vendored Submodule

@ -0,0 +1 @@
Subproject commit be3dbd49bf77052665e96b6c7484af855e7e5f67