aboutsummaryrefslogtreecommitdiff
path: root/loader/loader.c
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2015-04-08 21:33:34 -0600
committerChia-I Wu <olv@lunarg.com>2015-04-16 17:48:19 +0800
commita65963a5c7edcfd5e44f8d5102e8379ba86916ec (patch)
tree4d931bb5a34a6ec5b6cb77001f7f627d7b2a8227 /loader/loader.c
parent17cef59f95e4ffa518740c575dc18d59a4007fad (diff)
downloadusermoji-a65963a5c7edcfd5e44f8d5102e8379ba86916ec.tar.xz
layers: Remove wrapping of GPU objects by loader and layers
Loader only wraps GPU objects for creating a layer chain. After layer activation layers and loader use unwrapped gpu object returned by the driver. This is a large simplification. This fixes a nasty bug where layers intercepting entrypoints with gpu objects but not all these entrypoints would fail. These would cause non-uniform unwrapping of gpu objects by the time the driver was called with a gpu object. Fixes issue in loader_get_icd where it was trying to compare a wrapped GPU against a non-wrapped GPU.
Diffstat (limited to 'loader/loader.c')
-rw-r--r--loader/loader.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/loader/loader.c b/loader/loader.c
index 648a2584..dc053761 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -520,11 +520,16 @@ static void loader_init_dispatch_table(VkLayerDispatchTable *tab, PFN_vkGetProcA
extern struct loader_icd * loader_get_icd(const VkBaseLayerObject *gpu, uint32_t *gpu_index)
{
+ /*
+ * NOTE: at this time icd->gpus is pointing to wrapped GPUs, but no where else
+ * are wrapped gpus used. Should go away. The incoming gpu is NOT wrapped so
+ * need to test it against the wrapped GPU's base object.
+ */
for (struct loader_instance *inst = loader.instances; inst; inst = inst->next) {
for (struct loader_icd *icd = inst->icds; icd; icd = icd->next) {
for (uint32_t i = 0; i < icd->gpu_count; i++)
if ((icd->gpus + i) == gpu || (icd->gpus +i)->baseObject ==
- gpu->baseObject) {
+ gpu) {
*gpu_index = i;
return icd;
}
@@ -1000,7 +1005,7 @@ LOADER_EXPORT VkResult VKAPI vkEnumerateGpus(
(wrapped_gpus + i)->baseObject = gpus[i];
(wrapped_gpus + i)->pGPA = get_proc_addr;
(wrapped_gpus + i)->nextObject = gpus[i];
- memcpy(pGpus + count, &wrapped_gpus, sizeof(*pGpus));
+ memcpy(pGpus + count, gpus, sizeof(*pGpus));
loader_init_dispatch_table(icd->loader_dispatch + i,
get_proc_addr, gpus[i]);