Browse Source

Link against volk

Panagiotis Christopoulos Charitos 6 years ago
parent
commit
305c8eded3
4 changed files with 16 additions and 9 deletions
  1. 6 7
      CMakeLists.txt
  2. 1 1
      src/anki/gr/vulkan/Common.h
  3. 8 0
      src/anki/gr/vulkan/GrManagerImpl.cpp
  4. 1 1
      thirdparty

+ 6 - 7
CMakeLists.txt

@@ -230,6 +230,10 @@ if(ANKI_BUILD_TOOLS)
 	set(ANKI_EXTERN_SUB_DIRS ${ANKI_EXTERN_SUB_DIRS} assimp)
 endif()
 
+if(VULKAN)
+	set(ANKI_EXTERN_SUB_DIRS ${ANKI_EXTERN_SUB_DIRS} volk)
+endif()
+
 # SDL
 if(SDL)
 	message("++ Configuring SDL2")
@@ -369,7 +373,7 @@ if(LINUX)
 	if(GL)
 		set(THIRD_PARTY_LIBS ${ANKI_GR_BACKEND} ankiglew)
 	else()
-		set(THIRD_PARTY_LIBS vulkan)
+		set(THIRD_PARTY_LIBS ankivolk)
 		if(SDL)
 			set(THIRD_PARTY_LIBS ${THIRD_PARTY_LIBS} X11-xcb)
 		else()
@@ -389,12 +393,7 @@ elseif(WINDOWS)
 	if(GL)
 		set(THIRD_PARTY_LIBS ${THIRD_PARTY_LIBS} ankiglew opengl32)
 	else()
-		if(NOT DEFINED ENV{VULKAN_SDK})
-			message(FATAL_ERROR "You need to have VULKAN SDK installed and the VULKAN_SDK env variable set")
-		endif()
-
-		link_directories($ENV{VULKAN_SDK}/Lib)
-		set(THIRD_PARTY_LIBS vulkan-1)
+		set(THIRD_PARTY_LIBS ${THIRD_PARTY_LIBS} ankivolk)
 	endif()
 
 	set(THIRD_PARTY_LIBS ${THIRD_PARTY_LIBS} version Imm32 Winmm DbgHelp)

+ 1 - 1
src/anki/gr/vulkan/Common.h

@@ -14,7 +14,7 @@
 #else
 #	error TODO
 #endif
-#include <vulkan/vulkan.h>
+#include <volk/volk.h>
 #include <anki/util/CleanupWindows.h> // Clean global namespace
 
 namespace anki

+ 8 - 0
src/anki/gr/vulkan/GrManagerImpl.cpp

@@ -215,6 +215,10 @@ Error GrManagerImpl::initInternal(const GrManagerInitInfo& init)
 
 Error GrManagerImpl::initInstance(const GrManagerInitInfo& init)
 {
+	// Init VOLK
+	//
+	ANKI_VK_CHECK(volkInitialize());
+
 	// Create the instance
 	//
 	const U32 vulkanMinor = init.m_config->getNumber("gr.vkminor");
@@ -349,6 +353,10 @@ Error GrManagerImpl::initInstance(const GrManagerInitInfo& init)
 
 	ANKI_VK_CHECK(vkCreateInstance(&ci, pallocCbs, &m_instance));
 
+	// Get symbolx
+	//
+	volkLoadInstance(m_instance);
+
 	// Set debug callbacks
 	//
 	if(!!(m_extensions & VulkanExtensions::EXT_DEBUG_REPORT))

+ 1 - 1
thirdparty

@@ -1 +1 @@
-Subproject commit 1b6ed99944f741db13dedc24f3a0c31c6ce3e318
+Subproject commit f4fb04302a80b070aecace1af4d0f5f6595b4400