diff --git a/include/vulkan/vk_android_native_buffer.h b/include/vulkan/vk_android_native_buffer.h index 746103bc1f4..fb4f27a4fe6 100644 --- a/include/vulkan/vk_android_native_buffer.h +++ b/include/vulkan/vk_android_native_buffer.h @@ -18,7 +18,7 @@ #define __VK_ANDROID_NATIVE_BUFFER_H__ /* MESA: A hack to avoid #ifdefs in driver code. */ -#ifdef ANDROID +#ifdef __ANDROID__ #include #include diff --git a/src/vulkan/runtime/vk_debug_utils.c b/src/vulkan/runtime/vk_debug_utils.c index 3865fd66802..caca8cfce3f 100644 --- a/src/vulkan/runtime/vk_debug_utils.c +++ b/src/vulkan/runtime/vk_debug_utils.c @@ -197,7 +197,7 @@ vk_common_SetDebugUtilsObjectNameEXT( { VK_FROM_HANDLE(vk_device, device, _device); -#ifdef ANDROID +#if DETECT_OS_ANDROID if (pNameInfo->objectType == VK_OBJECT_TYPE_SWAPCHAIN_KHR || pNameInfo->objectType == VK_OBJECT_TYPE_SURFACE_KHR) { #else diff --git a/src/vulkan/runtime/vk_device.c b/src/vulkan/runtime/vk_device.c index 38d2bb6e7a5..d4aca6803b5 100644 --- a/src/vulkan/runtime/vk_device.c +++ b/src/vulkan/runtime/vk_device.c @@ -175,10 +175,10 @@ vk_device_init(struct vk_device *device, unreachable("Invalid timeline mode"); } -#ifdef ANDROID +#if DETECT_OS_ANDROID mtx_init(&device->swapchain_private_mtx, mtx_plain); device->swapchain_private = NULL; -#endif /* ANDROID */ +#endif /* DETECT_OS_ANDROID */ simple_mtx_init(&device->trace_mtx, mtx_plain); @@ -193,13 +193,13 @@ vk_device_finish(struct vk_device *device) vk_memory_trace_finish(device); -#ifdef ANDROID +#if DETECT_OS_ANDROID if (device->swapchain_private) { hash_table_foreach(device->swapchain_private, entry) util_sparse_array_finish(entry->data); ralloc_free(device->swapchain_private); } -#endif /* ANDROID */ +#endif /* DETECT_OS_ANDROID */ simple_mtx_destroy(&device->trace_mtx); diff --git a/src/vulkan/runtime/vk_image.c b/src/vulkan/runtime/vk_image.c index ba90ea61ccd..2a8f8d284a1 100644 --- a/src/vulkan/runtime/vk_image.c +++ b/src/vulkan/runtime/vk_image.c @@ -38,7 +38,7 @@ #include "vk_util.h" #include "vulkan/wsi/wsi_common.h" -#ifdef ANDROID +#if DETECT_OS_ANDROID #include "vk_android.h" #include #endif @@ -100,7 +100,7 @@ vk_image_init(struct vk_device *device, image->drm_format_mod = ((1ULL << 56) - 1) /* DRM_FORMAT_MOD_INVALID */; #endif -#ifdef ANDROID +#if DETECT_OS_ANDROID const VkExternalFormatANDROID *ext_format = vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_FORMAT_ANDROID); if (ext_format && ext_format->externalFormat != 0) { diff --git a/src/vulkan/runtime/vk_image.h b/src/vulkan/runtime/vk_image.h index e11ba0b073f..87d97a6f9d7 100644 --- a/src/vulkan/runtime/vk_image.h +++ b/src/vulkan/runtime/vk_image.h @@ -76,7 +76,7 @@ struct vk_image { uint64_t drm_format_mod; #endif -#ifdef ANDROID +#if DETECT_OS_ANDROID /* AHARDWAREBUFFER_FORMAT for this image or 0 * * A default is provided by the Vulkan runtime code based on the VkFormat diff --git a/src/vulkan/runtime/vk_object.c b/src/vulkan/runtime/vk_object.c index 10ce9f4e5c1..8a4aaae2664 100644 --- a/src/vulkan/runtime/vk_object.c +++ b/src/vulkan/runtime/vk_object.c @@ -243,7 +243,7 @@ vk_object_base_private_data(struct vk_device *device, * vkGet/SetPrivateData call on a swapchain because the loader will * handle it. */ -#ifdef ANDROID +#if DETECT_OS_ANDROID if (objectType == VK_OBJECT_TYPE_SWAPCHAIN_KHR || objectType == VK_OBJECT_TYPE_SURFACE_KHR) { #else diff --git a/src/vulkan/runtime/vk_object.h b/src/vulkan/runtime/vk_object.h index 9c32b788879..c95d6d90032 100644 --- a/src/vulkan/runtime/vk_object.h +++ b/src/vulkan/runtime/vk_object.h @@ -27,6 +27,7 @@ #include #include "c11/threads.h" +#include "util/detect_os.h" #include "util/macros.h" #include "util/sparse_array.h" diff --git a/src/vulkan/runtime/vk_queue.c b/src/vulkan/runtime/vk_queue.c index 81087dde7fc..b54dff90d5d 100644 --- a/src/vulkan/runtime/vk_queue.c +++ b/src/vulkan/runtime/vk_queue.c @@ -1124,7 +1124,7 @@ vk_queue_finish(struct vk_queue *queue) vk_queue_submit_destroy(queue, submit); } -#ifdef ANDROID +#if DETECT_OS_ANDROID if (queue->anb_semaphore != VK_NULL_HANDLE) { struct vk_device *device = queue->base.device; device->dispatch_table.DestroySemaphore(vk_device_to_handle(device), diff --git a/src/vulkan/runtime/vk_queue.h b/src/vulkan/runtime/vk_queue.h index 32a28b60603..814f9fefcdd 100644 --- a/src/vulkan/runtime/vk_queue.h +++ b/src/vulkan/runtime/vk_queue.h @@ -146,7 +146,7 @@ struct vk_queue { struct util_dynarray labels; bool region_begin; -#ifdef ANDROID +#if DETECT_OS_ANDROID /** SYNC_FD signal semaphore for vkQueueSignalReleaseImageANDROID * * VK_ANDROID_native_buffer enforces explicit fencing on the present api