Skip to content

Commit

Permalink
Add VK_BASALT_EXPORT
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-lunarg authored and DadSchoorse committed Mar 2, 2023
1 parent 2a515a9 commit 8dc9b3e
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions src/basalt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 41,12 @@

#define VKBASALT_NAME "VK_LAYER_VKBASALT_post_processing"

#if defined(__GNUC__) && __GNUC__ >= 4
#define VK_BASALT_EXPORT __attribute__((visibility("default")))
#else
#error "Unsupported platform!"
#endif

namespace vkBasalt
{
std::shared_ptr<Config> pConfig = nullptr;
Expand All @@ -67,9 73,9 @@ namespace vkBasalt
return *(void**) inst;
}

VK_LAYER_EXPORT VkResult VKAPI_CALL vkBasalt_CreateInstance(const VkInstanceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkInstance* pInstance)
VK_BASALT_EXPORT VkResult VKAPI_CALL vkBasalt_CreateInstance(const VkInstanceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkInstance* pInstance)
{
VkLayerInstanceCreateInfo* layerCreateInfo = (VkLayerInstanceCreateInfo*) pCreateInfo->pNext;

Expand Down Expand Up @@ -133,7 139,7 @@ namespace vkBasalt
return ret;
}

VK_LAYER_EXPORT void VKAPI_CALL vkBasalt_DestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator)
VK_BASALT_EXPORT void VKAPI_CALL vkBasalt_DestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator)
{
scoped_lock l(globalLock);

Expand All @@ -148,10 154,10 @@ namespace vkBasalt
instanceVersionMap.erase(GetKey(instance));
}

VK_LAYER_EXPORT VkResult VKAPI_CALL vkBasalt_CreateDevice(VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDevice* pDevice)
VK_BASALT_EXPORT VkResult VKAPI_CALL vkBasalt_CreateDevice(VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDevice* pDevice)
{
scoped_lock l(globalLock);
Logger::trace("vkCreateDevice");
Expand Down Expand Up @@ -283,7 289,7 @@ namespace vkBasalt
return VK_SUCCESS;
}

VK_LAYER_EXPORT void VKAPI_CALL vkBasalt_DestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator)
VK_BASALT_EXPORT void VKAPI_CALL vkBasalt_DestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator)
{
scoped_lock l(globalLock);

Expand Down Expand Up @@ -747,7 753,7 @@ namespace vkBasalt
///////////////////////////////////////////////////////////////////////////////////////////
// Enumeration function

VK_LAYER_EXPORT VkResult VKAPI_CALL vkBasalt_EnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties)
VK_BASALT_EXPORT VkResult VKAPI_CALL vkBasalt_EnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties)
{
if (pPropertyCount)
*pPropertyCount = 1;
Expand All @@ -763,16 769,16 @@ namespace vkBasalt
return VK_SUCCESS;
}

VK_LAYER_EXPORT VkResult VKAPI_CALL vkBasalt_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
uint32_t* pPropertyCount,
VkLayerProperties* pProperties)
VK_BASALT_EXPORT VkResult VKAPI_CALL vkBasalt_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
uint32_t* pPropertyCount,
VkLayerProperties* pProperties)
{
return vkBasalt_EnumerateInstanceLayerProperties(pPropertyCount, pProperties);
}

VK_LAYER_EXPORT VkResult VKAPI_CALL vkBasalt_EnumerateInstanceExtensionProperties(const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
VK_BASALT_EXPORT VkResult VKAPI_CALL vkBasalt_EnumerateInstanceExtensionProperties(const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
{
if (pLayerName == NULL || std::strcmp(pLayerName, VKBASALT_NAME))
{
Expand All @@ -787,10 793,10 @@ namespace vkBasalt
return VK_SUCCESS;
}

VK_LAYER_EXPORT VkResult VKAPI_CALL vkBasalt_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
VK_BASALT_EXPORT VkResult VKAPI_CALL vkBasalt_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
{
// pass through any queries that aren't to us
if (pLayerName == NULL || std::strcmp(pLayerName, VKBASALT_NAME))
Expand All @@ -817,8 823,8 @@ namespace vkBasalt
extern "C"
{ // these are the entry points for the layer, so they need to be c-linkeable

VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI_CALL vkBasalt_GetDeviceProcAddr(VkDevice device, const char* pName);
VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI_CALL vkBasalt_GetInstanceProcAddr(VkInstance instance, const char* pName);
VK_BASALT_EXPORT PFN_vkVoidFunction VKAPI_CALL vkBasalt_GetDeviceProcAddr(VkDevice device, const char* pName);
VK_BASALT_EXPORT PFN_vkVoidFunction VKAPI_CALL vkBasalt_GetInstanceProcAddr(VkInstance instance, const char* pName);

#define GETPROCADDR(func) \
if (!std::strcmp(pName, "vk" #func)) \
Expand Down Expand Up @@ -857,7 863,7 @@ extern "C"
GETPROCADDR(BindImageMemory); \
}

VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI_CALL vkBasalt_GetDeviceProcAddr(VkDevice device, const char* pName)
VK_BASALT_EXPORT PFN_vkVoidFunction VKAPI_CALL vkBasalt_GetDeviceProcAddr(VkDevice device, const char* pName)
{
if (vkBasalt::pConfig == nullptr)
{
Expand All @@ -872,7 878,7 @@ extern "C"
}
}

VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI_CALL vkBasalt_GetInstanceProcAddr(VkInstance instance, const char* pName)
VK_BASALT_EXPORT PFN_vkVoidFunction VKAPI_CALL vkBasalt_GetInstanceProcAddr(VkInstance instance, const char* pName)
{
if (vkBasalt::pConfig == nullptr)
{
Expand Down

0 comments on commit 8dc9b3e

Please sign in to comment.