diff --git a/bin/khronos-update.py b/bin/khronos-update.py index b7a5b947673..3a2e2762aa0 100755 --- a/bin/khronos-update.py +++ b/bin/khronos-update.py @@ -52,8 +52,26 @@ class Source: VK_ANDROID_NATIVE_BUFFER_TEMPLATE = """\ -/* MESA: A hack to avoid #ifdefs in driver code. */ -#ifdef __ANDROID__ +/* + * MESA: buffer_handle_t is defined by all Mesa builds, even if + * one is building for a non-Android target. This avoids unnecessary + * conditionals in driver code. + * + * We don't need to define buffer_handle_t locally when (__ANDROID__) + * or ANDROID are set. Here's the distinction between the two: + * + * - AOSP always defines ANDROID, since it just means one is using the + * AOSP tree. It means the build environment is Android, roughly. + * - __ANDROID__ is defined by the toolchain. This typically means the + * build target is Android. + * + * If the build environment is Android, AOSP can provide common Android + * headers, such as . This allows one to build + * and test certain aspects of Android window system code, on the host + * system rather the build target. + */ + +#if defined(__ANDROID__) || defined(ANDROID) #include #if ANDROID_API_LEVEL < 28