vulkan: Add #ifdef hack to vk_android_native_buffer.h
authorChad Versace <chadversary@chromium.org>
Tue, 29 Aug 2017 21:41:24 +0000 (14:41 -0700)
committerChad Versace <chadversary@chromium.org>
Mon, 18 Sep 2017 21:26:54 +0000 (14:26 -0700)
This patch consolidates many potential `#ifdef ANDROID` messes
throughout src/vulkan and src/intel/vulkan into a simple, localized
hack. The hack is an `#ifdef ANDROID` in vk_android_native_buffer.h
that, on non-Android platorms, avoids including the Android platform
headers and typedefs any Android-specific types to void*.

This hack doesn't remove *all* the `#ifdef ANDROID`s in upcoming
patches, but it does remove a lot.

I first tried implementing VK_ANDROID_native_buffer without this hack,
but eventually gave up when the yak shaving became too much.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
include/vulkan/vk_android_native_buffer.h

index d0ebf81353f12d3f8c8b875fdf246f51fad7c958..a658b49243df4cac0e55af3f5e95959c644f113e 100644 (file)
 #ifndef __VK_ANDROID_NATIVE_BUFFER_H__
 #define __VK_ANDROID_NATIVE_BUFFER_H__
 
+/* MESA: A hack to avoid #ifdefs in driver code. */
+#ifdef ANDROID
 #include <system/window.h>
 #include <vulkan/vulkan.h>
+#else
+typedef void *buffer_handle_t;
+#endif
 
 #ifdef __cplusplus
 extern "C" {