#define VK_OVERRIDE_LAYER_NAME "VK_LAYER_LUNARG_override"
struct loader_struct loader = {0};
-// TLS for instance for alloc/free callbacks
-THREAD_LOCAL_DECL struct loader_instance *tls_instance;
static size_t loader_platform_combine_path(char *dest, size_t len, ...);
return pNewMem;
}
-void *loader_instance_tls_heap_alloc(size_t size) {
- return loader_instance_heap_alloc(tls_instance, size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-}
-
-void loader_instance_tls_heap_free(void *pMemory) { loader_instance_heap_free(tls_instance, pMemory); }
-
void *loader_device_heap_alloc(const struct loader_device *device, size_t size, VkSystemAllocationScope alloc_scope) {
void *pMemory = NULL;
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
uint32_t copy_size;
VkResult res = VK_SUCCESS;
- // tls_instance = NULL;
+
memset(&local_ext_list, 0, sizeof(local_ext_list));
memset(&instance_layers, 0, sizeof(instance_layers));
VkLayerProperties *pProperties) {
VkResult result = VK_SUCCESS;
struct loader_layer_list instance_layer_list;
- tls_instance = NULL;
LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
// Global variables used across files
extern struct loader_struct loader;
-extern THREAD_LOCAL_DECL struct loader_instance *tls_instance;
extern loader_platform_thread_mutex loader_lock;
extern loader_platform_thread_mutex loader_json_lock;
extern loader_platform_thread_mutex loader_preload_icd_lock;
void loader_instance_heap_free(const struct loader_instance *instance, void *pMemory);
void *loader_instance_heap_realloc(const struct loader_instance *instance, void *pMemory, size_t orig_size, size_t size,
VkSystemAllocationScope alloc_scope);
-void *loader_instance_tls_heap_alloc(size_t size);
-void loader_instance_tls_heap_free(void *pMemory);
void *loader_device_heap_alloc(const struct loader_device *device, size_t size, VkSystemAllocationScope allocationScope);
void loader_device_heap_free(const struct loader_device *device, void *pMemory);
void *loader_device_heap_realloc(const struct loader_device *device, void *pMemory, size_t orig_size, size_t size,
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName,
uint32_t *pPropertyCount,
VkExtensionProperties *pProperties) {
- tls_instance = NULL;
LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
// We know we need to call at least the terminator
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
VkLayerProperties *pProperties) {
- tls_instance = NULL;
LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
// We know we need to call at least the terminator
}
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t *pApiVersion) {
- tls_instance = NULL;
LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
// We know we need to call at least the terminator
goto out;
}
- tls_instance = ptr_instance;
loader_platform_thread_lock_mutex(&loader_lock);
loaderLocked = true;
memset(ptr_instance, 0, sizeof(struct loader_instance));
// Threads:
typedef pthread_t loader_platform_thread;
-#define THREAD_LOCAL_DECL __thread
// The once init functionality is not used on Linux
#define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var)
// Threads:
typedef HANDLE loader_platform_thread;
-// __declspec(thread) is not supported by MinGW compiler (ignored with warning or
-// cause error depending on compiler switches)
-//
-// __thread should be used instead
-//
-// __MINGW32__ defined for both 32 and 64 bit MinGW compilers, so it is enough to
-// detect any (32 or 64) flavor of MinGW compiler.
-//
-// @note __GNUC__ could be used as a more generic way to detect _any_
-// GCC[-compatible] compiler on Windows, but this fix was tested
-// only with MinGW, so keep it explicit at the moment.
-#if defined(__MINGW32__)
-#define THREAD_LOCAL_DECL __thread
-#else
-#define THREAD_LOCAL_DECL __declspec(thread)
-#endif
-
// The once init functionality is not used when building a DLL on Windows. This is because there is no way to clean up the
// resources allocated by anything allocated by once init. This isn't a problem for static libraries, but it is for dynamic
// ones. When building a DLL, we use DllMain() instead to allow properly cleaning up resources.