loader: Fixes for ICD vk{Create|Destroy}SurfaceKHR
Need to keep VkIcdSurface private to the loader.
The definition may conflict with some redefinitions of
VK_DEFINE_NON_DISPATCHABLE_HANDLE and it's not necessary to make public
anyway.
Change-Id: I30e166f0ecce2fd3ea36c745dc073b705973d75f
diff --git a/include/vulkan/vk_icd.h b/include/vulkan/vk_icd.h
index 39442fb..c26d1f7 100644
--- a/include/vulkan/vk_icd.h
+++ b/include/vulkan/vk_icd.h
@@ -122,30 +122,4 @@
VkExtent2D imageExtent;
} VkIcdSurfaceDisplay;
-typedef struct {
- union {
-#ifdef VK_USE_PLATFORM_MIR_KHR
- VkIcdSurfaceMir mir_surf;
-#endif // VK_USE_PLATFORM_MIR_KHR
-#ifdef VK_USE_PLATFORM_WAYLAND_KHR
- VkIcdSurfaceWayland wayland_surf;
-#endif // VK_USE_PLATFORM_WAYLAND_KHR
-#ifdef VK_USE_PLATFORM_WIN32_KHR
- VkIcdSurfaceWin32 win_surf;
-#endif // VK_USE_PLATFORM_WIN32_KHR
-#ifdef VK_USE_PLATFORM_XCB_KHR
- VkIcdSurfaceXcb xcb_surf;
-#endif // VK_USE_PLATFORM_XCB_KHR
-#ifdef VK_USE_PLATFORM_XLIB_KHR
- VkIcdSurfaceXlib xlib_surf;
-#endif // VK_USE_PLATFORM_XLIB_KHR
- VkIcdSurfaceDisplay display_surf;
- };
- uint32_t base_size; // Size of VkIcdSurfaceBase
- uint32_t platform_size; // Size of corresponding VkIcdSurfaceXXX
- uint32_t non_platform_offset; // Start offset to base_size
- uint32_t entire_size; // Size of entire VkIcdSurface
- VkSurfaceKHR *real_icd_surfaces;
-} VkIcdSurface;
-
#endif // VKICD_H
diff --git a/loader/loader.c b/loader/loader.c
index 6abd432..641be74 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -3244,7 +3244,7 @@
}
-static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
loader_gpa_device_internal(VkDevice device, const char *pName) {
struct loader_device *dev;
struct loader_icd *icd = loader_get_icd_and_device(device, &dev, NULL);
diff --git a/loader/loader.h b/loader/loader.h
index a65f489..060e02e 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -511,6 +511,7 @@
uint32_t *icd_index);
void loader_init_dispatch_dev_ext(struct loader_instance *inst,
struct loader_device *dev);
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpa_device_internal(VkDevice device, const char *pName);
void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName);
void *loader_get_dev_ext_trampoline(uint32_t index);
struct loader_instance *loader_get_instance(const VkInstance instance);
diff --git a/loader/trampoline.c b/loader/trampoline.c
index 98b1e40..a26847d 100644
--- a/loader/trampoline.c
+++ b/loader/trampoline.c
@@ -721,7 +721,7 @@
* dedicated trampoline code for these*/
loader_init_device_extension_dispatch_table(
&dev->loader_dispatch,
- dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
+ loader_gpa_device_internal, *pDevice);
out:
diff --git a/loader/wsi.c b/loader/wsi.c
index d38085d..123a7f8 100644
--- a/loader/wsi.c
+++ b/loader/wsi.c
@@ -221,7 +221,7 @@
struct loader_icd *icd = &ptr_instance->icds[i];
if (NULL != icd->DestroySurfaceKHR &&
NULL != (void *)icd_surface->real_icd_surfaces[i]) {
- icd->DestroySurfaceKHR(instance,
+ icd->DestroySurfaceKHR(icd->instance,
icd_surface->real_icd_surfaces[i],
pAllocator);
icd_surface->real_icd_surfaces[i] = (VkSurfaceKHR)NULL;
@@ -490,7 +490,6 @@
uint32_t icd_index = 0;
struct loader_device *dev;
struct loader_icd *icd = loader_get_icd_and_device(device, &dev, &icd_index);
- PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
if (NULL != icd &&
NULL != icd->CreateSwapchainKHR) {
// Android doesn't have to worry about multiple ICD scenario, but the rest do.
@@ -506,7 +505,7 @@
if (NULL == pCreateCopy) {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
- memcpy(pCreateCopy, pCreateInfo, sizeof(VkIcdSurface));
+ memcpy(pCreateCopy, pCreateInfo, sizeof(VkSwapchainCreateInfoKHR));
pCreateCopy->surface =
icd_surface->real_icd_surfaces[icd_index];
return icd->CreateSwapchainKHR(device, pCreateCopy, pAllocator, pSwapchain);
@@ -631,7 +630,7 @@
struct loader_icd *icd = &ptr_instance->icds[i];
if (NULL != icd->CreateWin32SurfaceKHR) {
vkRes = icd->CreateWin32SurfaceKHR(
- instance, pCreateInfo, pAllocator,
+ icd->instance, pCreateInfo, pAllocator,
&pIcdSurface->real_icd_surfaces[i]);
if (VK_SUCCESS != vkRes) {
goto out;
@@ -651,7 +650,7 @@
if (NULL != pIcdSurface->real_icd_surfaces[i] &&
NULL != icd->DestroySurfaceKHR) {
icd->DestroySurfaceKHR(
- instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
+ icd->instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
}
}
loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces);
@@ -775,7 +774,7 @@
struct loader_icd *icd = &ptr_instance->icds[i];
if (NULL != icd->CreateMirSurfaceKHR) {
vkRes = icd->CreateMirSurfaceKHR(
- instance, pCreateInfo, pAllocator,
+ icd->instance, pCreateInfo, pAllocator,
&pIcdSurface->real_icd_surfaces[i]);
if (VK_SUCCESS != vkRes) {
goto out;
@@ -795,7 +794,7 @@
if (NULL != pIcdSurface->real_icd_surfaces[i] &&
NULL != icd->DestroySurfaceKHR) {
icd->DestroySurfaceKHR(
- instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
+ icd->instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
}
}
loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces);
@@ -922,7 +921,7 @@
struct loader_icd *icd = &ptr_instance->icds[i];
if (NULL != icd->CreateWaylandSurfaceKHR) {
vkRes = icd->CreateWaylandSurfaceKHR(
- instance, pCreateInfo, pAllocator,
+ icd->instance, pCreateInfo, pAllocator,
&pIcdSurface->real_icd_surfaces[i]);
if (VK_SUCCESS != vkRes) {
goto out;
@@ -942,7 +941,7 @@
if (NULL != pIcdSurface->real_icd_surfaces[i] &&
NULL != icd->DestroySurfaceKHR) {
icd->DestroySurfaceKHR(
- instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
+ icd->instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
}
}
loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces);
@@ -1070,7 +1069,7 @@
struct loader_icd *icd = &ptr_instance->icds[i];
if (NULL != icd->CreateXcbSurfaceKHR) {
vkRes = icd->CreateXcbSurfaceKHR(
- instance, pCreateInfo, pAllocator,
+ icd->instance, pCreateInfo, pAllocator,
&pIcdSurface->real_icd_surfaces[i]);
if (VK_SUCCESS != vkRes) {
goto out;
@@ -1090,7 +1089,7 @@
if (NULL != pIcdSurface->real_icd_surfaces[i] &&
NULL != icd->DestroySurfaceKHR) {
icd->DestroySurfaceKHR(
- instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
+ icd->instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
}
}
loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces);
@@ -1217,7 +1216,7 @@
struct loader_icd *icd = &ptr_instance->icds[i];
if (NULL != icd->CreateXlibSurfaceKHR) {
vkRes = icd->CreateXlibSurfaceKHR(
- instance, pCreateInfo, pAllocator,
+ icd->instance, pCreateInfo, pAllocator,
&pIcdSurface->real_icd_surfaces[i]);
if (VK_SUCCESS != vkRes) {
goto out;
@@ -1237,7 +1236,7 @@
if (NULL != pIcdSurface->real_icd_surfaces[i] &&
NULL != icd->DestroySurfaceKHR) {
icd->DestroySurfaceKHR(
- instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
+ icd->instance, pIcdSurface->real_icd_surfaces[i], pAllocator);
}
}
loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces);
diff --git a/loader/wsi.h b/loader/wsi.h
index 65b3986..77cc183 100644
--- a/loader/wsi.h
+++ b/loader/wsi.h
@@ -19,9 +19,38 @@
*
*/
+#ifndef WSI_H
+#define WSI_H
+
#include "vk_loader_platform.h"
#include "loader.h"
+typedef struct {
+ union {
+#ifdef VK_USE_PLATFORM_MIR_KHR
+ VkIcdSurfaceMir mir_surf;
+#endif // VK_USE_PLATFORM_MIR_KHR
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
+ VkIcdSurfaceWayland wayland_surf;
+#endif // VK_USE_PLATFORM_WAYLAND_KHR
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+ VkIcdSurfaceWin32 win_surf;
+#endif // VK_USE_PLATFORM_WIN32_KHR
+#ifdef VK_USE_PLATFORM_XCB_KHR
+ VkIcdSurfaceXcb xcb_surf;
+#endif // VK_USE_PLATFORM_XCB_KHR
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+ VkIcdSurfaceXlib xlib_surf;
+#endif // VK_USE_PLATFORM_XLIB_KHR
+ VkIcdSurfaceDisplay display_surf;
+ };
+ uint32_t base_size; // Size of VkIcdSurfaceBase
+ uint32_t platform_size; // Size of corresponding VkIcdSurfaceXXX
+ uint32_t non_platform_offset; // Start offset to base_size
+ uint32_t entire_size; // Size of entire VkIcdSurface
+ VkSurfaceKHR *real_icd_surfaces;
+} VkIcdSurface;
+
bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance,
const char *name, void **addr);
@@ -139,3 +168,5 @@
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(
VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
+
+#endif /* WSI_H */