Merge pie-platform-release to aosp-master - DO NOT MERGE
Change-Id: Ib4bf582448c827e21f35f10b7719d9ddb128476d
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 5a4e85a..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "third_party/googletest"]
- path = third_party/googletest
- url = https://github.com/google/googletest.git
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..f8c596f
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,108 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_defaults {
+ name: "swiftshader_common",
+
+ gnu_extensions: false,
+
+ cflags: [
+ "-Xclang", "-fuse-init-array",
+ "-fno-operator-names",
+ "-msse2",
+ "-Werror",
+ "-Wwrite-strings",
+ ],
+
+ cppflags: [
+ "-Woverloaded-virtual",
+ ],
+
+ target: {
+ host: {
+ cppflags: [
+ "-fno-rtti",
+ "-fno-exceptions",
+ ],
+ compile_multilib: "64",
+ },
+
+ // We don't need Darwin host-side builds
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_defaults {
+ name: "swiftshader_common_release",
+
+ defaults: [ "swiftshader_common" ],
+
+ cflags: [
+ "-Os",
+ "-fomit-frame-pointer",
+ "-ffunction-sections",
+ "-fdata-sections",
+ ],
+}
+
+cc_defaults {
+ name: "swiftshader_common_debug",
+
+ defaults: [ "swiftshader_common" ],
+
+ cflags: [
+ "-O0",
+ "-g",
+ "-UNDEBUG",
+ ],
+}
+
+cc_defaults {
+ name: "swiftshader_subzero",
+
+ cflags: [
+ "-DALLOW_DUMP=0",
+ "-DALLOW_TIMERS=0",
+ "-DALLOW_LLVM_CL=0",
+ "-DALLOW_LLVM_IR=0",
+ "-DALLOW_LLVM_IR_AS_INPUT=0",
+ "-DALLOW_MINIMAL_BUILD=0",
+ "-DALLOW_WASM=0",
+ "-DICE_THREAD_LOCAL_HACK=1",
+ ],
+}
+
+cc_library_headers {
+ name: "swiftshader_platform_headers",
+ host_supported: true,
+ export_include_dirs: ["include"],
+}
+
+cc_library_headers {
+ name: "swiftshader_host_headers",
+ device_supported: false,
+ host_supported: true,
+ export_include_dirs: ["include/Android"],
+}
+
+subdirs = [
+ "src",
+ "third_party/llvm-subzero",
+ "third_party/LLVM",
+ "third_party/subzero",
+]
diff --git a/Android.mk b/Android.mk
index a89cdf0..835c3d4 100644
--- a/Android.mk
+++ b/Android.mk
@@ -17,9 +17,10 @@
LOCAL_PATH := $(call my-dir)
# Use Subzero as the Reactor JIT back-end on ARM, else LLVM.
-ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm))
+# TODO(b/115344057) Consider turning LLVM back on, off for now due to leaks
+#ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm))
use_subzero := true
-endif
+#endif
# Subzero requires full C++11 support, which is available from Marshmallow and up.
ifdef use_subzero
@@ -32,4 +33,4 @@
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64 arm))
include $(call all-makefiles-under,$(LOCAL_PATH))
endif
-endif
\ No newline at end of file
+endif
diff --git a/OWNERS b/OWNERS
index a402880..87f4dbc 100644
--- a/OWNERS
+++ b/OWNERS
@@ -3,7 +3,8 @@
# This list is used by Chromium and Android to make sure that one of the owners
# in this list has approved a SwiftShader related change before landing it.
+ghartman@google.com
nicolascapens@google.com
sugoi@google.com
-# COMPONENT: Internals>GPU>SwiftShader
\ No newline at end of file
+# COMPONENT: Internals>GPU>SwiftShader
diff --git a/include/Android/android/api-level.h b/include/Android/android/api-level.h
new file mode 100644
index 0000000..2d2f096
--- /dev/null
+++ b/include/Android/android/api-level.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef ANDROID_API_LEVEL_H
+#define ANDROID_API_LEVEL_H
+
+/*
+ * Magic version number for a current development build, which has
+ * not yet turned into an official release.
+ */
+#define __ANDROID_API__ 10000
+
+#endif /* ANDROID_API_LEVEL_H */
diff --git a/include/Android/android/sync.h b/include/Android/android/sync.h
new file mode 100644
index 0000000..1ae728a
--- /dev/null
+++ b/include/Android/android/sync.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+extern "C" {
+int sync_wait(int fd, int timeout);
+};
diff --git a/include/Android/cutils/native_handle.h b/include/Android/cutils/native_handle.h
new file mode 100644
index 0000000..b92a663
--- /dev/null
+++ b/include/Android/cutils/native_handle.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+struct native_handle_t;
+
+typedef const struct native_handle_t* buffer_handle_t;
diff --git a/include/Android/hardware/gralloc.h b/include/Android/hardware/gralloc.h
new file mode 100644
index 0000000..8446ba4
--- /dev/null
+++ b/include/Android/hardware/gralloc.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <cutils/native_handle.h>
+
+#include <hardware/hardware.h>
+
+struct android_ycbcr;
+
+enum {
+ GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003U,
+ GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030U,
+ GRALLOC_USAGE_HW_TEXTURE = 0x00000100U,
+ GRALLOC_USAGE_HW_RENDER = 0x00000200U,
+};
+
+struct gralloc_module_t {
+ hw_module_t common;
+ int (*registerBuffer)(gralloc_module_t const*, buffer_handle_t);
+ int (*unregisterBuffer)(gralloc_module_t const*, buffer_handle_t);
+ int (*lock)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int, void**);
+ int (*unlock)(gralloc_module_t const*, buffer_handle_t);
+ int (*perform)(gralloc_module_t const*, int, ...);
+ int (*lock_ycbcr)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int,
+ android_ycbcr*);
+ int (*lockAsync)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int, void**, int);
+ int (*unlockAsync)(gralloc_module_t const*, buffer_handle_t, int*);
+ int (*lockAsync_ycbcr)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int,
+ android_ycbcr*, int);
+ void* reserved_proc[3];
+};
diff --git a/include/Android/hardware/gralloc1.h b/include/Android/hardware/gralloc1.h
new file mode 100644
index 0000000..b02decf
--- /dev/null
+++ b/include/Android/hardware/gralloc1.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <hardware/hardware.h>
+
+#include <cutils/native_handle.h>
+
+#define GRALLOC_MODULE_API_VERSION_1_0 HARDWARE_MAKE_API_VERSION(1, 0)
+
+#define GRALLOC_HARDWARE_MODULE_ID "gralloc"
+
+enum {
+ GRALLOC1_ERROR_NONE = 0,
+ GRALLOC1_ERROR_BAD_HANDLE = 2,
+ GRALLOC1_ERROR_BAD_VALUE = 3,
+ GRALLOC1_ERROR_UNDEFINED = 6,
+};
+
+enum {
+ GRALLOC1_FUNCTION_LOCK = 18,
+ GRALLOC1_FUNCTION_UNLOCK = 20,
+};
+
+enum {
+ GRALLOC1_CONSUMER_USAGE_CPU_READ = 1ULL << 1,
+ GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN = 1ULL << 2 | GRALLOC1_CONSUMER_USAGE_CPU_READ,
+ GRALLOC1_CONSUMER_USAGE_CPU_WRITE = 1ULL << 5,
+ GRALLOC1_CONSUMER_USAGE_CPU_WRITE_OFTEN = 1ULL << 6 | GRALLOC1_CONSUMER_USAGE_CPU_WRITE,
+ GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE = 1ULL << 8,
+};
+
+enum {
+ GRALLOC1_PRODUCER_USAGE_CPU_READ = 1ULL << 1,
+ GRALLOC1_PRODUCER_USAGE_CPU_READ_OFTEN = 1ULL << 2 | GRALLOC1_PRODUCER_USAGE_CPU_READ,
+ GRALLOC1_PRODUCER_USAGE_CPU_WRITE = 1ULL << 5,
+ GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN = 1ULL << 6 | GRALLOC1_PRODUCER_USAGE_CPU_WRITE,
+ GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET = 1ULL << 9,
+};
+
+typedef void (*gralloc1_function_pointer_t)();
+
+struct gralloc1_rect_t {
+ int32_t left;
+ int32_t top;
+ int32_t width;
+ int32_t height;
+};
+
+struct gralloc1_device_t {
+ hw_device_t common;
+ void (*getCapabilities)(gralloc1_device_t*, uint32_t*, int32_t*);
+ gralloc1_function_pointer_t (*getFunction)(gralloc1_device_t*, int32_t);
+};
+
+typedef int32_t (*GRALLOC1_PFN_LOCK)(gralloc1_device_t*, buffer_handle_t, uint64_t, uint64_t,
+ const gralloc1_rect_t*, void**, int32_t);
+typedef int32_t (*GRALLOC1_PFN_UNLOCK)(gralloc1_device_t*, buffer_handle_t, int32_t*);
+
+static inline int gralloc1_open(const hw_module_t* module, gralloc1_device_t** device) {
+ return module->methods->open(module, GRALLOC_HARDWARE_MODULE_ID,
+ reinterpret_cast<hw_device_t**>(device));
+}
diff --git a/include/Android/hardware/hardware.h b/include/Android/hardware/hardware.h
new file mode 100644
index 0000000..21d6dc4
--- /dev/null
+++ b/include/Android/hardware/hardware.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <cstdint>
+
+#define MAKE_TAG_CONSTANT(A, B, C, D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
+
+#define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
+#define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
+
+#define HARDWARE_MAKE_API_VERSION(maj, min) ((((maj)&0xff) << 8) | ((min)&0xff))
+
+#define HARDWARE_HAL_API_VERSION HARDWARE_MAKE_API_VERSION(1, 0)
+
+struct hw_module_methods_t;
+
+struct hw_module_t {
+ uint32_t tag;
+ uint16_t module_api_version;
+ uint16_t hal_api_version;
+ const char* id;
+ const char* name;
+ const char* author;
+ hw_module_methods_t* methods;
+ void* dso;
+#ifdef __LP64__
+ uint64_t reserved[32 - 7];
+#else
+ uint32_t reserved[32 - 7];
+#endif
+};
+
+struct hw_device_t {
+ uint32_t tag;
+ uint32_t version;
+ struct hw_module_t* module;
+#ifdef __LP64__
+ uint64_t reserved[12];
+#else
+ uint32_t reserved[12];
+#endif
+ int (*close)(hw_device_t* device);
+};
+
+struct hw_module_methods_t {
+ int (*open)(const hw_module_t*, const char*, hw_device_t**);
+};
+
+extern "C" {
+int hw_get_module(const char* id, const hw_module_t** module);
+};
diff --git a/include/Android/nativebase/nativebase.h b/include/Android/nativebase/nativebase.h
new file mode 100644
index 0000000..c2e84d7
--- /dev/null
+++ b/include/Android/nativebase/nativebase.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <cutils/native_handle.h>
+
+#include <cstdint>
+#include <cstring>
+
+// clang-format off
+#define ANDROID_NATIVE_MAKE_CONSTANT(a, b, c, d) \
+ ((static_cast<unsigned int>(a) << 24) | \
+ (static_cast<unsigned int>(b) << 16) | \
+ (static_cast<unsigned int>(c) << 8) | \
+ (static_cast<unsigned int>(d) << 0))
+// clang-format on
+
+struct android_native_base_t {
+ int magic;
+ int version;
+ void* reserved[4];
+ void (*incRef)(android_native_base_t*);
+ void (*decRef)(android_native_base_t*);
+};
+
+#define ANDROID_NATIVE_BUFFER_MAGIC ANDROID_NATIVE_MAKE_CONSTANT('_', 'b', 'f', 'r')
+
+struct ANativeWindowBuffer {
+ ANativeWindowBuffer() {
+ common.magic = ANDROID_NATIVE_BUFFER_MAGIC;
+ common.version = sizeof(ANativeWindowBuffer);
+ memset(common.reserved, 0, sizeof(common.reserved));
+ }
+
+ android_native_base_t common;
+
+ int width;
+ int height;
+ int stride;
+ int format;
+ int usage_deprecated;
+ uintptr_t layerCount;
+
+ void* reserved[1];
+
+ const native_handle_t* handle;
+ uint64_t usage;
+
+ void* reserved_proc[8 - (sizeof(uint64_t) / sizeof(void*))];
+};
diff --git a/include/Android/sync/sync.h b/include/Android/sync/sync.h
new file mode 100644
index 0000000..1ae728a
--- /dev/null
+++ b/include/Android/sync/sync.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+extern "C" {
+int sync_wait(int fd, int timeout);
+};
diff --git a/include/Android/system/graphics.h b/include/Android/system/graphics.h
new file mode 100644
index 0000000..563287a
--- /dev/null
+++ b/include/Android/system/graphics.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+enum {
+ HAL_PIXEL_FORMAT_RGBA_8888 = 1,
+ HAL_PIXEL_FORMAT_RGBX_8888 = 2,
+ HAL_PIXEL_FORMAT_RGB_888 = 3,
+ HAL_PIXEL_FORMAT_RGB_565 = 4,
+ HAL_PIXEL_FORMAT_BGRA_8888 = 5,
+ HAL_PIXEL_FORMAT_RGBA_FP16 = 22,
+ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 34,
+ HAL_PIXEL_FORMAT_YV12 = 842094169,
+};
diff --git a/include/Android/system/window.h b/include/Android/system/window.h
new file mode 100644
index 0000000..f986274
--- /dev/null
+++ b/include/Android/system/window.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <nativebase/nativebase.h>
+#include <system/graphics.h>
+
+#define ANDROID_NATIVE_WINDOW_MAGIC ANDROID_NATIVE_MAKE_CONSTANT('_', 'w', 'n', 'd')
+
+enum {
+ NATIVE_WINDOW_WIDTH = 0,
+ NATIVE_WINDOW_HEIGHT = 1,
+};
+
+struct ANativeWindow {
+ ANativeWindow() : flags(0), minSwapInterval(0), maxSwapInterval(0), xdpi(0), ydpi(0) {
+ common.magic = ANDROID_NATIVE_BUFFER_MAGIC;
+ common.version = sizeof(ANativeWindowBuffer);
+ memset(common.reserved, 0, sizeof(common.reserved));
+ }
+
+ android_native_base_t common;
+
+ const uint32_t flags;
+ const int minSwapInterval;
+ const int maxSwapInterval;
+ const float xdpi;
+ const float ydpi;
+ intptr_t oem[4];
+
+ int (*setSwapInterval)(ANativeWindow*, int);
+ int (*dequeueBuffer_DEPRECATED)(ANativeWindow*, ANativeWindowBuffer**);
+ int (*lockBuffer_DEPRECATED)(ANativeWindow*, ANativeWindowBuffer*);
+ int (*queueBuffer_DEPRECATED)(ANativeWindow*, ANativeWindowBuffer*);
+ int (*query)(const ANativeWindow*, int, int*);
+ int (*perform)(ANativeWindow*, int, ...);
+ int (*cancelBuffer_DEPRECATED)(ANativeWindow*, ANativeWindowBuffer*);
+ int (*dequeueBuffer)(ANativeWindow*, ANativeWindowBuffer**, int*);
+ int (*queueBuffer)(ANativeWindow*, ANativeWindowBuffer*, int);
+ int (*cancelBuffer)(ANativeWindow*, ANativeWindowBuffer*, int);
+};
+
+static inline int native_window_set_usage(ANativeWindow*, uint64_t) {
+ // No-op
+ return 0;
+}
+
+static inline int native_window_dequeue_buffer_and_wait(ANativeWindow* anw,
+ ANativeWindowBuffer** anwb) {
+ return anw->dequeueBuffer_DEPRECATED(anw, anwb);
+}
diff --git a/src/Android.bp b/src/Android.bp
new file mode 100644
index 0000000..9dbc324
--- /dev/null
+++ b/src/Android.bp
@@ -0,0 +1,533 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_defaults {
+ name: "libswiftshader",
+
+ device_supported: false,
+ host_supported: true,
+ vendor: true,
+
+ defaults: [ "swiftshader_common" ],
+
+ cflags: [
+ "-D_GNU_SOURCE",
+ "-D__STDC_LIMIT_MACROS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_FORMAT_MACROS",
+ "-DHAVE_GRALLOC1",
+ "-DNO_SANITIZE_FUNCTION=",
+ // FIXME: Use <android/api-level.h> instead?
+ "-DANDROID_PLATFORM_SDK_VERSION=10000",
+ "-Wno-implicit-fallthrough",
+ "-Wno-unused-parameter",
+ "-Wno-unused-local-typedef",
+ ],
+
+ cppflags: [
+ "-Wno-sign-promo",
+ "-Wno-non-virtual-dtor",
+ ],
+
+ local_include_dirs: [ "OpenGL" ],
+
+ target: {
+ android: {
+ relative_install_path: "hw",
+ header_libs: [
+ "swiftshader_platform_headers",
+ ],
+ shared_libs: [
+ "libnativewindow",
+ "libhardware",
+ "libcutils",
+ "libsync",
+ "liblog",
+ ],
+ },
+
+ host: {
+ header_libs: [
+ "swiftshader_host_headers",
+ "swiftshader_platform_headers",
+ ],
+
+ // Pretend to build for Android
+ cflags: [ "-D__ANDROID__", "-DANDROID_HOST_BUILD" ],
+
+ allow_undefined_symbols: true,
+ host_ldlibs: ["-ldl"],
+ },
+ },
+}
+
+cc_defaults {
+ name: "libswiftshader_release",
+
+ defaults: [ "libswiftshader" ],
+
+ cflags: [
+ "-fomit-frame-pointer",
+ "-ffunction-sections",
+ "-fdata-sections",
+ "-DANGLE_DISABLE_TRACE",
+ ],
+}
+
+cc_defaults {
+ name: "libswiftshader_debug",
+
+ defaults: [ "libswiftshader" ],
+
+ cflags: [
+ "-UNDEBUG",
+ "-g",
+ "-O0",
+ "-DDEFAULT_THREAD_COUNT=1",
+ ],
+}
+
+// Common libraries
+
+cc_defaults {
+ name: "libswiftshader_common_defaults",
+
+ cflags: [
+ "-DLOG_TAG=\"swiftshader\"",
+ ],
+
+ srcs: [
+ "Common/CPUID.cpp",
+ "Common/Configurator.cpp",
+ "Common/DebugAndroid.cpp",
+ "Common/GrallocAndroid.cpp",
+ "Common/Half.cpp",
+ "Common/Math.cpp",
+ "Common/Memory.cpp",
+ "Common/Resource.cpp",
+ "Common/Socket.cpp",
+ "Common/Thread.cpp",
+ "Common/Timer.cpp",
+ "Main/Config.cpp",
+ "Main/FrameBuffer.cpp",
+ "Main/FrameBufferAndroid.cpp",
+ "Main/SwiftConfig.cpp",
+ "Renderer/Blitter.cpp",
+ "Renderer/Clipper.cpp",
+ "Renderer/Color.cpp",
+ "Renderer/Context.cpp",
+ "Renderer/ETC_Decoder.cpp",
+ "Renderer/Matrix.cpp",
+ "Renderer/PixelProcessor.cpp",
+ "Renderer/Plane.cpp",
+ "Renderer/Point.cpp",
+ "Renderer/QuadRasterizer.cpp",
+ "Renderer/Renderer.cpp",
+ "Renderer/Sampler.cpp",
+ "Renderer/SetupProcessor.cpp",
+ "Renderer/Surface.cpp",
+ "Renderer/TextureStage.cpp",
+ "Renderer/Vector.cpp",
+ "Renderer/VertexProcessor.cpp",
+ "Shader/Constants.cpp",
+ "Shader/PixelPipeline.cpp",
+ "Shader/PixelProgram.cpp",
+ "Shader/PixelRoutine.cpp",
+ "Shader/PixelShader.cpp",
+ "Shader/SamplerCore.cpp",
+ "Shader/SetupRoutine.cpp",
+ "Shader/Shader.cpp",
+ "Shader/ShaderCore.cpp",
+ "Shader/VertexPipeline.cpp",
+ "Shader/VertexProgram.cpp",
+ "Shader/VertexRoutine.cpp",
+ "Shader/VertexShader.cpp",
+ "OpenGL/common/Image.cpp",
+ "OpenGL/common/Object.cpp",
+ "OpenGL/common/MatrixStack.cpp",
+ ],
+
+ target: {
+ host: {
+ exclude_srcs: [ "Common/DebugAndroid.cpp" ],
+ srcs: [ "Common/Debug.cpp" ],
+ },
+ },
+}
+
+cc_defaults {
+ name: "libswiftshader_llvm_defaults",
+
+ defaults: [ "libswiftshader_common_defaults" ],
+
+ srcs: [
+ "Reactor/LLVMReactor.cpp",
+ "Reactor/Routine.cpp",
+ "Reactor/LLVMRoutine.cpp",
+ "Reactor/LLVMRoutineManager.cpp",
+ ],
+
+ static_libs: [
+ "libLLVM_swiftshader",
+ ],
+}
+
+cc_defaults {
+ name: "libswiftshader_subzero_defaults",
+
+ defaults: [ "libswiftshader_common_defaults", "swiftshader_subzero" ],
+ device_supported: false,
+
+ srcs: [
+ "Reactor/SubzeroReactor.cpp",
+ "Reactor/Routine.cpp",
+ "Reactor/Optimizer.cpp",
+ ],
+
+ static_libs: [
+ "libLLVMSupport_subzero",
+ "libsubzero",
+ ],
+}
+
+cc_defaults {
+ name: "libswiftshader_common",
+
+ defaults: [ "libswiftshader_release", "libswiftshader_common_defaults" ],
+}
+
+cc_defaults {
+ name: "libswiftshader_common_debug",
+
+ srcs: [ "OpenGL/common/debug.cpp" ],
+
+ defaults: [ "libswiftshader_debug", "libswiftshader_common_defaults" ],
+}
+
+cc_library_static {
+ name: "libswiftshader_llvm",
+
+ defaults: [ "libswiftshader_common", "libswiftshader_llvm_defaults" ],
+ device_supported: false,
+}
+
+cc_library_static {
+ name: "libswiftshader_llvm_debug",
+ device_supported: false,
+
+ defaults: [ "libswiftshader_common_debug", "libswiftshader_llvm_defaults" ],
+}
+
+cc_library_static {
+ name: "libswiftshader_subzero",
+
+ defaults: [ "libswiftshader_common", "libswiftshader_subzero_defaults" ],
+ device_supported: false,
+}
+
+cc_library_static {
+ name: "libswiftshader_subzero_debug",
+ device_supported: false,
+
+ defaults: [ "libswiftshader_common_debug", "libswiftshader_subzero_defaults" ],
+}
+
+// compiler libraries
+
+cc_defaults {
+ name: "libswiftshader_compiler_defaults",
+
+ defaults: [ "libswiftshader" ],
+
+ cflags: [
+ "-DLOG_TAG=\"swiftshader_compiler\"",
+ ],
+
+ srcs: [
+ "OpenGL/compiler/preprocessor/DiagnosticsBase.cpp",
+ "OpenGL/compiler/preprocessor/DirectiveHandlerBase.cpp",
+ "OpenGL/compiler/preprocessor/DirectiveParser.cpp",
+ "OpenGL/compiler/preprocessor/ExpressionParser.cpp",
+ "OpenGL/compiler/preprocessor/Input.cpp",
+ "OpenGL/compiler/preprocessor/Lexer.cpp",
+ "OpenGL/compiler/preprocessor/Macro.cpp",
+ "OpenGL/compiler/preprocessor/MacroExpander.cpp",
+ "OpenGL/compiler/preprocessor/Preprocessor.cpp",
+ "OpenGL/compiler/preprocessor/Token.cpp",
+ "OpenGL/compiler/preprocessor/Tokenizer.cpp",
+ "OpenGL/compiler/AnalyzeCallDepth.cpp",
+ "OpenGL/compiler/Compiler.cpp",
+ "OpenGL/compiler/debug.cpp",
+ "OpenGL/compiler/Diagnostics.cpp",
+ "OpenGL/compiler/DirectiveHandler.cpp",
+ "OpenGL/compiler/glslang_lex.cpp",
+ "OpenGL/compiler/glslang_tab.cpp",
+ "OpenGL/compiler/InfoSink.cpp",
+ "OpenGL/compiler/Initialize.cpp",
+ "OpenGL/compiler/InitializeParseContext.cpp",
+ "OpenGL/compiler/IntermTraverse.cpp",
+ "OpenGL/compiler/Intermediate.cpp",
+ "OpenGL/compiler/intermOut.cpp",
+ "OpenGL/compiler/ossource_posix.cpp",
+ "OpenGL/compiler/OutputASM.cpp",
+ "OpenGL/compiler/parseConst.cpp",
+ "OpenGL/compiler/ParseHelper.cpp",
+ "OpenGL/compiler/PoolAlloc.cpp",
+ "OpenGL/compiler/SymbolTable.cpp",
+ "OpenGL/compiler/TranslatorASM.cpp",
+ "OpenGL/compiler/util.cpp",
+ "OpenGL/compiler/ValidateLimitations.cpp",
+ "OpenGL/compiler/ValidateSwitch.cpp",
+ ],
+}
+
+cc_library_static {
+ name: "libswiftshader_compiler",
+
+ defaults: [ "libswiftshader_release", "libswiftshader_compiler_defaults" ],
+}
+
+cc_library_static {
+ name: "libswiftshader_compiler_debug",
+
+ defaults: [ "libswiftshader_debug", "libswiftshader_compiler_defaults" ],
+}
+
+// libEGL libraries
+
+cc_defaults {
+ name: "swiftshader_client_libraries_subzero_or_llvm",
+
+ defaults: [ "libswiftshader_release" ],
+
+ target: {
+ android_arm: {
+ static_libs: [
+ "libswiftshader_subzero",
+ "libsubzero",
+ "libLLVMSupport_subzero",
+ ],
+ },
+
+ android: {
+ static_libs: [
+ "libswiftshader_llvm",
+ "libLLVM_swiftshader",
+ ],
+ },
+
+ host: {
+ static_libs: [
+ "libswiftshader_llvm",
+ "libLLVM_swiftshader",
+ ],
+ },
+ },
+}
+
+cc_defaults {
+ name: "swiftshader_client_libraries_subzero_or_llvm_debug",
+
+ defaults: [ "libswiftshader_debug" ],
+
+ target: {
+ android_arm: {
+ static_libs: [
+ "libswiftshader_subzero_debug",
+ "libsubzero",
+ "libLLVMSupport_subzero",
+ ],
+ },
+
+ android: {
+ static_libs: [
+ "libswiftshader_llvm_debug",
+ "libLLVM_swiftshader",
+ ],
+ },
+
+ host: {
+ static_libs: [
+ "libswiftshader_llvm_debug",
+ "libLLVM_swiftshader",
+ ],
+ },
+ },
+}
+
+cc_defaults {
+ name: "libEGL_swiftshader_defaults",
+
+ defaults: [ "libswiftshader" ],
+
+ cflags: [
+ "-DLOG_TAG=\"libEGL_swiftshader\"",
+ "-DEGLAPI=",
+ "-DEGL_EGLEXT_PROTOTYPES",
+ "-Wno-format",
+ ],
+
+ srcs: [
+ "OpenGL/libEGL/Config.cpp",
+ "OpenGL/libEGL/Display.cpp",
+ "OpenGL/libEGL/Surface.cpp",
+ "OpenGL/libEGL/libEGL.cpp",
+ "OpenGL/libEGL/main.cpp",
+ ],
+
+ version_script: "OpenGL/libEGL/libEGL.lds",
+}
+
+cc_library_shared {
+ name: "libEGL_swiftshader",
+
+ defaults: [
+ "libEGL_swiftshader_defaults",
+ "swiftshader_client_libraries_subzero_or_llvm",
+ ],
+ device_supported: false,
+}
+
+cc_library_shared {
+ name: "libEGL_swiftshader_debug",
+
+ defaults: [
+ "libEGL_swiftshader_defaults",
+ "swiftshader_client_libraries_subzero_or_llvm_debug",
+ ],
+ device_supported: false,
+}
+
+// libGLESv1_CM libraries
+
+cc_defaults {
+ name: "libGLESv1_CM_swiftshader_defaults",
+
+ defaults: [ "libswiftshader" ],
+
+ cflags: [
+ "-DLOG_TAG=\"libGLES_CM_swiftshader\"",
+ "-DEGLAPI=",
+ "-DGL_API=",
+ "-DGL_APICALL=",
+ "-DGL_GLEXT_PROTOTYPES",
+ "-Wno-format",
+ ],
+
+ srcs: [
+ "OpenGL/libGLES_CM/Buffer.cpp",
+ "OpenGL/libGLES_CM/Context.cpp",
+ "OpenGL/libGLES_CM/Device.cpp",
+ "OpenGL/libGLES_CM/Framebuffer.cpp",
+ "OpenGL/libGLES_CM/IndexDataManager.cpp",
+ "OpenGL/libGLES_CM/libGLES_CM.cpp",
+ "OpenGL/libGLES_CM/main.cpp",
+ "OpenGL/libGLES_CM/Renderbuffer.cpp",
+ "OpenGL/libGLES_CM/ResourceManager.cpp",
+ "OpenGL/libGLES_CM/Texture.cpp",
+ "OpenGL/libGLES_CM/utilities.cpp",
+ "OpenGL/libGLES_CM/VertexDataManager.cpp",
+ ],
+
+ version_script: "OpenGL/libGLES_CM/libGLES_CM.lds",
+}
+
+cc_library_shared {
+ name: "libGLESv1_CM_swiftshader",
+
+ defaults: [
+ "libGLESv1_CM_swiftshader_defaults",
+ "swiftshader_client_libraries_subzero_or_llvm",
+ ],
+ device_supported: false,
+}
+
+cc_library_shared {
+ name: "libGLESv1_CM_swiftshader_debug",
+
+ defaults: [
+ "libGLESv1_CM_swiftshader_defaults",
+ "swiftshader_client_libraries_subzero_or_llvm_debug",
+ ],
+ device_supported: false,
+}
+
+// libGLESv2 libraries
+
+cc_defaults {
+ name: "libGLESv2_swiftshader_defaults",
+
+ defaults: [ "libswiftshader" ],
+ device_supported: false,
+
+ cflags: [
+ "-DLOG_TAG=\"libGLESv2_swiftshader\"",
+ "-DEGLAPI=",
+ "-DGL_API=",
+ "-DGL_APICALL=",
+ "-DGL_GLEXT_PROTOTYPES",
+ "-Wno-format",
+ ],
+
+ srcs: [
+ "OpenGL/libGLESv2/Buffer.cpp",
+ "OpenGL/libGLESv2/Context.cpp",
+ "OpenGL/libGLESv2/Device.cpp",
+ "OpenGL/libGLESv2/Fence.cpp",
+ "OpenGL/libGLESv2/Framebuffer.cpp",
+ "OpenGL/libGLESv2/IndexDataManager.cpp",
+ "OpenGL/libGLESv2/libGLESv2.cpp",
+ "OpenGL/libGLESv2/libGLESv3.cpp",
+ "OpenGL/libGLESv2/main.cpp",
+ "OpenGL/libGLESv2/entry_points.cpp",
+ "OpenGL/libGLESv2/Program.cpp",
+ "OpenGL/libGLESv2/Query.cpp",
+ "OpenGL/libGLESv2/Renderbuffer.cpp",
+ "OpenGL/libGLESv2/ResourceManager.cpp",
+ "OpenGL/libGLESv2/Shader.cpp",
+ "OpenGL/libGLESv2/Texture.cpp",
+ "OpenGL/libGLESv2/TransformFeedback.cpp",
+ "OpenGL/libGLESv2/utilities.cpp",
+ "OpenGL/libGLESv2/VertexArray.cpp",
+ "OpenGL/libGLESv2/VertexDataManager.cpp",
+ ],
+
+ version_script: "OpenGL/libGLESv2/libGLESv2.lds",
+}
+
+cc_library_shared {
+ name: "libGLESv2_swiftshader",
+
+ defaults: [
+ "libGLESv2_swiftshader_defaults",
+ "swiftshader_client_libraries_subzero_or_llvm",
+ ],
+ device_supported: false,
+
+ static_libs: [ "libswiftshader_compiler" ],
+}
+
+cc_library_shared {
+ name: "libGLESv2_swiftshader_debug",
+
+ defaults: [
+ "libGLESv2_swiftshader_defaults",
+ "swiftshader_client_libraries_subzero_or_llvm_debug",
+ ],
+ device_supported: false,
+
+ static_libs: [ "libswiftshader_compiler_debug" ],
+}
diff --git a/src/Android.mk b/src/Android.mk
index 9c6513a..366b76b 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -111,6 +111,7 @@
-Wno-unused-value \
-Wno-unused-variable \
-Wno-implicit-exception-spec-mismatch \
+ -Wno-implicit-fallthrough \
-Wno-overloaded-virtual \
-Wno-non-virtual-dtor \
-Wno-attributes \
diff --git a/src/Common/Debug.hpp b/src/Common/Debug.hpp
index 5ccc35a..436854c 100644
--- a/src/Common/Debug.hpp
+++ b/src/Common/Debug.hpp
@@ -15,7 +15,7 @@
#ifndef Debug_hpp
#define Debug_hpp
-#ifdef __ANDROID__
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "DebugAndroid.hpp"
#else
diff --git a/src/Common/DebugAndroid.hpp b/src/Common/DebugAndroid.hpp
index 6dfb61d..a376adc 100644
--- a/src/Common/DebugAndroid.hpp
+++ b/src/Common/DebugAndroid.hpp
@@ -15,7 +15,14 @@
#ifndef DebugAndroid_hpp
#define DebugAndroid_hpp
+#if ANDROID_PLATFORM_SDK_VERSION < 27
#include <cutils/log.h>
+#elif ANDROID_PLATFORM_SDK_VERSION >= 27
+#include <log/log.h>
+#else
+#error "ANDROID_PLATFORM_SDK_VERSION is not defined"
+#endif
+
#include <cassert>
// On Android Virtual Devices we heavily depend on logging, even in
diff --git a/src/Common/GrallocAndroid.cpp b/src/Common/GrallocAndroid.cpp
index 4f87368..c877e99 100644
--- a/src/Common/GrallocAndroid.cpp
+++ b/src/Common/GrallocAndroid.cpp
@@ -13,8 +13,11 @@
// limitations under the License.
#include "GrallocAndroid.hpp"
+#include "Debug.hpp"
-#include <cutils/log.h>
+#ifdef HAVE_GRALLOC1
+#include <sync/sync.h>
+#endif
GrallocModule *GrallocModule::getInstance()
{
@@ -41,7 +44,63 @@
break;
#endif
default:
- ALOGE("unknown gralloc major version (%d)", m_major_version);
+ TRACE("unknown gralloc major version (%d)", m_major_version);
break;
}
}
+
+int GrallocModule::lock(buffer_handle_t handle, int usage, int left, int top, int width, int height, void **vaddr)
+{
+ switch(m_major_version)
+ {
+ case 0:
+ {
+ return m_module->lock(m_module, handle, usage, left, top, width, height, vaddr);
+ }
+ case 1:
+#ifdef HAVE_GRALLOC1
+ {
+ gralloc1_rect_t outRect{};
+ outRect.left = left;
+ outRect.top = top;
+ outRect.width = width;
+ outRect.height = height;
+ return m_gralloc1_lock(m_gralloc1_device, handle, usage, usage, &outRect, vaddr, -1);
+ }
+#endif
+ default:
+ {
+ TRACE("no gralloc module to lock");
+ return -1;
+ }
+ }
+}
+
+int GrallocModule::unlock(buffer_handle_t handle)
+{
+ switch(m_major_version)
+ {
+ case 0:
+ {
+ return m_module->unlock(m_module, handle);
+ }
+ case 1:
+#ifdef HAVE_GRALLOC1
+ {
+ int32_t fenceFd = -1;
+ int error = m_gralloc1_unlock(m_gralloc1_device, handle, &fenceFd);
+ if (!error)
+ {
+ sync_wait(fenceFd, -1);
+ close(fenceFd);
+ }
+ return error;
+ }
+#endif
+ default:
+ {
+ TRACE("no gralloc module to unlock");
+ return -1;
+ }
+ }
+}
diff --git a/src/Common/GrallocAndroid.hpp b/src/Common/GrallocAndroid.hpp
index 3ebb5d7..fe0b15a 100644
--- a/src/Common/GrallocAndroid.hpp
+++ b/src/Common/GrallocAndroid.hpp
@@ -16,11 +16,9 @@
#define GRALLOC_ANDROID
#include <hardware/gralloc.h>
-#include <cutils/log.h>
#ifdef HAVE_GRALLOC1
#include <hardware/gralloc1.h>
-#include <sync/sync.h>
#endif
#include <unistd.h> // for close()
@@ -29,61 +27,8 @@
{
public:
static GrallocModule *getInstance();
- int lock(buffer_handle_t handle, int usage, int left, int top, int width, int height, void **vaddr)
- {
- switch(m_major_version)
- {
- case 0:
- {
- return m_module->lock(m_module, handle, usage, left, top, width, height, vaddr);
- }
- case 1:
-#ifdef HAVE_GRALLOC1
- {
- gralloc1_rect_t outRect{};
- outRect.left = left;
- outRect.top = top;
- outRect.width = width;
- outRect.height = height;
- return m_gralloc1_lock(m_gralloc1_device, handle, usage, usage, &outRect, vaddr, -1);
- }
-#endif
- default:
- {
- ALOGE("no gralloc module to lock");
- return -1;
- }
- }
- }
-
- int unlock(buffer_handle_t handle)
- {
- switch(m_major_version)
- {
- case 0:
- {
- return m_module->unlock(m_module, handle);
- }
- case 1:
-#ifdef HAVE_GRALLOC1
- {
- int32_t fenceFd = -1;
- int error = m_gralloc1_unlock(m_gralloc1_device, handle, &fenceFd);
- if (!error)
- {
- sync_wait(fenceFd, -1);
- close(fenceFd);
- }
- return error;
- }
-#endif
- default:
- {
- ALOGE("no gralloc module to unlock");
- return -1;
- }
- }
- }
+ int lock(buffer_handle_t handle, int usage, int left, int top, int width, int height, void **vaddr);
+ int unlock(buffer_handle_t handle);
private:
GrallocModule();
diff --git a/src/Common/SharedLibrary.hpp b/src/Common/SharedLibrary.hpp
index ab710eb..8a8c3a1 100644
--- a/src/Common/SharedLibrary.hpp
+++ b/src/Common/SharedLibrary.hpp
@@ -21,17 +21,20 @@
#include <dlfcn.h>
#endif
+#include <string>
+
void *getLibraryHandle(const char *path);
void *loadLibrary(const char *path);
void freeLibrary(void *library);
void *getProcAddress(void *library, const char *name);
template<int n>
-void *loadLibrary(const char *(&names)[n], const char *mustContainSymbol = nullptr)
+void *loadLibrary(const std::string &libraryDirectory, const char *(&names)[n], const char *mustContainSymbol = nullptr)
{
- for(int i = 0; i < n; i++)
+ for(const char *libraryName : names)
{
- void *library = getLibraryHandle(names[i]);
+ std::string libraryPath = libraryDirectory + libraryName;
+ void *library = getLibraryHandle(libraryPath.c_str());
if(library)
{
@@ -44,9 +47,10 @@
}
}
- for(int i = 0; i < n; i++)
+ for(const char *libraryName : names)
{
- void *library = loadLibrary(names[i]);
+ std::string libraryPath = libraryDirectory + libraryName;
+ void *library = loadLibrary(libraryPath.c_str());
if(library)
{
@@ -84,6 +88,25 @@
{
return (void*)GetProcAddress((HMODULE)library, name);
}
+
+ inline std::string getModuleDirectory()
+ {
+ static int dummy_symbol = 0;
+
+ HMODULE module = NULL;
+ GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCTSTR)&dummy_symbol, &module);
+
+ char filename[1024];
+ if(module && (GetModuleFileName(module, filename, sizeof(filename)) != 0))
+ {
+ std::string directory(filename);
+ return directory.substr(0, directory.find_last_of("\\/") + 1).c_str();
+ }
+ else
+ {
+ return "";
+ }
+ }
#else
inline void *loadLibrary(const char *path)
{
@@ -127,6 +150,22 @@
return symbol;
}
+
+ inline std::string getModuleDirectory()
+ {
+ static int dummy_symbol = 0;
+
+ Dl_info dl_info;
+ if(dladdr(&dummy_symbol, &dl_info) != 0)
+ {
+ std::string directory(dl_info.dli_fname);
+ return directory.substr(0, directory.find_last_of("\\/") + 1).c_str();
+ }
+ else
+ {
+ return "";
+ }
+ }
#endif
#endif // SharedLibrary_hpp
diff --git a/src/Main/FrameBuffer.cpp b/src/Main/FrameBuffer.cpp
index 82dff46..7a8ddc1 100644
--- a/src/Main/FrameBuffer.cpp
+++ b/src/Main/FrameBuffer.cpp
@@ -23,10 +23,6 @@
#include <string.h>
#include <time.h>
-#ifdef __ANDROID__
-#include <cutils/properties.h>
-#endif
-
#define ASYNCHRONOUS_BLIT false // FIXME: Currently leads to rare race conditions
namespace sw
diff --git a/src/Main/FrameBufferAndroid.cpp b/src/Main/FrameBufferAndroid.cpp
index 9b47171..0ae5f09 100644
--- a/src/Main/FrameBufferAndroid.cpp
+++ b/src/Main/FrameBufferAndroid.cpp
@@ -17,7 +17,6 @@
#include "Common/GrallocAndroid.hpp"
#include <system/window.h>
-#include <cutils/log.h>
namespace sw
{
@@ -88,14 +87,14 @@
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
0, 0, buffer->width, buffer->height, &framebuffer) != 0)
{
- ALOGE("%s failed to lock buffer %p", __FUNCTION__, buffer);
+ TRACE("%s failed to lock buffer %p", __FUNCTION__, buffer);
return nullptr;
}
if((buffer->width < width) || (buffer->height < height))
{
- ALOGI("lock failed: buffer of %dx%d too small for window of %dx%d",
- buffer->width, buffer->height, width, height);
+ TRACE("lock failed: buffer of %dx%d too small for window of %dx%d",
+ buffer->width, buffer->height, width, height);
return nullptr;
}
@@ -110,11 +109,11 @@
case HAL_PIXEL_FORMAT_BGRA_8888: format = FORMAT_A8R8G8B8; break;
case HAL_PIXEL_FORMAT_RGB_888:
// Frame buffers are expected to have 16-bit or 32-bit colors, not 24-bit.
- ALOGE("Unsupported frame buffer format RGB_888"); ASSERT(false);
+ TRACE("Unsupported frame buffer format RGB_888"); ASSERT(false);
format = FORMAT_R8G8B8; // Wrong component order.
break;
default:
- ALOGE("Unsupported frame buffer format %d", buffer->format); ASSERT(false);
+ TRACE("Unsupported frame buffer format %d", buffer->format); ASSERT(false);
format = FORMAT_NULL;
break;
}
@@ -127,7 +126,7 @@
{
if(!buffer)
{
- ALOGE("%s: badness unlock with no active buffer", __FUNCTION__);
+ TRACE("%s: badness unlock with no active buffer", __FUNCTION__);
return;
}
@@ -135,7 +134,7 @@
if(GrallocModule::getInstance()->unlock(buffer->handle) != 0)
{
- ALOGE("%s: badness unlock failed", __FUNCTION__);
+ TRACE("%s: badness unlock failed", __FUNCTION__);
}
}
}
diff --git a/src/OpenGL/common/Image.hpp b/src/OpenGL/common/Image.hpp
index cb77a4c..be6f429 100644
--- a/src/OpenGL/common/Image.hpp
+++ b/src/OpenGL/common/Image.hpp
@@ -24,8 +24,11 @@
#if defined(__ANDROID__)
#include <system/window.h>
#include "../../Common/GrallocAndroid.hpp"
+#endif
+
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
-#define LOGLOCK(fmt, ...) // ALOGI(fmt " tid=%d", ##__VA_ARGS__, gettid())
+#define LOGLOCK(fmt, ...) // TRACE(fmt " tid=%d", ##__VA_ARGS__, gettid())
#else
#include <assert.h>
#define LOGLOCK(...)
@@ -252,7 +255,7 @@
#endif
case HAL_PIXEL_FORMAT_RGB_888: // Unsupported.
default:
- ALOGE("Unsupported EGL image format %d", halFormat); ASSERT(false);
+ ERR("Unsupported EGL image format %d", halFormat); ASSERT(false);
return GL_NONE;
}
}
@@ -290,7 +293,7 @@
{
if(x != 0 || y != 0 || z != 0)
{
- ALOGI("badness: %s called with unsupported parms: image=%p x=%d y=%d z=%d", __FUNCTION__, this, x, y, z);
+ TRACE("badness: %s called with unsupported parms: image=%p x=%d y=%d z=%d", __FUNCTION__, this, x, y, z);
}
LOGLOCK("image=%p op=%s.ani lock=%d", this, __FUNCTION__, lock);
diff --git a/src/OpenGL/common/debug.cpp b/src/OpenGL/common/debug.cpp
index a7ced89..589f905 100644
--- a/src/OpenGL/common/debug.cpp
+++ b/src/OpenGL/common/debug.cpp
@@ -18,7 +18,13 @@
#ifdef __ANDROID__
#include <utils/String8.h>
+#if ANDROID_PLATFORM_SDK_VERSION < 27
#include <cutils/log.h>
+#elif ANDROID_PLATFORM_SDK_VERSION >= 27
+#include <log/log.h>
+#else
+#error "ANDROID_PLATFORM_SDK_VERSION is not defined"
+#endif
#endif
#include <stdio.h>
@@ -26,8 +32,8 @@
namespace es
{
-#ifdef __ANDROID__
- void output(const char *format, va_list vararg)
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
+ static void output(const char *format, va_list vararg)
{
ALOGI("%s", android::String8::formatV(format, vararg).string());
}
diff --git a/src/OpenGL/common/debug.h b/src/OpenGL/common/debug.h
index aadb535..a5653b7 100644
--- a/src/OpenGL/common/debug.h
+++ b/src/OpenGL/common/debug.h
@@ -17,7 +17,7 @@
#ifndef COMMON_DEBUG_H_
#define COMMON_DEBUG_H_
-#ifdef __ANDROID__
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
#else
#include <stdio.h>
diff --git a/src/OpenGL/compiler/Android.mk b/src/OpenGL/compiler/Android.mk
index 07d9b6c..bc9d439 100644
--- a/src/OpenGL/compiler/Android.mk
+++ b/src/OpenGL/compiler/Android.mk
@@ -29,6 +29,7 @@
-Wno-unused-parameter \
-Wno-unused-variable \
-Wno-implicit-exception-spec-mismatch \
+ -Wno-implicit-fallthrough \
-Wno-overloaded-virtual \
-Wno-attributes \
-Wno-unknown-attributes \
diff --git a/src/OpenGL/compiler/ConstantUnion.h b/src/OpenGL/compiler/ConstantUnion.h
index 6b1050f..89b21e1 100644
--- a/src/OpenGL/compiler/ConstantUnion.h
+++ b/src/OpenGL/compiler/ConstantUnion.h
@@ -15,10 +15,10 @@
#ifndef _CONSTANT_UNION_INCLUDED_
#define _CONSTANT_UNION_INCLUDED_
-#ifndef __ANDROID__
-#include <assert.h>
-#else
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
+#else
+#include <assert.h>
#endif
class ConstantUnion {
diff --git a/src/OpenGL/compiler/SymbolTable.h b/src/OpenGL/compiler/SymbolTable.h
index 3466f2f..2fbf3cf 100644
--- a/src/OpenGL/compiler/SymbolTable.h
+++ b/src/OpenGL/compiler/SymbolTable.h
@@ -38,10 +38,10 @@
// are tracked in the intermediate representation, not the symbol table.
//
-#ifndef __ANDROID__
-#include <assert.h>
-#else
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
+#else
+#include <assert.h>
#endif
#include "InfoSink.h"
diff --git a/src/OpenGL/compiler/debug.h b/src/OpenGL/compiler/debug.h
index 2755d23..77798ef 100644
--- a/src/OpenGL/compiler/debug.h
+++ b/src/OpenGL/compiler/debug.h
@@ -17,7 +17,7 @@
#ifndef COMPILER_DEBUG_H_
#define COMPILER_DEBUG_H_
-#ifdef __ANDROID__
+#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD)
#include "../../Common/DebugAndroid.hpp"
#define Trace(...) ((void)0)
diff --git a/src/OpenGL/libEGL/Android.mk b/src/OpenGL/libEGL/Android.mk
index 60abaca..9d4c9217 100644
--- a/src/OpenGL/libEGL/Android.mk
+++ b/src/OpenGL/libEGL/Android.mk
@@ -1,5 +1,7 @@
LOCAL_PATH:= $(call my-dir)
+COMMON_SWIFTSHADER_RELATIVE_PATH := $(if $(BOARD_SWIFTSHADER_RELATIVE_PATH),$(BOARD_SWIFTSHADER_RELATIVE_PATH),egl)
+
COMMON_CFLAGS := \
-DLOG_TAG=\"libEGL_swiftshader\" \
-std=c++11 \
@@ -11,6 +13,7 @@
-Wno-unused-function \
-Wno-unused-parameter \
-Wno-implicit-exception-spec-mismatch \
+ -Wno-implicit-fallthrough \
-Wno-overloaded-virtual \
-Wno-attributes \
-Wno-unknown-attributes \
@@ -75,9 +78,9 @@
endif
ifeq (HasRelativePath,$(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo HasRelativePath))
-LOCAL_MODULE_RELATIVE_PATH := egl
+LOCAL_MODULE_RELATIVE_PATH := $(COMMON_SWIFTSHADER_RELATIVE_PATH)
else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(COMMON_SWIFTSHADER_RELATIVE_PATH)
endif
LOCAL_VENDOR_MODULE := true
@@ -100,9 +103,9 @@
endif
ifeq (HasRelativePath,$(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo HasRelativePath))
-LOCAL_MODULE_RELATIVE_PATH := egl
+LOCAL_MODULE_RELATIVE_PATH := $(COMMON_SWIFTSHADER_RELATIVE_PATH)
else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(COMMON_SWIFTSHADER_RELATIVE_PATH)
endif
LOCAL_VENDOR_MODULE := true
diff --git a/src/OpenGL/libEGL/Display.cpp b/src/OpenGL/libEGL/Display.cpp
index 2001d74..cd0cffb 100644
--- a/src/OpenGL/libEGL/Display.cpp
+++ b/src/OpenGL/libEGL/Display.cpp
@@ -671,12 +671,12 @@
#elif defined(__ANDROID__)
if(!window)
{
- ALOGE("%s called with window==NULL %s:%d", __FUNCTION__, __FILE__, __LINE__);
+ ERR("%s called with window==NULL %s:%d", __FUNCTION__, __FILE__, __LINE__);
return false;
}
if(static_cast<ANativeWindow*>(window)->common.magic != ANDROID_NATIVE_WINDOW_MAGIC)
{
- ALOGE("%s called with window==%p bad magic %s:%d", __FUNCTION__, window, __FILE__, __LINE__);
+ ERR("%s called with window==%p bad magic %s:%d", __FUNCTION__, window, __FILE__, __LINE__);
return false;
}
return true;
diff --git a/src/OpenGL/libEGL/libEGL.cpp b/src/OpenGL/libEGL/libEGL.cpp
index 74510df..dac923b 100644
--- a/src/OpenGL/libEGL/libEGL.cpp
+++ b/src/OpenGL/libEGL/libEGL.cpp
@@ -1070,7 +1070,7 @@
if(!nativeBuffer || GLPixelFormatFromAndroid(nativeBuffer->format) == GL_NONE)
{
- ALOGW("%s badness unsupported HAL format=%x", __FUNCTION__, nativeBuffer ? nativeBuffer->format : 0);
+ ERR("%s badness unsupported HAL format=%x", __FUNCTION__, nativeBuffer ? nativeBuffer->format : 0);
return error(EGL_BAD_ATTRIBUTE, EGL_NO_IMAGE_KHR);
}
diff --git a/src/OpenGL/libEGL/libEGL.hpp b/src/OpenGL/libEGL/libEGL.hpp
index 46e319a..b6d9d63 100644
--- a/src/OpenGL/libEGL/libEGL.hpp
+++ b/src/OpenGL/libEGL/libEGL.hpp
@@ -75,8 +75,6 @@
public:
LibEGL()
{
- libEGL = nullptr;
- libEGLexports = nullptr;
}
~LibEGL()
@@ -101,11 +99,7 @@
const char *libEGL_lib[] = {"libEGL.dll", "libEGL_translator.dll"};
#endif
#elif defined(__ANDROID__)
- #if defined(__LP64__)
- const char *libEGL_lib[] = {"/vendor/lib64/egl/libEGL_swiftshader.so", "/system/lib64/egl/libEGL_swiftshader.so"};
- #else
- const char *libEGL_lib[] = {"/vendor/lib/egl/libEGL_swiftshader.so", "/system/lib/egl/libEGL_swiftshader.so"};
- #endif
+ const char *libEGL_lib[] = {"libEGL_swiftshader.so", "libEGL_swiftshader.so"};
#elif defined(__linux__)
#if defined(__LP64__)
const char *libEGL_lib[] = {"lib64EGL_translator.so", "libEGL.so.1", "libEGL.so"};
@@ -124,7 +118,8 @@
#error "libEGL::loadExports unimplemented for this platform"
#endif
- libEGL = loadLibrary(libEGL_lib, "libEGL_swiftshader");
+ std::string directory = getModuleDirectory();
+ libEGL = loadLibrary(directory, libEGL_lib, "libEGL_swiftshader");
if(libEGL)
{
@@ -136,8 +131,8 @@
return libEGLexports;
}
- void *libEGL;
- LibEGLexports *libEGLexports;
+ void *libEGL = nullptr;
+ LibEGLexports *libEGLexports = nullptr;
};
#endif // libEGL_hpp
diff --git a/src/OpenGL/libGLES_CM/Android.mk b/src/OpenGL/libGLES_CM/Android.mk
index e34ba42..3d0f0db 100644
--- a/src/OpenGL/libGLES_CM/Android.mk
+++ b/src/OpenGL/libGLES_CM/Android.mk
@@ -1,5 +1,7 @@
LOCAL_PATH:= $(call my-dir)
+COMMON_SWIFTSHADER_RELATIVE_PATH := $(if $(BOARD_SWIFTSHADER_RELATIVE_PATH),$(BOARD_SWIFTSHADER_RELATIVE_PATH),egl)
+
COMMON_CFLAGS := \
-DLOG_TAG=\"libGLES_CM_swiftshader\" \
-std=c++11 \
@@ -18,6 +20,7 @@
-Wno-unused-parameter \
-Wno-unused-variable \
-Wno-implicit-exception-spec-mismatch \
+ -Wno-implicit-fallthrough \
-Wno-overloaded-virtual \
-Wno-attributes \
-Wno-unknown-attributes \
@@ -98,9 +101,9 @@
endif
ifeq (HasRelativePath,$(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo HasRelativePath))
-LOCAL_MODULE_RELATIVE_PATH := egl
+LOCAL_MODULE_RELATIVE_PATH := $(COMMON_SWIFTSHADER_RELATIVE_PATH)
else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(COMMON_SWIFTSHADER_RELATIVE_PATH)
endif
LOCAL_VENDOR_MODULE := true
@@ -123,9 +126,9 @@
endif
ifeq (HasRelativePath,$(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo HasRelativePath))
-LOCAL_MODULE_RELATIVE_PATH := egl
+LOCAL_MODULE_RELATIVE_PATH := $(COMMON_SWIFTSHADER_RELATIVE_PATH)
else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(COMMON_SWIFTSHADER_RELATIVE_PATH)
endif
LOCAL_VENDOR_MODULE := true
diff --git a/src/OpenGL/libGLES_CM/libGLES_CM.hpp b/src/OpenGL/libGLES_CM/libGLES_CM.hpp
index d6740ec..ae6237b 100644
--- a/src/OpenGL/libGLES_CM/libGLES_CM.hpp
+++ b/src/OpenGL/libGLES_CM/libGLES_CM.hpp
@@ -231,8 +231,6 @@
public:
LibGLES_CM()
{
- libGLES_CM = nullptr;
- libGLES_CMexports = nullptr;
}
~LibGLES_CM()
@@ -262,11 +260,7 @@
const char *libGLES_CM_lib[] = {"libGLES_CM.dll", "libGLES_CM_translator.dll"};
#endif
#elif defined(__ANDROID__)
- #if defined(__LP64__)
- const char *libGLES_CM_lib[] = {"/vendor/lib64/egl/libGLESv1_CM_swiftshader.so", "/system/lib64/egl/libGLESv1_CM_swiftshader.so"};
- #else
- const char *libGLES_CM_lib[] = {"/vendor/lib/egl/libGLESv1_CM_swiftshader.so", "/system/lib/egl/libGLESv1_CM_swiftshader.so"};
- #endif
+ const char *libGLES_CM_lib[] = {"libGLESv1_CM_swiftshader.so", "libGLESv1_CM_swiftshader.so"};
#elif defined(__linux__)
#if defined(__LP64__)
const char *libGLES_CM_lib[] = {"lib64GLES_CM_translator.so", "libGLES_CM.so.1", "libGLES_CM.so"};
@@ -285,7 +279,8 @@
#error "libGLES_CM::loadExports unimplemented for this platform"
#endif
- libGLES_CM = loadLibrary(libGLES_CM_lib, "libGLES_CM_swiftshader");
+ std::string directory = getModuleDirectory();
+ libGLES_CM = loadLibrary(directory, libGLES_CM_lib, "libGLES_CM_swiftshader");
if(libGLES_CM)
{
@@ -297,8 +292,8 @@
return libGLES_CMexports;
}
- void *libGLES_CM;
- LibGLES_CMexports *libGLES_CMexports;
+ void *libGLES_CM = nullptr;
+ LibGLES_CMexports *libGLES_CMexports = nullptr;
};
#endif // libGLES_CM_hpp
diff --git a/src/OpenGL/libGLESv2/Android.mk b/src/OpenGL/libGLESv2/Android.mk
index 56d077f..f4babfe 100644
--- a/src/OpenGL/libGLESv2/Android.mk
+++ b/src/OpenGL/libGLESv2/Android.mk
@@ -1,5 +1,7 @@
LOCAL_PATH:= $(call my-dir)
+COMMON_SWIFTSHADER_RELATIVE_PATH := $(if $(BOARD_SWIFTSHADER_RELATIVE_PATH),$(BOARD_SWIFTSHADER_RELATIVE_PATH),egl)
+
COMMON_CFLAGS := \
-DLOG_TAG=\"libGLESv2_swiftshader\" \
-fno-operator-names \
@@ -18,6 +20,7 @@
-Wno-unused-private-field \
-Wno-unused-variable \
-Wno-implicit-exception-spec-mismatch \
+ -Wno-implicit-fallthrough \
-Wno-overloaded-virtual \
-Wno-attributes \
-Wno-unknown-attributes \
@@ -107,9 +110,9 @@
endif
ifeq (HasRelativePath,$(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo HasRelativePath))
-LOCAL_MODULE_RELATIVE_PATH := egl
+LOCAL_MODULE_RELATIVE_PATH := $(COMMON_SWIFTSHADER_RELATIVE_PATH)
else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(COMMON_SWIFTSHADER_RELATIVE_PATH)
endif
LOCAL_VENDOR_MODULE := true
@@ -132,9 +135,9 @@
endif
ifeq (HasRelativePath,$(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo HasRelativePath))
-LOCAL_MODULE_RELATIVE_PATH := egl
+LOCAL_MODULE_RELATIVE_PATH := $(COMMON_SWIFTSHADER_RELATIVE_PATH)
else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$(COMMON_SWIFTSHADER_RELATIVE_PATH)
endif
LOCAL_VENDOR_MODULE := true
diff --git a/src/OpenGL/libGLESv2/libGLESv2.cpp b/src/OpenGL/libGLESv2/libGLESv2.cpp
index 3ba2a3a..e722a86 100644
--- a/src/OpenGL/libGLESv2/libGLESv2.cpp
+++ b/src/OpenGL/libGLESv2/libGLESv2.cpp
@@ -37,10 +37,6 @@
#include <algorithm>
#include <limits>
-#ifdef __ANDROID__
-#include <cutils/log.h>
-#endif
-
namespace es2
{
@@ -3012,11 +3008,7 @@
if(!context)
{
// Not strictly an error, but probably unintended or attempting to rely on non-compliant behavior
- #ifdef __ANDROID__
- ALOGI("expected_badness glGetIntegerv() called without current context.");
- #else
- ERR("glGetIntegerv() called without current context.");
- #endif
+ ERR("glGetIntegerv() called without current context.");
// This is not spec compliant! When there is no current GL context, functions should
// have no side effects. Google Maps queries these values before creating a context,
diff --git a/src/OpenGL/libGLESv2/libGLESv2.hpp b/src/OpenGL/libGLESv2/libGLESv2.hpp
index 8946f0b..0ad4f08 100644
--- a/src/OpenGL/libGLESv2/libGLESv2.hpp
+++ b/src/OpenGL/libGLESv2/libGLESv2.hpp
@@ -256,8 +256,6 @@
public:
LibGLESv2()
{
- libGLESv2 = nullptr;
- libGLESv2exports = nullptr;
}
~LibGLESv2()
@@ -287,11 +285,7 @@
const char *libGLESv2_lib[] = {"libGLESv2.dll", "libGLES_V2_translator.dll"};
#endif
#elif defined(__ANDROID__)
- #if defined(__LP64__)
- const char *libGLESv2_lib[] = {"/vendor/lib64/egl/libGLESv2_swiftshader.so", "/system/lib64/egl/libGLESv2_swiftshader.so"};
- #else
- const char *libGLESv2_lib[] = {"/vendor/lib/egl/libGLESv2_swiftshader.so", "/system/lib/egl/libGLESv2_swiftshader.so"};
- #endif
+ const char *libGLESv2_lib[] = {"libGLESv2_swiftshader.so", "libGLESv2_swiftshader.so"};
#elif defined(__linux__)
#if defined(__LP64__)
const char *libGLESv2_lib[] = {"lib64GLES_V2_translator.so", "libGLESv2.so.2", "libGLESv2.so"};
@@ -310,7 +304,8 @@
#error "libGLESv2::loadExports unimplemented for this platform"
#endif
- libGLESv2 = loadLibrary(libGLESv2_lib, "libGLESv2_swiftshader");
+ std::string directory = getModuleDirectory();
+ libGLESv2 = loadLibrary(directory, libGLESv2_lib, "libGLESv2_swiftshader");
if(libGLESv2)
{
@@ -322,8 +317,8 @@
return libGLESv2exports;
}
- void *libGLESv2;
- LibGLESv2exports *libGLESv2exports;
+ void *libGLESv2 = nullptr;
+ LibGLESv2exports *libGLESv2exports = nullptr;
};
#endif // libGLESv2_hpp
diff --git a/src/Reactor/Android.mk b/src/Reactor/Android.mk
index fa90a1a..4e3ac60 100644
--- a/src/Reactor/Android.mk
+++ b/src/Reactor/Android.mk
@@ -116,6 +116,7 @@
-Wno-error=unused-lambda-capture \
-Wno-unused-parameter \
-Wno-implicit-exception-spec-mismatch \
+ -Wno-implicit-fallthrough \
-Wno-overloaded-virtual \
-Wno-non-virtual-dtor \
-Wno-unknown-warning-option
diff --git a/third_party/LLVM/Android.bp b/third_party/LLVM/Android.bp
new file mode 100644
index 0000000..a5be4ab
--- /dev/null
+++ b/third_party/LLVM/Android.bp
@@ -0,0 +1,455 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// No ARM, MIPS support because there are no generated files checked in
+// for these architectures.
+
+libLLVM_swiftshader_x86_srcs = [
+ "lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp",
+ "lib/Target/X86/InstPrinter/X86InstComments.cpp",
+ "lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp",
+ "lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp",
+ "lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp",
+ "lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp",
+ "lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp",
+ "lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp",
+ "lib/Target/X86/TargetInfo/X86TargetInfo.cpp",
+ "lib/Target/X86/Utils/X86ShuffleDecode.cpp",
+ "lib/Target/X86/X86CodeEmitter.cpp",
+ "lib/Target/X86/X86ELFWriterInfo.cpp",
+ "lib/Target/X86/X86FastISel.cpp",
+ "lib/Target/X86/X86FloatingPoint.cpp",
+ "lib/Target/X86/X86FrameLowering.cpp",
+ "lib/Target/X86/X86InstrInfo.cpp",
+ "lib/Target/X86/X86ISelDAGToDAG.cpp",
+ "lib/Target/X86/X86ISelLowering.cpp",
+ "lib/Target/X86/X86JITInfo.cpp",
+ "lib/Target/X86/X86RegisterInfo.cpp",
+ "lib/Target/X86/X86SelectionDAGInfo.cpp",
+ "lib/Target/X86/X86Subtarget.cpp",
+ "lib/Target/X86/X86TargetMachine.cpp",
+ "lib/Target/X86/X86TargetObjectFile.cpp",
+ "lib/Target/X86/X86VZeroUpper.cpp",
+]
+
+cc_library_static {
+ name: "libLLVM_swiftshader",
+
+ defaults: [ "swiftshader_common_release" ],
+
+ device_supported: false,
+ host_supported: true,
+
+ cflags: [
+ "-D_GNU_SOURCE",
+ "-D__STDC_LIMIT_MACROS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_FORMAT_MACROS",
+ "-DLOG_TAG=\"libLLVM_swiftshader\"",
+ "-Wno-implicit-fallthrough",
+ "-Wno-unused-result",
+ "-Wno-unused-function",
+ "-Wno-unused-variable",
+ "-Wno-unused-parameter",
+ "-Wno-unused-local-typedef",
+ "-Wno-unused-private-field",
+ "-Wno-unneeded-internal-declaration",
+ ],
+
+ cppflags: [
+ "-Wno-sign-promo",
+ "-Wno-undefined-var-template",
+ ],
+
+ srcs: [
+ "lib/Analysis/AliasAnalysis.cpp",
+ "lib/Analysis/AliasSetTracker.cpp",
+ "lib/Analysis/BasicAliasAnalysis.cpp",
+ "lib/Analysis/BranchProbabilityInfo.cpp",
+ "lib/Analysis/CaptureTracking.cpp",
+ "lib/Analysis/ConstantFolding.cpp",
+ "lib/Analysis/DebugInfo.cpp",
+ "lib/Analysis/DIBuilder.cpp",
+ "lib/Analysis/InstructionSimplify.cpp",
+ "lib/Analysis/IVUsers.cpp",
+ "lib/Analysis/Loads.cpp",
+ "lib/Analysis/LoopInfo.cpp",
+ "lib/Analysis/LoopPass.cpp",
+ "lib/Analysis/MemoryBuiltins.cpp",
+ "lib/Analysis/MemoryDependenceAnalysis.cpp",
+ "lib/Analysis/NoAliasAnalysis.cpp",
+ "lib/Analysis/PathNumbering.cpp",
+ "lib/Analysis/PHITransAddr.cpp",
+ "lib/Analysis/ProfileInfo.cpp",
+ "lib/Analysis/ScalarEvolution.cpp",
+ "lib/Analysis/ScalarEvolutionExpander.cpp",
+ "lib/Analysis/ScalarEvolutionNormalization.cpp",
+ "lib/Analysis/TypeBasedAliasAnalysis.cpp",
+ "lib/Analysis/ValueTracking.cpp",
+ "lib/CodeGen/SelectionDAG/DAGCombiner.cpp",
+ "lib/CodeGen/SelectionDAG/FastISel.cpp",
+ "lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp",
+ "lib/CodeGen/SelectionDAG/InstrEmitter.cpp",
+ "lib/CodeGen/SelectionDAG/LegalizeDAG.cpp",
+ "lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp",
+ "lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp",
+ "lib/CodeGen/SelectionDAG/LegalizeTypes.cpp",
+ "lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp",
+ "lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp",
+ "lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp",
+ "lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp",
+ "lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp",
+ "lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp",
+ "lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp",
+ "lib/CodeGen/SelectionDAG/SelectionDAG.cpp",
+ "lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp",
+ "lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp",
+ "lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp",
+ "lib/CodeGen/SelectionDAG/TargetLowering.cpp",
+ "lib/CodeGen/SelectionDAG/TargetSelectionDAGInfo.cpp",
+ "lib/CodeGen/AggressiveAntiDepBreaker.cpp",
+ "lib/CodeGen/AllocationOrder.cpp",
+ "lib/CodeGen/Analysis.cpp",
+ "lib/CodeGen/BranchFolding.cpp",
+ "lib/CodeGen/CalcSpillWeights.cpp",
+ "lib/CodeGen/CallingConvLower.cpp",
+ "lib/CodeGen/CodeGen.cpp",
+ "lib/CodeGen/CodePlacementOpt.cpp",
+ "lib/CodeGen/CriticalAntiDepBreaker.cpp",
+ "lib/CodeGen/DeadMachineInstructionElim.cpp",
+ "lib/CodeGen/DwarfEHPrepare.cpp",
+ "lib/CodeGen/EdgeBundles.cpp",
+ "lib/CodeGen/ELFCodeEmitter.cpp",
+ "lib/CodeGen/ELFWriter.cpp",
+ "lib/CodeGen/ExecutionDepsFix.cpp",
+ "lib/CodeGen/ExpandISelPseudos.cpp",
+ "lib/CodeGen/ExpandPostRAPseudos.cpp",
+ "lib/CodeGen/GCMetadata.cpp",
+ "lib/CodeGen/GCStrategy.cpp",
+ "lib/CodeGen/IfConversion.cpp",
+ "lib/CodeGen/InlineSpiller.cpp",
+ "lib/CodeGen/InterferenceCache.cpp",
+ "lib/CodeGen/IntrinsicLowering.cpp",
+ "lib/CodeGen/LatencyPriorityQueue.cpp",
+ "lib/CodeGen/LexicalScopes.cpp",
+ "lib/CodeGen/LiveDebugVariables.cpp",
+ "lib/CodeGen/LiveIntervalAnalysis.cpp",
+ "lib/CodeGen/LiveInterval.cpp",
+ "lib/CodeGen/LiveIntervalUnion.cpp",
+ "lib/CodeGen/LiveRangeCalc.cpp",
+ "lib/CodeGen/LiveRangeEdit.cpp",
+ "lib/CodeGen/LiveStackAnalysis.cpp",
+ "lib/CodeGen/LiveVariables.cpp",
+ "lib/CodeGen/LLVMTargetMachine.cpp",
+ "lib/CodeGen/LocalStackSlotAllocation.cpp",
+ "lib/CodeGen/MachineBasicBlock.cpp",
+ "lib/CodeGen/MachineBlockFrequencyInfo.cpp",
+ "lib/CodeGen/MachineBranchProbabilityInfo.cpp",
+ "lib/CodeGen/MachineCSE.cpp",
+ "lib/CodeGen/MachineDominators.cpp",
+ "lib/CodeGen/MachineFunctionAnalysis.cpp",
+ "lib/CodeGen/MachineFunction.cpp",
+ "lib/CodeGen/MachineFunctionPass.cpp",
+ "lib/CodeGen/MachineFunctionPrinterPass.cpp",
+ "lib/CodeGen/MachineInstr.cpp",
+ "lib/CodeGen/MachineLICM.cpp",
+ "lib/CodeGen/MachineLoopInfo.cpp",
+ "lib/CodeGen/MachineLoopRanges.cpp",
+ "lib/CodeGen/MachineModuleInfo.cpp",
+ "lib/CodeGen/MachineModuleInfoImpls.cpp",
+ "lib/CodeGen/MachinePassRegistry.cpp",
+ "lib/CodeGen/MachineRegisterInfo.cpp",
+ "lib/CodeGen/MachineSink.cpp",
+ "lib/CodeGen/MachineSSAUpdater.cpp",
+ "lib/CodeGen/MachineVerifier.cpp",
+ "lib/CodeGen/ObjectCodeEmitter.cpp",
+ "lib/CodeGen/OcamlGC.cpp",
+ "lib/CodeGen/OptimizePHIs.cpp",
+ "lib/CodeGen/Passes.cpp",
+ "lib/CodeGen/PeepholeOptimizer.cpp",
+ "lib/CodeGen/PHIElimination.cpp",
+ "lib/CodeGen/PHIEliminationUtils.cpp",
+ "lib/CodeGen/PostRASchedulerList.cpp",
+ "lib/CodeGen/ProcessImplicitDefs.cpp",
+ "lib/CodeGen/PrologEpilogInserter.cpp",
+ "lib/CodeGen/PseudoSourceValue.cpp",
+ "lib/CodeGen/RegAllocBasic.cpp",
+ "lib/CodeGen/RegAllocFast.cpp",
+ "lib/CodeGen/RegAllocGreedy.cpp",
+ "lib/CodeGen/RegAllocLinearScan.cpp",
+ "lib/CodeGen/RegAllocPBQP.cpp",
+ "lib/CodeGen/RegisterClassInfo.cpp",
+ "lib/CodeGen/RegisterCoalescer.cpp",
+ "lib/CodeGen/RegisterScavenging.cpp",
+ "lib/CodeGen/RenderMachineFunction.cpp",
+ "lib/CodeGen/ScheduleDAG.cpp",
+ "lib/CodeGen/ScheduleDAGEmit.cpp",
+ "lib/CodeGen/ScheduleDAGInstrs.cpp",
+ "lib/CodeGen/ScheduleDAGPrinter.cpp",
+ "lib/CodeGen/ScoreboardHazardRecognizer.cpp",
+ "lib/CodeGen/ShadowStackGC.cpp",
+ "lib/CodeGen/ShrinkWrapping.cpp",
+ "lib/CodeGen/SjLjEHPrepare.cpp",
+ "lib/CodeGen/SlotIndexes.cpp",
+ "lib/CodeGen/Spiller.cpp",
+ "lib/CodeGen/SpillPlacement.cpp",
+ "lib/CodeGen/SplitKit.cpp",
+ "lib/CodeGen/Splitter.cpp",
+ "lib/CodeGen/StackProtector.cpp",
+ "lib/CodeGen/StackSlotColoring.cpp",
+ "lib/CodeGen/StrongPHIElimination.cpp",
+ "lib/CodeGen/TailDuplication.cpp",
+ "lib/CodeGen/TargetInstrInfoImpl.cpp",
+ "lib/CodeGen/TargetLoweringObjectFileImpl.cpp",
+ "lib/CodeGen/TwoAddressInstructionPass.cpp",
+ "lib/CodeGen/UnreachableBlockElim.cpp",
+ "lib/CodeGen/VirtRegMap.cpp",
+ "lib/CodeGen/VirtRegRewriter.cpp",
+ "lib/ExecutionEngine/JIT/Intercept.cpp",
+ "lib/ExecutionEngine/JIT/JIT.cpp",
+ "lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp",
+ "lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp",
+ "lib/ExecutionEngine/JIT/JITEmitter.cpp",
+ "lib/ExecutionEngine/JIT/JITMemoryManager.cpp",
+ "lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp",
+ "lib/ExecutionEngine/ExecutionEngine.cpp",
+ "lib/ExecutionEngine/TargetSelect.cpp",
+ "lib/MC/ELFObjectWriter.cpp",
+ "lib/MC/MachObjectWriter.cpp",
+ "lib/MC/MCAsmBackend.cpp",
+ "lib/MC/MCAsmInfoCOFF.cpp",
+ "lib/MC/MCAsmInfo.cpp",
+ "lib/MC/MCAsmInfoDarwin.cpp",
+ "lib/MC/MCAsmStreamer.cpp",
+ "lib/MC/MCAssembler.cpp",
+ "lib/MC/MCAtom.cpp",
+ "lib/MC/MCCodeEmitter.cpp",
+ "lib/MC/MCCodeGenInfo.cpp",
+ "lib/MC/MCContext.cpp",
+ "lib/MC/MCDisassembler.cpp",
+ "lib/MC/MCDwarf.cpp",
+ "lib/MC/MCELF.cpp",
+ "lib/MC/MCELFObjectTargetWriter.cpp",
+ "lib/MC/MCELFStreamer.cpp",
+ "lib/MC/MCExpr.cpp",
+ "lib/MC/MCInst.cpp",
+ "lib/MC/MCInstPrinter.cpp",
+ "lib/MC/MCInstrAnalysis.cpp",
+ "lib/MC/MCLabel.cpp",
+ "lib/MC/MCLoggingStreamer.cpp",
+ "lib/MC/MCMachObjectTargetWriter.cpp",
+ "lib/MC/MCMachOStreamer.cpp",
+ "lib/MC/MCModule.cpp",
+ "lib/MC/MCNullStreamer.cpp",
+ "lib/MC/MCObjectFileInfo.cpp",
+ "lib/MC/MCObjectStreamer.cpp",
+ "lib/MC/MCObjectWriter.cpp",
+ "lib/MC/MCPureStreamer.cpp",
+ "lib/MC/MCSectionCOFF.cpp",
+ "lib/MC/MCSection.cpp",
+ "lib/MC/MCSectionELF.cpp",
+ "lib/MC/MCSectionMachO.cpp",
+ "lib/MC/MCStreamer.cpp",
+ "lib/MC/MCSubtargetInfo.cpp",
+ "lib/MC/MCSymbol.cpp",
+ "lib/MC/MCTargetAsmLexer.cpp",
+ "lib/MC/MCValue.cpp",
+ "lib/MC/MCWin64EH.cpp",
+ "lib/MC/SubtargetFeature.cpp",
+ "lib/MC/WinCOFFObjectWriter.cpp",
+ "lib/MC/WinCOFFStreamer.cpp",
+ "lib/Support/Allocator.cpp",
+ "lib/Support/APFloat.cpp",
+ "lib/Support/APInt.cpp",
+ "lib/Support/APSInt.cpp",
+ "lib/Support/Atomic.cpp",
+ "lib/Support/BlockFrequency.cpp",
+ "lib/Support/BranchProbability.cpp",
+ "lib/Support/circular_raw_ostream.cpp",
+ "lib/Support/CommandLine.cpp",
+ "lib/Support/ConstantRange.cpp",
+ "lib/Support/CrashRecoveryContext.cpp",
+ "lib/Support/DAGDeltaAlgorithm.cpp",
+ "lib/Support/DataExtractor.cpp",
+ "lib/Support/Debug.cpp",
+ "lib/Support/DeltaAlgorithm.cpp",
+ "lib/Support/Disassembler.cpp",
+ "lib/Support/Dwarf.cpp",
+ "lib/Support/DynamicLibrary.cpp",
+ "lib/Support/Errno.cpp",
+ "lib/Support/ErrorHandling.cpp",
+ "lib/Support/FileUtilities.cpp",
+ "lib/Support/FoldingSet.cpp",
+ "lib/Support/FormattedStream.cpp",
+ "lib/Support/GraphWriter.cpp",
+ "lib/Support/Host.cpp",
+ "lib/Support/IncludeFile.cpp",
+ "lib/Support/IntEqClasses.cpp",
+ "lib/Support/IntervalMap.cpp",
+ "lib/Support/IsInf.cpp",
+ "lib/Support/IsNAN.cpp",
+ "lib/Support/ManagedStatic.cpp",
+ "lib/Support/MemoryBuffer.cpp",
+ "lib/Support/Memory.cpp",
+ "lib/Support/MemoryObject.cpp",
+ "lib/Support/Mutex.cpp",
+ "lib/Support/Path.cpp",
+ "lib/Support/PathV2.cpp",
+ "lib/Support/PluginLoader.cpp",
+ "lib/Support/PrettyStackTrace.cpp",
+ "lib/Support/Process.cpp",
+ "lib/Support/Program.cpp",
+ "lib/Support/raw_os_ostream.cpp",
+ "lib/Support/raw_ostream.cpp",
+ "lib/Support/Regex.cpp",
+ "lib/Support/RWMutex.cpp",
+ "lib/Support/SearchForAddressOfSpecialSymbol.cpp",
+ "lib/Support/Signals.cpp",
+ "lib/Support/SmallPtrSet.cpp",
+ "lib/Support/SmallVector.cpp",
+ "lib/Support/SourceMgr.cpp",
+ "lib/Support/Statistic.cpp",
+ "lib/Support/StringExtras.cpp",
+ "lib/Support/StringMap.cpp",
+ "lib/Support/StringPool.cpp",
+ "lib/Support/StringRef.cpp",
+ "lib/Support/system_error.cpp",
+ "lib/Support/SystemUtils.cpp",
+ "lib/Support/TargetRegistry.cpp",
+ "lib/Support/Threading.cpp",
+ "lib/Support/ThreadLocal.cpp",
+ "lib/Support/Timer.cpp",
+ "lib/Support/TimeValue.cpp",
+ "lib/Support/ToolOutputFile.cpp",
+ "lib/Support/Triple.cpp",
+ "lib/Support/Twine.cpp",
+ "lib/Support/Valgrind.cpp",
+ "lib/Target/Mangler.cpp",
+ "lib/Target/Target.cpp",
+ "lib/Target/TargetData.cpp",
+ "lib/Target/TargetELFWriterInfo.cpp",
+ "lib/Target/TargetFrameLowering.cpp",
+ "lib/Target/TargetInstrInfo.cpp",
+ "lib/Target/TargetLibraryInfo.cpp",
+ "lib/Target/TargetLoweringObjectFile.cpp",
+ "lib/Target/TargetMachine.cpp",
+ "lib/Target/TargetRegisterInfo.cpp",
+ "lib/Target/TargetSubtargetInfo.cpp",
+ "lib/Transforms/InstCombine/InstCombineAddSub.cpp",
+ "lib/Transforms/InstCombine/InstCombineAndOrXor.cpp",
+ "lib/Transforms/InstCombine/InstCombineCalls.cpp",
+ "lib/Transforms/InstCombine/InstCombineCasts.cpp",
+ "lib/Transforms/InstCombine/InstCombineCompares.cpp",
+ "lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp",
+ "lib/Transforms/InstCombine/InstCombineMulDivRem.cpp",
+ "lib/Transforms/InstCombine/InstCombinePHI.cpp",
+ "lib/Transforms/InstCombine/InstCombineSelect.cpp",
+ "lib/Transforms/InstCombine/InstCombineShifts.cpp",
+ "lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp",
+ "lib/Transforms/InstCombine/InstCombineVectorOps.cpp",
+ "lib/Transforms/InstCombine/InstructionCombining.cpp",
+ "lib/Transforms/Scalar/ADCE.cpp",
+ "lib/Transforms/Scalar/CodeGenPrepare.cpp",
+ "lib/Transforms/Scalar/DeadStoreElimination.cpp",
+ "lib/Transforms/Scalar/GVN.cpp",
+ "lib/Transforms/Scalar/LICM.cpp",
+ "lib/Transforms/Scalar/LoopStrengthReduce.cpp",
+ "lib/Transforms/Scalar/Reassociate.cpp",
+ "lib/Transforms/Scalar/Reg2Mem.cpp",
+ "lib/Transforms/Scalar/ScalarReplAggregates.cpp",
+ "lib/Transforms/Scalar/SCCP.cpp",
+ "lib/Transforms/Scalar/SimplifyCFGPass.cpp",
+ "lib/Transforms/Utils/AddrModeMatcher.cpp",
+ "lib/Transforms/Utils/BasicBlockUtils.cpp",
+ "lib/Transforms/Utils/BreakCriticalEdges.cpp",
+ "lib/Transforms/Utils/BuildLibCalls.cpp",
+ "lib/Transforms/Utils/DemoteRegToStack.cpp",
+ "lib/Transforms/Utils/InstructionNamer.cpp",
+ "lib/Transforms/Utils/LCSSA.cpp",
+ "lib/Transforms/Utils/Local.cpp",
+ "lib/Transforms/Utils/LoopSimplify.cpp",
+ "lib/Transforms/Utils/LowerInvoke.cpp",
+ "lib/Transforms/Utils/LowerSwitch.cpp",
+ "lib/Transforms/Utils/Mem2Reg.cpp",
+ "lib/Transforms/Utils/PromoteMemoryToRegister.cpp",
+ "lib/Transforms/Utils/SimplifyCFG.cpp",
+ "lib/Transforms/Utils/SSAUpdater.cpp",
+ "lib/Transforms/Utils/UnifyFunctionExitNodes.cpp",
+ "lib/VMCore/AsmWriter.cpp",
+ "lib/VMCore/Attributes.cpp",
+ "lib/VMCore/AutoUpgrade.cpp",
+ "lib/VMCore/BasicBlock.cpp",
+ "lib/VMCore/ConstantFold.cpp",
+ "lib/VMCore/Constants.cpp",
+ "lib/VMCore/Core.cpp",
+ "lib/VMCore/DebugInfoProbe.cpp",
+ "lib/VMCore/DebugLoc.cpp",
+ "lib/VMCore/Dominators.cpp",
+ "lib/VMCore/Function.cpp",
+ "lib/VMCore/GCOV.cpp",
+ "lib/VMCore/Globals.cpp",
+ "lib/VMCore/GVMaterializer.cpp",
+ "lib/VMCore/InlineAsm.cpp",
+ "lib/VMCore/Instruction.cpp",
+ "lib/VMCore/Instructions.cpp",
+ "lib/VMCore/IntrinsicInst.cpp",
+ "lib/VMCore/IRBuilder.cpp",
+ "lib/VMCore/LeakDetector.cpp",
+ "lib/VMCore/LLVMContext.cpp",
+ "lib/VMCore/LLVMContextImpl.cpp",
+ "lib/VMCore/Metadata.cpp",
+ "lib/VMCore/Module.cpp",
+ "lib/VMCore/Pass.cpp",
+ "lib/VMCore/PassManager.cpp",
+ "lib/VMCore/PassRegistry.cpp",
+ "lib/VMCore/PrintModulePass.cpp",
+ "lib/VMCore/Type.cpp",
+ "lib/VMCore/Use.cpp",
+ "lib/VMCore/User.cpp",
+ "lib/VMCore/Value.cpp",
+ "lib/VMCore/ValueSymbolTable.cpp",
+ "lib/VMCore/ValueTypes.cpp",
+ "lib/VMCore/Verifier.cpp",
+ ],
+
+ arch: {
+ x86: {
+ local_include_dirs: [ "lib/Target/X86" ],
+
+ srcs: libLLVM_swiftshader_x86_srcs,
+ },
+
+ x86_64: {
+ local_include_dirs: [ "lib/Target/X86" ],
+
+ srcs: libLLVM_swiftshader_x86_srcs,
+ },
+ },
+
+ target: {
+ android: {
+ export_include_dirs: [ "include-android", "include" ],
+ },
+
+ linux: {
+ export_include_dirs: [ "include-linux", "include" ],
+ },
+
+ darwin: {
+ export_include_dirs: [ "include-osx", "include" ],
+ },
+ },
+}
diff --git a/third_party/LLVM/Android.mk b/third_party/LLVM/Android.mk
index a07ca23..23f7d78 100644
--- a/third_party/LLVM/Android.mk
+++ b/third_party/LLVM/Android.mk
@@ -401,6 +401,7 @@
-Wall \
-Werror \
-Wno-implicit-exception-spec-mismatch \
+ -Wno-implicit-fallthrough \
-Wno-overloaded-virtual \
-Wno-undefined-var-template \
-Wno-unneeded-internal-declaration \
diff --git a/third_party/googletest b/third_party/googletest
deleted file mode 160000
index 0fe9660..0000000
--- a/third_party/googletest
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 0fe96607d85cf3a25ac40da369db62bbee2939a5
diff --git a/third_party/llvm-subzero/Android.bp b/third_party/llvm-subzero/Android.bp
new file mode 100644
index 0000000..72c9b32
--- /dev/null
+++ b/third_party/llvm-subzero/Android.bp
@@ -0,0 +1,86 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "libLLVMSupport_subzero",
+
+ defaults: [ "swiftshader_common_release" ],
+
+ device_supported: false,
+ host_supported: true,
+
+ cflags: [
+ "-D_GNU_SOURCE",
+ "-D__STDC_LIMIT_MACROS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_FORMAT_MACROS",
+ "-DLOG_TAG=\"libsubzero\"",
+ "-Wno-implicit-fallthrough",
+ "-Wno-unused-parameter",
+ ],
+
+ cppflags: [
+ "-Wno-sign-promo",
+ ],
+
+ srcs: [
+ "lib/Demangle/ItaniumDemangle.cpp",
+ "lib/Support/APInt.cpp",
+ "lib/Support/Atomic.cpp",
+ "lib/Support/circular_raw_ostream.cpp",
+ "lib/Support/CommandLine.cpp",
+ "lib/Support/ConvertUTF.cpp",
+ "lib/Support/ConvertUTFWrapper.cpp",
+ "lib/Support/Debug.cpp",
+ "lib/Support/Errno.cpp",
+ "lib/Support/ErrorHandling.cpp",
+ "lib/Support/FoldingSet.cpp",
+ "lib/Support/Hashing.cpp",
+ "lib/Support/Host.cpp",
+ "lib/Support/ManagedStatic.cpp",
+ "lib/Support/MemoryBuffer.cpp",
+ "lib/Support/Mutex.cpp",
+ "lib/Support/NativeFormatting.cpp",
+ "lib/Support/Path.cpp",
+ "lib/Support/Process.cpp",
+ "lib/Support/Program.cpp",
+ "lib/Support/raw_os_ostream.cpp",
+ "lib/Support/raw_ostream.cpp",
+ "lib/Support/regcomp.c",
+ "lib/Support/regerror.c",
+ "lib/Support/Regex.cpp",
+ "lib/Support/regexec.c",
+ "lib/Support/regfree.c",
+ "lib/Support/regstrlcpy.c",
+ "lib/Support/Signals.cpp",
+ "lib/Support/SmallPtrSet.cpp",
+ "lib/Support/SmallVector.cpp",
+ "lib/Support/StringExtras.cpp",
+ "lib/Support/StringMap.cpp",
+ "lib/Support/StringRef.cpp",
+ "lib/Support/StringSaver.cpp",
+ "lib/Support/TargetParser.cpp",
+ "lib/Support/Threading.cpp",
+ "lib/Support/Timer.cpp",
+ "lib/Support/Triple.cpp",
+ "lib/Support/Twine.cpp",
+ ],
+
+ export_include_dirs: [
+ "build/Android/include",
+ "include",
+ ],
+}
diff --git a/third_party/subzero/Android.bp b/third_party/subzero/Android.bp
new file mode 100644
index 0000000..6c5da1a
--- /dev/null
+++ b/third_party/subzero/Android.bp
@@ -0,0 +1,117 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "libsubzero",
+
+ defaults: [ "swiftshader_common_release", "swiftshader_subzero" ],
+
+ device_supported: false,
+ host_supported: true,
+
+ cflags: [
+ "-D_GNU_SOURCE",
+ "-D__STDC_LIMIT_MACROS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_FORMAT_MACROS",
+ "-DLOG_TAG=\"libsubzero\"",
+ "-Wno-implicit-fallthrough",
+ "-Wno-unused-parameter",
+ "-Wno-error=undefined-var-template",
+ "-Wno-error=unused-lambda-capture",
+ ],
+
+ cppflags: [
+ "-Wno-sign-promo",
+ "-Wno-non-virtual-dtor",
+ ],
+
+ srcs: [
+ "src/IceAssembler.cpp",
+ "src/IceCfg.cpp",
+ "src/IceCfgNode.cpp",
+ "src/IceClFlags.cpp",
+ "src/IceELFObjectWriter.cpp",
+ "src/IceELFSection.cpp",
+ "src/IceFixups.cpp",
+ "src/IceGlobalContext.cpp",
+ "src/IceGlobalInits.cpp",
+ "src/IceInst.cpp",
+ "src/IceInstrumentation.cpp",
+ "src/IceIntrinsics.cpp",
+ "src/IceLiveness.cpp",
+ "src/IceLoopAnalyzer.cpp",
+ "src/IceMangling.cpp",
+ "src/IceMemory.cpp",
+ "src/IceOperand.cpp",
+ "src/IceRangeSpec.cpp",
+ "src/IceRegAlloc.cpp",
+ "src/IceRevision.cpp",
+ "src/IceRNG.cpp",
+ "src/IceSwitchLowering.cpp",
+ "src/IceTargetLowering.cpp",
+ "src/IceThreading.cpp",
+ "src/IceTimerTree.cpp",
+ "src/IceTypes.cpp",
+ "src/IceVariableSplitting.cpp",
+ ],
+
+ arch: {
+ arm: {
+ cflags : [ "-DSZTARGET=ARM32" ],
+
+ srcs: [
+ "src/IceAssemblerARM32.cpp",
+ "src/IceTargetLoweringARM32.cpp",
+ "src/IceInstARM32.cpp",
+ ],
+ },
+
+ mips: {
+ cflags : [ "-DSZTARGET=MIPS32" ],
+
+ srcs: [
+ "src/IceAssemblerMIPS32.cpp",
+ "src/IceTargetLoweringMIPS32.cpp",
+ "src/IceInstMIPS32.cpp",
+ ],
+ },
+
+ x86: {
+ cflags : [ "-DSZTARGET=X8632" ],
+
+ srcs: [
+ "src/IceTargetLoweringX8632.cpp",
+ "src/IceInstX8632.cpp",
+ ],
+ },
+
+ x86_64: {
+ cflags : [ "-DSZTARGET=X8664" ],
+
+ srcs: [
+ "src/IceTargetLoweringX8664.cpp",
+ "src/IceInstX8664.cpp",
+ ],
+ },
+ },
+
+ // FIXME: The IceCfg.h interface needs to be exported correctly
+ // FIXME: Exporting the whole src tree is broken
+ export_include_dirs: [ "pnacl-llvm/include", "." ],
+
+ static_libs: [ "libLLVMSupport_subzero" ],
+}