Adding extra changes to make kompute work with older version of vulkan
This commit is contained in:
parent
ec2ca803d3
commit
ce07b33c28
4 changed files with 89 additions and 25 deletions
|
|
@ -264,17 +264,17 @@ Algorithm::createPipeline(std::vector<uint32_t> specializationData)
|
|||
&pipelineCacheInfo, nullptr, this->mPipelineCache.get());
|
||||
this->mFreePipelineCache = true;
|
||||
|
||||
vk::ResultValue<vk::Pipeline> pipelineResult =
|
||||
vk::Pipeline pipelineResult =
|
||||
this->mDevice->createComputePipeline(*this->mPipelineCache, pipelineInfo);
|
||||
this->mFreePipeline = true;
|
||||
|
||||
if (pipelineResult.result != vk::Result::eSuccess) {
|
||||
throw std::runtime_error("Failed to create pipeline result: " +
|
||||
vk::to_string(pipelineResult.result));
|
||||
}
|
||||
//if (pipelineResult.result != vk::Result::eSuccess) {
|
||||
// throw std::runtime_error("Failed to create pipeline result: " +
|
||||
// vk::to_string(pipelineResult.result));
|
||||
//}
|
||||
|
||||
this->mFreePipeline = true;
|
||||
this->mPipeline = std::make_shared<vk::Pipeline>(pipelineResult.value);
|
||||
this->mPipeline = std::make_shared<vk::Pipeline>(pipelineResult);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -5,7 +5,13 @@ if(KOMPUTE_OPT_ENABLE_SPDLOG)
|
|||
find_package(fmt REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Vulkan REQUIRED)
|
||||
if(KOMPUTE_OPT_ANDOID_BUILD)
|
||||
find_library(android android)
|
||||
endif()
|
||||
|
||||
if(NOT KOMPUTE_OPT_ANDOID_BUILD)
|
||||
find_package(Vulkan REQUIRED)
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_BUILD_SHADERS)
|
||||
# all shaders are compiled into cpp files
|
||||
|
|
@ -23,8 +29,33 @@ file(GLOB kompute_CPP
|
|||
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
|
||||
)
|
||||
|
||||
if(KOMPUTE_OPT_ANDOID_BUILD)
|
||||
set(ANDROID_APP_GLUE_DIR ${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
set(VK_ANDROID_COMMON_DIR ${ANDROID_NDK}/sources/third_party/vulkan/src/common)
|
||||
set(VK_ANDROID_PATCH_DIR ${PROJECT_SOURCE_DIR}/vulkan_ndk_patch_include/)
|
||||
set(VK_ANDROID_INCLUDE_DIR ${ANDROID_NDK}/sources/third_party/vulkan/src/include)
|
||||
|
||||
include_directories(
|
||||
${ANDROID_APP_GLUE_DIR}
|
||||
${VK_ANDROID_COMMON_DIR}
|
||||
${VK_ANDROID_PATCH_DIR}
|
||||
${VK_ANDROID_INCLUDE_DIR})
|
||||
|
||||
add_library(android_app_glue STATIC
|
||||
${ANDROID_APP_GLUE_DIR}/android_native_app_glue.c)
|
||||
|
||||
#add_library(android_vulkan_wrapper STATIC
|
||||
# ${VK_ANDROID_COMMON_DIR}/vulkan_wrapper.cpp)
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_BUILD_SINGLE_HEADER)
|
||||
add_library(kompute
|
||||
${kompute_CPP})
|
||||
endif()
|
||||
|
||||
add_library(kompute
|
||||
${kompute_CPP})
|
||||
${kompute_CPP}
|
||||
${PROJECT_SOURCE_DIR}/vulkan_ndk_patch_include/kompute_vulkan_wrapper.cpp)
|
||||
|
||||
target_include_directories(
|
||||
kompute PUBLIC
|
||||
|
|
@ -32,10 +63,17 @@ target_include_directories(
|
|||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
kompute
|
||||
Vulkan::Vulkan
|
||||
)
|
||||
if(NOT KOMPUTE_OPT_ANDOID_BUILD)
|
||||
target_link_libraries(
|
||||
kompute
|
||||
Vulkan::Vulkan
|
||||
)
|
||||
else()
|
||||
target_link_libraries(
|
||||
kompute
|
||||
"libvulkan.so"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_ENABLE_SPDLOG)
|
||||
target_link_libraries(
|
||||
|
|
@ -45,6 +83,15 @@ if(KOMPUTE_OPT_ENABLE_SPDLOG)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_ANDOID_BUILD)
|
||||
target_link_libraries(
|
||||
kompute
|
||||
android_app_glue
|
||||
log
|
||||
android
|
||||
)
|
||||
endif()
|
||||
|
||||
if(KOMPUTE_OPT_BUILD_SHADERS)
|
||||
add_dependencies(kompute
|
||||
build_shaders)
|
||||
|
|
@ -57,18 +104,20 @@ endif()
|
|||
|
||||
add_library(kompute::kompute ALIAS kompute)
|
||||
|
||||
install(TARGETS kompute EXPORT KomputeTargets
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
INCLUDES DESTINATION include)
|
||||
if(KOMPUTE_OPT_INSTALL)
|
||||
install(TARGETS kompute EXPORT KomputeTargets
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
INCLUDES DESTINATION include)
|
||||
|
||||
install(DIRECTORY include/ DESTINATION include)
|
||||
install(DIRECTORY include/ DESTINATION include)
|
||||
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/single_include/
|
||||
DESTINATION include)
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/single_include/
|
||||
DESTINATION include)
|
||||
|
||||
install(EXPORT KomputeTargets
|
||||
FILE komputeConfig.cmake
|
||||
NAMESPACE kompute::
|
||||
DESTINATION lib/cmake/kompute)
|
||||
install(EXPORT KomputeTargets
|
||||
FILE komputeConfig.cmake
|
||||
NAMESPACE kompute::
|
||||
DESTINATION lib/cmake/kompute)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ Manager::createInstance()
|
|||
vk::ApplicationInfo applicationInfo;
|
||||
applicationInfo.pApplicationName = "Vulkan Kompute";
|
||||
applicationInfo.pEngineName = "VulkanKompute";
|
||||
applicationInfo.apiVersion = VK_API_VERSION_1_2;
|
||||
applicationInfo.apiVersion = VK_API_VERSION_1_1;
|
||||
|
||||
std::vector<const char*> applicationExtensions;
|
||||
applicationExtensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
#include <android/log.h>
|
||||
#include <android_native_app_glue.h>
|
||||
#endif
|
||||
|
||||
//#define VK_NO_PROTOTYPES 1
|
||||
//#undef VK_NO_PROTOTYPES
|
||||
#undef DEBUG
|
||||
#ifndef RELEASE
|
||||
#define RELEASE 1
|
||||
#endif
|
||||
//#define USE_DEBUG_EXTENTIONS
|
||||
//#include <kompute_vulkan_wrapper.hpp>
|
||||
|
||||
//#undef VK_NO_PROTOTYPES
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
// SPDLOG_ACTIVE_LEVEL must be defined before spdlog.h import
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue