Permalink
Browse files

Remove VULKAN_STATIC

  • Loading branch information...
myfreeweb committed Dec 26, 2017
1 parent f4d76c8 commit 52234dae91524d98b05780aee498a28a7e90a587
Showing with 0 additions and 41 deletions.
  1. +0 −23 CMakeLists.txt
  2. +0 −15 Common/Vulkan/VulkanLoader.cpp
  3. +0 −3 Common/Vulkan/VulkanLoader.h
View
@@ -76,25 +76,6 @@ else()
add_definitions(-DNO_VULKAN)
endif()
if(NOT ANDROID)
# Use FindVulkan module added with CMAKE 3.7
if (NOT CMAKE_VERSION VERSION_LESS 3.7.0)
message(STATUS "Using module to find Vulkan")
find_package(Vulkan)
endif()
endif()
if(VULKAN AND NOT WIN32 AND NOT ANDROID)
IF (NOT Vulkan_FOUND)
find_library(Vulkan_LIBRARY NAMES vulkan HINTS "$ENV{VULKAN_SDK}/lib" "${CMAKE_SOURCE_DIR}/ext/vulkan" REQUIRED)
IF (Vulkan_LIBRARY)
set(Vulkan_FOUND ON)
MESSAGE("Using bundled Vulkan library version")
add_definitions(-DVULKAN_STATIC)
ENDIF()
ENDIF()
endif()
if(NOT DEFINED HEADLESS)
set(HEADLESS OFF)
endif()
@@ -1676,10 +1657,6 @@ set(GlslangLibs glslang OGLCompiler OSDependent SPIRV SPVRemapper spirv-cross-gl
target_link_libraries(${CoreLibName} Common native kirk cityhash sfmt19937 xbrz xxhash ${GlslangLibs}
${CoreExtraLibs} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_DL_LIBS})
if(VULKAN AND NOT ANDROID AND NOT WIN32)
target_link_libraries(${CoreLibName} ${Vulkan_LIBRARY})
endif()
if(FFmpeg_FOUND)
target_compile_definitions(${CoreLibName} PRIVATE USE_FFMPEG=1)
target_link_libraries(${CoreLibName}
@@ -23,8 +23,6 @@
#include <dlfcn.h>
#endif
#ifndef VULKAN_STATIC
PFN_vkCreateInstance vkCreateInstance;
PFN_vkDestroyInstance vkDestroyInstance;
PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices;
@@ -187,7 +185,6 @@ PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR;
PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR;
PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR;
PFN_vkQueuePresentKHR vkQueuePresentKHR;
#endif
// And the DEBUG_REPORT extension. We dynamically load this.
PFN_vkCreateDebugReportCallbackEXT dyn_vkCreateDebugReportCallbackEXT;
@@ -211,9 +208,6 @@ static const char *so_names[] = {
};
bool VulkanMayBeAvailable() {
#ifdef VULKAN_STATIC
return true;
#else
if (vulkanLibrary)
return true;
bool available = false;
@@ -235,11 +229,9 @@ bool VulkanMayBeAvailable() {
}
#endif
return available;
#endif
}
bool VulkanLoad() {
#ifndef VULKAN_STATIC
if (!vulkanLibrary) {
#ifndef _WIN32
for (int i = 0; i < ARRAY_SIZE(so_names); i++) {
@@ -264,12 +256,10 @@ bool VulkanLoad() {
LOAD_GLOBAL_FUNC(vkEnumerateInstanceLayerProperties);
WLOG("Vulkan base functions loaded.");
#endif
return true;
}
void VulkanLoadInstanceFunctions(VkInstance instance) {
#ifndef VULKAN_STATIC
// OK, let's use the above functions to get the rest.
LOAD_INSTANCE_FUNC(instance, vkDestroyInstance);
LOAD_INSTANCE_FUNC(instance, vkEnumeratePhysicalDevices);
@@ -428,7 +418,6 @@ void VulkanLoadInstanceFunctions(VkInstance instance) {
#endif
LOAD_INSTANCE_FUNC(instance, vkDestroySurfaceKHR);
#endif
dyn_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT");
dyn_vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT");
@@ -441,18 +430,15 @@ void VulkanLoadInstanceFunctions(VkInstance instance) {
// good for multi-device.
void VulkanLoadDeviceFunctions(VkDevice device) {
WLOG("Vulkan device functions loaded.");
#ifndef VULKAN_STATIC
// TODO: Move more functions VulkanLoadInstanceFunctions to here.
LOAD_DEVICE_FUNC(device, vkCreateSwapchainKHR);
LOAD_DEVICE_FUNC(device, vkDestroySwapchainKHR);
LOAD_DEVICE_FUNC(device, vkGetSwapchainImagesKHR);
LOAD_DEVICE_FUNC(device, vkAcquireNextImageKHR);
LOAD_DEVICE_FUNC(device, vkQueuePresentKHR);
#endif
}
void VulkanFree() {
#ifndef VULKAN_STATIC
if (vulkanLibrary) {
#ifdef _WIN32
FreeLibrary(vulkanLibrary);
@@ -461,5 +447,4 @@ void VulkanFree() {
#endif
vulkanLibrary = nullptr;
}
#endif
}
@@ -25,13 +25,10 @@
#define NOMINMAX
#endif
#ifndef VULKAN_STATIC
#define VK_NO_PROTOTYPES
#endif
#include "ext/vulkan/vulkan.h"
#ifndef VULKAN_STATIC
extern PFN_vkCreateInstance vkCreateInstance;
extern PFN_vkDestroyInstance vkDestroyInstance;
extern PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices;

0 comments on commit 52234da

Please sign in to comment.