build: loader: Fix warnings for 32-bit linux
Change-Id: Ied7668aa7edeef01675dd4f358916d3e8bc07b27
diff --git a/loader/debug_report.c b/loader/debug_report.c
index 8ad4102..f71896e 100644
--- a/loader/debug_report.c
+++ b/loader/debug_report.c
@@ -232,7 +232,7 @@
if (((VkInstanceCreateInfo *)pNext)->sType ==
VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) {
memcpy(pInfos, pNext, sizeof(VkDebugReportCallbackCreateInfoEXT));
- *pCallbacks++ = (VkDebugReportCallbackEXT)pInfos++;
+ *pCallbacks++ = (VkDebugReportCallbackEXT)(uintptr_t)pInfos++;
}
pNext = (void *)((VkInstanceCreateInfo *)pNext)->pNext;
}
diff --git a/loader/extensions.c b/loader/extensions.c
index 643911d..0a9f918 100644
--- a/loader/extensions.c
+++ b/loader/extensions.c
@@ -39,8 +39,8 @@
if (pTagInfo->objectType ==
VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {
struct loader_physical_device_tramp *phys_dev_tramp =
- (struct loader_physical_device_tramp *)pTagInfo->object;
- pTagInfo->object = (uint64_t)phys_dev_tramp->phys_dev;
+ (struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->object;
+ pTagInfo->object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;
}
return disp->DebugMarkerSetObjectTagEXT(device, pTagInfo);
}
@@ -56,15 +56,16 @@
if (pTagInfo->objectType ==
VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {
struct loader_physical_device_term *phys_dev_term =
- (struct loader_physical_device_term *)pTagInfo->object;
- pTagInfo->object = (uint64_t)phys_dev_term->phys_dev;
+ (struct loader_physical_device_term *)(uintptr_t)pTagInfo->object;
+ pTagInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;
// If this is a KHR_surface, and the ICD has created its own, we have to
// replace it with the proper one for the next call.
} else if (pTagInfo->objectType ==
VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) {
if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) {
- VkIcdSurface *icd_surface = (VkIcdSurface *)(pTagInfo->object);
+ VkIcdSurface *icd_surface =
+ (VkIcdSurface *)(uintptr_t)pTagInfo->object;
if (NULL != icd_surface->real_icd_surfaces) {
pTagInfo->object =
(uint64_t)icd_surface->real_icd_surfaces[icd_index];
@@ -84,8 +85,8 @@
if (pNameInfo->objectType ==
VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {
struct loader_physical_device_tramp *phys_dev_tramp =
- (struct loader_physical_device_tramp *)pNameInfo->object;
- pNameInfo->object = (uint64_t)phys_dev_tramp->phys_dev;
+ (struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->object;
+ pNameInfo->object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;
}
return disp->DebugMarkerSetObjectNameEXT(device, pNameInfo);
}
@@ -101,18 +102,20 @@
if (pNameInfo->objectType ==
VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {
struct loader_physical_device_term *phys_dev_term =
- (struct loader_physical_device_term *)pNameInfo->object;
- pNameInfo->object = (uint64_t)phys_dev_term->phys_dev;
+ (struct loader_physical_device_term *)(uintptr_t)pNameInfo->object;
+ pNameInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;
// If this is a KHR_surface, and the ICD has created its own, we have to
// replace it with the proper one for the next call.
} else if (pNameInfo->objectType ==
VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) {
if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) {
- VkIcdSurface *icd_surface = (VkIcdSurface *)(pNameInfo->object);
+ VkIcdSurface *icd_surface =
+ (VkIcdSurface *)(uintptr_t)pNameInfo->object;
if (NULL != icd_surface->real_icd_surfaces) {
pNameInfo->object =
- (uint64_t)icd_surface->real_icd_surfaces[icd_index];
+ (uint64_t)(
+ uintptr_t)icd_surface->real_icd_surfaces[icd_index];
}
}
}
diff --git a/loader/loader.c b/loader/loader.c
index 73281f9..30a3b2d 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -381,9 +381,9 @@
va_end(ap);
if (inst) {
- util_DebugReportMessage(inst, msg_type,
- VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT,
- (uint64_t)inst, 0, msg_code, "loader", msg);
+ util_DebugReportMessage(
+ inst, msg_type, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT,
+ (uint64_t)(uintptr_t)inst, 0, msg_code, "loader", msg);
}
if (!(msg_type & g_loader_log_msgs)) {
diff --git a/loader/wsi.c b/loader/wsi.c
index 9afb585..25f2630 100644
--- a/loader/wsi.c
+++ b/loader/wsi.c
@@ -164,7 +164,7 @@
const VkAllocationCallbacks *pAllocator) {
struct loader_instance *ptr_instance = loader_get_instance(instance);
- VkIcdSurface *icd_surface = (VkIcdSurface *)(surface);
+ VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface;
if (NULL != icd_surface) {
if (NULL != icd_surface->real_icd_surfaces) {
uint32_t i = 0;
@@ -173,24 +173,29 @@
if (icd_term->scanned_icd->interface_version >=
ICD_VER_SUPPORTS_ICD_SURFACE_KHR) {
if (NULL != icd_term->DestroySurfaceKHR &&
- NULL != (void *)icd_surface->real_icd_surfaces[i]) {
+ NULL !=
+ (void *)(uintptr_t)
+ icd_surface->real_icd_surfaces[i]) {
icd_term->DestroySurfaceKHR(
icd_term->instance,
icd_surface->real_icd_surfaces[i], pAllocator);
- icd_surface->real_icd_surfaces[i] = (VkSurfaceKHR)NULL;
+ icd_surface->real_icd_surfaces[i] =
+ (VkSurfaceKHR)(uintptr_t)NULL;
}
} else {
// The real_icd_surface for any ICD not supporting the
// proper interface version should be NULL. If not, then
// we have a problem.
- assert(NULL == (void *)icd_surface->real_icd_surfaces[i]);
+ assert(
+ NULL ==
+ (void *)(uintptr_t)icd_surface->real_icd_surfaces[i]);
}
}
loader_instance_heap_free(ptr_instance,
icd_surface->real_icd_surfaces);
}
- loader_instance_heap_free(ptr_instance, (void *)surface);
+ loader_instance_heap_free(ptr_instance, (void *)(uintptr_t)surface);
}
}
@@ -236,10 +241,11 @@
assert(icd_term->GetPhysicalDeviceSurfaceSupportKHR &&
"loader: null GetPhysicalDeviceSurfaceSupportKHR ICD pointer");
- VkIcdSurface *icd_surface = (VkIcdSurface *)(surface);
+ VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface;
if (NULL != icd_surface->real_icd_surfaces &&
NULL !=
- (void *)icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) {
+ (void *)(uintptr_t)
+ icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) {
return icd_term->GetPhysicalDeviceSurfaceSupportKHR(
phys_dev_term->phys_dev, queueFamilyIndex,
icd_surface->real_icd_surfaces[phys_dev_term->icd_index],
@@ -292,10 +298,11 @@
assert(icd_term->GetPhysicalDeviceSurfaceCapabilitiesKHR &&
"loader: null GetPhysicalDeviceSurfaceCapabilitiesKHR ICD pointer");
- VkIcdSurface *icd_surface = (VkIcdSurface *)(surface);
+ VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface;
if (NULL != icd_surface->real_icd_surfaces &&
NULL !=
- (void *)icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) {
+ (void *)(uintptr_t)
+ icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) {
return icd_term->GetPhysicalDeviceSurfaceCapabilitiesKHR(
phys_dev_term->phys_dev,
icd_surface->real_icd_surfaces[phys_dev_term->icd_index],
@@ -348,10 +355,11 @@
assert(icd_term->GetPhysicalDeviceSurfaceFormatsKHR &&
"loader: null GetPhysicalDeviceSurfaceFormatsKHR ICD pointer");
- VkIcdSurface *icd_surface = (VkIcdSurface *)(surface);
+ VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface;
if (NULL != icd_surface->real_icd_surfaces &&
NULL !=
- (void *)icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) {
+ (void *)(uintptr_t)
+ icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) {
return icd_term->GetPhysicalDeviceSurfaceFormatsKHR(
phys_dev_term->phys_dev,
icd_surface->real_icd_surfaces[phys_dev_term->icd_index],
@@ -404,10 +412,11 @@
assert(icd_term->GetPhysicalDeviceSurfacePresentModesKHR &&
"loader: null GetPhysicalDeviceSurfacePresentModesKHR ICD pointer");
- VkIcdSurface *icd_surface = (VkIcdSurface *)(surface);
+ VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface;
if (NULL != icd_surface->real_icd_surfaces &&
NULL !=
- (void *)icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) {
+ (void *)(uintptr_t)
+ icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) {
return icd_term->GetPhysicalDeviceSurfacePresentModesKHR(
phys_dev_term->phys_dev,
icd_surface->real_icd_surfaces[phys_dev_term->icd_index],
@@ -438,9 +447,11 @@
struct loader_icd_term *icd_term =
loader_get_icd_and_device(device, &dev, &icd_index);
if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) {
- VkIcdSurface *icd_surface = (VkIcdSurface *)(pCreateInfo->surface);
+ VkIcdSurface *icd_surface =
+ (VkIcdSurface *)(uintptr_t)pCreateInfo->surface;
if (NULL != icd_surface->real_icd_surfaces) {
- if (NULL != (void *)icd_surface->real_icd_surfaces[icd_index]) {
+ if (NULL !=
+ (void *)(uintptr_t)icd_surface->real_icd_surfaces[icd_index]) {
// We found the ICD, and there is an ICD KHR surface
// associated with it, so copy the CreateInfo struct
// and point it at the ICD's surface.
@@ -1009,7 +1020,7 @@
}
}
- *pSurface = (VkSurfaceKHR)pIcdSurface;
+ *pSurface = (VkSurfaceKHR)(uintptr_t)pIcdSurface;
out:
@@ -1018,7 +1029,8 @@
i = 0;
for (struct loader_icd_term *icd_term = ptr_instance->icd_terms;
icd_term != NULL; icd_term = icd_term->next, i++) {
- if (NULL != pIcdSurface->real_icd_surfaces[i] &&
+ if (NULL !=
+ (void *)(uintptr_t)pIcdSurface->real_icd_surfaces[i] &&
NULL != icd_term->DestroySurfaceKHR) {
icd_term->DestroySurfaceKHR(
icd_term->instance, pIcdSurface->real_icd_surfaces[i],
@@ -1145,7 +1157,7 @@
}
}
- *pSurface = (VkSurfaceKHR)pIcdSurface;
+ *pSurface = (VkSurfaceKHR)(uintptr_t)pIcdSurface;
out:
@@ -1154,7 +1166,8 @@
i = 0;
for (struct loader_icd_term *icd_term = ptr_instance->icd_terms;
icd_term != NULL; icd_term = icd_term->next, i++) {
- if (NULL != pIcdSurface->real_icd_surfaces[i] &&
+ if (NULL !=
+ (void *)(uintptr_t)pIcdSurface->real_icd_surfaces[i] &&
NULL != icd_term->DestroySurfaceKHR) {
icd_term->DestroySurfaceKHR(
icd_term->instance, pIcdSurface->real_icd_surfaces[i],
@@ -1559,7 +1572,7 @@
}
}
- *pSurface = (VkSurfaceKHR)pIcdSurface;
+ *pSurface = (VkSurfaceKHR)(uintptr_t)pIcdSurface;
out:
@@ -1568,7 +1581,8 @@
i = 0;
for (struct loader_icd_term *icd_term = inst->icd_terms;
icd_term != NULL; icd_term = icd_term->next, i++) {
- if (NULL != (void *)pIcdSurface->real_icd_surfaces[i] &&
+ if (NULL !=
+ (void *)(uintptr_t)pIcdSurface->real_icd_surfaces[i] &&
NULL != icd_term->DestroySurfaceKHR) {
icd_term->DestroySurfaceKHR(
icd_term->instance, pIcdSurface->real_icd_surfaces[i],