Initial work
This commit is contained in:
commit
3222551702
374 changed files with 40290 additions and 0 deletions
92
CMakeLists.txt
Normal file
92
CMakeLists.txt
Normal 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
25
cmake/FindEGL.cmake
Normal 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
25
cmake/FindGLESv2.cmake
Normal 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)
|
||||
43
cmake/LinuxCrossCompile.cmake
Normal file
43
cmake/LinuxCrossCompile.cmake
Normal 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
162
cross-compile-chroot.sh
Executable 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
3
external/CMakeLists.txt
vendored
Normal 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
91
external/android-emugl/Android.mk
vendored
Normal 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
20
external/android-emugl/CMakeLists.txt
vendored
Normal 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
615
external/android-emugl/DESIGN
vendored
Normal 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
96
external/android-emugl/README
vendored
Normal 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
241
external/android-emugl/common.mk
vendored
Normal 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
37
external/android-emugl/googletest.mk
vendored
Normal 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)
|
||||
2
external/android-emugl/host/CMakeLists.txt
vendored
Normal file
2
external/android-emugl/host/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
add_subdirectory(tools)
|
||||
add_subdirectory(libs)
|
||||
106
external/android-emugl/host/include/ETC1/etc1.h
vendored
Normal file
106
external/android-emugl/host/include/ETC1/etc1.h
vendored
Normal 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
|
||||
770
external/android-emugl/host/include/GLES/gl.h
vendored
Normal file
770
external/android-emugl/host/include/GLES/gl.h
vendored
Normal 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_ */
|
||||
|
||||
1073
external/android-emugl/host/include/GLES/glext.h
vendored
Normal file
1073
external/android-emugl/host/include/GLES/glext.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
30
external/android-emugl/host/include/GLES/glplatform.h
vendored
Normal file
30
external/android-emugl/host/include/GLES/glplatform.h
vendored
Normal 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_ */
|
||||
53
external/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h
vendored
Normal file
53
external/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h
vendored
Normal 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;
|
||||
41
external/android-emugl/host/include/OpenGLESDispatch/GLESv1Dispatch.h
vendored
Normal file
41
external/android-emugl/host/include/OpenGLESDispatch/GLESv1Dispatch.h
vendored
Normal 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);
|
||||
41
external/android-emugl/host/include/OpenGLESDispatch/GLESv2Dispatch.h
vendored
Normal file
41
external/android-emugl/host/include/OpenGLESDispatch/GLESv2Dispatch.h
vendored
Normal 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);
|
||||
15
external/android-emugl/host/include/OpenGLESDispatch/RenderEGL_extensions_functions.h
vendored
Normal file
15
external/android-emugl/host/include/OpenGLESDispatch/RenderEGL_extensions_functions.h
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=functions distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl_extensions.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_extensions_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef RENDER_EGL_EXTENSIONS_FUNCTIONS_H
|
||||
#define RENDER_EGL_EXTENSIONS_FUNCTIONS_H
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
#include <EGL/eglext.h>
|
||||
#define LIST_RENDER_EGL_EXTENSIONS_FUNCTIONS(X) \
|
||||
X(EGLImageKHR, eglCreateImageKHR, (EGLDisplay display, EGLContext context, EGLenum target, EGLClientBuffer buffer, const EGLint* attrib_list)) \
|
||||
X(EGLBoolean, eglDestroyImageKHR, (EGLDisplay display, EGLImageKHR image)) \
|
||||
|
||||
|
||||
#endif // RENDER_EGL_EXTENSIONS_FUNCTIONS_H
|
||||
31
external/android-emugl/host/include/OpenGLESDispatch/RenderEGL_functions.h
vendored
Normal file
31
external/android-emugl/host/include/OpenGLESDispatch/RenderEGL_functions.h
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=functions distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef RENDER_EGL_FUNCTIONS_H
|
||||
#define RENDER_EGL_FUNCTIONS_H
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#define LIST_RENDER_EGL_FUNCTIONS(X) \
|
||||
X(EGLint, eglGetError, ()) \
|
||||
X(EGLDisplay, eglGetDisplay, (EGLNativeDisplayType dpy)) \
|
||||
X(EGLBoolean, eglInitialize, (EGLDisplay dpy, EGLint* major, EGLint* minor)) \
|
||||
X(char*, eglQueryString, (EGLDisplay dpy, EGLint id)) \
|
||||
X(EGLBoolean, eglGetConfigs, (EGLDisplay display, EGLConfig* configs, EGLint config_size, EGLint* num_config)) \
|
||||
X(EGLBoolean, eglChooseConfig, (EGLDisplay display, const EGLint* attribs, EGLConfig* configs, EGLint config_size, EGLint* num_config)) \
|
||||
X(EGLBoolean, eglGetConfigAttrib, (EGLDisplay display, EGLConfig config, EGLint attribute, EGLint* value)) \
|
||||
X(EGLSurface, eglCreateWindowSurface, (EGLDisplay display, EGLConfig config, EGLNativeWindowType native_window, const EGLint* attrib_list)) \
|
||||
X(EGLSurface, eglCreatePbufferSurface, (EGLDisplay display, EGLConfig config, const EGLint* attrib_list)) \
|
||||
X(EGLBoolean, eglDestroySurface, (EGLDisplay display, EGLSurface surface)) \
|
||||
X(EGLBoolean, eglBindAPI, (EGLenum api)) \
|
||||
X(EGLenum, eglQueryAPI, ()) \
|
||||
X(EGLBoolean, eglReleaseThread, ()) \
|
||||
X(EGLContext, eglCreateContext, (EGLDisplay display, EGLConfig config, EGLContext share_context, const EGLint* attrib_list)) \
|
||||
X(EGLBoolean, eglDestroyContext, (EGLDisplay display, EGLContext context)) \
|
||||
X(EGLBoolean, eglMakeCurrent, (EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context)) \
|
||||
X(EGLContext, eglGetCurrentContext, ()) \
|
||||
X(EGLSurface, eglGetCurrentSurface, (EGLint readdraw)) \
|
||||
X(EGLBoolean, eglSwapBuffers, (EGLDisplay display, EGLSurface surface)) \
|
||||
X(void*, eglGetProcAddress, (const char* function_name)) \
|
||||
|
||||
|
||||
#endif // RENDER_EGL_FUNCTIONS_H
|
||||
45
external/android-emugl/host/include/OpenGLESDispatch/gldefs.h
vendored
Normal file
45
external/android-emugl/host/include/OpenGLESDispatch/gldefs.h
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
typedef double GLclampd; /* double precision float in [0,1] */
|
||||
typedef double GLdouble; /* double precision float */
|
||||
typedef void* GLeglImageOES;
|
||||
|
||||
#define GL_S 0x2000
|
||||
#define GL_T 0x2001
|
||||
#define GL_R 0x2002
|
||||
#define GL_Q 0x2003
|
||||
#define GL_TEXTURE_GEN_S 0x0C60
|
||||
#define GL_TEXTURE_GEN_T 0x0C61
|
||||
#define GL_TEXTURE_GEN_R 0x0C62
|
||||
#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
|
||||
#define GL_TRANSFORM_BIT 0x00001000
|
||||
#define GL_INT 0x1404
|
||||
#define GL_HALF_FLOAT_NV 0x140B
|
||||
#define GL_HALF_FLOAT 0x140B
|
||||
#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
|
||||
#define GL_POINT_SPRITE 0x8861
|
||||
#define GL_FRAMEBUFFER_EXT 0x8D40
|
||||
#define GL_TEXTURE_WIDTH 0x1000
|
||||
#define GL_TEXTURE_HEIGHT 0x1001
|
||||
#define GL_TEXTURE_RED_SIZE 0x805C
|
||||
#define GL_TEXTURE_GREEN_SIZE 0x805D
|
||||
#define GL_TEXTURE_BLUE_SIZE 0x805E
|
||||
#define GL_TEXTURE_ALPHA_SIZE 0x805F
|
||||
#define GL_TEXTURE_DEPTH_SIZE 0x884A
|
||||
#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
|
||||
27
external/android-emugl/host/include/OpenGLESDispatch/gles1_extensions_functions.h
vendored
Normal file
27
external/android-emugl/host/include/OpenGLESDispatch/gles1_extensions_functions.h
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_extensions.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles1_extensions_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef GLES1_EXTENSIONS_FUNCTIONS_H
|
||||
#define GLES1_EXTENSIONS_FUNCTIONS_H
|
||||
|
||||
#define LIST_GLES1_EXTENSIONS_FUNCTIONS(X) \
|
||||
X(void, glCurrentPaletteMatrixARB, (GLint index), (index)) \
|
||||
X(void, glMatrixIndexuivARB, (GLint size, GLuint * indices), (size, indices)) \
|
||||
X(void, glMatrixIndexPointerARB, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer), (size, type, stride, pointer)) \
|
||||
X(void, glWeightPointerARB, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer), (size, type, stride, pointer)) \
|
||||
X(void, glTexGenf, (GLenum coord, GLenum pname, GLfloat param), (coord, pname, param)) \
|
||||
X(void, glTexGeni, (GLenum coord, GLenum pname, GLint param), (coord, pname, param)) \
|
||||
X(void, glTexGenfv, (GLenum coord, GLenum pname, const GLfloat * params), (coord, pname, params)) \
|
||||
X(void, glTexGeniv, (GLenum coord, GLenum pname, const GLint * params), (coord, pname, params)) \
|
||||
X(void, glGetTexGenfv, (GLenum coord, GLenum pname, GLfloat * params), (coord, pname, params)) \
|
||||
X(void, glGetTexGeniv, (GLenum coord, GLenum pname, GLint * params), (coord, pname, params)) \
|
||||
X(void, glDrawTexsOES, (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height), (x, y, z, width, height)) \
|
||||
X(void, glDrawTexiOES, (GLshort x, GLint y, GLint z, GLint width, GLshort height), (x, y, z, width, height)) \
|
||||
X(void, glDrawTexfOES, (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height), (x, y, z, width, height)) \
|
||||
X(void, glDrawTexxOES, (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height), (x, y, z, width, height)) \
|
||||
X(void, glDrawTexsvOES, (const GLshort *coords), (coords)) \
|
||||
X(void, glDrawTexivOES, (const GLint *coords), (coords)) \
|
||||
X(void, glDrawTexxvOES, (const GLfixed *coords), (coords)) \
|
||||
X(void, glDrawTexfvOES, (const GLfloat *coords), (coords)) \
|
||||
|
||||
#endif // GLES1_EXTENSIONS_FUNCTIONS_H
|
||||
71
external/android-emugl/host/include/OpenGLESDispatch/gles1_only_functions.h
vendored
Normal file
71
external/android-emugl/host/include/OpenGLESDispatch/gles1_only_functions.h
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_only.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles1_only_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef GLES1_ONLY_FUNCTIONS_H
|
||||
#define GLES1_ONLY_FUNCTIONS_H
|
||||
|
||||
#define LIST_GLES1_ONLY_FUNCTIONS(X) \
|
||||
X(void, glAlphaFunc, (GLenum func, GLclampf ref), (func, ref)) \
|
||||
X(void, glBegin, (GLenum mode), (mode)) \
|
||||
X(void, glClientActiveTexture, (GLenum texture), (texture)) \
|
||||
X(void, glClipPlane, (GLenum plane, const GLdouble * equation), (plane, equation)) \
|
||||
X(void, glColor4d, (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha), (red, green, blue, alpha)) \
|
||||
X(void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha)) \
|
||||
X(void, glColor4fv, (const GLfloat * v), (v)) \
|
||||
X(void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha), (red, green, blue, alpha)) \
|
||||
X(void, glColor4ubv, (const GLubyte * v), (v)) \
|
||||
X(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), (size, type, stride, pointer)) \
|
||||
X(void, glDisableClientState, (GLenum array), (array)) \
|
||||
X(void, glEnableClientState, (GLenum array), (array)) \
|
||||
X(void, glEnd, (), ()) \
|
||||
X(void, glFogf, (GLenum pname, GLfloat param), (pname, param)) \
|
||||
X(void, glFogfv, (GLenum pname, const GLfloat * params), (pname, params)) \
|
||||
X(void, glFrustum, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar), (left, right, bottom, top, zNear, zFar)) \
|
||||
X(void, glGetClipPlane, (GLenum plane, GLdouble * equation), (plane, equation)) \
|
||||
X(void, glGetDoublev, (GLenum pname, GLdouble * params), (pname, params)) \
|
||||
X(void, glGetLightfv, (GLenum light, GLenum pname, GLfloat * params), (light, pname, params)) \
|
||||
X(void, glGetMaterialfv, (GLenum face, GLenum pname, GLfloat * params), (face, pname, params)) \
|
||||
X(void, glGetPointerv, (GLenum pname, GLvoid* * params), (pname, params)) \
|
||||
X(void, glGetTexEnvfv, (GLenum target, GLenum pname, GLfloat * params), (target, pname, params)) \
|
||||
X(void, glGetTexEnviv, (GLenum target, GLenum pname, GLint * params), (target, pname, params)) \
|
||||
X(void, glLightf, (GLenum light, GLenum pname, GLfloat param), (light, pname, param)) \
|
||||
X(void, glLightfv, (GLenum light, GLenum pname, const GLfloat * params), (light, pname, params)) \
|
||||
X(void, glLightModelf, (GLenum pname, GLfloat param), (pname, param)) \
|
||||
X(void, glLightModelfv, (GLenum pname, const GLfloat * params), (pname, params)) \
|
||||
X(void, glLoadIdentity, (), ()) \
|
||||
X(void, glLoadMatrixf, (const GLfloat * m), (m)) \
|
||||
X(void, glLogicOp, (GLenum opcode), (opcode)) \
|
||||
X(void, glMaterialf, (GLenum face, GLenum pname, GLfloat param), (face, pname, param)) \
|
||||
X(void, glMaterialfv, (GLenum face, GLenum pname, const GLfloat * params), (face, pname, params)) \
|
||||
X(void, glMultiTexCoord2fv, (GLenum target, const GLfloat * v), (target, v)) \
|
||||
X(void, glMultiTexCoord2sv, (GLenum target, const GLshort * v), (target, v)) \
|
||||
X(void, glMultiTexCoord3fv, (GLenum target, const GLfloat * v), (target, v)) \
|
||||
X(void, glMultiTexCoord3sv, (GLenum target, const GLshort * v), (target, v)) \
|
||||
X(void, glMultiTexCoord4f, (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q), (target, s, t, r, q)) \
|
||||
X(void, glMultiTexCoord4fv, (GLenum target, const GLfloat * v), (target, v)) \
|
||||
X(void, glMultiTexCoord4sv, (GLenum target, const GLshort * v), (target, v)) \
|
||||
X(void, glMultMatrixf, (const GLfloat * m), (m)) \
|
||||
X(void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz), (nx, ny, nz)) \
|
||||
X(void, glNormal3fv, (const GLfloat * v), (v)) \
|
||||
X(void, glNormal3sv, (const GLshort * v), (v)) \
|
||||
X(void, glOrtho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar), (left, right, bottom, top, zNear, zFar)) \
|
||||
X(void, glPointParameterf, (GLenum param, GLfloat value), (param, value)) \
|
||||
X(void, glPointParameterfv, (GLenum param, const GLfloat * values), (param, values)) \
|
||||
X(void, glPointSize, (GLfloat size), (size)) \
|
||||
X(void, glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z), (angle, x, y, z)) \
|
||||
X(void, glScalef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z)) \
|
||||
X(void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param)) \
|
||||
X(void, glTexEnvfv, (GLenum target, GLenum pname, const GLfloat * params), (target, pname, params)) \
|
||||
X(void, glMatrixMode, (GLenum mode), (mode)) \
|
||||
X(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid * pointer), (type, stride, pointer)) \
|
||||
X(void, glPopMatrix, (), ()) \
|
||||
X(void, glPushMatrix, (), ()) \
|
||||
X(void, glShadeModel, (GLenum mode), (mode)) \
|
||||
X(void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), (size, type, stride, pointer)) \
|
||||
X(void, glTexEnvi, (GLenum target, GLenum pname, GLint param), (target, pname, param)) \
|
||||
X(void, glTexEnviv, (GLenum target, GLenum pname, const GLint * params), (target, pname, params)) \
|
||||
X(void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z)) \
|
||||
X(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), (size, type, stride, pointer)) \
|
||||
|
||||
|
||||
#endif // GLES1_ONLY_FUNCTIONS_H
|
||||
13
external/android-emugl/host/include/OpenGLESDispatch/gles2_extensions_functions.h
vendored
Normal file
13
external/android-emugl/host/include/OpenGLESDispatch/gles2_extensions_functions.h
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_extensions.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles2_extensions_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef GLES2_EXTENSIONS_FUNCTIONS_H
|
||||
#define GLES2_EXTENSIONS_FUNCTIONS_H
|
||||
|
||||
#define LIST_GLES2_EXTENSIONS_FUNCTIONS(X) \
|
||||
X(void, glGetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision), (shadertype, precisiontype, range, precision)) \
|
||||
X(void, glReleaseShaderCompiler, (), ()) \
|
||||
X(void, glShaderBinary, (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length), (n, shaders, binaryformat, binary, length)) \
|
||||
|
||||
|
||||
#endif // GLES2_EXTENSIONS_FUNCTIONS_H
|
||||
85
external/android-emugl/host/include/OpenGLESDispatch/gles2_only_functions.h
vendored
Normal file
85
external/android-emugl/host/include/OpenGLESDispatch/gles2_only_functions.h
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_only.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles2_only_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef GLES2_ONLY_FUNCTIONS_H
|
||||
#define GLES2_ONLY_FUNCTIONS_H
|
||||
|
||||
#define LIST_GLES2_ONLY_FUNCTIONS(X) \
|
||||
X(void, glBlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red, green, blue, alpha)) \
|
||||
X(void, glStencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask), (face, func, ref, mask)) \
|
||||
X(void, glStencilMaskSeparate, (GLenum face, GLuint mask), (face, mask)) \
|
||||
X(void, glStencilOpSeparate, (GLenum face, GLenum fail, GLenum zfail, GLenum zpass), (face, fail, zfail, zpass)) \
|
||||
X(GLboolean, glIsProgram, (GLuint program), (program)) \
|
||||
X(GLboolean, glIsShader, (GLuint shader), (shader)) \
|
||||
X(void, glVertexAttrib1f, (GLuint indx, GLfloat x), (indx, x)) \
|
||||
X(void, glVertexAttrib1fv, (GLuint indx, const GLfloat* values), (indx, values)) \
|
||||
X(void, glVertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y), (indx, x, y)) \
|
||||
X(void, glVertexAttrib2fv, (GLuint indx, const GLfloat* values), (indx, values)) \
|
||||
X(void, glVertexAttrib3f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z), (indx, x, y, z)) \
|
||||
X(void, glVertexAttrib3fv, (GLuint indx, const GLfloat* values), (indx, values)) \
|
||||
X(void, glVertexAttrib4f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (indx, x, y, z, w)) \
|
||||
X(void, glVertexAttrib4fv, (GLuint indx, const GLfloat* values), (indx, values)) \
|
||||
X(void, glVertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr), (indx, size, type, normalized, stride, ptr)) \
|
||||
X(void, glDisableVertexAttribArray, (GLuint index), (index)) \
|
||||
X(void, glEnableVertexAttribArray, (GLuint index), (index)) \
|
||||
X(void, glGetVertexAttribfv, (GLuint index, GLenum pname, GLfloat* params), (index, pname, params)) \
|
||||
X(void, glGetVertexAttribiv, (GLuint index, GLenum pname, GLint* params), (index, pname, params)) \
|
||||
X(void, glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid** pointer), (index, pname, pointer)) \
|
||||
X(void, glUniform1f, (GLint location, GLfloat x), (location, x)) \
|
||||
X(void, glUniform1fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
|
||||
X(void, glUniform1i, (GLint location, GLint x), (location, x)) \
|
||||
X(void, glUniform1iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
|
||||
X(void, glUniform2f, (GLint location, GLfloat x, GLfloat y), (location, x, y)) \
|
||||
X(void, glUniform2fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
|
||||
X(void, glUniform2i, (GLint location, GLint x, GLint y), (location, x, y)) \
|
||||
X(void, glUniform2iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
|
||||
X(void, glUniform3f, (GLint location, GLfloat x, GLfloat y, GLfloat z), (location, x, y, z)) \
|
||||
X(void, glUniform3fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
|
||||
X(void, glUniform3i, (GLint location, GLint x, GLint y, GLint z), (location, x, y, z)) \
|
||||
X(void, glUniform3iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
|
||||
X(void, glUniform4f, (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (location, x, y, z, w)) \
|
||||
X(void, glUniform4fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
|
||||
X(void, glUniform4i, (GLint location, GLint x, GLint y, GLint z, GLint w), (location, x, y, z, w)) \
|
||||
X(void, glUniform4iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
|
||||
X(void, glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value)) \
|
||||
X(void, glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value)) \
|
||||
X(void, glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value)) \
|
||||
X(void, glAttachShader, (GLuint program, GLuint shader), (program, shader)) \
|
||||
X(void, glBindAttribLocation, (GLuint program, GLuint index, const GLchar* name), (program, index, name)) \
|
||||
X(void, glCompileShader, (GLuint shader), (shader)) \
|
||||
X(GLuint, glCreateProgram, (), ()) \
|
||||
X(GLuint, glCreateShader, (GLenum type), (type)) \
|
||||
X(void, glDeleteProgram, (GLuint program), (program)) \
|
||||
X(void, glDeleteShader, (GLuint shader), (shader)) \
|
||||
X(void, glDetachShader, (GLuint program, GLuint shader), (program, shader)) \
|
||||
X(void, glLinkProgram, (GLuint program), (program)) \
|
||||
X(void, glUseProgram, (GLuint program), (program)) \
|
||||
X(void, glValidateProgram, (GLuint program), (program)) \
|
||||
X(void, glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name)) \
|
||||
X(void, glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name)) \
|
||||
X(void, glGetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders), (program, maxcount, count, shaders)) \
|
||||
X(int, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name)) \
|
||||
X(void, glGetProgramiv, (GLuint program, GLenum pname, GLint* params), (program, pname, params)) \
|
||||
X(void, glGetProgramInfoLog, (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog), (program, bufsize, length, infolog)) \
|
||||
X(void, glGetShaderiv, (GLuint shader, GLenum pname, GLint* params), (shader, pname, params)) \
|
||||
X(void, glGetShaderInfoLog, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog), (shader, bufsize, length, infolog)) \
|
||||
X(void, glGetShaderSource, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source), (shader, bufsize, length, source)) \
|
||||
X(void, glGetUniformfv, (GLuint program, GLint location, GLfloat* params), (program, location, params)) \
|
||||
X(void, glGetUniformiv, (GLuint program, GLint location, GLint* params), (program, location, params)) \
|
||||
X(int, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name)) \
|
||||
X(void, glShaderSource, (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length), (shader, count, string, length)) \
|
||||
X(void, glBindFramebuffer, (GLenum target, GLuint framebuffer), (target, framebuffer)) \
|
||||
X(void, glGenFramebuffers, (GLsizei n, GLuint* framebuffers), (n, framebuffers)) \
|
||||
X(void, glFramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level)) \
|
||||
X(GLenum, glCheckFramebufferStatus, (GLenum target), (target)) \
|
||||
X(void, glDeleteFramebuffers, (GLsizei n, const GLuint* framebuffers), (n, framebuffers)) \
|
||||
X(GLboolean, glIsRenderbuffer, (GLuint renderbuffer), (renderbuffer)) \
|
||||
X(void, glBindRenderbuffer, (GLenum target, GLuint renderbuffer), (target, renderbuffer)) \
|
||||
X(void, glDeleteRenderbuffers, (GLsizei n, const GLuint * renderbuffers), (n, renderbuffers)) \
|
||||
X(void, glGenRenderbuffers, (GLsizei n, GLuint * renderbuffers), (n, renderbuffers)) \
|
||||
X(void, glRenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height)) \
|
||||
X(void, glGetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint * params), (target, pname, params)) \
|
||||
X(void, glFramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer)) \
|
||||
|
||||
|
||||
#endif // GLES2_ONLY_FUNCTIONS_H
|
||||
18
external/android-emugl/host/include/OpenGLESDispatch/gles3_only_functions.h
vendored
Normal file
18
external/android-emugl/host/include/OpenGLESDispatch/gles3_only_functions.h
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles3_only.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles3_only_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef GLES3_ONLY_FUNCTIONS_H
|
||||
#define GLES3_ONLY_FUNCTIONS_H
|
||||
|
||||
#include <GLES/gl.h>
|
||||
|
||||
// Used to avoid adding GLES3/gl3.h to our headers.
|
||||
#ifndef GL_NUM_EXTENSIONS
|
||||
#define GL_NUM_EXTENSIONS 0x821D
|
||||
#endif
|
||||
typedef const GLubyte* GLconstubyteptr;
|
||||
#define LIST_GLES3_ONLY_FUNCTIONS(X) \
|
||||
X(GLconstubyteptr, glGetStringi, (GLenum name, GLint index), (name, index)) \
|
||||
|
||||
|
||||
#endif // GLES3_ONLY_FUNCTIONS_H
|
||||
79
external/android-emugl/host/include/OpenGLESDispatch/gles_common_functions.h
vendored
Normal file
79
external/android-emugl/host/include/OpenGLESDispatch/gles_common_functions.h
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_common.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles_common_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef GLES_COMMON_FUNCTIONS_H
|
||||
#define GLES_COMMON_FUNCTIONS_H
|
||||
|
||||
#include <GLES/gl.h>
|
||||
// Return types must be single words, see GLDispatch.cpp
|
||||
typedef const GLubyte* GLconstubyteptr;
|
||||
#define LIST_GLES_COMMON_FUNCTIONS(X) \
|
||||
X(void, glActiveTexture, (GLenum texture), (texture)) \
|
||||
X(void, glBindBuffer, (GLenum target, GLuint buffer), (target, buffer)) \
|
||||
X(void, glBindTexture, (GLenum target, GLuint texture), (target, texture)) \
|
||||
X(void, glBlendFunc, (GLenum sfactor, GLenum dfactor), (sfactor, dfactor)) \
|
||||
X(void, glBlendEquation, (GLenum mode), (mode)) \
|
||||
X(void, glBlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha)) \
|
||||
X(void, glBlendFuncSeparate, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha)) \
|
||||
X(void, glBufferData, (GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage), (target, size, data, usage)) \
|
||||
X(void, glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data), (target, offset, size, data)) \
|
||||
X(void, glClear, (GLbitfield mask), (mask)) \
|
||||
X(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red, green, blue, alpha)) \
|
||||
X(void, glClearDepth, (GLclampd depth), (depth)) \
|
||||
X(void, glClearStencil, (GLint s), (s)) \
|
||||
X(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha), (red, green, blue, alpha)) \
|
||||
X(void, glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data), (target, level, internalformat, width, height, border, imageSize, data)) \
|
||||
X(void, glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data), (target, level, xoffset, yoffset, width, height, format, imageSize, data)) \
|
||||
X(void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border), (target, level, internalFormat, x, y, width, height, border)) \
|
||||
X(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, x, y, width, height)) \
|
||||
X(void, glCullFace, (GLenum mode), (mode)) \
|
||||
X(void, glDeleteBuffers, (GLsizei n, const GLuint * buffers), (n, buffers)) \
|
||||
X(void, glDeleteTextures, (GLsizei n, const GLuint * textures), (n, textures)) \
|
||||
X(void, glDepthFunc, (GLenum func), (func)) \
|
||||
X(void, glDepthMask, (GLboolean flag), (flag)) \
|
||||
X(void, glDepthRange, (GLclampd zNear, GLclampd zFar), (zNear, zFar)) \
|
||||
X(void, glDisable, (GLenum cap), (cap)) \
|
||||
X(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count), (mode, first, count)) \
|
||||
X(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid * indices), (mode, count, type, indices)) \
|
||||
X(void, glEnable, (GLenum cap), (cap)) \
|
||||
X(void, glFinish, (), ()) \
|
||||
X(void, glFlush, (), ()) \
|
||||
X(void, glFrontFace, (GLenum mode), (mode)) \
|
||||
X(void, glGenBuffers, (GLsizei n, GLuint * buffers), (n, buffers)) \
|
||||
X(void, glGenTextures, (GLsizei n, GLuint * textures), (n, textures)) \
|
||||
X(void, glGetBooleanv, (GLenum pname, GLboolean * params), (pname, params)) \
|
||||
X(void, glGetBufferParameteriv, (GLenum buffer, GLenum parameter, GLint * value), (buffer, parameter, value)) \
|
||||
X(GLenum, glGetError, (), ()) \
|
||||
X(void, glGetFloatv, (GLenum pname, GLfloat * params), (pname, params)) \
|
||||
X(void, glGetIntegerv, (GLenum pname, GLint * params), (pname, params)) \
|
||||
X(GLconstubyteptr, glGetString, (GLenum name), (name)) \
|
||||
X(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param)) \
|
||||
X(void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat * params), (target, pname, params)) \
|
||||
X(void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat * params), (target, pname, params)) \
|
||||
X(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint * params), (target, pname, params)) \
|
||||
X(void, glGetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint * params), (target, level, pname, params)) \
|
||||
X(void, glHint, (GLenum target, GLenum mode), (target, mode)) \
|
||||
X(GLboolean, glIsBuffer, (GLuint buffer), (buffer)) \
|
||||
X(GLboolean, glIsEnabled, (GLenum cap), (cap)) \
|
||||
X(GLboolean, glIsTexture, (GLuint texture), (texture)) \
|
||||
X(void, glLineWidth, (GLfloat width), (width)) \
|
||||
X(void, glPolygonOffset, (GLfloat factor, GLfloat units), (factor, units)) \
|
||||
X(void, glPixelStorei, (GLenum pname, GLint param), (pname, param)) \
|
||||
X(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels), (x, y, width, height, format, type, pixels)) \
|
||||
X(void, glSampleCoverage, (GLclampf value, GLboolean invert), (value, invert)) \
|
||||
X(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height)) \
|
||||
X(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask), (func, ref, mask)) \
|
||||
X(void, glStencilMask, (GLuint mask), (mask)) \
|
||||
X(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass), (fail, zfail, zpass)) \
|
||||
X(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels), (target, level, internalformat, width, height, border, format, type, pixels)) \
|
||||
X(void, glTexParameteri, (GLenum target, GLenum pname, GLint param), (target, pname, param)) \
|
||||
X(void, glTexParameteriv, (GLenum target, GLenum pname, const GLint * params), (target, pname, params)) \
|
||||
X(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels), (target, level, xoffset, yoffset, width, height, format, type, pixels)) \
|
||||
X(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height)) \
|
||||
X(void, glPushAttrib, (GLbitfield mask), (mask)) \
|
||||
X(void, glPushClientAttrib, (GLbitfield mask), (mask)) \
|
||||
X(void, glPopAttrib, (), ()) \
|
||||
X(void, glPopClientAttrib, (), ()) \
|
||||
|
||||
|
||||
#endif // GLES_COMMON_FUNCTIONS_H
|
||||
29
external/android-emugl/host/include/OpenGLESDispatch/gles_extensions_functions.h
vendored
Normal file
29
external/android-emugl/host/include/OpenGLESDispatch/gles_extensions_functions.h
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_extensions.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles_extensions_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef GLES_EXTENSIONS_FUNCTIONS_H
|
||||
#define GLES_EXTENSIONS_FUNCTIONS_H
|
||||
|
||||
#define LIST_GLES_EXTENSIONS_FUNCTIONS(X) \
|
||||
X(GLboolean, glIsRenderbufferEXT, (GLuint renderbuffer), (renderbuffer)) \
|
||||
X(void, glBindRenderbufferEXT, (GLenum target, GLuint renderbuffer), (target, renderbuffer)) \
|
||||
X(void, glDeleteRenderbuffersEXT, (GLsizei n, const GLuint * renderbuffers), (n, renderbuffers)) \
|
||||
X(void, glGenRenderbuffersEXT, (GLsizei n, GLuint * renderbuffers), (n, renderbuffers)) \
|
||||
X(void, glRenderbufferStorageEXT, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height)) \
|
||||
X(void, glGetRenderbufferParameterivEXT, (GLenum target, GLenum pname, GLint * params), (target, pname, params)) \
|
||||
X(GLboolean, glIsFramebufferEXT, (GLuint framebuffer), (framebuffer)) \
|
||||
X(void, glBindFramebufferEXT, (GLenum target, GLuint framebuffer), (target, framebuffer)) \
|
||||
X(void, glDeleteFramebuffersEXT, (GLsizei n, const GLuint * framebuffers), (n, framebuffers)) \
|
||||
X(void, glGenFramebuffersEXT, (GLsizei n, GLuint * framebuffers), (n, framebuffers)) \
|
||||
X(GLenum, glCheckFramebufferStatusEXT, (GLenum target), (target)) \
|
||||
X(void, glFramebufferTexture1DEXT, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level)) \
|
||||
X(void, glFramebufferTexture2DEXT, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level)) \
|
||||
X(void, glFramebufferTexture3DEXT, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset), (target, attachment, textarget, texture, level, zoffset)) \
|
||||
X(void, glFramebufferRenderbufferEXT, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer)) \
|
||||
X(void, glGetFramebufferAttachmentParameterivEXT, (GLenum target, GLenum attachment, GLenum pname, GLint * params), (target, attachment, pname, params)) \
|
||||
X(void, glGenerateMipmapEXT, (GLenum target), (target)) \
|
||||
X(void, glEGLImageTargetTexture2DOES, (GLenum target, GLeglImageOES image), (target, image)) \
|
||||
X(void, glEGLImageTargetRenderbufferStorageOES, (GLenum target, GLeglImageOES image), (target, image)) \
|
||||
|
||||
|
||||
#endif // GLES_EXTENSIONS_FUNCTIONS_H
|
||||
50
external/android-emugl/host/include/OpenGLESDispatch/gles_functions.h
vendored
Normal file
50
external/android-emugl/host/include/OpenGLESDispatch/gles_functions.h
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// Copyright 2016 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/gles_common_functions.h"
|
||||
#include "OpenGLESDispatch/gles_extensions_functions.h"
|
||||
#include "OpenGLESDispatch/gles1_only_functions.h"
|
||||
#include "OpenGLESDispatch/gles1_extensions_functions.h"
|
||||
#include "OpenGLESDispatch/gles2_only_functions.h"
|
||||
#include "OpenGLESDispatch/gles2_extensions_functions.h"
|
||||
#include "OpenGLESDispatch/gles3_only_functions.h"
|
||||
|
||||
// As a special case, LIST_GLES3_ONLY_FUNCTIONS below uses the Y parameter
|
||||
// instead of the X one, meaning that the corresponding functions are
|
||||
// optional extensions. This is only because currently, the only GLESv3
|
||||
// API we support is glGetStringi(), which is not always provided by
|
||||
// host desktop GL drivers (though most do).
|
||||
#define LIST_GLES_FUNCTIONS(X,Y) \
|
||||
LIST_GLES_COMMON_FUNCTIONS(X) \
|
||||
LIST_GLES_EXTENSIONS_FUNCTIONS(Y) \
|
||||
LIST_GLES1_ONLY_FUNCTIONS(X) \
|
||||
LIST_GLES1_EXTENSIONS_FUNCTIONS(Y) \
|
||||
LIST_GLES2_ONLY_FUNCTIONS(X) \
|
||||
LIST_GLES2_EXTENSIONS_FUNCTIONS(Y) \
|
||||
LIST_GLES3_ONLY_FUNCTIONS(Y) \
|
||||
|
||||
#define LIST_GLES1_FUNCTIONS(X, Y) \
|
||||
LIST_GLES_COMMON_FUNCTIONS(X) \
|
||||
LIST_GLES_EXTENSIONS_FUNCTIONS(Y) \
|
||||
LIST_GLES1_ONLY_FUNCTIONS(X) \
|
||||
LIST_GLES1_EXTENSIONS_FUNCTIONS(Y) \
|
||||
|
||||
#define LIST_GLES2_FUNCTIONS(X, Y) \
|
||||
LIST_GLES_COMMON_FUNCTIONS(X) \
|
||||
LIST_GLES_EXTENSIONS_FUNCTIONS(Y) \
|
||||
LIST_GLES2_ONLY_FUNCTIONS(X) \
|
||||
LIST_GLES2_EXTENSIONS_FUNCTIONS(Y) \
|
||||
|
||||
56
external/android-emugl/host/include/OpenglRender/render_api.h
vendored
Normal file
56
external/android-emugl/host/include/OpenglRender/render_api.h
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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 "OpenglRender/render_api_functions.h"
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
/* This header and its declarations must be usable from C code.
|
||||
*
|
||||
* If RENDER_API_NO_PROTOTYPES is #defined before including this header, only
|
||||
* the interface function pointer types will be declared, not the prototypes.
|
||||
* This allows the client to use those names for its function pointer variables.
|
||||
*
|
||||
* All interfaces which can fail return an int, with zero indicating failure
|
||||
* and anything else indicating success.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Use KHRONOS_APICALL to control visibility, but do not use KHRONOS_APIENTRY
|
||||
// because we don't need the functions to be __stdcall on Win32.
|
||||
#define RENDER_APICALL KHRONOS_APICALL
|
||||
#define RENDER_APIENTRY
|
||||
|
||||
#define RENDER_API_DECLARE(return_type, func_name, signature, callargs) \
|
||||
typedef return_type (RENDER_APIENTRY *func_name ## Fn) signature; \
|
||||
RENDER_APICALL return_type RENDER_APIENTRY func_name signature;
|
||||
|
||||
typedef void (*emugl_logger_func_t)(const char* fmt, ...);
|
||||
|
||||
typedef struct {
|
||||
emugl_logger_func_t coarse;
|
||||
emugl_logger_func_t fine;
|
||||
} emugl_logger_struct;
|
||||
|
||||
LIST_RENDER_API_FUNCTIONS(RENDER_API_DECLARE)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
37
external/android-emugl/host/include/OpenglRender/render_api_functions.h
vendored
Normal file
37
external/android-emugl/host/include/OpenglRender/render_api_functions.h
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenglRender/render_api.entries --output=distrib/android-emugl/host/include/OpenglRender/render_api_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef RENDER_API_FUNCTIONS_H
|
||||
#define RENDER_API_FUNCTIONS_H
|
||||
|
||||
#include "OpenglRender/render_api_platform_types.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* list of constants to be passed to setStreamMode */
|
||||
#define RENDER_API_STREAM_MODE_DEFAULT 0
|
||||
#define RENDER_API_STREAM_MODE_TCP 1
|
||||
#define RENDER_API_STREAM_MODE_UNIX 2
|
||||
#define RENDER_API_STREAM_MODE_PIPE 3
|
||||
|
||||
typedef void (*OnPostFn)(void* context, int width, int height, int ydir,
|
||||
int format, int type, unsigned char* pixels);
|
||||
typedef void (*emugl_crash_func_t)(const char* format, ...);
|
||||
|
||||
#define LIST_RENDER_API_FUNCTIONS(X) \
|
||||
X(int, initLibrary, (), ()) \
|
||||
X(int, setStreamMode, (int mode), (mode)) \
|
||||
X(int, initOpenGLRenderer, (int width, int height, bool useSubWindow, char* addr, size_t addrLen, emugl_logger_struct logfuncs, emugl_crash_func_t crashfunc), (width, height, useSubWindow, addr, addrLen, logfuncs, crashfunc)) \
|
||||
X(void, getHardwareStrings, (const char** vendor, const char** renderer, const char** version), (vendor, renderer, version)) \
|
||||
X(void, setPostCallback, (OnPostFn onPost, void* onPostContext), (onPost, onPostContext)) \
|
||||
X(bool, showOpenGLSubwindow, (FBNativeWindowType window, int wx, int wy, int ww, int wh, int fbw, int fbh, float dpr, float zRot), (window, wx, wy, ww, wh, fbw, fbh, dpr, zRot)) \
|
||||
X(bool, destroyOpenGLSubwindow, (), ()) \
|
||||
X(void, setOpenGLDisplayRotation, (float zRot), (zRot)) \
|
||||
X(void, setOpenGLDisplayTranslation, (float px, float py), (px, py)) \
|
||||
X(void, repaintOpenGLDisplay, (), ()) \
|
||||
X(int, stopOpenGLRenderer, (), ()) \
|
||||
|
||||
|
||||
#endif // RENDER_API_FUNCTIONS_H
|
||||
39
external/android-emugl/host/include/OpenglRender/render_api_platform_types.h
vendored
Normal file
39
external/android-emugl/host/include/OpenglRender/render_api_platform_types.h
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 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
|
||||
|
||||
// Define FBNativeWindowType which corresponds to the type of native
|
||||
// host UI window handles.
|
||||
|
||||
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
|
||||
#include <windows.h>
|
||||
|
||||
typedef HWND FBNativeWindowType;
|
||||
|
||||
#elif defined(__linux__)
|
||||
|
||||
// Really a Window handle, but we don't want to include the X11 headers here.
|
||||
#include <stdint.h>
|
||||
typedef uint32_t FBNativeWindowType;
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
typedef void* FBNativeWindowType;
|
||||
|
||||
#else
|
||||
#warning "Unsupported platform"
|
||||
#endif
|
||||
103
external/android-emugl/host/include/libOpenglRender/IOStream.h
vendored
Normal file
103
external/android-emugl/host/include/libOpenglRender/IOStream.h
vendored
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef __IO_STREAM_H__
|
||||
#define __IO_STREAM_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ErrorLog.h"
|
||||
|
||||
class IOStream {
|
||||
public:
|
||||
|
||||
IOStream(size_t bufSize) {
|
||||
m_buf = NULL;
|
||||
m_bufsize = bufSize;
|
||||
m_free = 0;
|
||||
}
|
||||
|
||||
virtual void *allocBuffer(size_t minSize) = 0;
|
||||
virtual int commitBuffer(size_t size) = 0;
|
||||
virtual const unsigned char *readFully( void *buf, size_t len) = 0;
|
||||
virtual const unsigned char *read( void *buf, size_t *inout_len) = 0;
|
||||
virtual int writeFully(const void* buf, size_t len) = 0;
|
||||
virtual void forceStop() = 0;
|
||||
|
||||
virtual ~IOStream() {
|
||||
|
||||
// NOTE: m_buf is 'owned' by the child class thus we expect it to be released by it
|
||||
}
|
||||
|
||||
unsigned char *alloc(size_t len) {
|
||||
|
||||
if (m_buf && len > m_free) {
|
||||
if (flush() < 0) {
|
||||
ERR("Failed to flush in alloc\n");
|
||||
return NULL; // we failed to flush so something is wrong
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_buf || len > m_bufsize) {
|
||||
int allocLen = m_bufsize < len ? len : m_bufsize;
|
||||
m_buf = (unsigned char *)allocBuffer(allocLen);
|
||||
if (!m_buf) {
|
||||
ERR("Alloc (%u bytes) failed\n", allocLen);
|
||||
return NULL;
|
||||
}
|
||||
m_bufsize = m_free = allocLen;
|
||||
}
|
||||
|
||||
unsigned char *ptr;
|
||||
|
||||
ptr = m_buf + (m_bufsize - m_free);
|
||||
m_free -= len;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
int flush() {
|
||||
|
||||
if (!m_buf || m_free == m_bufsize) return 0;
|
||||
|
||||
int stat = commitBuffer(m_bufsize - m_free);
|
||||
m_buf = NULL;
|
||||
m_free = 0;
|
||||
return stat;
|
||||
}
|
||||
|
||||
const unsigned char *readback(void *buf, size_t len) {
|
||||
flush();
|
||||
return readFully(buf, len);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
unsigned char *m_buf;
|
||||
size_t m_bufsize;
|
||||
size_t m_free;
|
||||
};
|
||||
|
||||
//
|
||||
// When a client opens a connection to the renderer, it should
|
||||
// send unsigned int value indicating the "clientFlags".
|
||||
// The following are the bitmask of the clientFlags.
|
||||
// currently only one bit is used which flags the server
|
||||
// it should exit.
|
||||
//
|
||||
#define IOSTREAM_CLIENT_EXIT_SERVER 1
|
||||
|
||||
#endif
|
||||
6
external/android-emugl/host/libs/CMakeLists.txt
vendored
Normal file
6
external/android-emugl/host/libs/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
add_subdirectory(mir_support)
|
||||
add_subdirectory(GLESv1_dec)
|
||||
add_subdirectory(GLESv2_dec)
|
||||
add_subdirectory(libOpenGLESDispatch)
|
||||
add_subdirectory(libOpenglRender)
|
||||
add_subdirectory(renderControl_dec)
|
||||
16
external/android-emugl/host/libs/GLESv1_dec/Android.mk
vendored
Normal file
16
external/android-emugl/host/libs/GLESv1_dec/Android.mk
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
### host library #########################################
|
||||
$(call emugl-begin-host-static-library,libGLESv1_dec)
|
||||
|
||||
$(call emugl-import, libOpenglCodecCommon)
|
||||
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
|
||||
|
||||
$(call emugl-gen-decoder,$(LOCAL_PATH),gles1)
|
||||
|
||||
LOCAL_SRC_FILES := GLESv1Decoder.cpp
|
||||
|
||||
$(call emugl-export,CFLAGS,$(EMUGL_USER_CFLAGS))
|
||||
$(call emugl-export,LDLIBS,$(CXX_STD_LIB))
|
||||
|
||||
$(call emugl-end-module)
|
||||
18
external/android-emugl/host/libs/GLESv1_dec/CMakeLists.txt
vendored
Normal file
18
external/android-emugl/host/libs/GLESv1_dec/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
set(GENERATED_SOURCES
|
||||
gles1_dec.cpp
|
||||
gles1_opcodes.h
|
||||
gles1_server_context.cpp)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${GENERATED_SOURCES}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen
|
||||
-D ${CMAKE_CURRENT_BINARY_DIR} gles1
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS emugen)
|
||||
|
||||
set(SOURCES
|
||||
GLESv1Decoder.cpp)
|
||||
|
||||
add_library(GLESv1_dec ${SOURCES} ${GENERATED_SOURCES})
|
||||
target_link_libraries(GLESv1_dec OpenglCodecCommon)
|
||||
229
external/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.cpp
vendored
Normal file
229
external/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.cpp
vendored
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "GLESv1Decoder.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static inline void* SafePointerFromUInt(GLuint value) {
|
||||
return (void*)(uintptr_t)value;
|
||||
}
|
||||
|
||||
GLESv1Decoder::GLESv1Decoder()
|
||||
{
|
||||
m_contextData = NULL;
|
||||
m_glesDso = NULL;
|
||||
}
|
||||
|
||||
GLESv1Decoder::~GLESv1Decoder()
|
||||
{
|
||||
if (m_glesDso != NULL) {
|
||||
delete m_glesDso;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int GLESv1Decoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
|
||||
{
|
||||
this->initDispatchByName(getProcFunc, getProcFuncData);
|
||||
|
||||
glGetCompressedTextureFormats = s_glGetCompressedTextureFormats;
|
||||
glVertexPointerOffset = s_glVertexPointerOffset;
|
||||
glColorPointerOffset = s_glColorPointerOffset;
|
||||
glNormalPointerOffset = s_glNormalPointerOffset;
|
||||
glTexCoordPointerOffset = s_glTexCoordPointerOffset;
|
||||
glPointSizePointerOffset = s_glPointSizePointerOffset;
|
||||
glWeightPointerOffset = s_glWeightPointerOffset;
|
||||
glMatrixIndexPointerOffset = s_glMatrixIndexPointerOffset;
|
||||
|
||||
glVertexPointerData = s_glVertexPointerData;
|
||||
glColorPointerData = s_glColorPointerData;
|
||||
glNormalPointerData = s_glNormalPointerData;
|
||||
glTexCoordPointerData = s_glTexCoordPointerData;
|
||||
glPointSizePointerData = s_glPointSizePointerData;
|
||||
glWeightPointerData = s_glWeightPointerData;
|
||||
glMatrixIndexPointerData = s_glMatrixIndexPointerData;
|
||||
|
||||
glDrawElementsOffset = s_glDrawElementsOffset;
|
||||
glDrawElementsData = s_glDrawElementsData;
|
||||
glFinishRoundTrip = s_glFinishRoundTrip;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GLESv1Decoder::s_glFinishRoundTrip(void *self)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glFinish();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glVertexPointer(size, type, stride, SafePointerFromUInt(offset));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glColorPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glColorPointer(size, type, stride, SafePointerFromUInt(offset));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glTexCoordPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glTexCoordPointer(size, type, stride, SafePointerFromUInt(offset));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glNormalPointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glNormalPointer(type, stride, SafePointerFromUInt(offset));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glPointSizePointerOES(type, stride, SafePointerFromUInt(offset));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glWeightPointerOES(size, type, stride, SafePointerFromUInt(offset));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glMatrixIndexPointerOES(size, type, stride, SafePointerFromUInt(offset));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define STORE_POINTER_DATA_OR_ABORT(location) \
|
||||
if (ctx->m_contextData != NULL) { \
|
||||
ctx->m_contextData->storePointerData((location), data, datalen); \
|
||||
} else { \
|
||||
return; \
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glVertexPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
|
||||
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::VERTEX_LOCATION);
|
||||
|
||||
ctx->glVertexPointer(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::VERTEX_LOCATION));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glColorPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
|
||||
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::COLOR_LOCATION);
|
||||
|
||||
ctx->glColorPointer(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::COLOR_LOCATION));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glTexCoordPointerData(void *self, GLint unit, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
STORE_POINTER_DATA_OR_ABORT((GLDecoderContextData::PointerDataLocation)
|
||||
(GLDecoderContextData::TEXCOORD0_LOCATION + unit));
|
||||
|
||||
ctx->glTexCoordPointer(size, type, 0,
|
||||
ctx->m_contextData->pointerData((GLDecoderContextData::PointerDataLocation)
|
||||
(GLDecoderContextData::TEXCOORD0_LOCATION + unit)));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glNormalPointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
|
||||
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::NORMAL_LOCATION);
|
||||
|
||||
ctx->glNormalPointer(type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::NORMAL_LOCATION));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glPointSizePointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
|
||||
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::POINTSIZE_LOCATION);
|
||||
|
||||
ctx->glPointSizePointerOES(type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::POINTSIZE_LOCATION));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
|
||||
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::WEIGHT_LOCATION);
|
||||
|
||||
ctx->glWeightPointerOES(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::WEIGHT_LOCATION));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
|
||||
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::MATRIXINDEX_LOCATION);
|
||||
|
||||
ctx->glMatrixIndexPointerOES(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::MATRIXINDEX_LOCATION));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glDrawElements(mode, count, type, SafePointerFromUInt(offset));
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)self;
|
||||
ctx->glDrawElements(mode, count, type, data);
|
||||
}
|
||||
|
||||
void GLESv1Decoder::s_glGetCompressedTextureFormats(void *self, GLint count, GLint *data)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *) self;
|
||||
ctx->glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, data);
|
||||
}
|
||||
|
||||
void *GLESv1Decoder::s_getProc(const char *name, void *userData)
|
||||
{
|
||||
GLESv1Decoder *ctx = (GLESv1Decoder *)userData;
|
||||
|
||||
if (ctx == NULL || ctx->m_glesDso == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *func = NULL;
|
||||
#ifdef USE_EGL_GETPROCADDRESS
|
||||
func = (void *) eglGetProcAddress(name);
|
||||
#endif
|
||||
if (func == NULL) {
|
||||
func = (void *)(ctx->m_glesDso->findSymbol(name));
|
||||
}
|
||||
return func;
|
||||
}
|
||||
68
external/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.h
vendored
Normal file
68
external/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.h
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _GL_DECODER_H_
|
||||
#define _GL_DECODER_H_
|
||||
|
||||
#include "gles1_dec.h"
|
||||
|
||||
#include "GLDecoderContextData.h"
|
||||
#include "emugl/common/shared_library.h"
|
||||
|
||||
class GLESv1Decoder : public gles1_decoder_context_t
|
||||
{
|
||||
public:
|
||||
typedef void *(*get_proc_func_t)(const char *name, void *userData);
|
||||
|
||||
GLESv1Decoder();
|
||||
~GLESv1Decoder();
|
||||
int initGL(get_proc_func_t getProcFunc, void *getProcFuncData);
|
||||
void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
|
||||
|
||||
private:
|
||||
static void gles1_APIENTRY s_glGetCompressedTextureFormats(void * self, GLint cont, GLint *data);
|
||||
static void gles1_APIENTRY s_glVertexPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
|
||||
static void gles1_APIENTRY s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
|
||||
|
||||
static void gles1_APIENTRY s_glColorPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
|
||||
static void gles1_APIENTRY s_glColorPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
|
||||
|
||||
static void gles1_APIENTRY s_glTexCoordPointerData(void *self, GLint unit, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
|
||||
static void gles1_APIENTRY s_glTexCoordPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
|
||||
|
||||
static void gles1_APIENTRY s_glNormalPointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen);
|
||||
static void gles1_APIENTRY s_glNormalPointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset);
|
||||
|
||||
static void gles1_APIENTRY s_glPointSizePointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen);
|
||||
static void gles1_APIENTRY s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset);
|
||||
|
||||
static void gles1_APIENTRY s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset);
|
||||
static void gles1_APIENTRY s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen);
|
||||
|
||||
static void gles1_APIENTRY s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
|
||||
static void gles1_APIENTRY s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
|
||||
|
||||
static void gles1_APIENTRY s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
|
||||
static void gles1_APIENTRY s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
|
||||
|
||||
static int gles1_APIENTRY s_glFinishRoundTrip(void *self);
|
||||
|
||||
static void * s_getProc(const char *name, void *userData);
|
||||
|
||||
GLDecoderContextData *m_contextData;
|
||||
emugl::SharedLibrary* m_glesDso;
|
||||
};
|
||||
|
||||
#endif
|
||||
15
external/android-emugl/host/libs/GLESv1_dec/gles1.addon
vendored
Normal file
15
external/android-emugl/host/libs/GLESv1_dec/gles1.addon
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
GL_ENTRY(void, glVertexPointerOffset, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glColorPointerOffset, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glNormalPointerOffset, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glPointSizePointerOffset, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glTexCoordPointerOffset, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
|
||||
GL_ENTRY(void, glVertexPointerData, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glColorPointerData, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glNormalPointerData, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glTexCoordPointerData, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glPointSizePointerData, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
|
||||
GL_ENTRY(void, glDrawElementsOffset, GLenum mode, GLsizei count, GLenum type, GLuint offset);
|
||||
GL_ENTRY(void, glDrawElementsData, GLenum mode, GLsizei count, GLenum type, void *data, GLuint datalen);
|
||||
|
||||
694
external/android-emugl/host/libs/GLESv1_dec/gles1.attrib
vendored
Normal file
694
external/android-emugl/host/libs/GLESv1_dec/gles1.attrib
vendored
Normal file
|
|
@ -0,0 +1,694 @@
|
|||
GLOBAL
|
||||
base_opcode 1024
|
||||
encoder_headers "glUtils.h" "GLEncoderUtils.h"
|
||||
|
||||
#void glClipPlanef(GLenum plane, GLfloat *equation)
|
||||
glClipPlanef
|
||||
dir equation in
|
||||
len equation (4 * sizeof(float))
|
||||
|
||||
#void glFogfv(GLenum pname, GLfloat *params)
|
||||
glFogfv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glGetFloatv(GLenum pname, GLfloat *params)
|
||||
glGetFloatv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
|
||||
glGetLightfv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
|
||||
glGetMaterialfv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params)
|
||||
glGetTexEnvfv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
glGetTexParameterfv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glLightModelfv(GLenum pname, GLfloat *params)
|
||||
glLightModelfv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glLightfv(GLenum light, GLenum pname, GLfloat *params)
|
||||
glLightfv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glLoadMatrixf(GLfloat *m)
|
||||
glLoadMatrixf
|
||||
len m (16 * sizeof(GLfloat))
|
||||
|
||||
#void glMaterialfv(GLenum face, GLenum pname, GLfloat *params)
|
||||
glMaterialfv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glMultMatrixf(GLfloat *m)
|
||||
glMultMatrixf
|
||||
len m (16 * sizeof(GLfloat))
|
||||
|
||||
#void glPointParameterfv(GLenum pname, GLfloat *params)
|
||||
glPointParameterfv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
glTexEnvfv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
glTexParameterfv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glBufferData(GLenum target, GLsizeiptr size, GLvoid *data, GLenum usage)
|
||||
glBufferData
|
||||
len data size
|
||||
var_flag data nullAllowed
|
||||
|
||||
#void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
|
||||
glBufferSubData
|
||||
dir data in
|
||||
len data size
|
||||
var_flag data nullAllowed
|
||||
|
||||
#void glClipPlanex(GLenum plane, GLfixed *eqn)
|
||||
glClipPlanex
|
||||
dir eqn in
|
||||
len eqn (4 * sizeof(GLfixed))
|
||||
|
||||
#void glColorPointer(GLint size, GLenum type, GLsizei stride, GLvoid *pointer)
|
||||
#we treat the pointer as offset to a VBO
|
||||
glColorPointer
|
||||
len pointer (sizeof(unsigned int))
|
||||
flag unsupported
|
||||
|
||||
#void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLvoid *data)
|
||||
glCompressedTexImage2D
|
||||
len data imageSize
|
||||
var_flag data nullAllowed
|
||||
|
||||
#void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLvoid *data)
|
||||
glCompressedTexSubImage2D
|
||||
len data imageSize
|
||||
var_flag data nullAllowed
|
||||
|
||||
#void glDeleteBuffers(GLsizei n, GLuint *buffers)
|
||||
glDeleteBuffers
|
||||
len buffers (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glDeleteTextures(GLsizei n, GLuint *textures)
|
||||
glDeleteTextures
|
||||
len textures (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#this function is marked as unsupported - it shouldn't be called directly
|
||||
#instead it translated into - glDrawDirectElements and glDrawIndirectElements
|
||||
#void glDrawElements(GLenum mode, GLsizei count, GLenum type, GLvoid *indices)
|
||||
glDrawElements
|
||||
flag unsupported
|
||||
|
||||
|
||||
#void glFogxv(GLenum pname, GLfixed *params)
|
||||
glFogxv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetBooleanv(GLenum pname, GLboolean *params)
|
||||
glGetBooleanv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLboolean))
|
||||
|
||||
#void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
glGetBufferParameteriv
|
||||
len params (sizeof(GLint))
|
||||
dir params out
|
||||
|
||||
#void glGenBuffers(GLsizei n, GLuint *buffers)
|
||||
glGenBuffers
|
||||
len buffers (n * sizeof(GLuint))
|
||||
dir buffers out
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGenTextures(GLsizei n, GLuint *textures)
|
||||
glGenTextures
|
||||
len textures (n * sizeof(GLuint))
|
||||
dir textures out
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGetFixedv(GLenum pname, GLfixed *params)
|
||||
glGetFixedv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetIntegerv(GLenum pname, GLint *params)
|
||||
glGetIntegerv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glGetLightxv(GLenum light, GLenum pname, GLfixed *params)
|
||||
glGetLightxv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
|
||||
glGetMaterialxv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetPointerv(GLenum pname, void **params)
|
||||
glGetPointerv
|
||||
flag unsupported
|
||||
|
||||
#GLubyte* glGetString(GLenum name)
|
||||
glGetString
|
||||
flag unsupported
|
||||
|
||||
#void glGetTexEnviv(GLenum env, GLenum pname, GLint *params)
|
||||
glGetTexEnviv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params)
|
||||
glGetTexEnvxv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
glGetTexParameteriv
|
||||
dir params out
|
||||
len params (sizeof(GLint))
|
||||
|
||||
#void glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
|
||||
glGetTexParameterxv
|
||||
dir params out
|
||||
len params (sizeof(GLfixed))
|
||||
|
||||
#void glLightModelxv(GLenum pname, GLfixed *params)
|
||||
glLightModelxv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glLightxv(GLenum light, GLenum pname, GLfixed *params)
|
||||
glLightxv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glLoadMatrixx(GLfixed *m)
|
||||
glLoadMatrixx
|
||||
len m (16 * sizeof(GLfixed))
|
||||
|
||||
#void glMaterialxv(GLenum face, GLenum pname, GLfixed *params)
|
||||
glMaterialxv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glMultMatrixx(GLfixed *m)
|
||||
glMultMatrixx
|
||||
len m (16 * sizeof(GLfixed))
|
||||
|
||||
#void glNormalPointer(GLenum type, GLsizei stride, GLvoid *pointer)
|
||||
#we treat the pointer as an offset to a VBO
|
||||
glNormalPointer
|
||||
len pointer (sizeof(unsigned int))
|
||||
flag unsupported
|
||||
|
||||
#void glPointParameterxv(GLenum pname, GLfixed *params)
|
||||
glPointParameterxv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
|
||||
glReadPixels
|
||||
dir pixels out
|
||||
len pixels glesv1_enc::pixelDataSize(self, width, height, format, type, 1)
|
||||
|
||||
#void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, GLvoid *pointer)
|
||||
glTexCoordPointer
|
||||
len pointer (sizeof(unsigned int))
|
||||
flag unsupported
|
||||
|
||||
#void glTexEnviv(GLenum target, GLenum pname, GLint *params)
|
||||
glTexEnviv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
|
||||
glTexEnvxv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid *pixels)
|
||||
glTexImage2D
|
||||
dir pixels in
|
||||
len pixels glesv1_enc::pixelDataSize(self, width, height, format, type, 0)
|
||||
var_flag pixels nullAllowed isLarge
|
||||
|
||||
#void glTexParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
glTexParameteriv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
|
||||
glTexParameterxv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
|
||||
glTexSubImage2D
|
||||
len pixels glesv1_enc::pixelDataSize(self, width, height, format, type, 0)
|
||||
var_flag pixels nullAllowed isLarge
|
||||
|
||||
#void glVertexPointer(GLint size, GLenum type, GLsizei stride, GLvoid *pointer)
|
||||
# we treat the pointer as an offset to a VBO
|
||||
glVertexPointer
|
||||
flag unsupported
|
||||
|
||||
#void glPointSizePointerOES(GLenum type, GLsizei stride, GLvoid *pointer)
|
||||
glPointSizePointerOES
|
||||
len pointer (sizeof(unsigned int))
|
||||
flag unsupported
|
||||
|
||||
#void glGetClipPlanef(GLenum pname, GLfloat * eqn)
|
||||
glGetClipPlanef
|
||||
dir eqn out
|
||||
len eqn (4 * sizeof(GLfloat))
|
||||
|
||||
#void glVertexPointerData(GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
glVertexPointerData
|
||||
len data datalen
|
||||
custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen)
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
#void glColorPointerData(GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
glColorPointerData
|
||||
len data datalen
|
||||
flag custom_decoder
|
||||
custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen)
|
||||
flag not_api
|
||||
|
||||
#void glNormalPointerData(GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
glNormalPointerData
|
||||
len data datalen
|
||||
flag custom_decoder
|
||||
custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, 3, type, stride, datalen)
|
||||
flag not_api
|
||||
|
||||
#void glPointSizePointerData(GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
glPointSizePointerData
|
||||
len data datalen
|
||||
flag custom_decoder
|
||||
custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, 1, type, stride, datalen)
|
||||
flag not_api
|
||||
|
||||
#void glTexCoordPointerData(GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
|
||||
glTexCoordPointerData
|
||||
len data datalen
|
||||
flag custom_decoder
|
||||
custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen)
|
||||
flag not_api
|
||||
|
||||
#void glWeightPointerData(GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
glWeightPointerData
|
||||
len data datalen
|
||||
custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen)
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
#void glMatrixIndexPointerData(GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
glMatrixIndexPointerData
|
||||
len data datalen
|
||||
custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen)
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
glVertexPointerOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
glNormalPointerOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
glTexCoordPointerOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
glPointSizePointerOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
glColorPointerOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
glWeightPointerOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
glMatrixIndexPointerOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
glDrawElementsData
|
||||
len data datalen
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
glDrawElementsOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
glGetCompressedTextureFormats
|
||||
dir formats out
|
||||
len formats (count * sizeof(GLint))
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
glFinishRoundTrip
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
#gles1 extensions
|
||||
|
||||
#void glDrawTexsvOES(GLshort *coords)
|
||||
glDrawTexsvOES
|
||||
len coords (5 * sizeof(GLshort))
|
||||
|
||||
#void glDrawTexivOES(GLint *coords)
|
||||
glDrawTexivOES
|
||||
len coords (5 * sizeof(GLint))
|
||||
|
||||
#void glDrawTexxvOES(GLfixed *coords)
|
||||
glDrawTexxvOES
|
||||
len coords (5 * sizeof(GLfixed))
|
||||
|
||||
#void glDrawTexfvOES(GLfloat *coords)
|
||||
glDrawTexfvOES
|
||||
len coords (5 * sizeof(GLfloat))
|
||||
|
||||
#glClipPlanexOES(GLenum plane, const GLfixed * equation)
|
||||
glClipPlanexOES
|
||||
dir equation in
|
||||
len equation (4 * sizeof(GLfixed))
|
||||
|
||||
#glClipPlanexIMG(GLenum plane, const GLfixed * equation)
|
||||
glClipPlanexIMG
|
||||
dir equation in
|
||||
len equation (4 * sizeof(GLfixed))
|
||||
|
||||
#void glFogxvOES(GLenum pname, GLfixed *params)
|
||||
glFogxvOES
|
||||
dir params in
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetClipPlanexOES(GLenum pname, GLfixed * eqn)
|
||||
glGetClipPlanexOES
|
||||
dir eqn out
|
||||
len eqn (4 * sizeof(GLfixed))
|
||||
|
||||
#void glGetClipPlanex(GLenum pname, GLfixed * eqn)
|
||||
glGetClipPlanex
|
||||
dir eqn out
|
||||
len eqn (4 * sizeof(GLfixed))
|
||||
|
||||
#void glGetFixedvOES(GLenum pname, GLfixed *params)
|
||||
glGetFixedvOES
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetLightxvOES(GLenum light, GLenum pname, GLfixed *params)
|
||||
glGetLightxvOES
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed *params)
|
||||
glGetMaterialxvOES
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed *params)
|
||||
glGetTexEnvxvOES
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params)
|
||||
glGetTexParameterxvOES
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glLightModelxvOES(GLenum pname, GLfixed *params)
|
||||
glLightModelxvOES
|
||||
dir params in
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glLightxvOES(GLenum light, GLenum pname, GLfixed *params)
|
||||
glLightxvOES
|
||||
dir params in
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glLoadMatrixxOES(GLfixed *m)
|
||||
glLoadMatrixxOES
|
||||
dir m in
|
||||
len m (16 * sizeof(GLfixed))
|
||||
|
||||
#void glMaterialxvOES(GLenum face, GLenum pname, GLfixed *params)
|
||||
glMaterialxvOES
|
||||
dir params in
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glMultMatrixxOES(GLfixed *m)
|
||||
glMultMatrixxOES
|
||||
dir m in
|
||||
len m (16 * sizeof(GLfixed))
|
||||
|
||||
#void glPointParameterxvOES(GLenum pname, GLfixed *params)
|
||||
glPointParameterxvOES
|
||||
dir params in
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glTexEnvxvOES(GLenum target, GLenum pname, GLfixed *params)
|
||||
glTexEnvxvOES
|
||||
dir params in
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params)
|
||||
glTexParameterxvOES
|
||||
dir params in
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glDeleteRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
|
||||
glDeleteRenderbuffersOES
|
||||
dir renderbuffers in
|
||||
len renderbuffers (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGenRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
|
||||
glGenRenderbuffersOES
|
||||
dir renderbuffers out
|
||||
len renderbuffers (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint *params)
|
||||
glGetRenderbufferParameterivOES
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glDeleteFramebuffersOES(GLsizei n, GLuint *framebuffers)
|
||||
glDeleteFramebuffersOES
|
||||
dir framebuffers in
|
||||
len framebuffers (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGenFramebuffersOES(GLsizei n, GLuint *framebuffers)
|
||||
glGenFramebuffersOES
|
||||
dir framebuffers out
|
||||
len framebuffers (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint *params)
|
||||
glGetFramebufferAttachmentParameterivOES
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void* glMapBufferOES(GLenum target, GLenum access)
|
||||
glMapBufferOES
|
||||
flag unsupported
|
||||
|
||||
#void glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid ** params)
|
||||
glGetBufferPointervOES
|
||||
flag unsupported
|
||||
|
||||
#void glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, GLvoid *pointer)
|
||||
glMatrixIndexPointerOES
|
||||
len pointer (sizeof(unsigned int))
|
||||
flag unsupported
|
||||
|
||||
#void glWeightPointerOES(GLint size, GLenum type, GLsizei stride, GLvoid *pointer)
|
||||
glWeightPointerOES
|
||||
len pointer (sizeof(unsigned int))
|
||||
flag unsupported
|
||||
|
||||
#glQueryMatrixxOES(GLfixed * mantissa, GLint * exponent)
|
||||
glQueryMatrixxOES
|
||||
dir mantissa out
|
||||
len mantissa (16 * sizeof(GLfixed))
|
||||
dir exponent out
|
||||
len exponent (16 * sizeof(GLfixed))
|
||||
|
||||
#void glClipPlanefOES(GLenum plane, GLfloat *equation)
|
||||
glClipPlanefOES
|
||||
dir equation in
|
||||
len equation (4 * sizeof(GLfloat))
|
||||
|
||||
#void glClipPlanefIMG(GLenum plane, GLfloat *equation)
|
||||
glClipPlanefIMG
|
||||
dir equation in
|
||||
len equation (4 * sizeof(GLfloat))
|
||||
|
||||
#void glGetClipPlanefOES(GLenum pname, GLfloat * eqn)
|
||||
glGetClipPlanefOES
|
||||
dir eqn out
|
||||
len eqn (4 * sizeof(GLfloat))
|
||||
|
||||
#void glTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params)
|
||||
glTexGenfvOES
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glTexGenivOES(GLenum coord, GLenum pname, GLint *params)
|
||||
glTexGenivOES
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
|
||||
glTexGenxvOES
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params)
|
||||
glGetTexGenfvOES
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
|
||||
glGetTexGenivOES
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
|
||||
glGetTexGenxvOES
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfixed))
|
||||
|
||||
#void glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
|
||||
glDeleteVertexArraysOES
|
||||
dir arrays in
|
||||
len arrays (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGenVertexArraysOES(GLsizei n, GLuint *arrays)
|
||||
glGenVertexArraysOES
|
||||
dir arrays out
|
||||
len arrays (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
|
||||
glDiscardFramebufferEXT
|
||||
dir attachments in
|
||||
len attachments (numAttachments * sizeof(const GLenum))
|
||||
|
||||
#void glMultiDrawArraysEXT(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)
|
||||
glMultiDrawArraysEXT
|
||||
flag unsupported
|
||||
|
||||
#void glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount)
|
||||
glMultiDrawElementsEXT
|
||||
flag unsupported
|
||||
|
||||
#void glMultiDrawArraysSUN(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount)
|
||||
glMultiDrawArraysSUN
|
||||
flag unsupported
|
||||
|
||||
#void glMultiDrawElementsSUN(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount)
|
||||
glMultiDrawElementsSUN
|
||||
flag unsupported
|
||||
|
||||
#void glDeleteFencesNV(GLsizei n, const GLuint *fences)
|
||||
glDeleteFencesNV
|
||||
dir fences in
|
||||
len fences (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGenFencesNV(GLsizei n, GLuint *fences)
|
||||
glGenFencesNV
|
||||
dir fences in
|
||||
len fences (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
|
||||
glGetFenceivNV
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls)
|
||||
glGetDriverControlsQCOM
|
||||
dir num out
|
||||
len num (1 * sizeof(GLint))
|
||||
dir driverControls out
|
||||
len driverControls (size * sizeof(GLuint))
|
||||
|
||||
#void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString)
|
||||
glGetDriverControlStringQCOM
|
||||
dir length out
|
||||
len length (1 * sizeof(GLsizei))
|
||||
dir driverControlString out
|
||||
len driverControlString (1 * sizeof(GLchar))
|
||||
|
||||
#void glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures)
|
||||
glExtGetTexturesQCOM
|
||||
dir textures out
|
||||
len textures (maxTextures * sizeof(GLuint))
|
||||
dir numTextures out
|
||||
len numTextures (1 * sizeof(GLint))
|
||||
|
||||
#void glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers)
|
||||
glExtGetBuffersQCOM
|
||||
dir buffers out
|
||||
len buffers (maxBuffers * sizeof(GLuint))
|
||||
dir numBuffers out
|
||||
len numBuffers (1 * sizeof(GLint))
|
||||
|
||||
#void glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers)
|
||||
glExtGetRenderbuffersQCOM
|
||||
dir renderbuffers out
|
||||
len renderbuffers (maxRenderbuffers * sizeof(GLuint))
|
||||
dir numRenderbuffers out
|
||||
len numRenderbuffers (1 * sizeof(GLint))
|
||||
|
||||
#void glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers)
|
||||
glExtGetFramebuffersQCOM
|
||||
dir framebuffers out
|
||||
len framebuffers (maxFramebuffers * sizeof(GLuint))
|
||||
dir numFramebuffers out
|
||||
len numFramebuffers (1 * sizeof(GLint))
|
||||
|
||||
#void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params)
|
||||
glExtGetTexLevelParameterivQCOM
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels)
|
||||
glExtGetTexSubImageQCOM
|
||||
dir texels out
|
||||
len texels (depth * glesv1_enc::pixelDataSize(self, width, height, format, type, 0))
|
||||
|
||||
#void glExtGetBufferPointervQCOM(GLenum target, GLvoid **params)
|
||||
glExtGetBufferPointervQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders)
|
||||
glExtGetShadersQCOM
|
||||
dir shaders out
|
||||
len shaders (maxShaders * sizeof(GLuint))
|
||||
dir numShaders out
|
||||
len numShaders (1 * sizeof(GLint))
|
||||
|
||||
#void glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms)
|
||||
glExtGetProgramsQCOM
|
||||
dir programs out
|
||||
len programs (maxPrograms * sizeof(GLuint))
|
||||
dir numPrograms out
|
||||
len numPrograms (1 * sizeof(GLint))
|
||||
|
||||
#void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length)
|
||||
glExtGetProgramBinarySourceQCOM
|
||||
flag unsupported
|
||||
298
external/android-emugl/host/libs/GLESv1_dec/gles1.in
vendored
Normal file
298
external/android-emugl/host/libs/GLESv1_dec/gles1.in
vendored
Normal file
|
|
@ -0,0 +1,298 @@
|
|||
GL_ENTRY(void, glAlphaFunc, GLenum func, GLclampf ref)
|
||||
GL_ENTRY(void, glClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
|
||||
GL_ENTRY(void, glClearDepthf, GLclampf depth)
|
||||
GL_ENTRY(void, glClipPlanef, GLenum plane, const GLfloat *equation)
|
||||
GL_ENTRY(void, glColor4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
|
||||
GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar)
|
||||
GL_ENTRY(void, glFogf, GLenum pname, GLfloat param)
|
||||
GL_ENTRY(void, glFogfv, GLenum pname, const GLfloat *params)
|
||||
GL_ENTRY(void, glFrustumf, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
|
||||
GL_ENTRY(void, glGetClipPlanef, GLenum pname, GLfloat* eqn)
|
||||
GL_ENTRY(void, glGetFloatv, GLenum pname, GLfloat *params)
|
||||
GL_ENTRY(void, glGetLightfv, GLenum light, GLenum pname, GLfloat *params)
|
||||
GL_ENTRY(void, glGetMaterialfv, GLenum face, GLenum pname, GLfloat *params)
|
||||
GL_ENTRY(void, glGetTexEnvfv, GLenum env, GLenum pname, GLfloat *params)
|
||||
GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat *params)
|
||||
GL_ENTRY(void, glLightModelf, GLenum pname, GLfloat param)
|
||||
GL_ENTRY(void, glLightModelfv, GLenum pname, const GLfloat *params)
|
||||
GL_ENTRY(void, glLightf, GLenum light, GLenum pname, GLfloat param)
|
||||
GL_ENTRY(void, glLightfv, GLenum light, GLenum pname, const GLfloat *params)
|
||||
GL_ENTRY(void, glLineWidth, GLfloat width)
|
||||
GL_ENTRY(void, glLoadMatrixf, const GLfloat *m)
|
||||
GL_ENTRY(void, glMaterialf, GLenum face, GLenum pname, GLfloat param)
|
||||
GL_ENTRY(void, glMaterialfv, GLenum face, GLenum pname, const GLfloat *params)
|
||||
GL_ENTRY(void, glMultMatrixf, const GLfloat *m)
|
||||
GL_ENTRY(void, glMultiTexCoord4f, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
|
||||
GL_ENTRY(void, glNormal3f, GLfloat nx, GLfloat ny, GLfloat nz)
|
||||
GL_ENTRY(void, glOrthof, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
|
||||
GL_ENTRY(void, glPointParameterf, GLenum pname, GLfloat param)
|
||||
GL_ENTRY(void, glPointParameterfv, GLenum pname, const GLfloat *params)
|
||||
GL_ENTRY(void, glPointSize, GLfloat size)
|
||||
GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units)
|
||||
GL_ENTRY(void, glRotatef, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
|
||||
GL_ENTRY(void, glScalef, GLfloat x, GLfloat y, GLfloat z)
|
||||
GL_ENTRY(void, glTexEnvf, GLenum target, GLenum pname, GLfloat param)
|
||||
GL_ENTRY(void, glTexEnvfv, GLenum target, GLenum pname, const GLfloat *params)
|
||||
GL_ENTRY(void, glTexParameterf, GLenum target, GLenum pname, GLfloat param)
|
||||
GL_ENTRY(void, glTexParameterfv, GLenum target, GLenum pname, const GLfloat *params)
|
||||
GL_ENTRY(void, glTranslatef, GLfloat x, GLfloat y, GLfloat z)
|
||||
GL_ENTRY(void, glActiveTexture, GLenum texture)
|
||||
GL_ENTRY(void, glAlphaFuncx, GLenum func, GLclampx ref)
|
||||
GL_ENTRY(void, glBindBuffer, GLenum target, GLuint buffer)
|
||||
GL_ENTRY(void, glBindTexture, GLenum target, GLuint texture)
|
||||
GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor)
|
||||
GL_ENTRY(void, glBufferData, GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
|
||||
GL_ENTRY(void, glBufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
|
||||
GL_ENTRY(void, glClear, GLbitfield mask)
|
||||
GL_ENTRY(void, glClearColorx, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
|
||||
GL_ENTRY(void, glClearDepthx, GLclampx depth)
|
||||
GL_ENTRY(void, glClearStencil, GLint s)
|
||||
GL_ENTRY(void, glClientActiveTexture, GLenum texture)
|
||||
GL_ENTRY(void, glColor4ub, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
|
||||
GL_ENTRY(void, glColor4x, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
|
||||
GL_ENTRY(void, glColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
|
||||
GL_ENTRY(void, glColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
GL_ENTRY(void, glCompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
|
||||
GL_ENTRY(void, glCompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
|
||||
GL_ENTRY(void, glCopyTexImage2D, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
|
||||
GL_ENTRY(void, glCopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glCullFace, GLenum mode)
|
||||
GL_ENTRY(void, glDeleteBuffers, GLsizei n, const GLuint *buffers)
|
||||
GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint *textures)
|
||||
GL_ENTRY(void, glDepthFunc, GLenum func)
|
||||
GL_ENTRY(void, glDepthMask, GLboolean flag)
|
||||
GL_ENTRY(void, glDepthRangex, GLclampx zNear, GLclampx zFar)
|
||||
GL_ENTRY(void, glDisable, GLenum cap)
|
||||
GL_ENTRY(void, glDisableClientState, GLenum array)
|
||||
GL_ENTRY(void, glDrawArrays, GLenum mode, GLint first, GLsizei count)
|
||||
GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
|
||||
GL_ENTRY(void, glEnable, GLenum cap)
|
||||
GL_ENTRY(void, glEnableClientState, GLenum array)
|
||||
GL_ENTRY(void, glFinish, void)
|
||||
GL_ENTRY(void, glFlush, void)
|
||||
GL_ENTRY(void, glFogx, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glFogxv, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glFrontFace, GLenum mode)
|
||||
GL_ENTRY(void, glFrustumx, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
|
||||
GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean *params)
|
||||
GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint *params)
|
||||
GL_ENTRY(void, glClipPlanex, GLenum pname, const GLfixed * eqn)
|
||||
GL_ENTRY(void, glGenBuffers, GLsizei n, GLuint *buffers)
|
||||
GL_ENTRY(void, glGenTextures, GLsizei n, GLuint *textures)
|
||||
GL_ENTRY(GLenum, glGetError, void)
|
||||
GL_ENTRY(void, glGetFixedv, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glGetIntegerv, GLenum pname, GLint *params)
|
||||
GL_ENTRY(void, glGetLightxv, GLenum light, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glGetMaterialxv, GLenum face, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glGetPointerv, GLenum pname, GLvoid **params)
|
||||
GL_ENTRY(const GLubyte *, glGetString, GLenum name)
|
||||
GL_ENTRY(void, glGetTexEnviv, GLenum env, GLenum pname, GLint *params)
|
||||
GL_ENTRY(void, glGetTexEnvxv, GLenum env, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint *params)
|
||||
GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glHint, GLenum target, GLenum mode)
|
||||
GL_ENTRY(GLboolean, glIsBuffer, GLuint buffer)
|
||||
GL_ENTRY(GLboolean, glIsEnabled, GLenum cap)
|
||||
GL_ENTRY(GLboolean, glIsTexture, GLuint texture)
|
||||
GL_ENTRY(void, glLightModelx, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glLightModelxv, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glLightx, GLenum light, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glLightxv, GLenum light, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glLineWidthx, GLfixed width)
|
||||
GL_ENTRY(void, glLoadIdentity, void)
|
||||
GL_ENTRY(void, glLoadMatrixx, const GLfixed *m)
|
||||
GL_ENTRY(void, glLogicOp, GLenum opcode)
|
||||
GL_ENTRY(void, glMaterialx, GLenum face, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glMaterialxv, GLenum face, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glMatrixMode, GLenum mode)
|
||||
GL_ENTRY(void, glMultMatrixx, const GLfixed *m)
|
||||
GL_ENTRY(void, glMultiTexCoord4x, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
|
||||
GL_ENTRY(void, glNormal3x, GLfixed nx, GLfixed ny, GLfixed nz)
|
||||
GL_ENTRY(void, glNormalPointer, GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
GL_ENTRY(void, glOrthox, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
|
||||
GL_ENTRY(void, glPixelStorei, GLenum pname, GLint param)
|
||||
GL_ENTRY(void, glPointParameterx, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glPointParameterxv, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glPointSizex, GLfixed size)
|
||||
GL_ENTRY(void, glPolygonOffsetx, GLfixed factor, GLfixed units)
|
||||
GL_ENTRY(void, glPopMatrix, void)
|
||||
GL_ENTRY(void, glPushMatrix, void)
|
||||
GL_ENTRY(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
|
||||
GL_ENTRY(void, glRotatex, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
|
||||
GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert)
|
||||
GL_ENTRY(void, glSampleCoveragex, GLclampx value, GLboolean invert)
|
||||
GL_ENTRY(void, glScalex, GLfixed x, GLfixed y, GLfixed z)
|
||||
GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glShadeModel, GLenum mode)
|
||||
GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask)
|
||||
GL_ENTRY(void, glStencilMask, GLuint mask)
|
||||
GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass)
|
||||
GL_ENTRY(void, glTexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
GL_ENTRY(void, glTexEnvi, GLenum target, GLenum pname, GLint param)
|
||||
GL_ENTRY(void, glTexEnvx, GLenum target, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glTexEnviv, GLenum target, GLenum pname, const GLint *params)
|
||||
GL_ENTRY(void, glTexEnvxv, GLenum target, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glTexImage2D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
|
||||
GL_ENTRY(void, glTexParameteri, GLenum target, GLenum pname, GLint param)
|
||||
GL_ENTRY(void, glTexParameterx, GLenum target, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glTexParameteriv, GLenum target, GLenum pname, const GLint *params)
|
||||
GL_ENTRY(void, glTexParameterxv, GLenum target, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
|
||||
GL_ENTRY(void, glTranslatex, GLfixed x, GLfixed y, GLfixed z)
|
||||
GL_ENTRY(void, glVertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
GL_ENTRY(void, glViewport, GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
|
||||
GL_ENTRY(void, glVertexPointerOffset, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glColorPointerOffset, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glNormalPointerOffset, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glPointSizePointerOffset, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glTexCoordPointerOffset, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glWeightPointerOffset, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glMatrixIndexPointerOffset, GLint size, GLenum type, GLsizei stride, GLuint offset)
|
||||
|
||||
GL_ENTRY(void, glVertexPointerData, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glColorPointerData, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glNormalPointerData, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glTexCoordPointerData, GLint unit, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glPointSizePointerData, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glWeightPointerData, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glMatrixIndexPointerData, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
|
||||
|
||||
GL_ENTRY(void, glDrawElementsOffset, GLenum mode, GLsizei count, GLenum type, GLuint offset)
|
||||
GL_ENTRY(void, glDrawElementsData, GLenum mode, GLsizei count, GLenum type, void *data, GLuint datalen)
|
||||
GL_ENTRY(void, glGetCompressedTextureFormats, int count, GLint *formats);
|
||||
|
||||
GL_ENTRY(int, glFinishRoundTrip, void)
|
||||
|
||||
#opengl extensions
|
||||
|
||||
GL_ENTRY(void, glBlendEquationSeparateOES, GLenum modeRGB, GLenum modeAlpha)
|
||||
GL_ENTRY(void, glBlendFuncSeparateOES, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
|
||||
GL_ENTRY(void, glBlendEquationOES, GLenum mode)
|
||||
GL_ENTRY(void, glDrawTexsOES, GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
|
||||
GL_ENTRY(void, glDrawTexiOES, GLint x, GLint y, GLint z, GLint width, GLint height)
|
||||
GL_ENTRY(void, glDrawTexxOES, GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
|
||||
GL_ENTRY(void, glDrawTexsvOES, const GLshort *coords)
|
||||
GL_ENTRY(void, glDrawTexivOES, const GLint *coords)
|
||||
GL_ENTRY(void, glDrawTexxvOES, const GLfixed *coords)
|
||||
GL_ENTRY(void, glDrawTexfOES, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
|
||||
GL_ENTRY(void, glDrawTexfvOES, const GLfloat *coords)
|
||||
GL_ENTRY(void, glEGLImageTargetTexture2DOES, GLenum target, GLeglImageOES image)
|
||||
GL_ENTRY(void, glEGLImageTargetRenderbufferStorageOES, GLenum target, GLeglImageOES image)
|
||||
GL_ENTRY(void, glAlphaFuncxOES, GLenum func, GLclampx ref)
|
||||
GL_ENTRY(void, glClearColorxOES, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
|
||||
GL_ENTRY(void, glClearDepthxOES, GLclampx depth)
|
||||
GL_ENTRY(void, glClipPlanexOES, GLenum plane, const GLfixed * equation)
|
||||
GL_ENTRY(void, glClipPlanexIMG, GLenum plane, const GLfixed * equation)
|
||||
GL_ENTRY(void, glColor4xOES, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
|
||||
GL_ENTRY(void, glDepthRangexOES, GLclampx zNear, GLclampx zFar)
|
||||
GL_ENTRY(void, glFogxOES, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glFogxvOES, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glFrustumxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
|
||||
GL_ENTRY(void, glGetClipPlanexOES, GLenum pname, GLfixed* eqn)
|
||||
GL_ENTRY(void, glGetClipPlanex, GLenum pname, GLfixed* eqn)
|
||||
GL_ENTRY(void, glGetFixedvOES, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glGetLightxvOES, GLenum light, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glGetMaterialxvOES, GLenum face, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glGetTexEnvxvOES, GLenum env, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glLightModelxOES, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glLightModelxvOES, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glLightxOES, GLenum light, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glLightxvOES, GLenum light, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glLineWidthxOES, GLfixed width)
|
||||
GL_ENTRY(void, glLoadMatrixxOES, const GLfixed *m)
|
||||
GL_ENTRY(void, glMaterialxOES, GLenum face, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glMaterialxvOES, GLenum face, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glMultMatrixxOES, const GLfixed *m)
|
||||
GL_ENTRY(void, glMultiTexCoord4xOES, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
|
||||
GL_ENTRY(void, glNormal3xOES, GLfixed nx, GLfixed ny, GLfixed nz)
|
||||
GL_ENTRY(void, glOrthoxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
|
||||
GL_ENTRY(void, glPointParameterxOES, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glPointParameterxvOES, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glPointSizexOES, GLfixed size)
|
||||
GL_ENTRY(void, glPolygonOffsetxOES, GLfixed factor, GLfixed units)
|
||||
GL_ENTRY(void, glRotatexOES, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
|
||||
GL_ENTRY(void, glSampleCoveragexOES, GLclampx value, GLboolean invert)
|
||||
GL_ENTRY(void, glScalexOES, GLfixed x, GLfixed y, GLfixed z)
|
||||
GL_ENTRY(void, glTexEnvxOES, GLenum target, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glTexEnvxvOES, GLenum target, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glTexParameterxOES, GLenum target, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glTexParameterxvOES, GLenum target, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glTranslatexOES, GLfixed x, GLfixed y, GLfixed z)
|
||||
GL_ENTRY(GLboolean, glIsRenderbufferOES, GLuint renderbuffer)
|
||||
GL_ENTRY(void, glBindRenderbufferOES, GLenum target, GLuint renderbuffer)
|
||||
GL_ENTRY(void, glDeleteRenderbuffersOES, GLsizei n, const GLuint* renderbuffers)
|
||||
GL_ENTRY(void, glGenRenderbuffersOES, GLsizei n, GLuint* renderbuffers)
|
||||
GL_ENTRY(void, glRenderbufferStorageOES, GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glGetRenderbufferParameterivOES, GLenum target, GLenum pname, GLint* params)
|
||||
GL_ENTRY(GLboolean, glIsFramebufferOES, GLuint framebuffer)
|
||||
GL_ENTRY(void, glBindFramebufferOES, GLenum target, GLuint framebuffer)
|
||||
GL_ENTRY(void, glDeleteFramebuffersOES, GLsizei n, const GLuint* framebuffers)
|
||||
GL_ENTRY(void, glGenFramebuffersOES, GLsizei n, GLuint* framebuffers)
|
||||
GL_ENTRY(GLenum, glCheckFramebufferStatusOES, GLenum target)
|
||||
GL_ENTRY(void, glFramebufferRenderbufferOES, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
|
||||
GL_ENTRY(void, glFramebufferTexture2DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
||||
GL_ENTRY(void, glGetFramebufferAttachmentParameterivOES, GLenum target, GLenum attachment, GLenum pname, GLint* params)
|
||||
GL_ENTRY(void, glGenerateMipmapOES, GLenum target)
|
||||
GL_ENTRY(void*, glMapBufferOES, GLenum target, GLenum access)
|
||||
GL_ENTRY(GLboolean, glUnmapBufferOES, GLenum target)
|
||||
GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid* *params)
|
||||
GL_ENTRY(void, glCurrentPaletteMatrixOES, GLuint matrixpaletteindex)
|
||||
GL_ENTRY(void, glLoadPaletteFromModelViewMatrixOES, void)
|
||||
GL_ENTRY(void, glMatrixIndexPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
|
||||
GL_ENTRY(void, glWeightPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
|
||||
GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed * mantissa, GLint * exponent)
|
||||
GL_ENTRY(void, glDepthRangefOES, GLclampf zNear, GLclampf zFar)
|
||||
GL_ENTRY(void, glFrustumfOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
|
||||
GL_ENTRY(void, glOrthofOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
|
||||
GL_ENTRY(void, glClipPlanefOES, GLenum plane, const GLfloat *equation)
|
||||
GL_ENTRY(void, glClipPlanefIMG, GLenum plane, const GLfloat *equation)
|
||||
GL_ENTRY(void, glGetClipPlanefOES, GLenum pname, GLfloat * eqn)
|
||||
GL_ENTRY(void, glClearDepthfOES, GLclampf depth)
|
||||
GL_ENTRY(void, glTexGenfOES, GLenum coord, GLenum pname, GLfloat param)
|
||||
GL_ENTRY(void, glTexGenfvOES, GLenum coord, GLenum pname, const GLfloat *params)
|
||||
GL_ENTRY(void, glTexGeniOES, GLenum coord, GLenum pname, GLint param)
|
||||
GL_ENTRY(void, glTexGenivOES, GLenum coord, GLenum pname, const GLint *params)
|
||||
GL_ENTRY(void, glTexGenxOES, GLenum coord, GLenum pname, GLfixed param)
|
||||
GL_ENTRY(void, glTexGenxvOES, GLenum coord, GLenum pname, const GLfixed *params)
|
||||
GL_ENTRY(void, glGetTexGenfvOES, GLenum coord, GLenum pname, GLfloat *params)
|
||||
GL_ENTRY(void, glGetTexGenivOES, GLenum coord, GLenum pname, GLint *params)
|
||||
GL_ENTRY(void, glGetTexGenxvOES, GLenum coord, GLenum pname, GLfixed *params)
|
||||
GL_ENTRY(void, glBindVertexArrayOES, GLuint array)
|
||||
GL_ENTRY(void, glDeleteVertexArraysOES, GLsizei n, const GLuint *arrays)
|
||||
GL_ENTRY(void, glGenVertexArraysOES, GLsizei n, GLuint *arrays)
|
||||
GL_ENTRY(GLboolean, glIsVertexArrayOES, GLuint array)
|
||||
GL_ENTRY(void, glDiscardFramebufferEXT, GLenum target, GLsizei numAttachments, const GLenum *attachments)
|
||||
GL_ENTRY(void, glMultiDrawArraysEXT, GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)
|
||||
GL_ENTRY(void, glMultiDrawElementsEXT, GLenum mode, const GLsizei *count, GLenum type, const GLvoid*const *indices, GLsizei primcount)
|
||||
GL_ENTRY(void, glMultiDrawArraysSUN, GLenum mode, GLint *first, GLsizei *count, GLsizei primcount)
|
||||
GL_ENTRY(void, glMultiDrawElementsSUN, GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)
|
||||
GL_ENTRY(void, glRenderbufferStorageMultisampleIMG, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glFramebufferTexture2DMultisampleIMG, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
|
||||
GL_ENTRY(void, glDeleteFencesNV, GLsizei n, const GLuint *fences)
|
||||
GL_ENTRY(void, glGenFencesNV, GLsizei n, GLuint *fences)
|
||||
GL_ENTRY(GLboolean, glIsFenceNV, GLuint fence)
|
||||
GL_ENTRY(GLboolean, glTestFenceNV, GLuint fence)
|
||||
GL_ENTRY(void, glGetFenceivNV, GLuint fence, GLenum pname, GLint *params)
|
||||
GL_ENTRY(void, glFinishFenceNV, GLuint fence)
|
||||
GL_ENTRY(void, glSetFenceNV, GLuint fence, GLenum condition)
|
||||
GL_ENTRY(void, glGetDriverControlsQCOM, GLint *num, GLsizei size, GLuint *driverControls)
|
||||
GL_ENTRY(void, glGetDriverControlStringQCOM, GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString)
|
||||
GL_ENTRY(void, glEnableDriverControlQCOM, GLuint driverControl)
|
||||
GL_ENTRY(void, glDisableDriverControlQCOM, GLuint driverControl)
|
||||
GL_ENTRY(void, glExtGetTexturesQCOM, GLuint *textures, GLint maxTextures, GLint *numTextures)
|
||||
GL_ENTRY(void, glExtGetBuffersQCOM, GLuint *buffers, GLint maxBuffers, GLint *numBuffers)
|
||||
GL_ENTRY(void, glExtGetRenderbuffersQCOM, GLuint * renderbuffers, GLint maxRenderbuffers, GLint * numRenderbuffers)
|
||||
GL_ENTRY(void, glExtGetFramebuffersQCOM, GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers)
|
||||
GL_ENTRY(void, glExtGetTexLevelParameterivQCOM, GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params)
|
||||
GL_ENTRY(void, glExtTexObjectStateOverrideiQCOM, GLenum target, GLenum pname, GLint param)
|
||||
GL_ENTRY(void, glExtGetTexSubImageQCOM, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels)
|
||||
GL_ENTRY(void, glExtGetBufferPointervQCOM, GLenum target, GLvoid* *params)
|
||||
GL_ENTRY(void, glExtGetShadersQCOM, GLuint *shaders, GLint maxShaders, GLint *numShaders)
|
||||
GL_ENTRY(void, glExtGetProgramsQCOM, GLuint *programs, GLint maxPrograms, GLint *numPrograms)
|
||||
GL_ENTRY(GLboolean, glExtIsProgramBinaryQCOM, GLuint program)
|
||||
GL_ENTRY(void, glExtGetProgramBinarySourceQCOM, GLuint program, GLenum shadertype, GLchar *source, GLint *length)
|
||||
GL_ENTRY(void, glStartTilingQCOM, GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
|
||||
GL_ENTRY(void, glEndTilingQCOM, GLbitfield preserveMask)
|
||||
34
external/android-emugl/host/libs/GLESv1_dec/gles1.types
vendored
Normal file
34
external/android-emugl/host/libs/GLESv1_dec/gles1.types
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
GLbitfield 32 0x%08x
|
||||
GLboolean 8 %d
|
||||
GLclampf 32 %f
|
||||
GLclampx 32 0x%08x
|
||||
GLeglImageOES 32 %p
|
||||
GLenum 32 0x%08x
|
||||
GLfixed 32 0x%08x
|
||||
GLfloat 32 %f
|
||||
GLint 32 %d
|
||||
GLintptr 32 %p
|
||||
GLshort 16 %d
|
||||
GLsizei 32 %d
|
||||
GLsizeiptr 32 %p
|
||||
GLubyte 8 0x%02x
|
||||
GLuint 32 %u
|
||||
GLvoid 0 %x
|
||||
GLchar 8 %d
|
||||
GLenum* 32 0x%08x
|
||||
GLboolean* 32 0x%08x
|
||||
GLclampf* 32 0x%08x
|
||||
GLclampx* 32 0x%08x
|
||||
GLeglImageOES* 32 0x%08x
|
||||
GLfixed* 32 0x%08x
|
||||
GLfloat* 32 0x%08x
|
||||
GLint* 32 0x%08x
|
||||
GLshort* 32 0x%08x
|
||||
GLsizei* 32 0x%08x
|
||||
GLubyte* 32 0x%08x
|
||||
GLuint* 32 0x%08x
|
||||
GLvoid* 32 0x%08x
|
||||
GLchar* 32 0x%08x
|
||||
GLvoid** 32 0x%08x
|
||||
void* 32 0x%08x
|
||||
GLvoid*const* 32 0x%08x
|
||||
21
external/android-emugl/host/libs/GLESv1_dec/gles1_types.h
vendored
Normal file
21
external/android-emugl/host/libs/GLESv1_dec/gles1_types.h
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef __GLES1_TYPES__H
|
||||
#define __GLES1_TYPES__H
|
||||
|
||||
#include "gl_base_types.h"
|
||||
|
||||
#endif // __GLES1_TYPES__H
|
||||
15
external/android-emugl/host/libs/GLESv2_dec/Android.mk
vendored
Normal file
15
external/android-emugl/host/libs/GLESv2_dec/Android.mk
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
### host library ##########################################
|
||||
$(call emugl-begin-host-static-library,libGLESv2_dec)
|
||||
$(call emugl-import, libOpenglCodecCommon)
|
||||
$(call emugl-gen-decoder,$(LOCAL_PATH),gles2)
|
||||
|
||||
# For gl2_types.h !
|
||||
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
|
||||
|
||||
$(call emugl-export,CFLAGS,$(EMUGL_USER_CFLAGS))
|
||||
|
||||
LOCAL_SRC_FILES := GLESv2Decoder.cpp
|
||||
|
||||
$(call emugl-end-module)
|
||||
18
external/android-emugl/host/libs/GLESv2_dec/CMakeLists.txt
vendored
Normal file
18
external/android-emugl/host/libs/GLESv2_dec/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
set(GENERATED_SOURCES
|
||||
gles2_dec.cpp
|
||||
gles2_opcodes.h
|
||||
gles2_server_context.cpp)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${GENERATED_SOURCES}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen
|
||||
-D ${CMAKE_CURRENT_BINARY_DIR} gles2
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS emugen)
|
||||
|
||||
set(SOURCES
|
||||
GLESv2Decoder.cpp)
|
||||
|
||||
add_library(GLESv2_dec ${SOURCES} ${GENERATED_SOURCES})
|
||||
target_link_libraries(GLESv2_dec OpenglCodecCommon)
|
||||
129
external/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.cpp
vendored
Normal file
129
external/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.cpp
vendored
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Copyright 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.
|
||||
*/
|
||||
|
||||
#include "GLESv2Decoder.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
|
||||
static inline void* SafePointerFromUInt(GLuint value) {
|
||||
return (void*)(uintptr_t)value;
|
||||
}
|
||||
|
||||
GLESv2Decoder::GLESv2Decoder()
|
||||
{
|
||||
m_contextData = NULL;
|
||||
m_GL2library = NULL;
|
||||
}
|
||||
|
||||
GLESv2Decoder::~GLESv2Decoder()
|
||||
{
|
||||
delete m_GL2library;
|
||||
}
|
||||
|
||||
void *GLESv2Decoder::s_getProc(const char *name, void *userData)
|
||||
{
|
||||
GLESv2Decoder *ctx = (GLESv2Decoder *) userData;
|
||||
|
||||
if (ctx == NULL || ctx->m_GL2library == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *func = NULL;
|
||||
#ifdef USE_EGL_GETPROCADDRESS
|
||||
func = (void *) eglGetProcAddress(name);
|
||||
#endif
|
||||
if (func == NULL) {
|
||||
func = (void *) ctx->m_GL2library->findSymbol(name);
|
||||
}
|
||||
return func;
|
||||
}
|
||||
|
||||
int GLESv2Decoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
|
||||
{
|
||||
this->initDispatchByName(getProcFunc, getProcFuncData);
|
||||
|
||||
glGetCompressedTextureFormats = s_glGetCompressedTextureFormats;
|
||||
glVertexAttribPointerData = s_glVertexAttribPointerData;
|
||||
glVertexAttribPointerOffset = s_glVertexAttribPointerOffset;
|
||||
|
||||
glDrawElementsOffset = s_glDrawElementsOffset;
|
||||
glDrawElementsData = s_glDrawElementsData;
|
||||
glShaderString = s_glShaderString;
|
||||
glFinishRoundTrip = s_glFinishRoundTrip;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int GLESv2Decoder::s_glFinishRoundTrip(void *self)
|
||||
{
|
||||
GLESv2Decoder *ctx = (GLESv2Decoder *)self;
|
||||
ctx->glFinish();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GLESv2Decoder::s_glGetCompressedTextureFormats(void *self, int count, GLint *formats)
|
||||
{
|
||||
GLESv2Decoder *ctx = (GLESv2Decoder *) self;
|
||||
|
||||
int nFormats;
|
||||
ctx->glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &nFormats);
|
||||
if (nFormats > count) {
|
||||
fprintf(stderr, "%s: GetCompressedTextureFormats: The requested number of formats does not match the number that is reported by OpenGL\n", __FUNCTION__);
|
||||
} else {
|
||||
ctx->glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
|
||||
}
|
||||
}
|
||||
|
||||
void GLESv2Decoder::s_glVertexAttribPointerData(void *self, GLuint indx, GLint size, GLenum type,
|
||||
GLboolean normalized, GLsizei stride, void * data, GLuint datalen)
|
||||
{
|
||||
GLESv2Decoder *ctx = (GLESv2Decoder *) self;
|
||||
if (ctx->m_contextData != NULL) {
|
||||
ctx->m_contextData->storePointerData(indx, data, datalen);
|
||||
// note - the stride of the data is always zero when it comes out of the codec.
|
||||
// See gl2.attrib for the packing function call.
|
||||
ctx->glVertexAttribPointer(indx, size, type, normalized, 0, ctx->m_contextData->pointerData(indx));
|
||||
}
|
||||
}
|
||||
|
||||
void GLESv2Decoder::s_glVertexAttribPointerOffset(void *self, GLuint indx, GLint size, GLenum type,
|
||||
GLboolean normalized, GLsizei stride, GLuint data)
|
||||
{
|
||||
GLESv2Decoder *ctx = (GLESv2Decoder *) self;
|
||||
ctx->glVertexAttribPointer(indx, size, type, normalized, stride, SafePointerFromUInt(data));
|
||||
}
|
||||
|
||||
|
||||
void GLESv2Decoder::s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen)
|
||||
{
|
||||
GLESv2Decoder *ctx = (GLESv2Decoder *)self;
|
||||
ctx->glDrawElements(mode, count, type, data);
|
||||
}
|
||||
|
||||
|
||||
void GLESv2Decoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset)
|
||||
{
|
||||
GLESv2Decoder *ctx = (GLESv2Decoder *)self;
|
||||
ctx->glDrawElements(mode, count, type, SafePointerFromUInt(offset));
|
||||
}
|
||||
|
||||
void GLESv2Decoder::s_glShaderString(void *self, GLuint shader, const GLchar* string, GLsizei len)
|
||||
{
|
||||
GLESv2Decoder *ctx = (GLESv2Decoder *)self;
|
||||
ctx->glShaderSource(shader, 1, &string, NULL);
|
||||
}
|
||||
48
external/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.h
vendored
Normal file
48
external/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.h
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 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.
|
||||
*/
|
||||
|
||||
#ifndef _GL2_DECODER_H_
|
||||
#define _GL2_DECODER_H_
|
||||
|
||||
#include "gles2_dec.h"
|
||||
#include "GLDecoderContextData.h"
|
||||
#include "emugl/common/shared_library.h"
|
||||
|
||||
class GLESv2Decoder : public gles2_decoder_context_t
|
||||
{
|
||||
public:
|
||||
typedef void *(*get_proc_func_t)(const char *name, void *userData);
|
||||
GLESv2Decoder();
|
||||
~GLESv2Decoder();
|
||||
int initGL(get_proc_func_t getProcFunc, void *getProcFuncData);
|
||||
void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
|
||||
private:
|
||||
GLDecoderContextData *m_contextData;
|
||||
emugl::SharedLibrary* m_GL2library;
|
||||
|
||||
static void *s_getProc(const char *name, void *userData);
|
||||
static void gles2_APIENTRY s_glGetCompressedTextureFormats(void *self, int count, GLint *formats);
|
||||
static void gles2_APIENTRY s_glVertexAttribPointerData(void *self, GLuint indx, GLint size, GLenum type,
|
||||
GLboolean normalized, GLsizei stride, void * data, GLuint datalen);
|
||||
static void gles2_APIENTRY s_glVertexAttribPointerOffset(void *self, GLuint indx, GLint size, GLenum type,
|
||||
GLboolean normalized, GLsizei stride, GLuint offset);
|
||||
|
||||
static void gles2_APIENTRY s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset);
|
||||
static void gles2_APIENTRY s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen);
|
||||
static void gles2_APIENTRY s_glShaderString(void *self, GLuint shader, const GLchar* string, GLsizei len);
|
||||
static int gles2_APIENTRY s_glFinishRoundTrip(void *self);
|
||||
};
|
||||
#endif
|
||||
595
external/android-emugl/host/libs/GLESv2_dec/gles2.attrib
vendored
Normal file
595
external/android-emugl/host/libs/GLESv2_dec/gles2.attrib
vendored
Normal file
|
|
@ -0,0 +1,595 @@
|
|||
GLOBAL
|
||||
base_opcode 2048
|
||||
encoder_headers <string.h> "glUtils.h" "GLESv2EncoderUtils.h"
|
||||
|
||||
#void glBindAttribLocation(GLuint program, GLuint index, GLchar *name)
|
||||
glBindAttribLocation
|
||||
len name (strlen(name) + 1)
|
||||
|
||||
#void glBufferData(GLenum target, GLsizeiptr size, GLvoid *data, GLenum usage)
|
||||
glBufferData
|
||||
len data size
|
||||
var_flag data nullAllowed isLarge
|
||||
|
||||
#void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)
|
||||
glBufferSubData
|
||||
len data size
|
||||
var_flag data nullAllowed isLarge
|
||||
|
||||
#void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLvoid *data)
|
||||
glCompressedTexImage2D
|
||||
len data imageSize
|
||||
var_flag data nullAllowed isLarge
|
||||
|
||||
#void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLvoid *data)
|
||||
glCompressedTexSubImage2D
|
||||
len data imageSize
|
||||
var_flag data nullAllowed isLarge
|
||||
|
||||
#void glDeleteBuffers(GLsizei n, GLuint *buffers)
|
||||
glDeleteBuffers
|
||||
len buffers (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glDeleteFramebuffers(GLsizei n, GLuint *framebuffers)
|
||||
glDeleteFramebuffers
|
||||
len framebuffers (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glDeleteRenderbuffers(GLsizei n, GLuint *renderbuffers)
|
||||
glDeleteRenderbuffers
|
||||
len renderbuffers (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glDeleteTextures(GLsizei n, GLuint *textures)
|
||||
glDeleteTextures
|
||||
len textures (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glDrawElements(GLenum mode, GLsizei count, GLenum type, GLvoid *indices)
|
||||
glDrawElements
|
||||
flag unsupported
|
||||
|
||||
#void glGenBuffers(GLsizei n, GLuint *buffers)
|
||||
glGenBuffers
|
||||
len buffers (n * sizeof(GLuint))
|
||||
dir buffers out
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGenFramebuffers(GLsizei n, GLuint *framebuffers)
|
||||
glGenFramebuffers
|
||||
len framebuffers (n * sizeof(GLuint))
|
||||
dir framebuffers out
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
|
||||
glGenRenderbuffers
|
||||
len renderbuffers (n * sizeof(GLuint))
|
||||
dir renderbuffers out
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGenTextures(GLsizei n, GLuint *textures)
|
||||
glGenTextures
|
||||
len textures (n * sizeof(GLuint))
|
||||
dir textures out
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
|
||||
glGetActiveAttrib
|
||||
len name bufsize
|
||||
dir name out
|
||||
var_flag name nullAllowed
|
||||
dir length out
|
||||
len length (sizeof(GLsizei))
|
||||
var_flag length nullAllowed
|
||||
dir size out
|
||||
len size (sizeof(GLint))
|
||||
var_flag size nullAllowed
|
||||
dir type out
|
||||
len type (sizeof(GLenum))
|
||||
var_flag type nullAllowed
|
||||
|
||||
#void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
|
||||
glGetActiveUniform
|
||||
len name bufsize
|
||||
dir name out
|
||||
var_flag name nullAllowed
|
||||
dir length out
|
||||
len length (sizeof(GLsizei))
|
||||
var_flag length nullAllowed
|
||||
dir size out
|
||||
len size (sizeof(GLint))
|
||||
var_flag size nullAllowed
|
||||
dir type out
|
||||
len type (sizeof(GLenum))
|
||||
var_flag type nullAllowed
|
||||
|
||||
|
||||
#void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders)
|
||||
glGetAttachedShaders
|
||||
len shaders (maxcount*sizeof(GLuint))
|
||||
dir shaders out
|
||||
dir count out
|
||||
var_flag count nullAllowed
|
||||
len count (sizeof(GLsizei))
|
||||
|
||||
#int glGetAttribLocation(GLuint program, GLchar *name)
|
||||
glGetAttribLocation
|
||||
len name (strlen(name) + 1)
|
||||
|
||||
#void glGetBooleanv(GLenum pname, GLboolean *params)
|
||||
glGetBooleanv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLboolean))
|
||||
|
||||
#void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
glGetBufferParameteriv
|
||||
len params (sizeof(GLint))
|
||||
dir params out
|
||||
|
||||
#void glGetFloatv(GLenum pname, GLfloat *params)
|
||||
glGetFloatv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
|
||||
glGetFramebufferAttachmentParameteriv
|
||||
dir params out
|
||||
len params (sizeof(GLint))
|
||||
|
||||
#void glGetIntegerv(GLenum pname, GLint *params)
|
||||
glGetIntegerv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glGetProgramiv(GLuint program, GLenum pname, GLint *params)
|
||||
glGetProgramiv
|
||||
dir params out
|
||||
len params sizeof(GLint)
|
||||
#XXX - might change if extension constants that return more then one value
|
||||
|
||||
|
||||
#void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog)
|
||||
glGetProgramInfoLog
|
||||
dir infolog out
|
||||
len infolog bufsize
|
||||
dir length out
|
||||
len length sizeof(GLsizei)
|
||||
var_flag length nullAllowed
|
||||
|
||||
#void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
glGetRenderbufferParameteriv
|
||||
dir params out
|
||||
len params sizeof(GLint)
|
||||
# XXX - might change if pname with value larger then one is added
|
||||
|
||||
#void glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
|
||||
glGetShaderiv
|
||||
dir params out
|
||||
len params sizeof(GLint)
|
||||
# XXX - might change if pname with value larger then one is added
|
||||
|
||||
#void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog)
|
||||
glGetShaderInfoLog
|
||||
dir length out
|
||||
len length (sizeof(GLsizei))
|
||||
var_flag length nullAllowed
|
||||
dir infolog out
|
||||
len infolog bufsize
|
||||
|
||||
|
||||
#void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
|
||||
glGetShaderPrecisionFormat
|
||||
dir range out
|
||||
len range (2 * sizeof(GLint))
|
||||
dir precision out
|
||||
len precision (sizeof(GLint))
|
||||
|
||||
#void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source)
|
||||
glGetShaderSource
|
||||
dir length out
|
||||
len length (sizeof(GLsizei))
|
||||
var_flag length nullAllowed
|
||||
dir source out
|
||||
len source bufsize
|
||||
|
||||
#GLubyte* glGetString(GLenum name)
|
||||
glGetString
|
||||
flag unsupported
|
||||
|
||||
#void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
glGetTexParameterfv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
glGetTexParameteriv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glGetUniformfv(GLuint program, GLint location, GLfloat *params)
|
||||
glGetUniformfv
|
||||
dir params out
|
||||
len params glSizeof(glesv2_enc::uniformType(self, program, location))
|
||||
|
||||
#void glGetUniformiv(GLuint program, GLint location, GLint *params)
|
||||
glGetUniformiv
|
||||
dir params out
|
||||
len params glSizeof(glesv2_enc::uniformType(self, program, location))
|
||||
|
||||
#int glGetUniformLocation(GLuint program, GLchar *name)
|
||||
glGetUniformLocation
|
||||
len name (strlen(name) + 1)
|
||||
|
||||
# client-state shall be handled locally by the encoder in most cases.
|
||||
# however, GL_CURRENT_VERTEX_ATTRIB and potential others are handled by the server side,
|
||||
# thus we still need to implement it.
|
||||
#void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
|
||||
glGetVertexAttribfv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
|
||||
#see glGetVertexAttribfv for comments
|
||||
#void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
|
||||
glGetVertexAttribiv
|
||||
dir params out
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
|
||||
|
||||
#void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
|
||||
glReadPixels
|
||||
dir pixels out
|
||||
len pixels glesv2_enc::pixelDataSize(self, width, height, format, type, 1)
|
||||
|
||||
#void glShaderBinary(GLsizei n, GLuint *shaders, GLenum binaryformat, GLvoid *binary, GLsizei length)
|
||||
glShaderBinary
|
||||
flag unsupported
|
||||
|
||||
#void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid *pixels)
|
||||
glTexImage2D
|
||||
dir pixels in
|
||||
len pixels glesv2_enc::pixelDataSize(self, width, height, format, type, 0)
|
||||
var_flag pixels nullAllowed isLarge
|
||||
|
||||
#void glTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
glTexParameterfv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLfloat))
|
||||
#void glTexParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
glTexParameteriv
|
||||
len params (glUtilsParamSize(pname) * sizeof(GLint))
|
||||
|
||||
#void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
|
||||
glTexSubImage2D
|
||||
len pixels glesv2_enc::pixelDataSize(self, width, height, format, type, 0)
|
||||
var_flag pixels nullAllowed isLarge
|
||||
|
||||
#void glUniform1fv(GLint location, GLsizei count, GLfloat *v)
|
||||
glUniform1fv
|
||||
len v (count * sizeof(GLfloat))
|
||||
|
||||
#void glUniform1iv(GLint location, GLsizei count, GLint *v)
|
||||
glUniform1iv
|
||||
len v (count * sizeof(GLint))
|
||||
|
||||
#void glUniform2fv(GLint location, GLsizei count, GLfloat *v)
|
||||
glUniform2fv
|
||||
len v (count * 2 * sizeof(GLfloat))
|
||||
|
||||
#void glUniform2iv(GLint location, GLsizei count, GLint *v)
|
||||
glUniform2iv
|
||||
len v (count * 2 * sizeof(GLint))
|
||||
|
||||
#void glUniform3fv(GLint location, GLsizei count, GLfloat *v)
|
||||
glUniform3fv
|
||||
len v (count * 3 * sizeof(GLfloat))
|
||||
|
||||
#void glUniform3iv(GLint location, GLsizei count, GLint *v)
|
||||
glUniform3iv
|
||||
len v (3 * count * sizeof(GLint))
|
||||
|
||||
#void glUniform4fv(GLint location, GLsizei count, GLfloat *v)
|
||||
glUniform4fv
|
||||
len v (4 * count * sizeof(GLfloat))
|
||||
|
||||
#void glUniform4iv(GLint location, GLsizei count, GLint *v)
|
||||
glUniform4iv
|
||||
len v (4 * count * sizeof(GLint))
|
||||
|
||||
#void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, GLfloat *value)
|
||||
glUniformMatrix2fv
|
||||
len value (count * 4 * sizeof(GLfloat))
|
||||
|
||||
#void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, GLfloat *value)
|
||||
glUniformMatrix3fv
|
||||
len value (count * 9 * sizeof(GLfloat))
|
||||
|
||||
#void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, GLfloat *value)
|
||||
glUniformMatrix4fv
|
||||
len value (count * 16 * sizeof(GLfloat))
|
||||
|
||||
#void glVertexAttrib1fv(GLuint indx, GLfloat *values)
|
||||
glVertexAttrib1fv
|
||||
len values (sizeof(GLfloat))
|
||||
#void glVertexAttrib2fv(GLuint indx, GLfloat *values)
|
||||
glVertexAttrib2fv
|
||||
len values (2 * sizeof(GLfloat))
|
||||
|
||||
#void glVertexAttrib3fv(GLuint indx, GLfloat *values)
|
||||
glVertexAttrib3fv
|
||||
len values (3 * sizeof(GLfloat))
|
||||
|
||||
#void glVertexAttrib4fv(GLuint indx, GLfloat *values)
|
||||
glVertexAttrib4fv
|
||||
len values (4 * sizeof(GLfloat))
|
||||
|
||||
#void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLvoid *ptr)
|
||||
glVertexAttribPointer
|
||||
flag unsupported
|
||||
|
||||
#void glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
|
||||
glGetProgramBinaryOES
|
||||
flag unsupported
|
||||
|
||||
#void glProgramBinaryOES(GLuint program, GLenum binaryFormat, GLvoid *binary, GLint length)
|
||||
glProgramBinaryOES
|
||||
flag unsupported
|
||||
|
||||
#void* glMapBufferOES(GLenum target, GLenum access)
|
||||
glMapBufferOES
|
||||
flag unsupported
|
||||
|
||||
#void glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid *pixels)
|
||||
glTexImage3DOES
|
||||
len pixels glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0)
|
||||
var_flag pixels nullAllowed isLarge
|
||||
|
||||
#void glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *pixels)
|
||||
glTexSubImage3DOES
|
||||
len pixels glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0)
|
||||
var_flag pixels nullAllowed isLarge
|
||||
|
||||
#void glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLvoid *data)
|
||||
glCompressedTexImage3DOES
|
||||
len data imageSize
|
||||
var_flag data nullAllowed isLarge
|
||||
|
||||
#void glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLvoid *data)
|
||||
glCompressedTexSubImage3DOES
|
||||
len data imageSize
|
||||
var_flag data nullAllowed isLarge
|
||||
|
||||
#void glDeleteVertexArraysOES(GLsizei n, GLuint *arrays)
|
||||
glDeleteVertexArraysOES
|
||||
len arrays (n * sizeof(GLuint))
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
#void glGenVertexArraysOES(GLsizei n, GLuint *arrays)
|
||||
glGenVertexArraysOES
|
||||
len arrays (n * sizeof(GLuint))
|
||||
dir arrays out
|
||||
param_check n if(n<0){ ctx->setError(GL_INVALID_VALUE); return; }
|
||||
|
||||
|
||||
#void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, GLenum *attachments)
|
||||
glDiscardFramebufferEXT
|
||||
len attachments (numAttachments * sizeof(GLenum))
|
||||
|
||||
#void glMultiDrawArraysEXT(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)
|
||||
glMultiDrawArraysEXT
|
||||
flag unsupported
|
||||
#void glMultiDrawElementsEXT(GLenum mode, GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount)
|
||||
glMultiDrawElementsEXT
|
||||
flag unsupported
|
||||
|
||||
|
||||
# handled by encoder
|
||||
#void glShaderSource(GLuint shader, GLsizei count, GLstr *string, const GLint *length)
|
||||
glShaderSource
|
||||
flag unsupported
|
||||
|
||||
|
||||
|
||||
#void glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups)
|
||||
glGetPerfMonitorGroupsAMD
|
||||
flag unsupported
|
||||
|
||||
#void glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters)
|
||||
glGetPerfMonitorCountersAMD
|
||||
flag unsupported
|
||||
|
||||
#void glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString)
|
||||
glGetPerfMonitorGroupStringAMD
|
||||
flag unsupported
|
||||
|
||||
#void glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString)
|
||||
glGetPerfMonitorCounterStringAMD
|
||||
flag unsupported
|
||||
|
||||
#void glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid *data)
|
||||
glGetPerfMonitorCounterInfoAMD
|
||||
flag unsupported
|
||||
|
||||
#void glGenPerfMonitorsAMD(GLsizei n, GLuint *monitors)
|
||||
glGenPerfMonitorsAMD
|
||||
flag unsupported
|
||||
|
||||
#void glDeletePerfMonitorsAMD(GLsizei n, GLuint *monitors)
|
||||
glDeletePerfMonitorsAMD
|
||||
flag unsupported
|
||||
|
||||
#void glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList)
|
||||
glSelectPerfMonitorCountersAMD
|
||||
flag unsupported
|
||||
|
||||
#void glBeginPerfMonitorAMD(GLuint monitor)
|
||||
glBeginPerfMonitorAMD
|
||||
flag unsupported
|
||||
|
||||
#void glEndPerfMonitorAMD(GLuint monitor)
|
||||
glEndPerfMonitorAMD
|
||||
flag unsupported
|
||||
|
||||
#void glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten)
|
||||
glGetPerfMonitorCounterDataAMD
|
||||
flag unsupported
|
||||
|
||||
#void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
|
||||
glRenderbufferStorageMultisampleIMG
|
||||
flag unsupported
|
||||
|
||||
#void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
|
||||
glFramebufferTexture2DMultisampleIMG
|
||||
flag unsupported
|
||||
|
||||
#void glDeleteFencesNV(GLsizei n, GLuint *fences)
|
||||
glDeleteFencesNV
|
||||
flag unsupported
|
||||
|
||||
#void glGenFencesNV(GLsizei n, GLuint *fences)
|
||||
glGenFencesNV
|
||||
flag unsupported
|
||||
|
||||
#GLboolean glIsFenceNV(GLuint fence)
|
||||
glIsFenceNV
|
||||
flag unsupported
|
||||
|
||||
#GLboolean glTestFenceNV(GLuint fence)
|
||||
glTestFenceNV
|
||||
flag unsupported
|
||||
|
||||
#void glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
|
||||
glGetFenceivNV
|
||||
flag unsupported
|
||||
|
||||
#void glFinishFenceNV(GLuint fence)
|
||||
glFinishFenceNV
|
||||
flag unsupported
|
||||
|
||||
#void glSetFenceNV(GLuint fence, GLenum condition)
|
||||
glSetFenceNV
|
||||
flag unsupported
|
||||
|
||||
#void glCoverageMaskNV(GLboolean mask)
|
||||
glCoverageMaskNV
|
||||
flag unsupported
|
||||
|
||||
#void glCoverageOperationNV(GLenum operation)
|
||||
glCoverageOperationNV
|
||||
flag unsupported
|
||||
|
||||
#void glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls)
|
||||
glGetDriverControlsQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString)
|
||||
glGetDriverControlStringQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glEnableDriverControlQCOM(GLuint driverControl)
|
||||
glEnableDriverControlQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glDisableDriverControlQCOM(GLuint driverControl)
|
||||
glDisableDriverControlQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures)
|
||||
glExtGetTexturesQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers)
|
||||
glExtGetBuffersQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers)
|
||||
glExtGetRenderbuffersQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers)
|
||||
glExtGetFramebuffersQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params)
|
||||
glExtGetTexLevelParameterivQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param)
|
||||
glExtTexObjectStateOverrideiQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels)
|
||||
glExtGetTexSubImageQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetBufferPointervQCOM(GLenum target, GLvoidptr *params)
|
||||
glExtGetBufferPointervQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders)
|
||||
glExtGetShadersQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms)
|
||||
glExtGetProgramsQCOM
|
||||
flag unsupported
|
||||
|
||||
#GLboolean glExtIsProgramBinaryQCOM(GLuint program)
|
||||
glExtIsProgramBinaryQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length)
|
||||
glExtGetProgramBinarySourceQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
|
||||
glStartTilingQCOM
|
||||
flag unsupported
|
||||
|
||||
#void glEndTilingQCOM(GLbitfield preserveMask)
|
||||
glEndTilingQCOM
|
||||
flag unsupported
|
||||
|
||||
|
||||
#void glVertexAttribPointerData(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void * data, GLuint datalen)
|
||||
glVertexAttribPointerData
|
||||
len data datalen
|
||||
custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen)
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
glVertexAttribPointerOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
#client-state, handled by the encoder
|
||||
#GL_ENTRY(void, glGetVertexAttribPointerv, GLuint index, GLenum pname, GLvoid** pointer)
|
||||
glGetVertexAttribPointerv
|
||||
flag unsupported
|
||||
|
||||
glDrawElementsData
|
||||
len data datalen
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
glDrawElementsOffset
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
#GL_ENTRY(void, glGetCompressedTextureFormats, int count, GLint *formats)
|
||||
glGetCompressedTextureFormats
|
||||
dir formats out
|
||||
len formats (count * sizeof(GLint))
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
#GL_ENTRY(void, glShaderString, GLuint shader, GLchar *string, GLsizei len)
|
||||
glShaderString
|
||||
len string len
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
glFinishRoundTrip
|
||||
flag custom_decoder
|
||||
flag not_api
|
||||
|
||||
214
external/android-emugl/host/libs/GLESv2_dec/gles2.in
vendored
Normal file
214
external/android-emugl/host/libs/GLESv2_dec/gles2.in
vendored
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
GL_ENTRY(void, glActiveTexture, GLenum texture)
|
||||
GL_ENTRY(void, glAttachShader, GLuint program, GLuint shader)
|
||||
GL_ENTRY(void, glBindAttribLocation, GLuint program, GLuint index, const GLchar* name)
|
||||
GL_ENTRY(void, glBindBuffer, GLenum target, GLuint buffer)
|
||||
GL_ENTRY(void, glBindFramebuffer, GLenum target, GLuint framebuffer)
|
||||
GL_ENTRY(void, glBindRenderbuffer, GLenum target, GLuint renderbuffer)
|
||||
GL_ENTRY(void, glBindTexture, GLenum target, GLuint texture)
|
||||
GL_ENTRY(void, glBlendColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
|
||||
GL_ENTRY(void, glBlendEquation, GLenum mode )
|
||||
GL_ENTRY(void, glBlendEquationSeparate, GLenum modeRGB, GLenum modeAlpha)
|
||||
GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor)
|
||||
GL_ENTRY(void, glBlendFuncSeparate, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
|
||||
GL_ENTRY(void, glBufferData, GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
|
||||
GL_ENTRY(void, glBufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
|
||||
GL_ENTRY(GLenum, glCheckFramebufferStatus, GLenum target)
|
||||
GL_ENTRY(void, glClear, GLbitfield mask)
|
||||
GL_ENTRY(void, glClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
|
||||
GL_ENTRY(void, glClearDepthf, GLclampf depth)
|
||||
GL_ENTRY(void, glClearStencil, GLint s)
|
||||
GL_ENTRY(void, glColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
|
||||
GL_ENTRY(void, glCompileShader, GLuint shader)
|
||||
GL_ENTRY(void, glCompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
|
||||
GL_ENTRY(void, glCompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
|
||||
GL_ENTRY(void, glCopyTexImage2D, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
|
||||
GL_ENTRY(void, glCopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(GLuint, glCreateProgram, void)
|
||||
GL_ENTRY(GLuint, glCreateShader, GLenum type)
|
||||
GL_ENTRY(void, glCullFace, GLenum mode)
|
||||
GL_ENTRY(void, glDeleteBuffers, GLsizei n, const GLuint* buffers)
|
||||
GL_ENTRY(void, glDeleteFramebuffers, GLsizei n, const GLuint* framebuffers)
|
||||
GL_ENTRY(void, glDeleteProgram, GLuint program)
|
||||
GL_ENTRY(void, glDeleteRenderbuffers, GLsizei n, const GLuint* renderbuffers)
|
||||
GL_ENTRY(void, glDeleteShader, GLuint shader)
|
||||
GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint* textures)
|
||||
GL_ENTRY(void, glDepthFunc, GLenum func)
|
||||
GL_ENTRY(void, glDepthMask, GLboolean flag)
|
||||
GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar)
|
||||
GL_ENTRY(void, glDetachShader, GLuint program, GLuint shader)
|
||||
GL_ENTRY(void, glDisable, GLenum cap)
|
||||
GL_ENTRY(void, glDisableVertexAttribArray, GLuint index)
|
||||
GL_ENTRY(void, glDrawArrays, GLenum mode, GLint first, GLsizei count)
|
||||
GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
|
||||
GL_ENTRY(void, glEnable, GLenum cap)
|
||||
GL_ENTRY(void, glEnableVertexAttribArray, GLuint index)
|
||||
GL_ENTRY(void, glFinish, void)
|
||||
GL_ENTRY(void, glFlush, void)
|
||||
GL_ENTRY(void, glFramebufferRenderbuffer, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
|
||||
GL_ENTRY(void, glFramebufferTexture2D, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
||||
GL_ENTRY(void, glFrontFace, GLenum mode)
|
||||
GL_ENTRY(void, glGenBuffers, GLsizei n, GLuint* buffers)
|
||||
GL_ENTRY(void, glGenerateMipmap, GLenum target)
|
||||
GL_ENTRY(void, glGenFramebuffers, GLsizei n, GLuint* framebuffers)
|
||||
GL_ENTRY(void, glGenRenderbuffers, GLsizei n, GLuint* renderbuffers)
|
||||
GL_ENTRY(void, glGenTextures, GLsizei n, GLuint* textures)
|
||||
GL_ENTRY(void, glGetActiveAttrib, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
|
||||
GL_ENTRY(void, glGetActiveUniform, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
|
||||
GL_ENTRY(void, glGetAttachedShaders, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
|
||||
GL_ENTRY(int, glGetAttribLocation, GLuint program, const GLchar* name)
|
||||
GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean* params)
|
||||
GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint* params)
|
||||
GL_ENTRY(GLenum, glGetError, void)
|
||||
GL_ENTRY(void, glGetFloatv, GLenum pname, GLfloat* params)
|
||||
GL_ENTRY(void, glGetFramebufferAttachmentParameteriv, GLenum target, GLenum attachment, GLenum pname, GLint* params)
|
||||
GL_ENTRY(void, glGetIntegerv, GLenum pname, GLint* params)
|
||||
GL_ENTRY(void, glGetProgramiv, GLuint program, GLenum pname, GLint* params)
|
||||
GL_ENTRY(void, glGetProgramInfoLog, GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
|
||||
GL_ENTRY(void, glGetRenderbufferParameteriv, GLenum target, GLenum pname, GLint* params)
|
||||
GL_ENTRY(void, glGetShaderiv, GLuint shader, GLenum pname, GLint* params)
|
||||
GL_ENTRY(void, glGetShaderInfoLog, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
|
||||
GL_ENTRY(void, glGetShaderPrecisionFormat, GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
|
||||
GL_ENTRY(void, glGetShaderSource, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
|
||||
GL_ENTRY(const GLubyte*, glGetString, GLenum name)
|
||||
GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat* params)
|
||||
GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint* params)
|
||||
GL_ENTRY(void, glGetUniformfv, GLuint program, GLint location, GLfloat* params)
|
||||
GL_ENTRY(void, glGetUniformiv, GLuint program, GLint location, GLint* params)
|
||||
GL_ENTRY(int, glGetUniformLocation, GLuint program, const GLchar* name)
|
||||
GL_ENTRY(void, glGetVertexAttribfv, GLuint index, GLenum pname, GLfloat* params)
|
||||
GL_ENTRY(void, glGetVertexAttribiv, GLuint index, GLenum pname, GLint* params)
|
||||
GL_ENTRY(void, glGetVertexAttribPointerv, GLuint index, GLenum pname, GLvoid** pointer)
|
||||
GL_ENTRY(void, glHint, GLenum target, GLenum mode)
|
||||
GL_ENTRY(GLboolean, glIsBuffer, GLuint buffer)
|
||||
GL_ENTRY(GLboolean, glIsEnabled, GLenum cap)
|
||||
GL_ENTRY(GLboolean, glIsFramebuffer, GLuint framebuffer)
|
||||
GL_ENTRY(GLboolean, glIsProgram, GLuint program)
|
||||
GL_ENTRY(GLboolean, glIsRenderbuffer, GLuint renderbuffer)
|
||||
GL_ENTRY(GLboolean, glIsShader, GLuint shader)
|
||||
GL_ENTRY(GLboolean, glIsTexture, GLuint texture)
|
||||
GL_ENTRY(void, glLineWidth, GLfloat width)
|
||||
GL_ENTRY(void, glLinkProgram, GLuint program)
|
||||
GL_ENTRY(void, glPixelStorei, GLenum pname, GLint param)
|
||||
GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units)
|
||||
GL_ENTRY(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
|
||||
GL_ENTRY(void, glReleaseShaderCompiler, void)
|
||||
GL_ENTRY(void, glRenderbufferStorage, GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert)
|
||||
GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glShaderBinary, GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
|
||||
GL_ENTRY(void, glShaderSource, GLuint shader, GLsizei count, const GLchar*const* string, const GLint* length)
|
||||
GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask)
|
||||
GL_ENTRY(void, glStencilFuncSeparate, GLenum face, GLenum func, GLint ref, GLuint mask)
|
||||
GL_ENTRY(void, glStencilMask, GLuint mask)
|
||||
GL_ENTRY(void, glStencilMaskSeparate, GLenum face, GLuint mask)
|
||||
GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass)
|
||||
GL_ENTRY(void, glStencilOpSeparate, GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
|
||||
GL_ENTRY(void, glTexImage2D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
|
||||
GL_ENTRY(void, glTexParameterf, GLenum target, GLenum pname, GLfloat param)
|
||||
GL_ENTRY(void, glTexParameterfv, GLenum target, GLenum pname, const GLfloat* params)
|
||||
GL_ENTRY(void, glTexParameteri, GLenum target, GLenum pname, GLint param)
|
||||
GL_ENTRY(void, glTexParameteriv, GLenum target, GLenum pname, const GLint* params)
|
||||
GL_ENTRY(void, glTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
|
||||
GL_ENTRY(void, glUniform1f, GLint location, GLfloat x)
|
||||
GL_ENTRY(void, glUniform1fv, GLint location, GLsizei count, const GLfloat* v)
|
||||
GL_ENTRY(void, glUniform1i, GLint location, GLint x)
|
||||
GL_ENTRY(void, glUniform1iv, GLint location, GLsizei count, const GLint* v)
|
||||
GL_ENTRY(void, glUniform2f, GLint location, GLfloat x, GLfloat y)
|
||||
GL_ENTRY(void, glUniform2fv, GLint location, GLsizei count, const GLfloat* v)
|
||||
GL_ENTRY(void, glUniform2i, GLint location, GLint x, GLint y)
|
||||
GL_ENTRY(void, glUniform2iv, GLint location, GLsizei count, const GLint* v)
|
||||
GL_ENTRY(void, glUniform3f, GLint location, GLfloat x, GLfloat y, GLfloat z)
|
||||
GL_ENTRY(void, glUniform3fv, GLint location, GLsizei count, const GLfloat* v)
|
||||
GL_ENTRY(void, glUniform3i, GLint location, GLint x, GLint y, GLint z)
|
||||
GL_ENTRY(void, glUniform3iv, GLint location, GLsizei count, const GLint* v)
|
||||
GL_ENTRY(void, glUniform4f, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||
GL_ENTRY(void, glUniform4fv, GLint location, GLsizei count, const GLfloat* v)
|
||||
GL_ENTRY(void, glUniform4i, GLint location, GLint x, GLint y, GLint z, GLint w)
|
||||
GL_ENTRY(void, glUniform4iv, GLint location, GLsizei count, const GLint* v)
|
||||
GL_ENTRY(void, glUniformMatrix2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
|
||||
GL_ENTRY(void, glUniformMatrix3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
|
||||
GL_ENTRY(void, glUniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
|
||||
GL_ENTRY(void, glUseProgram, GLuint program)
|
||||
GL_ENTRY(void, glValidateProgram, GLuint program)
|
||||
GL_ENTRY(void, glVertexAttrib1f, GLuint indx, GLfloat x)
|
||||
GL_ENTRY(void, glVertexAttrib1fv, GLuint indx, const GLfloat* values)
|
||||
GL_ENTRY(void, glVertexAttrib2f, GLuint indx, GLfloat x, GLfloat y)
|
||||
GL_ENTRY(void, glVertexAttrib2fv, GLuint indx, const GLfloat* values)
|
||||
GL_ENTRY(void, glVertexAttrib3f, GLuint indx, GLfloat x, GLfloat y, GLfloat z)
|
||||
GL_ENTRY(void, glVertexAttrib3fv, GLuint indx, const GLfloat* values)
|
||||
GL_ENTRY(void, glVertexAttrib4f, GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||
GL_ENTRY(void, glVertexAttrib4fv, GLuint indx, const GLfloat* values)
|
||||
GL_ENTRY(void, glVertexAttribPointer, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
|
||||
GL_ENTRY(void, glViewport, GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glEGLImageTargetTexture2DOES, GLenum target, GLeglImageOES image)
|
||||
GL_ENTRY(void, glEGLImageTargetRenderbufferStorageOES, GLenum target, GLeglImageOES image)
|
||||
GL_ENTRY(void, glGetProgramBinaryOES, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
|
||||
GL_ENTRY(void, glProgramBinaryOES, GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length)
|
||||
GL_ENTRY(void*, glMapBufferOES, GLenum target, GLenum access)
|
||||
GL_ENTRY(GLboolean, glUnmapBufferOES, GLenum target)
|
||||
#GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid** params)
|
||||
GL_ENTRY(void, glTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
|
||||
GL_ENTRY(void, glTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
|
||||
GL_ENTRY(void, glCopyTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glCompressedTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
|
||||
GL_ENTRY(void, glCompressedTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
|
||||
GL_ENTRY(void, glFramebufferTexture3DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
|
||||
GL_ENTRY(void, glBindVertexArrayOES, GLuint array)
|
||||
GL_ENTRY(void, glDeleteVertexArraysOES, GLsizei n, const GLuint *arrays)
|
||||
GL_ENTRY(void, glGenVertexArraysOES, GLsizei n, GLuint *arrays)
|
||||
GL_ENTRY(GLboolean, glIsVertexArrayOES, GLuint array)
|
||||
GL_ENTRY(void, glDiscardFramebufferEXT, GLenum target, GLsizei numAttachments, const GLenum *attachments)
|
||||
GL_ENTRY(void, glMultiDrawArraysEXT, GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)
|
||||
GL_ENTRY(void, glMultiDrawElementsEXT, GLenum mode, const GLsizei *count, GLenum type, const GLvoid*const* indices, GLsizei primcount)
|
||||
|
||||
#not supported
|
||||
GL_ENTRY(void, glGetPerfMonitorGroupsAMD, GLint *numGroups, GLsizei groupsSize, GLuint *groups)
|
||||
GL_ENTRY(void, glGetPerfMonitorCountersAMD, GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters)
|
||||
GL_ENTRY(void, glGetPerfMonitorGroupStringAMD, GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString)
|
||||
GL_ENTRY(void, glGetPerfMonitorCounterStringAMD, GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString)
|
||||
GL_ENTRY(void, glGetPerfMonitorCounterInfoAMD, GLuint group, GLuint counter, GLenum pname, GLvoid *data)
|
||||
GL_ENTRY(void, glGenPerfMonitorsAMD, GLsizei n, GLuint *monitors)
|
||||
GL_ENTRY(void, glDeletePerfMonitorsAMD, GLsizei n, GLuint *monitors)
|
||||
GL_ENTRY(void, glSelectPerfMonitorCountersAMD, GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList)
|
||||
GL_ENTRY(void, glBeginPerfMonitorAMD, GLuint monitor)
|
||||
GL_ENTRY(void, glEndPerfMonitorAMD, GLuint monitor)
|
||||
GL_ENTRY(void, glGetPerfMonitorCounterDataAMD, GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten)
|
||||
|
||||
GL_ENTRY(void, glRenderbufferStorageMultisampleIMG, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
|
||||
GL_ENTRY(void, glFramebufferTexture2DMultisampleIMG, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
|
||||
GL_ENTRY(void, glDeleteFencesNV, GLsizei n, const GLuint *fences)
|
||||
GL_ENTRY(void, glGenFencesNV, GLsizei n, GLuint *fences)
|
||||
GL_ENTRY(GLboolean, glIsFenceNV, GLuint fence)
|
||||
GL_ENTRY(GLboolean, glTestFenceNV, GLuint fence)
|
||||
GL_ENTRY(void, glGetFenceivNV, GLuint fence, GLenum pname, GLint *params)
|
||||
GL_ENTRY(void, glFinishFenceNV, GLuint fence)
|
||||
GL_ENTRY(void, glSetFenceNV, GLuint fence, GLenum condition)
|
||||
GL_ENTRY(void, glCoverageMaskNV, GLboolean mask)
|
||||
GL_ENTRY(void, glCoverageOperationNV, GLenum operation)
|
||||
GL_ENTRY(void, glGetDriverControlsQCOM, GLint *num, GLsizei size, GLuint *driverControls)
|
||||
GL_ENTRY(void, glGetDriverControlStringQCOM, GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString)
|
||||
GL_ENTRY(void, glEnableDriverControlQCOM, GLuint driverControl)
|
||||
GL_ENTRY(void, glDisableDriverControlQCOM, GLuint driverControl)
|
||||
GL_ENTRY(void, glExtGetTexturesQCOM, GLuint *textures, GLint maxTextures, GLint *numTextures)
|
||||
GL_ENTRY(void, glExtGetBuffersQCOM, GLuint *buffers, GLint maxBuffers, GLint *numBuffers)
|
||||
GL_ENTRY(void, glExtGetRenderbuffersQCOM, GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers)
|
||||
GL_ENTRY(void, glExtGetFramebuffersQCOM, GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers)
|
||||
GL_ENTRY(void, glExtGetTexLevelParameterivQCOM, GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params)
|
||||
GL_ENTRY(void, glExtTexObjectStateOverrideiQCOM, GLenum target, GLenum pname, GLint param)
|
||||
GL_ENTRY(void, glExtGetTexSubImageQCOM, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels)
|
||||
GL_ENTRY(void, glExtGetBufferPointervQCOM, GLenum target, GLvoidptr *params)
|
||||
GL_ENTRY(void, glExtGetShadersQCOM, GLuint *shaders, GLint maxShaders, GLint *numShaders)
|
||||
GL_ENTRY(void, glExtGetProgramsQCOM, GLuint *programs, GLint maxPrograms, GLint *numPrograms)
|
||||
GL_ENTRY(GLboolean, glExtIsProgramBinaryQCOM, GLuint program)
|
||||
GL_ENTRY(void, glExtGetProgramBinarySourceQCOM, GLuint program, GLenum shadertype, GLchar *source, GLint *length)
|
||||
GL_ENTRY(void, glStartTilingQCOM, GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
|
||||
GL_ENTRY(void, glEndTilingQCOM, GLbitfield preserveMask)
|
||||
|
||||
# add-ons
|
||||
GL_ENTRY(void, glVertexAttribPointerData, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void * data, GLuint datalen)
|
||||
GL_ENTRY(void, glVertexAttribPointerOffset, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset)
|
||||
GL_ENTRY(void, glDrawElementsOffset, GLenum mode, GLsizei count, GLenum type, GLuint offset)
|
||||
GL_ENTRY(void, glDrawElementsData, GLenum mode, GLsizei count, GLenum type, void *data, GLuint datalen)
|
||||
GL_ENTRY(void, glGetCompressedTextureFormats, int count, GLint *formats)
|
||||
GL_ENTRY(void, glShaderString, GLuint shader, const GLchar* string, GLsizei len)
|
||||
GL_ENTRY(int, glFinishRoundTrip, void)
|
||||
38
external/android-emugl/host/libs/GLESv2_dec/gles2.types
vendored
Normal file
38
external/android-emugl/host/libs/GLESv2_dec/gles2.types
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
GLbitfield 32 0x%08x
|
||||
GLboolean 8 %d
|
||||
GLclampf 32 %f
|
||||
GLclampx 32 0x%08x
|
||||
GLeglImageOES 32 %p
|
||||
GLenum 32 0x%08x
|
||||
GLfixed 32 0x%08x
|
||||
GLfloat 32 %f
|
||||
GLint 32 %d
|
||||
GLintptr 32 %p
|
||||
GLshort 16 %d
|
||||
GLsizei 32 %d
|
||||
GLsizeiptr 32 %p
|
||||
GLubyte 8 0x%02x
|
||||
GLuint 32 %u
|
||||
GLvoid 0 %x
|
||||
GLchar 8 %d
|
||||
GLenum* 32 0x%08x
|
||||
GLboolean* 32 0x%08x
|
||||
GLclampf* 32 0x%08x
|
||||
GLclampx* 32 0x%08x
|
||||
GLeglImageOES* 32 0x%08x
|
||||
GLfixed* 32 0x%08x
|
||||
GLfloat* 32 0x%08x
|
||||
GLint* 32 0x%08x
|
||||
GLshort* 32 0x%08x
|
||||
GLsizei* 32 0x%08x
|
||||
GLubyte* 32 0x%08x
|
||||
GLuint* 32 0x%08x
|
||||
GLvoid* 32 0x%08x
|
||||
GLchar* 32 0x%08x
|
||||
GLchar** 32 0x%08x
|
||||
GLvoid** 32 0x%08x
|
||||
void* 32 0x%08x
|
||||
GLstr* 32 0x%08x
|
||||
GLvoidptr* 32 0x%08x
|
||||
GLchar*const* 32 0x%08x
|
||||
GLvoid*const* 32 0x%08x
|
||||
21
external/android-emugl/host/libs/GLESv2_dec/gles2_types.h
vendored
Normal file
21
external/android-emugl/host/libs/GLESv2_dec/gles2_types.h
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _GL_2_TYPES_H_
|
||||
#define _GL_2_TYPES_H_
|
||||
#include "gl_base_types.h"
|
||||
|
||||
typedef void *GLvoidptr;
|
||||
#endif
|
||||
14
external/android-emugl/host/libs/libOpenGLESDispatch/Android.mk
vendored
Normal file
14
external/android-emugl/host/libs/libOpenGLESDispatch/Android.mk
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
### host library ##########################################
|
||||
$(call emugl-begin-host-static-library,libOpenGLESDispatch)
|
||||
$(call emugl-import,libGLESv2_dec libGLESv1_dec)
|
||||
|
||||
# use Translator's egl headers
|
||||
LOCAL_C_INCLUDES += $(EMUGL_PATH)/host/libs/Translator/include
|
||||
LOCAL_C_INCLUDES += $(EMUGL_PATH)/shared
|
||||
|
||||
LOCAL_SRC_FILES := EGLDispatch.cpp \
|
||||
GLESv2Dispatch.cpp \
|
||||
GLESv1Dispatch.cpp
|
||||
$(call emugl-end-module)
|
||||
10
external/android-emugl/host/libs/libOpenGLESDispatch/CMakeLists.txt
vendored
Normal file
10
external/android-emugl/host/libs/libOpenGLESDispatch/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
set(SOURCES
|
||||
EGLDispatch.cpp
|
||||
GLESv2Dispatch.cpp
|
||||
GLESv1Dispatch.cpp)
|
||||
|
||||
add_library(OpenGLESDispatch ${SOURCES} ${GENERATED_SOURCES})
|
||||
target_link_libraries(OpenGLESDispatch
|
||||
emugl_common
|
||||
GLESv2_dec
|
||||
GLESv1_dec)
|
||||
52
external/android-emugl/host/libs/libOpenGLESDispatch/EGLDispatch.cpp
vendored
Normal file
52
external/android-emugl/host/libs/libOpenGLESDispatch/EGLDispatch.cpp
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include "emugl/common/shared_library.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
EGLDispatch s_egl;
|
||||
|
||||
#define DEFAULT_EGL_LIB EMUGL_LIBNAME("EGL_translator")
|
||||
|
||||
#define RENDER_EGL_LOAD_FIELD(return_type, function_name, signature) \
|
||||
s_egl. function_name = (function_name ## _t) lib->findSymbol(#function_name);
|
||||
|
||||
#define RENDER_EGL_LOAD_OPTIONAL_FIELD(return_type, function_name, signature) \
|
||||
if (s_egl.eglGetProcAddress) s_egl. function_name = \
|
||||
(function_name ## _t) s_egl.eglGetProcAddress(#function_name); \
|
||||
if (!s_egl.function_name || !s_egl.eglGetProcAddress) \
|
||||
RENDER_EGL_LOAD_FIELD(return_type, function_name, signature)
|
||||
|
||||
bool init_egl_dispatch()
|
||||
{
|
||||
|
||||
const char *libName = getenv("ANDROID_EGL_LIB");
|
||||
if (!libName) libName = DEFAULT_EGL_LIB;
|
||||
|
||||
char error[256];
|
||||
emugl::SharedLibrary *lib = emugl::SharedLibrary::open(libName, error, sizeof(error));
|
||||
if (!lib) {
|
||||
printf("Failed to open %s: [%s]\n", libName, error);
|
||||
return NULL;
|
||||
}
|
||||
LIST_RENDER_EGL_FUNCTIONS(RENDER_EGL_LOAD_FIELD)
|
||||
LIST_RENDER_EGL_EXTENSIONS_FUNCTIONS(RENDER_EGL_LOAD_OPTIONAL_FIELD)
|
||||
|
||||
return true;
|
||||
}
|
||||
95
external/android-emugl/host/libs/libOpenGLESDispatch/GLESv1Dispatch.cpp
vendored
Normal file
95
external/android-emugl/host/libs/libOpenGLESDispatch/GLESv1Dispatch.cpp
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "OpenGLESDispatch/GLESv1Dispatch.h"
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "emugl/common/shared_library.h"
|
||||
|
||||
extern EGLDispatch s_egl;
|
||||
|
||||
static emugl::SharedLibrary *s_gles1_lib = NULL;
|
||||
|
||||
// An unimplemented function which prints out an error message.
|
||||
// To make it consistent with the guest, all GLES1 functions not supported by
|
||||
// the driver should be redirected to this function.
|
||||
|
||||
static void gles1_unimplemented() {
|
||||
fprintf(stderr, "Called unimplemented GLESv1 API\n");
|
||||
}
|
||||
|
||||
//
|
||||
// This function is called only once during initialiation before
|
||||
// any thread has been created - hence it should NOT be thread safe.
|
||||
//
|
||||
|
||||
#define DEFAULT_GLES_CM_LIB EMUGL_LIBNAME("GLES_CM_translator")
|
||||
|
||||
bool gles1_dispatch_init(GLESv1Dispatch* dispatch_table) {
|
||||
const char* libName = getenv("ANDROID_GLESv1_LIB");
|
||||
if (!libName) {
|
||||
libName = DEFAULT_GLES_CM_LIB;
|
||||
}
|
||||
|
||||
char error[256];
|
||||
s_gles1_lib = emugl::SharedLibrary::open(libName, error, sizeof(error));
|
||||
if (!s_gles1_lib) {
|
||||
fprintf(stderr, "%s: Could not load %s [%s]\n", __FUNCTION__,
|
||||
libName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// init the GLES dispatch table
|
||||
//
|
||||
#define LOOKUP_SYMBOL(return_type,function_name,signature,callargs) \
|
||||
dispatch_table-> function_name = reinterpret_cast< function_name ## _t >( \
|
||||
s_gles1_lib->findSymbol(#function_name));
|
||||
|
||||
#define LOOKUP_EXT_SYMBOL(return_type,function_name,signature,callargs) \
|
||||
dispatch_table-> function_name = reinterpret_cast< function_name ## _t >( \
|
||||
s_egl.eglGetProcAddress(#function_name));
|
||||
|
||||
LIST_GLES1_FUNCTIONS(LOOKUP_SYMBOL,LOOKUP_EXT_SYMBOL)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// This function is called only during initialization of the decoder before
|
||||
// any thread has been created - hence it should NOT be thread safe.
|
||||
//
|
||||
void *gles1_dispatch_get_proc_func(const char *name, void *userData)
|
||||
{
|
||||
void* func = NULL;
|
||||
if (s_gles1_lib && !func) {
|
||||
func = (void *)s_gles1_lib->findSymbol(name);
|
||||
}
|
||||
|
||||
if (!func) {
|
||||
func = (void *)s_egl.eglGetProcAddress(name);
|
||||
}
|
||||
|
||||
// To make it consistent with the guest, redirect any unsupported functions
|
||||
// to gles1_unimplemented.
|
||||
if (!func) {
|
||||
fprintf(stderr, "ERROR: Failed to find symbol for %s\n", name);
|
||||
func = (void *)gles1_unimplemented;
|
||||
}
|
||||
return func;
|
||||
}
|
||||
95
external/android-emugl/host/libs/libOpenGLESDispatch/GLESv2Dispatch.cpp
vendored
Normal file
95
external/android-emugl/host/libs/libOpenGLESDispatch/GLESv2Dispatch.cpp
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "OpenGLESDispatch/GLESv2Dispatch.h"
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "emugl/common/shared_library.h"
|
||||
|
||||
extern EGLDispatch s_egl;
|
||||
|
||||
static emugl::SharedLibrary *s_gles2_lib = NULL;
|
||||
|
||||
#define DEFAULT_GLES_V2_LIB EMUGL_LIBNAME("GLES_V2_translator")
|
||||
|
||||
// An unimplemented function which prints out an error message.
|
||||
// To make it consistent with the guest, all GLES2 functions not supported by
|
||||
// the driver should be redirected to this function.
|
||||
|
||||
static void gles2_unimplemented() {
|
||||
fprintf(stderr, "Called unimplemented GLESv2 API\n");
|
||||
}
|
||||
|
||||
//
|
||||
// This function is called only once during initialiation before
|
||||
// any thread has been created - hence it should NOT be thread safe.
|
||||
//
|
||||
bool gles2_dispatch_init(GLESv2Dispatch* dispatch_table)
|
||||
{
|
||||
const char *libName = getenv("ANDROID_GLESv2_LIB");
|
||||
if (!libName) {
|
||||
libName = DEFAULT_GLES_V2_LIB;
|
||||
}
|
||||
|
||||
char error[256];
|
||||
s_gles2_lib = emugl::SharedLibrary::open(libName, error, sizeof(error));
|
||||
if (!s_gles2_lib) {
|
||||
fprintf(stderr, "%s: Could not load %s [%s]\n", __FUNCTION__,
|
||||
libName, error);
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// init the GLES dispatch table
|
||||
//
|
||||
#define LOOKUP_SYMBOL(return_type,function_name,signature,callargs) \
|
||||
dispatch_table-> function_name = reinterpret_cast< function_name ## _t >( \
|
||||
s_gles2_lib->findSymbol(#function_name));
|
||||
|
||||
#define LOOKUP_EXT_SYMBOL(return_type,function_name,signature,callargs) \
|
||||
dispatch_table-> function_name = reinterpret_cast< function_name ## _t >( \
|
||||
s_egl.eglGetProcAddress(#function_name));
|
||||
|
||||
LIST_GLES2_FUNCTIONS(LOOKUP_SYMBOL,LOOKUP_EXT_SYMBOL)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// This function is called only during initialization before
|
||||
// any thread has been created - hence it should NOT be thread safe.
|
||||
//
|
||||
void *gles2_dispatch_get_proc_func(const char *name, void *userData)
|
||||
{
|
||||
void* func = NULL;
|
||||
|
||||
if (s_gles2_lib && !func) {
|
||||
func = (void *)s_gles2_lib->findSymbol(name);
|
||||
}
|
||||
|
||||
if (!func) {
|
||||
func = (void *)s_egl.eglGetProcAddress(name);
|
||||
}
|
||||
|
||||
// To make it consistent with the guest, redirect any unsupported functions
|
||||
// to gles2_unimplemented.
|
||||
if (!func) {
|
||||
func = (void *)gles2_unimplemented;
|
||||
}
|
||||
return func;
|
||||
}
|
||||
13
external/android-emugl/host/libs/libOpenGLESDispatch/gles1_extensions.entries
vendored
Normal file
13
external/android-emugl/host/libs/libOpenGLESDispatch/gles1_extensions.entries
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
!gles1_extensions
|
||||
|
||||
# OpenGL functions which are needed ONLY for implementing GLES 1.1 EXTENSIONS
|
||||
void glCurrentPaletteMatrixARB(GLint index);
|
||||
void glMatrixIndexuivARB(GLint size, GLuint * indices);
|
||||
void glMatrixIndexPointerARB(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
|
||||
void glWeightPointerARB(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
|
||||
void glTexGenf(GLenum coord, GLenum pname, GLfloat param );
|
||||
void glTexGeni(GLenum coord, GLenum pname, GLint param );
|
||||
void glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params );
|
||||
void glTexGeniv(GLenum coord, GLenum pname, const GLint *params );
|
||||
void glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params );
|
||||
void glGetTexGeniv(GLenum coord, GLenum pname, GLint *params );
|
||||
65
external/android-emugl/host/libs/libOpenGLESDispatch/gles1_only.entries
vendored
Normal file
65
external/android-emugl/host/libs/libOpenGLESDispatch/gles1_only.entries
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
!gles1_only
|
||||
|
||||
# OpenGL functions which are needed ONLY for implementing GLES 1.1
|
||||
|
||||
void glAlphaFunc(GLenum func, GLclampf ref);
|
||||
void glBegin( GLenum mode );
|
||||
void glClientActiveTexture( GLenum texture );
|
||||
void glClipPlane(GLenum plane, const GLdouble *equation);
|
||||
void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
|
||||
void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
void glColor4fv( const GLfloat *v );
|
||||
void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
|
||||
void glColor4ubv( const GLubyte *v );
|
||||
void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
void glDisableClientState(GLenum array);
|
||||
void glEnableClientState(GLenum array);
|
||||
void glEnd(void);
|
||||
void glFogf(GLenum pname, GLfloat param);
|
||||
void glFogfv(GLenum pname, const GLfloat *params);
|
||||
void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
|
||||
void glGetClipPlane(GLenum plane, GLdouble *equation);
|
||||
void glGetDoublev( GLenum pname, GLdouble *params );
|
||||
void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
|
||||
void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
|
||||
void glGetPointerv(GLenum pname, GLvoid* *params);
|
||||
void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
|
||||
void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
|
||||
void glLightf(GLenum light, GLenum pname, GLfloat param);
|
||||
void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
|
||||
void glLightModelf(GLenum pname, GLfloat param);
|
||||
void glLightModelfv(GLenum pname, const GLfloat *params);
|
||||
void glLoadIdentity(void);
|
||||
void glLoadMatrixf(const GLfloat *m);
|
||||
void glLogicOp(GLenum opcode);
|
||||
void glMaterialf(GLenum face, GLenum pname, GLfloat param);
|
||||
void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
|
||||
void glMultiTexCoord2fv( GLenum target, const GLfloat *v );
|
||||
void glMultiTexCoord2sv( GLenum target, const GLshort *v );
|
||||
void glMultiTexCoord3fv( GLenum target, const GLfloat *v );
|
||||
void glMultiTexCoord3sv( GLenum target, const GLshort *v );
|
||||
void glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
|
||||
void glMultiTexCoord4fv( GLenum target, const GLfloat *v );
|
||||
void glMultiTexCoord4sv( GLenum target, const GLshort *v );
|
||||
void glMultMatrixf(const GLfloat *m);
|
||||
void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
|
||||
void glNormal3fv( const GLfloat *v );
|
||||
void glNormal3sv( const GLshort *v );
|
||||
void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
|
||||
void glPointParameterf(GLenum param, GLfloat value);
|
||||
void glPointParameterfv(GLenum param, const GLfloat *values);
|
||||
void glPointSize(GLfloat size);
|
||||
void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
||||
void glScalef(GLfloat x, GLfloat y, GLfloat z);
|
||||
void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
|
||||
void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
|
||||
void glMatrixMode(GLenum mode);
|
||||
void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
void glPopMatrix(void);
|
||||
void glPushMatrix(void);
|
||||
void glShadeModel(GLenum mode);
|
||||
void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
void glTexEnvi(GLenum target, GLenum pname, GLint param);
|
||||
void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
|
||||
void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
|
||||
void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
6
external/android-emugl/host/libs/libOpenGLESDispatch/gles2_extensions.entries
vendored
Normal file
6
external/android-emugl/host/libs/libOpenGLESDispatch/gles2_extensions.entries
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
!gles2_extensions
|
||||
|
||||
# GLES 2.0 extensions
|
||||
void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
|
||||
void glReleaseShaderCompiler(void);
|
||||
void glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
|
||||
80
external/android-emugl/host/libs/libOpenGLESDispatch/gles2_only.entries
vendored
Normal file
80
external/android-emugl/host/libs/libOpenGLESDispatch/gles2_only.entries
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
!gles2_only
|
||||
|
||||
# OpenGL functions which are needed ONLY for implementing GLES 2.0
|
||||
void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
void glStencilMaskSeparate(GLenum face, GLuint mask);
|
||||
GLboolean glIsProgram(GLuint program);
|
||||
GLboolean glIsShader(GLuint shader);
|
||||
void glVertexAttrib1f(GLuint indx, GLfloat x);
|
||||
void glVertexAttrib1fv(GLuint indx, const GLfloat* values);
|
||||
void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
|
||||
void glVertexAttrib2fv(GLuint indx, const GLfloat* values);
|
||||
void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
|
||||
void glVertexAttrib3fv(GLuint indx, const GLfloat* values);
|
||||
void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
|
||||
void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
|
||||
void glDisableVertexAttribArray(GLuint index);
|
||||
void glEnableVertexAttribArray(GLuint index);
|
||||
void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
|
||||
void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
|
||||
void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
|
||||
void glUniform1f(GLint location, GLfloat x);
|
||||
void glUniform1fv(GLint location, GLsizei count, const GLfloat* v);
|
||||
void glUniform1i(GLint location, GLint x);
|
||||
void glUniform1iv(GLint location, GLsizei count, const GLint* v);
|
||||
void glUniform2f(GLint location, GLfloat x, GLfloat y);
|
||||
void glUniform2fv(GLint location, GLsizei count, const GLfloat* v);
|
||||
void glUniform2i(GLint location, GLint x, GLint y);
|
||||
void glUniform2iv(GLint location, GLsizei count, const GLint* v);
|
||||
void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
|
||||
void glUniform3fv(GLint location, GLsizei count, const GLfloat* v);
|
||||
void glUniform3i(GLint location, GLint x, GLint y, GLint z);
|
||||
void glUniform3iv(GLint location, GLsizei count, const GLint* v);
|
||||
void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void glUniform4fv(GLint location, GLsizei count, const GLfloat* v);
|
||||
void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
|
||||
void glUniform4iv(GLint location, GLsizei count, const GLint* v);
|
||||
void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
void glAttachShader(GLuint program, GLuint shader);
|
||||
void glBindAttribLocation(GLuint program, GLuint index, const GLchar* name);
|
||||
void glCompileShader(GLuint shader);
|
||||
GLuint glCreateProgram(void);
|
||||
GLuint glCreateShader(GLenum type);
|
||||
void glDeleteProgram(GLuint program);
|
||||
void glDeleteShader(GLuint shader);
|
||||
void glDetachShader(GLuint program, GLuint shader);
|
||||
void glLinkProgram(GLuint program);
|
||||
void glUseProgram(GLuint program);
|
||||
void glValidateProgram(GLuint program);
|
||||
void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
|
||||
void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
|
||||
void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
|
||||
int glGetAttribLocation(GLuint program, const GLchar* name);
|
||||
void glGetProgramiv(GLuint program, GLenum pname, GLint* params);
|
||||
void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
|
||||
void glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
|
||||
void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
|
||||
void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
|
||||
void glGetUniformfv(GLuint program, GLint location, GLfloat* params);
|
||||
void glGetUniformiv(GLuint program, GLint location, GLint* params);
|
||||
int glGetUniformLocation(GLuint program, const GLchar* name);
|
||||
void glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
|
||||
|
||||
# The following are not used by GLDispatch but by GLESv2Dispatch
|
||||
void glBindFramebuffer(GLenum target, GLuint framebuffer);
|
||||
void glGenFramebuffers(GLsizei n, GLuint* framebuffers);
|
||||
void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GLenum glCheckFramebufferStatus(GLenum target);
|
||||
void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
|
||||
|
||||
GLboolean glIsRenderbuffer(GLuint renderbuffer);
|
||||
void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
|
||||
void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
|
||||
void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
|
||||
void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
|
||||
void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
18
external/android-emugl/host/libs/libOpenGLESDispatch/gles3_only.entries
vendored
Normal file
18
external/android-emugl/host/libs/libOpenGLESDispatch/gles3_only.entries
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
!gles3_only
|
||||
|
||||
# GLES 3.x functions required by the translator library.
|
||||
# Right now, this is only use to get glGetStringi() from the host GL library
|
||||
# in order to deal with the fact that glGetString(GL_EXTENSIONS) is obsolete
|
||||
# in OpenGL 3.0, and some drivers don't implement it anymore (i.e. the
|
||||
# function just returns NULL).
|
||||
|
||||
%#include <GLES/gl.h>
|
||||
%
|
||||
%// Used to avoid adding GLES3/gl3.h to our headers.
|
||||
%#ifndef GL_NUM_EXTENSIONS
|
||||
%#define GL_NUM_EXTENSIONS 0x821D
|
||||
%#endif
|
||||
|
||||
%typedef const GLubyte* GLconstubyteptr;
|
||||
|
||||
GLconstubyteptr glGetStringi(GLenum name, GLint index);
|
||||
74
external/android-emugl/host/libs/libOpenGLESDispatch/gles_common.entries
vendored
Normal file
74
external/android-emugl/host/libs/libOpenGLESDispatch/gles_common.entries
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
!gles_common
|
||||
|
||||
# Functions common to both GLES 1.x and 2.0
|
||||
|
||||
%#include <GLES/gl.h>
|
||||
%// Return types must be single words, see GLDispatch.cpp
|
||||
%typedef const GLubyte* GLconstubyteptr;
|
||||
|
||||
void glActiveTexture( GLenum texture );
|
||||
void glBindBuffer(GLenum target, GLuint buffer);
|
||||
void glBindTexture(GLenum target, GLuint texture);
|
||||
void glBlendFunc(GLenum sfactor, GLenum dfactor);
|
||||
void glBlendEquation( GLenum mode );
|
||||
void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
|
||||
void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
|
||||
void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
|
||||
void glClear(GLbitfield mask);
|
||||
void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
void glClearDepth(GLclampd depth);
|
||||
void glClearStencil(GLint s);
|
||||
void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
void glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
|
||||
void glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
|
||||
void glCopyTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void glCullFace(GLenum mode);
|
||||
void glDeleteBuffers(GLsizei n, const GLuint *buffers);
|
||||
void glDeleteTextures(GLsizei n, const GLuint *textures);
|
||||
void glDepthFunc(GLenum func);
|
||||
void glDepthMask(GLboolean flag);
|
||||
void glDepthRange(GLclampd zNear, GLclampd zFar);
|
||||
void glDisable(GLenum cap);
|
||||
void glDrawArrays(GLenum mode, GLint first, GLsizei count);
|
||||
void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
void glEnable(GLenum cap);
|
||||
void glFinish(void);
|
||||
void glFlush(void);
|
||||
void glFrontFace(GLenum mode);
|
||||
void glGenBuffers(GLsizei n, GLuint *buffers);
|
||||
void glGenTextures(GLsizei n, GLuint *textures);
|
||||
void glGetBooleanv(GLenum pname, GLboolean *params);
|
||||
void glGetBufferParameteriv(GLenum buffer, GLenum parameter, GLint *value);
|
||||
GLenum glGetError(void);
|
||||
void glGetFloatv(GLenum pname, GLfloat *params);
|
||||
void glGetIntegerv(GLenum pname, GLint *params);
|
||||
GLconstubyteptr glGetString(GLenum name);
|
||||
void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
|
||||
void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
|
||||
void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
|
||||
void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
|
||||
void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
|
||||
void glHint(GLenum target, GLenum mode);
|
||||
GLboolean glIsBuffer(GLuint buffer);
|
||||
GLboolean glIsEnabled(GLenum cap);
|
||||
GLboolean glIsTexture(GLuint texture);
|
||||
void glLineWidth(GLfloat width);
|
||||
void glPolygonOffset(GLfloat factor, GLfloat units);
|
||||
void glPixelStorei(GLenum pname, GLint param);
|
||||
void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
|
||||
void glSampleCoverage( GLclampf value, GLboolean invert );
|
||||
void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void glStencilFunc(GLenum func, GLint ref, GLuint mask);
|
||||
void glStencilMask(GLuint mask);
|
||||
void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
|
||||
void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
void glTexParameteri(GLenum target, GLenum pname, GLint param);
|
||||
void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
|
||||
void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void glPushAttrib( GLbitfield mask );
|
||||
void glPushClientAttrib( GLbitfield mask );
|
||||
void glPopAttrib( void );
|
||||
void glPopClientAttrib( void );
|
||||
24
external/android-emugl/host/libs/libOpenGLESDispatch/gles_extensions.entries
vendored
Normal file
24
external/android-emugl/host/libs/libOpenGLESDispatch/gles_extensions.entries
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
!gles_extensions
|
||||
|
||||
# Common GLES 1.x / 2.0 extension functions
|
||||
GLboolean glIsRenderbufferEXT(GLuint renderbuffer);
|
||||
void glBindRenderbufferEXT(GLenum target, GLuint renderbuffer);
|
||||
void glDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers);
|
||||
void glGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers);
|
||||
void glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
void glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params);
|
||||
GLboolean glIsFramebufferEXT(GLuint framebuffer);
|
||||
void glBindFramebufferEXT(GLenum target, GLuint framebuffer);
|
||||
void glDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers);
|
||||
void glGenFramebuffersEXT(GLsizei n, GLuint *framebuffers);
|
||||
GLenum glCheckFramebufferStatusEXT(GLenum target);
|
||||
void glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
void glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
void glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
void glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
void glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
void glGenerateMipmapEXT(GLenum target);
|
||||
|
||||
# The following extensions are used by GLESv1Dispatch and GLESv2Dispatch, but not by GLDispatch
|
||||
void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
|
||||
void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
|
||||
26
external/android-emugl/host/libs/libOpenGLESDispatch/render_egl.entries
vendored
Normal file
26
external/android-emugl/host/libs/libOpenGLESDispatch/render_egl.entries
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# The list of EGL functions used by libOpenglRender, without extensions.
|
||||
# This is only a subset of the full EGL API.
|
||||
|
||||
!Render_EGL
|
||||
%#include <EGL/egl.h>
|
||||
|
||||
EGLint eglGetError(void);
|
||||
EGLDisplay eglGetDisplay(EGLNativeDisplayType dpy);
|
||||
EGLBoolean eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor);
|
||||
char* eglQueryString(EGLDisplay dpy, EGLint id);
|
||||
EGLBoolean eglGetConfigs(EGLDisplay display, EGLConfig* configs, EGLint config_size, EGLint* num_config);
|
||||
EGLBoolean eglChooseConfig(EGLDisplay display, const EGLint* attribs, EGLConfig* configs, EGLint config_size, EGLint* num_config);
|
||||
EGLBoolean eglGetConfigAttrib(EGLDisplay display, EGLConfig config, EGLint attribute, EGLint* value);
|
||||
EGLSurface eglCreateWindowSurface(EGLDisplay display, EGLConfig config, EGLNativeWindowType native_window, const EGLint* attrib_list);
|
||||
EGLSurface eglCreatePbufferSurface(EGLDisplay display, EGLConfig config, const EGLint* attrib_list);
|
||||
EGLBoolean eglDestroySurface(EGLDisplay display, EGLSurface surface);
|
||||
EGLBoolean eglBindAPI(EGLenum api);
|
||||
EGLenum eglQueryAPI(void);
|
||||
EGLBoolean eglReleaseThread(void);
|
||||
EGLContext eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, const EGLint* attrib_list);
|
||||
EGLBoolean eglDestroyContext(EGLDisplay display, EGLContext context);
|
||||
EGLBoolean eglMakeCurrent(EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context);
|
||||
EGLContext eglGetCurrentContext(void);
|
||||
EGLSurface eglGetCurrentSurface(EGLint readdraw);
|
||||
EGLBoolean eglSwapBuffers(EGLDisplay display, EGLSurface surface);
|
||||
void* eglGetProcAddress(const char* function_name);
|
||||
11
external/android-emugl/host/libs/libOpenGLESDispatch/render_egl_extensions.entries
vendored
Normal file
11
external/android-emugl/host/libs/libOpenGLESDispatch/render_egl_extensions.entries
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# The list of EGL extension functions used by libOpenglRender.
|
||||
# This is only a subset of the full EGL API.
|
||||
|
||||
!Render_EGL_extensions
|
||||
|
||||
%#include <EGL/egl.h>
|
||||
%#define EGL_EGLEXT_PROTOTYPES
|
||||
%#include <EGL/eglext.h>
|
||||
|
||||
EGLImageKHR eglCreateImageKHR(EGLDisplay display, EGLContext context, EGLenum target, EGLClientBuffer buffer, const EGLint* attrib_list);
|
||||
EGLBoolean eglDestroyImageKHR(EGLDisplay display, EGLImageKHR image);
|
||||
70
external/android-emugl/host/libs/libOpenglRender/Android.mk
vendored
Normal file
70
external/android-emugl/host/libs/libOpenglRender/Android.mk
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
host_OS_SRCS :=
|
||||
host_common_LDLIBS :=
|
||||
|
||||
ifeq ($(BUILD_TARGET_OS),linux)
|
||||
host_OS_SRCS = NativeSubWindow_x11.cpp
|
||||
host_common_LDLIBS += -lX11 -lrt
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_TARGET_OS),darwin)
|
||||
host_OS_SRCS = NativeSubWindow_cocoa.m
|
||||
host_common_LDLIBS += -Wl,-framework,AppKit
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_TARGET_OS),windows)
|
||||
host_OS_SRCS = NativeSubWindow_win32.cpp
|
||||
host_common_LDLIBS += -lgdi32
|
||||
endif
|
||||
|
||||
host_common_SRC_FILES := \
|
||||
$(host_OS_SRCS) \
|
||||
ColorBuffer.cpp \
|
||||
FbConfig.cpp \
|
||||
FrameBuffer.cpp \
|
||||
ReadBuffer.cpp \
|
||||
RenderContext.cpp \
|
||||
RenderControl.cpp \
|
||||
RenderServer.cpp \
|
||||
RenderThread.cpp \
|
||||
RenderThreadInfo.cpp \
|
||||
render_api.cpp \
|
||||
RenderWindow.cpp \
|
||||
SocketStream.cpp \
|
||||
TcpStream.cpp \
|
||||
TextureDraw.cpp \
|
||||
TextureResize.cpp \
|
||||
TimeUtils.cpp \
|
||||
WindowSurface.cpp \
|
||||
|
||||
ifeq ($(BUILD_TARGET_OS),windows)
|
||||
host_common_SRC_FILES += Win32PipeStream.cpp
|
||||
host_common_LDLIBS += -lws2_32 -lpsapi
|
||||
else
|
||||
host_common_SRC_FILES += UnixStream.cpp
|
||||
endif
|
||||
|
||||
### host libOpenglRender #################################################
|
||||
$(call emugl-begin-host-shared-library,lib$(BUILD_TARGET_SUFFIX)OpenglRender)
|
||||
|
||||
$(call emugl-import,libGLESv1_dec libGLESv2_dec lib_renderControl_dec libOpenglCodecCommon)
|
||||
|
||||
LOCAL_LDLIBS += $(host_common_LDLIBS)
|
||||
|
||||
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
|
||||
$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/host/include)
|
||||
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
|
||||
|
||||
# use Translator's egl/gles headers
|
||||
LOCAL_C_INCLUDES += $(EMUGL_PATH)/host/libs/Translator/include
|
||||
LOCAL_C_INCLUDES += $(EMUGL_PATH)/host/libs/libOpenGLESDispatch
|
||||
|
||||
LOCAL_STATIC_LIBRARIES += libemugl_common
|
||||
LOCAL_STATIC_LIBRARIES += libOpenGLESDispatch
|
||||
|
||||
LOCAL_SYMBOL_FILE := render_api.entries
|
||||
|
||||
$(call emugl-export,CFLAGS,$(EMUGL_USER_CFLAGS))
|
||||
|
||||
$(call emugl-end-module)
|
||||
37
external/android-emugl/host/libs/libOpenglRender/CMakeLists.txt
vendored
Normal file
37
external/android-emugl/host/libs/libOpenglRender/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
set(SOURCES
|
||||
ColorBuffer.cpp
|
||||
FbConfig.cpp
|
||||
FrameBuffer.cpp
|
||||
NativeSubWindow_mir.cpp
|
||||
ReadBuffer.cpp
|
||||
RenderContext.cpp
|
||||
RenderControl.cpp
|
||||
RenderServer.cpp
|
||||
RenderThread.cpp
|
||||
RenderThreadInfo.cpp
|
||||
render_api.cpp
|
||||
RenderWindow.cpp
|
||||
SocketStream.cpp
|
||||
TcpStream.cpp
|
||||
TextureDraw.cpp
|
||||
TextureResize.cpp
|
||||
TimeUtils.cpp
|
||||
UnixStream.cpp
|
||||
WindowSurface.cpp)
|
||||
|
||||
include_directories(BEFORE
|
||||
${MIRCLIENT_INCLUDE_DIRS})
|
||||
|
||||
add_library(OpenglRender ${SOURCES})
|
||||
target_link_libraries(OpenglRender
|
||||
emugl_common
|
||||
GLESv1_dec
|
||||
GLESv2_dec
|
||||
renderControl_dec
|
||||
OpenGLESDispatch
|
||||
OpenglCodecCommon
|
||||
mir_support
|
||||
${EGL_LDFLAGS}
|
||||
${EGL_LIBRARIES}
|
||||
${MIRCLIENT_LDFLAGS}
|
||||
${MIRCLIENT_LIBRARIES})
|
||||
396
external/android-emugl/host/libs/libOpenglRender/ColorBuffer.cpp
vendored
Normal file
396
external/android-emugl/host/libs/libOpenglRender/ColorBuffer.cpp
vendored
Normal file
|
|
@ -0,0 +1,396 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "ColorBuffer.h"
|
||||
|
||||
#include "DispatchTables.h"
|
||||
#include "RenderThreadInfo.h"
|
||||
#include "TextureDraw.h"
|
||||
#include "TextureResize.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace {
|
||||
|
||||
// <EGL/egl.h> defines many types as 'void*' while they're really
|
||||
// implemented as unsigned integers. These convenience template functions
|
||||
// help casting between them safely without generating compiler warnings.
|
||||
inline void* SafePointerFromUInt(unsigned int handle) {
|
||||
return (void*)(uintptr_t)(handle);
|
||||
}
|
||||
|
||||
inline unsigned int SafeUIntFromPointer(const void* ptr) {
|
||||
#if 1
|
||||
// Ignore the assert below to avoid crashing when running older
|
||||
// system images, which might have buggy encoder libraries. Print
|
||||
// an error message though.
|
||||
if ((uintptr_t)(ptr) != (unsigned int)(uintptr_t)(ptr)) {
|
||||
fprintf(stderr, "EmuGL:WARNING: bad generic pointer %p\n", ptr);
|
||||
}
|
||||
#else
|
||||
// Assertion error if the pointer contains a value that does not fit
|
||||
// in an unsigned integer!
|
||||
assert((uintptr_t)(ptr) == (unsigned int)(uintptr_t)(ptr));
|
||||
#endif
|
||||
return (unsigned int)(uintptr_t)(ptr);
|
||||
}
|
||||
|
||||
// Lazily create and bind a framebuffer object to the current host context.
|
||||
// |fbo| is the address of the framebuffer object name.
|
||||
// |tex| is the name of a texture that is attached to the framebuffer object
|
||||
// on creation only. I.e. all rendering operations will target it.
|
||||
// returns true in case of success, false on failure.
|
||||
bool bindFbo(GLuint* fbo, GLuint tex) {
|
||||
if (*fbo) {
|
||||
// fbo already exist - just bind
|
||||
s_gles2.glBindFramebuffer(GL_FRAMEBUFFER, *fbo);
|
||||
return true;
|
||||
}
|
||||
|
||||
s_gles2.glGenFramebuffers(1, fbo);
|
||||
s_gles2.glBindFramebuffer(GL_FRAMEBUFFER, *fbo);
|
||||
s_gles2.glFramebufferTexture2D(GL_FRAMEBUFFER,
|
||||
GL_COLOR_ATTACHMENT0_OES,
|
||||
GL_TEXTURE_2D, tex, 0);
|
||||
GLenum status = s_gles2.glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_OES) {
|
||||
ERR("ColorBuffer::bindFbo: FBO not complete: %#x\n", status);
|
||||
s_gles2.glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
s_gles2.glDeleteFramebuffers(1, fbo);
|
||||
*fbo = 0;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void unbindFbo() {
|
||||
s_gles2.glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
// Helper class to use a ColorBuffer::Helper context.
|
||||
// Usage is pretty simple:
|
||||
//
|
||||
// {
|
||||
// ScopedHelperContext context(m_helper);
|
||||
// if (!context.isOk()) {
|
||||
// return false; // something bad happened.
|
||||
// }
|
||||
// .... do something ....
|
||||
// } // automatically calls m_helper->teardownContext();
|
||||
//
|
||||
class ScopedHelperContext {
|
||||
public:
|
||||
ScopedHelperContext(ColorBuffer::Helper* helper) : mHelper(helper) {
|
||||
if (!helper->setupContext()) {
|
||||
mHelper = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool isOk() const { return mHelper != NULL; }
|
||||
|
||||
~ScopedHelperContext() {
|
||||
release();
|
||||
}
|
||||
|
||||
void release() {
|
||||
if (mHelper) {
|
||||
mHelper->teardownContext();
|
||||
mHelper = NULL;
|
||||
}
|
||||
}
|
||||
private:
|
||||
ColorBuffer::Helper* mHelper;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
ColorBuffer* ColorBuffer::create(EGLDisplay p_display,
|
||||
int p_width,
|
||||
int p_height,
|
||||
GLenum p_internalFormat,
|
||||
bool has_eglimage_texture_2d,
|
||||
Helper* helper) {
|
||||
GLenum texInternalFormat = 0;
|
||||
|
||||
printf("Creating new color buffer width %i height %i\n", p_width, p_height);
|
||||
|
||||
switch (p_internalFormat) {
|
||||
case GL_RGB:
|
||||
case GL_RGB565_OES:
|
||||
texInternalFormat = GL_RGB;
|
||||
break;
|
||||
|
||||
case GL_RGBA:
|
||||
case GL_RGB5_A1_OES:
|
||||
case GL_RGBA4_OES:
|
||||
texInternalFormat = GL_RGBA;
|
||||
break;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
ScopedHelperContext context(helper);
|
||||
if (!context.isOk()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ColorBuffer *cb = new ColorBuffer(p_display, helper);
|
||||
|
||||
s_gles2.glGenTextures(1, &cb->m_tex);
|
||||
s_gles2.glBindTexture(GL_TEXTURE_2D, cb->m_tex);
|
||||
|
||||
int nComp = (texInternalFormat == GL_RGB ? 3 : 4);
|
||||
|
||||
char* zBuff = static_cast<char*>(::calloc(nComp * p_width * p_height, 1));
|
||||
s_gles2.glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
texInternalFormat,
|
||||
p_width,
|
||||
p_height,
|
||||
0,
|
||||
texInternalFormat,
|
||||
GL_UNSIGNED_BYTE,
|
||||
zBuff);
|
||||
::free(zBuff);
|
||||
|
||||
s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
//
|
||||
// create another texture for that colorbuffer for blit
|
||||
//
|
||||
s_gles2.glGenTextures(1, &cb->m_blitTex);
|
||||
s_gles2.glBindTexture(GL_TEXTURE_2D, cb->m_blitTex);
|
||||
s_gles2.glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
texInternalFormat,
|
||||
p_width,
|
||||
p_height,
|
||||
0,
|
||||
texInternalFormat,
|
||||
GL_UNSIGNED_BYTE,
|
||||
NULL);
|
||||
|
||||
s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
cb->m_width = p_width;
|
||||
cb->m_height = p_height;
|
||||
cb->m_internalFormat = texInternalFormat;
|
||||
|
||||
if (has_eglimage_texture_2d) {
|
||||
cb->m_eglImage = s_egl.eglCreateImageKHR(
|
||||
p_display,
|
||||
s_egl.eglGetCurrentContext(),
|
||||
EGL_GL_TEXTURE_2D_KHR,
|
||||
(EGLClientBuffer)SafePointerFromUInt(cb->m_tex),
|
||||
NULL);
|
||||
|
||||
cb->m_blitEGLImage = s_egl.eglCreateImageKHR(
|
||||
p_display,
|
||||
s_egl.eglGetCurrentContext(),
|
||||
EGL_GL_TEXTURE_2D_KHR,
|
||||
(EGLClientBuffer)SafePointerFromUInt(cb->m_blitTex),
|
||||
NULL);
|
||||
}
|
||||
|
||||
cb->m_resizer = new TextureResize(p_width, p_height);
|
||||
|
||||
return cb;
|
||||
}
|
||||
|
||||
ColorBuffer::ColorBuffer(EGLDisplay display, Helper* helper) :
|
||||
m_tex(0),
|
||||
m_blitTex(0),
|
||||
m_eglImage(NULL),
|
||||
m_blitEGLImage(NULL),
|
||||
m_fbo(0),
|
||||
m_internalFormat(0),
|
||||
m_display(display),
|
||||
m_helper(helper) {}
|
||||
|
||||
ColorBuffer::~ColorBuffer() {
|
||||
ScopedHelperContext context(m_helper);
|
||||
|
||||
if (m_blitEGLImage) {
|
||||
s_egl.eglDestroyImageKHR(m_display, m_blitEGLImage);
|
||||
}
|
||||
if (m_eglImage) {
|
||||
s_egl.eglDestroyImageKHR(m_display, m_eglImage);
|
||||
}
|
||||
|
||||
if (m_fbo) {
|
||||
s_gles2.glDeleteFramebuffers(1, &m_fbo);
|
||||
}
|
||||
|
||||
GLuint tex[2] = {m_tex, m_blitTex};
|
||||
s_gles2.glDeleteTextures(2, tex);
|
||||
|
||||
delete m_resizer;
|
||||
}
|
||||
|
||||
void ColorBuffer::readPixels(int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
GLenum p_format,
|
||||
GLenum p_type,
|
||||
void* pixels) {
|
||||
ScopedHelperContext context(m_helper);
|
||||
if (!context.isOk()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bindFbo(&m_fbo, m_tex)) {
|
||||
s_gles2.glReadPixels(x, y, width, height, p_format, p_type, pixels);
|
||||
unbindFbo();
|
||||
}
|
||||
}
|
||||
|
||||
void ColorBuffer::subUpdate(int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
GLenum p_format,
|
||||
GLenum p_type,
|
||||
void* pixels) {
|
||||
ScopedHelperContext context(m_helper);
|
||||
if (!context.isOk()) {
|
||||
return;
|
||||
}
|
||||
|
||||
s_gles2.glBindTexture(GL_TEXTURE_2D, m_tex);
|
||||
s_gles2.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
s_gles2.glTexSubImage2D(
|
||||
GL_TEXTURE_2D, 0, x, y, width, height, p_format, p_type, pixels);
|
||||
}
|
||||
|
||||
bool ColorBuffer::blitFromCurrentReadBuffer()
|
||||
{
|
||||
RenderThreadInfo *tInfo = RenderThreadInfo::get();
|
||||
if (!tInfo->currContext.Ptr()) {
|
||||
// no Current context
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy the content of the current read surface into m_blitEGLImage.
|
||||
// This is done by creating a temporary texture, bind it to the EGLImage
|
||||
// then call glCopyTexSubImage2D().
|
||||
GLuint tmpTex;
|
||||
GLint currTexBind;
|
||||
if (tInfo->currContext->isGL2()) {
|
||||
s_gles2.glGetIntegerv(GL_TEXTURE_BINDING_2D, &currTexBind);
|
||||
s_gles2.glGenTextures(1,&tmpTex);
|
||||
s_gles2.glBindTexture(GL_TEXTURE_2D, tmpTex);
|
||||
s_gles2.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_blitEGLImage);
|
||||
s_gles2.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0,
|
||||
m_width, m_height);
|
||||
s_gles2.glDeleteTextures(1, &tmpTex);
|
||||
s_gles2.glBindTexture(GL_TEXTURE_2D, currTexBind);
|
||||
}
|
||||
else {
|
||||
s_gles1.glGetIntegerv(GL_TEXTURE_BINDING_2D, &currTexBind);
|
||||
s_gles1.glGenTextures(1,&tmpTex);
|
||||
s_gles1.glBindTexture(GL_TEXTURE_2D, tmpTex);
|
||||
s_gles1.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_blitEGLImage);
|
||||
s_gles1.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0,
|
||||
m_width, m_height);
|
||||
s_gles1.glDeleteTextures(1, &tmpTex);
|
||||
s_gles1.glBindTexture(GL_TEXTURE_2D, currTexBind);
|
||||
}
|
||||
|
||||
ScopedHelperContext context(m_helper);
|
||||
if (!context.isOk()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bindFbo(&m_fbo, m_tex)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save current viewport and match it to the current colorbuffer size.
|
||||
GLint vport[4] = { 0, };
|
||||
s_gles2.glGetIntegerv(GL_VIEWPORT, vport);
|
||||
s_gles2.glViewport(0, 0, m_width, m_height);
|
||||
|
||||
// render m_blitTex
|
||||
m_helper->getTextureDraw()->draw(m_blitTex, 0., 0, 0);
|
||||
|
||||
// Restore previous viewport.
|
||||
s_gles2.glViewport(vport[0], vport[1], vport[2], vport[3]);
|
||||
unbindFbo();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ColorBuffer::bindToTexture() {
|
||||
if (!m_eglImage) {
|
||||
return false;
|
||||
}
|
||||
RenderThreadInfo *tInfo = RenderThreadInfo::get();
|
||||
if (!tInfo->currContext.Ptr()) {
|
||||
return false;
|
||||
}
|
||||
if (tInfo->currContext->isGL2()) {
|
||||
s_gles2.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_eglImage);
|
||||
}
|
||||
else {
|
||||
s_gles1.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_eglImage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ColorBuffer::bindToRenderbuffer() {
|
||||
if (!m_eglImage) {
|
||||
return false;
|
||||
}
|
||||
RenderThreadInfo *tInfo = RenderThreadInfo::get();
|
||||
if (!tInfo->currContext.Ptr()) {
|
||||
return false;
|
||||
}
|
||||
if (tInfo->currContext->isGL2()) {
|
||||
s_gles2.glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER_OES, m_eglImage);
|
||||
}
|
||||
else {
|
||||
s_gles1.glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER_OES, m_eglImage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ColorBuffer::post(float rotation, float dx, float dy) {
|
||||
// NOTE: Do not call m_helper->setupContext() here!
|
||||
return m_helper->getTextureDraw()->draw(m_resizer->update(m_tex), rotation, dx, dy);
|
||||
}
|
||||
|
||||
void ColorBuffer::readback(unsigned char* img) {
|
||||
ScopedHelperContext context(m_helper);
|
||||
if (!context.isOk()) {
|
||||
return;
|
||||
}
|
||||
if (bindFbo(&m_fbo, m_tex)) {
|
||||
s_gles2.glReadPixels(
|
||||
0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, img);
|
||||
unbindFbo();
|
||||
}
|
||||
}
|
||||
161
external/android-emugl/host/libs/libOpenglRender/ColorBuffer.h
vendored
Normal file
161
external/android-emugl/host/libs/libOpenglRender/ColorBuffer.h
vendored
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _LIBRENDER_COLORBUFFER_H
|
||||
#define _LIBRENDER_COLORBUFFER_H
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <GLES/gl.h>
|
||||
#include "emugl/common/smart_ptr.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
class TextureDraw;
|
||||
class TextureResize;
|
||||
|
||||
// A class used to model a guest color buffer, and used to implement several
|
||||
// related things:
|
||||
//
|
||||
// - Every gralloc native buffer with HW read or write requirements will
|
||||
// allocate a host ColorBuffer instance. When gralloc_lock() is called,
|
||||
// the guest will use ColorBuffer::readPixels() to read the current content
|
||||
// of the buffer. When gralloc_unlock() is later called, it will call
|
||||
// ColorBuffer::subUpdate() to send the updated pixels.
|
||||
//
|
||||
// - Every guest window EGLSurface is implemented by a host PBuffer
|
||||
// (see WindowSurface.h) that can have a ColorBuffer instance attached to
|
||||
// it (through WindowSurface::attachColorBuffer()). When such an attachment
|
||||
// exists, WindowSurface::flushColorBuffer() will copy the PBuffer's
|
||||
// pixel data into the ColorBuffer. The latter can then be displayed
|
||||
// in the client's UI sub-window with ColorBuffer::post().
|
||||
//
|
||||
// - Guest EGLImages are implemented as native gralloc buffers too.
|
||||
// The guest glEGLImageTargetTexture2DOES() implementations will end up
|
||||
// calling ColorBuffer::bindToTexture() to bind the current context's
|
||||
// GL_TEXTURE_2D to the buffer. Similarly, the guest versions of
|
||||
// glEGLImageTargetRenderbufferStorageOES() will end up calling
|
||||
// ColorBuffer::bindToRenderbuffer().
|
||||
//
|
||||
// This forces the implementation to use a host EGLImage to implement each
|
||||
// ColorBuffer.
|
||||
//
|
||||
// As an additional twist.
|
||||
|
||||
class ColorBuffer {
|
||||
public:
|
||||
// Helper interface class used during ColorBuffer operations. This is
|
||||
// introduced to remove coupling from the FrameBuffer class implementation.
|
||||
class Helper {
|
||||
public:
|
||||
Helper() {}
|
||||
virtual ~Helper() {}
|
||||
virtual bool setupContext() = 0;
|
||||
virtual void teardownContext() = 0;
|
||||
virtual TextureDraw* getTextureDraw() const = 0;
|
||||
};
|
||||
|
||||
// Create a new ColorBuffer instance.
|
||||
// |p_display| is the host EGLDisplay handle.
|
||||
// |p_width| and |p_height| are the buffer's dimensions in pixels.
|
||||
// |p_internalFormat| is the internal pixel format to use, valid values
|
||||
// are: GL_RGB, GL_RGB565, GL_RGBA, GL_RGB5_A1_OES and GL_RGBA4_OES.
|
||||
// Implementation is free to use something else though.
|
||||
// |has_eglimage_texture_2d| should be true iff the display supports
|
||||
// the EGL_KHR_gl_texture_2D_image extension.
|
||||
// Returns NULL on failure.
|
||||
static ColorBuffer* create(EGLDisplay p_display,
|
||||
int p_width,
|
||||
int p_height,
|
||||
GLenum p_internalFormat,
|
||||
bool has_eglimage_texture_2d,
|
||||
Helper* helper);
|
||||
|
||||
// Destructor.
|
||||
~ColorBuffer();
|
||||
|
||||
// Return ColorBuffer width and height in pixels
|
||||
GLuint getWidth() const { return m_width; }
|
||||
GLuint getHeight() const { return m_height; }
|
||||
|
||||
// Read the ColorBuffer instance's pixel values into host memory.
|
||||
void readPixels(int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
GLenum p_format,
|
||||
GLenum p_type,
|
||||
void *pixels);
|
||||
|
||||
// Update the ColorBuffer instance's pixel values from host memory.
|
||||
void subUpdate(int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
GLenum p_format,
|
||||
GLenum p_type,
|
||||
void *pixels);
|
||||
|
||||
// Draw a ColorBuffer instance, i.e. blit it to the current guest
|
||||
// framebuffer object / window surface. This doesn't display anything.
|
||||
bool draw();
|
||||
|
||||
// Post this ColorBuffer to the host native sub-window.
|
||||
// |rotation| is the rotation angle in degrees, clockwise in the GL
|
||||
// coordinate space.
|
||||
bool post(float rotation, float dx, float dy);
|
||||
|
||||
// Bind the current context's EGL_TEXTURE_2D texture to this ColorBuffer's
|
||||
// EGLImage. This is intended to implement glEGLImageTargetTexture2DOES()
|
||||
// for all GLES versions.
|
||||
bool bindToTexture();
|
||||
|
||||
// Bind the current context's EGL_RENDERBUFFER_OES render buffer to this
|
||||
// ColorBuffer's EGLImage. This is intended to implement
|
||||
// glEGLImageTargetRenderbufferStorageOES() for all GLES versions.
|
||||
bool bindToRenderbuffer();
|
||||
|
||||
// Copy the content of the current context's read surface to this
|
||||
// ColorBuffer. This is used from WindowSurface::flushColorBuffer().
|
||||
// Return true on success, false on failure (e.g. no current context).
|
||||
bool blitFromCurrentReadBuffer();
|
||||
|
||||
// Read the content of the whole ColorBuffer as 32-bit RGBA pixels.
|
||||
// |img| must be a buffer large enough (i.e. width * height * 4).
|
||||
void readback(unsigned char* img);
|
||||
|
||||
private:
|
||||
ColorBuffer(); // no default constructor.
|
||||
|
||||
explicit ColorBuffer(EGLDisplay display, Helper* helper);
|
||||
|
||||
private:
|
||||
GLuint m_tex;
|
||||
GLuint m_blitTex;
|
||||
EGLImageKHR m_eglImage;
|
||||
EGLImageKHR m_blitEGLImage;
|
||||
GLuint m_width;
|
||||
GLuint m_height;
|
||||
GLuint m_fbo;
|
||||
GLenum m_internalFormat;
|
||||
EGLDisplay m_display;
|
||||
Helper* m_helper;
|
||||
TextureResize * m_resizer;
|
||||
};
|
||||
|
||||
typedef emugl::SmartPtr<ColorBuffer> ColorBufferPtr;
|
||||
|
||||
#endif
|
||||
22
external/android-emugl/host/libs/libOpenglRender/DispatchTables.h
vendored
Normal file
22
external/android-emugl/host/libs/libOpenglRender/DispatchTables.h
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 2011-2015 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/GLESv1Dispatch.h"
|
||||
#include "OpenGLESDispatch/GLESv2Dispatch.h"
|
||||
|
||||
extern GLESv2Dispatch s_gles2;
|
||||
extern GLESv1Dispatch s_gles1;
|
||||
275
external/android-emugl/host/libs/libOpenglRender/FbConfig.cpp
vendored
Normal file
275
external/android-emugl/host/libs/libOpenglRender/FbConfig.cpp
vendored
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
// Copyright (C) 2015 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.
|
||||
|
||||
#include "FbConfig.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace {
|
||||
|
||||
#define E(...) fprintf(stderr, __VA_ARGS__)
|
||||
|
||||
const GLuint kConfigAttributes[] = {
|
||||
EGL_DEPTH_SIZE, // must be first - see getDepthSize()
|
||||
EGL_STENCIL_SIZE, // must be second - see getStencilSize()
|
||||
EGL_RENDERABLE_TYPE,// must be third - see getRenderableType()
|
||||
EGL_SURFACE_TYPE, // must be fourth - see getSurfaceType()
|
||||
EGL_CONFIG_ID, // must be fifth - see chooseConfig()
|
||||
EGL_BUFFER_SIZE,
|
||||
EGL_ALPHA_SIZE,
|
||||
EGL_BLUE_SIZE,
|
||||
EGL_GREEN_SIZE,
|
||||
EGL_RED_SIZE,
|
||||
EGL_CONFIG_CAVEAT,
|
||||
EGL_LEVEL,
|
||||
EGL_MAX_PBUFFER_HEIGHT,
|
||||
EGL_MAX_PBUFFER_PIXELS,
|
||||
EGL_MAX_PBUFFER_WIDTH,
|
||||
EGL_NATIVE_RENDERABLE,
|
||||
EGL_NATIVE_VISUAL_ID,
|
||||
EGL_NATIVE_VISUAL_TYPE,
|
||||
EGL_SAMPLES,
|
||||
EGL_SAMPLE_BUFFERS,
|
||||
EGL_TRANSPARENT_TYPE,
|
||||
EGL_TRANSPARENT_BLUE_VALUE,
|
||||
EGL_TRANSPARENT_GREEN_VALUE,
|
||||
EGL_TRANSPARENT_RED_VALUE,
|
||||
EGL_BIND_TO_TEXTURE_RGB,
|
||||
EGL_BIND_TO_TEXTURE_RGBA,
|
||||
EGL_MIN_SWAP_INTERVAL,
|
||||
EGL_MAX_SWAP_INTERVAL,
|
||||
EGL_LUMINANCE_SIZE,
|
||||
EGL_ALPHA_MASK_SIZE,
|
||||
EGL_COLOR_BUFFER_TYPE,
|
||||
//EGL_MATCH_NATIVE_PIXMAP,
|
||||
EGL_CONFORMANT
|
||||
};
|
||||
|
||||
const size_t kConfigAttributesLen =
|
||||
sizeof(kConfigAttributes) / sizeof(kConfigAttributes[0]);
|
||||
|
||||
bool isCompatibleHostConfig(EGLConfig config, EGLDisplay display) {
|
||||
// Filter out configs which do not support pbuffers, since they
|
||||
// are used to implement window surfaces.
|
||||
EGLint surfaceType;
|
||||
s_egl.eglGetConfigAttrib(
|
||||
display, config, EGL_SURFACE_TYPE, &surfaceType);
|
||||
if (!(surfaceType & EGL_PBUFFER_BIT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter out configs that do not support RGB pixel values.
|
||||
EGLint redSize = 0, greenSize = 0, blueSize = 0, alphaSize = 0;
|
||||
s_egl.eglGetConfigAttrib(
|
||||
display, config,EGL_RED_SIZE, &redSize);
|
||||
s_egl.eglGetConfigAttrib(
|
||||
display, config, EGL_GREEN_SIZE, &greenSize);
|
||||
s_egl.eglGetConfigAttrib(
|
||||
display, config, EGL_BLUE_SIZE, &blueSize);
|
||||
s_egl.eglGetConfigAttrib(
|
||||
display, config, EGL_ALPHA_SIZE, &alphaSize);
|
||||
|
||||
if (!redSize || !greenSize || !blueSize || !alphaSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
FbConfig::~FbConfig() {
|
||||
delete [] mAttribValues;
|
||||
}
|
||||
|
||||
FbConfig::FbConfig(EGLConfig hostConfig, EGLDisplay hostDisplay) :
|
||||
mEglConfig(hostConfig), mAttribValues(NULL) {
|
||||
mAttribValues = new GLint[kConfigAttributesLen];
|
||||
for (size_t i = 0; i < kConfigAttributesLen; ++i) {
|
||||
mAttribValues[i] = 0;
|
||||
s_egl.eglGetConfigAttrib(hostDisplay,
|
||||
hostConfig,
|
||||
kConfigAttributes[i],
|
||||
&mAttribValues[i]);
|
||||
|
||||
// This implementation supports guest window surfaces by wrapping
|
||||
// them around host Pbuffers, so always report it to the guest.
|
||||
if (kConfigAttributes[i] == EGL_SURFACE_TYPE) {
|
||||
mAttribValues[i] |= EGL_WINDOW_BIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FbConfigList::FbConfigList(EGLDisplay display) :
|
||||
mCount(0), mConfigs(NULL), mDisplay(display) {
|
||||
if (display == EGL_NO_DISPLAY) {
|
||||
E("%s: Invalid display value %p (EGL_NO_DISPLAY)\n",
|
||||
__FUNCTION__, (void*)display);
|
||||
return;
|
||||
}
|
||||
|
||||
EGLint numHostConfigs = 0;
|
||||
if (!s_egl.eglGetConfigs(display, NULL, 0, &numHostConfigs)) {
|
||||
E("%s: Could not get number of host EGL configs\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
EGLConfig* hostConfigs = new EGLConfig[numHostConfigs];
|
||||
s_egl.eglGetConfigs(display, hostConfigs, numHostConfigs, &numHostConfigs);
|
||||
|
||||
mConfigs = new FbConfig*[numHostConfigs];
|
||||
for (EGLint i = 0; i < numHostConfigs; ++i) {
|
||||
// Filter out configs that are not compatible with our implementation.
|
||||
if (!isCompatibleHostConfig(hostConfigs[i], display)) {
|
||||
continue;
|
||||
}
|
||||
mConfigs[mCount] = new FbConfig(hostConfigs[i], display);
|
||||
mCount++;
|
||||
}
|
||||
|
||||
delete [] hostConfigs;
|
||||
}
|
||||
|
||||
FbConfigList::~FbConfigList() {
|
||||
for (int n = 0; n < mCount; ++n) {
|
||||
delete mConfigs[n];
|
||||
}
|
||||
delete [] mConfigs;
|
||||
}
|
||||
|
||||
int FbConfigList::chooseConfig(const EGLint* attribs,
|
||||
EGLint* configs,
|
||||
EGLint configsSize) const {
|
||||
EGLint numHostConfigs = 0;
|
||||
if (!s_egl.eglGetConfigs(mDisplay, NULL, 0, &numHostConfigs)) {
|
||||
E("%s: Could not get number of host EGL configs\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EGLConfig* matchedConfigs = new EGLConfig[numHostConfigs];
|
||||
|
||||
// If EGL_SURFACE_TYPE appears in |attribs|, the value passed to
|
||||
// eglChooseConfig should be forced to EGL_PBUFFER_BIT because that's
|
||||
// what it used by the current implementation, exclusively. This forces
|
||||
// the rewrite of |attribs| into a new array.
|
||||
bool hasSurfaceType = false;
|
||||
bool mustReplaceSurfaceType = false;
|
||||
int numAttribs = 0;
|
||||
while (attribs[numAttribs] != EGL_NONE) {
|
||||
if (attribs[numAttribs] == EGL_SURFACE_TYPE) {
|
||||
hasSurfaceType = true;
|
||||
if (attribs[numAttribs + 1] != EGL_PBUFFER_BIT) {
|
||||
mustReplaceSurfaceType = true;
|
||||
}
|
||||
}
|
||||
numAttribs += 2;
|
||||
}
|
||||
|
||||
EGLint* newAttribs = NULL;
|
||||
|
||||
if (mustReplaceSurfaceType) {
|
||||
// There is at least on EGL_SURFACE_TYPE in |attribs|. Copy the
|
||||
// array and replace all values with EGL_PBUFFER_BIT
|
||||
newAttribs = new GLint[numAttribs + 1];
|
||||
memcpy(newAttribs, attribs, numAttribs * sizeof(GLint));
|
||||
newAttribs[numAttribs] = EGL_NONE;
|
||||
for (int n = 0; n < numAttribs; n += 2) {
|
||||
if (newAttribs[n] == EGL_SURFACE_TYPE) {
|
||||
newAttribs[n + 1] = EGL_PBUFFER_BIT;
|
||||
}
|
||||
}
|
||||
} else if (!hasSurfaceType) {
|
||||
// There is no EGL_SURFACE_TYPE in |attribs|, then add one entry
|
||||
// with the value EGL_PBUFFER_BIT.
|
||||
newAttribs = new GLint[numAttribs + 3];
|
||||
memcpy(newAttribs, attribs, numAttribs * sizeof(GLint));
|
||||
newAttribs[numAttribs] = EGL_SURFACE_TYPE;
|
||||
newAttribs[numAttribs + 1] = EGL_PBUFFER_BIT;
|
||||
newAttribs[numAttribs + 2] = EGL_NONE;
|
||||
}
|
||||
|
||||
if (!s_egl.eglChooseConfig(mDisplay,
|
||||
newAttribs ? newAttribs : attribs,
|
||||
matchedConfigs,
|
||||
numHostConfigs,
|
||||
&numHostConfigs)) {
|
||||
numHostConfigs = 0;
|
||||
}
|
||||
|
||||
delete [] newAttribs;
|
||||
|
||||
int result = 0;
|
||||
for (int n = 0; n < numHostConfigs; ++n) {
|
||||
// Don't count or write more than |configsSize| items if |configs|
|
||||
// is not NULL.
|
||||
if (configs && configsSize > 0 && result >= configsSize) {
|
||||
break;
|
||||
}
|
||||
// Skip incompatible host configs.
|
||||
if (!isCompatibleHostConfig(matchedConfigs[n], mDisplay)) {
|
||||
continue;
|
||||
}
|
||||
// Find the FbConfig with the same EGL_CONFIG_ID
|
||||
EGLint hostConfigId;
|
||||
s_egl.eglGetConfigAttrib(
|
||||
mDisplay, matchedConfigs[n], EGL_CONFIG_ID, &hostConfigId);
|
||||
for (int k = 0; k < mCount; ++k) {
|
||||
int guestConfigId = mConfigs[k]->getConfigId();
|
||||
if (guestConfigId == hostConfigId) {
|
||||
// There is a match. Write it to |configs| if it is not NULL.
|
||||
if (configs && result < configsSize) {
|
||||
configs[result] = (uint32_t)k;
|
||||
}
|
||||
result ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete [] matchedConfigs;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void FbConfigList::getPackInfo(EGLint* numConfigs,
|
||||
EGLint* numAttributes) const {
|
||||
if (numConfigs) {
|
||||
*numConfigs = mCount;
|
||||
}
|
||||
if (numAttributes) {
|
||||
*numAttributes = static_cast<EGLint>(kConfigAttributesLen);
|
||||
}
|
||||
}
|
||||
|
||||
EGLint FbConfigList::packConfigs(GLuint bufferByteSize, GLuint* buffer) const {
|
||||
GLuint numAttribs = static_cast<GLuint>(kConfigAttributesLen);
|
||||
GLuint kGLuintSize = static_cast<GLuint>(sizeof(GLuint));
|
||||
GLuint neededByteSize = (mCount + 1) * numAttribs * kGLuintSize;
|
||||
if (!buffer || bufferByteSize < neededByteSize) {
|
||||
return -neededByteSize;
|
||||
}
|
||||
// Write to the buffer the config attribute ids, followed for each one
|
||||
// of the configs, their values.
|
||||
memcpy(buffer, kConfigAttributes, kConfigAttributesLen * kGLuintSize);
|
||||
|
||||
for (int i = 0; i < mCount; ++i) {
|
||||
memcpy(buffer + (i + 1) * kConfigAttributesLen,
|
||||
mConfigs[i]->mAttribValues,
|
||||
kConfigAttributesLen * kGLuintSize);
|
||||
}
|
||||
return mCount;
|
||||
}
|
||||
163
external/android-emugl/host/libs/libOpenglRender/FbConfig.h
vendored
Normal file
163
external/android-emugl/host/libs/libOpenglRender/FbConfig.h
vendored
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
// Copyright (C) 2015 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.
|
||||
|
||||
#ifndef _LIBRENDER_FB_CONFIG_H
|
||||
#define _LIBRENDER_FB_CONFIG_H
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES/gl.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// A class used to model a guest EGL config.
|
||||
// This really wraps a host EGLConfig handle, and provides a few cached
|
||||
// attributes that can be retrieved through direct accessors, like
|
||||
// getDepthSize().
|
||||
//
|
||||
// Each FbConfig is identified by a unique id which is its index in
|
||||
// an FbConfigList instance (as declared below). It is not related to
|
||||
// the host EGLConfig value or its EGL_CONFIG_ID.
|
||||
//
|
||||
// One doesn't create an FbConfig instance. Instead, create and initialize
|
||||
// an FbConfigList from the host EGLDisplay, and use its size() and get()
|
||||
// methods to access it.
|
||||
class FbConfig {
|
||||
public:
|
||||
// Destructor
|
||||
~FbConfig();
|
||||
|
||||
// Retrieve host EGLConfig.
|
||||
EGLConfig getEglConfig() const { return mEglConfig; }
|
||||
|
||||
// Get depth size in bits.
|
||||
GLuint getDepthSize() const { return getAttribValue(0); }
|
||||
|
||||
// Get stencil size in bits.
|
||||
GLuint getStencilSize() const { return getAttribValue(1); }
|
||||
|
||||
// Get renderable type mask.
|
||||
GLuint getRenderableType() const { return getAttribValue(2); }
|
||||
|
||||
// Get surface type mask.
|
||||
GLuint getSurfaceType() const { return getAttribValue(3); }
|
||||
|
||||
// Get the EGL_CONFIG_ID value. This is the same as the one of the
|
||||
// underlying host EGLConfig handle.
|
||||
GLint getConfigId() const { return (GLint)getAttribValue(4); }
|
||||
|
||||
private:
|
||||
FbConfig();
|
||||
FbConfig(FbConfig& other);
|
||||
|
||||
explicit FbConfig(EGLConfig hostConfig, EGLDisplay hostDisplay);
|
||||
|
||||
friend class FbConfigList;
|
||||
|
||||
GLuint getAttribValue(int n) const {
|
||||
return mAttribValues ? mAttribValues[n] : 0U;
|
||||
}
|
||||
|
||||
EGLConfig mEglConfig;
|
||||
GLint* mAttribValues;
|
||||
};
|
||||
|
||||
// A class to model the list of FbConfig for a given EGLDisplay, this is
|
||||
// built from the list of host EGLConfig handles, filtered to only accept
|
||||
// configs that are useful by the rendering library (e.g. they must support
|
||||
// PBuffers and RGB pixel values).
|
||||
//
|
||||
// Usage is the following:
|
||||
//
|
||||
// 1) Create new instance by passing host EGLDisplay value.
|
||||
//
|
||||
// 2) Call empty() to check that the list is not empty, which would indicate
|
||||
// an error during creation.
|
||||
//
|
||||
// 3) FbConfig instances are identified by numbers in 0..(N-1) range, where
|
||||
// N is the result of the size() method.
|
||||
//
|
||||
// 4) Convert an FbConfig id into an FbConfig instance with get().
|
||||
//
|
||||
// 5) Use getPackInfo() and packConfigs() to retrieve information about
|
||||
// available configs to the guest.
|
||||
class FbConfigList {
|
||||
public:
|
||||
// Create a new list of FbConfig instance, by querying all compatible
|
||||
// host configs from |display|. A compatible config is one that supports
|
||||
// Pbuffers and RGB pixel values.
|
||||
//
|
||||
// After construction, call empty() to check if there are items.
|
||||
// An empty list means there was an error during construction.
|
||||
explicit FbConfigList(EGLDisplay display);
|
||||
|
||||
// Destructor.
|
||||
~FbConfigList();
|
||||
|
||||
// Return true iff the list is empty. true means there was an error
|
||||
// during construction.
|
||||
bool empty() const { return mCount == 0; }
|
||||
|
||||
// Return the number of FbConfig instances in the list.
|
||||
// Each instance is identified by a number from 0 to N-1,
|
||||
// where N is the result of this function.
|
||||
size_t size() const { return static_cast<size_t>(mCount); }
|
||||
|
||||
// Retrieve the FbConfig instance associated with |guestId|,
|
||||
// which must be an integer between 0 and |size() - 1|. Returns
|
||||
// NULL in case of failure.
|
||||
const FbConfig* get(int guestId) const {
|
||||
if (guestId >= 0 && guestId < mCount) {
|
||||
return mConfigs[guestId];
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Use |attribs| a list of EGL attribute name/values terminated by
|
||||
// EGL_NONE, to select a set of matching FbConfig instances.
|
||||
//
|
||||
// On success, returns the number of matching instances.
|
||||
// If |configs| is not NULL, it will be populated with the guest IDs
|
||||
// of the matched FbConfig instances.
|
||||
//
|
||||
// |configsSize| is the number of entries in the |configs| array. The
|
||||
// function will never write more than |configsSize| entries into
|
||||
// |configsSize|.
|
||||
EGLint chooseConfig(const EGLint* attribs,
|
||||
EGLint* configs,
|
||||
EGLint configsSize) const;
|
||||
|
||||
// Retrieve information that can be sent to the guest before packed
|
||||
// config list information. If |numConfigs| is NULL, then |*numConfigs|
|
||||
// will be set on return to the number of config instances.
|
||||
// If |numAttribs| is not NULL, then |*numAttribs| will be set on return
|
||||
// to the number of attribute values cached by each FbConfig instance.
|
||||
void getPackInfo(EGLint* mumConfigs, EGLint* numAttribs) const;
|
||||
|
||||
// Write the full list information into an array of EGLuint items.
|
||||
// |buffer| is the output buffer that will receive the data.
|
||||
// |bufferByteSize| is teh buffer size in bytes.
|
||||
// On success, this returns
|
||||
EGLint packConfigs(GLuint bufferByteSize, GLuint* buffer) const;
|
||||
|
||||
private:
|
||||
FbConfigList();
|
||||
FbConfigList(const FbConfigList& other);
|
||||
|
||||
int mCount;
|
||||
FbConfig** mConfigs;
|
||||
EGLDisplay mDisplay;
|
||||
};
|
||||
|
||||
#endif // _LIBRENDER_FB_CONFIG_H
|
||||
1166
external/android-emugl/host/libs/libOpenglRender/FrameBuffer.cpp
vendored
Normal file
1166
external/android-emugl/host/libs/libOpenglRender/FrameBuffer.cpp
vendored
Normal file
File diff suppressed because it is too large
Load diff
360
external/android-emugl/host/libs/libOpenglRender/FrameBuffer.h
vendored
Normal file
360
external/android-emugl/host/libs/libOpenglRender/FrameBuffer.h
vendored
Normal file
|
|
@ -0,0 +1,360 @@
|
|||
/*
|
||||
* Copyright (C) 2011-2015 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.
|
||||
*/
|
||||
#ifndef _LIBRENDER_FRAMEBUFFER_H
|
||||
#define _LIBRENDER_FRAMEBUFFER_H
|
||||
|
||||
#include "ColorBuffer.h"
|
||||
#include "emugl/common/mutex.h"
|
||||
#include "FbConfig.h"
|
||||
#include "RenderContext.h"
|
||||
#include "TextureDraw.h"
|
||||
#include "WindowSurface.h"
|
||||
|
||||
#include "OpenglRender/render_api.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Type of handles, a.k.a. "object names" in the GL specification.
|
||||
// These are integers used to uniquely identify a resource of a given type.
|
||||
typedef uint32_t HandleType;
|
||||
|
||||
struct ColorBufferRef {
|
||||
ColorBufferPtr cb;
|
||||
uint32_t refcount; // number of client-side references
|
||||
};
|
||||
typedef std::map<HandleType, RenderContextPtr> RenderContextMap;
|
||||
typedef std::map<HandleType, std::pair<WindowSurfacePtr, HandleType> > WindowSurfaceMap;
|
||||
typedef std::map<HandleType, ColorBufferRef> ColorBufferMap;
|
||||
|
||||
// A structure used to list the capabilities of the underlying EGL
|
||||
// implementation that the FrameBuffer instance depends on.
|
||||
// |has_eglimage_texture_2d| is true iff the EGL_KHR_gl_texture_2D_image
|
||||
// extension is supported.
|
||||
// |has_eglimage_renderbuffer| is true iff the EGL_KHR_gl_renderbuffer_image
|
||||
// extension is supported.
|
||||
// |eglMajor| and |eglMinor| are the major and minor version numbers of
|
||||
// the underlying EGL implementation.
|
||||
struct FrameBufferCaps {
|
||||
bool has_eglimage_texture_2d;
|
||||
bool has_eglimage_renderbuffer;
|
||||
EGLint eglMajor;
|
||||
EGLint eglMinor;
|
||||
};
|
||||
|
||||
// The FrameBuffer class holds the global state of the emulation library on
|
||||
// top of the underlying EGL/GLES implementation. It should probably be
|
||||
// named "Display" instead of "FrameBuffer".
|
||||
//
|
||||
// There is only one global instance, that can be retrieved with getFB(),
|
||||
// and which must be previously setup by calling initialize().
|
||||
//
|
||||
class FrameBuffer {
|
||||
public:
|
||||
// Initialize the global instance.
|
||||
// |width| and |height| are the dimensions of the emulator GPU display
|
||||
// in pixels. |useSubWindow| is true to indicate that the caller
|
||||
// will use setupSubWindow() to let EmuGL display the GPU content in its
|
||||
// own sub-windows. If false, this means the caller will use
|
||||
// setPostCallback() instead to retrieve the content.
|
||||
// Returns true on success, false otherwise.
|
||||
static bool initialize(int width, int height, bool useSubWindow);
|
||||
|
||||
// Setup a sub-window to display the content of the emulated GPU
|
||||
// on-top of an existing UI window. |p_window| is the platform-specific
|
||||
// parent window handle. |wx|, |wy|, |ww| and |wh| are the
|
||||
// dimensions in pixels of the sub-window, relative to the parent window's
|
||||
// coordinate. |fbw| and |fbh| are the dimensions used to initialize
|
||||
// the framebuffer, which may be different from the dimensions of the
|
||||
// sub-window (in which case scaling will be applied automatically).
|
||||
// |dpr| is the device pixel ratio of the monitor, which is needed for
|
||||
// proper panning on high-density displays (like retina)
|
||||
// |zRot| is a rotation angle in degrees, (clockwise in the Y-upwards GL
|
||||
// coordinate space).
|
||||
//
|
||||
// If a sub-window already exists, this function updates the subwindow
|
||||
// and framebuffer properties to match the given values.
|
||||
//
|
||||
// Return true on success, false otherwise.
|
||||
//
|
||||
// NOTE: This can return false for software-only EGL engines like OSMesa.
|
||||
bool setupSubWindow(FBNativeWindowType p_window,
|
||||
int wx, int wy,
|
||||
int ww, int wh,
|
||||
int fbw, int fbh, float dpr, float zRot);
|
||||
|
||||
// Remove the sub-window created by setupSubWindow(), if any.
|
||||
// Return true on success, false otherwise.
|
||||
bool removeSubWindow();
|
||||
|
||||
// Finalize the instance.
|
||||
void finalize();
|
||||
|
||||
// Return a pointer to the global instance. initialize() must be called
|
||||
// previously, or this will return NULL.
|
||||
static FrameBuffer *getFB() { return s_theFrameBuffer; }
|
||||
|
||||
// Return the capabilities of the underlying display.
|
||||
const FrameBufferCaps &getCaps() const { return m_caps; }
|
||||
|
||||
// Return the emulated GPU display width in pixels.
|
||||
int getWidth() const { return m_framebufferWidth; }
|
||||
|
||||
// Return the emulated GPU display height in pixels.
|
||||
int getHeight() const { return m_framebufferHeight; }
|
||||
|
||||
// Return the list of configs available from this display.
|
||||
const FbConfigList* getConfigs() const { return m_configs; }
|
||||
|
||||
// Set a callback that will be called each time the emulated GPU content
|
||||
// is updated. This can be relatively slow with host-based GPU emulation,
|
||||
// so only do this when you need to.
|
||||
void setPostCallback(OnPostFn onPost, void* onPostContext);
|
||||
|
||||
// Retrieve the GL strings of the underlying EGL/GLES implementation.
|
||||
// On return, |*vendor|, |*renderer| and |*version| will point to strings
|
||||
// that are owned by the instance (and must not be freed by the caller).
|
||||
void getGLStrings(const char** vendor,
|
||||
const char** renderer,
|
||||
const char** version) const {
|
||||
*vendor = m_glVendor;
|
||||
*renderer = m_glRenderer;
|
||||
*version = m_glVersion;
|
||||
}
|
||||
|
||||
// Create a new RenderContext instance for this display instance.
|
||||
// |p_config| is the index of one of the configs returned by getConfigs().
|
||||
// |p_share| is either EGL_NO_CONTEXT or the handle of a shared context.
|
||||
// |p_isGL2| is true to create a GLES 2.x context, or false for a GLES 1.x
|
||||
// one.
|
||||
// Return a new handle value, which will be 0 in case of error.
|
||||
HandleType createRenderContext(
|
||||
int p_config, HandleType p_share, bool p_isGL2 = false);
|
||||
|
||||
// Create a new WindowSurface instance from this display instance.
|
||||
// |p_config| is the index of one of the configs returned by getConfigs().
|
||||
// |p_width| and |p_height| are the window dimensions in pixels.
|
||||
// Return a new handle value, or 0 in case of error.
|
||||
HandleType createWindowSurface(int p_config, int p_width, int p_height);
|
||||
|
||||
// Create a new ColorBuffer instance from this display instance.
|
||||
// |p_width| and |p_height| are its dimensions in pixels.
|
||||
// |p_internalFormat| is the pixel format. See ColorBuffer::create() for
|
||||
// list of valid values. Note that ColorBuffer instances are reference-
|
||||
// counted. Use openColorBuffer / closeColorBuffer to operate on the
|
||||
// internal count.
|
||||
HandleType createColorBuffer(
|
||||
int p_width, int p_height, GLenum p_internalFormat);
|
||||
|
||||
// Call this function when a render thread terminates to destroy all
|
||||
// the remaining contexts it created. Necessary to avoid leaking host
|
||||
// contexts when a guest application crashes, for example.
|
||||
void drainRenderContext();
|
||||
|
||||
// Call this function when a render thread terminates to destroy all
|
||||
// remaining window surfqce it created. Necessary to avoid leaking
|
||||
// host buffers when a guest application crashes, for example.
|
||||
void drainWindowSurface();
|
||||
|
||||
// Destroy a given RenderContext instance. |p_context| is its handle
|
||||
// value as returned by createRenderContext().
|
||||
void DestroyRenderContext(HandleType p_context);
|
||||
|
||||
// Destroy a given WindowSurface instance. |p_surcace| is its handle
|
||||
// value as returned by createWindowSurface().
|
||||
void DestroyWindowSurface(HandleType p_surface);
|
||||
|
||||
// Increment the reference count associated with a given ColorBuffer
|
||||
// instance. |p_colorbuffer| is its handle value as returned by
|
||||
// createColorBuffer().
|
||||
int openColorBuffer(HandleType p_colorbuffer);
|
||||
|
||||
// Decrement the reference count associated with a given ColorBuffer
|
||||
// instance. |p_colorbuffer| is its handle value as returned by
|
||||
// createColorBuffer(). Note that if the reference count reaches 0,
|
||||
// the instance is destroyed automatically.
|
||||
void closeColorBuffer(HandleType p_colorbuffer);
|
||||
|
||||
// Equivalent for eglMakeCurrent() for the current display.
|
||||
// |p_context|, |p_drawSurface| and |p_readSurface| are the handle values
|
||||
// of the context, the draw surface and the read surface, respectively.
|
||||
// Returns true on success, false on failure.
|
||||
// Note: if all handle values are 0, this is an unbind operation.
|
||||
bool bindContext(HandleType p_context,
|
||||
HandleType p_drawSurface,
|
||||
HandleType p_readSurface);
|
||||
|
||||
// Attach a ColorBuffer to a WindowSurface instance.
|
||||
// See the documentation for WindowSurface::setColorBuffer().
|
||||
// |p_surface| is the target WindowSurface's handle value.
|
||||
// |p_colorbuffer| is the ColorBuffer handle value.
|
||||
// Returns true on success, false otherwise.
|
||||
bool setWindowSurfaceColorBuffer(
|
||||
HandleType p_surface, HandleType p_colorbuffer);
|
||||
|
||||
// Copy the content of a WindowSurface's Pbuffer to its attached
|
||||
// ColorBuffer. See the documentation for WindowSurface::flushColorBuffer()
|
||||
// |p_surface| is the target WindowSurface's handle value.
|
||||
// Returns true on success, false on failure.
|
||||
bool flushWindowSurfaceColorBuffer(HandleType p_surface);
|
||||
|
||||
// Bind the current context's EGL_TEXTURE_2D texture to a ColorBuffer
|
||||
// instance's EGLImage. This is intended to implement
|
||||
// glEGLImageTargetTexture2DOES() for all GLES versions.
|
||||
// |p_colorbuffer| is the ColorBuffer's handle value.
|
||||
// Returns true on success, false on failure.
|
||||
bool bindColorBufferToTexture(HandleType p_colorbuffer);
|
||||
|
||||
// Bind the current context's EGL_RENDERBUFFER_OES render buffer to this
|
||||
// ColorBuffer's EGLImage. This is intended to implement
|
||||
// glEGLImageTargetRenderbufferStorageOES() for all GLES versions.
|
||||
// |p_colorbuffer| is the ColorBuffer's handle value.
|
||||
// Returns true on success, false on failure.
|
||||
bool bindColorBufferToRenderbuffer(HandleType p_colorbuffer);
|
||||
|
||||
// Read the content of a given ColorBuffer into client memory.
|
||||
// |p_colorbuffer| is the ColorBuffer's handle value. Similar
|
||||
// to glReadPixels(), this can be a slow operation.
|
||||
// |x|, |y|, |width| and |height| are the position and dimensions of
|
||||
// a rectangle whose pixel values will be transfered to the host.
|
||||
// |format| indicates the format of the pixel data, e.g. GL_RGB or GL_RGBA.
|
||||
// |type| is the type of pixel data, e.g. GL_UNSIGNED_BYTE.
|
||||
// |pixels| is the address of a caller-provided buffer that will be filled
|
||||
// with the pixel data.
|
||||
void readColorBuffer(HandleType p_colorbuffer,
|
||||
int x, int y, int width, int height,
|
||||
GLenum format, GLenum type, void *pixels);
|
||||
|
||||
// Update the content of a given ColorBuffer from client data.
|
||||
// |p_colorbuffer| is the ColorBuffer's handle value. Similar
|
||||
// to glReadPixels(), this can be a slow operation.
|
||||
// |x|, |y|, |width| and |height| are the position and dimensions of
|
||||
// a rectangle whose pixel values will be transfered to the GPU
|
||||
// |format| indicates the format of the pixel data, e.g. GL_RGB or GL_RGBA.
|
||||
// |type| is the type of pixel data, e.g. GL_UNSIGNED_BYTE.
|
||||
// |pixels| is the address of a buffer containing the new pixel data.
|
||||
// Returns true on success, false otherwise.
|
||||
bool updateColorBuffer(HandleType p_colorbuffer,
|
||||
int x, int y, int width, int height,
|
||||
GLenum format, GLenum type, void *pixels);
|
||||
|
||||
// Display the content of a given ColorBuffer into the framebuffer's
|
||||
// sub-window. |p_colorbuffer| is a handle value.
|
||||
// |needLock| is used to indicate whether the operation requires
|
||||
// acquiring/releasing the FrameBuffer instance's lock. It should be
|
||||
// false only when called internally.
|
||||
bool post(HandleType p_colorbuffer, bool needLock = true);
|
||||
|
||||
// Re-post the last ColorBuffer that was displayed through post().
|
||||
// This is useful if you detect that the sub-window content needs to
|
||||
// be re-displayed for any reason.
|
||||
bool repost();
|
||||
|
||||
// Return the host EGLDisplay used by this instance.
|
||||
EGLDisplay getDisplay() const { return m_eglDisplay; }
|
||||
|
||||
// Change the rotation of the displayed GPU sub-window.
|
||||
void setDisplayRotation(float zRot) {
|
||||
m_zRot = zRot;
|
||||
repost();
|
||||
}
|
||||
|
||||
// Changes what coordinate of this framebuffer will be displayed at the
|
||||
// corner of the GPU sub-window. Specifically, |px| and |py| = 0 means
|
||||
// align the bottom-left of the framebuffer with the bottom-left of the
|
||||
// sub-window, and |px| and |py| = 1 means align the top right of the
|
||||
// framebuffer with the top right of the sub-window. Intermediate values
|
||||
// interpolate between these states.
|
||||
void setDisplayTranslation(float px, float py) {
|
||||
|
||||
// Sanity check the values to ensure they are between 0 and 1
|
||||
m_px = px > 1 ? 1 : (px < 0 ? 0 : px);
|
||||
m_py = py > 1 ? 1 : (py < 0 ? 0 : py);
|
||||
repost();
|
||||
}
|
||||
|
||||
// Return a TextureDraw instance that can be used with this surfaces
|
||||
// and windows created by this instance.
|
||||
TextureDraw* getTextureDraw() const { return m_textureDraw; }
|
||||
|
||||
HandleType createClientImage(HandleType context, EGLenum target, GLuint buffer);
|
||||
EGLBoolean destroyClientImage(HandleType image);
|
||||
|
||||
// Used internally.
|
||||
bool bind_locked();
|
||||
bool unbind_locked();
|
||||
|
||||
private:
|
||||
FrameBuffer(int p_width, int p_height, bool useSubWindow);
|
||||
~FrameBuffer();
|
||||
HandleType genHandle();
|
||||
|
||||
bool bindSubwin_locked();
|
||||
|
||||
private:
|
||||
static FrameBuffer *s_theFrameBuffer;
|
||||
static HandleType s_nextHandle;
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_framebufferWidth;
|
||||
int m_framebufferHeight;
|
||||
int m_windowWidth;
|
||||
int m_windowHeight;
|
||||
float m_dpr;
|
||||
bool m_useSubWindow;
|
||||
emugl::Mutex m_lock;
|
||||
FbConfigList* m_configs;
|
||||
FBNativeWindowType m_nativeWindow;
|
||||
FrameBufferCaps m_caps;
|
||||
EGLDisplay m_eglDisplay;
|
||||
RenderContextMap m_contexts;
|
||||
WindowSurfaceMap m_windows;
|
||||
ColorBufferMap m_colorbuffers;
|
||||
ColorBuffer::Helper* m_colorBufferHelper;
|
||||
|
||||
EGLSurface m_eglSurface;
|
||||
EGLContext m_eglContext;
|
||||
EGLSurface m_pbufSurface;
|
||||
EGLContext m_pbufContext;
|
||||
|
||||
EGLContext m_prevContext;
|
||||
EGLSurface m_prevReadSurf;
|
||||
EGLSurface m_prevDrawSurf;
|
||||
EGLNativeWindowType m_subWin;
|
||||
TextureDraw* m_textureDraw;
|
||||
EGLConfig m_eglConfig;
|
||||
HandleType m_lastPostedColorBuffer;
|
||||
float m_zRot;
|
||||
float m_px;
|
||||
float m_py;
|
||||
bool m_eglContextInitialized;
|
||||
|
||||
int m_statsNumFrames;
|
||||
long long m_statsStartTime;
|
||||
bool m_fpsStats;
|
||||
|
||||
OnPostFn m_onPost;
|
||||
void* m_onPostContext;
|
||||
unsigned char* m_fbImage;
|
||||
|
||||
const char* m_glVendor;
|
||||
const char* m_glRenderer;
|
||||
const char* m_glVersion;
|
||||
};
|
||||
#endif
|
||||
70
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow.h
vendored
Normal file
70
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow.h
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef NATIVE_SUB_WINDOW_H
|
||||
#define NATIVE_SUB_WINDOW_H
|
||||
|
||||
#include "OpenglRender/render_api_platform_types.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*SubWindowRepaintCallback)(void*);
|
||||
|
||||
// Create a new sub-window that will be used to display the content of the
|
||||
// emulated GPU on top of the regular UI window.
|
||||
// |p_window| is the platform-specific handle to the main UI window.
|
||||
// |x|, |y| is the position sub-window relative to the top-left corner of the
|
||||
// main window.
|
||||
// |width| and |height| are the dimensions of the sub-window, as well as of
|
||||
// the emulated framebuffer.
|
||||
// |repaint_callback| may be invoked every time the window has to be repainted
|
||||
// (such as receiving a WM_PAINT event on Windows). If the provided argument is
|
||||
// NULL, nothing will be invoked.
|
||||
// |repaint_callback_param| an additional parameter that will be passed to the
|
||||
// repaint callback when/if it's invoked.
|
||||
// On success, return a new platform-specific window handle, cast as an
|
||||
// EGLNativeWindowType. Or 0/NULL in case of failure.
|
||||
EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
SubWindowRepaintCallback repaint_callback,
|
||||
void* repaint_callback_param);
|
||||
|
||||
// Destroy a sub-window previously created through createSubWindow() above.
|
||||
void destroySubWindow(EGLNativeWindowType win);
|
||||
|
||||
// Moves a sub-window previously created through createSubWindow() above.
|
||||
// |p_parent_window| is the platform-specific handle to the main UI window.
|
||||
// |p_sub_window| is the platform-specific handle to the EGL subwindow.
|
||||
// |x|,|y|,|width|,|height| are the new location and dimensions of the
|
||||
// subwindow.
|
||||
int moveSubWindow(FBNativeWindowType p_parent_window,
|
||||
EGLNativeWindowType p_sub_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
101
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_cocoa.m
vendored
Normal file
101
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_cocoa.m
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "NativeSubWindow.h"
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
/*
|
||||
* EmuGLView inherit from NSView and override the isOpaque
|
||||
* method to return YES. That prevents drawing of underlying window/view
|
||||
* when the view needs to be redrawn.
|
||||
*/
|
||||
@interface EmuGLView : NSView {
|
||||
} @end
|
||||
|
||||
@implementation EmuGLView
|
||||
|
||||
- (BOOL)isOpaque {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
SubWindowRepaintCallback repaint_callback,
|
||||
void* repaint_callback_param) {
|
||||
NSWindow* win = (NSWindow *)p_window;
|
||||
if (!win) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* (x,y) assume an upper-left origin, but Cocoa uses a lower-left origin */
|
||||
NSRect content_rect = [win contentRectForFrameRect:[win frame]];
|
||||
int cocoa_y = (int)content_rect.size.height - (y + height);
|
||||
NSRect contentRect = NSMakeRect(x, cocoa_y, width, height);
|
||||
|
||||
NSView *glView = [[EmuGLView alloc] initWithFrame:contentRect];
|
||||
if (glView) {
|
||||
[glView setWantsBestResolutionOpenGLSurface:YES];
|
||||
[[win contentView] addSubview:glView];
|
||||
[win makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
return (EGLNativeWindowType)glView;
|
||||
}
|
||||
|
||||
void destroySubWindow(EGLNativeWindowType win) {
|
||||
if(win){
|
||||
NSView *glView = (NSView *)win;
|
||||
[glView removeFromSuperview];
|
||||
[glView release];
|
||||
}
|
||||
}
|
||||
|
||||
int moveSubWindow(FBNativeWindowType p_parent_window,
|
||||
EGLNativeWindowType p_sub_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height) {
|
||||
NSWindow *win = (NSWindow *)p_parent_window;
|
||||
if (!win) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
NSView *glView = (NSView *)p_sub_window;
|
||||
if (!glView) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The view must be removed from the hierarchy to be properly resized */
|
||||
[glView removeFromSuperview];
|
||||
|
||||
/* (x,y) assume an upper-left origin, but Cocoa uses a lower-left origin */
|
||||
NSRect content_rect = [win contentRectForFrameRect:[win frame]];
|
||||
int cocoa_y = (int)content_rect.size.height - (y + height);
|
||||
NSRect newFrame = NSMakeRect(x, cocoa_y, width, height);
|
||||
[glView setFrame:newFrame];
|
||||
|
||||
/* Re-add the sub-window to the view hierarchy */
|
||||
[[win contentView] addSubview:glView];
|
||||
[win makeKeyAndOrderFront:nil];
|
||||
|
||||
return 1;
|
||||
}
|
||||
201
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_mir.cpp
vendored
Normal file
201
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_mir.cpp
vendored
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define MIR_EGL_PLATFORM
|
||||
|
||||
#include "mir_support/shared_state.h"
|
||||
|
||||
#include "NativeSubWindow.h"
|
||||
|
||||
#include "OpenglCodecCommon/ErrorLog.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <mirclient/mir_toolkit/mir_client_library.h>
|
||||
|
||||
namespace {
|
||||
std::map<EGLNativeWindowType,MirSurface*> surfaces;
|
||||
|
||||
static const MirDisplayOutput *find_active_output(
|
||||
const MirDisplayConfiguration *conf)
|
||||
{
|
||||
const MirDisplayOutput *output = NULL;
|
||||
int d;
|
||||
|
||||
for (d = 0; d < (int)conf->num_outputs; d++)
|
||||
{
|
||||
const MirDisplayOutput *out = conf->outputs + d;
|
||||
|
||||
if (out->used &&
|
||||
out->connected &&
|
||||
out->num_modes &&
|
||||
out->current_mode < out->num_modes)
|
||||
{
|
||||
output = out;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
MirPixelFormat defaultPixelFormatFor(MirConnection *connection)
|
||||
{
|
||||
MirPixelFormat format;
|
||||
unsigned int nformats;
|
||||
mir_connection_get_available_surface_formats(connection, &format, 1, &nformats);
|
||||
return format;
|
||||
}
|
||||
|
||||
void handleSurfaceEvent(const MirSurfaceEvent *event) {
|
||||
MirSurfaceAttrib attrib = mir_surface_event_get_attribute(event);
|
||||
if (attrib != mir_surface_attrib_visibility)
|
||||
return;
|
||||
switch (mir_surface_event_get_attribute(event)) {
|
||||
case mir_surface_visibility_exposed:
|
||||
ERR("Surface exposed\n");
|
||||
break;
|
||||
case mir_surface_visibility_occluded:
|
||||
ERR("Surface occluded\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void surfaceEventHandler(MirSurface *surface, MirEvent const *event, void *context) {
|
||||
switch (mir_event_get_type(event)) {
|
||||
case mir_event_type_input:
|
||||
break;
|
||||
case mir_event_type_surface:
|
||||
handleSurfaceEvent(mir_event_get_surface_event(event));
|
||||
break;
|
||||
case mir_event_type_resize:
|
||||
{
|
||||
MirResizeEvent const *resize_event = mir_event_get_resize_event(event);
|
||||
ERR("Resized to %dx%d\n",
|
||||
mir_resize_event_get_width(resize_event),
|
||||
mir_resize_event_get_height(resize_event));
|
||||
}
|
||||
break;
|
||||
case mir_event_type_close_surface:
|
||||
break;
|
||||
case mir_event_type_surface_output:
|
||||
{
|
||||
MirSurfaceOutputEvent const *output_event = mir_event_get_surface_output_event(event);
|
||||
ERR("dpi %i output id %d\n",
|
||||
mir_surface_output_event_get_dpi(output_event),
|
||||
mir_surface_output_event_get_output_id(output_event));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
SubWindowRepaintCallback repaint_callback,
|
||||
void* repaint_callback_param) {
|
||||
|
||||
(void) p_window;
|
||||
(void) x;
|
||||
(void) y;
|
||||
(void) width;
|
||||
(void) height;
|
||||
(void) repaint_callback;
|
||||
(void) repaint_callback_param;
|
||||
|
||||
mir::support::SharedState::get()->ensure_connection();
|
||||
|
||||
const auto pixel_format = defaultPixelFormatFor(mir::support::SharedState::get()->connection());
|
||||
|
||||
ERR("Selected pixel format %d\n", pixel_format);
|
||||
|
||||
MirDisplayConfiguration* display_config =
|
||||
mir_connection_create_display_config(mir::support::SharedState::get()->connection());
|
||||
|
||||
const MirDisplayOutput *output = find_active_output(display_config);
|
||||
if (!output)
|
||||
throw new std::runtime_error("Failed to find active output display");
|
||||
|
||||
const MirDisplayMode *mode = &output->modes[output->current_mode];
|
||||
|
||||
auto spec = mir_connection_create_spec_for_normal_surface(
|
||||
mir::support::SharedState::get()->connection(),
|
||||
mode->vertical_resolution,
|
||||
mode->horizontal_resolution,
|
||||
pixel_format);
|
||||
|
||||
mir_surface_spec_set_name(spec, "anbox");
|
||||
mir_surface_spec_set_event_handler(spec, surfaceEventHandler, nullptr);
|
||||
ERR("Selecting output id %d", output->output_id);
|
||||
mir_surface_spec_set_fullscreen_on_output(spec, output->output_id);
|
||||
mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_hardware);
|
||||
|
||||
mir_display_config_destroy(display_config);
|
||||
|
||||
auto surface = mir_surface_create_sync(spec);
|
||||
mir_surface_spec_release(spec);
|
||||
|
||||
if (!mir_surface_is_valid(surface)) {
|
||||
ERR("surface error: %s\n", mir_surface_get_error_message(surface));
|
||||
throw std::runtime_error("Failed to create a Mir surface");
|
||||
}
|
||||
|
||||
MirSurfaceParameters parameters;
|
||||
mir_surface_get_parameters(surface, ¶meters);
|
||||
ERR("width %i height %i output id %i\n",
|
||||
parameters.width,
|
||||
parameters.height,
|
||||
parameters.output_id);
|
||||
|
||||
auto surface_buffer_stream = mir_surface_get_buffer_stream(surface);
|
||||
auto native_window = reinterpret_cast<EGLNativeWindowType>(
|
||||
mir_buffer_stream_get_egl_native_window(surface_buffer_stream));
|
||||
|
||||
surfaces.insert({ native_window, surface });
|
||||
|
||||
return native_window;
|
||||
}
|
||||
|
||||
void destroySubWindow(EGLNativeWindowType win) {
|
||||
if (surfaces.find(win) == surfaces.end())
|
||||
return;
|
||||
|
||||
auto surface = surfaces[win];
|
||||
surfaces.erase(win);
|
||||
|
||||
mir_surface_release_sync(surface);
|
||||
}
|
||||
|
||||
int moveSubWindow(FBNativeWindowType p_parent_window,
|
||||
EGLNativeWindowType p_sub_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height) {
|
||||
|
||||
ERR("%s: Not implemented", __func__);
|
||||
|
||||
return true;
|
||||
}
|
||||
39
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_null.cpp
vendored
Normal file
39
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_null.cpp
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "NativeSubWindow.h"
|
||||
|
||||
EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
SubWindowRepaintCallback repaint_callback,
|
||||
void* repaint_callback_param) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void destroySubWindow(EGLNativeWindowType win) {
|
||||
}
|
||||
|
||||
int moveSubWindow(FBNativeWindowType p_parent_window,
|
||||
EGLNativeWindowType p_sub_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height) {
|
||||
return false;
|
||||
}
|
||||
90
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_win32.cpp
vendored
Normal file
90
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_win32.cpp
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "NativeSubWindow.h"
|
||||
|
||||
struct SubWindowUserData {
|
||||
SubWindowRepaintCallback repaint_callback;
|
||||
void* repaint_callback_param;
|
||||
};
|
||||
|
||||
static LRESULT CALLBACK subWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
if (uMsg == WM_PAINT) {
|
||||
auto user_data =
|
||||
(SubWindowUserData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if (user_data && user_data->repaint_callback) {
|
||||
user_data->repaint_callback(user_data->repaint_callback_param);
|
||||
}
|
||||
} else if (uMsg == WM_NCDESTROY) {
|
||||
SubWindowUserData* user_data =
|
||||
(SubWindowUserData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
delete user_data;
|
||||
}
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
||||
int x, int y,int width, int height,
|
||||
SubWindowRepaintCallback repaint_callback,
|
||||
void* repaint_callback_param){
|
||||
static const char className[] = "subWin";
|
||||
|
||||
WNDCLASS wc = {};
|
||||
if (!GetClassInfo(GetModuleHandle(NULL), className, &wc)) {
|
||||
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;// redraw if size changes
|
||||
wc.lpfnWndProc = &subWindowProc; // points to window procedure
|
||||
wc.cbWndExtra = sizeof(void*) ; // save extra window memory
|
||||
wc.lpszClassName = className; // name of window class
|
||||
RegisterClass(&wc);
|
||||
}
|
||||
|
||||
EGLNativeWindowType ret = CreateWindowEx(
|
||||
WS_EX_NOPARENTNOTIFY, // do not bother our parent window
|
||||
className,
|
||||
"sub",
|
||||
WS_CHILD|WS_DISABLED,
|
||||
x,y,width,height,
|
||||
p_window,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
auto user_data = new SubWindowUserData();
|
||||
user_data->repaint_callback = repaint_callback;
|
||||
user_data->repaint_callback_param = repaint_callback_param;
|
||||
|
||||
SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR)user_data);
|
||||
ShowWindow(ret, SW_SHOW);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void destroySubWindow(EGLNativeWindowType win){
|
||||
PostMessage(win, WM_CLOSE, 0, 0);
|
||||
}
|
||||
|
||||
int moveSubWindow(FBNativeWindowType p_parent_window,
|
||||
EGLNativeWindowType p_sub_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height) {
|
||||
BOOL ret = MoveWindow(p_sub_window,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
TRUE);
|
||||
return ret;
|
||||
}
|
||||
105
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_x11.cpp
vendored
Normal file
105
external/android-emugl/host/libs/libOpenglRender/NativeSubWindow_x11.cpp
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "NativeSubWindow.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static Bool WaitForMapNotify(Display *d, XEvent *e, char *arg) {
|
||||
if (e->type == MapNotify && e->xmap.window == (Window)arg) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Bool WaitForConfigureNotify(Display *d, XEvent *e, char *arg) {
|
||||
if (e->type == ConfigureNotify && e->xmap.window == (Window)arg) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Display *s_display = NULL;
|
||||
|
||||
EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
SubWindowRepaintCallback repaint_callback,
|
||||
void* repaint_callback_param) {
|
||||
// The call to this function is protected by a lock
|
||||
// in FrameBuffer so it is safe to check and initialize s_display here
|
||||
if (!s_display) {
|
||||
s_display = XOpenDisplay(NULL);
|
||||
}
|
||||
|
||||
XSetWindowAttributes wa;
|
||||
wa.event_mask = StructureNotifyMask;
|
||||
wa.override_redirect = True;
|
||||
Window win = XCreateWindow(s_display,
|
||||
p_window,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
0,
|
||||
CopyFromParent,
|
||||
CopyFromParent,
|
||||
CopyFromParent,
|
||||
CWEventMask,
|
||||
&wa);
|
||||
XMapWindow(s_display,win);
|
||||
XSetWindowBackground(s_display, win, BlackPixel(s_display, 0));
|
||||
XEvent e;
|
||||
XIfEvent(s_display, &e, WaitForMapNotify, (char *)win);
|
||||
return win;
|
||||
}
|
||||
|
||||
void destroySubWindow(EGLNativeWindowType win) {
|
||||
if (!s_display) {
|
||||
return;
|
||||
}
|
||||
XDestroyWindow(s_display, win);
|
||||
}
|
||||
|
||||
int moveSubWindow(FBNativeWindowType p_parent_window,
|
||||
EGLNativeWindowType p_sub_window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height) {
|
||||
// This value is set during create, so if it is still null, simply
|
||||
// return because the global state is corrupted
|
||||
if (!s_display) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// This prevents flicker on resize.
|
||||
XSetWindowBackgroundPixmap(s_display, p_sub_window, None);
|
||||
|
||||
int ret = XMoveResizeWindow(
|
||||
s_display,
|
||||
p_sub_window,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height);
|
||||
|
||||
XEvent e;
|
||||
XIfEvent(s_display, &e, WaitForConfigureNotify, (char *)p_sub_window);
|
||||
|
||||
return ret;
|
||||
}
|
||||
74
external/android-emugl/host/libs/libOpenglRender/ReadBuffer.cpp
vendored
Normal file
74
external/android-emugl/host/libs/libOpenglRender/ReadBuffer.cpp
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "ReadBuffer.h"
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include "ErrorLog.h"
|
||||
|
||||
ReadBuffer::ReadBuffer(size_t bufsize)
|
||||
{
|
||||
m_size = bufsize;
|
||||
m_buf = (unsigned char*)malloc(m_size*sizeof(unsigned char));
|
||||
m_validData = 0;
|
||||
m_readPtr = m_buf;
|
||||
}
|
||||
|
||||
ReadBuffer::~ReadBuffer()
|
||||
{
|
||||
free(m_buf);
|
||||
}
|
||||
|
||||
int ReadBuffer::getData(IOStream *stream)
|
||||
{
|
||||
if(stream == NULL)
|
||||
return -1;
|
||||
if ((m_validData > 0) && (m_readPtr > m_buf)) {
|
||||
memmove(m_buf, m_readPtr, m_validData);
|
||||
}
|
||||
// get fresh data into the buffer;
|
||||
size_t len = m_size - m_validData;
|
||||
if (len==0) {
|
||||
//we need to inc our buffer
|
||||
size_t new_size = m_size*2;
|
||||
unsigned char* new_buf;
|
||||
if (new_size < m_size) { // overflow check
|
||||
new_size = INT_MAX;
|
||||
}
|
||||
|
||||
new_buf = (unsigned char*)realloc(m_buf, new_size);
|
||||
if (!new_buf) {
|
||||
ERR("Failed to alloc %zu bytes for ReadBuffer\n", new_size);
|
||||
return -1;
|
||||
}
|
||||
m_size = new_size;
|
||||
m_buf = new_buf;
|
||||
len = m_size - m_validData;
|
||||
}
|
||||
m_readPtr = m_buf;
|
||||
if (NULL != stream->read(m_buf + m_validData, &len)) {
|
||||
m_validData += len;
|
||||
return len;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ReadBuffer::consume(size_t amount)
|
||||
{
|
||||
assert(amount <= m_validData);
|
||||
m_validData -= amount;
|
||||
m_readPtr += amount;
|
||||
}
|
||||
35
external/android-emugl/host/libs/libOpenglRender/ReadBuffer.h
vendored
Normal file
35
external/android-emugl/host/libs/libOpenglRender/ReadBuffer.h
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _READ_BUFFER_H
|
||||
#define _READ_BUFFER_H
|
||||
|
||||
#include "IOStream.h"
|
||||
|
||||
class ReadBuffer {
|
||||
public:
|
||||
ReadBuffer(size_t bufSize);
|
||||
~ReadBuffer();
|
||||
int getData(IOStream *stream); // get fresh data from the stream
|
||||
unsigned char *buf() { return m_readPtr; } // return the next read location
|
||||
size_t validData() { return m_validData; } // return the amount of valid data in readptr
|
||||
void consume(size_t amount); // notify that 'amount' data has been consumed;
|
||||
private:
|
||||
unsigned char *m_buf;
|
||||
unsigned char *m_readPtr;
|
||||
size_t m_size;
|
||||
size_t m_validData;
|
||||
};
|
||||
#endif
|
||||
49
external/android-emugl/host/libs/libOpenglRender/RenderContext.cpp
vendored
Normal file
49
external/android-emugl/host/libs/libOpenglRender/RenderContext.cpp
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "RenderContext.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
RenderContext* RenderContext::create(EGLDisplay display,
|
||||
EGLConfig config,
|
||||
EGLContext sharedContext,
|
||||
bool isGl2) {
|
||||
const EGLint contextAttribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, isGl2 ? 2 : 1,
|
||||
EGL_NONE
|
||||
};
|
||||
EGLContext context = s_egl.eglCreateContext(
|
||||
display, config, sharedContext, contextAttribs);
|
||||
if (context == EGL_NO_CONTEXT) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new RenderContext(display, context, isGl2);
|
||||
}
|
||||
|
||||
RenderContext::RenderContext(EGLDisplay display,
|
||||
EGLContext context,
|
||||
bool isGl2) :
|
||||
mDisplay(display),
|
||||
mContext(context),
|
||||
mIsGl2(isGl2),
|
||||
mContextData() {}
|
||||
|
||||
RenderContext::~RenderContext() {
|
||||
if (mContext != EGL_NO_CONTEXT) {
|
||||
s_egl.eglDestroyContext(mDisplay, mContext);
|
||||
}
|
||||
}
|
||||
69
external/android-emugl/host/libs/libOpenglRender/RenderContext.h
vendored
Normal file
69
external/android-emugl/host/libs/libOpenglRender/RenderContext.h
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _LIBRENDER_RENDER_CONTEXT_H
|
||||
#define _LIBRENDER_RENDER_CONTEXT_H
|
||||
|
||||
#include "emugl/common/smart_ptr.h"
|
||||
#include "GLDecoderContextData.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
// A class used to model a guest EGLContext. This simply wraps a host
|
||||
// EGLContext, associated with an GLDecoderContextData instance that is
|
||||
// used to store copies of guest-side arrays.
|
||||
class RenderContext {
|
||||
public:
|
||||
// Create a new RenderContext instance.
|
||||
// |display| is the host EGLDisplay handle.
|
||||
// |config| is the host EGLConfig to use.
|
||||
// |sharedContext| is either EGL_NO_CONTEXT of a host EGLContext handle.
|
||||
// |isGl2| is true iff the new context will be used with GLESv2, or
|
||||
// GLESv1 otherwise.
|
||||
static RenderContext *create(EGLDisplay display,
|
||||
EGLConfig config,
|
||||
EGLContext sharedContext,
|
||||
bool isGL2 = false);
|
||||
|
||||
// Destructor.
|
||||
~RenderContext();
|
||||
|
||||
// Retrieve host EGLContext value.
|
||||
EGLContext getEGLContext() const { return mContext; }
|
||||
|
||||
// Return true iff this is a GLESv2 context.
|
||||
bool isGL2() const { return mIsGl2; }
|
||||
|
||||
// Retrieve GLDecoderContextData instance reference for this
|
||||
// RenderContext instance.
|
||||
GLDecoderContextData& decoderContextData() { return mContextData; }
|
||||
|
||||
private:
|
||||
RenderContext();
|
||||
|
||||
RenderContext(EGLDisplay display,
|
||||
EGLContext context,
|
||||
bool isGl2);
|
||||
|
||||
private:
|
||||
EGLDisplay mDisplay;
|
||||
EGLContext mContext;
|
||||
bool mIsGl2;
|
||||
GLDecoderContextData mContextData;
|
||||
};
|
||||
|
||||
typedef emugl::SmartPtr<RenderContext> RenderContextPtr;
|
||||
|
||||
#endif // _LIBRENDER_RENDER_CONTEXT_H
|
||||
417
external/android-emugl/host/libs/libOpenglRender/RenderControl.cpp
vendored
Normal file
417
external/android-emugl/host/libs/libOpenglRender/RenderControl.cpp
vendored
Normal file
|
|
@ -0,0 +1,417 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "RenderControl.h"
|
||||
|
||||
#include "DispatchTables.h"
|
||||
#include "FbConfig.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "RenderThreadInfo.h"
|
||||
#include "ChecksumCalculatorThreadInfo.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
static const GLint rendererVersion = 1;
|
||||
|
||||
static GLint rcGetRendererVersion()
|
||||
{
|
||||
return rendererVersion;
|
||||
}
|
||||
|
||||
static EGLint rcGetEGLVersion(EGLint* major, EGLint* minor)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
*major = (EGLint)fb->getCaps().eglMajor;
|
||||
*minor = (EGLint)fb->getCaps().eglMinor;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *str = s_egl.eglQueryString(fb->getDisplay(), name);
|
||||
if (!str) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int len = strlen(str) + 1;
|
||||
if (!buffer || len > bufferSize) {
|
||||
return -len;
|
||||
}
|
||||
|
||||
strcpy((char *)buffer, str);
|
||||
return len;
|
||||
}
|
||||
|
||||
static EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize)
|
||||
{
|
||||
RenderThreadInfo *tInfo = RenderThreadInfo::get();
|
||||
const char *str = NULL;
|
||||
int len = 0;
|
||||
if (tInfo && tInfo->currContext.Ptr()) {
|
||||
if (tInfo->currContext->isGL2()) {
|
||||
str = (const char *)s_gles2.glGetString(name);
|
||||
}
|
||||
else {
|
||||
str = (const char *)s_gles1.glGetString(name);
|
||||
}
|
||||
if (str) {
|
||||
len = strlen(str) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// We add the maximum supported GL protocol number into GL_EXTENSIONS
|
||||
const char* glProtocolStr = NULL;
|
||||
if (name == GL_EXTENSIONS) {
|
||||
glProtocolStr = ChecksumCalculatorThreadInfo::getMaxVersionString();
|
||||
if (len==0) len = 1; // the last byte
|
||||
len += strlen(glProtocolStr) + 1;
|
||||
}
|
||||
|
||||
if (!buffer || len > bufferSize) {
|
||||
return -len;
|
||||
}
|
||||
|
||||
if (name == GL_EXTENSIONS) {
|
||||
snprintf((char *)buffer, bufferSize, "%s%s ", str ? str : "", glProtocolStr);
|
||||
} else if (str) {
|
||||
strcpy((char *)buffer, str);
|
||||
} else {
|
||||
if (bufferSize >= 1) {
|
||||
((char*)buffer)[0] = '\0';
|
||||
}
|
||||
len = 0;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
static EGLint rcGetNumConfigs(uint32_t* p_numAttribs)
|
||||
{
|
||||
int numConfigs = 0, numAttribs = 0;
|
||||
|
||||
FrameBuffer::getFB()->getConfigs()->getPackInfo(&numConfigs, &numAttribs);
|
||||
if (p_numAttribs) {
|
||||
*p_numAttribs = static_cast<uint32_t>(numAttribs);
|
||||
}
|
||||
return numConfigs;
|
||||
}
|
||||
|
||||
static EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer)
|
||||
{
|
||||
GLuint bufferSize = (GLuint)bufSize;
|
||||
return FrameBuffer::getFB()->getConfigs()->packConfigs(bufferSize, buffer);
|
||||
}
|
||||
|
||||
static EGLint rcChooseConfig(EGLint *attribs,
|
||||
uint32_t attribs_size,
|
||||
uint32_t *configs,
|
||||
uint32_t configs_size)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb || attribs_size==0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fb->getConfigs()->chooseConfig(
|
||||
attribs, (EGLint*)configs, (EGLint)configs_size);
|
||||
}
|
||||
|
||||
static EGLint rcGetFBParam(EGLint param)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
EGLint ret = 0;
|
||||
|
||||
switch(param) {
|
||||
case FB_WIDTH:
|
||||
ret = fb->getWidth();
|
||||
break;
|
||||
case FB_HEIGHT:
|
||||
ret = fb->getHeight();
|
||||
break;
|
||||
case FB_XDPI:
|
||||
ret = 72; // XXX: should be implemented
|
||||
break;
|
||||
case FB_YDPI:
|
||||
ret = 72; // XXX: should be implemented
|
||||
break;
|
||||
case FB_FPS:
|
||||
ret = 60;
|
||||
break;
|
||||
case FB_MIN_SWAP_INTERVAL:
|
||||
ret = 1; // XXX: should be implemented
|
||||
break;
|
||||
case FB_MAX_SWAP_INTERVAL:
|
||||
ret = 1; // XXX: should be implemented
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint32_t rcCreateContext(uint32_t config,
|
||||
uint32_t share, uint32_t glVersion)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// To make it consistent with the guest, create GLES2 context when GL
|
||||
// version==2 or 3
|
||||
HandleType ret = fb->createRenderContext(config, share, glVersion == 2 || glVersion == 3);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rcDestroyContext(uint32_t context)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
|
||||
fb->DestroyRenderContext(context);
|
||||
}
|
||||
|
||||
static uint32_t rcCreateWindowSurface(uint32_t config,
|
||||
uint32_t width, uint32_t height)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fb->createWindowSurface(config, width, height);
|
||||
}
|
||||
|
||||
static void rcDestroyWindowSurface(uint32_t windowSurface)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
|
||||
fb->DestroyWindowSurface( windowSurface );
|
||||
}
|
||||
|
||||
static uint32_t rcCreateColorBuffer(uint32_t width,
|
||||
uint32_t height, GLenum internalFormat)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fb->createColorBuffer(width, height, internalFormat);
|
||||
}
|
||||
|
||||
static int rcOpenColorBuffer2(uint32_t colorbuffer)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return -1;
|
||||
}
|
||||
return fb->openColorBuffer( colorbuffer );
|
||||
}
|
||||
|
||||
// Deprecated, kept for compatibility with old system images only.
|
||||
// Use rcOpenColorBuffer2 instead.
|
||||
static void rcOpenColorBuffer(uint32_t colorbuffer)
|
||||
{
|
||||
(void) rcOpenColorBuffer2(colorbuffer);
|
||||
}
|
||||
|
||||
static void rcCloseColorBuffer(uint32_t colorbuffer)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
fb->closeColorBuffer( colorbuffer );
|
||||
}
|
||||
|
||||
static int rcFlushWindowColorBuffer(uint32_t windowSurface)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return -1;
|
||||
}
|
||||
if (!fb->flushWindowSurfaceColorBuffer(windowSurface)) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rcSetWindowColorBuffer(uint32_t windowSurface,
|
||||
uint32_t colorBuffer)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
fb->setWindowSurfaceColorBuffer(windowSurface, colorBuffer);
|
||||
}
|
||||
|
||||
static EGLint rcMakeCurrent(uint32_t context,
|
||||
uint32_t drawSurf, uint32_t readSurf)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
bool ret = fb->bindContext(context, drawSurf, readSurf);
|
||||
|
||||
return (ret ? EGL_TRUE : EGL_FALSE);
|
||||
}
|
||||
|
||||
static void rcFBPost(uint32_t colorBuffer)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
|
||||
fb->post(colorBuffer);
|
||||
}
|
||||
|
||||
static void rcFBSetSwapInterval(EGLint interval)
|
||||
{
|
||||
// XXX: TBD - should be implemented
|
||||
}
|
||||
|
||||
static void rcBindTexture(uint32_t colorBuffer)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
|
||||
fb->bindColorBufferToTexture(colorBuffer);
|
||||
}
|
||||
|
||||
static void rcBindRenderbuffer(uint32_t colorBuffer)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
|
||||
fb->bindColorBufferToRenderbuffer(colorBuffer);
|
||||
}
|
||||
|
||||
static EGLint rcColorBufferCacheFlush(uint32_t colorBuffer,
|
||||
EGLint postCount, int forRead)
|
||||
{
|
||||
// XXX: TBD - should be implemented
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rcReadColorBuffer(uint32_t colorBuffer,
|
||||
GLint x, GLint y,
|
||||
GLint width, GLint height,
|
||||
GLenum format, GLenum type, void* pixels)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
|
||||
fb->readColorBuffer(colorBuffer, x, y, width, height, format, type, pixels);
|
||||
}
|
||||
|
||||
static int rcUpdateColorBuffer(uint32_t colorBuffer,
|
||||
GLint x, GLint y,
|
||||
GLint width, GLint height,
|
||||
GLenum format, GLenum type, void* pixels)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fb->updateColorBuffer(colorBuffer, x, y, width, height, format, type, pixels);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t rcCreateClientImage(uint32_t context, EGLenum target, GLuint buffer)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fb->createClientImage(context, target, buffer);
|
||||
}
|
||||
|
||||
static int rcDestroyClientImage(uint32_t image)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fb->destroyClientImage(image);
|
||||
}
|
||||
|
||||
static void rcSelectChecksumCalculator(uint32_t protocol, uint32_t reserved) {
|
||||
ChecksumCalculatorThreadInfo::setVersion(protocol);
|
||||
}
|
||||
|
||||
void initRenderControlContext(renderControl_decoder_context_t *dec)
|
||||
{
|
||||
dec->rcGetRendererVersion = rcGetRendererVersion;
|
||||
dec->rcGetEGLVersion = rcGetEGLVersion;
|
||||
dec->rcQueryEGLString = rcQueryEGLString;
|
||||
dec->rcGetGLString = rcGetGLString;
|
||||
dec->rcGetNumConfigs = rcGetNumConfigs;
|
||||
dec->rcGetConfigs = rcGetConfigs;
|
||||
dec->rcChooseConfig = rcChooseConfig;
|
||||
dec->rcGetFBParam = rcGetFBParam;
|
||||
dec->rcCreateContext = rcCreateContext;
|
||||
dec->rcDestroyContext = rcDestroyContext;
|
||||
dec->rcCreateWindowSurface = rcCreateWindowSurface;
|
||||
dec->rcDestroyWindowSurface = rcDestroyWindowSurface;
|
||||
dec->rcCreateColorBuffer = rcCreateColorBuffer;
|
||||
dec->rcOpenColorBuffer = rcOpenColorBuffer;
|
||||
dec->rcCloseColorBuffer = rcCloseColorBuffer;
|
||||
dec->rcSetWindowColorBuffer = rcSetWindowColorBuffer;
|
||||
dec->rcFlushWindowColorBuffer = rcFlushWindowColorBuffer;
|
||||
dec->rcMakeCurrent = rcMakeCurrent;
|
||||
dec->rcFBPost = rcFBPost;
|
||||
dec->rcFBSetSwapInterval = rcFBSetSwapInterval;
|
||||
dec->rcBindTexture = rcBindTexture;
|
||||
dec->rcBindRenderbuffer = rcBindRenderbuffer;
|
||||
dec->rcColorBufferCacheFlush = rcColorBufferCacheFlush;
|
||||
dec->rcReadColorBuffer = rcReadColorBuffer;
|
||||
dec->rcUpdateColorBuffer = rcUpdateColorBuffer;
|
||||
dec->rcOpenColorBuffer2 = rcOpenColorBuffer2;
|
||||
dec->rcCreateClientImage = rcCreateClientImage;
|
||||
dec->rcDestroyClientImage = rcDestroyClientImage;
|
||||
dec->rcSelectChecksumCalculator = rcSelectChecksumCalculator;
|
||||
}
|
||||
23
external/android-emugl/host/libs/libOpenglRender/RenderControl.h
vendored
Normal file
23
external/android-emugl/host/libs/libOpenglRender/RenderControl.h
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _RENDER_CONTROL_H
|
||||
#define _RENDER_CONTROL_H
|
||||
|
||||
#include "renderControl_dec.h"
|
||||
|
||||
void initRenderControlContext(renderControl_decoder_context_t *dec);
|
||||
|
||||
#endif
|
||||
170
external/android-emugl/host/libs/libOpenglRender/RenderServer.cpp
vendored
Normal file
170
external/android-emugl/host/libs/libOpenglRender/RenderServer.cpp
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "RenderServer.h"
|
||||
|
||||
#include "RenderThread.h"
|
||||
#include "TcpStream.h"
|
||||
#ifndef _WIN32
|
||||
#include "UnixStream.h"
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include "Win32PipeStream.h"
|
||||
#endif
|
||||
|
||||
#include "OpenglRender/render_api.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef std::set<RenderThread *> RenderThreadsSet;
|
||||
|
||||
RenderServer::RenderServer() :
|
||||
m_lock(),
|
||||
m_listenSock(NULL),
|
||||
m_exiting(false)
|
||||
{
|
||||
}
|
||||
|
||||
RenderServer::~RenderServer()
|
||||
{
|
||||
delete m_listenSock;
|
||||
}
|
||||
|
||||
|
||||
extern "C" int gRendererStreamMode;
|
||||
|
||||
RenderServer *RenderServer::create(char* addr, size_t addrLen)
|
||||
{
|
||||
RenderServer *server = new RenderServer();
|
||||
if (!server) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (gRendererStreamMode == RENDER_API_STREAM_MODE_TCP) {
|
||||
server->m_listenSock = new TcpStream();
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
server->m_listenSock = new Win32PipeStream();
|
||||
#else
|
||||
server->m_listenSock = new UnixStream();
|
||||
#endif
|
||||
}
|
||||
|
||||
char addrstr[SocketStream::MAX_ADDRSTR_LEN];
|
||||
if (server->m_listenSock->listen(addrstr) < 0) {
|
||||
ERR("RenderServer::create failed to listen\n");
|
||||
delete server;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t len = strlen(addrstr) + 1;
|
||||
if (len > addrLen) {
|
||||
ERR("RenderServer address name too big for provided buffer: %zu > %zu\n",
|
||||
len, addrLen);
|
||||
delete server;
|
||||
return NULL;
|
||||
}
|
||||
memcpy(addr, addrstr, len);
|
||||
|
||||
return server;
|
||||
}
|
||||
|
||||
intptr_t RenderServer::main()
|
||||
{
|
||||
RenderThreadsSet threads;
|
||||
|
||||
#ifndef _WIN32
|
||||
sigset_t set;
|
||||
sigfillset(&set);
|
||||
pthread_sigmask(SIG_SETMASK, &set, NULL);
|
||||
#endif
|
||||
|
||||
while(1) {
|
||||
SocketStream *stream = m_listenSock->accept();
|
||||
if (!stream) {
|
||||
fprintf(stderr,"Error accepting gles connection, ignoring.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned int clientFlags;
|
||||
if (!stream->readFully(&clientFlags, sizeof(unsigned int))) {
|
||||
fprintf(stderr,"Error reading clientFlags\n");
|
||||
delete stream;
|
||||
continue;
|
||||
}
|
||||
|
||||
DBG("RenderServer: Got new stream!\n");
|
||||
|
||||
// check if we have been requested to exit while waiting on accept
|
||||
if ((clientFlags & IOSTREAM_CLIENT_EXIT_SERVER) != 0) {
|
||||
m_exiting = true;
|
||||
delete stream;
|
||||
break;
|
||||
}
|
||||
|
||||
RenderThread *rt = RenderThread::create(stream, &m_lock);
|
||||
if (!rt) {
|
||||
fprintf(stderr,"Failed to create RenderThread\n");
|
||||
delete stream;
|
||||
} else if (!rt->start()) {
|
||||
fprintf(stderr,"Failed to start RenderThread\n");
|
||||
delete rt;
|
||||
delete stream;
|
||||
}
|
||||
|
||||
//
|
||||
// remove from the threads list threads which are
|
||||
// no longer running
|
||||
//
|
||||
for (RenderThreadsSet::iterator n,t = threads.begin();
|
||||
t != threads.end();
|
||||
t = n) {
|
||||
// first find next iterator
|
||||
n = t;
|
||||
n++;
|
||||
|
||||
// delete and erase the current iterator
|
||||
// if thread is no longer running
|
||||
if ((*t)->isFinished()) {
|
||||
delete (*t);
|
||||
threads.erase(t);
|
||||
}
|
||||
}
|
||||
|
||||
// if the thread has been created and started, insert it to the list
|
||||
if (rt) {
|
||||
threads.insert(rt);
|
||||
DBG("Started new RenderThread\n");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Wait for all threads to finish
|
||||
//
|
||||
for (RenderThreadsSet::iterator t = threads.begin();
|
||||
t != threads.end();
|
||||
t++) {
|
||||
(*t)->forceStop();
|
||||
(*t)->wait(NULL);
|
||||
delete (*t);
|
||||
}
|
||||
threads.clear();
|
||||
|
||||
return 0;
|
||||
}
|
||||
42
external/android-emugl/host/libs/libOpenglRender/RenderServer.h
vendored
Normal file
42
external/android-emugl/host/libs/libOpenglRender/RenderServer.h
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _LIB_OPENGL_RENDER_RENDER_SERVER_H
|
||||
#define _LIB_OPENGL_RENDER_RENDER_SERVER_H
|
||||
|
||||
#include "SocketStream.h"
|
||||
#include "emugl/common/mutex.h"
|
||||
#include "emugl/common/thread.h"
|
||||
|
||||
class RenderServer : public emugl::Thread
|
||||
{
|
||||
public:
|
||||
static RenderServer *create(char* addr, size_t addrLen);
|
||||
virtual ~RenderServer();
|
||||
|
||||
virtual intptr_t main();
|
||||
|
||||
bool isExiting() const { return m_exiting; }
|
||||
|
||||
private:
|
||||
RenderServer();
|
||||
|
||||
private:
|
||||
emugl::Mutex m_lock;
|
||||
SocketStream *m_listenSock;
|
||||
bool m_exiting;
|
||||
};
|
||||
|
||||
#endif
|
||||
165
external/android-emugl/host/libs/libOpenglRender/RenderThread.cpp
vendored
Normal file
165
external/android-emugl/host/libs/libOpenglRender/RenderThread.cpp
vendored
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "RenderThread.h"
|
||||
|
||||
#include "FrameBuffer.h"
|
||||
#include "ReadBuffer.h"
|
||||
#include "RenderControl.h"
|
||||
#include "RenderThreadInfo.h"
|
||||
#include "TimeUtils.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
#include "OpenGLESDispatch/GLESv2Dispatch.h"
|
||||
#include "OpenGLESDispatch/GLESv1Dispatch.h"
|
||||
#include "../../../shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h"
|
||||
|
||||
#define STREAM_BUFFER_SIZE 4*1024*1024
|
||||
|
||||
RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock) :
|
||||
emugl::Thread(),
|
||||
m_lock(lock),
|
||||
m_stream(stream) {}
|
||||
|
||||
RenderThread::~RenderThread() {
|
||||
delete m_stream;
|
||||
}
|
||||
|
||||
// static
|
||||
RenderThread* RenderThread::create(IOStream *stream, emugl::Mutex *lock) {
|
||||
return new RenderThread(stream, lock);
|
||||
}
|
||||
|
||||
void RenderThread::forceStop() {
|
||||
m_stream->forceStop();
|
||||
}
|
||||
|
||||
intptr_t RenderThread::main() {
|
||||
RenderThreadInfo tInfo;
|
||||
ChecksumCalculatorThreadInfo tChecksumInfo;
|
||||
|
||||
//
|
||||
// initialize decoders
|
||||
//
|
||||
tInfo.m_glDec.initGL(gles1_dispatch_get_proc_func, NULL);
|
||||
tInfo.m_gl2Dec.initGL(gles2_dispatch_get_proc_func, NULL);
|
||||
initRenderControlContext(&tInfo.m_rcDec);
|
||||
|
||||
ReadBuffer readBuf(STREAM_BUFFER_SIZE);
|
||||
|
||||
int stats_totalBytes = 0;
|
||||
long long stats_t0 = GetCurrentTimeMS();
|
||||
|
||||
//
|
||||
// open dump file if RENDER_DUMP_DIR is defined
|
||||
//
|
||||
const char *dump_dir = getenv("RENDERER_DUMP_DIR");
|
||||
FILE *dumpFP = NULL;
|
||||
if (dump_dir) {
|
||||
size_t bsize = strlen(dump_dir) + 32;
|
||||
char *fname = new char[bsize];
|
||||
snprintf(fname,bsize,"%s/stream_%p", dump_dir, this);
|
||||
dumpFP = fopen(fname, "wb");
|
||||
if (!dumpFP) {
|
||||
fprintf(stderr,"Warning: stream dump failed to open file %s\n",fname);
|
||||
}
|
||||
delete [] fname;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
||||
int stat = readBuf.getData(m_stream);
|
||||
if (stat <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// log received bandwidth statistics
|
||||
//
|
||||
stats_totalBytes += readBuf.validData();
|
||||
long long dt = GetCurrentTimeMS() - stats_t0;
|
||||
if (dt > 1000) {
|
||||
float dts = (float)dt / 1000.0f;
|
||||
printf("Used Bandwidth %5.3f MB/s\n", ((float)stats_totalBytes / dts) / (1024.0f*1024.0f));
|
||||
stats_totalBytes = 0;
|
||||
stats_t0 = GetCurrentTimeMS();
|
||||
}
|
||||
|
||||
//
|
||||
// dump stream to file if needed
|
||||
//
|
||||
if (dumpFP) {
|
||||
int skip = readBuf.validData() - stat;
|
||||
fwrite(readBuf.buf()+skip, 1, readBuf.validData()-skip, dumpFP);
|
||||
fflush(dumpFP);
|
||||
}
|
||||
|
||||
bool progress;
|
||||
do {
|
||||
progress = false;
|
||||
|
||||
m_lock->lock();
|
||||
//
|
||||
// try to process some of the command buffer using the GLESv1 decoder
|
||||
//
|
||||
size_t last = tInfo.m_glDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||
if (last > 0) {
|
||||
progress = true;
|
||||
readBuf.consume(last);
|
||||
}
|
||||
|
||||
//
|
||||
// try to process some of the command buffer using the GLESv2 decoder
|
||||
//
|
||||
last = tInfo.m_gl2Dec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||
if (last > 0) {
|
||||
progress = true;
|
||||
readBuf.consume(last);
|
||||
}
|
||||
|
||||
//
|
||||
// try to process some of the command buffer using the
|
||||
// renderControl decoder
|
||||
//
|
||||
last = tInfo.m_rcDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||
if (last > 0) {
|
||||
readBuf.consume(last);
|
||||
progress = true;
|
||||
}
|
||||
|
||||
m_lock->unlock();
|
||||
|
||||
} while( progress );
|
||||
|
||||
}
|
||||
|
||||
if (dumpFP) {
|
||||
fclose(dumpFP);
|
||||
}
|
||||
|
||||
//
|
||||
// Release references to the current thread's context/surfaces if any
|
||||
//
|
||||
FrameBuffer::getFB()->bindContext(0, 0, 0);
|
||||
if (tInfo.currContext || tInfo.currDrawSurf || tInfo.currReadSurf) {
|
||||
fprintf(stderr, "ERROR: RenderThread exiting with current context/surfaces\n");
|
||||
}
|
||||
|
||||
FrameBuffer::getFB()->drainWindowSurface();
|
||||
|
||||
FrameBuffer::getFB()->drainRenderContext();
|
||||
|
||||
return 0;
|
||||
}
|
||||
58
external/android-emugl/host/libs/libOpenglRender/RenderThread.h
vendored
Normal file
58
external/android-emugl/host/libs/libOpenglRender/RenderThread.h
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _LIB_OPENGL_RENDER_RENDER_THREAD_H
|
||||
#define _LIB_OPENGL_RENDER_RENDER_THREAD_H
|
||||
|
||||
#include "IOStream.h"
|
||||
|
||||
#include "emugl/common/mutex.h"
|
||||
#include "emugl/common/thread.h"
|
||||
|
||||
// A class used to model a thread of the RenderServer. Each one of them
|
||||
// handles a single guest client / protocol byte stream.
|
||||
class RenderThread : public emugl::Thread {
|
||||
public:
|
||||
// Create a new RenderThread instance.
|
||||
// |stream| is an input stream that will be read from the thread,
|
||||
// and deleted by it when it exits.
|
||||
// |mutex| is a pointer to a shared mutex used to serialize
|
||||
// decoding operations between all threads.
|
||||
// TODO(digit): Why is this needed here? Shouldn't this be handled
|
||||
// by the decoders themselves or at a lower-level?
|
||||
static RenderThread* create(IOStream* stream, emugl::Mutex* mutex);
|
||||
|
||||
// Destructor.
|
||||
virtual ~RenderThread();
|
||||
|
||||
// Returns true iff the thread has finished.
|
||||
// Note that this also means that the thread's stack has been
|
||||
bool isFinished() { return tryWait(NULL); }
|
||||
|
||||
// Force a thread to stop.
|
||||
void forceStop();
|
||||
|
||||
private:
|
||||
RenderThread(); // No default constructor
|
||||
|
||||
RenderThread(IOStream* stream, emugl::Mutex* mutex);
|
||||
|
||||
virtual intptr_t main();
|
||||
|
||||
emugl::Mutex* m_lock;
|
||||
IOStream* m_stream;
|
||||
};
|
||||
|
||||
#endif
|
||||
43
external/android-emugl/host/libs/libOpenglRender/RenderThreadInfo.cpp
vendored
Normal file
43
external/android-emugl/host/libs/libOpenglRender/RenderThreadInfo.cpp
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "RenderThreadInfo.h"
|
||||
|
||||
#include "emugl/common/lazy_instance.h"
|
||||
#include "emugl/common/thread_store.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ThreadInfoStore : public ::emugl::ThreadStore {
|
||||
public:
|
||||
ThreadInfoStore() : ::emugl::ThreadStore(NULL) {}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static ::emugl::LazyInstance<ThreadInfoStore> s_tls = LAZY_INSTANCE_INIT;
|
||||
|
||||
RenderThreadInfo::RenderThreadInfo() {
|
||||
s_tls->set(this);
|
||||
}
|
||||
|
||||
RenderThreadInfo::~RenderThreadInfo() {
|
||||
s_tls->set(NULL);
|
||||
}
|
||||
|
||||
RenderThreadInfo* RenderThreadInfo::get() {
|
||||
return static_cast<RenderThreadInfo*>(s_tls->get());
|
||||
}
|
||||
60
external/android-emugl/host/libs/libOpenglRender/RenderThreadInfo.h
vendored
Normal file
60
external/android-emugl/host/libs/libOpenglRender/RenderThreadInfo.h
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _LIB_OPENGL_RENDER_THREAD_INFO_H
|
||||
#define _LIB_OPENGL_RENDER_THREAD_INFO_H
|
||||
|
||||
#include "RenderContext.h"
|
||||
#include "WindowSurface.h"
|
||||
#include "GLESv1Decoder.h"
|
||||
#include "GLESv2Decoder.h"
|
||||
#include "renderControl_dec.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
typedef uint32_t HandleType;
|
||||
typedef std::set<HandleType> ThreadContextSet;
|
||||
typedef std::set<HandleType> WindowSurfaceSet;
|
||||
|
||||
// A class used to model the state of each RenderThread related
|
||||
struct RenderThreadInfo {
|
||||
// Create new instance. Only call this once per thread.
|
||||
// Future callls to get() will return this instance until
|
||||
// it is destroyed.
|
||||
RenderThreadInfo();
|
||||
|
||||
// Destructor.
|
||||
~RenderThreadInfo();
|
||||
|
||||
// Return the current thread's instance, if any, or NULL.
|
||||
static RenderThreadInfo* get();
|
||||
|
||||
// Current EGL context, draw surface and read surface.
|
||||
RenderContextPtr currContext;
|
||||
WindowSurfacePtr currDrawSurf;
|
||||
WindowSurfacePtr currReadSurf;
|
||||
|
||||
// Decoder states.
|
||||
GLESv1Decoder m_glDec;
|
||||
GLESv2Decoder m_gl2Dec;
|
||||
renderControl_decoder_context_t m_rcDec;
|
||||
|
||||
// all the contexts that are created by this render thread
|
||||
ThreadContextSet m_contextSet;
|
||||
// all the window surfaces that are created by this render thread
|
||||
WindowSurfaceSet m_windowSet;
|
||||
};
|
||||
|
||||
#endif
|
||||
454
external/android-emugl/host/libs/libOpenglRender/RenderWindow.cpp
vendored
Normal file
454
external/android-emugl/host/libs/libOpenglRender/RenderWindow.cpp
vendored
Normal file
|
|
@ -0,0 +1,454 @@
|
|||
// Copyright 2014-2015 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.
|
||||
|
||||
#include "RenderWindow.h"
|
||||
|
||||
#include "emugl/common/logging.h"
|
||||
#include "emugl/common/message_channel.h"
|
||||
#include "emugl/common/mutex.h"
|
||||
#include "emugl/common/thread.h"
|
||||
#include "FrameBuffer.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#ifndef _WIN32
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
#if DEBUG
|
||||
# define D(...) my_debug(__PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
#else
|
||||
# define D(...) ((void)0)
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
#if DEBUG
|
||||
void my_debug(const char* function, int line, const char* format, ...) {
|
||||
static ::emugl::Mutex mutex;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
mutex.lock();
|
||||
fprintf(stderr, "%s:%d:", function, line);
|
||||
vfprintf(stderr, format, args);
|
||||
mutex.unlock();
|
||||
va_end(args);
|
||||
}
|
||||
#endif
|
||||
|
||||
// List of possible commands to send to the render window thread from
|
||||
// the main one.
|
||||
enum Command {
|
||||
CMD_INITIALIZE,
|
||||
CMD_SET_POST_CALLBACK,
|
||||
CMD_SETUP_SUBWINDOW,
|
||||
CMD_REMOVE_SUBWINDOW,
|
||||
CMD_SET_ROTATION,
|
||||
CMD_SET_TRANSLATION,
|
||||
CMD_REPAINT,
|
||||
CMD_FINALIZE,
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// A single message sent from the main thread to the render window thread.
|
||||
// |cmd| determines which fields are valid to read.
|
||||
struct RenderWindowMessage {
|
||||
Command cmd;
|
||||
union {
|
||||
// CMD_INITIALIZE
|
||||
struct {
|
||||
int width;
|
||||
int height;
|
||||
bool useSubWindow;
|
||||
} init;
|
||||
|
||||
// CMD_SET_POST_CALLBACK
|
||||
struct {
|
||||
OnPostFn on_post;
|
||||
void* on_post_context;
|
||||
} set_post_callback;
|
||||
|
||||
// CMD_SETUP_SUBWINDOW
|
||||
struct {
|
||||
FBNativeWindowType parent;
|
||||
int wx;
|
||||
int wy;
|
||||
int ww;
|
||||
int wh;
|
||||
int fbw;
|
||||
int fbh;
|
||||
float dpr;
|
||||
float rotation;
|
||||
} subwindow;
|
||||
|
||||
// CMD_SET_TRANSLATION;
|
||||
struct {
|
||||
float px;
|
||||
float py;
|
||||
} trans;
|
||||
|
||||
// CMD_SET_ROTATION
|
||||
float rotation;
|
||||
|
||||
// result of operations.
|
||||
bool result;
|
||||
};
|
||||
|
||||
// Process the current message, and updates its |result| field.
|
||||
// Returns true on success, or false on failure.
|
||||
bool process() const {
|
||||
const RenderWindowMessage& msg = *this;
|
||||
FrameBuffer* fb;
|
||||
bool result = false;
|
||||
switch (msg.cmd) {
|
||||
case CMD_INITIALIZE:
|
||||
D("CMD_INITIALIZE w=%d h=%d\n", msg.init.width, msg.init.height);
|
||||
GL_LOG("RenderWindow: CMD_INITIALIZE w=%d h=%d",
|
||||
msg.init.width, msg.init.height);
|
||||
result = FrameBuffer::initialize(msg.init.width,
|
||||
msg.init.height,
|
||||
msg.init.useSubWindow);
|
||||
break;
|
||||
|
||||
case CMD_FINALIZE:
|
||||
D("CMD_FINALIZE\n");
|
||||
// this command may be issued even when frame buffer is not
|
||||
// yet created (e.g. if CMD_INITIALIZE failed),
|
||||
// so make sure we check if it is there before finalizing
|
||||
if (const auto fb = FrameBuffer::getFB()) {
|
||||
fb->finalize();
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
|
||||
case CMD_SET_POST_CALLBACK:
|
||||
D("CMD_SET_POST_CALLBACK\n");
|
||||
fb = FrameBuffer::getFB();
|
||||
fb->setPostCallback(msg.set_post_callback.on_post,
|
||||
msg.set_post_callback.on_post_context);
|
||||
result = true;
|
||||
break;
|
||||
|
||||
case CMD_SETUP_SUBWINDOW:
|
||||
D("CMD_SETUP_SUBWINDOW: parent=%p wx=%d wy=%d ww=%d wh=%d fbw=%d fbh=%d dpr=%f rotation=%f\n",
|
||||
(void*)msg.subwindow.parent,
|
||||
msg.subwindow.wx,
|
||||
msg.subwindow.wy,
|
||||
msg.subwindow.ww,
|
||||
msg.subwindow.wh,
|
||||
msg.subwindow.fbw,
|
||||
msg.subwindow.fbh,
|
||||
msg.subwindow.dpr,
|
||||
msg.subwindow.rotation);
|
||||
result = FrameBuffer::getFB()->setupSubWindow(
|
||||
msg.subwindow.parent,
|
||||
msg.subwindow.wx,
|
||||
msg.subwindow.wy,
|
||||
msg.subwindow.ww,
|
||||
msg.subwindow.wh,
|
||||
msg.subwindow.fbw,
|
||||
msg.subwindow.fbh,
|
||||
msg.subwindow.dpr,
|
||||
msg.subwindow.rotation);
|
||||
break;
|
||||
|
||||
case CMD_REMOVE_SUBWINDOW:
|
||||
D("CMD_REMOVE_SUBWINDOW\n");
|
||||
result = FrameBuffer::getFB()->removeSubWindow();
|
||||
break;
|
||||
|
||||
case CMD_SET_ROTATION:
|
||||
D("CMD_SET_ROTATION rotation=%f\n", msg.rotation);
|
||||
fb = FrameBuffer::getFB();
|
||||
if (fb) {
|
||||
fb->setDisplayRotation(msg.rotation);
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_SET_TRANSLATION:
|
||||
D("CMD_SET_TRANSLATION translation=%f,%f\n", msg.trans.px, msg.trans.py);
|
||||
fb = FrameBuffer::getFB();
|
||||
if (fb) {
|
||||
fb->setDisplayTranslation(msg.trans.px, msg.trans.py);
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_REPAINT:
|
||||
D("CMD_REPAINT\n");
|
||||
fb = FrameBuffer::getFB();
|
||||
if (fb) {
|
||||
fb->repost();
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
// Simple synchronization structure used to exchange data between the
|
||||
// main and render window threads. Usage is the following:
|
||||
//
|
||||
// The main thread does the following in a loop:
|
||||
//
|
||||
// canWriteCmd.wait()
|
||||
// updates |message| by writing a new |cmd| value and appropriate
|
||||
// parameters.
|
||||
// canReadCmd.signal()
|
||||
// canReadResult.wait()
|
||||
// reads |message.result|
|
||||
// canWriteResult.signal()
|
||||
//
|
||||
// The render window thread will do the following:
|
||||
//
|
||||
// canReadCmd.wait()
|
||||
// reads |message.cmd| and acts upon it.
|
||||
// canWriteResult.wait()
|
||||
// writes |message.result|
|
||||
// canReadResult.signal()
|
||||
// canWriteCmd.signal()
|
||||
//
|
||||
class RenderWindowChannel {
|
||||
public:
|
||||
RenderWindowChannel() : mIn(), mOut() {}
|
||||
~RenderWindowChannel() {}
|
||||
|
||||
// Send a message from the main thread.
|
||||
// Note that the content of |msg| is copied into the channel.
|
||||
// Returns with the command's result (true or false).
|
||||
bool sendMessageAndGetResult(const RenderWindowMessage& msg) {
|
||||
D("msg.cmd=%d\n", msg.cmd);
|
||||
mIn.send(msg);
|
||||
D("waiting for result\n");
|
||||
bool result = false;
|
||||
mOut.receive(&result);
|
||||
D("result=%s\n", result ? "success" : "failure");
|
||||
return result;
|
||||
}
|
||||
|
||||
// Receive a message from the render window thread.
|
||||
// On exit, |*msg| gets a copy of the message. The caller
|
||||
// must always call sendResult() after processing the message.
|
||||
void receiveMessage(RenderWindowMessage* msg) {
|
||||
D("entering\n");
|
||||
mIn.receive(msg);
|
||||
D("message cmd=%d\n", msg->cmd);
|
||||
}
|
||||
|
||||
// Send result from the render window thread to the main one.
|
||||
// Must always be called after receiveMessage().
|
||||
void sendResult(bool result) {
|
||||
D("waiting to send result (%s)\n", result ? "success" : "failure");
|
||||
mOut.send(result);
|
||||
D("result sent\n");
|
||||
}
|
||||
|
||||
private:
|
||||
emugl::MessageChannel<RenderWindowMessage, 16U> mIn;
|
||||
emugl::MessageChannel<bool, 16U> mOut;
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
// This class implements the window render thread.
|
||||
// Its purpose is to listen for commands from the main thread in a loop,
|
||||
// process them, then return a boolean result for each one of them.
|
||||
//
|
||||
// The thread ends with a CMD_FINALIZE.
|
||||
//
|
||||
class RenderWindowThread : public emugl::Thread {
|
||||
public:
|
||||
RenderWindowThread(RenderWindowChannel* channel) : mChannel(channel) {}
|
||||
|
||||
virtual intptr_t main() {
|
||||
D("Entering render window thread thread\n");
|
||||
#ifndef _WIN32
|
||||
sigset_t set;
|
||||
sigfillset(&set);
|
||||
pthread_sigmask(SIG_SETMASK, &set, NULL);
|
||||
#endif
|
||||
bool running = true;
|
||||
while (running) {
|
||||
RenderWindowMessage msg;
|
||||
|
||||
D("Waiting for message from main thread\n");
|
||||
mChannel->receiveMessage(&msg);
|
||||
|
||||
bool result = msg.process();
|
||||
if (msg.cmd == CMD_FINALIZE) {
|
||||
running = false;
|
||||
}
|
||||
|
||||
D("Sending result (%s) to main thread\n", result ? "success" : "failure");
|
||||
mChannel->sendResult(result);
|
||||
}
|
||||
D("Exiting thread\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
RenderWindowChannel* mChannel;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
RenderWindow::RenderWindow(int width,
|
||||
int height,
|
||||
bool use_thread,
|
||||
bool use_sub_window) :
|
||||
mValid(false),
|
||||
mHasSubWindow(false),
|
||||
mThread(NULL),
|
||||
mChannel(NULL) {
|
||||
if (use_thread) {
|
||||
mChannel = new RenderWindowChannel();
|
||||
mThread = new RenderWindowThread(mChannel);
|
||||
mThread->start();
|
||||
}
|
||||
|
||||
RenderWindowMessage msg;
|
||||
msg.cmd = CMD_INITIALIZE;
|
||||
msg.init.width = width;
|
||||
msg.init.height = height;
|
||||
msg.init.useSubWindow = use_sub_window;
|
||||
mValid = processMessage(msg);
|
||||
}
|
||||
|
||||
RenderWindow::~RenderWindow() {
|
||||
D("Entering\n");
|
||||
removeSubWindow();
|
||||
D("Sending CMD_FINALIZE\n");
|
||||
RenderWindowMessage msg;
|
||||
msg.cmd = CMD_FINALIZE;
|
||||
(void) processMessage(msg);
|
||||
|
||||
if (mThread) {
|
||||
mThread->wait(NULL);
|
||||
delete mThread;
|
||||
delete mChannel;
|
||||
}
|
||||
}
|
||||
|
||||
bool RenderWindow::getHardwareStrings(const char** vendor,
|
||||
const char** renderer,
|
||||
const char** version) {
|
||||
D("Entering\n");
|
||||
// TODO(digit): Move this to render window thread.
|
||||
FrameBuffer* fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
D("No framebuffer!\n");
|
||||
return false;
|
||||
}
|
||||
fb->getGLStrings(vendor, renderer, version);
|
||||
D("Exiting vendor=[%s] renderer=[%s] version=[%s]\n",
|
||||
*vendor, *renderer, *version);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RenderWindow::setPostCallback(OnPostFn onPost, void* onPostContext) {
|
||||
D("Entering\n");
|
||||
RenderWindowMessage msg;
|
||||
msg.cmd = CMD_SET_POST_CALLBACK;
|
||||
msg.set_post_callback.on_post = onPost;
|
||||
msg.set_post_callback.on_post_context = onPostContext;
|
||||
(void) processMessage(msg);
|
||||
D("Exiting\n");
|
||||
}
|
||||
|
||||
bool RenderWindow::setupSubWindow(FBNativeWindowType window,
|
||||
int wx,
|
||||
int wy,
|
||||
int ww,
|
||||
int wh,
|
||||
int fbw,
|
||||
int fbh,
|
||||
float dpr,
|
||||
float zRot) {
|
||||
D("Entering mHasSubWindow=%s\n", mHasSubWindow ? "true" : "false");
|
||||
|
||||
RenderWindowMessage msg;
|
||||
msg.cmd = CMD_SETUP_SUBWINDOW;
|
||||
msg.subwindow.parent = window;
|
||||
msg.subwindow.wx = wx;
|
||||
msg.subwindow.wy = wy;
|
||||
msg.subwindow.ww = ww;
|
||||
msg.subwindow.wh = wh;
|
||||
msg.subwindow.fbw = fbw;
|
||||
msg.subwindow.fbh = fbh;
|
||||
msg.subwindow.dpr = dpr;
|
||||
msg.subwindow.rotation = zRot;
|
||||
|
||||
mHasSubWindow = processMessage(msg);
|
||||
D("Exiting mHasSubWindow=%s\n", mHasSubWindow ? "true" : "false");
|
||||
return mHasSubWindow;
|
||||
}
|
||||
|
||||
bool RenderWindow::removeSubWindow() {
|
||||
D("Entering mHasSubWindow=%s\n", mHasSubWindow ? "true" : "false");
|
||||
if (!mHasSubWindow) {
|
||||
return false;
|
||||
}
|
||||
mHasSubWindow = false;
|
||||
|
||||
RenderWindowMessage msg;
|
||||
msg.cmd = CMD_REMOVE_SUBWINDOW;
|
||||
bool result = processMessage(msg);
|
||||
D("Exiting result=%s\n", result ? "success" : "failure");
|
||||
return result;
|
||||
}
|
||||
|
||||
void RenderWindow::setRotation(float zRot) {
|
||||
D("Entering rotation=%f\n", zRot);
|
||||
RenderWindowMessage msg;
|
||||
msg.cmd = CMD_SET_ROTATION;
|
||||
msg.rotation = zRot;
|
||||
(void) processMessage(msg);
|
||||
D("Exiting\n");
|
||||
}
|
||||
|
||||
void RenderWindow::setTranslation(float px, float py) {
|
||||
D("Entering translation=%f,%f\n", px, py);
|
||||
RenderWindowMessage msg;
|
||||
msg.cmd = CMD_SET_TRANSLATION;
|
||||
msg.trans.px = px;
|
||||
msg.trans.py = py;
|
||||
(void) processMessage(msg);
|
||||
D("Exiting\n");
|
||||
}
|
||||
|
||||
void RenderWindow::repaint() {
|
||||
D("Entering\n");
|
||||
RenderWindowMessage msg;
|
||||
msg.cmd = CMD_REPAINT;
|
||||
(void) processMessage(msg);
|
||||
D("Exiting\n");
|
||||
}
|
||||
|
||||
bool RenderWindow::processMessage(const RenderWindowMessage& msg) {
|
||||
if (mChannel) {
|
||||
return mChannel->sendMessageAndGetResult(msg);
|
||||
} else {
|
||||
return msg.process();
|
||||
}
|
||||
}
|
||||
135
external/android-emugl/host/libs/libOpenglRender/RenderWindow.h
vendored
Normal file
135
external/android-emugl/host/libs/libOpenglRender/RenderWindow.h
vendored
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
// Copyright 2014-2015 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.
|
||||
|
||||
#ifndef ANDROID_EMUGL_LIBRENDER_RENDER_WINDOW_H
|
||||
#define ANDROID_EMUGL_LIBRENDER_RENDER_WINDOW_H
|
||||
|
||||
#include "OpenglRender/render_api.h"
|
||||
|
||||
namespace emugl {
|
||||
class Thread;
|
||||
} // namespace emugl
|
||||
|
||||
class RenderWindowChannel;
|
||||
struct RenderWindowMessage;
|
||||
|
||||
// Helper class used to manage the sub-window that displays the emulated GPU
|
||||
// output. To use it, do the following:
|
||||
//
|
||||
// 1) Create a new instance, passing the size of the emulated accelerated
|
||||
// framebuffer in pixels you need.
|
||||
//
|
||||
// 2) Check isValid() after construction. If false, the library could not
|
||||
// initialize the class properly, and one should abort.
|
||||
//
|
||||
// 3) Optional: call setPostCallback() to specify a callback function which
|
||||
// will be called everytime a new frame is drawn.
|
||||
//
|
||||
// 4) Call setupSubWindow() to setup a new sub-window within the UI window.
|
||||
// One can call removeSubWindow() to remove it, and one can call
|
||||
// setupSubWindow() + removeSubWindow() any number of time (e.g. for
|
||||
// changing the position / rotation of the subwindow).
|
||||
//
|
||||
// 5) Optional: call setRotation() to only change the display rotation of
|
||||
// the sub-window content.
|
||||
//
|
||||
// 6) Call repaint() to force a repaint().
|
||||
//
|
||||
class RenderWindow {
|
||||
public:
|
||||
// Create new instance. |width| and |height| are the dimensions of the
|
||||
// emulated accelerated framebuffer. |use_thread| can be true to force
|
||||
// the use of a separate thread, which might be required on some platforms
|
||||
// to avoid GL-realted corruption issues in the main window. Call
|
||||
// isValid() after construction to verify that it worked properly.
|
||||
//
|
||||
// |use_sub_window| is true if the client will call setupSubWindow(),
|
||||
// and false if it will call setPostCallback().
|
||||
//
|
||||
// Note that this call doesn't display anything, it just initializes
|
||||
// the library, use setupSubWindow() to display something.
|
||||
RenderWindow(int width, int height, bool use_thread, bool use_sub_window);
|
||||
|
||||
// Destructor. This will automatically call removeSubWindow() is needed.
|
||||
~RenderWindow();
|
||||
|
||||
// Returns true if the RenderWindow instance is valid, which really
|
||||
// means that the constructor succeeded.
|
||||
bool isValid() const { return mValid; }
|
||||
|
||||
// Return misc. GL strings to the caller. On success, return true and sets
|
||||
// |*vendor| to the GL vendor string, |*renderer| to the GL renderer one,
|
||||
// and |*version| to the GL version one. On failure, return false.
|
||||
bool getHardwareStrings(const char** vendor,
|
||||
const char** renderer,
|
||||
const char** version);
|
||||
|
||||
// Specify a function that will be called everytime a new frame is
|
||||
// displayed. This is relatively slow but allows one to capture the
|
||||
// output.
|
||||
void setPostCallback(OnPostFn onPost, void* onPostContext);
|
||||
|
||||
// Start displaying the emulated framebuffer using a sub-window of a
|
||||
// parent |window| id. |wx|, |wy|, |ww| and |wh| are the position
|
||||
// and dimension of the sub-window, relative to its parent.
|
||||
// |fbw| and |fbh| are the dimensions of the underlying guest framebuffer.
|
||||
// |dpr| is the device pixel ratio for the monitor, which is required for
|
||||
// higher-density displays (such as retina).
|
||||
// |rotation| is a clockwise-rotation for the content. Only multiples of
|
||||
// 90. are accepted. Returns true on success, false otherwise.
|
||||
//
|
||||
// If the subwindow already exists, this function will update
|
||||
// the dimensions of the subwindow, backing framebuffer, and rendering
|
||||
// pipeline to reflect the new values.
|
||||
//
|
||||
// One can call removeSubWindow() to remove the sub-window.
|
||||
bool setupSubWindow(FBNativeWindowType window,
|
||||
int wx,
|
||||
int wy,
|
||||
int ww,
|
||||
int wh,
|
||||
int fbw,
|
||||
int fbh,
|
||||
float dpr,
|
||||
float rotation);
|
||||
|
||||
// Remove the sub-window created by calling setupSubWindow().
|
||||
// Note that this doesn't discard the content of the emulated framebuffer,
|
||||
// it just hides it from the main window. Returns true on success, false
|
||||
// otherwise.
|
||||
bool removeSubWindow();
|
||||
|
||||
// Change the display rotation on the fly. |zRot| is a clockwise rotation
|
||||
// angle in degrees. Only multiples of 90. are accepted.
|
||||
void setRotation(float zRot);
|
||||
|
||||
// Change the display translation. |px|,|py| are numbers between 0 and 1,
|
||||
// with (0,0) indicating "align the bottom left of the framebuffer with the
|
||||
// bottom left of the subwindow", and (1,1) indicating "align the top right of
|
||||
// the framebuffer with the top right of the subwindow."
|
||||
void setTranslation(float px, float py);
|
||||
|
||||
// Force a repaint of the whole content into the sub-window.
|
||||
void repaint();
|
||||
|
||||
private:
|
||||
bool processMessage(const RenderWindowMessage& msg);
|
||||
|
||||
bool mValid;
|
||||
bool mHasSubWindow;
|
||||
emugl::Thread* mThread;
|
||||
RenderWindowChannel* mChannel;
|
||||
};
|
||||
|
||||
#endif // ANDROID_EMUGL_LIBRENDER_RENDER_WINDOW_H
|
||||
183
external/android-emugl/host/libs/libOpenglRender/SocketStream.cpp
vendored
Normal file
183
external/android-emugl/host/libs/libOpenglRender/SocketStream.cpp
vendored
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "SocketStream.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <sys/un.h>
|
||||
#else
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
SocketStream::SocketStream(size_t bufSize) :
|
||||
IOStream(bufSize),
|
||||
m_sock(-1),
|
||||
m_bufsize(bufSize),
|
||||
m_buf(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
SocketStream::SocketStream(int sock, size_t bufSize) :
|
||||
IOStream(bufSize),
|
||||
m_sock(sock),
|
||||
m_bufsize(bufSize),
|
||||
m_buf(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
SocketStream::~SocketStream()
|
||||
{
|
||||
if (m_sock >= 0) {
|
||||
forceStop();
|
||||
#ifndef _WIN32
|
||||
if(close(m_sock) < 0)
|
||||
perror("Closing SocketStream failed");
|
||||
#endif
|
||||
// DBG("SocketStream::~close @ %d \n", m_sock);
|
||||
m_sock = -1;
|
||||
}
|
||||
if (m_buf != NULL) {
|
||||
free(m_buf);
|
||||
m_buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *SocketStream::allocBuffer(size_t minSize)
|
||||
{
|
||||
size_t allocSize = (m_bufsize < minSize ? minSize : m_bufsize);
|
||||
if (!m_buf) {
|
||||
m_buf = (unsigned char *)malloc(allocSize);
|
||||
}
|
||||
else if (m_bufsize < allocSize) {
|
||||
unsigned char *p = (unsigned char *)realloc(m_buf, allocSize);
|
||||
if (p != NULL) {
|
||||
m_buf = p;
|
||||
m_bufsize = allocSize;
|
||||
} else {
|
||||
ERR("%s: realloc (%zu) failed\n", __FUNCTION__, allocSize);
|
||||
free(m_buf);
|
||||
m_buf = NULL;
|
||||
m_bufsize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return m_buf;
|
||||
};
|
||||
|
||||
int SocketStream::commitBuffer(size_t size)
|
||||
{
|
||||
return writeFully(m_buf, size);
|
||||
}
|
||||
|
||||
int SocketStream::writeFully(const void* buffer, size_t size)
|
||||
{
|
||||
if (!valid()) return -1;
|
||||
|
||||
size_t res = size;
|
||||
int retval = 0;
|
||||
|
||||
while (res > 0) {
|
||||
ssize_t stat = ::send(m_sock, (const char *)buffer + (size - res), res, 0);
|
||||
if (stat < 0) {
|
||||
if (errno != EINTR) {
|
||||
retval = stat;
|
||||
ERR("%s: failed: %s\n", __FUNCTION__, strerror(errno));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
res -= stat;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
const unsigned char *SocketStream::readFully(void *buf, size_t len)
|
||||
{
|
||||
if (!valid()) return NULL;
|
||||
if (!buf) {
|
||||
return NULL; // do not allow NULL buf in that implementation
|
||||
}
|
||||
size_t res = len;
|
||||
while (res > 0) {
|
||||
ssize_t stat = ::recv(m_sock, (char *)(buf) + len - res, res, 0);
|
||||
if (stat > 0) {
|
||||
res -= stat;
|
||||
continue;
|
||||
}
|
||||
if (stat == 0 || errno != EINTR) { // client shutdown or error
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return (const unsigned char *)buf;
|
||||
}
|
||||
|
||||
const unsigned char *SocketStream::read( void *buf, size_t *inout_len)
|
||||
{
|
||||
if (!valid()) return NULL;
|
||||
if (!buf) {
|
||||
return NULL; // do not allow NULL buf in that implementation
|
||||
}
|
||||
|
||||
int n;
|
||||
do {
|
||||
n = this->recv(buf, *inout_len);
|
||||
} while( n < 0 && errno == EINTR );
|
||||
|
||||
if (n > 0) {
|
||||
*inout_len = n;
|
||||
return (const unsigned char *)buf;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int SocketStream::recv(void *buf, size_t len)
|
||||
{
|
||||
if (!valid()) return int(ERR_INVALID_SOCKET);
|
||||
int res = 0;
|
||||
while(true) {
|
||||
res = ::recv(m_sock, (char *)buf, len, 0);
|
||||
if (res < 0) {
|
||||
if (errno == EINTR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void SocketStream::forceStop() {
|
||||
// Shutdown socket to force read/write errors.
|
||||
#ifdef _WIN32
|
||||
::shutdown(m_sock, SD_BOTH);
|
||||
// As documented by programmers on MSDN, shutdown implementation in Windows does
|
||||
// NOT result to unblocking threads that are blocked on a recv on the socket
|
||||
// being shut down. The only way to actually implement this behavior (expected
|
||||
// by this forceStop() implementation) is to rudely close the socket.
|
||||
::closesocket(m_sock);
|
||||
m_sock = -1;
|
||||
#else
|
||||
::shutdown(m_sock, SHUT_RDWR);
|
||||
#endif
|
||||
}
|
||||
53
external/android-emugl/host/libs/libOpenglRender/SocketStream.h
vendored
Normal file
53
external/android-emugl/host/libs/libOpenglRender/SocketStream.h
vendored
Normal 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.
|
||||
*/
|
||||
#ifndef __SOCKET_STREAM_H
|
||||
#define __SOCKET_STREAM_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "IOStream.h"
|
||||
|
||||
class SocketStream : public IOStream {
|
||||
public:
|
||||
typedef enum { ERR_INVALID_SOCKET = -1000 } SocketStreamError;
|
||||
static const size_t MAX_ADDRSTR_LEN = 256;
|
||||
|
||||
explicit SocketStream(size_t bufsize = 10000);
|
||||
virtual ~SocketStream();
|
||||
|
||||
virtual int listen(char addrstr[MAX_ADDRSTR_LEN]) = 0;
|
||||
virtual SocketStream *accept() = 0;
|
||||
virtual int connect(const char* addr) = 0;
|
||||
|
||||
virtual void *allocBuffer(size_t minSize);
|
||||
virtual int commitBuffer(size_t size);
|
||||
virtual const unsigned char *readFully(void *buf, size_t len);
|
||||
virtual const unsigned char *read(void *buf, size_t *inout_len);
|
||||
|
||||
bool valid() { return m_sock >= 0; }
|
||||
virtual int recv(void *buf, size_t len);
|
||||
virtual int writeFully(const void *buf, size_t len);
|
||||
|
||||
virtual void forceStop();
|
||||
|
||||
protected:
|
||||
int m_sock;
|
||||
size_t m_bufsize;
|
||||
unsigned char *m_buf;
|
||||
|
||||
SocketStream(int sock, size_t bufSize);
|
||||
};
|
||||
|
||||
#endif /* __SOCKET_STREAM_H */
|
||||
78
external/android-emugl/host/libs/libOpenglRender/TcpStream.cpp
vendored
Normal file
78
external/android-emugl/host/libs/libOpenglRender/TcpStream.cpp
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "TcpStream.h"
|
||||
#include "emugl/common/sockets.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#else
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#define LISTEN_BACKLOG 4
|
||||
|
||||
TcpStream::TcpStream(size_t bufSize) : SocketStream(bufSize) {}
|
||||
|
||||
TcpStream::TcpStream(int sock, size_t bufSize) :
|
||||
SocketStream(sock, bufSize) {
|
||||
// disable Nagle algorithm to improve bandwidth of small
|
||||
// packets which are quite common in our implementation.
|
||||
emugl::socketTcpDisableNagle(sock);
|
||||
}
|
||||
|
||||
int TcpStream::listen(char addrstr[MAX_ADDRSTR_LEN]) {
|
||||
m_sock = emugl::socketTcpLoopbackServer(0, SOCK_STREAM);
|
||||
if (!valid())
|
||||
return int(ERR_INVALID_SOCKET);
|
||||
|
||||
int port = emugl::socketGetPort(m_sock);
|
||||
if (port < 0) {
|
||||
::close(m_sock);
|
||||
return int(ERR_INVALID_SOCKET);
|
||||
}
|
||||
|
||||
snprintf(addrstr, MAX_ADDRSTR_LEN - 1, "%hu", port);
|
||||
addrstr[MAX_ADDRSTR_LEN-1] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SocketStream * TcpStream::accept() {
|
||||
int clientSock = emugl::socketAccept(m_sock);
|
||||
if (clientSock < 0)
|
||||
return NULL;
|
||||
|
||||
return new TcpStream(clientSock, m_bufsize);
|
||||
}
|
||||
|
||||
int TcpStream::connect(const char* addr) {
|
||||
int port = atoi(addr);
|
||||
m_sock = emugl::socketTcpLoopbackClient(port, SOCK_STREAM);
|
||||
return valid() ? 0 : -1;
|
||||
}
|
||||
|
||||
int TcpStream::connect(const char* hostname, unsigned short port)
|
||||
{
|
||||
m_sock = emugl::socketTcpClient(hostname, port, SOCK_STREAM);
|
||||
return valid() ? 0 : -1;
|
||||
}
|
||||
32
external/android-emugl/host/libs/libOpenglRender/TcpStream.h
vendored
Normal file
32
external/android-emugl/host/libs/libOpenglRender/TcpStream.h
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef __TCP_STREAM_H
|
||||
#define __TCP_STREAM_H
|
||||
|
||||
#include "SocketStream.h"
|
||||
|
||||
class TcpStream : public SocketStream {
|
||||
public:
|
||||
explicit TcpStream(size_t bufsize = 10000);
|
||||
virtual int listen(char addrstr[MAX_ADDRSTR_LEN]);
|
||||
virtual SocketStream *accept();
|
||||
virtual int connect(const char* addr);
|
||||
int connect(const char* hostname, unsigned short port);
|
||||
private:
|
||||
TcpStream(int sock, size_t bufSize);
|
||||
};
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue