remove references to $VULKAN_SDK_SRC, delete not-needed loader patch

This commit is contained in:
baldurk
2015-12-31 22:51:40 +01:00
parent c4c002703e
commit 685f48a55f
2 changed files with 2 additions and 100 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ MACROS=-DLINUX \
CFLAGS=-c -Wall -Werror -Wno-unused -Wno-unknown-pragmas -fPIC $(MACROS) -I. -I3rdparty/
CPPFLAGS=-std=c++11 -g -Wno-reorder -fvisibility=hidden -fvisibility-inlines-hidden
LDFLAGS=-lpthread -lrt -shared -ldl -lX11 -lxcb-keysyms
LIBS=driver/gl/rdoc_gl.a driver/vulkan/rdoc_vulkan.a driver/shaders/spirv/rdoc_spirv.a $(VULKAN_SDK_SRC)/build/layers/liblayer_utils.so
LIBS=driver/gl/rdoc_gl.a driver/vulkan/rdoc_vulkan.a driver/shaders/spirv/rdoc_spirv.a
OBJDIR=.obj
OBJECTS=replay/replay_output.o \
replay/replay_renderer.o \
@@ -134,7 +134,7 @@ force_look:
true
librenderdoc.so: $(OBJDIR_OBJECTS) $(OBJDIR_DATA) $(LIBS)
$(CPP) -o librenderdoc.so $(OBJDIR_DATA) -Wl,--whole-archive $(LIBS) -Wl,--no-whole-archive $(OBJDIR_OBJECTS) $(LDFLAGS) -Wl,-rpath,$(VULKAN_SDK_SRC)/build/layers
$(CPP) -o librenderdoc.so $(OBJDIR_DATA) -Wl,--whole-archive $(LIBS) -Wl,--no-whole-archive $(OBJDIR_OBJECTS) $(LDFLAGS)
.PHONY: clean
clean:
@@ -1,98 +0,0 @@
diff --git a/loader/loader.c b/loader/loader.c
index 936ca97..e4ba0a0 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -741,7 +741,7 @@ static struct loader_icd *loader_get_icd_and_device(const VkDevice device,
for (struct loader_instance *inst = loader.instances; inst; inst = inst->next) {
for (struct loader_icd *icd = inst->icds; icd; icd = icd->next) {
for (struct loader_device *dev = icd->logical_device_list; dev; dev = dev->next)
- if (dev->device == device) {
+ if (loader_get_dispatch(dev->device) == loader_get_dispatch(device)) {
*found_dev = dev;
return icd;
}
@@ -1789,7 +1789,11 @@ struct loader_icd * loader_get_icd(const VkPhysicalDevice gpu, uint32_t *gpu_ind
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) {
+ /* Value comparison of VkPhysicalDevice prevents wrapping, use
+ * instance device table instead (TODO this aliases GPUs within
+ * an instance, since they have identical dispatch tables)
+ */
+ if (loader_get_instance_dispatch(icd->gpus[i]) == loader_get_instance_dispatch(gpu)) {
*gpu_index = i;
return icd;
}
@@ -2574,7 +2578,7 @@ VkResult VKAPI loader_GetPhysicalDeviceProperties(
VkResult res = VK_ERROR_INITIALIZATION_FAILED;
if (icd->GetPhysicalDeviceProperties)
- res = icd->GetPhysicalDeviceProperties(gpu, pProperties);
+ res = icd->GetPhysicalDeviceProperties(icd->gpus[gpu_index], pProperties);
return res;
}
@@ -2588,7 +2592,7 @@ VkResult VKAPI loader_GetPhysicalDeviceQueueCount(
VkResult res = VK_ERROR_INITIALIZATION_FAILED;
if (icd->GetPhysicalDeviceQueueCount)
- res = icd->GetPhysicalDeviceQueueCount(gpu, pCount);
+ res = icd->GetPhysicalDeviceQueueCount(icd->gpus[gpu_index], pCount);
return res;
}
@@ -2603,7 +2607,7 @@ VkResult VKAPI loader_GetPhysicalDeviceQueueProperties (
VkResult res = VK_ERROR_INITIALIZATION_FAILED;
if (icd->GetPhysicalDeviceQueueProperties)
- res = icd->GetPhysicalDeviceQueueProperties(gpu, count, pProperties);
+ res = icd->GetPhysicalDeviceQueueProperties(icd->gpus[gpu_index], count, pProperties);
return res;
}
@@ -2617,7 +2621,7 @@ VkResult VKAPI loader_GetPhysicalDeviceMemoryProperties (
VkResult res = VK_ERROR_INITIALIZATION_FAILED;
if (icd->GetPhysicalDeviceMemoryProperties)
- res = icd->GetPhysicalDeviceMemoryProperties(gpu, pProperties);
+ res = icd->GetPhysicalDeviceMemoryProperties(icd->gpus[gpu_index], pProperties);
return res;
}
@@ -2764,7 +2768,7 @@ VkResult VKAPI loader_CreateDevice(
}
}
- res = icd->CreateDevice(gpu, pCreateInfo, pDevice);
+ res = icd->CreateDevice(icd->gpus[gpu_index], pCreateInfo, pDevice);
if (res != VK_SUCCESS) {
return res;
}
diff --git a/loader/trampoline.c b/loader/trampoline.c
index 2224ce2..8e5846e 100644
--- a/loader/trampoline.c
+++ b/loader/trampoline.c
@@ -144,9 +144,21 @@ LOADER_EXPORT VkResult VKAPI vkDestroyInstance(
loader_platform_thread_lock_mutex(&loader_lock);
+ struct loader_instance *ptr_instance = NULL;
+
+ /* look up the loader_instance in our list by comparing dispatch tables, as
+ * there is no guarantee the instance is still a loader_instance* after any
+ * layers.
+ */
+ for (struct loader_instance *inst = loader.instances; inst; inst = inst->next) {
+ if (inst->disp == disp) {
+ ptr_instance = inst;
+ break;
+ }
+ }
+
res = disp->DestroyInstance(instance);
- struct loader_instance *ptr_instance = loader_instance(instance);
loader_deactivate_instance_layers(ptr_instance);
free(ptr_instance);