aboutsummaryrefslogtreecommitdiff
path: root/loader
diff options
context:
space:
mode:
authorPiers Daniell <pdaniell@nvidia.com>2016-09-14 11:24:36 -0600
committerMark Young <marky@lunarg.com>2016-09-19 14:52:50 -0600
commit4dec9eca7c80b931794e13ed507a8340269a77e7 (patch)
treee51beb72588f51dfdd7b9f68ca35edc71e0d329b /loader
parentddca7b207067f44df0990a697b9471efdef8b066 (diff)
downloadusermoji-4dec9eca7c80b931794e13ed507a8340269a77e7.tar.xz
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
Diffstat (limited to 'loader')
-rw-r--r--loader/loader.c2
-rw-r--r--loader/loader.h1
-rw-r--r--loader/trampoline.c2
-rw-r--r--loader/wsi.c25
-rw-r--r--loader/wsi.h31
5 files changed, 46 insertions, 15 deletions
diff --git a/loader/loader.c b/loader/loader.c
index 6abd4327..641be744 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -3244,7 +3244,7 @@ loader_gpa_instance_internal(VkInstance inst, const char *pName) {
}
-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 a65f489b..060e02ef 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -511,6 +511,7 @@ struct loader_icd *loader_get_icd_and_device(const VkDevice device,
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 98b1e40c..a26847d1 100644
--- a/loader/trampoline.c
+++ b/loader/trampoline.c
@@ -721,7 +721,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(
* 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 d38085d5..123a7f89 100644
--- a/loader/wsi.c
+++ b/loader/wsi.c
@@ -221,7 +221,7 @@ terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
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 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSwapchainKHR(
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 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSwapchainKHR(
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 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(
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 @@ out:
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 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR(
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 @@ out:
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 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(
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 @@ out:
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 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(
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 @@ out:
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 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(
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 @@ out:
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 65b39860..77cc183d 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_GetDisplayPlaneCapabilitiesKHR(
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(
VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
+
+#endif /* WSI_H */