aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Young <marky@lunarg.com>2017-06-15 08:36:58 -0600
committerMark Young <marky@lunarg.com>2017-06-15 08:36:58 -0600
commit7fb7b2917ef98618aef31a611b281b66d698543f (patch)
tree24efdbfade57be0f0ab59303b7f25abe4a023590
parent723159cb0eac837be4275d1a3e1fc0e0f5045b6f (diff)
downloadusermoji-7fb7b2917ef98618aef31a611b281b66d698543f.tar.xz
loader: Fix alloc issue
We were allocating the wrong struct for the dispatch table object when creating the instance. This left us using invalid memory when using the physical device extension trampolines. Change-Id: I9939a8c9fe320b0d07592ab4beb5b6faaba40383
-rw-r--r--loader/trampoline.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/loader/trampoline.c b/loader/trampoline.c
index 1afe4455..b03ebda6 100644
--- a/loader/trampoline.c
+++ b/loader/trampoline.c
@@ -307,16 +307,16 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr
goto out;
}
- ptr_instance->disp =
- loader_instance_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
+ ptr_instance->disp = loader_instance_heap_alloc(ptr_instance, sizeof(struct loader_instance_dispatch_table),
+ VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (ptr_instance->disp == NULL) {
loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
- "vkCreateInstance: Failed to allocate Instance dispatch"
- " table.");
+ "vkCreateInstance: Failed to allocate Loader's full Instance dispatch table.");
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
- memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
+ memcpy(&ptr_instance->disp->layer_inst_disp, &instance_disp, sizeof(instance_disp));
+
ptr_instance->next = loader.instances;
loader.instances = ptr_instance;