1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-22 18:28:52 -05:00

Add _GLFW_VULKAN_STATIC build macro

This allows clients to link GLFW with a staticly-built loader library.
This is useful in hermetic build systems that build the Khronos loader
from source, rather than depending on the LunarG SDK binaries.

Closes #820.
This commit is contained in:
Philip Rideout 2016-08-03 11:20:30 -07:00 committed by Camilla Berglund
parent d3775b973e
commit 8bdb105897
2 changed files with 17 additions and 6 deletions

View File

@ -149,11 +149,16 @@ typedef struct VkExtensionProperties
} VkExtensionProperties;
typedef void (APIENTRY * PFN_vkVoidFunction)(void);
typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*);
typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*);
#define vkEnumerateInstanceExtensionProperties _glfw.vk.EnumerateInstanceExtensionProperties
#define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr
#if defined(_GLFW_VULKAN_STATIC)
PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance,const char*);
VkResult vkEnumerateInstanceExtensionProperties(const char*,uint32_t*,VkExtensionProperties*);
#else
typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*);
typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*);
#define vkEnumerateInstanceExtensionProperties _glfw.vk.EnumerateInstanceExtensionProperties
#define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr
#endif
#if defined(_GLFW_COCOA)
#include "cocoa_platform.h"
@ -445,8 +450,10 @@ struct _GLFWlibrary
void* handle;
char** extensions;
uint32_t extensionCount;
PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
#if !defined(_GLFW_VULKAN_STATIC)
PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
#endif
GLFWbool KHR_surface;
GLFWbool KHR_win32_surface;
GLFWbool KHR_xlib_surface;

View File

@ -41,6 +41,8 @@ GLFWbool _glfwInitVulkan(void)
VkResult err;
VkExtensionProperties* ep;
uint32_t i, count;
#if !defined(_GLFW_VULKAN_STATIC)
#if defined(_GLFW_WIN32)
const char* name = "vulkan-1.dll";
#else
@ -79,6 +81,8 @@ GLFWbool _glfwInitVulkan(void)
return GLFW_FALSE;
}
#endif // _GLFW_VULKAN_STATIC
err = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL);
if (err)
{