Initial work

This commit is contained in:
Simon Fels 2016-05-26 22:38:57 +02:00 • committed by Simon Fels
commit 3222551702
374 changed files with 40290 additions and 0 deletions

92
CMakeLists.txt Normal file
View file

@ -0,0 +1,92 @@
project(anbox C CXX)
cmake_minimum_required(VERSION 2.8.2)
include(CTest)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to release")
set(CMAKE_BUILD_TYPE "release")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wno-variadic-macros -Wextra -fPIC")
# By default, all symbols are visible in the library. We strip out things we don't
# want at link time, by running a version script (see unity-scopes.map and the
# setting of LINK_FLAGS below).
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default")
set(C_AND_CXX_WARNINGS "-pedantic -Wall -Wextra")
# Some additional warnings not included by the general flags set above.
set(EXTRA_C_WARNINGS "-Wcast-align -Wcast-qual -Wformat -Wredundant-decls -Wswitch-default")
set(EXTRA_CXX_WARNINGS "-Wnon-virtual-dtor -Wctor-dtor-privacy -Wold-style-cast")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_AND_CXX_WARNINGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_WARNINGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${C_AND_CXX_WARNINGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_C_WARNINGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_WARNINGS}")
# -fno-permissive causes warnings with clang, so we only enable it for gcc
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-permissive")
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower)
if ("${cmake_build_type_lower}" STREQUAL "release" OR "${cmake_build_type_lower}" STREQUAL "relwithdebinfo")
option(Werror "Treat warnings as errors" ON)
else()
option(Werror "Treat warnings as errors" OFF)
endif()
if (${Werror})
message(STATUS "Treat warnings as errors")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
if ("${cmake_build_type_lower}" STREQUAL "release" OR "${cmake_build_type_lower}" STREQUAL "relwithdebinfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=deprecated-declarations")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations")
endif()
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Boost COMPONENTS filesystem log serialization system thread program_options)
find_package(PkgConfig)
find_package(Threads)
find_package(EGL REQUIRED)
find_package(GLESv2 REQUIRED)
pkg_check_modules(MIRCLIENT REQUIRED mirclient)
#####################################################################
# Enable code coverage calculation with gcov/gcovr/lcov
# Usage:
# * Switch build type to coverage (use ccmake or cmake-gui)
# * Invoke make, make test, make coverage
# * Find html report in subdir coveragereport
# * Find xml report feasible for jenkins in coverage.xml
#####################################################################
IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs" )
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
ENDIF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
# Build with system gmock and embedded gtest
set (GMOCK_INCLUDE_DIR "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
set (GTEST_INCLUDE_DIR "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")
add_subdirectory(${GMOCK_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fPIC")
add_subdirectory(external)
add_subdirectory(src)
add_subdirectory(tests)

25
cmake/FindEGL.cmake Normal file
View file

@ -0,0 +1,25 @@
# - Try to find EGL
# Once done this will define
# EGL_FOUND - System has EGL
# EGL_INCLUDE_DIRS - The EGL include directories
# EGL_LIBRARIES - The libraries needed to use EGL
find_package(PkgConfig)
pkg_check_modules(PC_EGL QUIET egl)
find_path(EGL_INCLUDE_DIR EGL/egl.h
HINTS ${PC_EGL_INCLUDEDIR} ${PC_EGL_INCLUDE_DIRS})
find_library(EGL_LIBRARY EGL
HINTS ${PC_EGL_LIBDIR} ${PC_EGL_LIBRARY_DIRS})
set(EGL_LIBRARIES ${EGL_LIBRARY})
set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set EGL_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(EGL DEFAULT_MSG
EGL_LIBRARY EGL_INCLUDE_DIR)
mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY)

25
cmake/FindGLESv2.cmake Normal file
View file

@ -0,0 +1,25 @@
# - Try to find GLESv2
# Once done this will define
# GLESv2_FOUND - System has GLESv2
# GLESv2_INCLUDE_DIRS - The GLESv2 include directories
# GLESv2_LIBRARIES - The libraries needed to use GLESv2
find_package(PkgConfig)
pkg_check_modules(PC_GLESv2 QUIET glesv2)
find_path(GLESv2_INCLUDE_DIR GLES2/gl2.h
HINTS ${PC_GLESv2_INCLUDEDIR} ${PC_GLESv2_INCLUDE_DIRS})
find_library(GLESv2_LIBRARY GLESv2
HINTS ${PC_GLESv2_LIBDIR} ${PC_GLESv2_LIBRARY_DIRS})
set(GLESv2_LIBRARIES ${GLESv2_LIBRARY})
set(GLESv2_INCLUDE_DIRS ${GLESv2_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set GLESv2_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(GLESv2 DEFAULT_MSG
GLESv2_LIBRARY GLESv2_INCLUDE_DIR)
mark_as_advanced(GLESv2_INCLUDE_DIR GLESv2_LIBRARY)

View file

@ -0,0 +1,43 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(AC_NDK_PATH $ENV{AC_NDK_PATH} CACHE STRING "path of mir android bundle")
if (NOT DEFINED AC_TARGET_MACHINE)
set(AC_TARGET_MACHINE $ENV{AC_TARGET_MACHINE} CACHE STRING "target machine")
endif()
if (NOT DEFINED AC_GCC_VARIANT)
set(AC_GCC_VARIANT $ENV{AC_GCC_VARIANT} CACHE STRING "gcc variant required")
endif()
set(CMAKE_C_COMPILER /usr/bin/${AC_TARGET_MACHINE}-gcc${AC_GCC_VARIANT})
set(CMAKE_CXX_COMPILER /usr/bin/${AC_TARGET_MACHINE}-g++${AC_GCC_VARIANT})
# where to look to find dependencies in the target environment
set(CMAKE_FIND_ROOT_PATH "${AC_NDK_PATH}")
#treat the chroot's includes as system includes
include_directories(SYSTEM "${AC_NDK_PATH}/usr/include" "${AC_NDK_PATH}/usr/include/${AC_TARGET_MACHINE}")
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH "${AC_NDK_PATH}/usr/include" "${AC_NDK_PATH}/usr/include/${AC_TARGET_MACHINE}" )
# Add the chroot libraries as system libraries
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
"${AC_NDK_PATH}/lib"
"${AC_NDK_PATH}/lib/${AC_TARGET_MACHINE}"
"${AC_NDK_PATH}/usr/lib"
"${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}"
)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_EXECUTABLE_RUNTIME_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG "-Wl,-rpath-link,")
set(CMAKE_INSTALL_RPATH "${AC_NDK_PATH}/lib:${AC_NDK_PATH}/lib/${AC_TARGET_MACHINE}:${AC_NDK_PATH}/usr/lib:${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}")
set(ENV{PKG_CONFIG_PATH} "${AC_NDK_PATH}/usr/lib/pkgconfig:${AC_NDK_PATH}/usr/lib/${AC_TARGET_MACHINE}/pkgconfig")
set(ENV{PKG_CONFIG_SYSROOT_DIR} "${AC_NDK_PATH}")
#use only the cross compile system
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

162
cross-compile-chroot.sh Executable file
View file

@ -0,0 +1,162 @@
#!/bin/bash
# build script to compile anbox for armhf devices
#
set -e
usage() {
echo "usage: $(basename $0) [-a <arch>] [-c] [-h] [-d <dist>] [-u]"
echo " -a <arch> Specify target architecture (armhf/arm64/powerpc/ppc64el/amd64/i386/host)"
echo " -c Clean before building"
echo " -d <dist> Select the distribution to build for (vivid/wily/xenial)"
echo " -h This message"
echo " -u Update partial chroot directory"
}
clean_build_dir() {
rm -rf ${1}
mkdir ${1}
}
# Default to a dist-agnostic directory name so as to not break Jenkins right now
BUILD_DIR=build-android-arm
# NUM_JOBS=$(( $(grep -c ^processor /proc/cpuinfo) + 1 ))
NUM_JOBS=5
_do_update_chroot=0
# Default to vivid as we don't seem to have any working wily devices right now
dist=vivid
clean=0
update_build_dir=0
target_arch=armhf
while getopts "a:cd:hu" OPTNAME
do
case $OPTNAME in
a )
target_arch=${OPTARG}
update_build_dir=1
;;
c )
clean=1
;;
d )
dist=${OPTARG}
update_build_dir=1
;;
u )
_do_update_chroot=1
;;
h )
usage
exit 0
;;
: )
echo "Parameter -${OPTARG} needs an argument"
usage
exit 1;
;;
* )
echo "invalid option specified"
usage
exit 1
;;
esac
done
shift $((${OPTIND}-1))
if [ "${target_arch}" = "host" ]; then
target_arch=`dpkg-architecture -qDEB_HOST_ARCH`
fi
if [ ${clean} -ne 0 ]; then
clean_build_dir ${BUILD_DIR}
fi
if [ ${update_build_dir} -eq 1 ]; then
BUILD_DIR=build-${target_arch}-${dist}
fi
if [ "${AC_NDK_PATH}" = "" ]; then
export AC_NDK_PATH=~/.cache/anbox-${target_arch}-chroot-${dist}
fi
if [ ! -d ${AC_NDK_PATH} ]; then
echo "no partial chroot dir detected. attempting to create one"
_do_update_chroot=1
fi
if [ ! -d ${BUILD_DIR} ]; then
mkdir ${BUILD_DIR}
fi
echo "Building for distro: $dist"
echo "Using AC_NDK_PATH: ${AC_NDK_PATH}"
additional_repositories="-r http://ppa.launchpad.net/ci-train-ppa-service/stable-phone-overlay/ubuntu"
gcc_variant=
if [ "${dist}" = "vivid" ]; then
gcc_variant=-4.9
fi
case ${target_arch} in
armhf )
target_machine=arm-linux-gnueabihf
;;
amd64 )
target_machine=x86_64-linux-gnu
;;
i386 )
target_machine=i386-linux-gnu
;;
arm64 )
target_machine=aarch64-linux-gnu
;;
ppc64el )
target_machine=powerpc64le-linux-gnu
;;
powerpc )
target_machine=powerpc-linux-gnu
;;
* )
# A good guess (assuming you have dpkg-architecture)
target_machine=`dpkg-architecture -A${target_arch} -qDEB_HOST_MULTIARCH` || {
echo "Unknown architecture ${target_arch}"
usage
exit 1
}
;;
esac
echo "Target architecture: ${target_arch}"
echo "Target machine: ${target_machine}"
if [ ${_do_update_chroot} -eq 1 ] ; then
pushd scripts > /dev/null
./setup-partial-armhf-chroot.sh -d ${dist} -a ${target_arch} ${additional_repositories} ${AC_NDK_PATH}
popd > /dev/null
# force a clean build after an update, since CMake cache maybe out of date
clean_build_dir ${BUILD_DIR}
fi
pushd ${BUILD_DIR} > /dev/null
export PKG_CONFIG_PATH="${AC_NDK_PATH}/usr/lib/pkgconfig:${AC_NDK_PATH}/usr/lib/${target_machine}/pkgconfig"
export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
export PKG_CONFIG_SYSROOT_DIR=$AC_NDK_PATH
export PKG_CONFIG_EXECUTABLE=`which pkg-config`
export AC_TARGET_MACHINE=${target_machine}
export AC_GCC_VARIANT=${gcc_variant}
export LDFLAGS=-Wl,-rpath-link,${AC_NDK_PATH}/usr/lib/${target_machine}/pulseaudio
echo "Using PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
echo "Using PKG_CONFIG_EXECUTABLE: $PKG_CONFIG_EXECUTABLE"
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrossCompile.cmake \
-DCMAKE_BUILD_TYPE=debug \
..
make -j${NUM_JOBS} $@
popd > /dev/null

3
external/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,3 @@
add_subdirectory(bubblewrap)
add_subdirectory(process-cpp-minimal)
add_subdirectory(android-emugl)

91
external/android-emugl/Android.mk vendored Normal file
View file

@ -0,0 +1,91 @@
# This is the top-level build file for the Android HW OpenGL ES emulation
# in Android.
#
# You must define BUILD_EMULATOR_HOST_OPENGL to 'true' in your environment to
# build the following files.
#
# Top-level for all modules
EMUGL_PATH := $(call my-dir)
EMUGL_OLD_LOCAL_PATH := $(LOCAL_PATH)
# Directory containing common headers that are part of EmuGL's public API.
# This is always set to a module's LOCAL_C_INCLUDES. See the definition of
# emugl-begin-module in common.mk
EMUGL_COMMON_INCLUDES := $(EMUGL_INCLUDES)
# common cflags used by several modules
# This is always set to a module's LOCAL_CFLAGS
# See the definition of emugl-begin-module in common.mk
# Needed to ensure SIZE_MAX is properly defined when including <stdint.h>
EMUGL_COMMON_CFLAGS += -D__STDC_LIMIT_MACROS=1
ifneq (,$(strip $(BUILD_DEBUG)))
EMUGL_COMMON_CFLAGS += -DEMUGL_DEBUG=1
endif
EMUGL_COMMON_CFLAGS += -DEMUGL_BUILD=1
ifeq (linux,$(BUILD_TARGET_OS))
EMUGL_COMMON_CFLAGS += -fvisibility=internal
endif
ifeq (darwin,$(BUILD_TARGET_OS))
EMUGL_COMMON_CFLAGS += -fvisibility=hidden
endif
# Include common definitions used by all the modules included later
# in this build file. This contains the definition of all useful
# emugl-xxxx functions.
#
include $(EMUGL_PATH)/common.mk
# IMPORTANT: ORDER IS CRUCIAL HERE
#
# For the import/export feature to work properly, you must include
# modules below in correct order. That is, if module B depends on
# module A, then it must be included after module A below.
#
# This ensures that anything exported by module A will be correctly
# be imported by module B when it is declared.
#
# Note that the build system will complain if you try to import a
# module that hasn't been declared yet anyway.
#
# Required by our units test.
include $(EMUGL_PATH)/googletest.mk
# First, build the emugen host source-generation tool
#
# It will be used by other modules to generate wire protocol encode/decoder
# source files (see all emugl-gen-decoder/encoder in common.mk)
#
include $(EMUGL_PATH)/host/tools/emugen/Android.mk
include $(EMUGL_PATH)/shared/emugl/common/Android.mk
include $(EMUGL_PATH)/shared/OpenglCodecCommon/Android.mk
ifeq (true,$(EMULATOR_USE_ANGLE))
# Alternative graphics translation (GT) implementation, stripped off
# and adjust from the equivalent mod in the ARC project.
# This GT acts as a thin wrapper + GLESv1-to-v2 translator
# and forwards GLES calls to underlying GLES API (e.g. ANGLE)
#
include $(EMUGL_PATH)/host/libs/graphics_translation/common/Android.mk
include $(EMUGL_PATH)/host/libs/graphics_translation/gles/Android.mk
endif
# Host static libraries
include $(EMUGL_PATH)/host/libs/GLESv1_dec/Android.mk
include $(EMUGL_PATH)/host/libs/GLESv2_dec/Android.mk
include $(EMUGL_PATH)/host/libs/renderControl_dec/Android.mk
include $(EMUGL_PATH)/host/libs/Translator/GLcommon/Android.mk
include $(EMUGL_PATH)/host/libs/Translator/GLES_CM/Android.mk
include $(EMUGL_PATH)/host/libs/Translator/GLES_V2/Android.mk
include $(EMUGL_PATH)/host/libs/Translator/EGL/Android.mk
include $(EMUGL_PATH)/host/libs/libOpenGLESDispatch/Android.mk
# Host shared libraries
include $(EMUGL_PATH)/host/libs/libOpenglRender/Android.mk
LOCAL_PATH := $(EMUGL_OLD_LOCAL_PATH)

20
external/android-emugl/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,20 @@
# Don't treat any warnings as error as we take the source directly from
# upstream and just compile it.
set(CMAKE_C_FLAGS "-Wall")
include_directories(
${CMAKE_SOURCE_DIR}/external/android-emugl/shared
${CMAKE_SOURCE_DIR}/external/android-emugl/host/include
${CMAKE_SOURCE_DIR}/external/android-emugl/shared/OpenglCodecCommon
${CMAKE_SOURCE_DIR}/external/android-emugl/host/libs
${CMAKE_SOURCE_DIR}/external/android-emugl/host/libs/Translator/include
${CMAKE_SOURCE_DIR}/external/android-emugl/host/include/libOpenglRender
${CMAKE_SOURCE_DIR}/external/android-emugl/host/libs/GLESv1_dec
${CMAKE_BINARY_DIR}/external/android-emugl/host/libs/GLESv1_dec
${CMAKE_SOURCE_DIR}/external/android-emugl/host/libs/GLESv2_dec
${CMAKE_BINARY_DIR}/external/android-emugl/host/libs/GLESv2_dec
${CMAKE_SOURCE_DIR}/external/android-emugl/host/libs/renderControl_dec
${CMAKE_BINARY_DIR}/external/android-emugl/host/libs/renderControl_dec)
add_subdirectory(host)
add_subdirectory(shared)

615
external/android-emugl/DESIGN vendored Normal file
View file

@ -0,0 +1,615 @@
Android Hardware OpenGLES emulation design overview
===================================================
Introduction:
-------------
Hardware GLES emulation in the Android platform is implemented with a mix
of components, which are:
- Several host "translator" libraries. They implement the EGL, GLES 1.1 and
GLES 2.0 ABIs defined by Khronos, and translate the corresponding function
calls into calls to the appropriate desktop APIs, i.e.:
- GLX (Linux), AGL (OS X) or WGL (Windows) for EGL
- desktop GL 2.0 for GLES 1.1 and GLES 2.0
_________ __________ __________
| | | | | |
|TRANSLATOR |TRANSLATOR| |TRANSLATOR| HOST
| EGL | | GLES 1.1 | | GLES 2.0 | TRANSLATOR
|_________| |__________| |__________| LIBRARIES
| | |
- - - | - - - - - - - - - | - - - - - - - - - | - - - - -
| | |
____v____ ____v_____ _____v____ HOST
| | | | | | SYSTEM
| GLX | | GL 2.0 | | GL 2.0 | LIBRARIES
|_________| |__________| |__________|
- Several system libraries inside the emulated guest system that implement
the same EGL / GLES 1.1 and GLES 2.0 ABIs.
They collect the sequence of EGL/GLES function calls and translate then
into a custom wire protocol stream that is sent to the emulator program
through a high-speed communication channel called a "QEMU Pipe".
For now, all you need to know is that the pipe is implemented with a
custom kernel driver, and provides for _very_ fast bandwidth. All read()
and writes() from/to the pipes are essentially instantaneous from the
guest's point of view.
_________ __________ __________
| | | | | |
|EMULATION| |EMULATION | |EMULATION | GUEST
| EGL | | GLES 1.1 | | GLES 2.0 | SYSTEM
|_________| |__________| |__________| LIBRARIES
| | |
- - - | - - - - - - - - - | - - - - - - - - - | - - - - -
| | |
____v____________________v____________________v____ GUEST
| | KERNEL
| QEMU PIPE |
|___________________________________________________|
|
- - - - - - - - - - - - - -|- - - - - - - - - - - - - - - -
|
v
EMULATOR
- Specific code inside the emulator program that is capable of transmitting
the wire protocol stream to a special rendering library or process (called
the "renderer" here), which understands the format.
|
| PROTOCOL BYTE STREAM
_____v_____
| |
| EMULATOR |
|___________|
|
| UNMODIFIED PROTOCOL BYTE STREAM
_____v_____
| |
| RENDERER |
|___________|
- The renderer decodes the EGL/GLES commands from the wire
protocol stream, and dispatches them to the translator libraries
appropriately.
|
| PROTOCOL BYTE STREAM
_____v_____
| |
| RENDERER |
|___________|
| | |
+-----------------+ | +-----------------+
| | |
____v____ ___v______ ____v_____
| | | | | | HOST
|TRANSLATOR |TRANSLATOR| |TRANSLATOR| HOST
| EGL | | GLES 1.1 | | GLES 2.0 | TRANSLATOR
|_________| |__________| |__________| LIBRARIES
- In reality, the protocol stream flows in both directions, even though most
of the commands result in data going from the guest to the host. A complete
picture of the emulation would thus be:
_________ __________ __________
| | | | | |
|EMULATION| |EMULATION | |EMULATION | GUEST
| EGL | | GLES 1.1 | | GLES 2.0 | SYSTEM
|_________| |__________| |__________| LIBRARIES
^ ^ ^
| | |
- - - | - - - - - - - - - | - - - - - - - - - | - - - - -
| | |
____v____________________v____________________v____ GUEST
| | KERNEL
| QEMU PIPE |
|___________________________________________________|
^
|
- - - - - - - - - - - - - -|- - - - - - - - - - - - - - - -
|
| PROTOCOL BYTE STREAM
_____v_____
| |
| EMULATOR |
|___________|
^
| UNMODIFIED PROTOCOL BYTE STREAM
_____v_____
| |
| RENDERER |
|___________|
^ ^ ^
| | |
+-----------------+ | +-----------------+
| | |
____v____ ___v______ ____v_____
| | | | | |
|TRANSLATOR |TRANSLATOR| |TRANSLATOR| HOST
| EGL | | GLES 1.1 | | GLES 2.0 | TRANSLATOR
|_________| |__________| |__________| LIBRARIES
^ ^ ^
| | |
- - - | - - - - - - - - - | - - - - - - - - - | - - - - -
| | |
____v____ ____v_____ _____v____ HOST
| | | | | | SYSTEM
| GLX | | GL 2.0 | | GL 2.0 | LIBRARIES
|_________| |__________| |__________|
(NOTE: 'GLX' is for Linux only, replace 'AGL' on OS X, and 'WGL' on Windows).
Note that, in the above graphics, only the host system libraries at the bottom
are _not_ provided by Android.
Design Requirements:
--------------------
The above design comes from several important requirements that were decided
early in the project:
1 - The ability to run the renderer in a separate process from the emulator
itself is important.
For various practical reasons, we plan to completely separate the core QEMU
emulation from the UI window by using two distinct processes. As such, the
renderer will be implemented as a library inside the UI program, but will
need to receive protocol bytes from the QEMU process.
The communication channel will be either a fast Unix socket or a Win32
named pipe between these two. A shared memory segment with appropriate
synchronization primitives might also be used if performance becomes
an issue.
This explains why the emulator doesn't alter or even try to parse the
protocol byte stream. It only acts as a dumb proxy between the guest
system and the renderer. This also avoids adding lots of GLES-specific
code inside the QEMU code base which is terribly complex.
2 - The ability to use vendor-specific desktop EGL/GLES libraries is
important.
GPU vendors like NVidia, AMD or ARM all provide host versions of the
EGL/GLES libraries that emulate their respectivie embedded graphics
chipset.
The renderer library can be configured to use these instead of the
translator libraries provided with this project. This can be useful to
more accurately emulate the behaviour of specific devices.
Moreover, these vendor libraries typically expose vendor-specific
extensions that are not provided by the translator libraries. We cannot
expose them without modifying our code, but it's important to be able
to do so without too much pain.
Code organization:
------------------
All source code for the components above is spread over multiple directories
in the Android source trees:
- The emulator sources are under $ANDROID/external/qemu, which we'll
call $QEMU in the rest of this document.
- The guest libraries are under
$ANDROID/device/generic/goldfish/opengl, which we'll call $EMUGL_GUEST
- The host renderer and translator libraries are under
$QEMU/distrib/android-emugl, which we'll call $EMUGL_HOST
- The QEMU Pipe kernel driver is under $KERNEL/drivers/misc/qemupipe (3.4)
or $KERNEL/drivers/platform/goldfish/goldfish_pipe.c (3.10)
Where $ANDROID is the top of the open-source Android source tree, and
$KERNEL is the top of the qemu-specific kernel source tree (using one
of the android-goldfish-xxxx branches here).
The emulator sources related to this projects are:
$QEMU/hw/android/goldfish/pipe.c -> implements QEMU pipe virtual hardware.
$QEMU/android/opengles.c -> implements GLES initialization.
$QEMU/android/hw-pipe-net.c -> implements the communication channel
between the QEMU Pipe and the renderer library
The other sources are:
$EMUGL_GUEST/system -> system libraries
$EMUGL_GUEST/shared -> guest copy of shared libraries
$EMUGL_GUEST/tests -> various test programs
$EMUGL_HOST/host -> host libraries (translator + renderer)
$EMUGL_HOST/shared -> host copy of shared libraries
The reason the shared libraries aren't actually shared is historical: at one
point both guest and host code lived in the same place. That turned out to be
impractical with the way the Android SDK is branched, and didn't support the
requirement that a single emulator binary be able to run several releases
of Android.
Translator libraries:
---------------------
There are three translator host libraries provided by this project:
libEGL_translator -> EGL 1.2 translation
libGLES_CM_translator -> GLES 1.1 translation
libGLES_V2_translator -> GLES 2.0 translation
The full name of the library will depend on the host system.
For simplicity, only the library name suffix will change (i.e. the
'lib' prefix is not dropped on Windows), i.e.:
libEGL_translator.so -> for Linux
libEGL_translator.dylib -> for OS X
libEGL_translator.dll -> for Windows
The source code for these libraries is located under the following
path in the Android source tree:
$EMUGL_HOST/host/libs/Translator/EGL
$EMUGL_HOST/host/libs/Translator/GLES_CM
$EMUGL_HOST/host/libs/Translator/GLES_V2
The translator libraries also use a common routines defined under:
$EMUGL_HOST/host/libs/Translator/GLcommon
Wire Protocol Overiew:
----------------------
The "wire protocol" is implemented as follows:
- EGL/GLES function calls are described through several "specification"
files, which describes the types, function signatures and various
attributes for each one of them.
- These files are read by a tool called "emugen" which generates C
source files and headers based on the specification. These correspond
to both encoding, decoding and "wrappers" (more on this later).
- System "encoder" static libraries are built using some of these generated
files. They contain code that can serialize EGL/GLES calls into simple
byte messages and send it through a generic "IOStream" object.
- Host "decoder" static libraries are also built using some of these
generated files. Their code retrieves byte messages from an "IOStream"
object, and translates them into function callbacks.
IOStream abstraction:
- - - - - - - - - - -
The "IOStream" is a very simple abstract class used to send byte messages
both in the guest and host. It is defined through a shared header under
$EMUGL/host/include/libOpenglRender/IOStream.h
Note that despite the path, this header is included by *both* host and guest
source code. The main idea around IOStream's design is that to send a message,
one does the following:
1/ call stream->allocBuffer(size), which returns the address of a
memory buffer of at least 'size' bytes.
2/ write the content of the serialized command (usually a header + some
payload) directly into the buffer
3/ call stream->commitBuffer() to send it.
Alternatively, one can also pack several commands into a single buffer with
stream->alloc() and stream->flush(), as in:
1/ buf1 = stream->alloc(size1)
2/ write first command bytes into buf1
3/ buf2 = stream->alloc(size2)
4/ write second command bytes into buf2
5/ stream->flush()
Finally, there are also explict read/write methods like stream->readFully()
or stream->writeFully() which can be used when you don't want an intermediate
buffer. This is used in certain cases by the implementation, e.g. to avoid
an intermediate memory copy when sending texture data from the guest to the
host.
The host IOStream implementations are under $EMUGL/shared/OpenglCodecCommon/,
see in particular:
$EMUGL_HOST/shared/OpenglCodecCommon/TcpStream.cpp
-> using local TCP sockets
$EMUGL_HOST/shared/OpenglCodecCommon/UnixStream.cpp
-> using Unix sockets
$EMUGL_HOST/shared/OpenglCodecCommon/Win32PipeStream.cpp
-> using Win32 named pipes
The guest IOStream implementation uses the TcpStream.cpp above, as well as
an alternative QEMU-specific source:
$EMUGL_GUEST/system/OpenglSystemCommon/QemuPipeStream.cpp
-> uses QEMU pipe from the guest
The QEMU Pipe implementation is _significantly_ faster (about 20x) due to
several reasons:
- all succesful read() and write() operations through it are instantaneous
from the guest's point of view.
- all buffer/memory copies are performed directly by the emulator, and thus
much faster than performing the same thing inside the kernel with emulated
ARM instructions.
- it doesn't need to go through a kernel TCP/IP stack that will wrap the
data into TCP/IP/MAC packets, send them to an emulated ethernet device,
which is itself connected to an internal firewall implementation that
will unwrap the packets, re-assemble them, then send them through BSD
sockets to the host kernel.
However, would it be necessary, you could write a guest IOStream implementation
that uses a different transport. If you do, please look at
$EMUGL_GUEST/system/OpenglCodecCommon/HostConnection.cpp which contains the
code used to connect the guest to the host, on a per-thread basis.
Source code auto-generation:
- - - - - - - - - - - - - -
The 'emugen' tool is located under $EMUGL_HOST/host/tools/emugen. There is a
README file that explains how it works.
You can also look at the following specifications files:
For GLES 1.1:
$EMUGL_HOST/host/GLESv1_dec/gl.types
$EMUGL_HOST/host/GLESv1_dec/gl.in
$EMUGL_HOST/host/GLESv1_dec/gl.attrib
For GLES 2.0:
$EMUGL_HOST/host/GLESv2_dec/gl2.types
$EMUGL_HOST/host/GLESv2_dec/gl2.in
$EMUGL_HOST/host/GLESv2_dec/gl2.attrib
For EGL:
$EMUGL_HOST/host/renderControl_dec/renderControl.types
$EMUGL_HOST/host/renderControl_dec/renderControl.in
$EMUGL_HOST/host/renderControl_dec/renderControl.attrib
Note that the EGL specification files are under a directory named
"renderControl_dec" and have filenames that begin with "renderControl"
This is mainly for historic reasons now, but is also related to the fact that
this part of the wire protocol contains support functions/calls/specifications
that are not part of the EGL specification itself, but add a few features
required to make everything works. For example, they have calls related to
the "gralloc" system library module used to manage graphics surfaces at a
lower level than EGL.
Generally speaking, guest encoder sources are located under directories
named $EMUGL_GUEST/system/<name>_enc/, while the corresponding host decoder
sources will be under $EMUGL_HOST/host/libs/<name>_dec/
However, all these sources use the same spec files located under the
decoding directories.
The encoder files are built from emugen and spec files located in $EMUGL_HOST
and copied to the encoder directories in $EMUGL_GUEST by the gen-encoder.sh
script. They are checked in, so that a given version of Android supports a
specific version of the protocol, even if newer versions of the renderer (and
future Android versions) support a newer protocol version. This step needs to
be done manually when the protocol changes; these changes also need to be
accompanied by changes in the renderer to handle the old version of the
protocol.
System libraries:
-----------------
Meta EGL/GLES system libraries, and egl.cfg:
- - - - - - - - - - - - - - - - - - - - - -
It is important to understand that the emulation-specific EGL/GLES libraries
are not directly linked by applications at runtime. Instead, the system
provides a set of "meta" EGL/GLES libraries that will load the appropriate
hardware-specific libraries on first use.
More specifically, the system libEGL.so contains a "loader" which will try
to load:
- hardware-specific EGL/GLES libraries
- the software-based rendering libraries (called "libagl")
The system libEGL.so is also capable of merging the EGL configs of both the
hardware and software libraries transparently to the application. The system
libGLESv1_CM.so and libGLESv2.so, work with it to ensure that the thread's
current context will be linked to either the hardware or software libraries
depending on the config selected.
For the record, the loader's source code in under
frameworks/base/opengl/libs/EGL/Loader.cpp. It depends on a file named
/system/lib/egl/egl.cfg which must contain two lines that look like:
0 1 <name>
0 0 android
The first number in each line is a display number, and must be 0 since the
system's EGL/GLES libraries don't support anything else.
The second number must be 1 to indicate hardware libraries, and 0 to indicate
a software one. The line corresponding to the hardware library, if any, must
always appear before the one for the software library.
The third field is a name corresponding to a shared library suffix. It really
means that the corresponding libraries will be named libEGL_<name>.so,
libGLESv1_CM_<name>.so and libGLESv2_<name>.so. Moreover these libraries must
be placed under /system/lib/egl/
The name "android" is reserved for the system software renderer.
The egl.cfg that comes with this project uses the name "emulation" for the
hardware libraries. This means that it provides an egl.cfg file that contains
the following lines:
0 1 emulation
0 0 android
See $EMUGL_GUEST/system/egl/egl.cfg and more generally the following build
files:
$EMUGL_GUEST/system/egl/Android.mk
$EMUGL_GUEST/system/GLESv1/Android.mk
$EMUGL_GUEST/system/GLESv2/Android.mk
to see how the libraries are named and placed under /system/lib/egl/ by the
build system.
Emulation libraries:
- - - - - - - - - - -
The emulator-specific libraries are under the following:
$EMUGL_GUEST/system/egl/
$EMUGL_GUEST/system/GLESv1/
$EMUGL_GUEST/system/GLESv2/
The code for GLESv1 and GLESv2 is pretty small, since it mostly link against
the static encoding libraries.
The code for EGL is a bit more complex, because it needs to deal with
extensions dynamically. I.e. if an extension is not available on the host
it shouldn't be exposed by the library at runtime. So the EGL code queries
the host for the list of available extensions in order to return them to
clients. Similarly, it must query the list of valid EGLConfigs for the
current host system.
"gralloc" module implementation:
- - - - - - - - - - - - - - - - -
In addition to EGL/GLES libraries, the Android system requires a
hardware-specific library to manage graphics surfaces at a level lower than
EGL. This library must be what is called in Android land as a "HAL module".
A "HAL module" must provide interfaces defined by Android's HAL
(Hardware Abstraction Library). These interface definitions can be found
under $ANDROID/hardware/libhardware/include/
Of all possible HAL modules, the "gralloc" one is used by the system's
SurfaceFlinger to allocate framebuffers and other graphics memory regions,
as well as eventually lock/unlock/swap them when needed.
The code under $EMUGL/system/gralloc/ implements the module required by the
GLES emulation project. It's not very long, but there are a few things to
notice here:
- first, it will probe the guest system to determine if the emulator that
is running the virtual device really supports GPU emulation. In certain
circumstances this may not be possible.
If this is the case, then the module will redirect all calls to the
"default" gralloc module that is normally used by the system when
software-only rendering is enabled.
The probing happens in the function "fallback_init" which gets called
when the module is first opened. This initializes the 'sFallback' variable
to a pointer to the default gralloc module when required.
- second, this module is used by SurfaceFlinger to display "software surfaces",
i.e. those that are backed by system memory pixel buffers, and written to
directly through the Skia graphics library (i.e. the non-accelerated ones).
the default module simply copies the pixel data from the surface to the
virtual framebuffer i/o memory, but this project's gralloc module sends it
to the renderer through the QEMU Pipe instead.
It turns out that this results in _faster_ rendering/frame-rates overall,
because memory copies inside the guest are slow, while QEMU pipe transfers
are done directly in the emulator.
Host Renderer:
--------------
The host renderer library is located under
$EMUGL_HOST/host/libs/libOpenglRender, and it provides an interface described
by the headers under $EMUGL_HOST/host/libs/libOpenglRender/render_api.h
(e.g. for use by the emulator).
In a nutshell, the rendering library is responsible for the following:
- Providing a virtual off-screen video surface where everything will get
rendered at runtime. Its dimensions are fixed by the call to
initOpenglRender() that must happen just after the library is
initialized.
- Provide a way to display the virtual video surface on a host application's
UI. This is done by calling createOpenGLSubWindow() which takes as argument
the window ID or handle of a parent window, some display dimensions and
a rotation angle. This allows the surface to be scaled/rotated when it is
displayed, even if the dimensions of the video surface do not change.
- Provide a way to listen to incoming EGL/GLES commands from the guest.
This is done by providing a so-called "port number" to initOpenglRender().
By default, the port number corresponds to a local TCP port number that the
renderer will bind to and listen. Every new connection to this port will
correspond to the creation of a new guest host connection, each such
connection corresponding to a distinct thread in the guest system.
For performance reasons, it is possible to listen to either Unix sockets
(on Linux and OS X), or to a Win32 named pipe (on Windows). To do so, one
had to call setStreamType() between library initialization
(i.e. initLibrary()) and construction (i.e. initOpenglRender()).
Note that in these modes, the port number is still used to differentiate
between several emulator instances. These details are normally handled by
the emulator code so you shouldn't care too much.
Note that an earlier version of the interface allowed a client of the renderer
library to provide its own IOStream implementation. However, this wasn't very
convenient for a number of reasons. This maybe something that could be done
again if it makes sense, but for now the performance numbers are pretty good.
Host emulator:
--------------
The code under $QEMU/android/opengles.c is in charge of dynamically loading
the rendering library and initializing / constructing it properly.
QEMU pipe connections to the 'opengles' service are piped through the code
in $QEMU/android/hw-pipe-net.c. Look for the openglesPipe_init() function,
which is in charge of creating a connection to the renderer library
(either through a TCP socket, or a Unix pipe depending on configuration.
support for Win32 named pipes hasn't been implemented yet in the emulator)
whenever a guest process opens the "opengles" service through /dev/qemu_pipe.
There is also some support code for the display of the GLES framebuffer
(through the renderer library's subwindow) under $QEMU/skin/window.
Note that at the moment, scaling and rotation are supported. However,
brightness emulation (which used to modify the pixel values from the
hardware framebuffer before displaying them) doesn't work.
Another issue is that it is not possible to display anything on top of the
GL subwindow at the moment. E.g. this will obscure the emulated trackball
image (that is normally toggled with Ctrl-T during emulation, or enabled
by pressing the Delete key).

96
external/android-emugl/README vendored Normal file
View file

@ -0,0 +1,96 @@
This directory contains the host-side modules related to hardware OpenGL ES
emulation. The guest-side modules are in
$ANDROID_BUILD_TOP/device/generic/goldfish/opengl
I. Overview of components:
==========================
The 'emugen' tool is used to generate several source files related to the
EGL/GLES command stream used between the guest and the host during emulation.
host/tools/emugen -> emugen program
Note that emugen is capable of generating, from a single set of specification
files, three types of auto-generated sources:
- sources to encode commands into a byte stream.
- sources to decode the byte stream into commands.
- sources to wrap normal procedural EGL/GLES calls into context-aware ones.
Modules under the system/ directory corresponds to code that runs on the
guest, and implement the marshalling of EGL/GLES commands into a stream of
bytes sent to the host through a fast pipe mechanism.
system/GLESv1_enc -> encoder for GLES 1.1 commands
system/GLESv2_enc -> encoder for GLES 2.0 commands
system/renderControl_enc -> encoder for rendering control commands
system/egl -> emulator-specific guest EGL library
system/GLESv1 -> emulator-specific guest GLES 1.1 library
system/gralloc -> emulator-specific gralloc module
system/OpenglSystemCommon -> library of common routines
Modules under the host/ directory corresponds to code that runs on the
host, and implement the decoding of the command stream, translation of
EGL/GLES commands into desktop GL 2.0 ones, and rendering to an off-screen
buffer.
host/libs/GLESv1_dec -> decoder for GLES 1.1 commands
host/libs/GLESv2_dec -> decoder for GLES 2.0 commands
host/libs/renderControl_dec -> decoder for rendering control commands
host/libs/Translator/EGL -> translator for EGL commands
host/libs/Translator/GLES_CM -> translator for GLES 1.1 commands
host/libs/Translator/GLES_V2 -> translator for GLES 2.0 commands
host/libs/Translator/GLcommon -> library of common translation routines
host/libs/libOpenglRender -> rendering library (uses all host libs above)
can be used by the 'renderer' program below,
or directly linked into the emulator UI program.
host/renderer/ -> stand-alone renderer program executable.
this can run in head-less mode and receive requests from
several emulators at the same time. It is the receiving
end of all command streams.
Modules under the test/ directory correspond to test programs that are useful
to debug the various modules described above:
tests/EGL_host_wrapper -> a small library used to dynamically load the
desktop libEGL.so or a replacement named by the
ANDROID_EGL_LIB environment variable. This lib
provides all EGL entry points.
tests/emulator_test_renderer -> a small program to run the rendering library
in a single SDL window on the host desktop.
tests/gles_android_wrapper -> guest EGL / GLES libraries that are run on
the device to run some tests. Replace the
system/egl and system/GLESv1 modules for now.
tests/translator_tests/GLES_CM -> desktop GLESv1 translation unit test
tests/translator_tests/GLES_V2 -> desktop GLESv2 translation unit test
tests/translator_tests/MacCommon -> used by translation tests on Mac only.
tests/ut_rendercontrol_enc -> guest library used by tests/ut_renderer
tests/ut_rendercontrol_dec -> host library used by tests/ut_renderer
tests/ut_renderer -> unit-test for render control and rendering library.
II. Build system considerations:
--------------------------------
The dependencies on the more than 20 components described in the previous
section are pretty sophisticated, involving lots of auto-generated code and
non-trivial placement for guest/device libraries.
To simplify the development and maintenance of these modules, a set of
helper GNU Make function is defined in common.mk, and included from the
Android.mk in this directory.
These functions all begin with the "emugl-" prefix, and can be used to
declare modules, what information they export to other modules, or import
from them, and also what kind of auto-generated sources they depend on.
Look at the comments inside common.mk and the Android.mk of the modules
to better understand what's happening.

241
external/android-emugl/common.mk vendored Normal file
View file

@ -0,0 +1,241 @@
# This top-level build file is included by all modules that implement
# the hardware OpenGL ES emulation for Android.
#
# We use it to ensure that all sub-Makefiles are included in the right
# order for various variable definitions and usage to happen in the correct
# order.
#
# The following macros are used to start a new GLES emulation module.
#
# This will define LOCAL_MODULE as $1, plus a few other variables
# needed by the build system (e.g. LOCAL_MODULE_TAGS, LOCAL_MODULE_CLASS...)
#
# NOTE: You still need to define LOCAL_PATH before this
#
# Usage example:
#
# $(call emugl-begin-static-library,<name>)
# LOCAL_SRC_FILES := ....
# LOCAL_C_INCLUDES += ....
# $(call emugl-end-module)
#
emugl-begin-host-static-library = $(call emugl-begin-module,$1,HOST_STATIC_LIBRARY,HOST)
emugl-begin-host-shared-library = $(call emugl-begin-module,$1,HOST_SHARED_LIBRARY,HOST)
emugl-begin-host-executable = $(call emugl-begin-module,$1,HOST_EXECUTABLE,HOST)
# Internal list of all declared modules (used for sanity checking)
_emugl_modules :=
_emugl_HOST_modules :=
# do not use directly, see functions above instead
emugl-begin-module = \
$(eval include $(CLEAR_VARS)) \
$(eval LOCAL_MODULE := $1) \
$(eval LOCAL_MODULE_TAGS := $(if $3,,debug)) \
$(eval LOCAL_MODULE_CLASS := $(patsubst HOST_%,%,$(patsubst %EXECUTABLE,%EXECUTABLES,$(patsubst %LIBRARY,%LIBRARIES,$2)))) \
$(eval LOCAL_IS_HOST_MODULE := $(if $3,true,))\
$(eval LOCAL_C_INCLUDES += $(EMUGL_COMMON_INCLUDES)) \
$(eval LOCAL_CFLAGS += $(EMUGL_COMMON_CFLAGS)) \
$(eval LOCAL_LDLIBS += $(CXX_STD_LIB)) \
$(eval LOCAL_BUILD_FILE := $(BUILD_$2)) \
$(call _emugl-init-module,$1,$2,$3)
# Used to end a module definition, see function definitions above
emugl-end-module = \
$(eval $(end-emulator-module-ev)) \
$(eval LOCAL_BUILD_FILE :=) \
$(eval _emugl_$(_emugl_HOST)modules += $(_emugl_MODULE))\
$(if $(EMUGL_DEBUG),$(call emugl-dump-module))
# Managing module exports and imports.
#
# A module can 'import' another module, by calling emugl-import. This will
# make the current LOCAL_MODULE inherit various definitions exported from
# the imported module.
#
# Module exports are defined by calling emugl-export. Here is an example:
#
# $(call emugl-begin-static-library,foo)
# LOCAL_SRC_FILES := foo.c
# $(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
# $(call emugl-export,SHARED_LIBRARIES,libcutils)
# $(call emugl-end-module)
#
# $(call emugl-begin-shared-library,bar)
# LOCAL_SRC_FILES := bar.cpp
# $(call emugl-import,foo)
# $(call emugl-end-module)
#
# Here, we define a static library named 'foo' which exports an include
# path and a shared library requirement, and a shared library 'bar' which
# imports it.
#
# What this means is that:
#
# - 'bar' will automatically inherit foo's LOCAL_PATH in its LOCAL_C_INCLUDES
# - 'bar' will automatically inherit libcutils in its own LOCAL_SHARED_LIBRARIES
#
# Note that order of declaration matters. If 'foo' is defined after 'bar' in
# the example above, nothing will work correctly because dependencies are
# computed at import time.
#
#
# IMPORTANT: Imports are transitive, i.e. when module A imports B,
# it automatically imports anything imported by B too.
# This is the list of recognized export types we support for now.
EMUGL_EXPORT_TYPES := \
CFLAGS \
CXXFLAGS \
LDLIBS \
LDFLAGS \
C_INCLUDES \
SHARED_LIBRARIES \
STATIC_LIBRARIES \
ADDITIONAL_DEPENDENCIES
# Initialize a module in our database
# $1: Module name
# $2: Module type
# $3: "HOST" for a host module, empty for a target one.
_emugl-init-module = \
$(eval _emugl_HOST := $(if $3,HOST_,))\
$(eval _emugl_MODULE := $(_emugl_HOST)$1)\
$(if $(filter $(_emugl_$(_emugl_HOST)modules),$(_emugl_MODULE)),\
$(error There is already a $(if $3,host,) module named $1!)\
)\
$(eval _mod = $(_emugl_MODULE)) \
$(eval _emugl.$(_mod).type := $(patsubst HOST_%,%,$2))\
$(eval _emugl.$(_mod).imports :=) \
$(eval _emugl,$(_mod).moved :=) \
$(foreach _type,$(EMUGL_EXPORT_TYPES),\
$(eval _emugl.$(_mod).export.$(_type) :=)\
)
# Called to indicate that a module exports a given local variable for its
# users. This also adds this to LOCAL_$1
# $1: Local variable type (e.g. CFLAGS, LDLIBS, etc...)
# $2: Value(s) to append to the export
emugl-export = \
$(eval _emugl.$(_emugl_MODULE).export.$1 += $2)\
$(eval LOCAL_$1 := $(LOCAL_$1) $2)
emugl-export-outer = \
$(eval _emugl.$(_emugl_MODULE).export.$1 += $2)
# Called to indicate that a module imports the exports of another module
# $1: list of modules to import
#
emugl-import = \
$(foreach _imod,$1,\
$(call _emugl-module-import,$(_emugl_HOST)$(_imod))\
)
_emugl-module-import = \
$(eval _mod := $(_emugl_MODULE))\
$(if $(filter-out $(_emugl_$(_emugl_HOST)modules),$1),\
$(info Unknown imported emugles module: $1)\
$(if $(_emugl_HOST),\
$(eval _names := $(patsubst HOST_%,%,$(_emugl_HOST_modules))),\
$(eval _names := $(_emugl_modules))\
)\
$(info Please one of the following names: $(_names))\
$(error Aborting)\
)\
$(if $(filter-out $(_emugl.$(_mod).imports),$1),\
$(eval _emugl.$(_mod).imports += $1)\
$(foreach _sub,$(_emugl.$1.imports),\
$(call _emugl-module-import,$(_sub))\
)\
$(foreach _type,$(EMUGL_EXPORT_TYPES),\
$(eval LOCAL_$(_type) := $(LOCAL_$(_type)) $(_emugl.$1.export.$(_type)))\
)\
$(if $(filter EXECUTABLE SHARED_LIBRARY,$(_emugl.$(_emugl_MODULE).type)),\
$(if $(filter STATIC_LIBRARY,$(_emugl.$1.type)),\
$(eval LOCAL_STATIC_LIBRARIES := $(1:HOST_%=%) $(LOCAL_STATIC_LIBRARIES))\
)\
$(if $(filter SHARED_LIBRARY,$(_emugl.$1.type)),\
$(if $(_emugl.$1.moved),,\
$(eval LOCAL_SHARED_LIBRARIES := $(1:HOST_%=%) $(LOCAL_SHARED_LIBRARIES))\
)\
)\
)\
)
_emugl-dump-list = \
$(foreach _list_item,$(strip $1),$(info . $(_list_item)))
emugl-dump-module = \
$(info MODULE=$(_emugl_MODULE))\
$(info . HOST=$(_emugl_HOST))\
$(info . TYPE=$(_emugl.$(_emugl_MODULE).type))\
$(info . IMPORTS=$(_emugl.$(_emugl_MODULE).imports))\
$(foreach _type,$(EMUGL_EXPORT_TYPES),\
$(if $(filter C_INCLUDES ADDITIONAL_DEPENDENCIES,$(_type)),\
$(info . EXPORT.$(_type) :=)\
$(call _emugl-dump-list,$(_emugl.$(_emugl_MODULE).export.$(_type)))\
$(info . LOCAL_$(_type) :=)\
$(call _emugl-dump-list,$(LOCAL_$(_type)))\
,\
$(info . EXPORT.$(_type) := $(strip $(_emugl.$(_emugl_MODULE).export.$(_type))))\
$(info . LOCAL_$(_type) := $(strip $(LOCAL_$(_type))))\
)\
)\
$(info . LOCAL_SRC_FILES := $(LOCAL_SRC_FILES))\
# This function can be called to generate the decoder source files.
# LOCAL_MODULE and LOCAL_MODULE_CLASS must be defined or the build will abort.
# Source files will be stored in the local intermediates directory that will
# be automatically added to your LOCAL_C_INCLUDES.
#
# Usage:
# $(call emugl-gen-decoder,<input-dir>,<basename>)
#
emugl-gen-decoder = \
$(eval _emugl_out := $(call intermediates-dir-for,$(BUILD_TARGET_BITS),$2))\
$(call emugl-gen-decoder-generic,$(_emugl_out),$1,$2)\
$(call emugl-export,C_INCLUDES,$(_emugl_out))
# DO NOT CALL DIRECTLY, USE emugl-gen-decoder instead.
#
# The following function can be called to generate wire protocol decoder
# source files, Usage is:
#
# $(call emugl-gen-decoder-generic,<dst-dir>,<src-dir>,<basename>)
#
# <dst-dir> is the destination directory where the generated sources are stored
# <src-dir> is the source directory where to find <basename>.attrib, etc..
# <basename> is the emugen basename (see host/tools/emugen/README)
#
emugl-gen-decoder-generic = $(eval $(emugl-gen-decoder-generic-ev))
define emugl-gen-decoder-generic-ev
_emugl_dec := $$1/$$3
_emugl_src := $$2/$$3
GEN := $$(_emugl_dec)_dec.cpp \
$$(_emugl_dec)_dec.h \
$$(_emugl_dec)_opcodes.h \
$$(_emugl_dec)_server_context.h \
$$(_emugl_dec)_server_context.cpp
$$(GEN): PRIVATE_PATH := $$(LOCAL_PATH)
$$(GEN): PRIVATE_CUSTOM_TOOL := $$(EMUGL_EMUGEN) -D $$1 -i $$2 $$3
$$(GEN): $$(EMUGL_EMUGEN) $$(_emugl_src).attrib $$(_emugl_src).in $$(_emugl_src).types
$$(transform-generated-source)
$$(call emugl-export,ADDITIONAL_DEPENDENCIES,$$(GEN))
LOCAL_GENERATED_SOURCES += $$(GEN)
LOCAL_C_INCLUDES += $$1
endef
# Call this function when your shared library must be placed in a non-standard
# library path (i.e. not under /system/lib
# $1: library sub-path,relative to /system/lib
# For example: $(call emugl-set-shared-library-subpath,egl)
emugl-set-shared-library-subpath = \
$(eval LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$1)\
$(eval LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/$1)\
$(eval _emugl.$(LOCAL_MODULE).moved := true)\
$(call emugl-export-outer,ADDITIONAL_DEPENDENCIES,$(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)$(TARGET_SHLIB_SUFFIX))

37
external/android-emugl/googletest.mk vendored Normal file
View file

@ -0,0 +1,37 @@
# This contains common definitions used to define a host module
# to link GoogleTest with the EmuGL test programs.
#
# This is used instead of including external/gtest/Android.mk to
# be able to build both the 32-bit and 64-bit binaries while
# building a 32-bit only SDK (sdk-eng, sdk_x86-eng, sdk_mips-eng).
LOCAL_PATH := $(EMULATOR_GTEST_SOURCES_DIR)
common_SRC_FILES := \
src/gtest-all.cc \
src/gtest_main.cc
common_CFLAGS := -O0
ifneq (windows,$(BUILD_TARGET_OS))
common_LDLIBS += -lpthread
endif
$(call emugl-begin-host-static-library,libemugl_gtest)
LOCAL_SRC_FILES := $(common_SRC_FILES)
LOCAL_CFLAGS += $(common_CFLAGS)
LOCAL_CPP_EXTENSION := .cc
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include)
$(call emugl-export,LDLIBS,$(common_LDLIBS))
$(call emugl-end-module)
$(call emugl-begin-host-static-library,libemugl_gtest_host)
LOCAL_SRC_FILES := $(common_SRC_FILES)
LOCAL_CFLAGS += $(common_CFLAGS)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_CPP_EXTENSION := .cc
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include)
$(call emugl-export,LDLIBS,$(common_LDLIBS) -lpthread)
LOCAL_HOST_BUILD := true
$(call emugl-end-module)

View file

@ -0,0 +1,2 @@
add_subdirectory(tools)
add_subdirectory(libs)

View file

@ -0,0 +1,106 @@
// Copyright 2009 Google Inc.
//
// 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.
#ifndef __etc1_h__
#define __etc1_h__
#define ETC1_ENCODED_BLOCK_SIZE 8
#define ETC1_DECODED_BLOCK_SIZE 48
#ifndef ETC1_RGB8_OES
#define ETC1_RGB8_OES 0x8D64
#endif
typedef unsigned char etc1_byte;
typedef int etc1_bool;
typedef unsigned int etc1_uint32;
#ifdef __cplusplus
extern "C" {
#endif
// Encode a block of pixels.
//
// pIn is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
// value of pixel (x, y).
//
// validPixelMask is a 16-bit mask where bit (1 << (x + y * 4)) indicates whether
// the corresponding (x,y) pixel is valid. Invalid pixel color values are ignored when compressing.
//
// pOut is an ETC1 compressed version of the data.
void etc1_encode_block(const etc1_byte* pIn, etc1_uint32 validPixelMask, etc1_byte* pOut);
// Decode a block of pixels.
//
// pIn is an ETC1 compressed version of the data.
//
// pOut is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
// value of pixel (x, y).
void etc1_decode_block(const etc1_byte* pIn, etc1_byte* pOut);
// Return the size of the encoded image data (does not include size of PKM header).
etc1_uint32 etc1_get_encoded_data_size(etc1_uint32 width, etc1_uint32 height);
// Encode an entire image.
// pIn - pointer to the image data. Formatted such that
// pixel (x,y) is at pIn + pixelSize * x + stride * y;
// pOut - pointer to encoded data. Must be large enough to store entire encoded image.
// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
// returns non-zero if there is an error.
int etc1_encode_image(const etc1_byte* pIn, etc1_uint32 width, etc1_uint32 height,
etc1_uint32 pixelSize, etc1_uint32 stride, etc1_byte* pOut);
// Decode an entire image.
// pIn - pointer to encoded data.
// pOut - pointer to the image data. Will be written such that
// pixel (x,y) is at pIn + pixelSize * x + stride * y. Must be
// large enough to store entire image.
// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
// returns non-zero if there is an error.
int etc1_decode_image(const etc1_byte* pIn, etc1_byte* pOut,
etc1_uint32 width, etc1_uint32 height,
etc1_uint32 pixelSize, etc1_uint32 stride);
// Size of a PKM header, in bytes.
#define ETC_PKM_HEADER_SIZE 16
// Format a PKM header
void etc1_pkm_format_header(etc1_byte* pHeader, etc1_uint32 width, etc1_uint32 height);
// Check if a PKM header is correctly formatted.
etc1_bool etc1_pkm_is_valid(const etc1_byte* pHeader);
// Read the image width from a PKM header
etc1_uint32 etc1_pkm_get_width(const etc1_byte* pHeader);
// Read the image height from a PKM header
etc1_uint32 etc1_pkm_get_height(const etc1_byte* pHeader);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,770 @@
#ifndef __gl_h_
#define __gl_h_
/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
#include <GLES/glplatform.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
typedef void GLvoid;
typedef char GLchar;
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef khronos_int8_t GLbyte;
typedef short GLshort;
typedef int GLint;
typedef int GLsizei;
typedef khronos_uint8_t GLubyte;
typedef unsigned short GLushort;
typedef unsigned int GLuint;
typedef khronos_float_t GLfloat;
typedef khronos_float_t GLclampf;
typedef khronos_int32_t GLfixed;
typedef khronos_int32_t GLclampx;
typedef khronos_intptr_t GLintptr;
typedef khronos_ssize_t GLsizeiptr;
/*************************************************************/
/* OpenGL ES core versions */
#define GL_VERSION_ES_CM_1_0 1
#define GL_VERSION_ES_CL_1_0 1
#define GL_VERSION_ES_CM_1_1 1
#define GL_VERSION_ES_CL_1_1 1
/* ClearBufferMask */
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
/* Boolean */
#define GL_FALSE 0
#define GL_TRUE 1
/* BeginMode */
#define GL_POINTS 0x0000
#define GL_LINES 0x0001
#define GL_LINE_LOOP 0x0002
#define GL_LINE_STRIP 0x0003
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
/* AlphaFunction */
#define GL_NEVER 0x0200
#define GL_LESS 0x0201
#define GL_EQUAL 0x0202
#define GL_LEQUAL 0x0203
#define GL_GREATER 0x0204
#define GL_NOTEQUAL 0x0205
#define GL_GEQUAL 0x0206
#define GL_ALWAYS 0x0207
/* BlendingFactorDest */
#define GL_ZERO 0
#define GL_ONE 1
#define GL_SRC_COLOR 0x0300
#define GL_ONE_MINUS_SRC_COLOR 0x0301
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
#define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307
#define GL_SRC_ALPHA_SATURATE 0x0308
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* ClipPlaneName */
#define GL_CLIP_PLANE0 0x3000
#define GL_CLIP_PLANE1 0x3001
#define GL_CLIP_PLANE2 0x3002
#define GL_CLIP_PLANE3 0x3003
#define GL_CLIP_PLANE4 0x3004
#define GL_CLIP_PLANE5 0x3005
/* ColorMaterialFace */
/* GL_FRONT_AND_BACK */
/* ColorMaterialParameter */
/* GL_AMBIENT_AND_DIFFUSE */
/* ColorPointerType */
/* GL_UNSIGNED_BYTE */
/* GL_FLOAT */
/* GL_FIXED */
/* CullFaceMode */
#define GL_FRONT 0x0404
#define GL_BACK 0x0405
#define GL_FRONT_AND_BACK 0x0408
/* DepthFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* EnableCap */
#define GL_FOG 0x0B60
#define GL_LIGHTING 0x0B50
#define GL_TEXTURE_2D 0x0DE1
#define GL_CULL_FACE 0x0B44
#define GL_ALPHA_TEST 0x0BC0
#define GL_BLEND 0x0BE2
#define GL_COLOR_LOGIC_OP 0x0BF2
#define GL_DITHER 0x0BD0
#define GL_STENCIL_TEST 0x0B90
#define GL_DEPTH_TEST 0x0B71
/* GL_LIGHT0 */
/* GL_LIGHT1 */
/* GL_LIGHT2 */
/* GL_LIGHT3 */
/* GL_LIGHT4 */
/* GL_LIGHT5 */
/* GL_LIGHT6 */
/* GL_LIGHT7 */
#define GL_POINT_SMOOTH 0x0B10
#define GL_LINE_SMOOTH 0x0B20
#define GL_SCISSOR_TEST 0x0C11
#define GL_COLOR_MATERIAL 0x0B57
#define GL_NORMALIZE 0x0BA1
#define GL_RESCALE_NORMAL 0x803A
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_VERTEX_ARRAY 0x8074
#define GL_NORMAL_ARRAY 0x8075
#define GL_COLOR_ARRAY 0x8076
#define GL_TEXTURE_COORD_ARRAY 0x8078
#define GL_MULTISAMPLE 0x809D
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
#define GL_SAMPLE_COVERAGE 0x80A0
/* ErrorCode */
#define GL_NO_ERROR 0
#define GL_INVALID_ENUM 0x0500
#define GL_INVALID_VALUE 0x0501
#define GL_INVALID_OPERATION 0x0502
#define GL_STACK_OVERFLOW 0x0503
#define GL_STACK_UNDERFLOW 0x0504
#define GL_OUT_OF_MEMORY 0x0505
/* FogMode */
/* GL_LINEAR */
#define GL_EXP 0x0800
#define GL_EXP2 0x0801
/* FogParameter */
#define GL_FOG_DENSITY 0x0B62
#define GL_FOG_START 0x0B63
#define GL_FOG_END 0x0B64
#define GL_FOG_MODE 0x0B65
#define GL_FOG_COLOR 0x0B66
/* FrontFaceDirection */
#define GL_CW 0x0900
#define GL_CCW 0x0901
/* GetPName */
#define GL_CURRENT_COLOR 0x0B00
#define GL_CURRENT_NORMAL 0x0B02
#define GL_CURRENT_TEXTURE_COORDS 0x0B03
#define GL_POINT_SIZE 0x0B11
#define GL_POINT_SIZE_MIN 0x8126
#define GL_POINT_SIZE_MAX 0x8127
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
#define GL_LINE_WIDTH 0x0B21
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#define GL_CULL_FACE_MODE 0x0B45
#define GL_FRONT_FACE 0x0B46
#define GL_SHADE_MODEL 0x0B54
#define GL_DEPTH_RANGE 0x0B70
#define GL_DEPTH_WRITEMASK 0x0B72
#define GL_DEPTH_CLEAR_VALUE 0x0B73
#define GL_DEPTH_FUNC 0x0B74
#define GL_STENCIL_CLEAR_VALUE 0x0B91
#define GL_STENCIL_FUNC 0x0B92
#define GL_STENCIL_VALUE_MASK 0x0B93
#define GL_STENCIL_FAIL 0x0B94
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
#define GL_STENCIL_REF 0x0B97
#define GL_STENCIL_WRITEMASK 0x0B98
#define GL_MATRIX_MODE 0x0BA0
#define GL_VIEWPORT 0x0BA2
#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
#define GL_PROJECTION_STACK_DEPTH 0x0BA4
#define GL_TEXTURE_STACK_DEPTH 0x0BA5
#define GL_MODELVIEW_MATRIX 0x0BA6
#define GL_PROJECTION_MATRIX 0x0BA7
#define GL_TEXTURE_MATRIX 0x0BA8
#define GL_ALPHA_TEST_FUNC 0x0BC1
#define GL_ALPHA_TEST_REF 0x0BC2
#define GL_BLEND_DST 0x0BE0
#define GL_BLEND_SRC 0x0BE1
#define GL_LOGIC_OP_MODE 0x0BF0
#define GL_SCISSOR_BOX 0x0C10
#define GL_SCISSOR_TEST 0x0C11
#define GL_COLOR_CLEAR_VALUE 0x0C22
#define GL_COLOR_WRITEMASK 0x0C23
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
#define GL_MAX_LIGHTS 0x0D31
#define GL_MAX_CLIP_PLANES 0x0D32
#define GL_MAX_TEXTURE_SIZE 0x0D33
#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
#define GL_MAX_TEXTURE_UNITS 0x84E2
#define GL_SUBPIXEL_BITS 0x0D50
#define GL_RED_BITS 0x0D52
#define GL_GREEN_BITS 0x0D53
#define GL_BLUE_BITS 0x0D54
#define GL_ALPHA_BITS 0x0D55
#define GL_DEPTH_BITS 0x0D56
#define GL_STENCIL_BITS 0x0D57
#define GL_POLYGON_OFFSET_UNITS 0x2A00
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_POLYGON_OFFSET_FACTOR 0x8038
#define GL_TEXTURE_BINDING_2D 0x8069
#define GL_VERTEX_ARRAY_SIZE 0x807A
#define GL_VERTEX_ARRAY_TYPE 0x807B
#define GL_VERTEX_ARRAY_STRIDE 0x807C
#define GL_NORMAL_ARRAY_TYPE 0x807E
#define GL_NORMAL_ARRAY_STRIDE 0x807F
#define GL_COLOR_ARRAY_SIZE 0x8081
#define GL_COLOR_ARRAY_TYPE 0x8082
#define GL_COLOR_ARRAY_STRIDE 0x8083
#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
#define GL_VERTEX_ARRAY_POINTER 0x808E
#define GL_NORMAL_ARRAY_POINTER 0x808F
#define GL_COLOR_ARRAY_POINTER 0x8090
#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
#define GL_SAMPLE_BUFFERS 0x80A8
#define GL_SAMPLES 0x80A9
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
/* GetTextureParameter */
/* GL_TEXTURE_MAG_FILTER */
/* GL_TEXTURE_MIN_FILTER */
/* GL_TEXTURE_WRAP_S */
/* GL_TEXTURE_WRAP_T */
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
/* HintMode */
#define GL_DONT_CARE 0x1100
#define GL_FASTEST 0x1101
#define GL_NICEST 0x1102
/* HintTarget */
#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
#define GL_POINT_SMOOTH_HINT 0x0C51
#define GL_LINE_SMOOTH_HINT 0x0C52
#define GL_FOG_HINT 0x0C54
#define GL_GENERATE_MIPMAP_HINT 0x8192
/* LightModelParameter */
#define GL_LIGHT_MODEL_AMBIENT 0x0B53
#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
/* LightParameter */
#define GL_AMBIENT 0x1200
#define GL_DIFFUSE 0x1201
#define GL_SPECULAR 0x1202
#define GL_POSITION 0x1203
#define GL_SPOT_DIRECTION 0x1204
#define GL_SPOT_EXPONENT 0x1205
#define GL_SPOT_CUTOFF 0x1206
#define GL_CONSTANT_ATTENUATION 0x1207
#define GL_LINEAR_ATTENUATION 0x1208
#define GL_QUADRATIC_ATTENUATION 0x1209
/* DataType */
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
#define GL_SHORT 0x1402
#define GL_UNSIGNED_SHORT 0x1403
#define GL_FLOAT 0x1406
#define GL_FIXED 0x140C
/* LogicOp */
#define GL_CLEAR 0x1500
#define GL_AND 0x1501
#define GL_AND_REVERSE 0x1502
#define GL_COPY 0x1503
#define GL_AND_INVERTED 0x1504
#define GL_NOOP 0x1505
#define GL_XOR 0x1506
#define GL_OR 0x1507
#define GL_NOR 0x1508
#define GL_EQUIV 0x1509
#define GL_INVERT 0x150A
#define GL_OR_REVERSE 0x150B
#define GL_COPY_INVERTED 0x150C
#define GL_OR_INVERTED 0x150D
#define GL_NAND 0x150E
#define GL_SET 0x150F
/* MaterialFace */
/* GL_FRONT_AND_BACK */
/* MaterialParameter */
#define GL_EMISSION 0x1600
#define GL_SHININESS 0x1601
#define GL_AMBIENT_AND_DIFFUSE 0x1602
/* GL_AMBIENT */
/* GL_DIFFUSE */
/* GL_SPECULAR */
/* MatrixMode */
#define GL_MODELVIEW 0x1700
#define GL_PROJECTION 0x1701
#define GL_TEXTURE 0x1702
/* NormalPointerType */
/* GL_BYTE */
/* GL_SHORT */
/* GL_FLOAT */
/* GL_FIXED */
/* PixelFormat */
#define GL_ALPHA 0x1906
#define GL_RGB 0x1907
#define GL_RGBA 0x1908
#define GL_LUMINANCE 0x1909
#define GL_LUMINANCE_ALPHA 0x190A
/* PixelStoreParameter */
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
/* PixelType */
/* GL_UNSIGNED_BYTE */
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
/* ShadingModel */
#define GL_FLAT 0x1D00
#define GL_SMOOTH 0x1D01
/* StencilFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* StencilOp */
/* GL_ZERO */
#define GL_KEEP 0x1E00
#define GL_REPLACE 0x1E01
#define GL_INCR 0x1E02
#define GL_DECR 0x1E03
/* GL_INVERT */
/* StringName */
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03
/* TexCoordPointerType */
/* GL_SHORT */
/* GL_FLOAT */
/* GL_FIXED */
/* GL_BYTE */
/* TextureEnvMode */
#define GL_MODULATE 0x2100
#define GL_DECAL 0x2101
/* GL_BLEND */
#define GL_ADD 0x0104
/* GL_REPLACE */
/* TextureEnvParameter */
#define GL_TEXTURE_ENV_MODE 0x2200
#define GL_TEXTURE_ENV_COLOR 0x2201
/* TextureEnvTarget */
#define GL_TEXTURE_ENV 0x2300
/* TextureMagFilter */
#define GL_NEAREST 0x2600
#define GL_LINEAR 0x2601
/* TextureMinFilter */
/* GL_NEAREST */
/* GL_LINEAR */
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
/* TextureParameterName */
#define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
#define GL_GENERATE_MIPMAP 0x8191
/* TextureTarget */
/* GL_TEXTURE_2D */
/* TextureUnit */
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#define GL_TEXTURE2 0x84C2
#define GL_TEXTURE3 0x84C3
#define GL_TEXTURE4 0x84C4
#define GL_TEXTURE5 0x84C5
#define GL_TEXTURE6 0x84C6
#define GL_TEXTURE7 0x84C7
#define GL_TEXTURE8 0x84C8
#define GL_TEXTURE9 0x84C9
#define GL_TEXTURE10 0x84CA
#define GL_TEXTURE11 0x84CB
#define GL_TEXTURE12 0x84CC
#define GL_TEXTURE13 0x84CD
#define GL_TEXTURE14 0x84CE
#define GL_TEXTURE15 0x84CF
#define GL_TEXTURE16 0x84D0
#define GL_TEXTURE17 0x84D1
#define GL_TEXTURE18 0x84D2
#define GL_TEXTURE19 0x84D3
#define GL_TEXTURE20 0x84D4
#define GL_TEXTURE21 0x84D5
#define GL_TEXTURE22 0x84D6
#define GL_TEXTURE23 0x84D7
#define GL_TEXTURE24 0x84D8
#define GL_TEXTURE25 0x84D9
#define GL_TEXTURE26 0x84DA
#define GL_TEXTURE27 0x84DB
#define GL_TEXTURE28 0x84DC
#define GL_TEXTURE29 0x84DD
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
/* TextureWrapMode */
#define GL_REPEAT 0x2901
#define GL_CLAMP_TO_EDGE 0x812F
/* VertexPointerType */
/* GL_SHORT */
/* GL_FLOAT */
/* GL_FIXED */
/* GL_BYTE */
/* LightName */
#define GL_LIGHT0 0x4000
#define GL_LIGHT1 0x4001
#define GL_LIGHT2 0x4002
#define GL_LIGHT3 0x4003
#define GL_LIGHT4 0x4004
#define GL_LIGHT5 0x4005
#define GL_LIGHT6 0x4006
#define GL_LIGHT7 0x4007
/* Buffer Objects */
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
#define GL_STATIC_DRAW 0x88E4
#define GL_DYNAMIC_DRAW 0x88E8
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765
/* Texture combine + dot3 */
#define GL_SUBTRACT 0x84E7
#define GL_COMBINE 0x8570
#define GL_COMBINE_RGB 0x8571
#define GL_COMBINE_ALPHA 0x8572
#define GL_RGB_SCALE 0x8573
#define GL_ADD_SIGNED 0x8574
#define GL_INTERPOLATE 0x8575
#define GL_CONSTANT 0x8576
#define GL_PRIMARY_COLOR 0x8577
#define GL_PREVIOUS 0x8578
#define GL_OPERAND0_RGB 0x8590
#define GL_OPERAND1_RGB 0x8591
#define GL_OPERAND2_RGB 0x8592
#define GL_OPERAND0_ALPHA 0x8598
#define GL_OPERAND1_ALPHA 0x8599
#define GL_OPERAND2_ALPHA 0x859A
#define GL_ALPHA_SCALE 0x0D1C
#define GL_SRC0_RGB 0x8580
#define GL_SRC1_RGB 0x8581
#define GL_SRC2_RGB 0x8582
#define GL_SRC0_ALPHA 0x8588
#define GL_SRC1_ALPHA 0x8589
#define GL_SRC2_ALPHA 0x858A
#define GL_DOT3_RGB 0x86AE
#define GL_DOT3_RGBA 0x86AF
/*------------------------------------------------------------------------*
* required OES extension tokens
*------------------------------------------------------------------------*/
/* OES_read_format */
#ifndef GL_OES_read_format
#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
#endif
/* GL_OES_compressed_paletted_texture */
#ifndef GL_OES_compressed_paletted_texture
#define GL_PALETTE4_RGB8_OES 0x8B90
#define GL_PALETTE4_RGBA8_OES 0x8B91
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
#define GL_PALETTE4_RGBA4_OES 0x8B93
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
#define GL_PALETTE8_RGB8_OES 0x8B95
#define GL_PALETTE8_RGBA8_OES 0x8B96
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
#define GL_PALETTE8_RGBA4_OES 0x8B98
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
#endif
/* OES_point_size_array */
#ifndef GL_OES_point_size_array
#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
#endif
/* GL_OES_point_sprite */
#ifndef GL_OES_point_sprite
#define GL_POINT_SPRITE_OES 0x8861
#define GL_COORD_REPLACE_OES 0x8862
#endif
/*************************************************************/
/* Available only in Common profile */
GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref);
GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]);
GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glLineWidth (GLfloat width);
GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glPointSize (GLfloat size);
GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
/* Available in both Common and Common-Lite profiles */
GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
GL_API void GL_APIENTRY glClear (GLbitfield mask);
GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
GL_API void GL_APIENTRY glClearDepthx (GLclampx depth);
GL_API void GL_APIENTRY glClearStencil (GLint s);
GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GL_API void GL_APIENTRY glCullFace (GLenum mode);
GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
GL_API void GL_APIENTRY glDepthFunc (GLenum func);
GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
GL_API void GL_APIENTRY glDisable (GLenum cap);
GL_API void GL_APIENTRY glDisableClientState (GLenum array);
GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
GL_API void GL_APIENTRY glEnable (GLenum cap);
GL_API void GL_APIENTRY glEnableClientState (GLenum array);
GL_API void GL_APIENTRY glFinish (void);
GL_API void GL_APIENTRY glFlush (void);
GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glFrontFace (GLenum mode);
GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params);
GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]);
GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
GL_API GLenum GL_APIENTRY glGetError (void);
GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params);
GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glGetPointerv (GLenum pname, GLvoid **params);
GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name);
GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params);
GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
GL_API void GL_APIENTRY glLoadIdentity (void);
GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glPointSizex (GLfixed size);
GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
GL_API void GL_APIENTRY glPopMatrix (void);
GL_API void GL_APIENTRY glPushMatrix (void);
GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
GL_API void GL_APIENTRY glShadeModel (GLenum mode);
GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
GL_API void GL_APIENTRY glStencilMask (GLuint mask);
GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
/*------------------------------------------------------------------------*
* Required OES extension functions
*------------------------------------------------------------------------*/
/* GL_OES_read_format */
#ifndef GL_OES_read_format
#define GL_OES_read_format 1
#endif
/* GL_OES_compressed_paletted_texture */
#ifndef GL_OES_compressed_paletted_texture
#define GL_OES_compressed_paletted_texture 1
#endif
/* GL_OES_point_size_array */
#ifndef GL_OES_point_size_array
#define GL_OES_point_size_array 1
GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer);
#endif
/* GL_OES_point_sprite */
#ifndef GL_OES_point_sprite
#define GL_OES_point_sprite 1
#endif
#ifdef __cplusplus
}
#endif
#endif /* __gl_h_ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
#ifndef __glplatform_h_
#define __glplatform_h_
/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/* Platform-specific types and definitions for OpenGL ES 1.X gl.h
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "OpenGL-ES" component "Registry".
*/
#include <KHR/khrplatform.h>
#ifndef GL_API
#define GL_API KHRONOS_APICALL
#endif
#ifndef GL_APIENTRY
#define GL_APIENTRY KHRONOS_APIENTRY
#endif
#endif /* __glplatform_h_ */

View file

@ -0,0 +1,53 @@
/*
* Copyright (C) 2011 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 "OpenGLESDispatch/RenderEGL_functions.h"
#include "OpenGLESDispatch/RenderEGL_extensions_functions.h"
// This header is used to define the EGLDispatch structure that contains
// pointers to the EGL shared library used by libOpenglRender. Normally,
// this will be our own libEGL_translator, but one could imagine a
// vendor-specific being used instead.
// There is a single global instance of this structure, named |s_egl|,
// which must be initialized by calling init_egl_dispatch() before use.
// Note that our code requires the implementation of misc EGL extensions
// including eglSetSwapRectangleANDROID(), see RenderEGL_extensions_functions.h
// for a full list.
#define RENDER_EGL_DEFINE_TYPE(return_type, function_name, signature) \
typedef return_type (EGLAPIENTRY *function_name ## _t) signature;
#define RENDER_EGL_DECLARE_MEMBER(return_type, function_name, signature) \
function_name ## _t function_name;
// Define function typedefs.
LIST_RENDER_EGL_FUNCTIONS(RENDER_EGL_DEFINE_TYPE)
LIST_RENDER_EGL_EXTENSIONS_FUNCTIONS(RENDER_EGL_DEFINE_TYPE)
// Define EGLDispatch structure.
struct EGLDispatch {
LIST_RENDER_EGL_FUNCTIONS(RENDER_EGL_DECLARE_MEMBER)
LIST_RENDER_EGL_EXTENSIONS_FUNCTIONS(RENDER_EGL_DECLARE_MEMBER)
};
// Initialize EGLDispatch function. Return true on success, false on failure.
bool init_egl_dispatch();
// Global EGLDispatch instance. Call init_egl_dispatch() before using it.
extern EGLDispatch s_egl;

View file

@ -0,0 +1,41 @@
/*
* Copyright (C) 2011 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 "OpenGLESDispatch/gldefs.h"
#include "OpenGLESDispatch/gles_functions.h"
#include "KHR/khrplatform.h"
// Define function pointer types.
#define GLES1_DISPATCH_DEFINE_TYPE(return_type,func_name,signature,callargs) \
typedef return_type (KHRONOS_APIENTRY * func_name ## _t) signature;
LIST_GLES1_FUNCTIONS(GLES1_DISPATCH_DEFINE_TYPE,GLES1_DISPATCH_DEFINE_TYPE)
struct GLESv1Dispatch {
#define GLES1_DISPATCH_DECLARE_POINTER(return_type,func_name,signature,callargs) \
func_name ## _t func_name;
LIST_GLES1_FUNCTIONS(GLES1_DISPATCH_DECLARE_POINTER,
GLES1_DISPATCH_DECLARE_POINTER)
};
#undef GLES1_DISPATCH_DECLARE_POINTER
#undef GLES1_DISPATCH_DEFINE_TYPE
bool gles1_dispatch_init(GLESv1Dispatch* dispatch_table);
// Used to initialize the decoder.
void* gles1_dispatch_get_proc_func(const char* name, void* userData);

View file

@ -0,0 +1,41 @@
/*
* Copyright (C) 2011 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 "OpenGLESDispatch/gldefs.h"
#include "OpenGLESDispatch/gles_functions.h"
#include "KHR/khrplatform.h"
// Define function pointer types.
#define GLES2_DISPATCH_DEFINE_TYPE(return_type,func_name,signature,callargs) \
typedef return_type (KHRONOS_APIENTRY * func_name ## _t) signature;
LIST_GLES2_FUNCTIONS(GLES2_DISPATCH_DEFINE_TYPE,GLES2_DISPATCH_DEFINE_TYPE)
struct GLESv2Dispatch {
#define GLES2_DISPATCH_DECLARE_POINTER(return_type,func_name,signature,callargs) \
func_name ## _t func_name;
LIST_GLES2_FUNCTIONS(GLES2_DISPATCH_DECLARE_POINTER,
GLES2_DISPATCH_DECLARE_POINTER)
};
#undef GLES2_DISPATCH_DECLARE_POINTER
#undef GLES2_DISPATCH_DEFINE_TYPE
bool gles2_dispatch_init(GLESv2Dispatch* dispatch_table);
// Used to initialize the decoder.
void* gles2_dispatch_get_proc_func(const char* name, void* userData);

Some files were not shown because too many files have changed in this diff Show more