Import goldfish HAL sources from devices/generic/goldfish

We import all code here so we can customize and keep in sync with what
we do on the host side more easily.
This commit is contained in:
Simon Fels 2017-01-09 08:05:04 +01:00
commit 23392b9732
196 changed files with 62159 additions and 0 deletions

65
android/opengl/Android.mk Normal file
View file

@ -0,0 +1,65 @@
# This is the top-level build file for the Android HW OpenGL ES emulation
# in Android.
#
# You must define BUILD_EMULATOR_OPENGL to 'true' in your environment to
# build the following files.
#
# Also define BUILD_EMULATOR_OPENGL_DRIVER to 'true' to build the gralloc
# stuff as well.
#
ifeq (true,$(BUILD_EMULATOR_OPENGL))
# Top-level for all modules
EMUGL_PATH := $(call my-dir)
# Directory containing common headers used by several modules
# 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_PATH)/host/include/libOpenglRender
# 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
#
EMUGL_COMMON_CFLAGS := -DWITH_GLES2
# Uncomment the following line if you want to enable debug traces
# in the GLES emulation libraries.
# EMUGL_COMMON_CFLAGS += -DEMUGL_DEBUG=1
# 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.
#
include $(EMUGL_PATH)/shared/OpenglCodecCommon/Android.mk
# System static libraries
include $(EMUGL_PATH)/system/GLESv1_enc/Android.mk
include $(EMUGL_PATH)/system/GLESv2_enc/Android.mk
include $(EMUGL_PATH)/system/renderControl_enc/Android.mk
include $(EMUGL_PATH)/system/OpenglSystemCommon/Android.mk
# System shared libraries
include $(EMUGL_PATH)/system/GLESv1/Android.mk
include $(EMUGL_PATH)/system/GLESv2/Android.mk
include $(EMUGL_PATH)/system/gralloc/Android.mk
include $(EMUGL_PATH)/system/egl/Android.mk
endif # BUILD_EMULATOR_OPENGL == true

19
android/opengl/README Normal file
View file

@ -0,0 +1,19 @@
This directory contains Android-side modules related to hardware OpenGL ES
emulation. The host-side modules and documentation are in
$ANDROID_BUILD_TOP/sdk/emulator/opengl.
Note that this directory contains encoder sources that are auto-generated
with the 'emugen' host tool (see sdk/emulator/opengl/host/tools/emugen).
To regenerate them, run external/qemu/distrib/update-emugl-sources.sh,
after building the emulator from sources, this will populate the content
here with the appropriate updated source files.
You should do this whenever you update one of the *.types, *.in and *.attrib
files located under one of:
$AOSP/sdk/emulator/opengl/libs/GLESv1_dec/
$AOSP/sdk/emulator/opengl/libs/GLESv2_dec/
$AOSP/sdk/emulator/opengl/libs/renderControl_dec/
or when the 'emugen' tool itself is modified.

237
android/opengl/common.mk Normal file
View file

@ -0,0 +1,237 @@
# 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-static-library = $(call emugl-begin-module,$1,STATIC_LIBRARY)
emugl-begin-shared-library = $(call emugl-begin-module,$1,SHARED_LIBRARY)
# 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_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 _EMUGL_INCLUDE_TYPE := $(BUILD_$2)) \
$(call _emugl-init-module,$1,$2,$3)
# Used to end a module definition, see function definitions above
emugl-end-module = \
$(eval include $(_EMUGL_INCLUDE_TYPE))\
$(eval _EMUGL_INCLUDE_TYPE :=) \
$(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 \
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 := $2 $(LOCAL_$1))
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) := $(_emugl.$1.export.$(_type)) $(LOCAL_$(_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 wrapper 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-wrapper,<input-dir>,<basename>)
#
emugl-gen-wrapper = \
$(eval _emugl_out := $(call local-intermediates-dir)) \
$(call emugl-gen-wrapper-generic,$(_emugl_out),$1,$2) \
$(call emugl-export,C_INCLUDES,$(_emugl_out))
# DO NOT CALL DIRECTLY, USE emugl-gen-wrapper instead.
#
# The following function can be called to generate GL library wrapper
# Usage is:
#
# $(call emugl-gen-wrapper-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-wrapper-generic = $(eval $(emugl-gen-wrapper-generic-ev))
define emugl-gen-wrapper-generic-ev
_emugl_wrap := $$1/$$3
_emugl_src := $$2/$$3
GEN := $$(_emugl_wrap)_wrapper_entry.cpp \
$$(_emugl_wrap)_wrapper_context.cpp \
$$(_emugl_wrap)_wrapper_context.h \
$$(_emugl_wrap)_wrapper_proc.h
$$(GEN): PRIVATE_PATH := $$(LOCAL_PATH)
$$(GEN): PRIVATE_CUSTOM_TOOL := $$(EMUGL_EMUGEN) -W $$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
#ifneq ($$(HOST_OS),windows)
$$(call emugl-export,LDFLAGS,-ldl)
#endif
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_RELATIVE_PATH := $1)\
$(eval _emugl.$(LOCAL_MODULE).moved := true)

View file

@ -0,0 +1,102 @@
/*
* 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 ~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

View file

@ -0,0 +1,23 @@
# This build script corresponds to a library containing many definitions
# common to both the guest and the host. They relate to
#
LOCAL_PATH := $(call my-dir)
commonSources := \
GLClientState.cpp \
ChecksumCalculator.cpp \
GLSharedGroup.cpp \
glUtils.cpp \
SocketStream.cpp \
TcpStream.cpp \
### CodecCommon guest ##############################################
$(call emugl-begin-static-library,libOpenglCodecCommon)
LOCAL_SRC_FILES := $(commonSources)
LOCAL_CFLAGS += -DLOG_TAG=\"eglCodecCommon\"
$(call emugl-export,SHARED_LIBRARIES,libcutils libutils liblog)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-end-module)

View file

@ -0,0 +1,154 @@
/*
* Copyright (C) 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.
*/
#include "ChecksumCalculator.h"
#include <string>
#include <vector>
#include <string.h>
// Checklist when implementing new protocol:
// 1. update CHECKSUMHELPER_MAX_VERSION
// 2. update maxChecksumSize()
// 3. update checksumByteSize()
// 4. update addBuffer, writeChecksum, resetChecksum, validate
// change CHECKSUMHELPER_MAX_VERSION when you want to update the protocol version
#define CHECKSUMHELPER_MAX_VERSION 1
// checksum buffer size
// Please add a new checksum buffer size when implementing a new protocol,
// as well as modifying the maxChecksumSize function.
static const size_t kV1ChecksumSize = 8;
static constexpr size_t maxChecksumSize() {
return 0 > kV1ChecksumSize ? 0 : kV1ChecksumSize;
}
static const size_t kMaxChecksumSize = maxChecksumSize();
// utility macros to create checksum string at compilation time
#define CHECKSUMHELPER_VERSION_STR_PREFIX "ANDROID_EMU_CHECKSUM_HELPER_v"
#define CHECKSUMHELPER_MACRO_TO_STR(x) #x
#define CHECKSUMHELPER_MACRO_VAL_TO_STR(x) CHECKSUMHELPER_MACRO_TO_STR(x)
static const uint32_t kMaxVersion = CHECKSUMHELPER_MAX_VERSION;
static const char* kMaxVersionStrPrefix = CHECKSUMHELPER_VERSION_STR_PREFIX;
static const char* kMaxVersionStr = CHECKSUMHELPER_VERSION_STR_PREFIX CHECKSUMHELPER_MACRO_VAL_TO_STR(CHECKSUMHELPER_MAX_VERSION);
#undef CHECKSUMHELPER_MAX_VERSION
#undef CHECKSUMHELPER_VERSION_STR_PREFIX
#undef CHECKSUMHELPER_MACRO_TO_STR
#undef CHECKSUMHELPER_MACRO_VAL_TO_STR
uint32_t ChecksumCalculator::getMaxVersion() {return kMaxVersion;}
const char* ChecksumCalculator::getMaxVersionStr() {return kMaxVersionStr;}
const char* ChecksumCalculator::getMaxVersionStrPrefix() {return kMaxVersionStrPrefix;}
bool ChecksumCalculator::setVersion(uint32_t version) {
if (version > kMaxVersion) { // unsupported version
LOG_CHECKSUMHELPER("%s: ChecksumCalculator Set Unsupported version Version %d\n",
__FUNCTION__, m_version);
return false;
}
if (m_isEncodingChecksum) { // setVersion is called in the middle of encoding checksums
LOG_CHECKSUMHELPER("%s: called between addBuffer and writeChecksum\n",
__FUNCTION__);
return false;
}
m_version = version;
LOG_CHECKSUMHELPER("%s: ChecksumCalculator Set Version %d\n", __FUNCTION__,
m_version);
return true;
}
size_t ChecksumCalculator::checksumByteSize() const {
switch (m_version) {
case 0:
return 0;
case 1:
return sizeof(uint32_t) + sizeof(m_numWrite);
default:
return 0;
}
}
void ChecksumCalculator::addBuffer(const void* buf, size_t packetLen) {
m_isEncodingChecksum = true;
switch (m_version) {
case 1:
m_v1BufferTotalLength += packetLen;
break;
}
}
bool ChecksumCalculator::writeChecksum(void* outputChecksum, size_t outputChecksumLen) {
if (outputChecksumLen < checksumByteSize()) return false;
char *checksumPtr = (char *)outputChecksum;
switch (m_version) {
case 1: { // protocol v1 is to reverse the packetLen and write it at the end
uint32_t val = computeV1Checksum();
memcpy(checksumPtr, &val, sizeof(val));
memcpy(checksumPtr+sizeof(val), &m_numWrite, sizeof(m_numWrite));
break;
}
}
resetChecksum();
m_numWrite++;
return true;
}
void ChecksumCalculator::resetChecksum() {
switch (m_version) {
case 1:
m_v1BufferTotalLength = 0;
break;
}
m_isEncodingChecksum = false;
}
bool ChecksumCalculator::validate(const void* expectedChecksum, size_t expectedChecksumLen) {
size_t checksumSize = checksumByteSize();
if (expectedChecksumLen != checksumSize) {
m_numRead++;
resetChecksum();
return false;
}
// buffers for computing the checksum
unsigned char sChecksumBuffer[kMaxChecksumSize];
switch (m_version) {
case 1: {
uint32_t val = computeV1Checksum();
memcpy(sChecksumBuffer, &val, sizeof(val));
memcpy(sChecksumBuffer+sizeof(val), &m_numRead, sizeof(m_numRead));
break;
}
}
bool isValid = !memcmp(sChecksumBuffer, expectedChecksum, checksumSize);
m_numRead++;
resetChecksum();
return isValid;
}
uint32_t ChecksumCalculator::computeV1Checksum() {
uint32_t revLen = m_v1BufferTotalLength;
revLen = (revLen & 0xffff0000) >> 16 | (revLen & 0x0000ffff) << 16;
revLen = (revLen & 0xff00ff00) >> 8 | (revLen & 0x00ff00ff) << 8;
revLen = (revLen & 0xf0f0f0f0) >> 4 | (revLen & 0x0f0f0f0f) << 4;
revLen = (revLen & 0xcccccccc) >> 2 | (revLen & 0x33333333) << 2;
revLen = (revLen & 0xaaaaaaaa) >> 1 | (revLen & 0x55555555) << 1;
return revLen;
}

View file

@ -0,0 +1,181 @@
/*
* Copyright (C) 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 <stdint.h>
#include <stdlib.h>
// Set TRACE_CHECKSUMHELPER to 1 to debug creation/destruction of GLprotocol
// instances.
#define TRACE_CHECKSUMHELPER 0
#if TRACE_CHECKSUMHELPER
#define LOG_CHECKSUMHELPER(x...) fprintf(stderr, x)
#else
#define LOG_CHECKSUMHELPER(x...)
#endif
// ChecksumCalculator adds checksum as an array of bytes to GL pipe communication, which
// size depends on the protocol version. Each pipe should use one ChecksumCalculator.
// It can:
// (1) take a list of buffers one by one and compute their checksum string,
// in this case the checksum should be as the data in those buffers are
// concatenated;
// (2) compute the checksum of the buffer list, then either write them into
// a buffer provided by user, or compare it against a checksum provided
// by user
// (3) support different checksum version in future.
//
// For backward compatibility, checksum version 0 behaves the same as there is
// no checksum (i.e., checksumByteSize returns 0, validate always returns true,
// addBuffer and writeCheckSum does nothing).
//
// Notice that to detect package lost, ChecksumCalculator also keeps track of how
// many times it generates/validates checksums, and might use it as part of the
// checksum.
//
// To evaluate checksums from a list of data buffers buf1, buf2... Please call
// addBuffer(buf1, buf1len), addBuffer(buf2, buf2len) ... in order.
// Then if the checksum needs to be encoded into a buffer, one needs to allocate
// a checksum buffer with size checksumByteSize(), and call
// writeChecksum(checksumBuffer) to write the checksum to the buffer.
// If the checksum needs to be validated against an existing one, one needs to
// call validate(existChecksum, existChecksumLen).
//
// The checksum generator and validator must be set to the same version, and
// the validator must check ALL checksums in the order they are generated,
// otherwise the validation function will return false.
//
// It is allowed to change the checksum version between calculating two
// checksums. This is designed for backward compatibility reason.
//
// Example 1, encoding and decoding:
//
// bool testChecksum(void* buf, size_t bufLen) {
// // encoding message
// ChecksumCalculator encoder;
// encoder.setVersion(1);
// encoder.addBuffer(buf, bufLen);
// std::vector<unsigned char> message(bufLen + encoder.checksumByteSize());
// memcpy(&message[0], buf, bufLen);
// encoder.writeChecksum(&message[0] + bufLen, encoder.checksumByteSize());
//
// // decoding message
// ChecksumCalculator decoder;
// decoder.setVersion(1);
// decoder.addBuffer(&message[0], bufLen);
// return decoder.validate(&message[0] + bufLen, decoder.checksumByteSize());
// }
// The return value is true.
//
// Example 2, decoding will fail if the order of messages is wrong:
//
// bool testChecksumOrder(void* buf1, size_t bufLen1,
// void* buf2, size_t bufLen2) {
// // encoding messages
// ChecksumCalculator encoder;
// encoder.setVersion(1);
//
// std::vector<unsigned char> message1(bufLen1 + encoder.checksumByteSize());
// std::vector<unsigned char> message2(bufLen2 + encoder.checksumByteSize());
//
// encoder.addBuffer(buf1, bufLen1);
// std::vector<unsigned char> message1(bufLen1 + encoder.checksumByteSize());
// memcpy(&message1[0], buf1, bufLen1);
// encoder.writeChecksum(&message1[0] + bufLen1, encoder.checksumByteSize());
//
// encoder.addBuffer(buf2, bufLen2);
// std::vector<unsigned char> message2(bufLen2 + encoder.checksumByteSize());
// memcpy(&message2[0], buf2, bufLen2);
// encoder.writeChecksum(&message2[0] + bufLen2, encoder.checksumByteSize());
//
// // decoding messages
// ChecksumCalculator decoder;
// decoder.setVersion(1);
// decoder.addBuffer(&message2[0], bufLen2);
// // returns false because the decoding order is not consistent with
// // encoding order
// if (!decoder.validate(&message2[0]+bufLen2, decoder.checksumByteSize())) {
// return false;
// }
//
// decoder.addBuffer(&message1[0], bufLen1);
// if (!decoder.validate(&message1[0]+bufLen1, decoder.checksumByteSize())) {
// return false;
// }
//
// return false;
// }
class ChecksumCalculator {
public:
// Get and set current checksum version
uint32_t getVersion() const { return m_version; }
// Call setVersion to set a checksum version. It should be called before
// addBuffer(), writeChecksum() and validate(). And it should be called
// exact once per rendering thread if both host and guest support checksum.
// It won't be called if either host or guest does not support checksum.
bool setVersion(uint32_t version);
// Maximum supported checksum version
static uint32_t getMaxVersion();
// A version string that looks like "ANDROID_EMU_CHECKSUM_HELPER_v1"
// Used multiple times when the guest queries the maximum supported version
// from the host.
// The library owns the returned pointer. The returned pointer will be
// deconstructed when unloading library.
static const char* getMaxVersionStr();
static const char* getMaxVersionStrPrefix();
// Size of checksum in the current version
size_t checksumByteSize() const;
// Update the current checksum value from the data
// at |buf| of |bufLen| bytes. Once all buffers
// have been added, call writeChecksum() to store
// the final checksum value and reset its state.
void addBuffer(const void* buf, size_t bufLen);
// Write the checksum from the list of buffers to outputChecksum
// Will reset the list of buffers by calling resetChecksum.
// Return false if the buffer is not long enough
// Please query buffer size from checksumByteSize()
bool writeChecksum(void* outputChecksum, size_t outputChecksumLen);
// Restore the states for computing checksums.
// Automatically called at the end of writeChecksum and validate.
// Can also be used to abandon the current checksum being calculated.
// Notes: it doesn't update the internal read / write counter
void resetChecksum();
// Calculate the checksum from the list of buffers and
// compare it with the checksum encoded in expectedChecksum
// Will reset the list of buffers by calling resetChecksum.
bool validate(const void* expectedChecksum, size_t expectedChecksumLen);
protected:
uint32_t m_version = 0;
// A temporary state used to compute the total length of a list of buffers,
// if addBuffer is called.
uint32_t m_numRead = 0;
uint32_t m_numWrite = 0;
// m_isEncodingChecksum is true when between addBuffer and writeChecksum
bool m_isEncodingChecksum = false;
private:
// Compute a 32bit checksum
// Used in protocol v1
uint32_t computeV1Checksum();
// The buffer used in protocol version 1 to compute checksum.
uint32_t m_v1BufferTotalLength = 0;
};

View file

@ -0,0 +1,37 @@
/*
* 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 _ERROR_LOG_H_
#define _ERROR_LOG_H_
#if defined(__ANDROID__)
# include <cutils/log.h>
# define ERR(...) ALOGE(__VA_ARGS__)
# ifdef EMUGL_DEBUG
# define DBG(...) ALOGD(__VA_ARGS__)
# else
# define DBG(...) ((void)0)
# endif
#else
# include <stdio.h>
# define ERR(...) fprintf(stderr, __VA_ARGS__)
# ifdef EMUGL_DEBUG
# define DBG(...) fprintf(stderr, __VA_ARGS__)
# else
# define DBG(...) ((void)0)
# endif
#endif
#endif

View file

@ -0,0 +1,53 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _FIXED_BUFFER_H
#define _FIXED_BUFFER_H
class FixedBuffer {
public:
FixedBuffer(size_t initialSize = 0) {
m_buffer = NULL;
m_bufferLen = initialSize;
alloc(m_bufferLen);
}
~FixedBuffer() {
delete [] m_buffer;
m_bufferLen = 0;
}
void * alloc(size_t size) {
if (m_bufferLen >= size)
return (void *)(m_buffer);
if (m_buffer != NULL)
delete[] m_buffer;
m_bufferLen = size;
m_buffer = new unsigned char[m_bufferLen];
if (m_buffer == NULL)
m_bufferLen = 0;
return m_buffer;
}
void *ptr() { return m_buffer; }
size_t len() { return m_bufferLen; }
private:
unsigned char *m_buffer;
size_t m_bufferLen;
};
#endif

View file

@ -0,0 +1,422 @@
/*
* 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 "GLClientState.h"
#include "ErrorLog.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "glUtils.h"
#include <cutils/log.h>
#ifndef MAX
#define MAX(a, b) ((a) < (b) ? (b) : (a))
#endif
GLClientState::GLClientState(int nLocations)
{
if (nLocations < LAST_LOCATION) {
nLocations = LAST_LOCATION;
}
m_nLocations = nLocations;
m_states = new VertexAttribState[m_nLocations];
for (int i = 0; i < m_nLocations; i++) {
m_states[i].enabled = 0;
m_states[i].enableDirty = false;
m_states[i].data = 0;
}
m_currentArrayVbo = 0;
m_currentIndexVbo = 0;
// init gl constans;
m_states[VERTEX_LOCATION].glConst = GL_VERTEX_ARRAY;
m_states[NORMAL_LOCATION].glConst = GL_NORMAL_ARRAY;
m_states[COLOR_LOCATION].glConst = GL_COLOR_ARRAY;
m_states[POINTSIZE_LOCATION].glConst = GL_POINT_SIZE_ARRAY_OES;
m_states[TEXCOORD0_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
m_states[TEXCOORD1_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
m_states[TEXCOORD2_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
m_states[TEXCOORD3_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
m_states[TEXCOORD4_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
m_states[TEXCOORD5_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
m_states[TEXCOORD6_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
m_states[TEXCOORD7_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
m_states[MATRIXINDEX_LOCATION].glConst = GL_MATRIX_INDEX_ARRAY_OES;
m_states[WEIGHT_LOCATION].glConst = GL_WEIGHT_ARRAY_OES;
m_activeTexture = 0;
m_currentProgram = 0;
m_pixelStore.unpack_alignment = 4;
m_pixelStore.pack_alignment = 4;
memset(m_tex.unit, 0, sizeof(m_tex.unit));
m_tex.activeUnit = &m_tex.unit[0];
m_tex.textures = NULL;
m_tex.numTextures = 0;
m_tex.allocTextures = 0;
m_maxVertexAttribsDirty = true;
}
GLClientState::~GLClientState()
{
delete m_states;
}
void GLClientState::enable(int location, int state)
{
if (!validLocation(location)) {
return;
}
m_states[location].enableDirty |= (state != m_states[location].enabled);
m_states[location].enabled = state;
}
void GLClientState::setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, const void *data)
{
if (!validLocation(location)) {
return;
}
m_states[location].size = size;
m_states[location].type = type;
m_states[location].stride = stride;
m_states[location].data = (void*)data;
m_states[location].bufferObject = m_currentArrayVbo;
m_states[location].elementSize = size ? (glSizeof(type) * size) : 0;
m_states[location].normalized = normalized;
}
void GLClientState::setBufferObject(int location, GLuint id)
{
if (!validLocation(location)) {
return;
}
m_states[location].bufferObject = id;
}
const GLClientState::VertexAttribState * GLClientState::getState(int location)
{
if (!validLocation(location)) {
return NULL;
}
return & m_states[location];
}
const GLClientState::VertexAttribState * GLClientState::getStateAndEnableDirty(int location, bool *enableChanged)
{
if (!validLocation(location)) {
return NULL;
}
if (enableChanged) {
*enableChanged = m_states[location].enableDirty;
}
m_states[location].enableDirty = false;
return & m_states[location];
}
int GLClientState::getLocation(GLenum loc)
{
int retval;
switch(loc) {
case GL_VERTEX_ARRAY:
retval = int(VERTEX_LOCATION);
break;
case GL_NORMAL_ARRAY:
retval = int(NORMAL_LOCATION);
break;
case GL_COLOR_ARRAY:
retval = int(COLOR_LOCATION);
break;
case GL_POINT_SIZE_ARRAY_OES:
retval = int(POINTSIZE_LOCATION);
break;
case GL_TEXTURE_COORD_ARRAY:
retval = int (TEXCOORD0_LOCATION + m_activeTexture);
break;
case GL_MATRIX_INDEX_ARRAY_OES:
retval = int (MATRIXINDEX_LOCATION);
break;
case GL_WEIGHT_ARRAY_OES:
retval = int (WEIGHT_LOCATION);
break;
default:
retval = loc;
}
return retval;
}
void GLClientState::getClientStatePointer(GLenum pname, GLvoid** params)
{
const GLClientState::VertexAttribState *state = NULL;
switch (pname) {
case GL_VERTEX_ARRAY_POINTER: {
state = getState(GLClientState::VERTEX_LOCATION);
break;
}
case GL_NORMAL_ARRAY_POINTER: {
state = getState(GLClientState::NORMAL_LOCATION);
break;
}
case GL_COLOR_ARRAY_POINTER: {
state = getState(GLClientState::COLOR_LOCATION);
break;
}
case GL_TEXTURE_COORD_ARRAY_POINTER: {
state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
break;
}
case GL_POINT_SIZE_ARRAY_POINTER_OES: {
state = getState(GLClientState::POINTSIZE_LOCATION);
break;
}
case GL_MATRIX_INDEX_ARRAY_POINTER_OES: {
state = getState(GLClientState::MATRIXINDEX_LOCATION);
break;
}
case GL_WEIGHT_ARRAY_POINTER_OES: {
state = getState(GLClientState::WEIGHT_LOCATION);
break;
}
}
if (state && params)
*params = state->data;
}
int GLClientState::setPixelStore(GLenum param, GLint value)
{
int retval = 0;
switch(param) {
case GL_UNPACK_ALIGNMENT:
if (value == 1 || value == 2 || value == 4 || value == 8) {
m_pixelStore.unpack_alignment = value;
} else {
retval = GL_INVALID_VALUE;
}
break;
case GL_PACK_ALIGNMENT:
if (value == 1 || value == 2 || value == 4 || value == 8) {
m_pixelStore.pack_alignment = value;
} else {
retval = GL_INVALID_VALUE;
}
break;
default:
retval = GL_INVALID_ENUM;
}
return retval;
}
size_t GLClientState::pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) const
{
if (width <= 0 || height <= 0) return 0;
int pixelsize = glUtilsPixelBitSize(format, type) >> 3;
int alignment = pack ? m_pixelStore.pack_alignment : m_pixelStore.unpack_alignment;
if (pixelsize == 0 ) {
ERR("unknown pixel size: width: %d height: %d format: %d type: %d pack: %d align: %d\n",
width, height, format, type, pack, alignment);
}
size_t linesize = pixelsize * width;
size_t aligned_linesize = int(linesize / alignment) * alignment;
if (aligned_linesize < linesize) {
aligned_linesize += alignment;
}
return aligned_linesize * height;
}
GLenum GLClientState::setActiveTextureUnit(GLenum texture)
{
GLuint unit = texture - GL_TEXTURE0;
if (unit >= MAX_TEXTURE_UNITS) {
return GL_INVALID_ENUM;
}
m_tex.activeUnit = &m_tex.unit[unit];
return GL_NO_ERROR;
}
GLenum GLClientState::getActiveTextureUnit() const
{
return GL_TEXTURE0 + (m_tex.activeUnit - &m_tex.unit[0]);
}
void GLClientState::enableTextureTarget(GLenum target)
{
switch (target) {
case GL_TEXTURE_2D:
m_tex.activeUnit->enables |= (1u << TEXTURE_2D);
break;
case GL_TEXTURE_EXTERNAL_OES:
m_tex.activeUnit->enables |= (1u << TEXTURE_EXTERNAL);
break;
}
}
void GLClientState::disableTextureTarget(GLenum target)
{
switch (target) {
case GL_TEXTURE_2D:
m_tex.activeUnit->enables &= ~(1u << TEXTURE_2D);
break;
case GL_TEXTURE_EXTERNAL_OES:
m_tex.activeUnit->enables &= ~(1u << TEXTURE_EXTERNAL);
break;
}
}
GLenum GLClientState::getPriorityEnabledTarget(GLenum allDisabled) const
{
unsigned int enables = m_tex.activeUnit->enables;
if (enables & (1u << TEXTURE_EXTERNAL)) {
return GL_TEXTURE_EXTERNAL_OES;
} else if (enables & (1u << TEXTURE_2D)) {
return GL_TEXTURE_2D;
} else {
return allDisabled;
}
}
int GLClientState::compareTexId(const void* pid, const void* prec)
{
const GLuint* id = (const GLuint*)pid;
const TextureRec* rec = (const TextureRec*)prec;
return (GLint)(*id) - (GLint)rec->id;
}
GLenum GLClientState::bindTexture(GLenum target, GLuint texture,
GLboolean* firstUse)
{
GLboolean first = GL_FALSE;
TextureRec* texrec = NULL;
if (texture != 0) {
if (m_tex.textures) {
texrec = (TextureRec*)bsearch(&texture, m_tex.textures,
m_tex.numTextures, sizeof(TextureRec), compareTexId);
}
if (!texrec) {
if (!(texrec = addTextureRec(texture, target))) {
return GL_OUT_OF_MEMORY;
}
first = GL_TRUE;
}
if (target != texrec->target) {
return GL_INVALID_OPERATION;
}
}
switch (target) {
case GL_TEXTURE_2D:
m_tex.activeUnit->texture[TEXTURE_2D] = texture;
break;
case GL_TEXTURE_EXTERNAL_OES:
m_tex.activeUnit->texture[TEXTURE_EXTERNAL] = texture;
break;
}
if (firstUse) {
*firstUse = first;
}
return GL_NO_ERROR;
}
GLClientState::TextureRec* GLClientState::addTextureRec(GLuint id,
GLenum target)
{
if (m_tex.numTextures == m_tex.allocTextures) {
const GLuint MAX_TEXTURES = 0xFFFFFFFFu;
GLuint newAlloc;
if (MAX_TEXTURES - m_tex.allocTextures >= m_tex.allocTextures) {
newAlloc = MAX(4, 2 * m_tex.allocTextures);
} else {
if (m_tex.allocTextures == MAX_TEXTURES) {
return NULL;
}
newAlloc = MAX_TEXTURES;
}
TextureRec* newTextures = (TextureRec*)realloc(m_tex.textures,
newAlloc * sizeof(TextureRec));
if (!newTextures) {
return NULL;
}
m_tex.textures = newTextures;
m_tex.allocTextures = newAlloc;
}
TextureRec* tex = m_tex.textures + m_tex.numTextures;
TextureRec* prev = tex - 1;
while (tex != m_tex.textures && id < prev->id) {
*tex-- = *prev--;
}
tex->id = id;
tex->target = target;
m_tex.numTextures++;
return tex;
}
GLuint GLClientState::getBoundTexture(GLenum target) const
{
switch (target) {
case GL_TEXTURE_2D:
return m_tex.activeUnit->texture[TEXTURE_2D];
case GL_TEXTURE_EXTERNAL_OES:
return m_tex.activeUnit->texture[TEXTURE_EXTERNAL];
default:
return 0;
}
}
void GLClientState::deleteTextures(GLsizei n, const GLuint* textures)
{
// Updating the textures array could be made more efficient when deleting
// several textures:
// - compacting the array could be done in a single pass once the deleted
// textures are marked, or
// - could swap deleted textures to the end and re-sort.
TextureRec* texrec;
for (const GLuint* texture = textures; texture != textures + n; texture++) {
texrec = (TextureRec*)bsearch(texture, m_tex.textures,
m_tex.numTextures, sizeof(TextureRec), compareTexId);
if (texrec) {
const TextureRec* end = m_tex.textures + m_tex.numTextures;
memmove(texrec, texrec + 1,
(end - texrec - 1) * sizeof(TextureRec));
m_tex.numTextures--;
for (TextureUnit* unit = m_tex.unit;
unit != m_tex.unit + MAX_TEXTURE_UNITS;
unit++)
{
if (unit->texture[TEXTURE_2D] == *texture) {
unit->texture[TEXTURE_2D] = 0;
} else if (unit->texture[TEXTURE_EXTERNAL] == *texture) {
unit->texture[TEXTURE_EXTERNAL] = 0;
}
}
}
}
}

View file

@ -0,0 +1,462 @@
/*
* 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_CLIENT_STATE_H_
#define _GL_CLIENT_STATE_H_
#define GL_API
#ifndef ANDROID
#define GL_APIENTRY
#define GL_APIENTRYP
#endif
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <stdio.h>
#include <stdlib.h>
#include "ErrorLog.h"
#include "codec_defs.h"
class GLClientState {
public:
typedef enum {
VERTEX_LOCATION = 0,
NORMAL_LOCATION = 1,
COLOR_LOCATION = 2,
POINTSIZE_LOCATION = 3,
TEXCOORD0_LOCATION = 4,
TEXCOORD1_LOCATION = 5,
TEXCOORD2_LOCATION = 6,
TEXCOORD3_LOCATION = 7,
TEXCOORD4_LOCATION = 8,
TEXCOORD5_LOCATION = 9,
TEXCOORD6_LOCATION = 10,
TEXCOORD7_LOCATION = 11,
MATRIXINDEX_LOCATION = 12,
WEIGHT_LOCATION = 13,
LAST_LOCATION = 14
} StateLocation;
typedef struct {
GLint enabled;
GLint size;
GLenum type;
GLsizei stride;
void *data;
GLuint bufferObject;
GLenum glConst;
unsigned int elementSize;
bool enableDirty; // true if any enable state has changed since last draw
bool normalized;
} VertexAttribState;
typedef struct {
int unpack_alignment;
int pack_alignment;
} PixelStoreState;
enum {
MAX_TEXTURE_UNITS = 32,
};
public:
GLClientState(int nLocations = CODEC_MAX_VERTEX_ATTRIBUTES);
~GLClientState();
int nLocations() { return m_nLocations; }
const PixelStoreState *pixelStoreState() { return &m_pixelStore; }
int setPixelStore(GLenum param, GLint value);
GLuint currentArrayVbo() { return m_currentArrayVbo; }
GLuint currentIndexVbo() { return m_currentIndexVbo; }
void enable(int location, int state);
void setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, const void *data);
void setBufferObject(int location, GLuint id);
const VertexAttribState *getState(int location);
const VertexAttribState *getStateAndEnableDirty(int location, bool *enableChanged);
int getLocation(GLenum loc);
void setActiveTexture(int texUnit) {m_activeTexture = texUnit; };
int getActiveTexture() const { return m_activeTexture; }
void setMaxVertexAttribs(int val) {
m_maxVertexAttribs = val;
m_maxVertexAttribsDirty = false;
}
void unBindBuffer(GLuint id)
{
if (m_currentArrayVbo == id) m_currentArrayVbo = 0;
else if (m_currentIndexVbo == id) m_currentIndexVbo = 0;
}
int bindBuffer(GLenum target, GLuint id)
{
int err = 0;
switch(target) {
case GL_ARRAY_BUFFER:
m_currentArrayVbo = id;
break;
case GL_ELEMENT_ARRAY_BUFFER:
m_currentIndexVbo = id;
break;
default:
err = -1;
}
return err;
}
int getBuffer(GLenum target)
{
int ret=0;
switch (target) {
case GL_ARRAY_BUFFER:
ret = m_currentArrayVbo;
break;
case GL_ELEMENT_ARRAY_BUFFER:
ret = m_currentIndexVbo;
break;
default:
ret = -1;
}
return ret;
}
size_t pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) const;
void setCurrentProgram(GLint program) { m_currentProgram = program; }
GLint currentProgram() const { return m_currentProgram; }
/* OES_EGL_image_external
*
* These functions manipulate GL state which interacts with the
* OES_EGL_image_external extension, to support client-side emulation on
* top of host implementations that don't have it.
*
* Most of these calls should only be used with TEXTURE_2D or
* TEXTURE_EXTERNAL_OES texture targets; TEXTURE_CUBE_MAP or other extension
* targets should bypass this. An exception is bindTexture(), which should
* see all glBindTexture() calls for any target.
*/
// glActiveTexture(GL_TEXTURE0 + i)
// Sets the active texture unit. Up to MAX_TEXTURE_UNITS are supported.
GLenum setActiveTextureUnit(GLenum texture);
GLenum getActiveTextureUnit() const;
// glEnable(GL_TEXTURE_(2D|EXTERNAL_OES))
void enableTextureTarget(GLenum target);
// glDisable(GL_TEXTURE_(2D|EXTERNAL_OES))
void disableTextureTarget(GLenum target);
// Implements the target priority logic:
// * Return GL_TEXTURE_EXTERNAL_OES if enabled, else
// * Return GL_TEXTURE_2D if enabled, else
// * Return the allDisabled value.
// For some cases passing GL_TEXTURE_2D for allDisabled makes callee code
// simpler; for other cases passing a recognizable enum like GL_ZERO or
// GL_INVALID_ENUM is appropriate.
GLenum getPriorityEnabledTarget(GLenum allDisabled) const;
// glBindTexture(GL_TEXTURE_*, ...)
// Set the target binding of the active texture unit to texture. Returns
// GL_NO_ERROR on success or GL_INVALID_OPERATION if the texture has
// previously been bound to a different target. If firstUse is not NULL,
// it is set to indicate whether this is the first use of the texture.
// For accurate error detection, bindTexture should be called for *all*
// targets, not just 2D and EXTERNAL_OES.
GLenum bindTexture(GLenum target, GLuint texture, GLboolean* firstUse);
// Return the texture currently bound to GL_TEXTURE_(2D|EXTERNAL_OES).
GLuint getBoundTexture(GLenum target) const;
// glDeleteTextures(...)
// Remove references to the to-be-deleted textures.
void deleteTextures(GLsizei n, const GLuint* textures);
private:
PixelStoreState m_pixelStore;
VertexAttribState *m_states;
int m_maxVertexAttribs;
bool m_maxVertexAttribsDirty;
int m_nLocations;
GLuint m_currentArrayVbo;
GLuint m_currentIndexVbo;
int m_activeTexture;
GLint m_currentProgram;
bool validLocation(int location) { return (location >= 0 && location < m_nLocations); }
enum TextureTarget {
TEXTURE_2D = 0,
TEXTURE_EXTERNAL = 1,
TEXTURE_TARGET_COUNT
};
struct TextureUnit {
unsigned int enables;
GLuint texture[TEXTURE_TARGET_COUNT];
};
struct TextureRec {
GLuint id;
GLenum target;
};
struct TextureState {
TextureUnit unit[MAX_TEXTURE_UNITS];
TextureUnit* activeUnit;
TextureRec* textures;
GLuint numTextures;
GLuint allocTextures;
};
TextureState m_tex;
static int compareTexId(const void* pid, const void* prec);
TextureRec* addTextureRec(GLuint id, GLenum target);
public:
void getClientStatePointer(GLenum pname, GLvoid** params);
template <class T>
int getVertexAttribParameter(GLuint index, GLenum param, T *ptr)
{
bool handled = true;
const VertexAttribState *vertexAttrib = getState(index);
if (vertexAttrib == NULL) {
ERR("getVeterxAttriParameter for non existant index %d\n", index);
// set gl error;
return handled;
}
switch(param) {
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
*ptr = (T)(vertexAttrib->bufferObject);
break;
case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
*ptr = (T)(vertexAttrib->enabled);
break;
case GL_VERTEX_ATTRIB_ARRAY_SIZE:
*ptr = (T)(vertexAttrib->size);
break;
case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
*ptr = (T)(vertexAttrib->stride);
break;
case GL_VERTEX_ATTRIB_ARRAY_TYPE:
*ptr = (T)(vertexAttrib->type);
break;
case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
*ptr = (T)(vertexAttrib->normalized);
break;
case GL_CURRENT_VERTEX_ATTRIB:
handled = false;
break;
default:
handled = false;
ERR("unknown vertex-attrib parameter param %d\n", param);
}
return handled;
}
template <class T>
bool getClientStateParameter(GLenum param, T* ptr)
{
bool isClientStateParam = false;
switch (param) {
case GL_CLIENT_ACTIVE_TEXTURE: {
GLint tex = getActiveTexture() + GL_TEXTURE0;
*ptr = tex;
isClientStateParam = true;
break;
}
case GL_VERTEX_ARRAY_SIZE: {
const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
*ptr = state->size;
isClientStateParam = true;
break;
}
case GL_VERTEX_ARRAY_TYPE: {
const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
*ptr = state->type;
isClientStateParam = true;
break;
}
case GL_VERTEX_ARRAY_STRIDE: {
const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
*ptr = state->stride;
isClientStateParam = true;
break;
}
case GL_COLOR_ARRAY_SIZE: {
const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
*ptr = state->size;
isClientStateParam = true;
break;
}
case GL_COLOR_ARRAY_TYPE: {
const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
*ptr = state->type;
isClientStateParam = true;
break;
}
case GL_COLOR_ARRAY_STRIDE: {
const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
*ptr = state->stride;
isClientStateParam = true;
break;
}
case GL_NORMAL_ARRAY_TYPE: {
const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
*ptr = state->type;
isClientStateParam = true;
break;
}
case GL_NORMAL_ARRAY_STRIDE: {
const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
*ptr = state->stride;
isClientStateParam = true;
break;
}
case GL_TEXTURE_COORD_ARRAY_SIZE: {
const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
*ptr = state->size;
isClientStateParam = true;
break;
}
case GL_TEXTURE_COORD_ARRAY_TYPE: {
const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
*ptr = state->type;
isClientStateParam = true;
break;
}
case GL_TEXTURE_COORD_ARRAY_STRIDE: {
const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
*ptr = state->stride;
isClientStateParam = true;
break;
}
case GL_POINT_SIZE_ARRAY_TYPE_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
*ptr = state->type;
isClientStateParam = true;
break;
}
case GL_POINT_SIZE_ARRAY_STRIDE_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
*ptr = state->stride;
isClientStateParam = true;
break;
}
case GL_MATRIX_INDEX_ARRAY_SIZE_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
*ptr = state->size;
isClientStateParam = true;
break;
}
case GL_MATRIX_INDEX_ARRAY_TYPE_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
*ptr = state->type;
isClientStateParam = true;
break;
}
case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
*ptr = state->stride;
isClientStateParam = true;
break;
}
case GL_WEIGHT_ARRAY_SIZE_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
*ptr = state->size;
isClientStateParam = true;
break;
}
case GL_WEIGHT_ARRAY_TYPE_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
*ptr = state->type;
isClientStateParam = true;
break;
}
case GL_WEIGHT_ARRAY_STRIDE_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
*ptr = state->stride;
isClientStateParam = true;
break;
}
case GL_VERTEX_ARRAY_BUFFER_BINDING: {
const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
*ptr = state->bufferObject;
isClientStateParam = true;
break;
}
case GL_NORMAL_ARRAY_BUFFER_BINDING: {
const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
*ptr = state->bufferObject;
isClientStateParam = true;
break;
}
case GL_COLOR_ARRAY_BUFFER_BINDING: {
const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
*ptr = state->bufferObject;
isClientStateParam = true;
break;
}
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: {
const GLClientState::VertexAttribState *state = getState(getActiveTexture()+GLClientState::TEXCOORD0_LOCATION);
*ptr = state->bufferObject;
isClientStateParam = true;
break;
}
case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
*ptr = state->bufferObject;
isClientStateParam = true;
break;
}
case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
*ptr = state->bufferObject;
isClientStateParam = true;
break;
}
case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: {
const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
*ptr = state->bufferObject;
isClientStateParam = true;
break;
}
case GL_ARRAY_BUFFER_BINDING: {
int buffer = getBuffer(GL_ARRAY_BUFFER);
*ptr = buffer;
isClientStateParam = true;
break;
}
case GL_ELEMENT_ARRAY_BUFFER_BINDING: {
int buffer = getBuffer(GL_ELEMENT_ARRAY_BUFFER);
*ptr = buffer;
isClientStateParam = true;
break;
}
case GL_MAX_VERTEX_ATTRIBS: {
if (m_maxVertexAttribsDirty) {
isClientStateParam = false;
} else {
*ptr = m_maxVertexAttribs;
isClientStateParam = true;
}
break;
}
}
return isClientStateParam;
}
};
#endif

View file

@ -0,0 +1,497 @@
/*
* 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 "GLSharedGroup.h"
/**** KeyedVector utilities ****/
template <typename T>
static void clearObjectMap(android::DefaultKeyedVector<GLuint, T>& v) {
for (size_t i = 0; i < v.size(); i++)
delete v.valueAt(i);
v.clear();
}
/**** BufferData ****/
BufferData::BufferData() : m_size(0) {};
BufferData::BufferData(GLsizeiptr size, void * data) : m_size(size)
{
void * buffer = NULL;
if (size>0) buffer = m_fixedBuffer.alloc(size);
if (data) memcpy(buffer, data, size);
}
/**** ProgramData ****/
ProgramData::ProgramData() : m_numIndexes(0),
m_initialized(false),
m_locShiftWAR(false)
{
m_Indexes = NULL;
}
void ProgramData::initProgramData(GLuint numIndexes)
{
m_initialized = true;
m_numIndexes = numIndexes;
delete[] m_Indexes;
m_Indexes = new IndexInfo[numIndexes];
m_locShiftWAR = false;
}
bool ProgramData::isInitialized()
{
return m_initialized;
}
ProgramData::~ProgramData()
{
delete[] m_Indexes;
m_Indexes = NULL;
}
void ProgramData::setIndexInfo(GLuint index, GLint base, GLint size, GLenum type)
{
if (index>=m_numIndexes)
return;
m_Indexes[index].base = base;
m_Indexes[index].size = size;
m_Indexes[index].type = type;
if (index > 0) {
m_Indexes[index].appBase = m_Indexes[index-1].appBase +
m_Indexes[index-1].size;
}
else {
m_Indexes[index].appBase = 0;
}
m_Indexes[index].hostLocsPerElement = 1;
m_Indexes[index].flags = 0;
m_Indexes[index].samplerValue = 0;
}
void ProgramData::setIndexFlags(GLuint index, GLuint flags)
{
if (index >= m_numIndexes)
return;
m_Indexes[index].flags |= flags;
}
GLuint ProgramData::getIndexForLocation(GLint location)
{
GLuint index = m_numIndexes;
GLint minDist = -1;
for (GLuint i=0;i<m_numIndexes;++i)
{
GLint dist = location - m_Indexes[i].base;
if (dist >= 0 &&
(minDist < 0 || dist < minDist)) {
index = i;
minDist = dist;
}
}
return index;
}
GLenum ProgramData::getTypeForLocation(GLint location)
{
GLuint index = getIndexForLocation(location);
if (index<m_numIndexes) {
return m_Indexes[index].type;
}
return 0;
}
void ProgramData::setupLocationShiftWAR()
{
m_locShiftWAR = false;
for (GLuint i=0; i<m_numIndexes; i++) {
if (0 != (m_Indexes[i].base & 0xffff)) {
return;
}
}
// if we have one uniform at location 0, we do not need the WAR.
if (m_numIndexes > 1) {
m_locShiftWAR = true;
}
}
GLint ProgramData::locationWARHostToApp(GLint hostLoc, GLint arrIndex)
{
if (!m_locShiftWAR) return hostLoc;
GLuint index = getIndexForLocation(hostLoc);
if (index<m_numIndexes) {
if (arrIndex > 0) {
m_Indexes[index].hostLocsPerElement =
(hostLoc - m_Indexes[index].base) / arrIndex;
}
return m_Indexes[index].appBase + arrIndex;
}
return -1;
}
GLint ProgramData::locationWARAppToHost(GLint appLoc)
{
if (!m_locShiftWAR) return appLoc;
for(GLuint i=0; i<m_numIndexes; i++) {
GLint elemIndex = appLoc - m_Indexes[i].appBase;
if (elemIndex >= 0 && elemIndex < m_Indexes[i].size) {
return m_Indexes[i].base +
elemIndex * m_Indexes[i].hostLocsPerElement;
}
}
return -1;
}
GLint ProgramData::getNextSamplerUniform(GLint index, GLint* val, GLenum* target)
{
for (GLint i = index + 1; i >= 0 && i < (GLint)m_numIndexes; i++) {
if (m_Indexes[i].type == GL_SAMPLER_2D) {
if (val) *val = m_Indexes[i].samplerValue;
if (target) {
if (m_Indexes[i].flags & INDEX_FLAG_SAMPLER_EXTERNAL) {
*target = GL_TEXTURE_EXTERNAL_OES;
} else {
*target = GL_TEXTURE_2D;
}
}
return i;
}
}
return -1;
}
bool ProgramData::setSamplerUniform(GLint appLoc, GLint val, GLenum* target)
{
for (GLuint i = 0; i < m_numIndexes; i++) {
GLint elemIndex = appLoc - m_Indexes[i].appBase;
if (elemIndex >= 0 && elemIndex < m_Indexes[i].size) {
if (m_Indexes[i].type == GL_TEXTURE_2D) {
m_Indexes[i].samplerValue = val;
if (target) {
if (m_Indexes[i].flags & INDEX_FLAG_SAMPLER_EXTERNAL) {
*target = GL_TEXTURE_EXTERNAL_OES;
} else {
*target = GL_TEXTURE_2D;
}
}
return true;
}
}
}
return false;
}
bool ProgramData::attachShader(GLuint shader)
{
size_t n = m_shaders.size();
for (size_t i = 0; i < n; i++) {
if (m_shaders[i] == shader) {
return false;
}
}
// AKA m_shaders.push_back(), but that has an ambiguous call to insertAt()
// due to the default parameters. This is the desired insertAt() overload.
m_shaders.insertAt(shader, m_shaders.size(), 1);
return true;
}
bool ProgramData::detachShader(GLuint shader)
{
size_t n = m_shaders.size();
for (size_t i = 0; i < n; i++) {
if (m_shaders[i] == shader) {
m_shaders.removeAt(i);
return true;
}
}
return false;
}
/***** GLSharedGroup ****/
GLSharedGroup::GLSharedGroup() :
m_buffers(android::DefaultKeyedVector<GLuint, BufferData*>(NULL)),
m_programs(android::DefaultKeyedVector<GLuint, ProgramData*>(NULL)),
m_shaders(android::DefaultKeyedVector<GLuint, ShaderData*>(NULL))
{
}
GLSharedGroup::~GLSharedGroup()
{
m_buffers.clear();
m_programs.clear();
clearObjectMap(m_buffers);
clearObjectMap(m_programs);
clearObjectMap(m_shaders);
}
bool GLSharedGroup::isObject(GLuint obj)
{
android::AutoMutex _lock(m_lock);
return ((m_shaders.valueFor(obj)!=NULL) || (m_programs.valueFor(obj)!=NULL));
}
BufferData * GLSharedGroup::getBufferData(GLuint bufferId)
{
android::AutoMutex _lock(m_lock);
return m_buffers.valueFor(bufferId);
}
void GLSharedGroup::addBufferData(GLuint bufferId, GLsizeiptr size, void * data)
{
android::AutoMutex _lock(m_lock);
m_buffers.add(bufferId, new BufferData(size, data));
}
void GLSharedGroup::updateBufferData(GLuint bufferId, GLsizeiptr size, void * data)
{
android::AutoMutex _lock(m_lock);
ssize_t idx = m_buffers.indexOfKey(bufferId);
if (idx >= 0) {
delete m_buffers.valueAt(idx);
m_buffers.editValueAt(idx) = new BufferData(size, data);
} else {
m_buffers.add(bufferId, new BufferData(size, data));
}
}
GLenum GLSharedGroup::subUpdateBufferData(GLuint bufferId, GLintptr offset, GLsizeiptr size, void * data)
{
android::AutoMutex _lock(m_lock);
BufferData * buf = m_buffers.valueFor(bufferId);
if ((!buf) || (buf->m_size < offset+size) || (offset < 0) || (size<0)) return GL_INVALID_VALUE;
//it's safe to update now
memcpy((char*)buf->m_fixedBuffer.ptr() + offset, data, size);
return GL_NO_ERROR;
}
void GLSharedGroup::deleteBufferData(GLuint bufferId)
{
android::AutoMutex _lock(m_lock);
ssize_t idx = m_buffers.indexOfKey(bufferId);
if (idx >= 0) {
delete m_buffers.valueAt(idx);
m_buffers.removeItemsAt(idx);
}
}
void GLSharedGroup::addProgramData(GLuint program)
{
android::AutoMutex _lock(m_lock);
ProgramData *pData = m_programs.valueFor(program);
if (pData)
{
m_programs.removeItem(program);
delete pData;
}
m_programs.add(program,new ProgramData());
}
void GLSharedGroup::initProgramData(GLuint program, GLuint numIndexes)
{
android::AutoMutex _lock(m_lock);
ProgramData *pData = m_programs.valueFor(program);
if (pData)
{
pData->initProgramData(numIndexes);
}
}
bool GLSharedGroup::isProgramInitialized(GLuint program)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
if (pData)
{
return pData->isInitialized();
}
return false;
}
void GLSharedGroup::deleteProgramData(GLuint program)
{
android::AutoMutex _lock(m_lock);
ProgramData *pData = m_programs.valueFor(program);
if (pData)
delete pData;
m_programs.removeItem(program);
}
void GLSharedGroup::attachShader(GLuint program, GLuint shader)
{
android::AutoMutex _lock(m_lock);
ProgramData* programData = m_programs.valueFor(program);
ssize_t idx = m_shaders.indexOfKey(shader);
if (programData && idx >= 0) {
if (programData->attachShader(shader)) {
refShaderDataLocked(idx);
}
}
}
void GLSharedGroup::detachShader(GLuint program, GLuint shader)
{
android::AutoMutex _lock(m_lock);
ProgramData* programData = m_programs.valueFor(program);
ssize_t idx = m_shaders.indexOfKey(shader);
if (programData && idx >= 0) {
if (programData->detachShader(shader)) {
unrefShaderDataLocked(idx);
}
}
}
void GLSharedGroup::setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type, const char* name)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
if (pData)
{
pData->setIndexInfo(index,base,size,type);
if (type == GL_SAMPLER_2D) {
size_t n = pData->getNumShaders();
for (size_t i = 0; i < n; i++) {
GLuint shaderId = pData->getShader(i);
ShaderData* shader = m_shaders.valueFor(shaderId);
if (!shader) continue;
ShaderData::StringList::iterator nameIter = shader->samplerExternalNames.begin();
ShaderData::StringList::iterator nameEnd = shader->samplerExternalNames.end();
while (nameIter != nameEnd) {
if (*nameIter == name) {
pData->setIndexFlags(index, ProgramData::INDEX_FLAG_SAMPLER_EXTERNAL);
break;
}
++nameIter;
}
}
}
}
}
GLenum GLSharedGroup::getProgramUniformType(GLuint program, GLint location)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
GLenum type=0;
if (pData)
{
type = pData->getTypeForLocation(location);
}
return type;
}
bool GLSharedGroup::isProgram(GLuint program)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
return (pData!=NULL);
}
void GLSharedGroup::setupLocationShiftWAR(GLuint program)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
if (pData) pData->setupLocationShiftWAR();
}
GLint GLSharedGroup::locationWARHostToApp(GLuint program, GLint hostLoc, GLint arrIndex)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
if (pData) return pData->locationWARHostToApp(hostLoc, arrIndex);
else return hostLoc;
}
GLint GLSharedGroup::locationWARAppToHost(GLuint program, GLint appLoc)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
if (pData) return pData->locationWARAppToHost(appLoc);
else return appLoc;
}
bool GLSharedGroup::needUniformLocationWAR(GLuint program)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
if (pData) return pData->needUniformLocationWAR();
return false;
}
GLint GLSharedGroup::getNextSamplerUniform(GLuint program, GLint index, GLint* val, GLenum* target) const
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
return pData ? pData->getNextSamplerUniform(index, val, target) : -1;
}
bool GLSharedGroup::setSamplerUniform(GLuint program, GLint appLoc, GLint val, GLenum* target)
{
android::AutoMutex _lock(m_lock);
ProgramData* pData = m_programs.valueFor(program);
return pData ? pData->setSamplerUniform(appLoc, val, target) : false;
}
bool GLSharedGroup::addShaderData(GLuint shader)
{
android::AutoMutex _lock(m_lock);
ShaderData* data = new ShaderData;
if (data) {
if (m_shaders.add(shader, data) < 0) {
delete data;
data = NULL;
}
data->refcount = 1;
}
return data != NULL;
}
ShaderData* GLSharedGroup::getShaderData(GLuint shader)
{
android::AutoMutex _lock(m_lock);
return m_shaders.valueFor(shader);
}
void GLSharedGroup::unrefShaderData(GLuint shader)
{
android::AutoMutex _lock(m_lock);
ssize_t idx = m_shaders.indexOfKey(shader);
if (idx >= 0) {
unrefShaderDataLocked(idx);
}
}
void GLSharedGroup::refShaderDataLocked(ssize_t shaderIdx)
{
assert(shaderIdx >= 0 && shaderIdx <= m_shaders.size());
ShaderData* data = m_shaders.valueAt(shaderIdx);
data->refcount++;
}
void GLSharedGroup::unrefShaderDataLocked(ssize_t shaderIdx)
{
assert(shaderIdx >= 0 && shaderIdx <= m_shaders.size());
ShaderData* data = m_shaders.valueAt(shaderIdx);
if (--data->refcount == 0) {
delete data;
m_shaders.removeItemsAt(shaderIdx);
}
}

View file

@ -0,0 +1,144 @@
/*
* 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_SHARED_GROUP_H_
#define _GL_SHARED_GROUP_H_
#define GL_API
#ifndef ANDROID
#define GL_APIENTRY
#define GL_APIENTRYP
#endif
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <stdio.h>
#include <stdlib.h>
#include "ErrorLog.h"
#include <utils/KeyedVector.h>
#include <utils/List.h>
#include <utils/String8.h>
#include <utils/threads.h>
#include "FixedBuffer.h"
#include "SmartPtr.h"
struct BufferData {
BufferData();
BufferData(GLsizeiptr size, void * data);
GLsizeiptr m_size;
FixedBuffer m_fixedBuffer;
};
class ProgramData {
private:
typedef struct _IndexInfo {
GLint base;
GLint size;
GLenum type;
GLint appBase;
GLint hostLocsPerElement;
GLuint flags;
GLint samplerValue; // only set for sampler uniforms
} IndexInfo;
GLuint m_numIndexes;
IndexInfo* m_Indexes;
bool m_initialized;
bool m_locShiftWAR;
android::Vector<GLuint> m_shaders;
public:
enum {
INDEX_FLAG_SAMPLER_EXTERNAL = 0x00000001,
};
ProgramData();
void initProgramData(GLuint numIndexes);
bool isInitialized();
virtual ~ProgramData();
void setIndexInfo(GLuint index, GLint base, GLint size, GLenum type);
void setIndexFlags(GLuint index, GLuint flags);
GLuint getIndexForLocation(GLint location);
GLenum getTypeForLocation(GLint location);
bool needUniformLocationWAR() const { return m_locShiftWAR; }
void setupLocationShiftWAR();
GLint locationWARHostToApp(GLint hostLoc, GLint arrIndex);
GLint locationWARAppToHost(GLint appLoc);
GLint getNextSamplerUniform(GLint index, GLint* val, GLenum* target);
bool setSamplerUniform(GLint appLoc, GLint val, GLenum* target);
bool attachShader(GLuint shader);
bool detachShader(GLuint shader);
size_t getNumShaders() const { return m_shaders.size(); }
GLuint getShader(size_t i) const { return m_shaders[i]; }
};
struct ShaderData {
typedef android::List<android::String8> StringList;
StringList samplerExternalNames;
int refcount;
};
class GLSharedGroup {
private:
android::DefaultKeyedVector<GLuint, BufferData*> m_buffers;
android::DefaultKeyedVector<GLuint, ProgramData*> m_programs;
android::DefaultKeyedVector<GLuint, ShaderData*> m_shaders;
mutable android::Mutex m_lock;
void refShaderDataLocked(ssize_t shaderIdx);
void unrefShaderDataLocked(ssize_t shaderIdx);
public:
GLSharedGroup();
~GLSharedGroup();
bool isObject(GLuint obj);
BufferData * getBufferData(GLuint bufferId);
void addBufferData(GLuint bufferId, GLsizeiptr size, void * data);
void updateBufferData(GLuint bufferId, GLsizeiptr size, void * data);
GLenum subUpdateBufferData(GLuint bufferId, GLintptr offset, GLsizeiptr size, void * data);
void deleteBufferData(GLuint);
bool isProgram(GLuint program);
bool isProgramInitialized(GLuint program);
void addProgramData(GLuint program);
void initProgramData(GLuint program, GLuint numIndexes);
void attachShader(GLuint program, GLuint shader);
void detachShader(GLuint program, GLuint shader);
void deleteProgramData(GLuint program);
void setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type, const char* name);
GLenum getProgramUniformType(GLuint program, GLint location);
void setupLocationShiftWAR(GLuint program);
GLint locationWARHostToApp(GLuint program, GLint hostLoc, GLint arrIndex);
GLint locationWARAppToHost(GLuint program, GLint appLoc);
bool needUniformLocationWAR(GLuint program);
GLint getNextSamplerUniform(GLuint program, GLint index, GLint* val, GLenum* target) const;
bool setSamplerUniform(GLuint program, GLint appLoc, GLint val, GLenum* target);
bool addShaderData(GLuint shader);
// caller must hold a reference to the shader as long as it holds the pointer
ShaderData* getShaderData(GLuint shader);
void unrefShaderData(GLuint shader);
};
typedef SmartPtr<GLSharedGroup> GLSharedGroupPtr;
#endif //_GL_SHARED_GROUP_H_

View file

@ -0,0 +1,13 @@
ROOT=../..
include $(ROOT)/make/commondefs
CXXFILES = TcpStream.cpp GLClientState.cpp glUtils.cpp
CXXINCS += -I$(ROOT)/libs/GLESv1 -I$(ROOT)/include
LIBRARY_NAME = libcodecCommon.a
include $(COMMONRULES)

View file

@ -0,0 +1,167 @@
/*
* 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 __SMART_PTR_H
#define __SMART_PTR_H
#include <cutils/threads.h>
#include <cutils/atomic.h>
template <class T, bool threadSafe = false>
class SmartPtr
{
public:
explicit SmartPtr(T* ptr = (T*)NULL) {
if (threadSafe) {
m_lock = new mutex_t;
mutex_init(m_lock);
}
else m_lock = NULL;
m_ptr = ptr;
if (ptr)
m_pRefCount = new int32_t(1);
else
m_pRefCount = NULL;
}
SmartPtr<T,threadSafe>(const SmartPtr<T,false>& rhs) {
if (threadSafe) {
m_lock = new mutex_t;
mutex_init(m_lock);
}
else m_lock = NULL;
m_pRefCount = rhs.m_pRefCount;
m_ptr = rhs.m_ptr;
use();
}
SmartPtr<T,threadSafe>(SmartPtr<T,true>& rhs) {
if (threadSafe) {
m_lock = new mutex_t;
mutex_init(m_lock);
}
else m_lock = NULL;
if (rhs.m_lock) mutex_lock(rhs.m_lock);
m_pRefCount = rhs.m_pRefCount;
m_ptr = rhs.m_ptr;
use();
if (rhs.m_lock) mutex_unlock(rhs.m_lock);
}
~SmartPtr() {
if (m_lock) mutex_lock(m_lock);
release();
if (m_lock)
{
mutex_unlock(m_lock);
mutex_destroy(m_lock);
delete m_lock;
}
}
T* Ptr() const {
return m_ptr;
}
const T* constPtr() const
{
return m_ptr;
}
T* operator->() const {
return m_ptr;
}
T& operator*() const {
return *m_ptr;
}
operator void*() const {
return (void *)m_ptr;
}
// This gives STL lists something to compare.
bool operator <(const SmartPtr<T>& t1) const {
return m_ptr < t1.m_ptr;
}
SmartPtr<T,threadSafe>& operator=(const SmartPtr<T,false>& rhs)
{
if (m_ptr == rhs.m_ptr)
return *this;
if (m_lock) mutex_lock(m_lock);
release();
m_pRefCount = rhs.m_pRefCount;
m_ptr = rhs.m_ptr;
use();
if (m_lock) mutex_unlock(m_lock);
return *this;
}
SmartPtr<T,threadSafe>& operator=(SmartPtr<T,true>& rhs)
{
if (m_ptr == rhs.m_ptr)
return *this;
if (m_lock) mutex_lock(m_lock);
release();
if (rhs.m_lock) mutex_lock(rhs.m_lock);
m_pRefCount = rhs.m_pRefCount;
m_ptr = rhs.m_ptr;
use();
if (rhs.m_lock) mutex_unlock(rhs.m_lock);
if (m_lock) mutex_unlock(m_lock);
return *this;
}
private:
int32_t *m_pRefCount;
mutex_t *m_lock;
T* m_ptr;
// Increment the reference count on this pointer by 1.
int use() {
if (!m_pRefCount) return 0;
return android_atomic_inc(m_pRefCount) + 1;
}
// Decrement the reference count on the pointer by 1.
// If the reference count goes to (or below) 0, the pointer is deleted.
int release() {
if (!m_pRefCount) return 0;
int iVal = android_atomic_dec(m_pRefCount);
if (iVal > 1)
return iVal - 1;
delete m_pRefCount;
m_pRefCount = NULL;
if (m_ptr) {
delete m_ptr;
m_ptr = NULL;
}
return 0;
}
};
#endif // of __SMART_PTR_H

View file

@ -0,0 +1,168 @@
/*
* 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 <cutils/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>
#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) {
#ifdef _WIN32
closesocket(m_sock);
#else
::close(m_sock);
#endif
}
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)
{
const unsigned char* ret = NULL;
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 = 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;
}

View file

@ -0,0 +1,50 @@
/*
* 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;
explicit SocketStream(size_t bufsize = 10000);
virtual ~SocketStream();
virtual int listen(unsigned short port) = 0;
virtual SocketStream *accept() = 0;
virtual int connect(unsigned short port) = 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);
protected:
int m_sock;
size_t m_bufsize;
unsigned char *m_buf;
SocketStream(int sock, size_t bufSize);
};
#endif /* __SOCKET_STREAM_H */

View file

@ -0,0 +1,91 @@
/*
* 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 <cutils/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
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.
#ifdef _WIN32
DWORD flag;
#else
int flag;
#endif
flag = 1;
setsockopt( sock, IPPROTO_TCP, TCP_NODELAY, (const char*)&flag, sizeof(flag) );
}
int TcpStream::listen(unsigned short port)
{
m_sock = socket_loopback_server(port, SOCK_STREAM);
if (!valid()) return int(ERR_INVALID_SOCKET);
return 0;
}
SocketStream * TcpStream::accept()
{
int clientSock = -1;
while (true) {
struct sockaddr_in addr;
socklen_t len = sizeof(addr);
clientSock = ::accept(m_sock, (sockaddr *)&addr, &len);
if (clientSock < 0 && errno == EINTR) {
continue;
}
break;
}
TcpStream *clientStream = NULL;
if (clientSock >= 0) {
clientStream = new TcpStream(clientSock, m_bufsize);
}
return clientStream;
}
int TcpStream::connect(unsigned short port)
{
return connect("127.0.0.1",port);
}
int TcpStream::connect(const char* hostname, unsigned short port)
{
m_sock = socket_network_client(hostname, port, SOCK_STREAM);
if (!valid()) return -1;
return 0;
}

View 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(unsigned short port);
virtual SocketStream *accept();
virtual int connect(unsigned short port);
int connect(const char* hostname, unsigned short port);
private:
TcpStream(int sock, size_t bufSize);
};
#endif

View 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 _CODEC_DEFS_H
#define _CODEC_DEFS_H
#define CODEC_SERVER_PORT 22468
#define CODEC_MAX_VERTEX_ATTRIBUTES 64
#endif

View file

@ -0,0 +1,475 @@
/*
* 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 "glUtils.h"
#include <string.h>
#include "ErrorLog.h"
#include <IOStream.h>
size_t glSizeof(GLenum type)
{
size_t retval = 0;
switch(type) {
case GL_BYTE:
case GL_UNSIGNED_BYTE:
retval = 1;
break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
case GL_HALF_FLOAT_OES:
retval = 2;
break;
case GL_UNSIGNED_INT:
case GL_INT:
case GL_FLOAT:
case GL_FIXED:
case GL_BOOL:
retval = 4;
break;
#ifdef GL_DOUBLE
case GL_DOUBLE:
retval = 8;
break;
#endif
case GL_FLOAT_VEC2:
case GL_INT_VEC2:
case GL_BOOL_VEC2:
retval = 8;
break;
case GL_INT_VEC3:
case GL_BOOL_VEC3:
case GL_FLOAT_VEC3:
retval = 12;
break;
case GL_FLOAT_VEC4:
case GL_BOOL_VEC4:
case GL_INT_VEC4:
case GL_FLOAT_MAT2:
retval = 16;
break;
case GL_FLOAT_MAT3:
retval = 36;
break;
case GL_FLOAT_MAT4:
retval = 64;
break;
case GL_SAMPLER_2D:
case GL_SAMPLER_CUBE:
retval = 4;
break;
default:
ERR("**** ERROR unknown type 0x%x (%s,%d)\n", type, __FUNCTION__,__LINE__);
}
return retval;
}
size_t glUtilsParamSize(GLenum param)
{
size_t s = 0;
switch(param)
{
case GL_DEPTH_TEST:
case GL_DEPTH_FUNC:
case GL_DEPTH_BITS:
case GL_MAX_CLIP_PLANES:
case GL_GREEN_BITS:
case GL_MAX_MODELVIEW_STACK_DEPTH:
case GL_MAX_PROJECTION_STACK_DEPTH:
case GL_MAX_TEXTURE_STACK_DEPTH:
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
case GL_MAX_TEXTURE_SIZE:
case GL_TEXTURE_GEN_MODE_OES:
case GL_TEXTURE_ENV_MODE:
case GL_FOG_MODE:
case GL_FOG_DENSITY:
case GL_FOG_START:
case GL_FOG_END:
case GL_SPOT_EXPONENT:
case GL_CONSTANT_ATTENUATION:
case GL_LINEAR_ATTENUATION:
case GL_QUADRATIC_ATTENUATION:
case GL_SHININESS:
case GL_LIGHT_MODEL_TWO_SIDE:
case GL_POINT_SIZE:
case GL_POINT_SIZE_MIN:
case GL_POINT_SIZE_MAX:
case GL_POINT_FADE_THRESHOLD_SIZE:
case GL_CULL_FACE:
case GL_CULL_FACE_MODE:
case GL_FRONT_FACE:
case GL_SHADE_MODEL:
case GL_DEPTH_WRITEMASK:
case GL_DEPTH_CLEAR_VALUE:
case GL_STENCIL_FAIL:
case GL_STENCIL_PASS_DEPTH_FAIL:
case GL_STENCIL_PASS_DEPTH_PASS:
case GL_STENCIL_REF:
case GL_STENCIL_WRITEMASK:
case GL_MATRIX_MODE:
case GL_MODELVIEW_STACK_DEPTH:
case GL_PROJECTION_STACK_DEPTH:
case GL_TEXTURE_STACK_DEPTH:
case GL_ALPHA_TEST_FUNC:
case GL_ALPHA_TEST_REF:
case GL_ALPHA_TEST:
case GL_DITHER:
case GL_BLEND_DST:
case GL_BLEND_SRC:
case GL_BLEND:
case GL_LOGIC_OP_MODE:
case GL_SCISSOR_TEST:
case GL_MAX_TEXTURE_UNITS:
case GL_ACTIVE_TEXTURE:
case GL_ALPHA_BITS:
case GL_ARRAY_BUFFER_BINDING:
case GL_BLUE_BITS:
case GL_CLIENT_ACTIVE_TEXTURE:
case GL_CLIP_PLANE0:
case GL_CLIP_PLANE1:
case GL_CLIP_PLANE2:
case GL_CLIP_PLANE3:
case GL_CLIP_PLANE4:
case GL_CLIP_PLANE5:
case GL_COLOR_ARRAY:
case GL_COLOR_ARRAY_BUFFER_BINDING:
case GL_COLOR_ARRAY_SIZE:
case GL_COLOR_ARRAY_STRIDE:
case GL_COLOR_ARRAY_TYPE:
case GL_COLOR_LOGIC_OP:
case GL_COLOR_MATERIAL:
case GL_PACK_ALIGNMENT:
case GL_PERSPECTIVE_CORRECTION_HINT:
case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
case GL_POINT_SIZE_ARRAY_STRIDE_OES:
case GL_POINT_SIZE_ARRAY_TYPE_OES:
case GL_POINT_SMOOTH:
case GL_POINT_SMOOTH_HINT:
case GL_POINT_SPRITE_OES:
case GL_COORD_REPLACE_OES:
case GL_COMBINE_ALPHA:
case GL_SRC0_RGB:
case GL_SRC1_RGB:
case GL_SRC2_RGB:
case GL_OPERAND0_RGB:
case GL_OPERAND1_RGB:
case GL_OPERAND2_RGB:
case GL_SRC0_ALPHA:
case GL_SRC1_ALPHA:
case GL_SRC2_ALPHA:
case GL_OPERAND0_ALPHA:
case GL_OPERAND1_ALPHA:
case GL_OPERAND2_ALPHA:
case GL_RGB_SCALE:
case GL_ALPHA_SCALE:
case GL_COMBINE_RGB:
case GL_POLYGON_OFFSET_FACTOR:
case GL_POLYGON_OFFSET_FILL:
case GL_POLYGON_OFFSET_UNITS:
case GL_RED_BITS:
case GL_RESCALE_NORMAL:
case GL_SAMPLE_ALPHA_TO_COVERAGE:
case GL_SAMPLE_ALPHA_TO_ONE:
case GL_SAMPLE_BUFFERS:
case GL_SAMPLE_COVERAGE:
case GL_SAMPLE_COVERAGE_INVERT:
case GL_SAMPLE_COVERAGE_VALUE:
case GL_SAMPLES:
case GL_MAX_SAMPLES_EXT:
case GL_STENCIL_BITS:
case GL_STENCIL_CLEAR_VALUE:
case GL_STENCIL_FUNC:
case GL_STENCIL_TEST:
case GL_STENCIL_VALUE_MASK:
case GL_STENCIL_BACK_FUNC:
case GL_STENCIL_BACK_VALUE_MASK:
case GL_STENCIL_BACK_REF:
case GL_STENCIL_BACK_FAIL:
case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
case GL_STENCIL_BACK_PASS_DEPTH_PASS:
case GL_STENCIL_BACK_WRITEMASK:
case GL_TEXTURE_2D:
case GL_TEXTURE_BINDING_2D:
case GL_TEXTURE_BINDING_CUBE_MAP:
case GL_TEXTURE_BINDING_EXTERNAL_OES:
case GL_TEXTURE_COORD_ARRAY:
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
case GL_TEXTURE_COORD_ARRAY_SIZE:
case GL_TEXTURE_COORD_ARRAY_STRIDE:
case GL_TEXTURE_COORD_ARRAY_TYPE:
case GL_UNPACK_ALIGNMENT:
case GL_VERTEX_ARRAY:
case GL_VERTEX_ARRAY_BUFFER_BINDING:
case GL_VERTEX_ARRAY_SIZE:
case GL_VERTEX_ARRAY_STRIDE:
case GL_VERTEX_ARRAY_TYPE:
case GL_SPOT_CUTOFF:
case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
case GL_GENERATE_MIPMAP:
case GL_GENERATE_MIPMAP_HINT:
case GL_RENDERBUFFER_WIDTH_OES:
case GL_RENDERBUFFER_HEIGHT_OES:
case GL_RENDERBUFFER_INTERNAL_FORMAT_OES:
case GL_RENDERBUFFER_RED_SIZE_OES:
case GL_RENDERBUFFER_GREEN_SIZE_OES:
case GL_RENDERBUFFER_BLUE_SIZE_OES:
case GL_RENDERBUFFER_ALPHA_SIZE_OES:
case GL_RENDERBUFFER_DEPTH_SIZE_OES:
case GL_RENDERBUFFER_STENCIL_SIZE_OES:
case GL_RENDERBUFFER_BINDING:
case GL_FRAMEBUFFER_BINDING:
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES:
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES:
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES:
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES:
case GL_FENCE_STATUS_NV:
case GL_FENCE_CONDITION_NV:
case GL_TEXTURE_WIDTH_QCOM:
case GL_TEXTURE_HEIGHT_QCOM:
case GL_TEXTURE_DEPTH_QCOM:
case GL_TEXTURE_INTERNAL_FORMAT_QCOM:
case GL_TEXTURE_FORMAT_QCOM:
case GL_TEXTURE_TYPE_QCOM:
case GL_TEXTURE_IMAGE_VALID_QCOM:
case GL_TEXTURE_NUM_LEVELS_QCOM:
case GL_TEXTURE_TARGET_QCOM:
case GL_TEXTURE_OBJECT_VALID_QCOM:
case GL_BLEND_EQUATION_RGB_OES:
case GL_BLEND_EQUATION_ALPHA_OES:
case GL_BLEND_DST_RGB_OES:
case GL_BLEND_SRC_RGB_OES:
case GL_BLEND_DST_ALPHA_OES:
case GL_BLEND_SRC_ALPHA_OES:
case GL_MAX_LIGHTS:
case GL_SHADER_TYPE:
case GL_DELETE_STATUS:
case GL_COMPILE_STATUS:
case GL_INFO_LOG_LENGTH:
case GL_SHADER_SOURCE_LENGTH:
case GL_CURRENT_PROGRAM:
case GL_LINK_STATUS:
case GL_VALIDATE_STATUS:
case GL_ATTACHED_SHADERS:
case GL_ACTIVE_UNIFORMS:
case GL_ACTIVE_ATTRIBUTES:
case GL_SUBPIXEL_BITS:
case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
case GL_NUM_SHADER_BINARY_FORMATS:
case GL_SHADER_COMPILER:
case GL_MAX_VERTEX_ATTRIBS:
case GL_MAX_VERTEX_UNIFORM_VECTORS:
case GL_MAX_VARYING_VECTORS:
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
case GL_MAX_RENDERBUFFER_SIZE:
case GL_MAX_TEXTURE_IMAGE_UNITS:
case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
case GL_LINE_WIDTH:
s = 1;
break;
case GL_ALIASED_LINE_WIDTH_RANGE:
case GL_ALIASED_POINT_SIZE_RANGE:
case GL_DEPTH_RANGE:
case GL_MAX_VIEWPORT_DIMS:
case GL_SMOOTH_POINT_SIZE_RANGE:
case GL_SMOOTH_LINE_WIDTH_RANGE:
s= 2;
break;
case GL_SPOT_DIRECTION:
case GL_POINT_DISTANCE_ATTENUATION:
case GL_CURRENT_NORMAL:
s = 3;
break;
case GL_CURRENT_VERTEX_ATTRIB:
case GL_CURRENT_TEXTURE_COORDS:
case GL_CURRENT_COLOR:
case GL_FOG_COLOR:
case GL_AMBIENT:
case GL_DIFFUSE:
case GL_SPECULAR:
case GL_EMISSION:
case GL_POSITION:
case GL_LIGHT_MODEL_AMBIENT:
case GL_TEXTURE_ENV_COLOR:
case GL_SCISSOR_BOX:
case GL_VIEWPORT:
case GL_TEXTURE_CROP_RECT_OES:
case GL_COLOR_CLEAR_VALUE:
case GL_COLOR_WRITEMASK:
case GL_AMBIENT_AND_DIFFUSE:
case GL_BLEND_COLOR:
s = 4;
break;
case GL_MODELVIEW_MATRIX:
case GL_PROJECTION_MATRIX:
case GL_TEXTURE_MATRIX:
s = 16;
break;
default:
ERR("glUtilsParamSize: unknow param 0x%08x\n", param);
s = 1; // assume 1
}
return s;
}
void glUtilsPackPointerData(unsigned char *dst, unsigned char *src,
int size, GLenum type, unsigned int stride,
unsigned int datalen)
{
unsigned int vsize = size * glSizeof(type);
if (stride == 0) stride = vsize;
if (stride == vsize) {
memcpy(dst, src, datalen);
} else {
for (unsigned int i = 0; i < datalen; i += vsize) {
memcpy(dst, src, vsize);
dst += vsize;
src += stride;
}
}
}
void glUtilsWritePackPointerData(void* _stream, unsigned char *src,
int size, GLenum type, unsigned int stride,
unsigned int datalen)
{
IOStream* stream = reinterpret_cast<IOStream*>(_stream);
unsigned int vsize = size * glSizeof(type);
if (stride == 0) stride = vsize;
if (stride == vsize) {
stream->writeFully(src, datalen);
} else {
for (unsigned int i = 0; i < datalen; i += vsize) {
stream->writeFully(src, (size_t)vsize);
src += stride;
}
}
}
int glUtilsPixelBitSize(GLenum format, GLenum type)
{
int components = 0;
int componentsize = 0;
int pixelsize = 0;
switch(type) {
case GL_BYTE:
case GL_UNSIGNED_BYTE:
componentsize = 8;
break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_RGB565_OES:
case GL_RGB5_A1_OES:
case GL_RGBA4_OES:
pixelsize = 16;
break;
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
case GL_FIXED:
case GL_UNSIGNED_INT_24_8_OES:
pixelsize = 32;
break;
default:
ERR("glUtilsPixelBitSize: unknown pixel type - assuming pixel data 0\n");
componentsize = 0;
}
if (pixelsize == 0) {
switch(format) {
#if 0
case GL_RED:
case GL_GREEN:
case GL_BLUE:
#endif
case GL_ALPHA:
case GL_LUMINANCE:
case GL_DEPTH_COMPONENT:
case GL_DEPTH_STENCIL_OES:
components = 1;
break;
case GL_LUMINANCE_ALPHA:
components = 2;
break;
case GL_RGB:
#if 0
case GL_BGR:
#endif
components = 3;
break;
case GL_RGBA:
case GL_BGRA_EXT:
components = 4;
break;
default:
ERR("glUtilsPixelBitSize: unknown pixel format...\n");
components = 0;
}
pixelsize = components * componentsize;
}
return pixelsize;
}
// pack a list of strings into one.
void glUtilsPackStrings(char *ptr, char **strings, GLint *length, GLsizei count)
{
char *p = ptr;
*p = '\0';
for (int i = 0; i < count; i++) {
int l=0;
if (strings[i]!=NULL) {
if (length == NULL || length[i] < 0) {
l = strlen(strings[i]);
strcat(p, strings[i]);
} else {
l = length[i];
strncat(p, strings[i], l);
}
}
p += l;
}
}
// claculate the length of a list of strings
int glUtilsCalcShaderSourceLen( char **strings, GLint *length, GLsizei count)
{
int len = 0;
for (int i = 0; i < count; i++) {
int l;
if (length == NULL || length[i] < 0) {
l = strings[i]!=NULL ? strlen(strings[i]) : 0;
} else {
l = length[i];
}
len += l;
}
return len;
}

View 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.
*/
#ifndef __GL_UTILS_H__
#define __GL_UTILS_H__
#include <stdio.h>
#include <stdlib.h>
#ifdef GL_API
#undef GL_API
#endif
#define GL_API
#ifdef GL_APIENTRY
#undef GL_APIENTRY
#endif
#ifdef GL_APIENTRYP
#undef GL_APIENTRYP
#endif
#define GL_APIENTRYP
#ifndef ANDROID
#define GL_APIENTRY
#endif
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#ifdef __cplusplus
extern "C" {
#endif
size_t glSizeof(GLenum type);
size_t glUtilsParamSize(GLenum param);
void glUtilsPackPointerData(unsigned char *dst, unsigned char *str,
int size, GLenum type, unsigned int stride,
unsigned int datalen);
void glUtilsWritePackPointerData(void* stream, unsigned char *src,
int size, GLenum type, unsigned int stride,
unsigned int datalen);
int glUtilsPixelBitSize(GLenum format, GLenum type);
void glUtilsPackStrings(char *ptr, char **strings, GLint *length, GLsizei count);
int glUtilsCalcShaderSourceLen(char **strings, GLint *length, GLsizei count);
#ifdef __cplusplus
};
#endif
namespace GLUtils {
template <class T> void minmax(T *indices, int count, int *min, int *max) {
*min = -1;
*max = -1;
T *ptr = indices;
for (int i = 0; i < count; i++) {
if (*min == -1 || *ptr < *min) *min = *ptr;
if (*max == -1 || *ptr > *max) *max = *ptr;
ptr++;
}
}
template <class T> void shiftIndices(T *indices, int count, int offset) {
T *ptr = indices;
for (int i = 0; i < count; i++) {
*ptr += offset;
ptr++;
}
}
template <class T> void shiftIndices(T *src, T *dst, int count, int offset)
{
for (int i = 0; i < count; i++) {
*dst = *src + offset;
dst++;
src++;
}
}
}; // namespace GLUtils
#endif

View file

@ -0,0 +1,63 @@
/*
* 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_BASE_TYPES__H
#define __GL_BASE_TYPES__H
#include <KHR/khrplatform.h>
#ifndef gl_APIENTRY
#define gl_APIENTRY KHRONOS_APIENTRY
#endif
#ifndef gl2_APIENTRY
#define gl2_APIENTRY KHRONOS_APIENTRY
#endif
typedef void GLvoid;
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef char GLchar;
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;
typedef char *GLstr;
/* JR XXX Treating this as an in handle - is this correct? */
typedef void * GLeglImageOES;
/* ErrorCode */
#ifndef GL_INVALID_ENUM
#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
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
#endif
#endif

View file

@ -0,0 +1,12 @@
LOCAL_PATH := $(call my-dir)
### GLESv1 implementation ###########################################
$(call emugl-begin-shared-library,libGLESv1_CM_emulation)
$(call emugl-import,libOpenglSystemCommon libGLESv1_enc lib_renderControl_enc)
LOCAL_CFLAGS += -DLOG_TAG=\"GLES_emulation\" -DGL_GLEXT_PROTOTYPES
LOCAL_SRC_FILES := gl.cpp
LOCAL_MODULE_RELATIVE_PATH := egl
$(call emugl-end-module)

View file

@ -0,0 +1,165 @@
/*
* 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 "EGLClientIface.h"
#include "HostConnection.h"
#include "GLEncoder.h"
#include "GLES/gl.h"
#include "GLES/glext.h"
#include "ErrorLog.h"
#include "gralloc_cb.h"
#include "ThreadInfo.h"
#include "EGLImage.h"
//XXX: fix this macro to get the context from fast tls path
#define GET_CONTEXT GLEncoder * ctx = getEGLThreadInfo()->hostConn->glEncoder();
#include "gl_entry.cpp"
//The functions table
#include "gl_ftable.h"
static EGLClient_eglInterface * s_egl = NULL;
static EGLClient_glesInterface * s_gl = NULL;
#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
HostConnection *hostCon = HostConnection::get(); \
if (!hostCon) { \
ALOGE("egl: Failed to get host connection\n"); \
return ret; \
} \
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
if (!rcEnc) { \
ALOGE("egl: Failed to get renderControl encoder context\n"); \
return ret; \
}
//GL extensions
void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES img)
{
(void)self;
DBG("glEGLImageTargetTexture2DOES v1 target=%#x img=%p", target, img);
EGLImage_t *image = (EGLImage_t*)img;
if (image->target == EGL_NATIVE_BUFFER_ANDROID) {
//TODO: check error - we don't have a way to set gl error
android_native_buffer_t* native_buffer = image->native_buffer;
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
return;
}
if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
return;
}
GET_CONTEXT;
DEFINE_AND_VALIDATE_HOST_CONNECTION();
ctx->override2DTextureTarget(target);
rcEnc->rcBindTexture(rcEnc,
((cb_handle_t *)(native_buffer->handle))->hostHandle);
ctx->restore2DTextureTarget();
}
else if (image->target == EGL_GL_TEXTURE_2D_KHR) {
GET_CONTEXT;
ctx->override2DTextureTarget(target);
GLeglImageOES hostImage = reinterpret_cast<GLeglImageOES>((intptr_t)image->host_egl_image);
ctx->m_glEGLImageTargetTexture2DOES_enc(self, target, hostImage);
ctx->restore2DTextureTarget();
}
}
void glEGLImageTargetRenderbufferStorageOES(void *self, GLenum target, GLeglImageOES image)
{
(void)self;
(void)target;
DBG("glEGLImageTargetRenderbufferStorageOES v1 target=%#x image=%p",
target, image);
//TODO: check error - we don't have a way to set gl error
android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
return;
}
if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
return;
}
DEFINE_AND_VALIDATE_HOST_CONNECTION();
rcEnc->rcBindRenderbuffer(rcEnc,
((cb_handle_t *)(native_buffer->handle))->hostHandle);
return;
}
void * getProcAddress(const char * procname)
{
// search in GL function table
for (int i=0; i<gl_num_funcs; i++) {
if (!strcmp(gl_funcs_by_name[i].name, procname)) {
return gl_funcs_by_name[i].proc;
}
}
return NULL;
}
void finish()
{
glFinish();
}
const GLubyte *my_glGetString (void *self, GLenum name)
{
(void)self;
if (s_egl) {
return (const GLubyte*)s_egl->getGLString(name);
}
return NULL;
}
void init()
{
GET_CONTEXT;
ctx->m_glEGLImageTargetTexture2DOES_enc = ctx->glEGLImageTargetTexture2DOES;
ctx->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES;
ctx->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES;
ctx->glGetString = &my_glGetString;
}
extern "C" {
EGLClient_glesInterface * init_emul_gles(EGLClient_eglInterface *eglIface)
{
s_egl = eglIface;
if (!s_gl) {
s_gl = new EGLClient_glesInterface();
s_gl->getProcAddress = getProcAddress;
s_gl->finish = finish;
s_gl->init = init;
}
return s_gl;
}
} //extern

View file

@ -0,0 +1,19 @@
LOCAL_PATH := $(call my-dir)
### GLESv1_enc Encoder ###########################################
$(call emugl-begin-shared-library,libGLESv1_enc)
LOCAL_CFLAGS += -DLOG_TAG=\"emuglGLESv1_enc\"
LOCAL_SRC_FILES := \
GLEncoder.cpp \
GLEncoderUtils.cpp \
gl_client_context.cpp \
gl_enc.cpp \
gl_entry.cpp
$(call emugl-import,libOpenglCodecCommon)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-export,C_INCLUDES,$(intermediates))
$(call emugl-end-module)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,154 @@
/*
* 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_ENCODER_H_
#define _GL_ENCODER_H_
#include "gl_enc.h"
#include "GLClientState.h"
#include "GLSharedGroup.h"
#include "FixedBuffer.h"
#include "ChecksumCalculator.h"
class GLEncoder : public gl_encoder_context_t {
public:
GLEncoder(IOStream *stream, ChecksumCalculator* protocol);
virtual ~GLEncoder();
void setClientState(GLClientState *state) {
m_state = state;
}
void setSharedGroup(GLSharedGroupPtr shared) { m_shared = shared; }
void flush() { m_stream->flush(); }
size_t pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack);
void setInitialized(){ m_initialized = true; };
bool isInitialized(){ return m_initialized; };
virtual void setError(GLenum error){ m_error = error; };
virtual GLenum getError() { return m_error; };
void override2DTextureTarget(GLenum target);
void restore2DTextureTarget();
private:
bool m_initialized;
GLClientState *m_state;
GLSharedGroupPtr m_shared;
GLenum m_error;
FixedBuffer m_fixedBuffer;
GLint *m_compressedTextureFormats;
GLint m_num_compressedTextureFormats;
GLint *getCompressedTextureFormats();
// original functions;
glGetError_client_proc_t m_glGetError_enc;
glGetIntegerv_client_proc_t m_glGetIntegerv_enc;
glGetFloatv_client_proc_t m_glGetFloatv_enc;
glGetFixedv_client_proc_t m_glGetFixedv_enc;
glGetBooleanv_client_proc_t m_glGetBooleanv_enc;
glGetPointerv_client_proc_t m_glGetPointerv_enc;
glPixelStorei_client_proc_t m_glPixelStorei_enc;
glVertexPointer_client_proc_t m_glVertexPointer_enc;
glNormalPointer_client_proc_t m_glNormalPointer_enc;
glColorPointer_client_proc_t m_glColorPointer_enc;
glPointSizePointerOES_client_proc_t m_glPointSizePointerOES_enc;
glTexCoordPointer_client_proc_t m_glTexCoordPointer_enc;
glClientActiveTexture_client_proc_t m_glClientActiveTexture_enc;
glMatrixIndexPointerOES_client_proc_t m_glMatrixIndexPointerOES_enc;
glWeightPointerOES_client_proc_t m_glWeightPointerOES_enc;
glBindBuffer_client_proc_t m_glBindBuffer_enc;
glBufferData_client_proc_t m_glBufferData_enc;
glBufferSubData_client_proc_t m_glBufferSubData_enc;
glDeleteBuffers_client_proc_t m_glDeleteBuffers_enc;
glEnableClientState_client_proc_t m_glEnableClientState_enc;
glDisableClientState_client_proc_t m_glDisableClientState_enc;
glIsEnabled_client_proc_t m_glIsEnabled_enc;
glDrawArrays_client_proc_t m_glDrawArrays_enc;
glDrawElements_client_proc_t m_glDrawElements_enc;
glFlush_client_proc_t m_glFlush_enc;
glActiveTexture_client_proc_t m_glActiveTexture_enc;
glBindTexture_client_proc_t m_glBindTexture_enc;
glDeleteTextures_client_proc_t m_glDeleteTextures_enc;
glDisable_client_proc_t m_glDisable_enc;
glEnable_client_proc_t m_glEnable_enc;
glGetTexParameterfv_client_proc_t m_glGetTexParameterfv_enc;
glGetTexParameteriv_client_proc_t m_glGetTexParameteriv_enc;
glGetTexParameterxv_client_proc_t m_glGetTexParameterxv_enc;
glTexParameterf_client_proc_t m_glTexParameterf_enc;
glTexParameterfv_client_proc_t m_glTexParameterfv_enc;
glTexParameteri_client_proc_t m_glTexParameteri_enc;
glTexParameterx_client_proc_t m_glTexParameterx_enc;
glTexParameteriv_client_proc_t m_glTexParameteriv_enc;
glTexParameterxv_client_proc_t m_glTexParameterxv_enc;
// statics
static GLenum s_glGetError(void * self);
static void s_glGetIntegerv(void *self, GLenum pname, GLint *ptr);
static void s_glGetBooleanv(void *self, GLenum pname, GLboolean *ptr);
static void s_glGetFloatv(void *self, GLenum pname, GLfloat *ptr);
static void s_glGetFixedv(void *self, GLenum pname, GLfixed *ptr);
static void s_glGetPointerv(void *self, GLenum pname, GLvoid **params);
static void s_glFlush(void * self);
static const GLubyte * s_glGetString(void *self, GLenum name);
static void s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, const void *data);
static void s_glNormalPointer(void *self, GLenum type, GLsizei stride, const void *data);
static void s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, const void *data);
static void s_glPointSizePointerOES(void *self, GLenum type, GLsizei stride, const void *data);
static void s_glClientActiveTexture(void *self, GLenum texture);
static void s_glTexCoordPointer(void *self, int size, GLenum type, GLsizei stride, const void *data);
static void s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data);
static void s_glWeightPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data);
static void s_glDisableClientState(void *self, GLenum state);
static void s_glEnableClientState(void *self, GLenum state);
static GLboolean s_glIsEnabled(void *self, GLenum cap);
static void s_glBindBuffer(void *self, GLenum target, GLuint id);
static void s_glBufferData(void *self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage);
static void s_glBufferSubData(void *self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data);
static void s_glDeleteBuffers(void *self, GLsizei n, const GLuint * buffers);
static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count);
static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices);
static void s_glPixelStorei(void *self, GLenum param, GLint value);
static void s_glFinish(void *self);
void sendVertexData(unsigned first, unsigned count);
static void s_glActiveTexture(void* self, GLenum texture);
static void s_glBindTexture(void* self, GLenum target, GLuint texture);
static void s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures);
static void s_glDisable(void* self, GLenum cap);
static void s_glEnable(void* self, GLenum cap);
static void s_glGetTexParameterfv(void* self, GLenum target, GLenum pname, GLfloat* params);
static void s_glGetTexParameteriv(void* self, GLenum target, GLenum pname, GLint* params);
static void s_glGetTexParameterxv(void* self, GLenum target, GLenum pname, GLfixed* params);
static void s_glTexParameterf(void* self, GLenum target, GLenum pname, GLfloat param);
static void s_glTexParameterfv(void* self, GLenum target, GLenum pname, const GLfloat* params);
static void s_glTexParameteri(void* self, GLenum target, GLenum pname, GLint param);
static void s_glTexParameterx(void* self, GLenum target, GLenum pname, GLfixed param);
static void s_glTexParameteriv(void* self, GLenum target, GLenum pname, const GLint* params);
static void s_glTexParameterxv(void* self, GLenum target, GLenum pname, const GLfixed* params);
public:
glEGLImageTargetTexture2DOES_client_proc_t m_glEGLImageTargetTexture2DOES_enc;
};
#endif

View file

@ -0,0 +1,28 @@
/*
* 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 <stdio.h>
#include <stdlib.h>
#include "GLEncoder.h"
namespace glesv1_enc {
size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack)
{
GLEncoder *ctx = (GLEncoder *)self;
return ctx->pixelDataSize(width, height, format, type, pack);
}
} // namespace glesv1_enc

View 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 GL_ENCODER_UTILS_H
#define GL_ENCODER_UTILS_H
namespace glesv1_enc {
size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack);
};
#endif

View file

@ -0,0 +1,306 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#include <string.h>
#include "gl_client_context.h"
#include <stdio.h>
int gl_client_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)
{
glAlphaFunc = (glAlphaFunc_client_proc_t) getProc("glAlphaFunc", userData);
glClearColor = (glClearColor_client_proc_t) getProc("glClearColor", userData);
glClearDepthf = (glClearDepthf_client_proc_t) getProc("glClearDepthf", userData);
glClipPlanef = (glClipPlanef_client_proc_t) getProc("glClipPlanef", userData);
glColor4f = (glColor4f_client_proc_t) getProc("glColor4f", userData);
glDepthRangef = (glDepthRangef_client_proc_t) getProc("glDepthRangef", userData);
glFogf = (glFogf_client_proc_t) getProc("glFogf", userData);
glFogfv = (glFogfv_client_proc_t) getProc("glFogfv", userData);
glFrustumf = (glFrustumf_client_proc_t) getProc("glFrustumf", userData);
glGetClipPlanef = (glGetClipPlanef_client_proc_t) getProc("glGetClipPlanef", userData);
glGetFloatv = (glGetFloatv_client_proc_t) getProc("glGetFloatv", userData);
glGetLightfv = (glGetLightfv_client_proc_t) getProc("glGetLightfv", userData);
glGetMaterialfv = (glGetMaterialfv_client_proc_t) getProc("glGetMaterialfv", userData);
glGetTexEnvfv = (glGetTexEnvfv_client_proc_t) getProc("glGetTexEnvfv", userData);
glGetTexParameterfv = (glGetTexParameterfv_client_proc_t) getProc("glGetTexParameterfv", userData);
glLightModelf = (glLightModelf_client_proc_t) getProc("glLightModelf", userData);
glLightModelfv = (glLightModelfv_client_proc_t) getProc("glLightModelfv", userData);
glLightf = (glLightf_client_proc_t) getProc("glLightf", userData);
glLightfv = (glLightfv_client_proc_t) getProc("glLightfv", userData);
glLineWidth = (glLineWidth_client_proc_t) getProc("glLineWidth", userData);
glLoadMatrixf = (glLoadMatrixf_client_proc_t) getProc("glLoadMatrixf", userData);
glMaterialf = (glMaterialf_client_proc_t) getProc("glMaterialf", userData);
glMaterialfv = (glMaterialfv_client_proc_t) getProc("glMaterialfv", userData);
glMultMatrixf = (glMultMatrixf_client_proc_t) getProc("glMultMatrixf", userData);
glMultiTexCoord4f = (glMultiTexCoord4f_client_proc_t) getProc("glMultiTexCoord4f", userData);
glNormal3f = (glNormal3f_client_proc_t) getProc("glNormal3f", userData);
glOrthof = (glOrthof_client_proc_t) getProc("glOrthof", userData);
glPointParameterf = (glPointParameterf_client_proc_t) getProc("glPointParameterf", userData);
glPointParameterfv = (glPointParameterfv_client_proc_t) getProc("glPointParameterfv", userData);
glPointSize = (glPointSize_client_proc_t) getProc("glPointSize", userData);
glPolygonOffset = (glPolygonOffset_client_proc_t) getProc("glPolygonOffset", userData);
glRotatef = (glRotatef_client_proc_t) getProc("glRotatef", userData);
glScalef = (glScalef_client_proc_t) getProc("glScalef", userData);
glTexEnvf = (glTexEnvf_client_proc_t) getProc("glTexEnvf", userData);
glTexEnvfv = (glTexEnvfv_client_proc_t) getProc("glTexEnvfv", userData);
glTexParameterf = (glTexParameterf_client_proc_t) getProc("glTexParameterf", userData);
glTexParameterfv = (glTexParameterfv_client_proc_t) getProc("glTexParameterfv", userData);
glTranslatef = (glTranslatef_client_proc_t) getProc("glTranslatef", userData);
glActiveTexture = (glActiveTexture_client_proc_t) getProc("glActiveTexture", userData);
glAlphaFuncx = (glAlphaFuncx_client_proc_t) getProc("glAlphaFuncx", userData);
glBindBuffer = (glBindBuffer_client_proc_t) getProc("glBindBuffer", userData);
glBindTexture = (glBindTexture_client_proc_t) getProc("glBindTexture", userData);
glBlendFunc = (glBlendFunc_client_proc_t) getProc("glBlendFunc", userData);
glBufferData = (glBufferData_client_proc_t) getProc("glBufferData", userData);
glBufferSubData = (glBufferSubData_client_proc_t) getProc("glBufferSubData", userData);
glClear = (glClear_client_proc_t) getProc("glClear", userData);
glClearColorx = (glClearColorx_client_proc_t) getProc("glClearColorx", userData);
glClearDepthx = (glClearDepthx_client_proc_t) getProc("glClearDepthx", userData);
glClearStencil = (glClearStencil_client_proc_t) getProc("glClearStencil", userData);
glClientActiveTexture = (glClientActiveTexture_client_proc_t) getProc("glClientActiveTexture", userData);
glColor4ub = (glColor4ub_client_proc_t) getProc("glColor4ub", userData);
glColor4x = (glColor4x_client_proc_t) getProc("glColor4x", userData);
glColorMask = (glColorMask_client_proc_t) getProc("glColorMask", userData);
glColorPointer = (glColorPointer_client_proc_t) getProc("glColorPointer", userData);
glCompressedTexImage2D = (glCompressedTexImage2D_client_proc_t) getProc("glCompressedTexImage2D", userData);
glCompressedTexSubImage2D = (glCompressedTexSubImage2D_client_proc_t) getProc("glCompressedTexSubImage2D", userData);
glCopyTexImage2D = (glCopyTexImage2D_client_proc_t) getProc("glCopyTexImage2D", userData);
glCopyTexSubImage2D = (glCopyTexSubImage2D_client_proc_t) getProc("glCopyTexSubImage2D", userData);
glCullFace = (glCullFace_client_proc_t) getProc("glCullFace", userData);
glDeleteBuffers = (glDeleteBuffers_client_proc_t) getProc("glDeleteBuffers", userData);
glDeleteTextures = (glDeleteTextures_client_proc_t) getProc("glDeleteTextures", userData);
glDepthFunc = (glDepthFunc_client_proc_t) getProc("glDepthFunc", userData);
glDepthMask = (glDepthMask_client_proc_t) getProc("glDepthMask", userData);
glDepthRangex = (glDepthRangex_client_proc_t) getProc("glDepthRangex", userData);
glDisable = (glDisable_client_proc_t) getProc("glDisable", userData);
glDisableClientState = (glDisableClientState_client_proc_t) getProc("glDisableClientState", userData);
glDrawArrays = (glDrawArrays_client_proc_t) getProc("glDrawArrays", userData);
glDrawElements = (glDrawElements_client_proc_t) getProc("glDrawElements", userData);
glEnable = (glEnable_client_proc_t) getProc("glEnable", userData);
glEnableClientState = (glEnableClientState_client_proc_t) getProc("glEnableClientState", userData);
glFinish = (glFinish_client_proc_t) getProc("glFinish", userData);
glFlush = (glFlush_client_proc_t) getProc("glFlush", userData);
glFogx = (glFogx_client_proc_t) getProc("glFogx", userData);
glFogxv = (glFogxv_client_proc_t) getProc("glFogxv", userData);
glFrontFace = (glFrontFace_client_proc_t) getProc("glFrontFace", userData);
glFrustumx = (glFrustumx_client_proc_t) getProc("glFrustumx", userData);
glGetBooleanv = (glGetBooleanv_client_proc_t) getProc("glGetBooleanv", userData);
glGetBufferParameteriv = (glGetBufferParameteriv_client_proc_t) getProc("glGetBufferParameteriv", userData);
glClipPlanex = (glClipPlanex_client_proc_t) getProc("glClipPlanex", userData);
glGenBuffers = (glGenBuffers_client_proc_t) getProc("glGenBuffers", userData);
glGenTextures = (glGenTextures_client_proc_t) getProc("glGenTextures", userData);
glGetError = (glGetError_client_proc_t) getProc("glGetError", userData);
glGetFixedv = (glGetFixedv_client_proc_t) getProc("glGetFixedv", userData);
glGetIntegerv = (glGetIntegerv_client_proc_t) getProc("glGetIntegerv", userData);
glGetLightxv = (glGetLightxv_client_proc_t) getProc("glGetLightxv", userData);
glGetMaterialxv = (glGetMaterialxv_client_proc_t) getProc("glGetMaterialxv", userData);
glGetPointerv = (glGetPointerv_client_proc_t) getProc("glGetPointerv", userData);
glGetString = (glGetString_client_proc_t) getProc("glGetString", userData);
glGetTexEnviv = (glGetTexEnviv_client_proc_t) getProc("glGetTexEnviv", userData);
glGetTexEnvxv = (glGetTexEnvxv_client_proc_t) getProc("glGetTexEnvxv", userData);
glGetTexParameteriv = (glGetTexParameteriv_client_proc_t) getProc("glGetTexParameteriv", userData);
glGetTexParameterxv = (glGetTexParameterxv_client_proc_t) getProc("glGetTexParameterxv", userData);
glHint = (glHint_client_proc_t) getProc("glHint", userData);
glIsBuffer = (glIsBuffer_client_proc_t) getProc("glIsBuffer", userData);
glIsEnabled = (glIsEnabled_client_proc_t) getProc("glIsEnabled", userData);
glIsTexture = (glIsTexture_client_proc_t) getProc("glIsTexture", userData);
glLightModelx = (glLightModelx_client_proc_t) getProc("glLightModelx", userData);
glLightModelxv = (glLightModelxv_client_proc_t) getProc("glLightModelxv", userData);
glLightx = (glLightx_client_proc_t) getProc("glLightx", userData);
glLightxv = (glLightxv_client_proc_t) getProc("glLightxv", userData);
glLineWidthx = (glLineWidthx_client_proc_t) getProc("glLineWidthx", userData);
glLoadIdentity = (glLoadIdentity_client_proc_t) getProc("glLoadIdentity", userData);
glLoadMatrixx = (glLoadMatrixx_client_proc_t) getProc("glLoadMatrixx", userData);
glLogicOp = (glLogicOp_client_proc_t) getProc("glLogicOp", userData);
glMaterialx = (glMaterialx_client_proc_t) getProc("glMaterialx", userData);
glMaterialxv = (glMaterialxv_client_proc_t) getProc("glMaterialxv", userData);
glMatrixMode = (glMatrixMode_client_proc_t) getProc("glMatrixMode", userData);
glMultMatrixx = (glMultMatrixx_client_proc_t) getProc("glMultMatrixx", userData);
glMultiTexCoord4x = (glMultiTexCoord4x_client_proc_t) getProc("glMultiTexCoord4x", userData);
glNormal3x = (glNormal3x_client_proc_t) getProc("glNormal3x", userData);
glNormalPointer = (glNormalPointer_client_proc_t) getProc("glNormalPointer", userData);
glOrthox = (glOrthox_client_proc_t) getProc("glOrthox", userData);
glPixelStorei = (glPixelStorei_client_proc_t) getProc("glPixelStorei", userData);
glPointParameterx = (glPointParameterx_client_proc_t) getProc("glPointParameterx", userData);
glPointParameterxv = (glPointParameterxv_client_proc_t) getProc("glPointParameterxv", userData);
glPointSizex = (glPointSizex_client_proc_t) getProc("glPointSizex", userData);
glPolygonOffsetx = (glPolygonOffsetx_client_proc_t) getProc("glPolygonOffsetx", userData);
glPopMatrix = (glPopMatrix_client_proc_t) getProc("glPopMatrix", userData);
glPushMatrix = (glPushMatrix_client_proc_t) getProc("glPushMatrix", userData);
glReadPixels = (glReadPixels_client_proc_t) getProc("glReadPixels", userData);
glRotatex = (glRotatex_client_proc_t) getProc("glRotatex", userData);
glSampleCoverage = (glSampleCoverage_client_proc_t) getProc("glSampleCoverage", userData);
glSampleCoveragex = (glSampleCoveragex_client_proc_t) getProc("glSampleCoveragex", userData);
glScalex = (glScalex_client_proc_t) getProc("glScalex", userData);
glScissor = (glScissor_client_proc_t) getProc("glScissor", userData);
glShadeModel = (glShadeModel_client_proc_t) getProc("glShadeModel", userData);
glStencilFunc = (glStencilFunc_client_proc_t) getProc("glStencilFunc", userData);
glStencilMask = (glStencilMask_client_proc_t) getProc("glStencilMask", userData);
glStencilOp = (glStencilOp_client_proc_t) getProc("glStencilOp", userData);
glTexCoordPointer = (glTexCoordPointer_client_proc_t) getProc("glTexCoordPointer", userData);
glTexEnvi = (glTexEnvi_client_proc_t) getProc("glTexEnvi", userData);
glTexEnvx = (glTexEnvx_client_proc_t) getProc("glTexEnvx", userData);
glTexEnviv = (glTexEnviv_client_proc_t) getProc("glTexEnviv", userData);
glTexEnvxv = (glTexEnvxv_client_proc_t) getProc("glTexEnvxv", userData);
glTexImage2D = (glTexImage2D_client_proc_t) getProc("glTexImage2D", userData);
glTexParameteri = (glTexParameteri_client_proc_t) getProc("glTexParameteri", userData);
glTexParameterx = (glTexParameterx_client_proc_t) getProc("glTexParameterx", userData);
glTexParameteriv = (glTexParameteriv_client_proc_t) getProc("glTexParameteriv", userData);
glTexParameterxv = (glTexParameterxv_client_proc_t) getProc("glTexParameterxv", userData);
glTexSubImage2D = (glTexSubImage2D_client_proc_t) getProc("glTexSubImage2D", userData);
glTranslatex = (glTranslatex_client_proc_t) getProc("glTranslatex", userData);
glVertexPointer = (glVertexPointer_client_proc_t) getProc("glVertexPointer", userData);
glViewport = (glViewport_client_proc_t) getProc("glViewport", userData);
glPointSizePointerOES = (glPointSizePointerOES_client_proc_t) getProc("glPointSizePointerOES", userData);
glVertexPointerOffset = (glVertexPointerOffset_client_proc_t) getProc("glVertexPointerOffset", userData);
glColorPointerOffset = (glColorPointerOffset_client_proc_t) getProc("glColorPointerOffset", userData);
glNormalPointerOffset = (glNormalPointerOffset_client_proc_t) getProc("glNormalPointerOffset", userData);
glPointSizePointerOffset = (glPointSizePointerOffset_client_proc_t) getProc("glPointSizePointerOffset", userData);
glTexCoordPointerOffset = (glTexCoordPointerOffset_client_proc_t) getProc("glTexCoordPointerOffset", userData);
glWeightPointerOffset = (glWeightPointerOffset_client_proc_t) getProc("glWeightPointerOffset", userData);
glMatrixIndexPointerOffset = (glMatrixIndexPointerOffset_client_proc_t) getProc("glMatrixIndexPointerOffset", userData);
glVertexPointerData = (glVertexPointerData_client_proc_t) getProc("glVertexPointerData", userData);
glColorPointerData = (glColorPointerData_client_proc_t) getProc("glColorPointerData", userData);
glNormalPointerData = (glNormalPointerData_client_proc_t) getProc("glNormalPointerData", userData);
glTexCoordPointerData = (glTexCoordPointerData_client_proc_t) getProc("glTexCoordPointerData", userData);
glPointSizePointerData = (glPointSizePointerData_client_proc_t) getProc("glPointSizePointerData", userData);
glWeightPointerData = (glWeightPointerData_client_proc_t) getProc("glWeightPointerData", userData);
glMatrixIndexPointerData = (glMatrixIndexPointerData_client_proc_t) getProc("glMatrixIndexPointerData", userData);
glDrawElementsOffset = (glDrawElementsOffset_client_proc_t) getProc("glDrawElementsOffset", userData);
glDrawElementsData = (glDrawElementsData_client_proc_t) getProc("glDrawElementsData", userData);
glGetCompressedTextureFormats = (glGetCompressedTextureFormats_client_proc_t) getProc("glGetCompressedTextureFormats", userData);
glFinishRoundTrip = (glFinishRoundTrip_client_proc_t) getProc("glFinishRoundTrip", userData);
glBlendEquationSeparateOES = (glBlendEquationSeparateOES_client_proc_t) getProc("glBlendEquationSeparateOES", userData);
glBlendFuncSeparateOES = (glBlendFuncSeparateOES_client_proc_t) getProc("glBlendFuncSeparateOES", userData);
glBlendEquationOES = (glBlendEquationOES_client_proc_t) getProc("glBlendEquationOES", userData);
glDrawTexsOES = (glDrawTexsOES_client_proc_t) getProc("glDrawTexsOES", userData);
glDrawTexiOES = (glDrawTexiOES_client_proc_t) getProc("glDrawTexiOES", userData);
glDrawTexxOES = (glDrawTexxOES_client_proc_t) getProc("glDrawTexxOES", userData);
glDrawTexsvOES = (glDrawTexsvOES_client_proc_t) getProc("glDrawTexsvOES", userData);
glDrawTexivOES = (glDrawTexivOES_client_proc_t) getProc("glDrawTexivOES", userData);
glDrawTexxvOES = (glDrawTexxvOES_client_proc_t) getProc("glDrawTexxvOES", userData);
glDrawTexfOES = (glDrawTexfOES_client_proc_t) getProc("glDrawTexfOES", userData);
glDrawTexfvOES = (glDrawTexfvOES_client_proc_t) getProc("glDrawTexfvOES", userData);
glEGLImageTargetTexture2DOES = (glEGLImageTargetTexture2DOES_client_proc_t) getProc("glEGLImageTargetTexture2DOES", userData);
glEGLImageTargetRenderbufferStorageOES = (glEGLImageTargetRenderbufferStorageOES_client_proc_t) getProc("glEGLImageTargetRenderbufferStorageOES", userData);
glAlphaFuncxOES = (glAlphaFuncxOES_client_proc_t) getProc("glAlphaFuncxOES", userData);
glClearColorxOES = (glClearColorxOES_client_proc_t) getProc("glClearColorxOES", userData);
glClearDepthxOES = (glClearDepthxOES_client_proc_t) getProc("glClearDepthxOES", userData);
glClipPlanexOES = (glClipPlanexOES_client_proc_t) getProc("glClipPlanexOES", userData);
glClipPlanexIMG = (glClipPlanexIMG_client_proc_t) getProc("glClipPlanexIMG", userData);
glColor4xOES = (glColor4xOES_client_proc_t) getProc("glColor4xOES", userData);
glDepthRangexOES = (glDepthRangexOES_client_proc_t) getProc("glDepthRangexOES", userData);
glFogxOES = (glFogxOES_client_proc_t) getProc("glFogxOES", userData);
glFogxvOES = (glFogxvOES_client_proc_t) getProc("glFogxvOES", userData);
glFrustumxOES = (glFrustumxOES_client_proc_t) getProc("glFrustumxOES", userData);
glGetClipPlanexOES = (glGetClipPlanexOES_client_proc_t) getProc("glGetClipPlanexOES", userData);
glGetClipPlanex = (glGetClipPlanex_client_proc_t) getProc("glGetClipPlanex", userData);
glGetFixedvOES = (glGetFixedvOES_client_proc_t) getProc("glGetFixedvOES", userData);
glGetLightxvOES = (glGetLightxvOES_client_proc_t) getProc("glGetLightxvOES", userData);
glGetMaterialxvOES = (glGetMaterialxvOES_client_proc_t) getProc("glGetMaterialxvOES", userData);
glGetTexEnvxvOES = (glGetTexEnvxvOES_client_proc_t) getProc("glGetTexEnvxvOES", userData);
glGetTexParameterxvOES = (glGetTexParameterxvOES_client_proc_t) getProc("glGetTexParameterxvOES", userData);
glLightModelxOES = (glLightModelxOES_client_proc_t) getProc("glLightModelxOES", userData);
glLightModelxvOES = (glLightModelxvOES_client_proc_t) getProc("glLightModelxvOES", userData);
glLightxOES = (glLightxOES_client_proc_t) getProc("glLightxOES", userData);
glLightxvOES = (glLightxvOES_client_proc_t) getProc("glLightxvOES", userData);
glLineWidthxOES = (glLineWidthxOES_client_proc_t) getProc("glLineWidthxOES", userData);
glLoadMatrixxOES = (glLoadMatrixxOES_client_proc_t) getProc("glLoadMatrixxOES", userData);
glMaterialxOES = (glMaterialxOES_client_proc_t) getProc("glMaterialxOES", userData);
glMaterialxvOES = (glMaterialxvOES_client_proc_t) getProc("glMaterialxvOES", userData);
glMultMatrixxOES = (glMultMatrixxOES_client_proc_t) getProc("glMultMatrixxOES", userData);
glMultiTexCoord4xOES = (glMultiTexCoord4xOES_client_proc_t) getProc("glMultiTexCoord4xOES", userData);
glNormal3xOES = (glNormal3xOES_client_proc_t) getProc("glNormal3xOES", userData);
glOrthoxOES = (glOrthoxOES_client_proc_t) getProc("glOrthoxOES", userData);
glPointParameterxOES = (glPointParameterxOES_client_proc_t) getProc("glPointParameterxOES", userData);
glPointParameterxvOES = (glPointParameterxvOES_client_proc_t) getProc("glPointParameterxvOES", userData);
glPointSizexOES = (glPointSizexOES_client_proc_t) getProc("glPointSizexOES", userData);
glPolygonOffsetxOES = (glPolygonOffsetxOES_client_proc_t) getProc("glPolygonOffsetxOES", userData);
glRotatexOES = (glRotatexOES_client_proc_t) getProc("glRotatexOES", userData);
glSampleCoveragexOES = (glSampleCoveragexOES_client_proc_t) getProc("glSampleCoveragexOES", userData);
glScalexOES = (glScalexOES_client_proc_t) getProc("glScalexOES", userData);
glTexEnvxOES = (glTexEnvxOES_client_proc_t) getProc("glTexEnvxOES", userData);
glTexEnvxvOES = (glTexEnvxvOES_client_proc_t) getProc("glTexEnvxvOES", userData);
glTexParameterxOES = (glTexParameterxOES_client_proc_t) getProc("glTexParameterxOES", userData);
glTexParameterxvOES = (glTexParameterxvOES_client_proc_t) getProc("glTexParameterxvOES", userData);
glTranslatexOES = (glTranslatexOES_client_proc_t) getProc("glTranslatexOES", userData);
glIsRenderbufferOES = (glIsRenderbufferOES_client_proc_t) getProc("glIsRenderbufferOES", userData);
glBindRenderbufferOES = (glBindRenderbufferOES_client_proc_t) getProc("glBindRenderbufferOES", userData);
glDeleteRenderbuffersOES = (glDeleteRenderbuffersOES_client_proc_t) getProc("glDeleteRenderbuffersOES", userData);
glGenRenderbuffersOES = (glGenRenderbuffersOES_client_proc_t) getProc("glGenRenderbuffersOES", userData);
glRenderbufferStorageOES = (glRenderbufferStorageOES_client_proc_t) getProc("glRenderbufferStorageOES", userData);
glGetRenderbufferParameterivOES = (glGetRenderbufferParameterivOES_client_proc_t) getProc("glGetRenderbufferParameterivOES", userData);
glIsFramebufferOES = (glIsFramebufferOES_client_proc_t) getProc("glIsFramebufferOES", userData);
glBindFramebufferOES = (glBindFramebufferOES_client_proc_t) getProc("glBindFramebufferOES", userData);
glDeleteFramebuffersOES = (glDeleteFramebuffersOES_client_proc_t) getProc("glDeleteFramebuffersOES", userData);
glGenFramebuffersOES = (glGenFramebuffersOES_client_proc_t) getProc("glGenFramebuffersOES", userData);
glCheckFramebufferStatusOES = (glCheckFramebufferStatusOES_client_proc_t) getProc("glCheckFramebufferStatusOES", userData);
glFramebufferRenderbufferOES = (glFramebufferRenderbufferOES_client_proc_t) getProc("glFramebufferRenderbufferOES", userData);
glFramebufferTexture2DOES = (glFramebufferTexture2DOES_client_proc_t) getProc("glFramebufferTexture2DOES", userData);
glGetFramebufferAttachmentParameterivOES = (glGetFramebufferAttachmentParameterivOES_client_proc_t) getProc("glGetFramebufferAttachmentParameterivOES", userData);
glGenerateMipmapOES = (glGenerateMipmapOES_client_proc_t) getProc("glGenerateMipmapOES", userData);
glMapBufferOES = (glMapBufferOES_client_proc_t) getProc("glMapBufferOES", userData);
glUnmapBufferOES = (glUnmapBufferOES_client_proc_t) getProc("glUnmapBufferOES", userData);
glGetBufferPointervOES = (glGetBufferPointervOES_client_proc_t) getProc("glGetBufferPointervOES", userData);
glCurrentPaletteMatrixOES = (glCurrentPaletteMatrixOES_client_proc_t) getProc("glCurrentPaletteMatrixOES", userData);
glLoadPaletteFromModelViewMatrixOES = (glLoadPaletteFromModelViewMatrixOES_client_proc_t) getProc("glLoadPaletteFromModelViewMatrixOES", userData);
glMatrixIndexPointerOES = (glMatrixIndexPointerOES_client_proc_t) getProc("glMatrixIndexPointerOES", userData);
glWeightPointerOES = (glWeightPointerOES_client_proc_t) getProc("glWeightPointerOES", userData);
glQueryMatrixxOES = (glQueryMatrixxOES_client_proc_t) getProc("glQueryMatrixxOES", userData);
glDepthRangefOES = (glDepthRangefOES_client_proc_t) getProc("glDepthRangefOES", userData);
glFrustumfOES = (glFrustumfOES_client_proc_t) getProc("glFrustumfOES", userData);
glOrthofOES = (glOrthofOES_client_proc_t) getProc("glOrthofOES", userData);
glClipPlanefOES = (glClipPlanefOES_client_proc_t) getProc("glClipPlanefOES", userData);
glClipPlanefIMG = (glClipPlanefIMG_client_proc_t) getProc("glClipPlanefIMG", userData);
glGetClipPlanefOES = (glGetClipPlanefOES_client_proc_t) getProc("glGetClipPlanefOES", userData);
glClearDepthfOES = (glClearDepthfOES_client_proc_t) getProc("glClearDepthfOES", userData);
glTexGenfOES = (glTexGenfOES_client_proc_t) getProc("glTexGenfOES", userData);
glTexGenfvOES = (glTexGenfvOES_client_proc_t) getProc("glTexGenfvOES", userData);
glTexGeniOES = (glTexGeniOES_client_proc_t) getProc("glTexGeniOES", userData);
glTexGenivOES = (glTexGenivOES_client_proc_t) getProc("glTexGenivOES", userData);
glTexGenxOES = (glTexGenxOES_client_proc_t) getProc("glTexGenxOES", userData);
glTexGenxvOES = (glTexGenxvOES_client_proc_t) getProc("glTexGenxvOES", userData);
glGetTexGenfvOES = (glGetTexGenfvOES_client_proc_t) getProc("glGetTexGenfvOES", userData);
glGetTexGenivOES = (glGetTexGenivOES_client_proc_t) getProc("glGetTexGenivOES", userData);
glGetTexGenxvOES = (glGetTexGenxvOES_client_proc_t) getProc("glGetTexGenxvOES", userData);
glBindVertexArrayOES = (glBindVertexArrayOES_client_proc_t) getProc("glBindVertexArrayOES", userData);
glDeleteVertexArraysOES = (glDeleteVertexArraysOES_client_proc_t) getProc("glDeleteVertexArraysOES", userData);
glGenVertexArraysOES = (glGenVertexArraysOES_client_proc_t) getProc("glGenVertexArraysOES", userData);
glIsVertexArrayOES = (glIsVertexArrayOES_client_proc_t) getProc("glIsVertexArrayOES", userData);
glDiscardFramebufferEXT = (glDiscardFramebufferEXT_client_proc_t) getProc("glDiscardFramebufferEXT", userData);
glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) getProc("glMultiDrawArraysEXT", userData);
glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) getProc("glMultiDrawElementsEXT", userData);
glMultiDrawArraysSUN = (glMultiDrawArraysSUN_client_proc_t) getProc("glMultiDrawArraysSUN", userData);
glMultiDrawElementsSUN = (glMultiDrawElementsSUN_client_proc_t) getProc("glMultiDrawElementsSUN", userData);
glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) getProc("glRenderbufferStorageMultisampleIMG", userData);
glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) getProc("glFramebufferTexture2DMultisampleIMG", userData);
glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) getProc("glDeleteFencesNV", userData);
glGenFencesNV = (glGenFencesNV_client_proc_t) getProc("glGenFencesNV", userData);
glIsFenceNV = (glIsFenceNV_client_proc_t) getProc("glIsFenceNV", userData);
glTestFenceNV = (glTestFenceNV_client_proc_t) getProc("glTestFenceNV", userData);
glGetFenceivNV = (glGetFenceivNV_client_proc_t) getProc("glGetFenceivNV", userData);
glFinishFenceNV = (glFinishFenceNV_client_proc_t) getProc("glFinishFenceNV", userData);
glSetFenceNV = (glSetFenceNV_client_proc_t) getProc("glSetFenceNV", userData);
glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) getProc("glGetDriverControlsQCOM", userData);
glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) getProc("glGetDriverControlStringQCOM", userData);
glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) getProc("glEnableDriverControlQCOM", userData);
glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) getProc("glDisableDriverControlQCOM", userData);
glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) getProc("glExtGetTexturesQCOM", userData);
glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) getProc("glExtGetBuffersQCOM", userData);
glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) getProc("glExtGetRenderbuffersQCOM", userData);
glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) getProc("glExtGetFramebuffersQCOM", userData);
glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) getProc("glExtGetTexLevelParameterivQCOM", userData);
glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) getProc("glExtTexObjectStateOverrideiQCOM", userData);
glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) getProc("glExtGetTexSubImageQCOM", userData);
glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) getProc("glExtGetBufferPointervQCOM", userData);
glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) getProc("glExtGetShadersQCOM", userData);
glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) getProc("glExtGetProgramsQCOM", userData);
glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) getProc("glExtIsProgramBinaryQCOM", userData);
glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) getProc("glExtGetProgramBinarySourceQCOM", userData);
glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) getProc("glStartTilingQCOM", userData);
glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) getProc("glEndTilingQCOM", userData);
return 0;
}

View file

@ -0,0 +1,313 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __gl_client_context_t_h
#define __gl_client_context_t_h
#include "gl_client_proc.h"
#include "gl_types.h"
struct gl_client_context_t {
glAlphaFunc_client_proc_t glAlphaFunc;
glClearColor_client_proc_t glClearColor;
glClearDepthf_client_proc_t glClearDepthf;
glClipPlanef_client_proc_t glClipPlanef;
glColor4f_client_proc_t glColor4f;
glDepthRangef_client_proc_t glDepthRangef;
glFogf_client_proc_t glFogf;
glFogfv_client_proc_t glFogfv;
glFrustumf_client_proc_t glFrustumf;
glGetClipPlanef_client_proc_t glGetClipPlanef;
glGetFloatv_client_proc_t glGetFloatv;
glGetLightfv_client_proc_t glGetLightfv;
glGetMaterialfv_client_proc_t glGetMaterialfv;
glGetTexEnvfv_client_proc_t glGetTexEnvfv;
glGetTexParameterfv_client_proc_t glGetTexParameterfv;
glLightModelf_client_proc_t glLightModelf;
glLightModelfv_client_proc_t glLightModelfv;
glLightf_client_proc_t glLightf;
glLightfv_client_proc_t glLightfv;
glLineWidth_client_proc_t glLineWidth;
glLoadMatrixf_client_proc_t glLoadMatrixf;
glMaterialf_client_proc_t glMaterialf;
glMaterialfv_client_proc_t glMaterialfv;
glMultMatrixf_client_proc_t glMultMatrixf;
glMultiTexCoord4f_client_proc_t glMultiTexCoord4f;
glNormal3f_client_proc_t glNormal3f;
glOrthof_client_proc_t glOrthof;
glPointParameterf_client_proc_t glPointParameterf;
glPointParameterfv_client_proc_t glPointParameterfv;
glPointSize_client_proc_t glPointSize;
glPolygonOffset_client_proc_t glPolygonOffset;
glRotatef_client_proc_t glRotatef;
glScalef_client_proc_t glScalef;
glTexEnvf_client_proc_t glTexEnvf;
glTexEnvfv_client_proc_t glTexEnvfv;
glTexParameterf_client_proc_t glTexParameterf;
glTexParameterfv_client_proc_t glTexParameterfv;
glTranslatef_client_proc_t glTranslatef;
glActiveTexture_client_proc_t glActiveTexture;
glAlphaFuncx_client_proc_t glAlphaFuncx;
glBindBuffer_client_proc_t glBindBuffer;
glBindTexture_client_proc_t glBindTexture;
glBlendFunc_client_proc_t glBlendFunc;
glBufferData_client_proc_t glBufferData;
glBufferSubData_client_proc_t glBufferSubData;
glClear_client_proc_t glClear;
glClearColorx_client_proc_t glClearColorx;
glClearDepthx_client_proc_t glClearDepthx;
glClearStencil_client_proc_t glClearStencil;
glClientActiveTexture_client_proc_t glClientActiveTexture;
glColor4ub_client_proc_t glColor4ub;
glColor4x_client_proc_t glColor4x;
glColorMask_client_proc_t glColorMask;
glColorPointer_client_proc_t glColorPointer;
glCompressedTexImage2D_client_proc_t glCompressedTexImage2D;
glCompressedTexSubImage2D_client_proc_t glCompressedTexSubImage2D;
glCopyTexImage2D_client_proc_t glCopyTexImage2D;
glCopyTexSubImage2D_client_proc_t glCopyTexSubImage2D;
glCullFace_client_proc_t glCullFace;
glDeleteBuffers_client_proc_t glDeleteBuffers;
glDeleteTextures_client_proc_t glDeleteTextures;
glDepthFunc_client_proc_t glDepthFunc;
glDepthMask_client_proc_t glDepthMask;
glDepthRangex_client_proc_t glDepthRangex;
glDisable_client_proc_t glDisable;
glDisableClientState_client_proc_t glDisableClientState;
glDrawArrays_client_proc_t glDrawArrays;
glDrawElements_client_proc_t glDrawElements;
glEnable_client_proc_t glEnable;
glEnableClientState_client_proc_t glEnableClientState;
glFinish_client_proc_t glFinish;
glFlush_client_proc_t glFlush;
glFogx_client_proc_t glFogx;
glFogxv_client_proc_t glFogxv;
glFrontFace_client_proc_t glFrontFace;
glFrustumx_client_proc_t glFrustumx;
glGetBooleanv_client_proc_t glGetBooleanv;
glGetBufferParameteriv_client_proc_t glGetBufferParameteriv;
glClipPlanex_client_proc_t glClipPlanex;
glGenBuffers_client_proc_t glGenBuffers;
glGenTextures_client_proc_t glGenTextures;
glGetError_client_proc_t glGetError;
glGetFixedv_client_proc_t glGetFixedv;
glGetIntegerv_client_proc_t glGetIntegerv;
glGetLightxv_client_proc_t glGetLightxv;
glGetMaterialxv_client_proc_t glGetMaterialxv;
glGetPointerv_client_proc_t glGetPointerv;
glGetString_client_proc_t glGetString;
glGetTexEnviv_client_proc_t glGetTexEnviv;
glGetTexEnvxv_client_proc_t glGetTexEnvxv;
glGetTexParameteriv_client_proc_t glGetTexParameteriv;
glGetTexParameterxv_client_proc_t glGetTexParameterxv;
glHint_client_proc_t glHint;
glIsBuffer_client_proc_t glIsBuffer;
glIsEnabled_client_proc_t glIsEnabled;
glIsTexture_client_proc_t glIsTexture;
glLightModelx_client_proc_t glLightModelx;
glLightModelxv_client_proc_t glLightModelxv;
glLightx_client_proc_t glLightx;
glLightxv_client_proc_t glLightxv;
glLineWidthx_client_proc_t glLineWidthx;
glLoadIdentity_client_proc_t glLoadIdentity;
glLoadMatrixx_client_proc_t glLoadMatrixx;
glLogicOp_client_proc_t glLogicOp;
glMaterialx_client_proc_t glMaterialx;
glMaterialxv_client_proc_t glMaterialxv;
glMatrixMode_client_proc_t glMatrixMode;
glMultMatrixx_client_proc_t glMultMatrixx;
glMultiTexCoord4x_client_proc_t glMultiTexCoord4x;
glNormal3x_client_proc_t glNormal3x;
glNormalPointer_client_proc_t glNormalPointer;
glOrthox_client_proc_t glOrthox;
glPixelStorei_client_proc_t glPixelStorei;
glPointParameterx_client_proc_t glPointParameterx;
glPointParameterxv_client_proc_t glPointParameterxv;
glPointSizex_client_proc_t glPointSizex;
glPolygonOffsetx_client_proc_t glPolygonOffsetx;
glPopMatrix_client_proc_t glPopMatrix;
glPushMatrix_client_proc_t glPushMatrix;
glReadPixels_client_proc_t glReadPixels;
glRotatex_client_proc_t glRotatex;
glSampleCoverage_client_proc_t glSampleCoverage;
glSampleCoveragex_client_proc_t glSampleCoveragex;
glScalex_client_proc_t glScalex;
glScissor_client_proc_t glScissor;
glShadeModel_client_proc_t glShadeModel;
glStencilFunc_client_proc_t glStencilFunc;
glStencilMask_client_proc_t glStencilMask;
glStencilOp_client_proc_t glStencilOp;
glTexCoordPointer_client_proc_t glTexCoordPointer;
glTexEnvi_client_proc_t glTexEnvi;
glTexEnvx_client_proc_t glTexEnvx;
glTexEnviv_client_proc_t glTexEnviv;
glTexEnvxv_client_proc_t glTexEnvxv;
glTexImage2D_client_proc_t glTexImage2D;
glTexParameteri_client_proc_t glTexParameteri;
glTexParameterx_client_proc_t glTexParameterx;
glTexParameteriv_client_proc_t glTexParameteriv;
glTexParameterxv_client_proc_t glTexParameterxv;
glTexSubImage2D_client_proc_t glTexSubImage2D;
glTranslatex_client_proc_t glTranslatex;
glVertexPointer_client_proc_t glVertexPointer;
glViewport_client_proc_t glViewport;
glPointSizePointerOES_client_proc_t glPointSizePointerOES;
glVertexPointerOffset_client_proc_t glVertexPointerOffset;
glColorPointerOffset_client_proc_t glColorPointerOffset;
glNormalPointerOffset_client_proc_t glNormalPointerOffset;
glPointSizePointerOffset_client_proc_t glPointSizePointerOffset;
glTexCoordPointerOffset_client_proc_t glTexCoordPointerOffset;
glWeightPointerOffset_client_proc_t glWeightPointerOffset;
glMatrixIndexPointerOffset_client_proc_t glMatrixIndexPointerOffset;
glVertexPointerData_client_proc_t glVertexPointerData;
glColorPointerData_client_proc_t glColorPointerData;
glNormalPointerData_client_proc_t glNormalPointerData;
glTexCoordPointerData_client_proc_t glTexCoordPointerData;
glPointSizePointerData_client_proc_t glPointSizePointerData;
glWeightPointerData_client_proc_t glWeightPointerData;
glMatrixIndexPointerData_client_proc_t glMatrixIndexPointerData;
glDrawElementsOffset_client_proc_t glDrawElementsOffset;
glDrawElementsData_client_proc_t glDrawElementsData;
glGetCompressedTextureFormats_client_proc_t glGetCompressedTextureFormats;
glFinishRoundTrip_client_proc_t glFinishRoundTrip;
glBlendEquationSeparateOES_client_proc_t glBlendEquationSeparateOES;
glBlendFuncSeparateOES_client_proc_t glBlendFuncSeparateOES;
glBlendEquationOES_client_proc_t glBlendEquationOES;
glDrawTexsOES_client_proc_t glDrawTexsOES;
glDrawTexiOES_client_proc_t glDrawTexiOES;
glDrawTexxOES_client_proc_t glDrawTexxOES;
glDrawTexsvOES_client_proc_t glDrawTexsvOES;
glDrawTexivOES_client_proc_t glDrawTexivOES;
glDrawTexxvOES_client_proc_t glDrawTexxvOES;
glDrawTexfOES_client_proc_t glDrawTexfOES;
glDrawTexfvOES_client_proc_t glDrawTexfvOES;
glEGLImageTargetTexture2DOES_client_proc_t glEGLImageTargetTexture2DOES;
glEGLImageTargetRenderbufferStorageOES_client_proc_t glEGLImageTargetRenderbufferStorageOES;
glAlphaFuncxOES_client_proc_t glAlphaFuncxOES;
glClearColorxOES_client_proc_t glClearColorxOES;
glClearDepthxOES_client_proc_t glClearDepthxOES;
glClipPlanexOES_client_proc_t glClipPlanexOES;
glClipPlanexIMG_client_proc_t glClipPlanexIMG;
glColor4xOES_client_proc_t glColor4xOES;
glDepthRangexOES_client_proc_t glDepthRangexOES;
glFogxOES_client_proc_t glFogxOES;
glFogxvOES_client_proc_t glFogxvOES;
glFrustumxOES_client_proc_t glFrustumxOES;
glGetClipPlanexOES_client_proc_t glGetClipPlanexOES;
glGetClipPlanex_client_proc_t glGetClipPlanex;
glGetFixedvOES_client_proc_t glGetFixedvOES;
glGetLightxvOES_client_proc_t glGetLightxvOES;
glGetMaterialxvOES_client_proc_t glGetMaterialxvOES;
glGetTexEnvxvOES_client_proc_t glGetTexEnvxvOES;
glGetTexParameterxvOES_client_proc_t glGetTexParameterxvOES;
glLightModelxOES_client_proc_t glLightModelxOES;
glLightModelxvOES_client_proc_t glLightModelxvOES;
glLightxOES_client_proc_t glLightxOES;
glLightxvOES_client_proc_t glLightxvOES;
glLineWidthxOES_client_proc_t glLineWidthxOES;
glLoadMatrixxOES_client_proc_t glLoadMatrixxOES;
glMaterialxOES_client_proc_t glMaterialxOES;
glMaterialxvOES_client_proc_t glMaterialxvOES;
glMultMatrixxOES_client_proc_t glMultMatrixxOES;
glMultiTexCoord4xOES_client_proc_t glMultiTexCoord4xOES;
glNormal3xOES_client_proc_t glNormal3xOES;
glOrthoxOES_client_proc_t glOrthoxOES;
glPointParameterxOES_client_proc_t glPointParameterxOES;
glPointParameterxvOES_client_proc_t glPointParameterxvOES;
glPointSizexOES_client_proc_t glPointSizexOES;
glPolygonOffsetxOES_client_proc_t glPolygonOffsetxOES;
glRotatexOES_client_proc_t glRotatexOES;
glSampleCoveragexOES_client_proc_t glSampleCoveragexOES;
glScalexOES_client_proc_t glScalexOES;
glTexEnvxOES_client_proc_t glTexEnvxOES;
glTexEnvxvOES_client_proc_t glTexEnvxvOES;
glTexParameterxOES_client_proc_t glTexParameterxOES;
glTexParameterxvOES_client_proc_t glTexParameterxvOES;
glTranslatexOES_client_proc_t glTranslatexOES;
glIsRenderbufferOES_client_proc_t glIsRenderbufferOES;
glBindRenderbufferOES_client_proc_t glBindRenderbufferOES;
glDeleteRenderbuffersOES_client_proc_t glDeleteRenderbuffersOES;
glGenRenderbuffersOES_client_proc_t glGenRenderbuffersOES;
glRenderbufferStorageOES_client_proc_t glRenderbufferStorageOES;
glGetRenderbufferParameterivOES_client_proc_t glGetRenderbufferParameterivOES;
glIsFramebufferOES_client_proc_t glIsFramebufferOES;
glBindFramebufferOES_client_proc_t glBindFramebufferOES;
glDeleteFramebuffersOES_client_proc_t glDeleteFramebuffersOES;
glGenFramebuffersOES_client_proc_t glGenFramebuffersOES;
glCheckFramebufferStatusOES_client_proc_t glCheckFramebufferStatusOES;
glFramebufferRenderbufferOES_client_proc_t glFramebufferRenderbufferOES;
glFramebufferTexture2DOES_client_proc_t glFramebufferTexture2DOES;
glGetFramebufferAttachmentParameterivOES_client_proc_t glGetFramebufferAttachmentParameterivOES;
glGenerateMipmapOES_client_proc_t glGenerateMipmapOES;
glMapBufferOES_client_proc_t glMapBufferOES;
glUnmapBufferOES_client_proc_t glUnmapBufferOES;
glGetBufferPointervOES_client_proc_t glGetBufferPointervOES;
glCurrentPaletteMatrixOES_client_proc_t glCurrentPaletteMatrixOES;
glLoadPaletteFromModelViewMatrixOES_client_proc_t glLoadPaletteFromModelViewMatrixOES;
glMatrixIndexPointerOES_client_proc_t glMatrixIndexPointerOES;
glWeightPointerOES_client_proc_t glWeightPointerOES;
glQueryMatrixxOES_client_proc_t glQueryMatrixxOES;
glDepthRangefOES_client_proc_t glDepthRangefOES;
glFrustumfOES_client_proc_t glFrustumfOES;
glOrthofOES_client_proc_t glOrthofOES;
glClipPlanefOES_client_proc_t glClipPlanefOES;
glClipPlanefIMG_client_proc_t glClipPlanefIMG;
glGetClipPlanefOES_client_proc_t glGetClipPlanefOES;
glClearDepthfOES_client_proc_t glClearDepthfOES;
glTexGenfOES_client_proc_t glTexGenfOES;
glTexGenfvOES_client_proc_t glTexGenfvOES;
glTexGeniOES_client_proc_t glTexGeniOES;
glTexGenivOES_client_proc_t glTexGenivOES;
glTexGenxOES_client_proc_t glTexGenxOES;
glTexGenxvOES_client_proc_t glTexGenxvOES;
glGetTexGenfvOES_client_proc_t glGetTexGenfvOES;
glGetTexGenivOES_client_proc_t glGetTexGenivOES;
glGetTexGenxvOES_client_proc_t glGetTexGenxvOES;
glBindVertexArrayOES_client_proc_t glBindVertexArrayOES;
glDeleteVertexArraysOES_client_proc_t glDeleteVertexArraysOES;
glGenVertexArraysOES_client_proc_t glGenVertexArraysOES;
glIsVertexArrayOES_client_proc_t glIsVertexArrayOES;
glDiscardFramebufferEXT_client_proc_t glDiscardFramebufferEXT;
glMultiDrawArraysEXT_client_proc_t glMultiDrawArraysEXT;
glMultiDrawElementsEXT_client_proc_t glMultiDrawElementsEXT;
glMultiDrawArraysSUN_client_proc_t glMultiDrawArraysSUN;
glMultiDrawElementsSUN_client_proc_t glMultiDrawElementsSUN;
glRenderbufferStorageMultisampleIMG_client_proc_t glRenderbufferStorageMultisampleIMG;
glFramebufferTexture2DMultisampleIMG_client_proc_t glFramebufferTexture2DMultisampleIMG;
glDeleteFencesNV_client_proc_t glDeleteFencesNV;
glGenFencesNV_client_proc_t glGenFencesNV;
glIsFenceNV_client_proc_t glIsFenceNV;
glTestFenceNV_client_proc_t glTestFenceNV;
glGetFenceivNV_client_proc_t glGetFenceivNV;
glFinishFenceNV_client_proc_t glFinishFenceNV;
glSetFenceNV_client_proc_t glSetFenceNV;
glGetDriverControlsQCOM_client_proc_t glGetDriverControlsQCOM;
glGetDriverControlStringQCOM_client_proc_t glGetDriverControlStringQCOM;
glEnableDriverControlQCOM_client_proc_t glEnableDriverControlQCOM;
glDisableDriverControlQCOM_client_proc_t glDisableDriverControlQCOM;
glExtGetTexturesQCOM_client_proc_t glExtGetTexturesQCOM;
glExtGetBuffersQCOM_client_proc_t glExtGetBuffersQCOM;
glExtGetRenderbuffersQCOM_client_proc_t glExtGetRenderbuffersQCOM;
glExtGetFramebuffersQCOM_client_proc_t glExtGetFramebuffersQCOM;
glExtGetTexLevelParameterivQCOM_client_proc_t glExtGetTexLevelParameterivQCOM;
glExtTexObjectStateOverrideiQCOM_client_proc_t glExtTexObjectStateOverrideiQCOM;
glExtGetTexSubImageQCOM_client_proc_t glExtGetTexSubImageQCOM;
glExtGetBufferPointervQCOM_client_proc_t glExtGetBufferPointervQCOM;
glExtGetShadersQCOM_client_proc_t glExtGetShadersQCOM;
glExtGetProgramsQCOM_client_proc_t glExtGetProgramsQCOM;
glExtIsProgramBinaryQCOM_client_proc_t glExtIsProgramBinaryQCOM;
glExtGetProgramBinarySourceQCOM_client_proc_t glExtGetProgramBinarySourceQCOM;
glStartTilingQCOM_client_proc_t glStartTilingQCOM;
glEndTilingQCOM_client_proc_t glEndTilingQCOM;
virtual ~gl_client_context_t() {}
typedef gl_client_context_t *CONTEXT_ACCESSOR_TYPE(void);
static void setContextAccessor(CONTEXT_ACCESSOR_TYPE *f);
int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData);
virtual void setError(unsigned int error){ (void)error; };
virtual unsigned int getError(){ return 0; };
};
#endif

View file

@ -0,0 +1,305 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __gl_client_proc_t_h
#define __gl_client_proc_t_h
#include "gl_types.h"
#ifndef gl_APIENTRY
#define gl_APIENTRY
#endif
typedef void (gl_APIENTRY *glAlphaFunc_client_proc_t) (void * ctx, GLenum, GLclampf);
typedef void (gl_APIENTRY *glClearColor_client_proc_t) (void * ctx, GLclampf, GLclampf, GLclampf, GLclampf);
typedef void (gl_APIENTRY *glClearDepthf_client_proc_t) (void * ctx, GLclampf);
typedef void (gl_APIENTRY *glClipPlanef_client_proc_t) (void * ctx, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glColor4f_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glDepthRangef_client_proc_t) (void * ctx, GLclampf, GLclampf);
typedef void (gl_APIENTRY *glFogf_client_proc_t) (void * ctx, GLenum, GLfloat);
typedef void (gl_APIENTRY *glFogfv_client_proc_t) (void * ctx, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glFrustumf_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glGetClipPlanef_client_proc_t) (void * ctx, GLenum, GLfloat*);
typedef void (gl_APIENTRY *glGetFloatv_client_proc_t) (void * ctx, GLenum, GLfloat*);
typedef void (gl_APIENTRY *glGetLightfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
typedef void (gl_APIENTRY *glGetMaterialfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
typedef void (gl_APIENTRY *glGetTexEnvfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
typedef void (gl_APIENTRY *glGetTexParameterfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
typedef void (gl_APIENTRY *glLightModelf_client_proc_t) (void * ctx, GLenum, GLfloat);
typedef void (gl_APIENTRY *glLightModelfv_client_proc_t) (void * ctx, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glLightf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
typedef void (gl_APIENTRY *glLightfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glLineWidth_client_proc_t) (void * ctx, GLfloat);
typedef void (gl_APIENTRY *glLoadMatrixf_client_proc_t) (void * ctx, const GLfloat*);
typedef void (gl_APIENTRY *glMaterialf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
typedef void (gl_APIENTRY *glMaterialfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glMultMatrixf_client_proc_t) (void * ctx, const GLfloat*);
typedef void (gl_APIENTRY *glMultiTexCoord4f_client_proc_t) (void * ctx, GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glNormal3f_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glOrthof_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glPointParameterf_client_proc_t) (void * ctx, GLenum, GLfloat);
typedef void (gl_APIENTRY *glPointParameterfv_client_proc_t) (void * ctx, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glPointSize_client_proc_t) (void * ctx, GLfloat);
typedef void (gl_APIENTRY *glPolygonOffset_client_proc_t) (void * ctx, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glRotatef_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glScalef_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glTexEnvf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
typedef void (gl_APIENTRY *glTexEnvfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glTexParameterf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
typedef void (gl_APIENTRY *glTexParameterfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glTranslatef_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glActiveTexture_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glAlphaFuncx_client_proc_t) (void * ctx, GLenum, GLclampx);
typedef void (gl_APIENTRY *glBindBuffer_client_proc_t) (void * ctx, GLenum, GLuint);
typedef void (gl_APIENTRY *glBindTexture_client_proc_t) (void * ctx, GLenum, GLuint);
typedef void (gl_APIENTRY *glBlendFunc_client_proc_t) (void * ctx, GLenum, GLenum);
typedef void (gl_APIENTRY *glBufferData_client_proc_t) (void * ctx, GLenum, GLsizeiptr, const GLvoid*, GLenum);
typedef void (gl_APIENTRY *glBufferSubData_client_proc_t) (void * ctx, GLenum, GLintptr, GLsizeiptr, const GLvoid*);
typedef void (gl_APIENTRY *glClear_client_proc_t) (void * ctx, GLbitfield);
typedef void (gl_APIENTRY *glClearColorx_client_proc_t) (void * ctx, GLclampx, GLclampx, GLclampx, GLclampx);
typedef void (gl_APIENTRY *glClearDepthx_client_proc_t) (void * ctx, GLclampx);
typedef void (gl_APIENTRY *glClearStencil_client_proc_t) (void * ctx, GLint);
typedef void (gl_APIENTRY *glClientActiveTexture_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glColor4ub_client_proc_t) (void * ctx, GLubyte, GLubyte, GLubyte, GLubyte);
typedef void (gl_APIENTRY *glColor4x_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glColorMask_client_proc_t) (void * ctx, GLboolean, GLboolean, GLboolean, GLboolean);
typedef void (gl_APIENTRY *glColorPointer_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
typedef void (gl_APIENTRY *glCompressedTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
typedef void (gl_APIENTRY *glCompressedTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
typedef void (gl_APIENTRY *glCopyTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
typedef void (gl_APIENTRY *glCopyTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
typedef void (gl_APIENTRY *glCullFace_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glDeleteBuffers_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl_APIENTRY *glDeleteTextures_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl_APIENTRY *glDepthFunc_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glDepthMask_client_proc_t) (void * ctx, GLboolean);
typedef void (gl_APIENTRY *glDepthRangex_client_proc_t) (void * ctx, GLclampx, GLclampx);
typedef void (gl_APIENTRY *glDisable_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glDisableClientState_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glDrawArrays_client_proc_t) (void * ctx, GLenum, GLint, GLsizei);
typedef void (gl_APIENTRY *glDrawElements_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, const GLvoid*);
typedef void (gl_APIENTRY *glEnable_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glEnableClientState_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glFinish_client_proc_t) (void * ctx);
typedef void (gl_APIENTRY *glFlush_client_proc_t) (void * ctx);
typedef void (gl_APIENTRY *glFogx_client_proc_t) (void * ctx, GLenum, GLfixed);
typedef void (gl_APIENTRY *glFogxv_client_proc_t) (void * ctx, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glFrontFace_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glFrustumx_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glGetBooleanv_client_proc_t) (void * ctx, GLenum, GLboolean*);
typedef void (gl_APIENTRY *glGetBufferParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
typedef void (gl_APIENTRY *glClipPlanex_client_proc_t) (void * ctx, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glGenBuffers_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef void (gl_APIENTRY *glGenTextures_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef GLenum (gl_APIENTRY *glGetError_client_proc_t) (void * ctx);
typedef void (gl_APIENTRY *glGetFixedv_client_proc_t) (void * ctx, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetIntegerv_client_proc_t) (void * ctx, GLenum, GLint*);
typedef void (gl_APIENTRY *glGetLightxv_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetMaterialxv_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetPointerv_client_proc_t) (void * ctx, GLenum, GLvoid**);
typedef const GLubyte* (gl_APIENTRY *glGetString_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glGetTexEnviv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
typedef void (gl_APIENTRY *glGetTexEnvxv_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetTexParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
typedef void (gl_APIENTRY *glGetTexParameterxv_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glHint_client_proc_t) (void * ctx, GLenum, GLenum);
typedef GLboolean (gl_APIENTRY *glIsBuffer_client_proc_t) (void * ctx, GLuint);
typedef GLboolean (gl_APIENTRY *glIsEnabled_client_proc_t) (void * ctx, GLenum);
typedef GLboolean (gl_APIENTRY *glIsTexture_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glLightModelx_client_proc_t) (void * ctx, GLenum, GLfixed);
typedef void (gl_APIENTRY *glLightModelxv_client_proc_t) (void * ctx, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glLightx_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
typedef void (gl_APIENTRY *glLightxv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glLineWidthx_client_proc_t) (void * ctx, GLfixed);
typedef void (gl_APIENTRY *glLoadIdentity_client_proc_t) (void * ctx);
typedef void (gl_APIENTRY *glLoadMatrixx_client_proc_t) (void * ctx, const GLfixed*);
typedef void (gl_APIENTRY *glLogicOp_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glMaterialx_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
typedef void (gl_APIENTRY *glMaterialxv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glMatrixMode_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glMultMatrixx_client_proc_t) (void * ctx, const GLfixed*);
typedef void (gl_APIENTRY *glMultiTexCoord4x_client_proc_t) (void * ctx, GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glNormal3x_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glNormalPointer_client_proc_t) (void * ctx, GLenum, GLsizei, const GLvoid*);
typedef void (gl_APIENTRY *glOrthox_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glPixelStorei_client_proc_t) (void * ctx, GLenum, GLint);
typedef void (gl_APIENTRY *glPointParameterx_client_proc_t) (void * ctx, GLenum, GLfixed);
typedef void (gl_APIENTRY *glPointParameterxv_client_proc_t) (void * ctx, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glPointSizex_client_proc_t) (void * ctx, GLfixed);
typedef void (gl_APIENTRY *glPolygonOffsetx_client_proc_t) (void * ctx, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glPopMatrix_client_proc_t) (void * ctx);
typedef void (gl_APIENTRY *glPushMatrix_client_proc_t) (void * ctx);
typedef void (gl_APIENTRY *glReadPixels_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
typedef void (gl_APIENTRY *glRotatex_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glSampleCoverage_client_proc_t) (void * ctx, GLclampf, GLboolean);
typedef void (gl_APIENTRY *glSampleCoveragex_client_proc_t) (void * ctx, GLclampx, GLboolean);
typedef void (gl_APIENTRY *glScalex_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glScissor_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei);
typedef void (gl_APIENTRY *glShadeModel_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glStencilFunc_client_proc_t) (void * ctx, GLenum, GLint, GLuint);
typedef void (gl_APIENTRY *glStencilMask_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glStencilOp_client_proc_t) (void * ctx, GLenum, GLenum, GLenum);
typedef void (gl_APIENTRY *glTexCoordPointer_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
typedef void (gl_APIENTRY *glTexEnvi_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
typedef void (gl_APIENTRY *glTexEnvx_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
typedef void (gl_APIENTRY *glTexEnviv_client_proc_t) (void * ctx, GLenum, GLenum, const GLint*);
typedef void (gl_APIENTRY *glTexEnvxv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
typedef void (gl_APIENTRY *glTexParameteri_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
typedef void (gl_APIENTRY *glTexParameterx_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
typedef void (gl_APIENTRY *glTexParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, const GLint*);
typedef void (gl_APIENTRY *glTexParameterxv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
typedef void (gl_APIENTRY *glTranslatex_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glVertexPointer_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
typedef void (gl_APIENTRY *glViewport_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei);
typedef void (gl_APIENTRY *glPointSizePointerOES_client_proc_t) (void * ctx, GLenum, GLsizei, const GLvoid*);
typedef void (gl_APIENTRY *glVertexPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
typedef void (gl_APIENTRY *glColorPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
typedef void (gl_APIENTRY *glNormalPointerOffset_client_proc_t) (void * ctx, GLenum, GLsizei, GLuint);
typedef void (gl_APIENTRY *glPointSizePointerOffset_client_proc_t) (void * ctx, GLenum, GLsizei, GLuint);
typedef void (gl_APIENTRY *glTexCoordPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
typedef void (gl_APIENTRY *glWeightPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
typedef void (gl_APIENTRY *glMatrixIndexPointerOffset_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, GLuint);
typedef void (gl_APIENTRY *glVertexPointerData_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, void*, GLuint);
typedef void (gl_APIENTRY *glColorPointerData_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, void*, GLuint);
typedef void (gl_APIENTRY *glNormalPointerData_client_proc_t) (void * ctx, GLenum, GLsizei, void*, GLuint);
typedef void (gl_APIENTRY *glTexCoordPointerData_client_proc_t) (void * ctx, GLint, GLint, GLenum, GLsizei, void*, GLuint);
typedef void (gl_APIENTRY *glPointSizePointerData_client_proc_t) (void * ctx, GLenum, GLsizei, void*, GLuint);
typedef void (gl_APIENTRY *glWeightPointerData_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, void*, GLuint);
typedef void (gl_APIENTRY *glMatrixIndexPointerData_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, void*, GLuint);
typedef void (gl_APIENTRY *glDrawElementsOffset_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, GLuint);
typedef void (gl_APIENTRY *glDrawElementsData_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, void*, GLuint);
typedef void (gl_APIENTRY *glGetCompressedTextureFormats_client_proc_t) (void * ctx, int, GLint*);
typedef int (gl_APIENTRY *glFinishRoundTrip_client_proc_t) (void * ctx);
typedef void (gl_APIENTRY *glBlendEquationSeparateOES_client_proc_t) (void * ctx, GLenum, GLenum);
typedef void (gl_APIENTRY *glBlendFuncSeparateOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLenum);
typedef void (gl_APIENTRY *glBlendEquationOES_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glDrawTexsOES_client_proc_t) (void * ctx, GLshort, GLshort, GLshort, GLshort, GLshort);
typedef void (gl_APIENTRY *glDrawTexiOES_client_proc_t) (void * ctx, GLint, GLint, GLint, GLint, GLint);
typedef void (gl_APIENTRY *glDrawTexxOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glDrawTexsvOES_client_proc_t) (void * ctx, const GLshort*);
typedef void (gl_APIENTRY *glDrawTexivOES_client_proc_t) (void * ctx, const GLint*);
typedef void (gl_APIENTRY *glDrawTexxvOES_client_proc_t) (void * ctx, const GLfixed*);
typedef void (gl_APIENTRY *glDrawTexfOES_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glDrawTexfvOES_client_proc_t) (void * ctx, const GLfloat*);
typedef void (gl_APIENTRY *glEGLImageTargetTexture2DOES_client_proc_t) (void * ctx, GLenum, GLeglImageOES);
typedef void (gl_APIENTRY *glEGLImageTargetRenderbufferStorageOES_client_proc_t) (void * ctx, GLenum, GLeglImageOES);
typedef void (gl_APIENTRY *glAlphaFuncxOES_client_proc_t) (void * ctx, GLenum, GLclampx);
typedef void (gl_APIENTRY *glClearColorxOES_client_proc_t) (void * ctx, GLclampx, GLclampx, GLclampx, GLclampx);
typedef void (gl_APIENTRY *glClearDepthxOES_client_proc_t) (void * ctx, GLclampx);
typedef void (gl_APIENTRY *glClipPlanexOES_client_proc_t) (void * ctx, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glClipPlanexIMG_client_proc_t) (void * ctx, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glColor4xOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glDepthRangexOES_client_proc_t) (void * ctx, GLclampx, GLclampx);
typedef void (gl_APIENTRY *glFogxOES_client_proc_t) (void * ctx, GLenum, GLfixed);
typedef void (gl_APIENTRY *glFogxvOES_client_proc_t) (void * ctx, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glFrustumxOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glGetClipPlanexOES_client_proc_t) (void * ctx, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetClipPlanex_client_proc_t) (void * ctx, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetFixedvOES_client_proc_t) (void * ctx, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetLightxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetMaterialxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetTexEnvxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glGetTexParameterxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glLightModelxOES_client_proc_t) (void * ctx, GLenum, GLfixed);
typedef void (gl_APIENTRY *glLightModelxvOES_client_proc_t) (void * ctx, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glLightxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
typedef void (gl_APIENTRY *glLightxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glLineWidthxOES_client_proc_t) (void * ctx, GLfixed);
typedef void (gl_APIENTRY *glLoadMatrixxOES_client_proc_t) (void * ctx, const GLfixed*);
typedef void (gl_APIENTRY *glMaterialxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
typedef void (gl_APIENTRY *glMaterialxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glMultMatrixxOES_client_proc_t) (void * ctx, const GLfixed*);
typedef void (gl_APIENTRY *glMultiTexCoord4xOES_client_proc_t) (void * ctx, GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glNormal3xOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glOrthoxOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glPointParameterxOES_client_proc_t) (void * ctx, GLenum, GLfixed);
typedef void (gl_APIENTRY *glPointParameterxvOES_client_proc_t) (void * ctx, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glPointSizexOES_client_proc_t) (void * ctx, GLfixed);
typedef void (gl_APIENTRY *glPolygonOffsetxOES_client_proc_t) (void * ctx, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glRotatexOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glSampleCoveragexOES_client_proc_t) (void * ctx, GLclampx, GLboolean);
typedef void (gl_APIENTRY *glScalexOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
typedef void (gl_APIENTRY *glTexEnvxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
typedef void (gl_APIENTRY *glTexEnvxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glTexParameterxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
typedef void (gl_APIENTRY *glTexParameterxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glTranslatexOES_client_proc_t) (void * ctx, GLfixed, GLfixed, GLfixed);
typedef GLboolean (gl_APIENTRY *glIsRenderbufferOES_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glBindRenderbufferOES_client_proc_t) (void * ctx, GLenum, GLuint);
typedef void (gl_APIENTRY *glDeleteRenderbuffersOES_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl_APIENTRY *glGenRenderbuffersOES_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef void (gl_APIENTRY *glRenderbufferStorageOES_client_proc_t) (void * ctx, GLenum, GLenum, GLsizei, GLsizei);
typedef void (gl_APIENTRY *glGetRenderbufferParameterivOES_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
typedef GLboolean (gl_APIENTRY *glIsFramebufferOES_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glBindFramebufferOES_client_proc_t) (void * ctx, GLenum, GLuint);
typedef void (gl_APIENTRY *glDeleteFramebuffersOES_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl_APIENTRY *glGenFramebuffersOES_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef GLenum (gl_APIENTRY *glCheckFramebufferStatusOES_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glFramebufferRenderbufferOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint);
typedef void (gl_APIENTRY *glFramebufferTexture2DOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint);
typedef void (gl_APIENTRY *glGetFramebufferAttachmentParameterivOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLint*);
typedef void (gl_APIENTRY *glGenerateMipmapOES_client_proc_t) (void * ctx, GLenum);
typedef void* (gl_APIENTRY *glMapBufferOES_client_proc_t) (void * ctx, GLenum, GLenum);
typedef GLboolean (gl_APIENTRY *glUnmapBufferOES_client_proc_t) (void * ctx, GLenum);
typedef void (gl_APIENTRY *glGetBufferPointervOES_client_proc_t) (void * ctx, GLenum, GLenum, GLvoid**);
typedef void (gl_APIENTRY *glCurrentPaletteMatrixOES_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glLoadPaletteFromModelViewMatrixOES_client_proc_t) (void * ctx);
typedef void (gl_APIENTRY *glMatrixIndexPointerOES_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
typedef void (gl_APIENTRY *glWeightPointerOES_client_proc_t) (void * ctx, GLint, GLenum, GLsizei, const GLvoid*);
typedef GLbitfield (gl_APIENTRY *glQueryMatrixxOES_client_proc_t) (void * ctx, GLfixed*, GLint*);
typedef void (gl_APIENTRY *glDepthRangefOES_client_proc_t) (void * ctx, GLclampf, GLclampf);
typedef void (gl_APIENTRY *glFrustumfOES_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glOrthofOES_client_proc_t) (void * ctx, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl_APIENTRY *glClipPlanefOES_client_proc_t) (void * ctx, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glClipPlanefIMG_client_proc_t) (void * ctx, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glGetClipPlanefOES_client_proc_t) (void * ctx, GLenum, GLfloat*);
typedef void (gl_APIENTRY *glClearDepthfOES_client_proc_t) (void * ctx, GLclampf);
typedef void (gl_APIENTRY *glTexGenfOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
typedef void (gl_APIENTRY *glTexGenfvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
typedef void (gl_APIENTRY *glTexGeniOES_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
typedef void (gl_APIENTRY *glTexGenivOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLint*);
typedef void (gl_APIENTRY *glTexGenxOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed);
typedef void (gl_APIENTRY *glTexGenxvOES_client_proc_t) (void * ctx, GLenum, GLenum, const GLfixed*);
typedef void (gl_APIENTRY *glGetTexGenfvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
typedef void (gl_APIENTRY *glGetTexGenivOES_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
typedef void (gl_APIENTRY *glGetTexGenxvOES_client_proc_t) (void * ctx, GLenum, GLenum, GLfixed*);
typedef void (gl_APIENTRY *glBindVertexArrayOES_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glDeleteVertexArraysOES_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl_APIENTRY *glGenVertexArraysOES_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef GLboolean (gl_APIENTRY *glIsVertexArrayOES_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glDiscardFramebufferEXT_client_proc_t) (void * ctx, GLenum, GLsizei, const GLenum*);
typedef void (gl_APIENTRY *glMultiDrawArraysEXT_client_proc_t) (void * ctx, GLenum, const GLint*, const GLsizei*, GLsizei);
typedef void (gl_APIENTRY *glMultiDrawElementsEXT_client_proc_t) (void * ctx, GLenum, const GLsizei*, GLenum, const GLvoid* const*, GLsizei);
typedef void (gl_APIENTRY *glMultiDrawArraysSUN_client_proc_t) (void * ctx, GLenum, GLint*, GLsizei*, GLsizei);
typedef void (gl_APIENTRY *glMultiDrawElementsSUN_client_proc_t) (void * ctx, GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei);
typedef void (gl_APIENTRY *glRenderbufferStorageMultisampleIMG_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, GLsizei, GLsizei);
typedef void (gl_APIENTRY *glFramebufferTexture2DMultisampleIMG_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
typedef void (gl_APIENTRY *glDeleteFencesNV_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl_APIENTRY *glGenFencesNV_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef GLboolean (gl_APIENTRY *glIsFenceNV_client_proc_t) (void * ctx, GLuint);
typedef GLboolean (gl_APIENTRY *glTestFenceNV_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glGetFenceivNV_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
typedef void (gl_APIENTRY *glFinishFenceNV_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glSetFenceNV_client_proc_t) (void * ctx, GLuint, GLenum);
typedef void (gl_APIENTRY *glGetDriverControlsQCOM_client_proc_t) (void * ctx, GLint*, GLsizei, GLuint*);
typedef void (gl_APIENTRY *glGetDriverControlStringQCOM_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
typedef void (gl_APIENTRY *glEnableDriverControlQCOM_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glDisableDriverControlQCOM_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glExtGetTexturesQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl_APIENTRY *glExtGetBuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl_APIENTRY *glExtGetRenderbuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl_APIENTRY *glExtGetFramebuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl_APIENTRY *glExtGetTexLevelParameterivQCOM_client_proc_t) (void * ctx, GLuint, GLenum, GLint, GLenum, GLint*);
typedef void (gl_APIENTRY *glExtTexObjectStateOverrideiQCOM_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
typedef void (gl_APIENTRY *glExtGetTexSubImageQCOM_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
typedef void (gl_APIENTRY *glExtGetBufferPointervQCOM_client_proc_t) (void * ctx, GLenum, GLvoid**);
typedef void (gl_APIENTRY *glExtGetShadersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl_APIENTRY *glExtGetProgramsQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef GLboolean (gl_APIENTRY *glExtIsProgramBinaryQCOM_client_proc_t) (void * ctx, GLuint);
typedef void (gl_APIENTRY *glExtGetProgramBinarySourceQCOM_client_proc_t) (void * ctx, GLuint, GLenum, GLchar*, GLint*);
typedef void (gl_APIENTRY *glStartTilingQCOM_client_proc_t) (void * ctx, GLuint, GLuint, GLuint, GLuint, GLbitfield);
typedef void (gl_APIENTRY *glEndTilingQCOM_client_proc_t) (void * ctx, GLbitfield);
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,23 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef GUARD_gl_encoder_context_t
#define GUARD_gl_encoder_context_t
#include "IOStream.h"
#include "ChecksumCalculator.h"
#include "gl_client_context.h"
#include "glUtils.h"
#include "GLEncoderUtils.h"
struct gl_encoder_context_t : public gl_client_context_t {
IOStream *m_stream;
ChecksumCalculator *m_checksumCalculator;
gl_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator);
};
#endif // GUARD_gl_encoder_context_t

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,288 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __gl_client_ftable_t_h
#define __gl_client_ftable_t_h
static const struct _gl_funcs_by_name {
const char *name;
void *proc;
} gl_funcs_by_name[] = {
{"glAlphaFunc", (void*)glAlphaFunc},
{"glClearColor", (void*)glClearColor},
{"glClearDepthf", (void*)glClearDepthf},
{"glClipPlanef", (void*)glClipPlanef},
{"glColor4f", (void*)glColor4f},
{"glDepthRangef", (void*)glDepthRangef},
{"glFogf", (void*)glFogf},
{"glFogfv", (void*)glFogfv},
{"glFrustumf", (void*)glFrustumf},
{"glGetClipPlanef", (void*)glGetClipPlanef},
{"glGetFloatv", (void*)glGetFloatv},
{"glGetLightfv", (void*)glGetLightfv},
{"glGetMaterialfv", (void*)glGetMaterialfv},
{"glGetTexEnvfv", (void*)glGetTexEnvfv},
{"glGetTexParameterfv", (void*)glGetTexParameterfv},
{"glLightModelf", (void*)glLightModelf},
{"glLightModelfv", (void*)glLightModelfv},
{"glLightf", (void*)glLightf},
{"glLightfv", (void*)glLightfv},
{"glLineWidth", (void*)glLineWidth},
{"glLoadMatrixf", (void*)glLoadMatrixf},
{"glMaterialf", (void*)glMaterialf},
{"glMaterialfv", (void*)glMaterialfv},
{"glMultMatrixf", (void*)glMultMatrixf},
{"glMultiTexCoord4f", (void*)glMultiTexCoord4f},
{"glNormal3f", (void*)glNormal3f},
{"glOrthof", (void*)glOrthof},
{"glPointParameterf", (void*)glPointParameterf},
{"glPointParameterfv", (void*)glPointParameterfv},
{"glPointSize", (void*)glPointSize},
{"glPolygonOffset", (void*)glPolygonOffset},
{"glRotatef", (void*)glRotatef},
{"glScalef", (void*)glScalef},
{"glTexEnvf", (void*)glTexEnvf},
{"glTexEnvfv", (void*)glTexEnvfv},
{"glTexParameterf", (void*)glTexParameterf},
{"glTexParameterfv", (void*)glTexParameterfv},
{"glTranslatef", (void*)glTranslatef},
{"glActiveTexture", (void*)glActiveTexture},
{"glAlphaFuncx", (void*)glAlphaFuncx},
{"glBindBuffer", (void*)glBindBuffer},
{"glBindTexture", (void*)glBindTexture},
{"glBlendFunc", (void*)glBlendFunc},
{"glBufferData", (void*)glBufferData},
{"glBufferSubData", (void*)glBufferSubData},
{"glClear", (void*)glClear},
{"glClearColorx", (void*)glClearColorx},
{"glClearDepthx", (void*)glClearDepthx},
{"glClearStencil", (void*)glClearStencil},
{"glClientActiveTexture", (void*)glClientActiveTexture},
{"glColor4ub", (void*)glColor4ub},
{"glColor4x", (void*)glColor4x},
{"glColorMask", (void*)glColorMask},
{"glColorPointer", (void*)glColorPointer},
{"glCompressedTexImage2D", (void*)glCompressedTexImage2D},
{"glCompressedTexSubImage2D", (void*)glCompressedTexSubImage2D},
{"glCopyTexImage2D", (void*)glCopyTexImage2D},
{"glCopyTexSubImage2D", (void*)glCopyTexSubImage2D},
{"glCullFace", (void*)glCullFace},
{"glDeleteBuffers", (void*)glDeleteBuffers},
{"glDeleteTextures", (void*)glDeleteTextures},
{"glDepthFunc", (void*)glDepthFunc},
{"glDepthMask", (void*)glDepthMask},
{"glDepthRangex", (void*)glDepthRangex},
{"glDisable", (void*)glDisable},
{"glDisableClientState", (void*)glDisableClientState},
{"glDrawArrays", (void*)glDrawArrays},
{"glDrawElements", (void*)glDrawElements},
{"glEnable", (void*)glEnable},
{"glEnableClientState", (void*)glEnableClientState},
{"glFinish", (void*)glFinish},
{"glFlush", (void*)glFlush},
{"glFogx", (void*)glFogx},
{"glFogxv", (void*)glFogxv},
{"glFrontFace", (void*)glFrontFace},
{"glFrustumx", (void*)glFrustumx},
{"glGetBooleanv", (void*)glGetBooleanv},
{"glGetBufferParameteriv", (void*)glGetBufferParameteriv},
{"glClipPlanex", (void*)glClipPlanex},
{"glGenBuffers", (void*)glGenBuffers},
{"glGenTextures", (void*)glGenTextures},
{"glGetError", (void*)glGetError},
{"glGetFixedv", (void*)glGetFixedv},
{"glGetIntegerv", (void*)glGetIntegerv},
{"glGetLightxv", (void*)glGetLightxv},
{"glGetMaterialxv", (void*)glGetMaterialxv},
{"glGetPointerv", (void*)glGetPointerv},
{"glGetString", (void*)glGetString},
{"glGetTexEnviv", (void*)glGetTexEnviv},
{"glGetTexEnvxv", (void*)glGetTexEnvxv},
{"glGetTexParameteriv", (void*)glGetTexParameteriv},
{"glGetTexParameterxv", (void*)glGetTexParameterxv},
{"glHint", (void*)glHint},
{"glIsBuffer", (void*)glIsBuffer},
{"glIsEnabled", (void*)glIsEnabled},
{"glIsTexture", (void*)glIsTexture},
{"glLightModelx", (void*)glLightModelx},
{"glLightModelxv", (void*)glLightModelxv},
{"glLightx", (void*)glLightx},
{"glLightxv", (void*)glLightxv},
{"glLineWidthx", (void*)glLineWidthx},
{"glLoadIdentity", (void*)glLoadIdentity},
{"glLoadMatrixx", (void*)glLoadMatrixx},
{"glLogicOp", (void*)glLogicOp},
{"glMaterialx", (void*)glMaterialx},
{"glMaterialxv", (void*)glMaterialxv},
{"glMatrixMode", (void*)glMatrixMode},
{"glMultMatrixx", (void*)glMultMatrixx},
{"glMultiTexCoord4x", (void*)glMultiTexCoord4x},
{"glNormal3x", (void*)glNormal3x},
{"glNormalPointer", (void*)glNormalPointer},
{"glOrthox", (void*)glOrthox},
{"glPixelStorei", (void*)glPixelStorei},
{"glPointParameterx", (void*)glPointParameterx},
{"glPointParameterxv", (void*)glPointParameterxv},
{"glPointSizex", (void*)glPointSizex},
{"glPolygonOffsetx", (void*)glPolygonOffsetx},
{"glPopMatrix", (void*)glPopMatrix},
{"glPushMatrix", (void*)glPushMatrix},
{"glReadPixels", (void*)glReadPixels},
{"glRotatex", (void*)glRotatex},
{"glSampleCoverage", (void*)glSampleCoverage},
{"glSampleCoveragex", (void*)glSampleCoveragex},
{"glScalex", (void*)glScalex},
{"glScissor", (void*)glScissor},
{"glShadeModel", (void*)glShadeModel},
{"glStencilFunc", (void*)glStencilFunc},
{"glStencilMask", (void*)glStencilMask},
{"glStencilOp", (void*)glStencilOp},
{"glTexCoordPointer", (void*)glTexCoordPointer},
{"glTexEnvi", (void*)glTexEnvi},
{"glTexEnvx", (void*)glTexEnvx},
{"glTexEnviv", (void*)glTexEnviv},
{"glTexEnvxv", (void*)glTexEnvxv},
{"glTexImage2D", (void*)glTexImage2D},
{"glTexParameteri", (void*)glTexParameteri},
{"glTexParameterx", (void*)glTexParameterx},
{"glTexParameteriv", (void*)glTexParameteriv},
{"glTexParameterxv", (void*)glTexParameterxv},
{"glTexSubImage2D", (void*)glTexSubImage2D},
{"glTranslatex", (void*)glTranslatex},
{"glVertexPointer", (void*)glVertexPointer},
{"glViewport", (void*)glViewport},
{"glPointSizePointerOES", (void*)glPointSizePointerOES},
{"glBlendEquationSeparateOES", (void*)glBlendEquationSeparateOES},
{"glBlendFuncSeparateOES", (void*)glBlendFuncSeparateOES},
{"glBlendEquationOES", (void*)glBlendEquationOES},
{"glDrawTexsOES", (void*)glDrawTexsOES},
{"glDrawTexiOES", (void*)glDrawTexiOES},
{"glDrawTexxOES", (void*)glDrawTexxOES},
{"glDrawTexsvOES", (void*)glDrawTexsvOES},
{"glDrawTexivOES", (void*)glDrawTexivOES},
{"glDrawTexxvOES", (void*)glDrawTexxvOES},
{"glDrawTexfOES", (void*)glDrawTexfOES},
{"glDrawTexfvOES", (void*)glDrawTexfvOES},
{"glEGLImageTargetTexture2DOES", (void*)glEGLImageTargetTexture2DOES},
{"glEGLImageTargetRenderbufferStorageOES", (void*)glEGLImageTargetRenderbufferStorageOES},
{"glAlphaFuncxOES", (void*)glAlphaFuncxOES},
{"glClearColorxOES", (void*)glClearColorxOES},
{"glClearDepthxOES", (void*)glClearDepthxOES},
{"glClipPlanexOES", (void*)glClipPlanexOES},
{"glClipPlanexIMG", (void*)glClipPlanexIMG},
{"glColor4xOES", (void*)glColor4xOES},
{"glDepthRangexOES", (void*)glDepthRangexOES},
{"glFogxOES", (void*)glFogxOES},
{"glFogxvOES", (void*)glFogxvOES},
{"glFrustumxOES", (void*)glFrustumxOES},
{"glGetClipPlanexOES", (void*)glGetClipPlanexOES},
{"glGetClipPlanex", (void*)glGetClipPlanex},
{"glGetFixedvOES", (void*)glGetFixedvOES},
{"glGetLightxvOES", (void*)glGetLightxvOES},
{"glGetMaterialxvOES", (void*)glGetMaterialxvOES},
{"glGetTexEnvxvOES", (void*)glGetTexEnvxvOES},
{"glGetTexParameterxvOES", (void*)glGetTexParameterxvOES},
{"glLightModelxOES", (void*)glLightModelxOES},
{"glLightModelxvOES", (void*)glLightModelxvOES},
{"glLightxOES", (void*)glLightxOES},
{"glLightxvOES", (void*)glLightxvOES},
{"glLineWidthxOES", (void*)glLineWidthxOES},
{"glLoadMatrixxOES", (void*)glLoadMatrixxOES},
{"glMaterialxOES", (void*)glMaterialxOES},
{"glMaterialxvOES", (void*)glMaterialxvOES},
{"glMultMatrixxOES", (void*)glMultMatrixxOES},
{"glMultiTexCoord4xOES", (void*)glMultiTexCoord4xOES},
{"glNormal3xOES", (void*)glNormal3xOES},
{"glOrthoxOES", (void*)glOrthoxOES},
{"glPointParameterxOES", (void*)glPointParameterxOES},
{"glPointParameterxvOES", (void*)glPointParameterxvOES},
{"glPointSizexOES", (void*)glPointSizexOES},
{"glPolygonOffsetxOES", (void*)glPolygonOffsetxOES},
{"glRotatexOES", (void*)glRotatexOES},
{"glSampleCoveragexOES", (void*)glSampleCoveragexOES},
{"glScalexOES", (void*)glScalexOES},
{"glTexEnvxOES", (void*)glTexEnvxOES},
{"glTexEnvxvOES", (void*)glTexEnvxvOES},
{"glTexParameterxOES", (void*)glTexParameterxOES},
{"glTexParameterxvOES", (void*)glTexParameterxvOES},
{"glTranslatexOES", (void*)glTranslatexOES},
{"glIsRenderbufferOES", (void*)glIsRenderbufferOES},
{"glBindRenderbufferOES", (void*)glBindRenderbufferOES},
{"glDeleteRenderbuffersOES", (void*)glDeleteRenderbuffersOES},
{"glGenRenderbuffersOES", (void*)glGenRenderbuffersOES},
{"glRenderbufferStorageOES", (void*)glRenderbufferStorageOES},
{"glGetRenderbufferParameterivOES", (void*)glGetRenderbufferParameterivOES},
{"glIsFramebufferOES", (void*)glIsFramebufferOES},
{"glBindFramebufferOES", (void*)glBindFramebufferOES},
{"glDeleteFramebuffersOES", (void*)glDeleteFramebuffersOES},
{"glGenFramebuffersOES", (void*)glGenFramebuffersOES},
{"glCheckFramebufferStatusOES", (void*)glCheckFramebufferStatusOES},
{"glFramebufferRenderbufferOES", (void*)glFramebufferRenderbufferOES},
{"glFramebufferTexture2DOES", (void*)glFramebufferTexture2DOES},
{"glGetFramebufferAttachmentParameterivOES", (void*)glGetFramebufferAttachmentParameterivOES},
{"glGenerateMipmapOES", (void*)glGenerateMipmapOES},
{"glMapBufferOES", (void*)glMapBufferOES},
{"glUnmapBufferOES", (void*)glUnmapBufferOES},
{"glGetBufferPointervOES", (void*)glGetBufferPointervOES},
{"glCurrentPaletteMatrixOES", (void*)glCurrentPaletteMatrixOES},
{"glLoadPaletteFromModelViewMatrixOES", (void*)glLoadPaletteFromModelViewMatrixOES},
{"glMatrixIndexPointerOES", (void*)glMatrixIndexPointerOES},
{"glWeightPointerOES", (void*)glWeightPointerOES},
{"glQueryMatrixxOES", (void*)glQueryMatrixxOES},
{"glDepthRangefOES", (void*)glDepthRangefOES},
{"glFrustumfOES", (void*)glFrustumfOES},
{"glOrthofOES", (void*)glOrthofOES},
{"glClipPlanefOES", (void*)glClipPlanefOES},
{"glClipPlanefIMG", (void*)glClipPlanefIMG},
{"glGetClipPlanefOES", (void*)glGetClipPlanefOES},
{"glClearDepthfOES", (void*)glClearDepthfOES},
{"glTexGenfOES", (void*)glTexGenfOES},
{"glTexGenfvOES", (void*)glTexGenfvOES},
{"glTexGeniOES", (void*)glTexGeniOES},
{"glTexGenivOES", (void*)glTexGenivOES},
{"glTexGenxOES", (void*)glTexGenxOES},
{"glTexGenxvOES", (void*)glTexGenxvOES},
{"glGetTexGenfvOES", (void*)glGetTexGenfvOES},
{"glGetTexGenivOES", (void*)glGetTexGenivOES},
{"glGetTexGenxvOES", (void*)glGetTexGenxvOES},
{"glBindVertexArrayOES", (void*)glBindVertexArrayOES},
{"glDeleteVertexArraysOES", (void*)glDeleteVertexArraysOES},
{"glGenVertexArraysOES", (void*)glGenVertexArraysOES},
{"glIsVertexArrayOES", (void*)glIsVertexArrayOES},
{"glDiscardFramebufferEXT", (void*)glDiscardFramebufferEXT},
{"glMultiDrawArraysEXT", (void*)glMultiDrawArraysEXT},
{"glMultiDrawElementsEXT", (void*)glMultiDrawElementsEXT},
{"glMultiDrawArraysSUN", (void*)glMultiDrawArraysSUN},
{"glMultiDrawElementsSUN", (void*)glMultiDrawElementsSUN},
{"glRenderbufferStorageMultisampleIMG", (void*)glRenderbufferStorageMultisampleIMG},
{"glFramebufferTexture2DMultisampleIMG", (void*)glFramebufferTexture2DMultisampleIMG},
{"glDeleteFencesNV", (void*)glDeleteFencesNV},
{"glGenFencesNV", (void*)glGenFencesNV},
{"glIsFenceNV", (void*)glIsFenceNV},
{"glTestFenceNV", (void*)glTestFenceNV},
{"glGetFenceivNV", (void*)glGetFenceivNV},
{"glFinishFenceNV", (void*)glFinishFenceNV},
{"glSetFenceNV", (void*)glSetFenceNV},
{"glGetDriverControlsQCOM", (void*)glGetDriverControlsQCOM},
{"glGetDriverControlStringQCOM", (void*)glGetDriverControlStringQCOM},
{"glEnableDriverControlQCOM", (void*)glEnableDriverControlQCOM},
{"glDisableDriverControlQCOM", (void*)glDisableDriverControlQCOM},
{"glExtGetTexturesQCOM", (void*)glExtGetTexturesQCOM},
{"glExtGetBuffersQCOM", (void*)glExtGetBuffersQCOM},
{"glExtGetRenderbuffersQCOM", (void*)glExtGetRenderbuffersQCOM},
{"glExtGetFramebuffersQCOM", (void*)glExtGetFramebuffersQCOM},
{"glExtGetTexLevelParameterivQCOM", (void*)glExtGetTexLevelParameterivQCOM},
{"glExtTexObjectStateOverrideiQCOM", (void*)glExtTexObjectStateOverrideiQCOM},
{"glExtGetTexSubImageQCOM", (void*)glExtGetTexSubImageQCOM},
{"glExtGetBufferPointervQCOM", (void*)glExtGetBufferPointervQCOM},
{"glExtGetShadersQCOM", (void*)glExtGetShadersQCOM},
{"glExtGetProgramsQCOM", (void*)glExtGetProgramsQCOM},
{"glExtIsProgramBinaryQCOM", (void*)glExtIsProgramBinaryQCOM},
{"glExtGetProgramBinarySourceQCOM", (void*)glExtGetProgramBinarySourceQCOM},
{"glStartTilingQCOM", (void*)glStartTilingQCOM},
{"glEndTilingQCOM", (void*)glEndTilingQCOM},
};
static const int gl_num_funcs = sizeof(gl_funcs_by_name) / sizeof(struct _gl_funcs_by_name);
#endif

View file

@ -0,0 +1,300 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __GUARD_gl_opcodes_h_
#define __GUARD_gl_opcodes_h_
#define OP_glAlphaFunc 1024
#define OP_glClearColor 1025
#define OP_glClearDepthf 1026
#define OP_glClipPlanef 1027
#define OP_glColor4f 1028
#define OP_glDepthRangef 1029
#define OP_glFogf 1030
#define OP_glFogfv 1031
#define OP_glFrustumf 1032
#define OP_glGetClipPlanef 1033
#define OP_glGetFloatv 1034
#define OP_glGetLightfv 1035
#define OP_glGetMaterialfv 1036
#define OP_glGetTexEnvfv 1037
#define OP_glGetTexParameterfv 1038
#define OP_glLightModelf 1039
#define OP_glLightModelfv 1040
#define OP_glLightf 1041
#define OP_glLightfv 1042
#define OP_glLineWidth 1043
#define OP_glLoadMatrixf 1044
#define OP_glMaterialf 1045
#define OP_glMaterialfv 1046
#define OP_glMultMatrixf 1047
#define OP_glMultiTexCoord4f 1048
#define OP_glNormal3f 1049
#define OP_glOrthof 1050
#define OP_glPointParameterf 1051
#define OP_glPointParameterfv 1052
#define OP_glPointSize 1053
#define OP_glPolygonOffset 1054
#define OP_glRotatef 1055
#define OP_glScalef 1056
#define OP_glTexEnvf 1057
#define OP_glTexEnvfv 1058
#define OP_glTexParameterf 1059
#define OP_glTexParameterfv 1060
#define OP_glTranslatef 1061
#define OP_glActiveTexture 1062
#define OP_glAlphaFuncx 1063
#define OP_glBindBuffer 1064
#define OP_glBindTexture 1065
#define OP_glBlendFunc 1066
#define OP_glBufferData 1067
#define OP_glBufferSubData 1068
#define OP_glClear 1069
#define OP_glClearColorx 1070
#define OP_glClearDepthx 1071
#define OP_glClearStencil 1072
#define OP_glClientActiveTexture 1073
#define OP_glColor4ub 1074
#define OP_glColor4x 1075
#define OP_glColorMask 1076
#define OP_glColorPointer 1077
#define OP_glCompressedTexImage2D 1078
#define OP_glCompressedTexSubImage2D 1079
#define OP_glCopyTexImage2D 1080
#define OP_glCopyTexSubImage2D 1081
#define OP_glCullFace 1082
#define OP_glDeleteBuffers 1083
#define OP_glDeleteTextures 1084
#define OP_glDepthFunc 1085
#define OP_glDepthMask 1086
#define OP_glDepthRangex 1087
#define OP_glDisable 1088
#define OP_glDisableClientState 1089
#define OP_glDrawArrays 1090
#define OP_glDrawElements 1091
#define OP_glEnable 1092
#define OP_glEnableClientState 1093
#define OP_glFinish 1094
#define OP_glFlush 1095
#define OP_glFogx 1096
#define OP_glFogxv 1097
#define OP_glFrontFace 1098
#define OP_glFrustumx 1099
#define OP_glGetBooleanv 1100
#define OP_glGetBufferParameteriv 1101
#define OP_glClipPlanex 1102
#define OP_glGenBuffers 1103
#define OP_glGenTextures 1104
#define OP_glGetError 1105
#define OP_glGetFixedv 1106
#define OP_glGetIntegerv 1107
#define OP_glGetLightxv 1108
#define OP_glGetMaterialxv 1109
#define OP_glGetPointerv 1110
#define OP_glGetString 1111
#define OP_glGetTexEnviv 1112
#define OP_glGetTexEnvxv 1113
#define OP_glGetTexParameteriv 1114
#define OP_glGetTexParameterxv 1115
#define OP_glHint 1116
#define OP_glIsBuffer 1117
#define OP_glIsEnabled 1118
#define OP_glIsTexture 1119
#define OP_glLightModelx 1120
#define OP_glLightModelxv 1121
#define OP_glLightx 1122
#define OP_glLightxv 1123
#define OP_glLineWidthx 1124
#define OP_glLoadIdentity 1125
#define OP_glLoadMatrixx 1126
#define OP_glLogicOp 1127
#define OP_glMaterialx 1128
#define OP_glMaterialxv 1129
#define OP_glMatrixMode 1130
#define OP_glMultMatrixx 1131
#define OP_glMultiTexCoord4x 1132
#define OP_glNormal3x 1133
#define OP_glNormalPointer 1134
#define OP_glOrthox 1135
#define OP_glPixelStorei 1136
#define OP_glPointParameterx 1137
#define OP_glPointParameterxv 1138
#define OP_glPointSizex 1139
#define OP_glPolygonOffsetx 1140
#define OP_glPopMatrix 1141
#define OP_glPushMatrix 1142
#define OP_glReadPixels 1143
#define OP_glRotatex 1144
#define OP_glSampleCoverage 1145
#define OP_glSampleCoveragex 1146
#define OP_glScalex 1147
#define OP_glScissor 1148
#define OP_glShadeModel 1149
#define OP_glStencilFunc 1150
#define OP_glStencilMask 1151
#define OP_glStencilOp 1152
#define OP_glTexCoordPointer 1153
#define OP_glTexEnvi 1154
#define OP_glTexEnvx 1155
#define OP_glTexEnviv 1156
#define OP_glTexEnvxv 1157
#define OP_glTexImage2D 1158
#define OP_glTexParameteri 1159
#define OP_glTexParameterx 1160
#define OP_glTexParameteriv 1161
#define OP_glTexParameterxv 1162
#define OP_glTexSubImage2D 1163
#define OP_glTranslatex 1164
#define OP_glVertexPointer 1165
#define OP_glViewport 1166
#define OP_glPointSizePointerOES 1167
#define OP_glVertexPointerOffset 1168
#define OP_glColorPointerOffset 1169
#define OP_glNormalPointerOffset 1170
#define OP_glPointSizePointerOffset 1171
#define OP_glTexCoordPointerOffset 1172
#define OP_glWeightPointerOffset 1173
#define OP_glMatrixIndexPointerOffset 1174
#define OP_glVertexPointerData 1175
#define OP_glColorPointerData 1176
#define OP_glNormalPointerData 1177
#define OP_glTexCoordPointerData 1178
#define OP_glPointSizePointerData 1179
#define OP_glWeightPointerData 1180
#define OP_glMatrixIndexPointerData 1181
#define OP_glDrawElementsOffset 1182
#define OP_glDrawElementsData 1183
#define OP_glGetCompressedTextureFormats 1184
#define OP_glFinishRoundTrip 1185
#define OP_glBlendEquationSeparateOES 1186
#define OP_glBlendFuncSeparateOES 1187
#define OP_glBlendEquationOES 1188
#define OP_glDrawTexsOES 1189
#define OP_glDrawTexiOES 1190
#define OP_glDrawTexxOES 1191
#define OP_glDrawTexsvOES 1192
#define OP_glDrawTexivOES 1193
#define OP_glDrawTexxvOES 1194
#define OP_glDrawTexfOES 1195
#define OP_glDrawTexfvOES 1196
#define OP_glEGLImageTargetTexture2DOES 1197
#define OP_glEGLImageTargetRenderbufferStorageOES 1198
#define OP_glAlphaFuncxOES 1199
#define OP_glClearColorxOES 1200
#define OP_glClearDepthxOES 1201
#define OP_glClipPlanexOES 1202
#define OP_glClipPlanexIMG 1203
#define OP_glColor4xOES 1204
#define OP_glDepthRangexOES 1205
#define OP_glFogxOES 1206
#define OP_glFogxvOES 1207
#define OP_glFrustumxOES 1208
#define OP_glGetClipPlanexOES 1209
#define OP_glGetClipPlanex 1210
#define OP_glGetFixedvOES 1211
#define OP_glGetLightxvOES 1212
#define OP_glGetMaterialxvOES 1213
#define OP_glGetTexEnvxvOES 1214
#define OP_glGetTexParameterxvOES 1215
#define OP_glLightModelxOES 1216
#define OP_glLightModelxvOES 1217
#define OP_glLightxOES 1218
#define OP_glLightxvOES 1219
#define OP_glLineWidthxOES 1220
#define OP_glLoadMatrixxOES 1221
#define OP_glMaterialxOES 1222
#define OP_glMaterialxvOES 1223
#define OP_glMultMatrixxOES 1224
#define OP_glMultiTexCoord4xOES 1225
#define OP_glNormal3xOES 1226
#define OP_glOrthoxOES 1227
#define OP_glPointParameterxOES 1228
#define OP_glPointParameterxvOES 1229
#define OP_glPointSizexOES 1230
#define OP_glPolygonOffsetxOES 1231
#define OP_glRotatexOES 1232
#define OP_glSampleCoveragexOES 1233
#define OP_glScalexOES 1234
#define OP_glTexEnvxOES 1235
#define OP_glTexEnvxvOES 1236
#define OP_glTexParameterxOES 1237
#define OP_glTexParameterxvOES 1238
#define OP_glTranslatexOES 1239
#define OP_glIsRenderbufferOES 1240
#define OP_glBindRenderbufferOES 1241
#define OP_glDeleteRenderbuffersOES 1242
#define OP_glGenRenderbuffersOES 1243
#define OP_glRenderbufferStorageOES 1244
#define OP_glGetRenderbufferParameterivOES 1245
#define OP_glIsFramebufferOES 1246
#define OP_glBindFramebufferOES 1247
#define OP_glDeleteFramebuffersOES 1248
#define OP_glGenFramebuffersOES 1249
#define OP_glCheckFramebufferStatusOES 1250
#define OP_glFramebufferRenderbufferOES 1251
#define OP_glFramebufferTexture2DOES 1252
#define OP_glGetFramebufferAttachmentParameterivOES 1253
#define OP_glGenerateMipmapOES 1254
#define OP_glMapBufferOES 1255
#define OP_glUnmapBufferOES 1256
#define OP_glGetBufferPointervOES 1257
#define OP_glCurrentPaletteMatrixOES 1258
#define OP_glLoadPaletteFromModelViewMatrixOES 1259
#define OP_glMatrixIndexPointerOES 1260
#define OP_glWeightPointerOES 1261
#define OP_glQueryMatrixxOES 1262
#define OP_glDepthRangefOES 1263
#define OP_glFrustumfOES 1264
#define OP_glOrthofOES 1265
#define OP_glClipPlanefOES 1266
#define OP_glClipPlanefIMG 1267
#define OP_glGetClipPlanefOES 1268
#define OP_glClearDepthfOES 1269
#define OP_glTexGenfOES 1270
#define OP_glTexGenfvOES 1271
#define OP_glTexGeniOES 1272
#define OP_glTexGenivOES 1273
#define OP_glTexGenxOES 1274
#define OP_glTexGenxvOES 1275
#define OP_glGetTexGenfvOES 1276
#define OP_glGetTexGenivOES 1277
#define OP_glGetTexGenxvOES 1278
#define OP_glBindVertexArrayOES 1279
#define OP_glDeleteVertexArraysOES 1280
#define OP_glGenVertexArraysOES 1281
#define OP_glIsVertexArrayOES 1282
#define OP_glDiscardFramebufferEXT 1283
#define OP_glMultiDrawArraysEXT 1284
#define OP_glMultiDrawElementsEXT 1285
#define OP_glMultiDrawArraysSUN 1286
#define OP_glMultiDrawElementsSUN 1287
#define OP_glRenderbufferStorageMultisampleIMG 1288
#define OP_glFramebufferTexture2DMultisampleIMG 1289
#define OP_glDeleteFencesNV 1290
#define OP_glGenFencesNV 1291
#define OP_glIsFenceNV 1292
#define OP_glTestFenceNV 1293
#define OP_glGetFenceivNV 1294
#define OP_glFinishFenceNV 1295
#define OP_glSetFenceNV 1296
#define OP_glGetDriverControlsQCOM 1297
#define OP_glGetDriverControlStringQCOM 1298
#define OP_glEnableDriverControlQCOM 1299
#define OP_glDisableDriverControlQCOM 1300
#define OP_glExtGetTexturesQCOM 1301
#define OP_glExtGetBuffersQCOM 1302
#define OP_glExtGetRenderbuffersQCOM 1303
#define OP_glExtGetFramebuffersQCOM 1304
#define OP_glExtGetTexLevelParameterivQCOM 1305
#define OP_glExtTexObjectStateOverrideiQCOM 1306
#define OP_glExtGetTexSubImageQCOM 1307
#define OP_glExtGetBufferPointervQCOM 1308
#define OP_glExtGetShadersQCOM 1309
#define OP_glExtGetProgramsQCOM 1310
#define OP_glExtIsProgramBinaryQCOM 1311
#define OP_glExtGetProgramBinarySourceQCOM 1312
#define OP_glStartTilingQCOM 1313
#define OP_glEndTilingQCOM 1314
#define OP_last 1315
#endif

View file

@ -0,0 +1,20 @@
/*
* 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_TYPES__H
#define __GL_TYPES__H
#include "gl_base_types.h"
#endif

View file

@ -0,0 +1,12 @@
LOCAL_PATH := $(call my-dir)
### GLESv2 implementation ###########################################
$(call emugl-begin-shared-library,libGLESv2_emulation)
$(call emugl-import,libOpenglSystemCommon libGLESv2_enc lib_renderControl_enc)
LOCAL_CFLAGS += -DLOG_TAG=\"GLESv2_emulation\" -DGL_GLEXT_PROTOTYPES
LOCAL_SRC_FILES := gl2.cpp
LOCAL_MODULE_RELATIVE_PATH := egl
$(call emugl-end-module)

View file

@ -0,0 +1,177 @@
/*
* 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 "EGLClientIface.h"
#include "HostConnection.h"
#include "GL2Encoder.h"
#include "GLES/gl.h"
#include "GLES/glext.h"
#include "ErrorLog.h"
#include "gralloc_cb.h"
#include "ThreadInfo.h"
#include "EGLImage.h"
//XXX: fix this macro to get the context from fast tls path
#define GET_CONTEXT GL2Encoder * ctx = getEGLThreadInfo()->hostConn->gl2Encoder();
#include "gl2_entry.cpp"
//The functions table
#include "gl2_ftable.h"
static EGLClient_eglInterface * s_egl = NULL;
static EGLClient_glesInterface * s_gl = NULL;
#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \
HostConnection *hostCon = HostConnection::get(); \
if (!hostCon) { \
ALOGE("egl: Failed to get host connection\n"); \
return ret; \
} \
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
if (!rcEnc) { \
ALOGE("egl: Failed to get renderControl encoder context\n"); \
return ret; \
}
//GL extensions
void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES img)
{
(void)self;
(void)target;
DBG("glEGLImageTargetTexture2DOES v2 target=%#x img=%p\n", target, img);
EGLImage_t *image = (EGLImage_t*)img;
if (image->target == EGL_NATIVE_BUFFER_ANDROID) {
//TODO: check error - we don't have a way to set gl error
android_native_buffer_t* native_buffer = image->native_buffer;
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
return;
}
if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
return;
}
GET_CONTEXT;
DEFINE_AND_VALIDATE_HOST_CONNECTION();
ctx->override2DTextureTarget(target);
rcEnc->rcBindTexture(rcEnc, ((cb_handle_t *)(native_buffer->handle))->hostHandle);
ctx->restore2DTextureTarget();
}
else if (image->target == EGL_GL_TEXTURE_2D_KHR) {
GET_CONTEXT;
ctx->override2DTextureTarget(target);
GLeglImageOES hostImage = reinterpret_cast<GLeglImageOES>((intptr_t)image->host_egl_image);
ctx->m_glEGLImageTargetTexture2DOES_enc(self, target, hostImage);
ctx->restore2DTextureTarget();
}
}
void glEGLImageTargetRenderbufferStorageOES(void *self, GLenum target, GLeglImageOES image)
{
(void)self;
(void)target;
DBG("glEGLImageTargetRenderbufferStorageOES v2 image=%p\n", image);
//TODO: check error - we don't have a way to set gl error
android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
return;
}
if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
return;
}
DEFINE_AND_VALIDATE_HOST_CONNECTION();
rcEnc->rcBindRenderbuffer(rcEnc, ((cb_handle_t *)(native_buffer->handle))->hostHandle);
return;
}
void * getProcAddress(const char * procname)
{
// search in GL function table
for (int i=0; i<gl2_num_funcs; i++) {
if (!strcmp(gl2_funcs_by_name[i].name, procname)) {
return gl2_funcs_by_name[i].proc;
}
}
return NULL;
}
void finish()
{
glFinish();
}
const GLubyte *my_glGetString (void *self, GLenum name)
{
(void)self;
//see ref in https://www.khronos.org/opengles/sdk/docs/man
//name in glGetString can be one of the following five values
switch (name) {
case GL_VERSION:
case GL_VENDOR:
case GL_RENDERER:
case GL_SHADING_LANGUAGE_VERSION:
case GL_EXTENSIONS:
if (s_egl) {
return (const GLubyte*)s_egl->getGLString(name);
}
break;
default:
GET_CONTEXT;
ctx->setError(GL_INVALID_ENUM);
break;
}
return NULL;
}
void init()
{
GET_CONTEXT;
ctx->m_glEGLImageTargetTexture2DOES_enc = ctx->glEGLImageTargetTexture2DOES;
ctx->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES;
ctx->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES;
ctx->glGetString = &my_glGetString;
}
extern "C" {
EGLClient_glesInterface * init_emul_gles(EGLClient_eglInterface *eglIface)
{
s_egl = eglIface;
if (!s_gl) {
s_gl = new EGLClient_glesInterface();
s_gl->getProcAddress = getProcAddress;
s_gl->finish = finish;
s_gl->init = init;
}
return s_gl;
}
} //extern

View file

@ -0,0 +1,20 @@
LOCAL_PATH := $(call my-dir)
### GLESv2_enc Encoder ###########################################
$(call emugl-begin-shared-library,libGLESv2_enc)
LOCAL_SRC_FILES := \
GL2EncoderUtils.cpp \
GL2Encoder.cpp \
gl2_client_context.cpp \
gl2_enc.cpp \
gl2_entry.cpp
LOCAL_CFLAGS += -DLOG_TAG=\"emuglGLESv2_enc\"
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-import,libOpenglCodecCommon)
$(call emugl-end-module)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,251 @@
/*
* 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 _GL2_ENCODER_H_
#define _GL2_ENCODER_H_
#include "gl2_enc.h"
#include "GLClientState.h"
#include "GLSharedGroup.h"
#include "FixedBuffer.h"
class GL2Encoder : public gl2_encoder_context_t {
public:
GL2Encoder(IOStream *stream, ChecksumCalculator* protocol);
virtual ~GL2Encoder();
void setClientState(GLClientState *state) {
m_state = state;
}
void setSharedGroup(GLSharedGroupPtr shared){ m_shared = shared; }
const GLClientState *state() { return m_state; }
const GLSharedGroupPtr shared() { return m_shared; }
void flush() { m_stream->flush(); }
void setInitialized(){ m_initialized = true; };
bool isInitialized(){ return m_initialized; };
virtual void setError(GLenum error){ m_error = error; };
virtual GLenum getError() { return m_error; };
void override2DTextureTarget(GLenum target);
void restore2DTextureTarget();
private:
bool m_initialized;
GLClientState *m_state;
GLSharedGroupPtr m_shared;
GLenum m_error;
GLint *m_compressedTextureFormats;
GLint m_num_compressedTextureFormats;
GLint *getCompressedTextureFormats();
GLint m_max_cubeMapTextureSize;
GLint m_max_renderBufferSize;
GLint m_max_textureSize;
FixedBuffer m_fixedBuffer;
void sendVertexAttributes(GLint first, GLsizei count);
bool updateHostTexture2DBinding(GLenum texUnit, GLenum newTarget);
void checkValidUniformParam(void * self, GLsizei count, GLboolean transpose);
void getHostLocation(void *self, GLint location, GLint *hostLoc);
glGetError_client_proc_t m_glGetError_enc;
static GLenum s_glGetError(void * self);
glFlush_client_proc_t m_glFlush_enc;
static void s_glFlush(void * self);
glPixelStorei_client_proc_t m_glPixelStorei_enc;
static void s_glPixelStorei(void *self, GLenum param, GLint value);
glGetString_client_proc_t m_glGetString_enc;
static const GLubyte * s_glGetString(void *self, GLenum name);
glBindBuffer_client_proc_t m_glBindBuffer_enc;
static void s_glBindBuffer(void *self, GLenum target, GLuint id);
glBufferData_client_proc_t m_glBufferData_enc;
static void s_glBufferData(void *self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage);
glBufferSubData_client_proc_t m_glBufferSubData_enc;
static void s_glBufferSubData(void *self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data);
glDeleteBuffers_client_proc_t m_glDeleteBuffers_enc;
static void s_glDeleteBuffers(void *self, GLsizei n, const GLuint * buffers);
glDrawArrays_client_proc_t m_glDrawArrays_enc;
static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count);
glDrawElements_client_proc_t m_glDrawElements_enc;
static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices);
glGetIntegerv_client_proc_t m_glGetIntegerv_enc;
static void s_glGetIntegerv(void *self, GLenum pname, GLint *ptr);
glGetFloatv_client_proc_t m_glGetFloatv_enc;
static void s_glGetFloatv(void *self, GLenum pname, GLfloat *ptr);
glGetBooleanv_client_proc_t m_glGetBooleanv_enc;
static void s_glGetBooleanv(void *self, GLenum pname, GLboolean *ptr);
glVertexAttribPointer_client_proc_t m_glVertexAttribPointer_enc;
static void s_glVertexAttribPointer(void *self, GLuint indx, GLint size, GLenum type,
GLboolean normalized, GLsizei stride, const GLvoid * ptr);
glEnableVertexAttribArray_client_proc_t m_glEnableVertexAttribArray_enc;
static void s_glEnableVertexAttribArray(void *self, GLuint index);
glDisableVertexAttribArray_client_proc_t m_glDisableVertexAttribArray_enc;
static void s_glDisableVertexAttribArray(void *self, GLuint index);
glGetVertexAttribiv_client_proc_t m_glGetVertexAttribiv_enc;
static void s_glGetVertexAttribiv(void *self, GLuint index, GLenum pname, GLint *params);
glGetVertexAttribfv_client_proc_t m_glGetVertexAttribfv_enc;
static void s_glGetVertexAttribfv(void *self, GLuint index, GLenum pname, GLfloat *params);
glGetVertexAttribPointerv_client_proc_t m_glGetVertexAttribPointerv_enc;
static void s_glGetVertexAttribPointerv(void *self, GLuint index, GLenum pname, GLvoid **pointer);
static void s_glShaderBinary(void *self, GLsizei n, const GLuint *shaders, GLenum binaryformat, const void* binary, GLsizei length);
static void s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLchar * const *string, const GLint *length);
static void s_glFinish(void *self);
glLinkProgram_client_proc_t m_glLinkProgram_enc;
static void s_glLinkProgram(void *self, GLuint program);
glDeleteProgram_client_proc_t m_glDeleteProgram_enc;
static void s_glDeleteProgram(void * self, GLuint program);
glGetUniformiv_client_proc_t m_glGetUniformiv_enc;
static void s_glGetUniformiv(void *self, GLuint program, GLint location , GLint *params);
glGetUniformfv_client_proc_t m_glGetUniformfv_enc;
static void s_glGetUniformfv(void *self, GLuint program, GLint location , GLfloat *params);
glCreateProgram_client_proc_t m_glCreateProgram_enc;
static GLuint s_glCreateProgram(void *self);
glCreateShader_client_proc_t m_glCreateShader_enc;
static GLuint s_glCreateShader(void *self, GLenum shaderType);
glDeleteShader_client_proc_t m_glDeleteShader_enc;
static void s_glDeleteShader(void *self, GLuint shader);
glAttachShader_client_proc_t m_glAttachShader_enc;
static void s_glAttachShader(void *self, GLuint program, GLuint shader);
glDetachShader_client_proc_t m_glDetachShader_enc;
static void s_glDetachShader(void *self, GLuint program, GLuint shader);
glGetAttachedShaders_client_proc_t m_glGetAttachedShaders_enc;
static void s_glGetAttachedShaders(void *self, GLuint program, GLsizei maxCount,
GLsizei* count, GLuint* shaders);
glGetShaderSource_client_proc_t m_glGetShaderSource_enc;
static void s_glGetShaderSource(void *self, GLuint shader, GLsizei bufsize,
GLsizei* length, GLchar* source);
glGetShaderInfoLog_client_proc_t m_glGetShaderInfoLog_enc;
static void s_glGetShaderInfoLog(void *self,GLuint shader,
GLsizei bufsize, GLsizei* length, GLchar* infolog);
glGetProgramInfoLog_client_proc_t m_glGetProgramInfoLog_enc;
static void s_glGetProgramInfoLog(void *self,GLuint program,
GLsizei bufsize, GLsizei* length, GLchar* infolog);
glGetUniformLocation_client_proc_t m_glGetUniformLocation_enc;
static int s_glGetUniformLocation(void *self, GLuint program, const GLchar *name);
glUseProgram_client_proc_t m_glUseProgram_enc;
glUniform1f_client_proc_t m_glUniform1f_enc;
glUniform1fv_client_proc_t m_glUniform1fv_enc;
glUniform1i_client_proc_t m_glUniform1i_enc;
glUniform1iv_client_proc_t m_glUniform1iv_enc;
glUniform2f_client_proc_t m_glUniform2f_enc;
glUniform2fv_client_proc_t m_glUniform2fv_enc;
glUniform2i_client_proc_t m_glUniform2i_enc;
glUniform2iv_client_proc_t m_glUniform2iv_enc;
glUniform3f_client_proc_t m_glUniform3f_enc;
glUniform3fv_client_proc_t m_glUniform3fv_enc;
glUniform3i_client_proc_t m_glUniform3i_enc;
glUniform3iv_client_proc_t m_glUniform3iv_enc;
glUniform4f_client_proc_t m_glUniform4f_enc;
glUniform4fv_client_proc_t m_glUniform4fv_enc;
glUniform4i_client_proc_t m_glUniform4i_enc;
glUniform4iv_client_proc_t m_glUniform4iv_enc;
glUniformMatrix2fv_client_proc_t m_glUniformMatrix2fv_enc;
glUniformMatrix3fv_client_proc_t m_glUniformMatrix3fv_enc;
glUniformMatrix4fv_client_proc_t m_glUniformMatrix4fv_enc;
static void s_glUseProgram(void *self, GLuint program);
static void s_glUniform1f(void *self , GLint location, GLfloat x);
static void s_glUniform1fv(void *self , GLint location, GLsizei count, const GLfloat* v);
static void s_glUniform1i(void *self , GLint location, GLint x);
static void s_glUniform1iv(void *self , GLint location, GLsizei count, const GLint* v);
static void s_glUniform2f(void *self , GLint location, GLfloat x, GLfloat y);
static void s_glUniform2fv(void *self , GLint location, GLsizei count, const GLfloat* v);
static void s_glUniform2i(void *self , GLint location, GLint x, GLint y);
static void s_glUniform2iv(void *self , GLint location, GLsizei count, const GLint* v);
static void s_glUniform3f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z);
static void s_glUniform3fv(void *self , GLint location, GLsizei count, const GLfloat* v);
static void s_glUniform3i(void *self , GLint location, GLint x, GLint y, GLint z);
static void s_glUniform3iv(void *self , GLint location, GLsizei count, const GLint* v);
static void s_glUniform4f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
static void s_glUniform4fv(void *self , GLint location, GLsizei count, const GLfloat* v);
static void s_glUniform4i(void *self , GLint location, GLint x, GLint y, GLint z, GLint w);
static void s_glUniform4iv(void *self , GLint location, GLsizei count, const GLint* v);
static void s_glUniformMatrix2fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
static void s_glUniformMatrix3fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
static void s_glUniformMatrix4fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
glActiveTexture_client_proc_t m_glActiveTexture_enc;
glBindTexture_client_proc_t m_glBindTexture_enc;
glDeleteTextures_client_proc_t m_glDeleteTextures_enc;
glGetTexParameterfv_client_proc_t m_glGetTexParameterfv_enc;
glGetTexParameteriv_client_proc_t m_glGetTexParameteriv_enc;
glTexParameterf_client_proc_t m_glTexParameterf_enc;
glTexParameterfv_client_proc_t m_glTexParameterfv_enc;
glTexParameteri_client_proc_t m_glTexParameteri_enc;
glTexParameteriv_client_proc_t m_glTexParameteriv_enc;
glTexImage2D_client_proc_t m_glTexImage2D_enc;
glTexSubImage2D_client_proc_t m_glTexSubImage2D_enc;
static void s_glActiveTexture(void* self, GLenum texture);
static void s_glBindTexture(void* self, GLenum target, GLuint texture);
static void s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures);
static void s_glGetTexParameterfv(void* self, GLenum target, GLenum pname, GLfloat* params);
static void s_glGetTexParameteriv(void* self, GLenum target, GLenum pname, GLint* params);
static void s_glTexParameterf(void* self, GLenum target, GLenum pname, GLfloat param);
static void s_glTexParameterfv(void* self, GLenum target, GLenum pname, const GLfloat* params);
static void s_glTexParameteri(void* self, GLenum target, GLenum pname, GLint param);
static void s_glTexParameteriv(void* self, GLenum target, GLenum pname, const GLint* params);
static void s_glTexImage2D(void* self, GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type,
const GLvoid* pixels);
static void s_glTexSubImage2D(void* self, GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
const GLvoid* pixels);
public:
glEGLImageTargetTexture2DOES_client_proc_t m_glEGLImageTargetTexture2DOES_enc;
};
#endif

View 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 <stdio.h>
#include <stdlib.h>
#include "GL2Encoder.h"
#include <assert.h>
namespace glesv2_enc {
size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack)
{
GL2Encoder *ctx = (GL2Encoder *)self;
assert (ctx->state() != NULL);
return ctx->state()->pixelDataSize(width, height, format, type, pack);
}
size_t pixelDataSize3D(void *self, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int pack)
{
size_t layerSize = pixelDataSize(self, width, height, format, type, pack);
return layerSize * depth;
}
GLenum uniformType(void * self, GLuint program, GLint location)
{
GL2Encoder * ctx = (GL2Encoder *) self;
assert (ctx->shared() != NULL);
return ctx->shared()->getProgramUniformType(program, location);
}
} // namespace glesv2_enc

View file

@ -0,0 +1,27 @@
/*
* 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 GL2_ENCODER_UTILS_H
#define GL2_ENCODER_UTILS_H
namespace glesv2_enc {
size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack);
size_t pixelDataSize3D(void *self, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int pack);
GLenum uniformType(void * self, GLuint program, GLint location);
} // namespace glesv2_enc
#endif

View file

@ -0,0 +1,223 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#include <string.h>
#include "gl2_client_context.h"
#include <stdio.h>
int gl2_client_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)
{
glActiveTexture = (glActiveTexture_client_proc_t) getProc("glActiveTexture", userData);
glAttachShader = (glAttachShader_client_proc_t) getProc("glAttachShader", userData);
glBindAttribLocation = (glBindAttribLocation_client_proc_t) getProc("glBindAttribLocation", userData);
glBindBuffer = (glBindBuffer_client_proc_t) getProc("glBindBuffer", userData);
glBindFramebuffer = (glBindFramebuffer_client_proc_t) getProc("glBindFramebuffer", userData);
glBindRenderbuffer = (glBindRenderbuffer_client_proc_t) getProc("glBindRenderbuffer", userData);
glBindTexture = (glBindTexture_client_proc_t) getProc("glBindTexture", userData);
glBlendColor = (glBlendColor_client_proc_t) getProc("glBlendColor", userData);
glBlendEquation = (glBlendEquation_client_proc_t) getProc("glBlendEquation", userData);
glBlendEquationSeparate = (glBlendEquationSeparate_client_proc_t) getProc("glBlendEquationSeparate", userData);
glBlendFunc = (glBlendFunc_client_proc_t) getProc("glBlendFunc", userData);
glBlendFuncSeparate = (glBlendFuncSeparate_client_proc_t) getProc("glBlendFuncSeparate", userData);
glBufferData = (glBufferData_client_proc_t) getProc("glBufferData", userData);
glBufferSubData = (glBufferSubData_client_proc_t) getProc("glBufferSubData", userData);
glCheckFramebufferStatus = (glCheckFramebufferStatus_client_proc_t) getProc("glCheckFramebufferStatus", userData);
glClear = (glClear_client_proc_t) getProc("glClear", userData);
glClearColor = (glClearColor_client_proc_t) getProc("glClearColor", userData);
glClearDepthf = (glClearDepthf_client_proc_t) getProc("glClearDepthf", userData);
glClearStencil = (glClearStencil_client_proc_t) getProc("glClearStencil", userData);
glColorMask = (glColorMask_client_proc_t) getProc("glColorMask", userData);
glCompileShader = (glCompileShader_client_proc_t) getProc("glCompileShader", userData);
glCompressedTexImage2D = (glCompressedTexImage2D_client_proc_t) getProc("glCompressedTexImage2D", userData);
glCompressedTexSubImage2D = (glCompressedTexSubImage2D_client_proc_t) getProc("glCompressedTexSubImage2D", userData);
glCopyTexImage2D = (glCopyTexImage2D_client_proc_t) getProc("glCopyTexImage2D", userData);
glCopyTexSubImage2D = (glCopyTexSubImage2D_client_proc_t) getProc("glCopyTexSubImage2D", userData);
glCreateProgram = (glCreateProgram_client_proc_t) getProc("glCreateProgram", userData);
glCreateShader = (glCreateShader_client_proc_t) getProc("glCreateShader", userData);
glCullFace = (glCullFace_client_proc_t) getProc("glCullFace", userData);
glDeleteBuffers = (glDeleteBuffers_client_proc_t) getProc("glDeleteBuffers", userData);
glDeleteFramebuffers = (glDeleteFramebuffers_client_proc_t) getProc("glDeleteFramebuffers", userData);
glDeleteProgram = (glDeleteProgram_client_proc_t) getProc("glDeleteProgram", userData);
glDeleteRenderbuffers = (glDeleteRenderbuffers_client_proc_t) getProc("glDeleteRenderbuffers", userData);
glDeleteShader = (glDeleteShader_client_proc_t) getProc("glDeleteShader", userData);
glDeleteTextures = (glDeleteTextures_client_proc_t) getProc("glDeleteTextures", userData);
glDepthFunc = (glDepthFunc_client_proc_t) getProc("glDepthFunc", userData);
glDepthMask = (glDepthMask_client_proc_t) getProc("glDepthMask", userData);
glDepthRangef = (glDepthRangef_client_proc_t) getProc("glDepthRangef", userData);
glDetachShader = (glDetachShader_client_proc_t) getProc("glDetachShader", userData);
glDisable = (glDisable_client_proc_t) getProc("glDisable", userData);
glDisableVertexAttribArray = (glDisableVertexAttribArray_client_proc_t) getProc("glDisableVertexAttribArray", userData);
glDrawArrays = (glDrawArrays_client_proc_t) getProc("glDrawArrays", userData);
glDrawElements = (glDrawElements_client_proc_t) getProc("glDrawElements", userData);
glEnable = (glEnable_client_proc_t) getProc("glEnable", userData);
glEnableVertexAttribArray = (glEnableVertexAttribArray_client_proc_t) getProc("glEnableVertexAttribArray", userData);
glFinish = (glFinish_client_proc_t) getProc("glFinish", userData);
glFlush = (glFlush_client_proc_t) getProc("glFlush", userData);
glFramebufferRenderbuffer = (glFramebufferRenderbuffer_client_proc_t) getProc("glFramebufferRenderbuffer", userData);
glFramebufferTexture2D = (glFramebufferTexture2D_client_proc_t) getProc("glFramebufferTexture2D", userData);
glFrontFace = (glFrontFace_client_proc_t) getProc("glFrontFace", userData);
glGenBuffers = (glGenBuffers_client_proc_t) getProc("glGenBuffers", userData);
glGenerateMipmap = (glGenerateMipmap_client_proc_t) getProc("glGenerateMipmap", userData);
glGenFramebuffers = (glGenFramebuffers_client_proc_t) getProc("glGenFramebuffers", userData);
glGenRenderbuffers = (glGenRenderbuffers_client_proc_t) getProc("glGenRenderbuffers", userData);
glGenTextures = (glGenTextures_client_proc_t) getProc("glGenTextures", userData);
glGetActiveAttrib = (glGetActiveAttrib_client_proc_t) getProc("glGetActiveAttrib", userData);
glGetActiveUniform = (glGetActiveUniform_client_proc_t) getProc("glGetActiveUniform", userData);
glGetAttachedShaders = (glGetAttachedShaders_client_proc_t) getProc("glGetAttachedShaders", userData);
glGetAttribLocation = (glGetAttribLocation_client_proc_t) getProc("glGetAttribLocation", userData);
glGetBooleanv = (glGetBooleanv_client_proc_t) getProc("glGetBooleanv", userData);
glGetBufferParameteriv = (glGetBufferParameteriv_client_proc_t) getProc("glGetBufferParameteriv", userData);
glGetError = (glGetError_client_proc_t) getProc("glGetError", userData);
glGetFloatv = (glGetFloatv_client_proc_t) getProc("glGetFloatv", userData);
glGetFramebufferAttachmentParameteriv = (glGetFramebufferAttachmentParameteriv_client_proc_t) getProc("glGetFramebufferAttachmentParameteriv", userData);
glGetIntegerv = (glGetIntegerv_client_proc_t) getProc("glGetIntegerv", userData);
glGetProgramiv = (glGetProgramiv_client_proc_t) getProc("glGetProgramiv", userData);
glGetProgramInfoLog = (glGetProgramInfoLog_client_proc_t) getProc("glGetProgramInfoLog", userData);
glGetRenderbufferParameteriv = (glGetRenderbufferParameteriv_client_proc_t) getProc("glGetRenderbufferParameteriv", userData);
glGetShaderiv = (glGetShaderiv_client_proc_t) getProc("glGetShaderiv", userData);
glGetShaderInfoLog = (glGetShaderInfoLog_client_proc_t) getProc("glGetShaderInfoLog", userData);
glGetShaderPrecisionFormat = (glGetShaderPrecisionFormat_client_proc_t) getProc("glGetShaderPrecisionFormat", userData);
glGetShaderSource = (glGetShaderSource_client_proc_t) getProc("glGetShaderSource", userData);
glGetString = (glGetString_client_proc_t) getProc("glGetString", userData);
glGetTexParameterfv = (glGetTexParameterfv_client_proc_t) getProc("glGetTexParameterfv", userData);
glGetTexParameteriv = (glGetTexParameteriv_client_proc_t) getProc("glGetTexParameteriv", userData);
glGetUniformfv = (glGetUniformfv_client_proc_t) getProc("glGetUniformfv", userData);
glGetUniformiv = (glGetUniformiv_client_proc_t) getProc("glGetUniformiv", userData);
glGetUniformLocation = (glGetUniformLocation_client_proc_t) getProc("glGetUniformLocation", userData);
glGetVertexAttribfv = (glGetVertexAttribfv_client_proc_t) getProc("glGetVertexAttribfv", userData);
glGetVertexAttribiv = (glGetVertexAttribiv_client_proc_t) getProc("glGetVertexAttribiv", userData);
glGetVertexAttribPointerv = (glGetVertexAttribPointerv_client_proc_t) getProc("glGetVertexAttribPointerv", userData);
glHint = (glHint_client_proc_t) getProc("glHint", userData);
glIsBuffer = (glIsBuffer_client_proc_t) getProc("glIsBuffer", userData);
glIsEnabled = (glIsEnabled_client_proc_t) getProc("glIsEnabled", userData);
glIsFramebuffer = (glIsFramebuffer_client_proc_t) getProc("glIsFramebuffer", userData);
glIsProgram = (glIsProgram_client_proc_t) getProc("glIsProgram", userData);
glIsRenderbuffer = (glIsRenderbuffer_client_proc_t) getProc("glIsRenderbuffer", userData);
glIsShader = (glIsShader_client_proc_t) getProc("glIsShader", userData);
glIsTexture = (glIsTexture_client_proc_t) getProc("glIsTexture", userData);
glLineWidth = (glLineWidth_client_proc_t) getProc("glLineWidth", userData);
glLinkProgram = (glLinkProgram_client_proc_t) getProc("glLinkProgram", userData);
glPixelStorei = (glPixelStorei_client_proc_t) getProc("glPixelStorei", userData);
glPolygonOffset = (glPolygonOffset_client_proc_t) getProc("glPolygonOffset", userData);
glReadPixels = (glReadPixels_client_proc_t) getProc("glReadPixels", userData);
glReleaseShaderCompiler = (glReleaseShaderCompiler_client_proc_t) getProc("glReleaseShaderCompiler", userData);
glRenderbufferStorage = (glRenderbufferStorage_client_proc_t) getProc("glRenderbufferStorage", userData);
glSampleCoverage = (glSampleCoverage_client_proc_t) getProc("glSampleCoverage", userData);
glScissor = (glScissor_client_proc_t) getProc("glScissor", userData);
glShaderBinary = (glShaderBinary_client_proc_t) getProc("glShaderBinary", userData);
glShaderSource = (glShaderSource_client_proc_t) getProc("glShaderSource", userData);
glStencilFunc = (glStencilFunc_client_proc_t) getProc("glStencilFunc", userData);
glStencilFuncSeparate = (glStencilFuncSeparate_client_proc_t) getProc("glStencilFuncSeparate", userData);
glStencilMask = (glStencilMask_client_proc_t) getProc("glStencilMask", userData);
glStencilMaskSeparate = (glStencilMaskSeparate_client_proc_t) getProc("glStencilMaskSeparate", userData);
glStencilOp = (glStencilOp_client_proc_t) getProc("glStencilOp", userData);
glStencilOpSeparate = (glStencilOpSeparate_client_proc_t) getProc("glStencilOpSeparate", userData);
glTexImage2D = (glTexImage2D_client_proc_t) getProc("glTexImage2D", userData);
glTexParameterf = (glTexParameterf_client_proc_t) getProc("glTexParameterf", userData);
glTexParameterfv = (glTexParameterfv_client_proc_t) getProc("glTexParameterfv", userData);
glTexParameteri = (glTexParameteri_client_proc_t) getProc("glTexParameteri", userData);
glTexParameteriv = (glTexParameteriv_client_proc_t) getProc("glTexParameteriv", userData);
glTexSubImage2D = (glTexSubImage2D_client_proc_t) getProc("glTexSubImage2D", userData);
glUniform1f = (glUniform1f_client_proc_t) getProc("glUniform1f", userData);
glUniform1fv = (glUniform1fv_client_proc_t) getProc("glUniform1fv", userData);
glUniform1i = (glUniform1i_client_proc_t) getProc("glUniform1i", userData);
glUniform1iv = (glUniform1iv_client_proc_t) getProc("glUniform1iv", userData);
glUniform2f = (glUniform2f_client_proc_t) getProc("glUniform2f", userData);
glUniform2fv = (glUniform2fv_client_proc_t) getProc("glUniform2fv", userData);
glUniform2i = (glUniform2i_client_proc_t) getProc("glUniform2i", userData);
glUniform2iv = (glUniform2iv_client_proc_t) getProc("glUniform2iv", userData);
glUniform3f = (glUniform3f_client_proc_t) getProc("glUniform3f", userData);
glUniform3fv = (glUniform3fv_client_proc_t) getProc("glUniform3fv", userData);
glUniform3i = (glUniform3i_client_proc_t) getProc("glUniform3i", userData);
glUniform3iv = (glUniform3iv_client_proc_t) getProc("glUniform3iv", userData);
glUniform4f = (glUniform4f_client_proc_t) getProc("glUniform4f", userData);
glUniform4fv = (glUniform4fv_client_proc_t) getProc("glUniform4fv", userData);
glUniform4i = (glUniform4i_client_proc_t) getProc("glUniform4i", userData);
glUniform4iv = (glUniform4iv_client_proc_t) getProc("glUniform4iv", userData);
glUniformMatrix2fv = (glUniformMatrix2fv_client_proc_t) getProc("glUniformMatrix2fv", userData);
glUniformMatrix3fv = (glUniformMatrix3fv_client_proc_t) getProc("glUniformMatrix3fv", userData);
glUniformMatrix4fv = (glUniformMatrix4fv_client_proc_t) getProc("glUniformMatrix4fv", userData);
glUseProgram = (glUseProgram_client_proc_t) getProc("glUseProgram", userData);
glValidateProgram = (glValidateProgram_client_proc_t) getProc("glValidateProgram", userData);
glVertexAttrib1f = (glVertexAttrib1f_client_proc_t) getProc("glVertexAttrib1f", userData);
glVertexAttrib1fv = (glVertexAttrib1fv_client_proc_t) getProc("glVertexAttrib1fv", userData);
glVertexAttrib2f = (glVertexAttrib2f_client_proc_t) getProc("glVertexAttrib2f", userData);
glVertexAttrib2fv = (glVertexAttrib2fv_client_proc_t) getProc("glVertexAttrib2fv", userData);
glVertexAttrib3f = (glVertexAttrib3f_client_proc_t) getProc("glVertexAttrib3f", userData);
glVertexAttrib3fv = (glVertexAttrib3fv_client_proc_t) getProc("glVertexAttrib3fv", userData);
glVertexAttrib4f = (glVertexAttrib4f_client_proc_t) getProc("glVertexAttrib4f", userData);
glVertexAttrib4fv = (glVertexAttrib4fv_client_proc_t) getProc("glVertexAttrib4fv", userData);
glVertexAttribPointer = (glVertexAttribPointer_client_proc_t) getProc("glVertexAttribPointer", userData);
glViewport = (glViewport_client_proc_t) getProc("glViewport", userData);
glEGLImageTargetTexture2DOES = (glEGLImageTargetTexture2DOES_client_proc_t) getProc("glEGLImageTargetTexture2DOES", userData);
glEGLImageTargetRenderbufferStorageOES = (glEGLImageTargetRenderbufferStorageOES_client_proc_t) getProc("glEGLImageTargetRenderbufferStorageOES", userData);
glGetProgramBinaryOES = (glGetProgramBinaryOES_client_proc_t) getProc("glGetProgramBinaryOES", userData);
glProgramBinaryOES = (glProgramBinaryOES_client_proc_t) getProc("glProgramBinaryOES", userData);
glMapBufferOES = (glMapBufferOES_client_proc_t) getProc("glMapBufferOES", userData);
glUnmapBufferOES = (glUnmapBufferOES_client_proc_t) getProc("glUnmapBufferOES", userData);
glTexImage3DOES = (glTexImage3DOES_client_proc_t) getProc("glTexImage3DOES", userData);
glTexSubImage3DOES = (glTexSubImage3DOES_client_proc_t) getProc("glTexSubImage3DOES", userData);
glCopyTexSubImage3DOES = (glCopyTexSubImage3DOES_client_proc_t) getProc("glCopyTexSubImage3DOES", userData);
glCompressedTexImage3DOES = (glCompressedTexImage3DOES_client_proc_t) getProc("glCompressedTexImage3DOES", userData);
glCompressedTexSubImage3DOES = (glCompressedTexSubImage3DOES_client_proc_t) getProc("glCompressedTexSubImage3DOES", userData);
glFramebufferTexture3DOES = (glFramebufferTexture3DOES_client_proc_t) getProc("glFramebufferTexture3DOES", userData);
glBindVertexArrayOES = (glBindVertexArrayOES_client_proc_t) getProc("glBindVertexArrayOES", userData);
glDeleteVertexArraysOES = (glDeleteVertexArraysOES_client_proc_t) getProc("glDeleteVertexArraysOES", userData);
glGenVertexArraysOES = (glGenVertexArraysOES_client_proc_t) getProc("glGenVertexArraysOES", userData);
glIsVertexArrayOES = (glIsVertexArrayOES_client_proc_t) getProc("glIsVertexArrayOES", userData);
glDiscardFramebufferEXT = (glDiscardFramebufferEXT_client_proc_t) getProc("glDiscardFramebufferEXT", userData);
glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) getProc("glMultiDrawArraysEXT", userData);
glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) getProc("glMultiDrawElementsEXT", userData);
glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMD_client_proc_t) getProc("glGetPerfMonitorGroupsAMD", userData);
glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMD_client_proc_t) getProc("glGetPerfMonitorCountersAMD", userData);
glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMD_client_proc_t) getProc("glGetPerfMonitorGroupStringAMD", userData);
glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMD_client_proc_t) getProc("glGetPerfMonitorCounterStringAMD", userData);
glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMD_client_proc_t) getProc("glGetPerfMonitorCounterInfoAMD", userData);
glGenPerfMonitorsAMD = (glGenPerfMonitorsAMD_client_proc_t) getProc("glGenPerfMonitorsAMD", userData);
glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMD_client_proc_t) getProc("glDeletePerfMonitorsAMD", userData);
glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMD_client_proc_t) getProc("glSelectPerfMonitorCountersAMD", userData);
glBeginPerfMonitorAMD = (glBeginPerfMonitorAMD_client_proc_t) getProc("glBeginPerfMonitorAMD", userData);
glEndPerfMonitorAMD = (glEndPerfMonitorAMD_client_proc_t) getProc("glEndPerfMonitorAMD", userData);
glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMD_client_proc_t) getProc("glGetPerfMonitorCounterDataAMD", userData);
glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) getProc("glRenderbufferStorageMultisampleIMG", userData);
glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) getProc("glFramebufferTexture2DMultisampleIMG", userData);
glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) getProc("glDeleteFencesNV", userData);
glGenFencesNV = (glGenFencesNV_client_proc_t) getProc("glGenFencesNV", userData);
glIsFenceNV = (glIsFenceNV_client_proc_t) getProc("glIsFenceNV", userData);
glTestFenceNV = (glTestFenceNV_client_proc_t) getProc("glTestFenceNV", userData);
glGetFenceivNV = (glGetFenceivNV_client_proc_t) getProc("glGetFenceivNV", userData);
glFinishFenceNV = (glFinishFenceNV_client_proc_t) getProc("glFinishFenceNV", userData);
glSetFenceNV = (glSetFenceNV_client_proc_t) getProc("glSetFenceNV", userData);
glCoverageMaskNV = (glCoverageMaskNV_client_proc_t) getProc("glCoverageMaskNV", userData);
glCoverageOperationNV = (glCoverageOperationNV_client_proc_t) getProc("glCoverageOperationNV", userData);
glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) getProc("glGetDriverControlsQCOM", userData);
glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) getProc("glGetDriverControlStringQCOM", userData);
glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) getProc("glEnableDriverControlQCOM", userData);
glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) getProc("glDisableDriverControlQCOM", userData);
glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) getProc("glExtGetTexturesQCOM", userData);
glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) getProc("glExtGetBuffersQCOM", userData);
glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) getProc("glExtGetRenderbuffersQCOM", userData);
glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) getProc("glExtGetFramebuffersQCOM", userData);
glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) getProc("glExtGetTexLevelParameterivQCOM", userData);
glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) getProc("glExtTexObjectStateOverrideiQCOM", userData);
glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) getProc("glExtGetTexSubImageQCOM", userData);
glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) getProc("glExtGetBufferPointervQCOM", userData);
glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) getProc("glExtGetShadersQCOM", userData);
glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) getProc("glExtGetProgramsQCOM", userData);
glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) getProc("glExtIsProgramBinaryQCOM", userData);
glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) getProc("glExtGetProgramBinarySourceQCOM", userData);
glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) getProc("glStartTilingQCOM", userData);
glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) getProc("glEndTilingQCOM", userData);
glVertexAttribPointerData = (glVertexAttribPointerData_client_proc_t) getProc("glVertexAttribPointerData", userData);
glVertexAttribPointerOffset = (glVertexAttribPointerOffset_client_proc_t) getProc("glVertexAttribPointerOffset", userData);
glDrawElementsOffset = (glDrawElementsOffset_client_proc_t) getProc("glDrawElementsOffset", userData);
glDrawElementsData = (glDrawElementsData_client_proc_t) getProc("glDrawElementsData", userData);
glGetCompressedTextureFormats = (glGetCompressedTextureFormats_client_proc_t) getProc("glGetCompressedTextureFormats", userData);
glShaderString = (glShaderString_client_proc_t) getProc("glShaderString", userData);
glFinishRoundTrip = (glFinishRoundTrip_client_proc_t) getProc("glFinishRoundTrip", userData);
return 0;
}

View file

@ -0,0 +1,230 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __gl2_client_context_t_h
#define __gl2_client_context_t_h
#include "gl2_client_proc.h"
#include "gl2_types.h"
struct gl2_client_context_t {
glActiveTexture_client_proc_t glActiveTexture;
glAttachShader_client_proc_t glAttachShader;
glBindAttribLocation_client_proc_t glBindAttribLocation;
glBindBuffer_client_proc_t glBindBuffer;
glBindFramebuffer_client_proc_t glBindFramebuffer;
glBindRenderbuffer_client_proc_t glBindRenderbuffer;
glBindTexture_client_proc_t glBindTexture;
glBlendColor_client_proc_t glBlendColor;
glBlendEquation_client_proc_t glBlendEquation;
glBlendEquationSeparate_client_proc_t glBlendEquationSeparate;
glBlendFunc_client_proc_t glBlendFunc;
glBlendFuncSeparate_client_proc_t glBlendFuncSeparate;
glBufferData_client_proc_t glBufferData;
glBufferSubData_client_proc_t glBufferSubData;
glCheckFramebufferStatus_client_proc_t glCheckFramebufferStatus;
glClear_client_proc_t glClear;
glClearColor_client_proc_t glClearColor;
glClearDepthf_client_proc_t glClearDepthf;
glClearStencil_client_proc_t glClearStencil;
glColorMask_client_proc_t glColorMask;
glCompileShader_client_proc_t glCompileShader;
glCompressedTexImage2D_client_proc_t glCompressedTexImage2D;
glCompressedTexSubImage2D_client_proc_t glCompressedTexSubImage2D;
glCopyTexImage2D_client_proc_t glCopyTexImage2D;
glCopyTexSubImage2D_client_proc_t glCopyTexSubImage2D;
glCreateProgram_client_proc_t glCreateProgram;
glCreateShader_client_proc_t glCreateShader;
glCullFace_client_proc_t glCullFace;
glDeleteBuffers_client_proc_t glDeleteBuffers;
glDeleteFramebuffers_client_proc_t glDeleteFramebuffers;
glDeleteProgram_client_proc_t glDeleteProgram;
glDeleteRenderbuffers_client_proc_t glDeleteRenderbuffers;
glDeleteShader_client_proc_t glDeleteShader;
glDeleteTextures_client_proc_t glDeleteTextures;
glDepthFunc_client_proc_t glDepthFunc;
glDepthMask_client_proc_t glDepthMask;
glDepthRangef_client_proc_t glDepthRangef;
glDetachShader_client_proc_t glDetachShader;
glDisable_client_proc_t glDisable;
glDisableVertexAttribArray_client_proc_t glDisableVertexAttribArray;
glDrawArrays_client_proc_t glDrawArrays;
glDrawElements_client_proc_t glDrawElements;
glEnable_client_proc_t glEnable;
glEnableVertexAttribArray_client_proc_t glEnableVertexAttribArray;
glFinish_client_proc_t glFinish;
glFlush_client_proc_t glFlush;
glFramebufferRenderbuffer_client_proc_t glFramebufferRenderbuffer;
glFramebufferTexture2D_client_proc_t glFramebufferTexture2D;
glFrontFace_client_proc_t glFrontFace;
glGenBuffers_client_proc_t glGenBuffers;
glGenerateMipmap_client_proc_t glGenerateMipmap;
glGenFramebuffers_client_proc_t glGenFramebuffers;
glGenRenderbuffers_client_proc_t glGenRenderbuffers;
glGenTextures_client_proc_t glGenTextures;
glGetActiveAttrib_client_proc_t glGetActiveAttrib;
glGetActiveUniform_client_proc_t glGetActiveUniform;
glGetAttachedShaders_client_proc_t glGetAttachedShaders;
glGetAttribLocation_client_proc_t glGetAttribLocation;
glGetBooleanv_client_proc_t glGetBooleanv;
glGetBufferParameteriv_client_proc_t glGetBufferParameteriv;
glGetError_client_proc_t glGetError;
glGetFloatv_client_proc_t glGetFloatv;
glGetFramebufferAttachmentParameteriv_client_proc_t glGetFramebufferAttachmentParameteriv;
glGetIntegerv_client_proc_t glGetIntegerv;
glGetProgramiv_client_proc_t glGetProgramiv;
glGetProgramInfoLog_client_proc_t glGetProgramInfoLog;
glGetRenderbufferParameteriv_client_proc_t glGetRenderbufferParameteriv;
glGetShaderiv_client_proc_t glGetShaderiv;
glGetShaderInfoLog_client_proc_t glGetShaderInfoLog;
glGetShaderPrecisionFormat_client_proc_t glGetShaderPrecisionFormat;
glGetShaderSource_client_proc_t glGetShaderSource;
glGetString_client_proc_t glGetString;
glGetTexParameterfv_client_proc_t glGetTexParameterfv;
glGetTexParameteriv_client_proc_t glGetTexParameteriv;
glGetUniformfv_client_proc_t glGetUniformfv;
glGetUniformiv_client_proc_t glGetUniformiv;
glGetUniformLocation_client_proc_t glGetUniformLocation;
glGetVertexAttribfv_client_proc_t glGetVertexAttribfv;
glGetVertexAttribiv_client_proc_t glGetVertexAttribiv;
glGetVertexAttribPointerv_client_proc_t glGetVertexAttribPointerv;
glHint_client_proc_t glHint;
glIsBuffer_client_proc_t glIsBuffer;
glIsEnabled_client_proc_t glIsEnabled;
glIsFramebuffer_client_proc_t glIsFramebuffer;
glIsProgram_client_proc_t glIsProgram;
glIsRenderbuffer_client_proc_t glIsRenderbuffer;
glIsShader_client_proc_t glIsShader;
glIsTexture_client_proc_t glIsTexture;
glLineWidth_client_proc_t glLineWidth;
glLinkProgram_client_proc_t glLinkProgram;
glPixelStorei_client_proc_t glPixelStorei;
glPolygonOffset_client_proc_t glPolygonOffset;
glReadPixels_client_proc_t glReadPixels;
glReleaseShaderCompiler_client_proc_t glReleaseShaderCompiler;
glRenderbufferStorage_client_proc_t glRenderbufferStorage;
glSampleCoverage_client_proc_t glSampleCoverage;
glScissor_client_proc_t glScissor;
glShaderBinary_client_proc_t glShaderBinary;
glShaderSource_client_proc_t glShaderSource;
glStencilFunc_client_proc_t glStencilFunc;
glStencilFuncSeparate_client_proc_t glStencilFuncSeparate;
glStencilMask_client_proc_t glStencilMask;
glStencilMaskSeparate_client_proc_t glStencilMaskSeparate;
glStencilOp_client_proc_t glStencilOp;
glStencilOpSeparate_client_proc_t glStencilOpSeparate;
glTexImage2D_client_proc_t glTexImage2D;
glTexParameterf_client_proc_t glTexParameterf;
glTexParameterfv_client_proc_t glTexParameterfv;
glTexParameteri_client_proc_t glTexParameteri;
glTexParameteriv_client_proc_t glTexParameteriv;
glTexSubImage2D_client_proc_t glTexSubImage2D;
glUniform1f_client_proc_t glUniform1f;
glUniform1fv_client_proc_t glUniform1fv;
glUniform1i_client_proc_t glUniform1i;
glUniform1iv_client_proc_t glUniform1iv;
glUniform2f_client_proc_t glUniform2f;
glUniform2fv_client_proc_t glUniform2fv;
glUniform2i_client_proc_t glUniform2i;
glUniform2iv_client_proc_t glUniform2iv;
glUniform3f_client_proc_t glUniform3f;
glUniform3fv_client_proc_t glUniform3fv;
glUniform3i_client_proc_t glUniform3i;
glUniform3iv_client_proc_t glUniform3iv;
glUniform4f_client_proc_t glUniform4f;
glUniform4fv_client_proc_t glUniform4fv;
glUniform4i_client_proc_t glUniform4i;
glUniform4iv_client_proc_t glUniform4iv;
glUniformMatrix2fv_client_proc_t glUniformMatrix2fv;
glUniformMatrix3fv_client_proc_t glUniformMatrix3fv;
glUniformMatrix4fv_client_proc_t glUniformMatrix4fv;
glUseProgram_client_proc_t glUseProgram;
glValidateProgram_client_proc_t glValidateProgram;
glVertexAttrib1f_client_proc_t glVertexAttrib1f;
glVertexAttrib1fv_client_proc_t glVertexAttrib1fv;
glVertexAttrib2f_client_proc_t glVertexAttrib2f;
glVertexAttrib2fv_client_proc_t glVertexAttrib2fv;
glVertexAttrib3f_client_proc_t glVertexAttrib3f;
glVertexAttrib3fv_client_proc_t glVertexAttrib3fv;
glVertexAttrib4f_client_proc_t glVertexAttrib4f;
glVertexAttrib4fv_client_proc_t glVertexAttrib4fv;
glVertexAttribPointer_client_proc_t glVertexAttribPointer;
glViewport_client_proc_t glViewport;
glEGLImageTargetTexture2DOES_client_proc_t glEGLImageTargetTexture2DOES;
glEGLImageTargetRenderbufferStorageOES_client_proc_t glEGLImageTargetRenderbufferStorageOES;
glGetProgramBinaryOES_client_proc_t glGetProgramBinaryOES;
glProgramBinaryOES_client_proc_t glProgramBinaryOES;
glMapBufferOES_client_proc_t glMapBufferOES;
glUnmapBufferOES_client_proc_t glUnmapBufferOES;
glTexImage3DOES_client_proc_t glTexImage3DOES;
glTexSubImage3DOES_client_proc_t glTexSubImage3DOES;
glCopyTexSubImage3DOES_client_proc_t glCopyTexSubImage3DOES;
glCompressedTexImage3DOES_client_proc_t glCompressedTexImage3DOES;
glCompressedTexSubImage3DOES_client_proc_t glCompressedTexSubImage3DOES;
glFramebufferTexture3DOES_client_proc_t glFramebufferTexture3DOES;
glBindVertexArrayOES_client_proc_t glBindVertexArrayOES;
glDeleteVertexArraysOES_client_proc_t glDeleteVertexArraysOES;
glGenVertexArraysOES_client_proc_t glGenVertexArraysOES;
glIsVertexArrayOES_client_proc_t glIsVertexArrayOES;
glDiscardFramebufferEXT_client_proc_t glDiscardFramebufferEXT;
glMultiDrawArraysEXT_client_proc_t glMultiDrawArraysEXT;
glMultiDrawElementsEXT_client_proc_t glMultiDrawElementsEXT;
glGetPerfMonitorGroupsAMD_client_proc_t glGetPerfMonitorGroupsAMD;
glGetPerfMonitorCountersAMD_client_proc_t glGetPerfMonitorCountersAMD;
glGetPerfMonitorGroupStringAMD_client_proc_t glGetPerfMonitorGroupStringAMD;
glGetPerfMonitorCounterStringAMD_client_proc_t glGetPerfMonitorCounterStringAMD;
glGetPerfMonitorCounterInfoAMD_client_proc_t glGetPerfMonitorCounterInfoAMD;
glGenPerfMonitorsAMD_client_proc_t glGenPerfMonitorsAMD;
glDeletePerfMonitorsAMD_client_proc_t glDeletePerfMonitorsAMD;
glSelectPerfMonitorCountersAMD_client_proc_t glSelectPerfMonitorCountersAMD;
glBeginPerfMonitorAMD_client_proc_t glBeginPerfMonitorAMD;
glEndPerfMonitorAMD_client_proc_t glEndPerfMonitorAMD;
glGetPerfMonitorCounterDataAMD_client_proc_t glGetPerfMonitorCounterDataAMD;
glRenderbufferStorageMultisampleIMG_client_proc_t glRenderbufferStorageMultisampleIMG;
glFramebufferTexture2DMultisampleIMG_client_proc_t glFramebufferTexture2DMultisampleIMG;
glDeleteFencesNV_client_proc_t glDeleteFencesNV;
glGenFencesNV_client_proc_t glGenFencesNV;
glIsFenceNV_client_proc_t glIsFenceNV;
glTestFenceNV_client_proc_t glTestFenceNV;
glGetFenceivNV_client_proc_t glGetFenceivNV;
glFinishFenceNV_client_proc_t glFinishFenceNV;
glSetFenceNV_client_proc_t glSetFenceNV;
glCoverageMaskNV_client_proc_t glCoverageMaskNV;
glCoverageOperationNV_client_proc_t glCoverageOperationNV;
glGetDriverControlsQCOM_client_proc_t glGetDriverControlsQCOM;
glGetDriverControlStringQCOM_client_proc_t glGetDriverControlStringQCOM;
glEnableDriverControlQCOM_client_proc_t glEnableDriverControlQCOM;
glDisableDriverControlQCOM_client_proc_t glDisableDriverControlQCOM;
glExtGetTexturesQCOM_client_proc_t glExtGetTexturesQCOM;
glExtGetBuffersQCOM_client_proc_t glExtGetBuffersQCOM;
glExtGetRenderbuffersQCOM_client_proc_t glExtGetRenderbuffersQCOM;
glExtGetFramebuffersQCOM_client_proc_t glExtGetFramebuffersQCOM;
glExtGetTexLevelParameterivQCOM_client_proc_t glExtGetTexLevelParameterivQCOM;
glExtTexObjectStateOverrideiQCOM_client_proc_t glExtTexObjectStateOverrideiQCOM;
glExtGetTexSubImageQCOM_client_proc_t glExtGetTexSubImageQCOM;
glExtGetBufferPointervQCOM_client_proc_t glExtGetBufferPointervQCOM;
glExtGetShadersQCOM_client_proc_t glExtGetShadersQCOM;
glExtGetProgramsQCOM_client_proc_t glExtGetProgramsQCOM;
glExtIsProgramBinaryQCOM_client_proc_t glExtIsProgramBinaryQCOM;
glExtGetProgramBinarySourceQCOM_client_proc_t glExtGetProgramBinarySourceQCOM;
glStartTilingQCOM_client_proc_t glStartTilingQCOM;
glEndTilingQCOM_client_proc_t glEndTilingQCOM;
glVertexAttribPointerData_client_proc_t glVertexAttribPointerData;
glVertexAttribPointerOffset_client_proc_t glVertexAttribPointerOffset;
glDrawElementsOffset_client_proc_t glDrawElementsOffset;
glDrawElementsData_client_proc_t glDrawElementsData;
glGetCompressedTextureFormats_client_proc_t glGetCompressedTextureFormats;
glShaderString_client_proc_t glShaderString;
glFinishRoundTrip_client_proc_t glFinishRoundTrip;
virtual ~gl2_client_context_t() {}
typedef gl2_client_context_t *CONTEXT_ACCESSOR_TYPE(void);
static void setContextAccessor(CONTEXT_ACCESSOR_TYPE *f);
int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData);
virtual void setError(unsigned int error){ (void)error; };
virtual unsigned int getError(){ return 0; };
};
#endif

View file

@ -0,0 +1,222 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __gl2_client_proc_t_h
#define __gl2_client_proc_t_h
#include "gl2_types.h"
#ifndef gl2_APIENTRY
#define gl2_APIENTRY
#endif
typedef void (gl2_APIENTRY *glActiveTexture_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glAttachShader_client_proc_t) (void * ctx, GLuint, GLuint);
typedef void (gl2_APIENTRY *glBindAttribLocation_client_proc_t) (void * ctx, GLuint, GLuint, const GLchar*);
typedef void (gl2_APIENTRY *glBindBuffer_client_proc_t) (void * ctx, GLenum, GLuint);
typedef void (gl2_APIENTRY *glBindFramebuffer_client_proc_t) (void * ctx, GLenum, GLuint);
typedef void (gl2_APIENTRY *glBindRenderbuffer_client_proc_t) (void * ctx, GLenum, GLuint);
typedef void (gl2_APIENTRY *glBindTexture_client_proc_t) (void * ctx, GLenum, GLuint);
typedef void (gl2_APIENTRY *glBlendColor_client_proc_t) (void * ctx, GLclampf, GLclampf, GLclampf, GLclampf);
typedef void (gl2_APIENTRY *glBlendEquation_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glBlendEquationSeparate_client_proc_t) (void * ctx, GLenum, GLenum);
typedef void (gl2_APIENTRY *glBlendFunc_client_proc_t) (void * ctx, GLenum, GLenum);
typedef void (gl2_APIENTRY *glBlendFuncSeparate_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLenum);
typedef void (gl2_APIENTRY *glBufferData_client_proc_t) (void * ctx, GLenum, GLsizeiptr, const GLvoid*, GLenum);
typedef void (gl2_APIENTRY *glBufferSubData_client_proc_t) (void * ctx, GLenum, GLintptr, GLsizeiptr, const GLvoid*);
typedef GLenum (gl2_APIENTRY *glCheckFramebufferStatus_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glClear_client_proc_t) (void * ctx, GLbitfield);
typedef void (gl2_APIENTRY *glClearColor_client_proc_t) (void * ctx, GLclampf, GLclampf, GLclampf, GLclampf);
typedef void (gl2_APIENTRY *glClearDepthf_client_proc_t) (void * ctx, GLclampf);
typedef void (gl2_APIENTRY *glClearStencil_client_proc_t) (void * ctx, GLint);
typedef void (gl2_APIENTRY *glColorMask_client_proc_t) (void * ctx, GLboolean, GLboolean, GLboolean, GLboolean);
typedef void (gl2_APIENTRY *glCompileShader_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glCompressedTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
typedef void (gl2_APIENTRY *glCompressedTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
typedef void (gl2_APIENTRY *glCopyTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
typedef void (gl2_APIENTRY *glCopyTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
typedef GLuint (gl2_APIENTRY *glCreateProgram_client_proc_t) (void * ctx);
typedef GLuint (gl2_APIENTRY *glCreateShader_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glCullFace_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glDeleteBuffers_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl2_APIENTRY *glDeleteFramebuffers_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl2_APIENTRY *glDeleteProgram_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glDeleteRenderbuffers_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl2_APIENTRY *glDeleteShader_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glDeleteTextures_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl2_APIENTRY *glDepthFunc_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glDepthMask_client_proc_t) (void * ctx, GLboolean);
typedef void (gl2_APIENTRY *glDepthRangef_client_proc_t) (void * ctx, GLclampf, GLclampf);
typedef void (gl2_APIENTRY *glDetachShader_client_proc_t) (void * ctx, GLuint, GLuint);
typedef void (gl2_APIENTRY *glDisable_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glDisableVertexAttribArray_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glDrawArrays_client_proc_t) (void * ctx, GLenum, GLint, GLsizei);
typedef void (gl2_APIENTRY *glDrawElements_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, const GLvoid*);
typedef void (gl2_APIENTRY *glEnable_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glEnableVertexAttribArray_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glFinish_client_proc_t) (void * ctx);
typedef void (gl2_APIENTRY *glFlush_client_proc_t) (void * ctx);
typedef void (gl2_APIENTRY *glFramebufferRenderbuffer_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint);
typedef void (gl2_APIENTRY *glFramebufferTexture2D_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint);
typedef void (gl2_APIENTRY *glFrontFace_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glGenBuffers_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef void (gl2_APIENTRY *glGenerateMipmap_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glGenFramebuffers_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef void (gl2_APIENTRY *glGenRenderbuffers_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef void (gl2_APIENTRY *glGenTextures_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef void (gl2_APIENTRY *glGetActiveAttrib_client_proc_t) (void * ctx, GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
typedef void (gl2_APIENTRY *glGetActiveUniform_client_proc_t) (void * ctx, GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
typedef void (gl2_APIENTRY *glGetAttachedShaders_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLuint*);
typedef int (gl2_APIENTRY *glGetAttribLocation_client_proc_t) (void * ctx, GLuint, const GLchar*);
typedef void (gl2_APIENTRY *glGetBooleanv_client_proc_t) (void * ctx, GLenum, GLboolean*);
typedef void (gl2_APIENTRY *glGetBufferParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
typedef GLenum (gl2_APIENTRY *glGetError_client_proc_t) (void * ctx);
typedef void (gl2_APIENTRY *glGetFloatv_client_proc_t) (void * ctx, GLenum, GLfloat*);
typedef void (gl2_APIENTRY *glGetFramebufferAttachmentParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLint*);
typedef void (gl2_APIENTRY *glGetIntegerv_client_proc_t) (void * ctx, GLenum, GLint*);
typedef void (gl2_APIENTRY *glGetProgramiv_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
typedef void (gl2_APIENTRY *glGetProgramInfoLog_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
typedef void (gl2_APIENTRY *glGetRenderbufferParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
typedef void (gl2_APIENTRY *glGetShaderiv_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
typedef void (gl2_APIENTRY *glGetShaderInfoLog_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
typedef void (gl2_APIENTRY *glGetShaderPrecisionFormat_client_proc_t) (void * ctx, GLenum, GLenum, GLint*, GLint*);
typedef void (gl2_APIENTRY *glGetShaderSource_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
typedef const GLubyte* (gl2_APIENTRY *glGetString_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glGetTexParameterfv_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat*);
typedef void (gl2_APIENTRY *glGetTexParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, GLint*);
typedef void (gl2_APIENTRY *glGetUniformfv_client_proc_t) (void * ctx, GLuint, GLint, GLfloat*);
typedef void (gl2_APIENTRY *glGetUniformiv_client_proc_t) (void * ctx, GLuint, GLint, GLint*);
typedef int (gl2_APIENTRY *glGetUniformLocation_client_proc_t) (void * ctx, GLuint, const GLchar*);
typedef void (gl2_APIENTRY *glGetVertexAttribfv_client_proc_t) (void * ctx, GLuint, GLenum, GLfloat*);
typedef void (gl2_APIENTRY *glGetVertexAttribiv_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
typedef void (gl2_APIENTRY *glGetVertexAttribPointerv_client_proc_t) (void * ctx, GLuint, GLenum, GLvoid**);
typedef void (gl2_APIENTRY *glHint_client_proc_t) (void * ctx, GLenum, GLenum);
typedef GLboolean (gl2_APIENTRY *glIsBuffer_client_proc_t) (void * ctx, GLuint);
typedef GLboolean (gl2_APIENTRY *glIsEnabled_client_proc_t) (void * ctx, GLenum);
typedef GLboolean (gl2_APIENTRY *glIsFramebuffer_client_proc_t) (void * ctx, GLuint);
typedef GLboolean (gl2_APIENTRY *glIsProgram_client_proc_t) (void * ctx, GLuint);
typedef GLboolean (gl2_APIENTRY *glIsRenderbuffer_client_proc_t) (void * ctx, GLuint);
typedef GLboolean (gl2_APIENTRY *glIsShader_client_proc_t) (void * ctx, GLuint);
typedef GLboolean (gl2_APIENTRY *glIsTexture_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glLineWidth_client_proc_t) (void * ctx, GLfloat);
typedef void (gl2_APIENTRY *glLinkProgram_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glPixelStorei_client_proc_t) (void * ctx, GLenum, GLint);
typedef void (gl2_APIENTRY *glPolygonOffset_client_proc_t) (void * ctx, GLfloat, GLfloat);
typedef void (gl2_APIENTRY *glReadPixels_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
typedef void (gl2_APIENTRY *glReleaseShaderCompiler_client_proc_t) (void * ctx);
typedef void (gl2_APIENTRY *glRenderbufferStorage_client_proc_t) (void * ctx, GLenum, GLenum, GLsizei, GLsizei);
typedef void (gl2_APIENTRY *glSampleCoverage_client_proc_t) (void * ctx, GLclampf, GLboolean);
typedef void (gl2_APIENTRY *glScissor_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei);
typedef void (gl2_APIENTRY *glShaderBinary_client_proc_t) (void * ctx, GLsizei, const GLuint*, GLenum, const GLvoid*, GLsizei);
typedef void (gl2_APIENTRY *glShaderSource_client_proc_t) (void * ctx, GLuint, GLsizei, const GLchar* const*, const GLint*);
typedef void (gl2_APIENTRY *glStencilFunc_client_proc_t) (void * ctx, GLenum, GLint, GLuint);
typedef void (gl2_APIENTRY *glStencilFuncSeparate_client_proc_t) (void * ctx, GLenum, GLenum, GLint, GLuint);
typedef void (gl2_APIENTRY *glStencilMask_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glStencilMaskSeparate_client_proc_t) (void * ctx, GLenum, GLuint);
typedef void (gl2_APIENTRY *glStencilOp_client_proc_t) (void * ctx, GLenum, GLenum, GLenum);
typedef void (gl2_APIENTRY *glStencilOpSeparate_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLenum);
typedef void (gl2_APIENTRY *glTexImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
typedef void (gl2_APIENTRY *glTexParameterf_client_proc_t) (void * ctx, GLenum, GLenum, GLfloat);
typedef void (gl2_APIENTRY *glTexParameterfv_client_proc_t) (void * ctx, GLenum, GLenum, const GLfloat*);
typedef void (gl2_APIENTRY *glTexParameteri_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
typedef void (gl2_APIENTRY *glTexParameteriv_client_proc_t) (void * ctx, GLenum, GLenum, const GLint*);
typedef void (gl2_APIENTRY *glTexSubImage2D_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
typedef void (gl2_APIENTRY *glUniform1f_client_proc_t) (void * ctx, GLint, GLfloat);
typedef void (gl2_APIENTRY *glUniform1fv_client_proc_t) (void * ctx, GLint, GLsizei, const GLfloat*);
typedef void (gl2_APIENTRY *glUniform1i_client_proc_t) (void * ctx, GLint, GLint);
typedef void (gl2_APIENTRY *glUniform1iv_client_proc_t) (void * ctx, GLint, GLsizei, const GLint*);
typedef void (gl2_APIENTRY *glUniform2f_client_proc_t) (void * ctx, GLint, GLfloat, GLfloat);
typedef void (gl2_APIENTRY *glUniform2fv_client_proc_t) (void * ctx, GLint, GLsizei, const GLfloat*);
typedef void (gl2_APIENTRY *glUniform2i_client_proc_t) (void * ctx, GLint, GLint, GLint);
typedef void (gl2_APIENTRY *glUniform2iv_client_proc_t) (void * ctx, GLint, GLsizei, const GLint*);
typedef void (gl2_APIENTRY *glUniform3f_client_proc_t) (void * ctx, GLint, GLfloat, GLfloat, GLfloat);
typedef void (gl2_APIENTRY *glUniform3fv_client_proc_t) (void * ctx, GLint, GLsizei, const GLfloat*);
typedef void (gl2_APIENTRY *glUniform3i_client_proc_t) (void * ctx, GLint, GLint, GLint, GLint);
typedef void (gl2_APIENTRY *glUniform3iv_client_proc_t) (void * ctx, GLint, GLsizei, const GLint*);
typedef void (gl2_APIENTRY *glUniform4f_client_proc_t) (void * ctx, GLint, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl2_APIENTRY *glUniform4fv_client_proc_t) (void * ctx, GLint, GLsizei, const GLfloat*);
typedef void (gl2_APIENTRY *glUniform4i_client_proc_t) (void * ctx, GLint, GLint, GLint, GLint, GLint);
typedef void (gl2_APIENTRY *glUniform4iv_client_proc_t) (void * ctx, GLint, GLsizei, const GLint*);
typedef void (gl2_APIENTRY *glUniformMatrix2fv_client_proc_t) (void * ctx, GLint, GLsizei, GLboolean, const GLfloat*);
typedef void (gl2_APIENTRY *glUniformMatrix3fv_client_proc_t) (void * ctx, GLint, GLsizei, GLboolean, const GLfloat*);
typedef void (gl2_APIENTRY *glUniformMatrix4fv_client_proc_t) (void * ctx, GLint, GLsizei, GLboolean, const GLfloat*);
typedef void (gl2_APIENTRY *glUseProgram_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glValidateProgram_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glVertexAttrib1f_client_proc_t) (void * ctx, GLuint, GLfloat);
typedef void (gl2_APIENTRY *glVertexAttrib1fv_client_proc_t) (void * ctx, GLuint, const GLfloat*);
typedef void (gl2_APIENTRY *glVertexAttrib2f_client_proc_t) (void * ctx, GLuint, GLfloat, GLfloat);
typedef void (gl2_APIENTRY *glVertexAttrib2fv_client_proc_t) (void * ctx, GLuint, const GLfloat*);
typedef void (gl2_APIENTRY *glVertexAttrib3f_client_proc_t) (void * ctx, GLuint, GLfloat, GLfloat, GLfloat);
typedef void (gl2_APIENTRY *glVertexAttrib3fv_client_proc_t) (void * ctx, GLuint, const GLfloat*);
typedef void (gl2_APIENTRY *glVertexAttrib4f_client_proc_t) (void * ctx, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
typedef void (gl2_APIENTRY *glVertexAttrib4fv_client_proc_t) (void * ctx, GLuint, const GLfloat*);
typedef void (gl2_APIENTRY *glVertexAttribPointer_client_proc_t) (void * ctx, GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*);
typedef void (gl2_APIENTRY *glViewport_client_proc_t) (void * ctx, GLint, GLint, GLsizei, GLsizei);
typedef void (gl2_APIENTRY *glEGLImageTargetTexture2DOES_client_proc_t) (void * ctx, GLenum, GLeglImageOES);
typedef void (gl2_APIENTRY *glEGLImageTargetRenderbufferStorageOES_client_proc_t) (void * ctx, GLenum, GLeglImageOES);
typedef void (gl2_APIENTRY *glGetProgramBinaryOES_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLenum*, GLvoid*);
typedef void (gl2_APIENTRY *glProgramBinaryOES_client_proc_t) (void * ctx, GLuint, GLenum, const GLvoid*, GLint);
typedef void* (gl2_APIENTRY *glMapBufferOES_client_proc_t) (void * ctx, GLenum, GLenum);
typedef GLboolean (gl2_APIENTRY *glUnmapBufferOES_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glTexImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
typedef void (gl2_APIENTRY *glTexSubImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
typedef void (gl2_APIENTRY *glCopyTexSubImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
typedef void (gl2_APIENTRY *glCompressedTexImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
typedef void (gl2_APIENTRY *glCompressedTexSubImage3DOES_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
typedef void (gl2_APIENTRY *glFramebufferTexture3DOES_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint, GLint);
typedef void (gl2_APIENTRY *glBindVertexArrayOES_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glDeleteVertexArraysOES_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl2_APIENTRY *glGenVertexArraysOES_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef GLboolean (gl2_APIENTRY *glIsVertexArrayOES_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glDiscardFramebufferEXT_client_proc_t) (void * ctx, GLenum, GLsizei, const GLenum*);
typedef void (gl2_APIENTRY *glMultiDrawArraysEXT_client_proc_t) (void * ctx, GLenum, const GLint*, const GLsizei*, GLsizei);
typedef void (gl2_APIENTRY *glMultiDrawElementsEXT_client_proc_t) (void * ctx, GLenum, const GLsizei*, GLenum, const GLvoid* const*, GLsizei);
typedef void (gl2_APIENTRY *glGetPerfMonitorGroupsAMD_client_proc_t) (void * ctx, GLint*, GLsizei, GLuint*);
typedef void (gl2_APIENTRY *glGetPerfMonitorCountersAMD_client_proc_t) (void * ctx, GLuint, GLint*, GLint*, GLsizei, GLuint*);
typedef void (gl2_APIENTRY *glGetPerfMonitorGroupStringAMD_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
typedef void (gl2_APIENTRY *glGetPerfMonitorCounterStringAMD_client_proc_t) (void * ctx, GLuint, GLuint, GLsizei, GLsizei*, GLchar*);
typedef void (gl2_APIENTRY *glGetPerfMonitorCounterInfoAMD_client_proc_t) (void * ctx, GLuint, GLuint, GLenum, GLvoid*);
typedef void (gl2_APIENTRY *glGenPerfMonitorsAMD_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef void (gl2_APIENTRY *glDeletePerfMonitorsAMD_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef void (gl2_APIENTRY *glSelectPerfMonitorCountersAMD_client_proc_t) (void * ctx, GLuint, GLboolean, GLuint, GLint, GLuint*);
typedef void (gl2_APIENTRY *glBeginPerfMonitorAMD_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glEndPerfMonitorAMD_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glGetPerfMonitorCounterDataAMD_client_proc_t) (void * ctx, GLuint, GLenum, GLsizei, GLuint*, GLint*);
typedef void (gl2_APIENTRY *glRenderbufferStorageMultisampleIMG_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, GLsizei, GLsizei);
typedef void (gl2_APIENTRY *glFramebufferTexture2DMultisampleIMG_client_proc_t) (void * ctx, GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
typedef void (gl2_APIENTRY *glDeleteFencesNV_client_proc_t) (void * ctx, GLsizei, const GLuint*);
typedef void (gl2_APIENTRY *glGenFencesNV_client_proc_t) (void * ctx, GLsizei, GLuint*);
typedef GLboolean (gl2_APIENTRY *glIsFenceNV_client_proc_t) (void * ctx, GLuint);
typedef GLboolean (gl2_APIENTRY *glTestFenceNV_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glGetFenceivNV_client_proc_t) (void * ctx, GLuint, GLenum, GLint*);
typedef void (gl2_APIENTRY *glFinishFenceNV_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glSetFenceNV_client_proc_t) (void * ctx, GLuint, GLenum);
typedef void (gl2_APIENTRY *glCoverageMaskNV_client_proc_t) (void * ctx, GLboolean);
typedef void (gl2_APIENTRY *glCoverageOperationNV_client_proc_t) (void * ctx, GLenum);
typedef void (gl2_APIENTRY *glGetDriverControlsQCOM_client_proc_t) (void * ctx, GLint*, GLsizei, GLuint*);
typedef void (gl2_APIENTRY *glGetDriverControlStringQCOM_client_proc_t) (void * ctx, GLuint, GLsizei, GLsizei*, GLchar*);
typedef void (gl2_APIENTRY *glEnableDriverControlQCOM_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glDisableDriverControlQCOM_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glExtGetTexturesQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl2_APIENTRY *glExtGetBuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl2_APIENTRY *glExtGetRenderbuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl2_APIENTRY *glExtGetFramebuffersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl2_APIENTRY *glExtGetTexLevelParameterivQCOM_client_proc_t) (void * ctx, GLuint, GLenum, GLint, GLenum, GLint*);
typedef void (gl2_APIENTRY *glExtTexObjectStateOverrideiQCOM_client_proc_t) (void * ctx, GLenum, GLenum, GLint);
typedef void (gl2_APIENTRY *glExtGetTexSubImageQCOM_client_proc_t) (void * ctx, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
typedef void (gl2_APIENTRY *glExtGetBufferPointervQCOM_client_proc_t) (void * ctx, GLenum, GLvoidptr*);
typedef void (gl2_APIENTRY *glExtGetShadersQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef void (gl2_APIENTRY *glExtGetProgramsQCOM_client_proc_t) (void * ctx, GLuint*, GLint, GLint*);
typedef GLboolean (gl2_APIENTRY *glExtIsProgramBinaryQCOM_client_proc_t) (void * ctx, GLuint);
typedef void (gl2_APIENTRY *glExtGetProgramBinarySourceQCOM_client_proc_t) (void * ctx, GLuint, GLenum, GLchar*, GLint*);
typedef void (gl2_APIENTRY *glStartTilingQCOM_client_proc_t) (void * ctx, GLuint, GLuint, GLuint, GLuint, GLbitfield);
typedef void (gl2_APIENTRY *glEndTilingQCOM_client_proc_t) (void * ctx, GLbitfield);
typedef void (gl2_APIENTRY *glVertexAttribPointerData_client_proc_t) (void * ctx, GLuint, GLint, GLenum, GLboolean, GLsizei, void*, GLuint);
typedef void (gl2_APIENTRY *glVertexAttribPointerOffset_client_proc_t) (void * ctx, GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint);
typedef void (gl2_APIENTRY *glDrawElementsOffset_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, GLuint);
typedef void (gl2_APIENTRY *glDrawElementsData_client_proc_t) (void * ctx, GLenum, GLsizei, GLenum, void*, GLuint);
typedef void (gl2_APIENTRY *glGetCompressedTextureFormats_client_proc_t) (void * ctx, int, GLint*);
typedef void (gl2_APIENTRY *glShaderString_client_proc_t) (void * ctx, GLuint, const GLchar*, GLsizei);
typedef int (gl2_APIENTRY *glFinishRoundTrip_client_proc_t) (void * ctx);
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,24 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef GUARD_gl2_encoder_context_t
#define GUARD_gl2_encoder_context_t
#include "IOStream.h"
#include "ChecksumCalculator.h"
#include "gl2_client_context.h"
#include <string.h>
#include "glUtils.h"
#include "GL2EncoderUtils.h"
struct gl2_encoder_context_t : public gl2_client_context_t {
IOStream *m_stream;
ChecksumCalculator *m_checksumCalculator;
gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator);
};
#endif // GUARD_gl2_encoder_context_t

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,216 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __gl2_client_ftable_t_h
#define __gl2_client_ftable_t_h
static const struct _gl2_funcs_by_name {
const char *name;
void *proc;
} gl2_funcs_by_name[] = {
{"glActiveTexture", (void*)glActiveTexture},
{"glAttachShader", (void*)glAttachShader},
{"glBindAttribLocation", (void*)glBindAttribLocation},
{"glBindBuffer", (void*)glBindBuffer},
{"glBindFramebuffer", (void*)glBindFramebuffer},
{"glBindRenderbuffer", (void*)glBindRenderbuffer},
{"glBindTexture", (void*)glBindTexture},
{"glBlendColor", (void*)glBlendColor},
{"glBlendEquation", (void*)glBlendEquation},
{"glBlendEquationSeparate", (void*)glBlendEquationSeparate},
{"glBlendFunc", (void*)glBlendFunc},
{"glBlendFuncSeparate", (void*)glBlendFuncSeparate},
{"glBufferData", (void*)glBufferData},
{"glBufferSubData", (void*)glBufferSubData},
{"glCheckFramebufferStatus", (void*)glCheckFramebufferStatus},
{"glClear", (void*)glClear},
{"glClearColor", (void*)glClearColor},
{"glClearDepthf", (void*)glClearDepthf},
{"glClearStencil", (void*)glClearStencil},
{"glColorMask", (void*)glColorMask},
{"glCompileShader", (void*)glCompileShader},
{"glCompressedTexImage2D", (void*)glCompressedTexImage2D},
{"glCompressedTexSubImage2D", (void*)glCompressedTexSubImage2D},
{"glCopyTexImage2D", (void*)glCopyTexImage2D},
{"glCopyTexSubImage2D", (void*)glCopyTexSubImage2D},
{"glCreateProgram", (void*)glCreateProgram},
{"glCreateShader", (void*)glCreateShader},
{"glCullFace", (void*)glCullFace},
{"glDeleteBuffers", (void*)glDeleteBuffers},
{"glDeleteFramebuffers", (void*)glDeleteFramebuffers},
{"glDeleteProgram", (void*)glDeleteProgram},
{"glDeleteRenderbuffers", (void*)glDeleteRenderbuffers},
{"glDeleteShader", (void*)glDeleteShader},
{"glDeleteTextures", (void*)glDeleteTextures},
{"glDepthFunc", (void*)glDepthFunc},
{"glDepthMask", (void*)glDepthMask},
{"glDepthRangef", (void*)glDepthRangef},
{"glDetachShader", (void*)glDetachShader},
{"glDisable", (void*)glDisable},
{"glDisableVertexAttribArray", (void*)glDisableVertexAttribArray},
{"glDrawArrays", (void*)glDrawArrays},
{"glDrawElements", (void*)glDrawElements},
{"glEnable", (void*)glEnable},
{"glEnableVertexAttribArray", (void*)glEnableVertexAttribArray},
{"glFinish", (void*)glFinish},
{"glFlush", (void*)glFlush},
{"glFramebufferRenderbuffer", (void*)glFramebufferRenderbuffer},
{"glFramebufferTexture2D", (void*)glFramebufferTexture2D},
{"glFrontFace", (void*)glFrontFace},
{"glGenBuffers", (void*)glGenBuffers},
{"glGenerateMipmap", (void*)glGenerateMipmap},
{"glGenFramebuffers", (void*)glGenFramebuffers},
{"glGenRenderbuffers", (void*)glGenRenderbuffers},
{"glGenTextures", (void*)glGenTextures},
{"glGetActiveAttrib", (void*)glGetActiveAttrib},
{"glGetActiveUniform", (void*)glGetActiveUniform},
{"glGetAttachedShaders", (void*)glGetAttachedShaders},
{"glGetAttribLocation", (void*)glGetAttribLocation},
{"glGetBooleanv", (void*)glGetBooleanv},
{"glGetBufferParameteriv", (void*)glGetBufferParameteriv},
{"glGetError", (void*)glGetError},
{"glGetFloatv", (void*)glGetFloatv},
{"glGetFramebufferAttachmentParameteriv", (void*)glGetFramebufferAttachmentParameteriv},
{"glGetIntegerv", (void*)glGetIntegerv},
{"glGetProgramiv", (void*)glGetProgramiv},
{"glGetProgramInfoLog", (void*)glGetProgramInfoLog},
{"glGetRenderbufferParameteriv", (void*)glGetRenderbufferParameteriv},
{"glGetShaderiv", (void*)glGetShaderiv},
{"glGetShaderInfoLog", (void*)glGetShaderInfoLog},
{"glGetShaderPrecisionFormat", (void*)glGetShaderPrecisionFormat},
{"glGetShaderSource", (void*)glGetShaderSource},
{"glGetString", (void*)glGetString},
{"glGetTexParameterfv", (void*)glGetTexParameterfv},
{"glGetTexParameteriv", (void*)glGetTexParameteriv},
{"glGetUniformfv", (void*)glGetUniformfv},
{"glGetUniformiv", (void*)glGetUniformiv},
{"glGetUniformLocation", (void*)glGetUniformLocation},
{"glGetVertexAttribfv", (void*)glGetVertexAttribfv},
{"glGetVertexAttribiv", (void*)glGetVertexAttribiv},
{"glGetVertexAttribPointerv", (void*)glGetVertexAttribPointerv},
{"glHint", (void*)glHint},
{"glIsBuffer", (void*)glIsBuffer},
{"glIsEnabled", (void*)glIsEnabled},
{"glIsFramebuffer", (void*)glIsFramebuffer},
{"glIsProgram", (void*)glIsProgram},
{"glIsRenderbuffer", (void*)glIsRenderbuffer},
{"glIsShader", (void*)glIsShader},
{"glIsTexture", (void*)glIsTexture},
{"glLineWidth", (void*)glLineWidth},
{"glLinkProgram", (void*)glLinkProgram},
{"glPixelStorei", (void*)glPixelStorei},
{"glPolygonOffset", (void*)glPolygonOffset},
{"glReadPixels", (void*)glReadPixels},
{"glReleaseShaderCompiler", (void*)glReleaseShaderCompiler},
{"glRenderbufferStorage", (void*)glRenderbufferStorage},
{"glSampleCoverage", (void*)glSampleCoverage},
{"glScissor", (void*)glScissor},
{"glShaderBinary", (void*)glShaderBinary},
{"glShaderSource", (void*)glShaderSource},
{"glStencilFunc", (void*)glStencilFunc},
{"glStencilFuncSeparate", (void*)glStencilFuncSeparate},
{"glStencilMask", (void*)glStencilMask},
{"glStencilMaskSeparate", (void*)glStencilMaskSeparate},
{"glStencilOp", (void*)glStencilOp},
{"glStencilOpSeparate", (void*)glStencilOpSeparate},
{"glTexImage2D", (void*)glTexImage2D},
{"glTexParameterf", (void*)glTexParameterf},
{"glTexParameterfv", (void*)glTexParameterfv},
{"glTexParameteri", (void*)glTexParameteri},
{"glTexParameteriv", (void*)glTexParameteriv},
{"glTexSubImage2D", (void*)glTexSubImage2D},
{"glUniform1f", (void*)glUniform1f},
{"glUniform1fv", (void*)glUniform1fv},
{"glUniform1i", (void*)glUniform1i},
{"glUniform1iv", (void*)glUniform1iv},
{"glUniform2f", (void*)glUniform2f},
{"glUniform2fv", (void*)glUniform2fv},
{"glUniform2i", (void*)glUniform2i},
{"glUniform2iv", (void*)glUniform2iv},
{"glUniform3f", (void*)glUniform3f},
{"glUniform3fv", (void*)glUniform3fv},
{"glUniform3i", (void*)glUniform3i},
{"glUniform3iv", (void*)glUniform3iv},
{"glUniform4f", (void*)glUniform4f},
{"glUniform4fv", (void*)glUniform4fv},
{"glUniform4i", (void*)glUniform4i},
{"glUniform4iv", (void*)glUniform4iv},
{"glUniformMatrix2fv", (void*)glUniformMatrix2fv},
{"glUniformMatrix3fv", (void*)glUniformMatrix3fv},
{"glUniformMatrix4fv", (void*)glUniformMatrix4fv},
{"glUseProgram", (void*)glUseProgram},
{"glValidateProgram", (void*)glValidateProgram},
{"glVertexAttrib1f", (void*)glVertexAttrib1f},
{"glVertexAttrib1fv", (void*)glVertexAttrib1fv},
{"glVertexAttrib2f", (void*)glVertexAttrib2f},
{"glVertexAttrib2fv", (void*)glVertexAttrib2fv},
{"glVertexAttrib3f", (void*)glVertexAttrib3f},
{"glVertexAttrib3fv", (void*)glVertexAttrib3fv},
{"glVertexAttrib4f", (void*)glVertexAttrib4f},
{"glVertexAttrib4fv", (void*)glVertexAttrib4fv},
{"glVertexAttribPointer", (void*)glVertexAttribPointer},
{"glViewport", (void*)glViewport},
{"glEGLImageTargetTexture2DOES", (void*)glEGLImageTargetTexture2DOES},
{"glEGLImageTargetRenderbufferStorageOES", (void*)glEGLImageTargetRenderbufferStorageOES},
{"glGetProgramBinaryOES", (void*)glGetProgramBinaryOES},
{"glProgramBinaryOES", (void*)glProgramBinaryOES},
{"glMapBufferOES", (void*)glMapBufferOES},
{"glUnmapBufferOES", (void*)glUnmapBufferOES},
{"glTexImage3DOES", (void*)glTexImage3DOES},
{"glTexSubImage3DOES", (void*)glTexSubImage3DOES},
{"glCopyTexSubImage3DOES", (void*)glCopyTexSubImage3DOES},
{"glCompressedTexImage3DOES", (void*)glCompressedTexImage3DOES},
{"glCompressedTexSubImage3DOES", (void*)glCompressedTexSubImage3DOES},
{"glFramebufferTexture3DOES", (void*)glFramebufferTexture3DOES},
{"glBindVertexArrayOES", (void*)glBindVertexArrayOES},
{"glDeleteVertexArraysOES", (void*)glDeleteVertexArraysOES},
{"glGenVertexArraysOES", (void*)glGenVertexArraysOES},
{"glIsVertexArrayOES", (void*)glIsVertexArrayOES},
{"glDiscardFramebufferEXT", (void*)glDiscardFramebufferEXT},
{"glMultiDrawArraysEXT", (void*)glMultiDrawArraysEXT},
{"glMultiDrawElementsEXT", (void*)glMultiDrawElementsEXT},
{"glGetPerfMonitorGroupsAMD", (void*)glGetPerfMonitorGroupsAMD},
{"glGetPerfMonitorCountersAMD", (void*)glGetPerfMonitorCountersAMD},
{"glGetPerfMonitorGroupStringAMD", (void*)glGetPerfMonitorGroupStringAMD},
{"glGetPerfMonitorCounterStringAMD", (void*)glGetPerfMonitorCounterStringAMD},
{"glGetPerfMonitorCounterInfoAMD", (void*)glGetPerfMonitorCounterInfoAMD},
{"glGenPerfMonitorsAMD", (void*)glGenPerfMonitorsAMD},
{"glDeletePerfMonitorsAMD", (void*)glDeletePerfMonitorsAMD},
{"glSelectPerfMonitorCountersAMD", (void*)glSelectPerfMonitorCountersAMD},
{"glBeginPerfMonitorAMD", (void*)glBeginPerfMonitorAMD},
{"glEndPerfMonitorAMD", (void*)glEndPerfMonitorAMD},
{"glGetPerfMonitorCounterDataAMD", (void*)glGetPerfMonitorCounterDataAMD},
{"glRenderbufferStorageMultisampleIMG", (void*)glRenderbufferStorageMultisampleIMG},
{"glFramebufferTexture2DMultisampleIMG", (void*)glFramebufferTexture2DMultisampleIMG},
{"glDeleteFencesNV", (void*)glDeleteFencesNV},
{"glGenFencesNV", (void*)glGenFencesNV},
{"glIsFenceNV", (void*)glIsFenceNV},
{"glTestFenceNV", (void*)glTestFenceNV},
{"glGetFenceivNV", (void*)glGetFenceivNV},
{"glFinishFenceNV", (void*)glFinishFenceNV},
{"glSetFenceNV", (void*)glSetFenceNV},
{"glCoverageMaskNV", (void*)glCoverageMaskNV},
{"glCoverageOperationNV", (void*)glCoverageOperationNV},
{"glGetDriverControlsQCOM", (void*)glGetDriverControlsQCOM},
{"glGetDriverControlStringQCOM", (void*)glGetDriverControlStringQCOM},
{"glEnableDriverControlQCOM", (void*)glEnableDriverControlQCOM},
{"glDisableDriverControlQCOM", (void*)glDisableDriverControlQCOM},
{"glExtGetTexturesQCOM", (void*)glExtGetTexturesQCOM},
{"glExtGetBuffersQCOM", (void*)glExtGetBuffersQCOM},
{"glExtGetRenderbuffersQCOM", (void*)glExtGetRenderbuffersQCOM},
{"glExtGetFramebuffersQCOM", (void*)glExtGetFramebuffersQCOM},
{"glExtGetTexLevelParameterivQCOM", (void*)glExtGetTexLevelParameterivQCOM},
{"glExtTexObjectStateOverrideiQCOM", (void*)glExtTexObjectStateOverrideiQCOM},
{"glExtGetTexSubImageQCOM", (void*)glExtGetTexSubImageQCOM},
{"glExtGetBufferPointervQCOM", (void*)glExtGetBufferPointervQCOM},
{"glExtGetShadersQCOM", (void*)glExtGetShadersQCOM},
{"glExtGetProgramsQCOM", (void*)glExtGetProgramsQCOM},
{"glExtIsProgramBinaryQCOM", (void*)glExtIsProgramBinaryQCOM},
{"glExtGetProgramBinarySourceQCOM", (void*)glExtGetProgramBinarySourceQCOM},
{"glStartTilingQCOM", (void*)glStartTilingQCOM},
{"glEndTilingQCOM", (void*)glEndTilingQCOM},
};
static const int gl2_num_funcs = sizeof(gl2_funcs_by_name) / sizeof(struct _gl2_funcs_by_name);
#endif

View file

@ -0,0 +1,217 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __GUARD_gl2_opcodes_h_
#define __GUARD_gl2_opcodes_h_
#define OP_glActiveTexture 2048
#define OP_glAttachShader 2049
#define OP_glBindAttribLocation 2050
#define OP_glBindBuffer 2051
#define OP_glBindFramebuffer 2052
#define OP_glBindRenderbuffer 2053
#define OP_glBindTexture 2054
#define OP_glBlendColor 2055
#define OP_glBlendEquation 2056
#define OP_glBlendEquationSeparate 2057
#define OP_glBlendFunc 2058
#define OP_glBlendFuncSeparate 2059
#define OP_glBufferData 2060
#define OP_glBufferSubData 2061
#define OP_glCheckFramebufferStatus 2062
#define OP_glClear 2063
#define OP_glClearColor 2064
#define OP_glClearDepthf 2065
#define OP_glClearStencil 2066
#define OP_glColorMask 2067
#define OP_glCompileShader 2068
#define OP_glCompressedTexImage2D 2069
#define OP_glCompressedTexSubImage2D 2070
#define OP_glCopyTexImage2D 2071
#define OP_glCopyTexSubImage2D 2072
#define OP_glCreateProgram 2073
#define OP_glCreateShader 2074
#define OP_glCullFace 2075
#define OP_glDeleteBuffers 2076
#define OP_glDeleteFramebuffers 2077
#define OP_glDeleteProgram 2078
#define OP_glDeleteRenderbuffers 2079
#define OP_glDeleteShader 2080
#define OP_glDeleteTextures 2081
#define OP_glDepthFunc 2082
#define OP_glDepthMask 2083
#define OP_glDepthRangef 2084
#define OP_glDetachShader 2085
#define OP_glDisable 2086
#define OP_glDisableVertexAttribArray 2087
#define OP_glDrawArrays 2088
#define OP_glDrawElements 2089
#define OP_glEnable 2090
#define OP_glEnableVertexAttribArray 2091
#define OP_glFinish 2092
#define OP_glFlush 2093
#define OP_glFramebufferRenderbuffer 2094
#define OP_glFramebufferTexture2D 2095
#define OP_glFrontFace 2096
#define OP_glGenBuffers 2097
#define OP_glGenerateMipmap 2098
#define OP_glGenFramebuffers 2099
#define OP_glGenRenderbuffers 2100
#define OP_glGenTextures 2101
#define OP_glGetActiveAttrib 2102
#define OP_glGetActiveUniform 2103
#define OP_glGetAttachedShaders 2104
#define OP_glGetAttribLocation 2105
#define OP_glGetBooleanv 2106
#define OP_glGetBufferParameteriv 2107
#define OP_glGetError 2108
#define OP_glGetFloatv 2109
#define OP_glGetFramebufferAttachmentParameteriv 2110
#define OP_glGetIntegerv 2111
#define OP_glGetProgramiv 2112
#define OP_glGetProgramInfoLog 2113
#define OP_glGetRenderbufferParameteriv 2114
#define OP_glGetShaderiv 2115
#define OP_glGetShaderInfoLog 2116
#define OP_glGetShaderPrecisionFormat 2117
#define OP_glGetShaderSource 2118
#define OP_glGetString 2119
#define OP_glGetTexParameterfv 2120
#define OP_glGetTexParameteriv 2121
#define OP_glGetUniformfv 2122
#define OP_glGetUniformiv 2123
#define OP_glGetUniformLocation 2124
#define OP_glGetVertexAttribfv 2125
#define OP_glGetVertexAttribiv 2126
#define OP_glGetVertexAttribPointerv 2127
#define OP_glHint 2128
#define OP_glIsBuffer 2129
#define OP_glIsEnabled 2130
#define OP_glIsFramebuffer 2131
#define OP_glIsProgram 2132
#define OP_glIsRenderbuffer 2133
#define OP_glIsShader 2134
#define OP_glIsTexture 2135
#define OP_glLineWidth 2136
#define OP_glLinkProgram 2137
#define OP_glPixelStorei 2138
#define OP_glPolygonOffset 2139
#define OP_glReadPixels 2140
#define OP_glReleaseShaderCompiler 2141
#define OP_glRenderbufferStorage 2142
#define OP_glSampleCoverage 2143
#define OP_glScissor 2144
#define OP_glShaderBinary 2145
#define OP_glShaderSource 2146
#define OP_glStencilFunc 2147
#define OP_glStencilFuncSeparate 2148
#define OP_glStencilMask 2149
#define OP_glStencilMaskSeparate 2150
#define OP_glStencilOp 2151
#define OP_glStencilOpSeparate 2152
#define OP_glTexImage2D 2153
#define OP_glTexParameterf 2154
#define OP_glTexParameterfv 2155
#define OP_glTexParameteri 2156
#define OP_glTexParameteriv 2157
#define OP_glTexSubImage2D 2158
#define OP_glUniform1f 2159
#define OP_glUniform1fv 2160
#define OP_glUniform1i 2161
#define OP_glUniform1iv 2162
#define OP_glUniform2f 2163
#define OP_glUniform2fv 2164
#define OP_glUniform2i 2165
#define OP_glUniform2iv 2166
#define OP_glUniform3f 2167
#define OP_glUniform3fv 2168
#define OP_glUniform3i 2169
#define OP_glUniform3iv 2170
#define OP_glUniform4f 2171
#define OP_glUniform4fv 2172
#define OP_glUniform4i 2173
#define OP_glUniform4iv 2174
#define OP_glUniformMatrix2fv 2175
#define OP_glUniformMatrix3fv 2176
#define OP_glUniformMatrix4fv 2177
#define OP_glUseProgram 2178
#define OP_glValidateProgram 2179
#define OP_glVertexAttrib1f 2180
#define OP_glVertexAttrib1fv 2181
#define OP_glVertexAttrib2f 2182
#define OP_glVertexAttrib2fv 2183
#define OP_glVertexAttrib3f 2184
#define OP_glVertexAttrib3fv 2185
#define OP_glVertexAttrib4f 2186
#define OP_glVertexAttrib4fv 2187
#define OP_glVertexAttribPointer 2188
#define OP_glViewport 2189
#define OP_glEGLImageTargetTexture2DOES 2190
#define OP_glEGLImageTargetRenderbufferStorageOES 2191
#define OP_glGetProgramBinaryOES 2192
#define OP_glProgramBinaryOES 2193
#define OP_glMapBufferOES 2194
#define OP_glUnmapBufferOES 2195
#define OP_glTexImage3DOES 2196
#define OP_glTexSubImage3DOES 2197
#define OP_glCopyTexSubImage3DOES 2198
#define OP_glCompressedTexImage3DOES 2199
#define OP_glCompressedTexSubImage3DOES 2200
#define OP_glFramebufferTexture3DOES 2201
#define OP_glBindVertexArrayOES 2202
#define OP_glDeleteVertexArraysOES 2203
#define OP_glGenVertexArraysOES 2204
#define OP_glIsVertexArrayOES 2205
#define OP_glDiscardFramebufferEXT 2206
#define OP_glMultiDrawArraysEXT 2207
#define OP_glMultiDrawElementsEXT 2208
#define OP_glGetPerfMonitorGroupsAMD 2209
#define OP_glGetPerfMonitorCountersAMD 2210
#define OP_glGetPerfMonitorGroupStringAMD 2211
#define OP_glGetPerfMonitorCounterStringAMD 2212
#define OP_glGetPerfMonitorCounterInfoAMD 2213
#define OP_glGenPerfMonitorsAMD 2214
#define OP_glDeletePerfMonitorsAMD 2215
#define OP_glSelectPerfMonitorCountersAMD 2216
#define OP_glBeginPerfMonitorAMD 2217
#define OP_glEndPerfMonitorAMD 2218
#define OP_glGetPerfMonitorCounterDataAMD 2219
#define OP_glRenderbufferStorageMultisampleIMG 2220
#define OP_glFramebufferTexture2DMultisampleIMG 2221
#define OP_glDeleteFencesNV 2222
#define OP_glGenFencesNV 2223
#define OP_glIsFenceNV 2224
#define OP_glTestFenceNV 2225
#define OP_glGetFenceivNV 2226
#define OP_glFinishFenceNV 2227
#define OP_glSetFenceNV 2228
#define OP_glCoverageMaskNV 2229
#define OP_glCoverageOperationNV 2230
#define OP_glGetDriverControlsQCOM 2231
#define OP_glGetDriverControlStringQCOM 2232
#define OP_glEnableDriverControlQCOM 2233
#define OP_glDisableDriverControlQCOM 2234
#define OP_glExtGetTexturesQCOM 2235
#define OP_glExtGetBuffersQCOM 2236
#define OP_glExtGetRenderbuffersQCOM 2237
#define OP_glExtGetFramebuffersQCOM 2238
#define OP_glExtGetTexLevelParameterivQCOM 2239
#define OP_glExtTexObjectStateOverrideiQCOM 2240
#define OP_glExtGetTexSubImageQCOM 2241
#define OP_glExtGetBufferPointervQCOM 2242
#define OP_glExtGetShadersQCOM 2243
#define OP_glExtGetProgramsQCOM 2244
#define OP_glExtIsProgramBinaryQCOM 2245
#define OP_glExtGetProgramBinarySourceQCOM 2246
#define OP_glStartTilingQCOM 2247
#define OP_glEndTilingQCOM 2248
#define OP_glVertexAttribPointerData 2249
#define OP_glVertexAttribPointerOffset 2250
#define OP_glDrawElementsOffset 2251
#define OP_glDrawElementsData 2252
#define OP_glGetCompressedTextureFormats 2253
#define OP_glShaderString 2254
#define OP_glFinishRoundTrip 2255
#define OP_last 2256
#endif

View 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

View file

@ -0,0 +1,13 @@
LOCAL_PATH := $(call my-dir)
$(call emugl-begin-shared-library,libOpenglSystemCommon)
$(call emugl-import,libGLESv1_enc libGLESv2_enc lib_renderControl_enc)
LOCAL_SRC_FILES := \
HostConnection.cpp \
QemuPipeStream.cpp \
ThreadInfo.cpp
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH) bionic/libc/private)
$(call emugl-end-module)

View file

@ -0,0 +1,41 @@
/*
* 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 _SYSTEM_COMMON_EGL_CLIENT_IFACE_H
#define _SYSTEM_COMMON_EGL_CLIENT_IFACE_H
struct EGLThreadInfo; // defined in ThreadInfo.h
typedef struct {
EGLThreadInfo* (*getThreadInfo)();
const char* (*getGLString)(int glEnum);
} EGLClient_eglInterface;
typedef struct {
void* (*getProcAddress)(const char *funcName);
void (*init)();
void (*finish)();
} EGLClient_glesInterface;
//
// Any GLES/GLES2 client API library should define a function named "init_emul_gles"
// with the following prototype,
// It will be called by EGL after loading the GLES library for initialization
// and exchanging interface function pointers.
//
typedef EGLClient_glesInterface *(*init_emul_gles_t)(EGLClient_eglInterface *eglIface);
#endif

View file

@ -0,0 +1,36 @@
/*
* 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 __COMMON_EGL_IMAGE_H
#define __COMMON_EGL_IMAGE_H
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES/gl.h>
#include <system/window.h>
struct EGLImage_t
{
EGLDisplay dpy;
EGLenum target;
union
{
android_native_buffer_t *native_buffer;
uint32_t host_egl_image;
};
};
#endif

View file

@ -0,0 +1,186 @@
/*
* 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 "HostConnection.h"
#include "TcpStream.h"
#include "QemuPipeStream.h"
#include "ThreadInfo.h"
#include <cutils/log.h>
#include "GLEncoder.h"
#include "GL2Encoder.h"
#include <memory>
#define STREAM_BUFFER_SIZE 4*1024*1024
#define STREAM_PORT_NUM 22468
/* Set to 1 to use a QEMU pipe, or 0 for a TCP connection */
#define USE_QEMU_PIPE 1
HostConnection::HostConnection() :
m_stream(NULL),
m_glEnc(NULL),
m_gl2Enc(NULL),
m_rcEnc(NULL),
m_checksumHelper()
{
}
HostConnection::~HostConnection()
{
delete m_stream;
delete m_glEnc;
delete m_gl2Enc;
delete m_rcEnc;
}
HostConnection *HostConnection::get()
{
/* TODO: Make this configurable with a system property */
const int useQemuPipe = USE_QEMU_PIPE;
// Get thread info
EGLThreadInfo *tinfo = getEGLThreadInfo();
if (!tinfo) {
return NULL;
}
if (tinfo->hostConn == NULL) {
HostConnection *con = new HostConnection();
if (NULL == con) {
return NULL;
}
if (useQemuPipe) {
QemuPipeStream *stream = new QemuPipeStream(STREAM_BUFFER_SIZE);
if (!stream) {
ALOGE("Failed to create QemuPipeStream for host connection!!!\n");
delete con;
return NULL;
}
if (stream->connect() < 0) {
ALOGE("Failed to connect to host (QemuPipeStream)!!!\n");
delete stream;
delete con;
return NULL;
}
con->m_stream = stream;
}
else /* !useQemuPipe */
{
TcpStream *stream = new TcpStream(STREAM_BUFFER_SIZE);
if (!stream) {
ALOGE("Failed to create TcpStream for host connection!!!\n");
delete con;
return NULL;
}
if (stream->connect("10.0.2.2", STREAM_PORT_NUM) < 0) {
ALOGE("Failed to connect to host (TcpStream)!!!\n");
delete stream;
delete con;
return NULL;
}
con->m_stream = stream;
}
// send zero 'clientFlags' to the host.
unsigned int *pClientFlags =
(unsigned int *)con->m_stream->allocBuffer(sizeof(unsigned int));
*pClientFlags = 0;
con->m_stream->commitBuffer(sizeof(unsigned int));
ALOGD("HostConnection::get() New Host Connection established %p, tid %d\n", con, gettid());
tinfo->hostConn = con;
}
return tinfo->hostConn;
}
GLEncoder *HostConnection::glEncoder()
{
if (!m_glEnc) {
m_glEnc = new GLEncoder(m_stream, checksumHelper());
DBG("HostConnection::glEncoder new encoder %p, tid %d", m_glEnc, gettid());
m_glEnc->setContextAccessor(s_getGLContext);
}
return m_glEnc;
}
GL2Encoder *HostConnection::gl2Encoder()
{
if (!m_gl2Enc) {
m_gl2Enc = new GL2Encoder(m_stream, checksumHelper());
DBG("HostConnection::gl2Encoder new encoder %p, tid %d", m_gl2Enc, gettid());
m_gl2Enc->setContextAccessor(s_getGL2Context);
}
return m_gl2Enc;
}
renderControl_encoder_context_t *HostConnection::rcEncoder()
{
if (!m_rcEnc) {
m_rcEnc = new renderControl_encoder_context_t(m_stream, checksumHelper());
// TODO: disable checksum as a workaround in a glTexSubImage2D problem
// Uncomment the following line when the root cause is solved
//setChecksumHelper(m_rcEnc);
}
return m_rcEnc;
}
gl_client_context_t *HostConnection::s_getGLContext()
{
EGLThreadInfo *ti = getEGLThreadInfo();
if (ti->hostConn) {
return ti->hostConn->m_glEnc;
}
return NULL;
}
gl2_client_context_t *HostConnection::s_getGL2Context()
{
EGLThreadInfo *ti = getEGLThreadInfo();
if (ti->hostConn) {
return ti->hostConn->m_gl2Enc;
}
return NULL;
}
void HostConnection::setChecksumHelper(renderControl_encoder_context_t *rcEnc) {
std::unique_ptr<char[]> glExtensions;
int extensionSize = rcEnc->rcGetGLString(rcEnc, GL_EXTENSIONS, NULL, 0);
if (extensionSize < 0) {
glExtensions = std::unique_ptr<char[]>(new char[-extensionSize]);
extensionSize = rcEnc->rcGetGLString(rcEnc, GL_EXTENSIONS, glExtensions.get(), -extensionSize);
if (extensionSize <= 0) {
glExtensions.reset();
}
}
// check the host supported version
uint32_t checksumVersion = 0;
const char* checksumPrefix = ChecksumCalculator::getMaxVersionStrPrefix();
const char* glProtocolStr = glExtensions.get() ?
strstr(glExtensions.get(), checksumPrefix) : NULL;
if (glProtocolStr) {
uint32_t maxVersion = ChecksumCalculator::getMaxVersion();
sscanf(glProtocolStr+strlen(checksumPrefix), "%d", &checksumVersion);
if (maxVersion < checksumVersion) {
checksumVersion = maxVersion;
}
// The ordering of the following two commands matters!
// Must tell the host first before setting it in the guest
rcEnc->rcSelectChecksumCalculator(rcEnc, checksumVersion, 0);
m_checksumHelper.setVersion(checksumVersion);
}
}

View file

@ -0,0 +1,61 @@
/*
* 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 __COMMON_HOST_CONNECTION_H
#define __COMMON_HOST_CONNECTION_H
#include "IOStream.h"
#include "renderControl_enc.h"
#include "ChecksumCalculator.h"
class GLEncoder;
class gl_client_context_t;
class GL2Encoder;
class gl2_client_context_t;
class HostConnection
{
public:
static HostConnection *get();
~HostConnection();
GLEncoder *glEncoder();
GL2Encoder *gl2Encoder();
renderControl_encoder_context_t *rcEncoder();
ChecksumCalculator *checksumHelper() { return &m_checksumHelper; }
void flush() {
if (m_stream) {
m_stream->flush();
}
}
private:
HostConnection();
static gl_client_context_t *s_getGLContext();
static gl2_client_context_t *s_getGL2Context();
// setProtocol initilizes GL communication protocol for checksums
// should be called when m_rcEnc is created
void setChecksumHelper(renderControl_encoder_context_t *rcEnc);
private:
IOStream *m_stream;
GLEncoder *m_glEnc;
GL2Encoder *m_gl2Enc;
renderControl_encoder_context_t *m_rcEnc;
ChecksumCalculator m_checksumHelper;
};
#endif

View file

@ -0,0 +1,209 @@
/*
* 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 "QemuPipeStream.h"
#include <hardware/qemu_pipe.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
QemuPipeStream::QemuPipeStream(size_t bufSize) :
IOStream(bufSize),
m_sock(-1),
m_bufsize(bufSize),
m_buf(NULL)
{
}
QemuPipeStream::QemuPipeStream(int sock, size_t bufSize) :
IOStream(bufSize),
m_sock(sock),
m_bufsize(bufSize),
m_buf(NULL)
{
}
QemuPipeStream::~QemuPipeStream()
{
if (m_sock >= 0) {
flush();
::close(m_sock);
}
if (m_buf != NULL) {
free(m_buf);
}
}
int QemuPipeStream::connect(void)
{
m_sock = qemu_pipe_open("opengles");
if (!valid()) return -1;
return 0;
}
void *QemuPipeStream::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("realloc (%d) failed\n", allocSize);
free(m_buf);
m_buf = NULL;
m_bufsize = 0;
}
}
return m_buf;
};
int QemuPipeStream::commitBuffer(size_t size)
{
return writeFully(m_buf, size);
}
int QemuPipeStream::writeFully(const void *buf, size_t len)
{
//DBG(">> QemuPipeStream::writeFully %d\n", len);
if (!valid()) return -1;
if (!buf) {
if (len>0) {
// If len is non-zero, buf must not be NULL. Otherwise the pipe would be
// in a corrupted state, which is lethal for the emulator.
ERR("QemuPipeStream::writeFully failed, buf=NULL, len %d,"
" lethal error, exiting", len);
abort();
}
return 0;
}
size_t res = len;
int retval = 0;
while (res > 0) {
ssize_t stat = ::write(m_sock, (const char *)(buf) + (len - res), res);
if (stat > 0) {
res -= stat;
continue;
}
if (stat == 0) { /* EOF */
ERR("QemuPipeStream::writeFully failed: premature EOF\n");
retval = -1;
break;
}
if (errno == EINTR) {
continue;
}
retval = stat;
ERR("QemuPipeStream::writeFully failed: %s, lethal error, exiting.\n",
strerror(errno));
abort();
}
//DBG("<< QemuPipeStream::writeFully %d\n", len );
return retval;
}
const unsigned char *QemuPipeStream::readFully(void *buf, size_t len)
{
//DBG(">> QemuPipeStream::readFully %d\n", len);
if (!valid()) return NULL;
if (!buf) {
if (len > 0) {
// If len is non-zero, buf must not be NULL. Otherwise the pipe would be
// in a corrupted state, which is lethal for the emulator.
ERR("QemuPipeStream::readFully failed, buf=NULL, len %zu, lethal"
" error, exiting.", len);
abort();
}
return NULL; // do not allow NULL buf in that implementation
}
size_t res = len;
while (res > 0) {
ssize_t stat = ::read(m_sock, (char *)(buf) + len - res, res);
if (stat == 0) {
// client shutdown;
return NULL;
} else if (stat < 0) {
if (errno == EINTR) {
continue;
} else {
ERR("QemuPipeStream::readFully failed (buf %p, len %zu"
", res %zu): %s, lethal error, exiting.", buf, len, res,
strerror(errno));
abort();
}
} else {
res -= stat;
}
}
//DBG("<< QemuPipeStream::readFully %d\n", len);
return (const unsigned char *)buf;
}
const unsigned char *QemuPipeStream::read( void *buf, size_t *inout_len)
{
//DBG(">> QemuPipeStream::read %d\n", *inout_len);
if (!valid()) return NULL;
if (!buf) {
ERR("QemuPipeStream::read failed, buf=NULL");
return NULL; // do not allow NULL buf in that implementation
}
int n = recv(buf, *inout_len);
if (n > 0) {
*inout_len = n;
return (const unsigned char *)buf;
}
//DBG("<< QemuPipeStream::read %d\n", *inout_len);
return NULL;
}
int QemuPipeStream::recv(void *buf, size_t len)
{
if (!valid()) return int(ERR_INVALID_SOCKET);
char* p = (char *)buf;
int ret = 0;
while(len > 0) {
int res = ::read(m_sock, p, len);
if (res > 0) {
p += res;
ret += res;
len -= res;
continue;
}
if (res == 0) { /* EOF */
break;
}
if (errno == EINTR)
continue;
/* A real error */
if (ret == 0)
ret = -1;
break;
}
return ret;
}

View file

@ -0,0 +1,51 @@
/*
* 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 __QEMU_PIPE_STREAM_H
#define __QEMU_PIPE_STREAM_H
/* This file implements an IOStream that uses a QEMU fast-pipe
* to communicate with the emulator's 'opengles' service. See
* <hardware/qemu_pipe.h> for more details.
*/
#include <stdlib.h>
#include "IOStream.h"
class QemuPipeStream : public IOStream {
public:
typedef enum { ERR_INVALID_SOCKET = -1000 } QemuPipeStreamError;
explicit QemuPipeStream(size_t bufsize = 10000);
~QemuPipeStream();
int connect(void);
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; }
int recv(void *buf, size_t len);
virtual int writeFully(const void *buf, size_t len);
private:
int m_sock;
size_t m_bufsize;
unsigned char *m_buf;
QemuPipeStream(int sock, size_t bufSize);
};
#endif

View file

@ -0,0 +1,40 @@
/*
* 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 "ThreadInfo.h"
#include "cutils/threads.h"
thread_store_t s_tls = THREAD_STORE_INITIALIZER;
static void tlsDestruct(void *ptr)
{
if (ptr) {
EGLThreadInfo *ti = (EGLThreadInfo *)ptr;
delete ti->hostConn;
delete ti;
((void **)__get_tls())[TLS_SLOT_OPENGL] = NULL;
}
}
EGLThreadInfo *slow_getEGLThreadInfo()
{
EGLThreadInfo *ti = (EGLThreadInfo *)thread_store_get(&s_tls);
if (ti) return ti;
ti = new EGLThreadInfo();
thread_store_set(&s_tls, ti, tlsDestruct);
return ti;
}

View file

@ -0,0 +1,59 @@
/*
* 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 _THREAD_INFO_H
#define _THREAD_INFO_H
#include "HostConnection.h"
#include <pthread.h>
#ifdef __ANDROID__
#include <bionic_tls.h>
#endif
struct EGLContext_t;
struct EGLThreadInfo
{
EGLThreadInfo() : currentContext(NULL), hostConn(NULL), eglError(EGL_SUCCESS) {}
EGLContext_t *currentContext;
HostConnection *hostConn;
int eglError;
};
EGLThreadInfo *slow_getEGLThreadInfo();
#ifdef __ANDROID__
// We have a dedicated TLS slot in bionic
inline EGLThreadInfo* getEGLThreadInfo() {
EGLThreadInfo *tInfo =
(EGLThreadInfo *)(((uintptr_t *)__get_tls())[TLS_SLOT_OPENGL]);
if (!tInfo) {
tInfo = slow_getEGLThreadInfo();
((uintptr_t *)__get_tls())[TLS_SLOT_OPENGL] = (uintptr_t)tInfo;
}
return tInfo;
}
#else
inline EGLThreadInfo* getEGLThreadInfo() {
return slow_getEGLThreadInfo();
}
#endif
#endif // of _THREAD_INFO_H

View file

@ -0,0 +1,114 @@
/*
* 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 __GRALLOC_CB_H__
#define __GRALLOC_CB_H__
#include <hardware/hardware.h>
#include <hardware/gralloc.h>
#include <cutils/native_handle.h>
#define BUFFER_HANDLE_MAGIC ((int)0xabfabfab)
#define CB_HANDLE_NUM_INTS(nfds) (int)((sizeof(cb_handle_t) - (nfds)*sizeof(int)) / sizeof(int))
//
// Our buffer handle structure
//
struct cb_handle_t : public native_handle {
cb_handle_t(int p_fd, int p_ashmemSize, int p_usage,
int p_width, int p_height, int p_frameworkFormat,
int p_format, int p_glFormat, int p_glType) :
fd(p_fd),
magic(BUFFER_HANDLE_MAGIC),
usage(p_usage),
width(p_width),
height(p_height),
frameworkFormat(p_frameworkFormat),
format(p_format),
glFormat(p_glFormat),
glType(p_glType),
ashmemSize(p_ashmemSize),
ashmemBase(0),
ashmemBasePid(0),
mappedPid(0),
lockedLeft(0),
lockedTop(0),
lockedWidth(0),
lockedHeight(0),
hostHandle(0)
{
version = sizeof(native_handle);
numFds = 0;
numInts = CB_HANDLE_NUM_INTS(numFds);
}
~cb_handle_t() {
magic = 0;
}
void setFd(int p_fd) {
if (p_fd >= 0) {
numFds = 1;
}
else {
numFds = 0;
}
fd = p_fd;
numInts = CB_HANDLE_NUM_INTS(numFds);
}
static bool validate(const cb_handle_t* hnd) {
return (hnd &&
hnd->version == sizeof(native_handle) &&
hnd->magic == BUFFER_HANDLE_MAGIC &&
hnd->numInts == CB_HANDLE_NUM_INTS(hnd->numFds));
}
bool canBePosted() {
return (0 != (usage & GRALLOC_USAGE_HW_FB));
}
// file-descriptors
int fd; // ashmem fd (-1 of ashmem region did not allocated, i.e. no SW access needed)
// ints
int magic; // magic number in order to validate a pointer to be a cb_handle_t
int usage; // usage bits the buffer was created with
int width; // buffer width
int height; // buffer height
int frameworkFormat; // format requested by the Android framework
int format; // real internal pixel format format
int glFormat; // OpenGL format enum used for host h/w color buffer
int glType; // OpenGL type enum used when uploading to host
int ashmemSize; // ashmem region size for the buffer (0 unless is HW_FB buffer or
// s/w access is needed)
union {
intptr_t ashmemBase; // CPU address of the mapped ashmem region
uint64_t padding; // enforce same size on 32-bit/64-bit
} __attribute__((aligned(8)));
int ashmemBasePid; // process id which mapped the ashmem region
int mappedPid; // process id which succeeded gralloc_register call
int lockedLeft; // region of buffer locked for s/w write
int lockedTop;
int lockedWidth;
int lockedHeight;
uint32_t hostHandle;
};
#endif //__GRALLOC_CB_H__

View file

@ -0,0 +1,41 @@
ifneq (false,$(BUILD_EMULATOR_OPENGL_DRIVER))
LOCAL_PATH := $(call my-dir)
$(call emugl-begin-shared-library,libEGL_emulation)
$(call emugl-import,libOpenglSystemCommon)
$(call emugl-set-shared-library-subpath,egl)
LOCAL_CFLAGS += -DLOG_TAG=\"EGL_emulation\" -DEGL_EGLEXT_PROTOTYPES -DWITH_GLES2
LOCAL_SRC_FILES := \
eglDisplay.cpp \
egl.cpp \
ClientAPIExts.cpp
LOCAL_SHARED_LIBRARIES += libdl
# Used to access the Bionic private OpenGL TLS slot
LOCAL_C_INCLUDES += bionic/libc/private
$(call emugl-end-module)
#### egl.cfg ####
# Ensure that this file is only copied to emulator-specific builds.
# Other builds are device-specific and will provide their own
# version of this file to point to the appropriate HW EGL libraries.
#
ifneq (,$(filter aosp_arm aosp_x86 aosp_mips full full_x86 full_mips sdk sdk_x86 sdk_mips google_sdk google_sdk_x86 google_sdk_mips,$(TARGET_PRODUCT)))
include $(CLEAR_VARS)
LOCAL_MODULE := egl.cfg
LOCAL_SRC_FILES := $(LOCAL_MODULE)
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl
LOCAL_MODULE_CLASS := ETC
include $(BUILD_PREBUILT)
endif # TARGET_PRODUCT in 'full full_x86 full_mips sdk sdk_x86 sdk_mips google_sdk google_sdk_x86 google_sdk_mips')
endif # BUILD_EMULATOR_OPENGL_DRIVER != false

View file

@ -0,0 +1,157 @@
/*
* 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 "ClientAPIExts.h"
#include "ThreadInfo.h"
#include <GLES/gl.h>
#include <GLES/glext.h>
#include "eglContext.h"
namespace ClientAPIExts
{
//
// define function pointer type for each extention function
// typename has the form __egl_{funcname}_t
//
#define FUNC_TYPE(fname) __egl_ ## fname ## _t
#define API_ENTRY(fname,params,args) \
typedef void (GL_APIENTRY *FUNC_TYPE(fname)) params;
#define API_ENTRY_RET(rtype,fname,params,args) \
typedef rtype (GL_APIENTRY *FUNC_TYPE(fname)) params;
#include "ClientAPIExts.in"
#undef API_ENTRY
#undef API_ENTRY_RET
/////
// Define static table to store the function value for each
// client API. functions pointers will get initialized through
// ClientAPIExts::initClientFuncs function after each client API has been
// loaded.
/////
#define API_ENTRY(fname,params,args) \
FUNC_TYPE(fname) fname;
#define API_ENTRY_RET(rtype,fname,params,args) \
API_ENTRY(fname,params,args)
static struct _ext_table
{
#include "ClientAPIExts.in"
} s_client_extensions[2];
#undef API_ENTRY
#undef API_ENTRY_RET
//
// This function initialized each entry in the s_client_extensions
// struct at the givven index using the givven client interface
//
void initClientFuncs(const EGLClient_glesInterface *iface, int idx)
{
#define API_ENTRY(fname,params,args) \
s_client_extensions[idx].fname = \
(FUNC_TYPE(fname))iface->getProcAddress(#fname);
#define API_ENTRY_RET(rtype,fname,params,args) \
API_ENTRY(fname,params,args)
//
// reset all func pointers to NULL
//
memset(&s_client_extensions[idx], 0, sizeof(struct _ext_table));
//
// And now query the GLES library for each proc address
//
#include "ClientAPIExts.in"
#undef API_ENTRY
#undef API_ENTRY_RET
}
//
// Define implementation for each extension function which checks
// the current context version and calls to the correct client API
// function.
//
#define API_ENTRY(fname,params,args) \
static void _egl_ ## fname params \
{ \
EGLThreadInfo* thread = getEGLThreadInfo(); \
if (!thread->currentContext) { \
return; \
} \
int idx = (int)thread->currentContext->version - 1; \
if (!s_client_extensions[idx].fname) { \
return; \
} \
(*s_client_extensions[idx].fname) args; \
}
#define API_ENTRY_RET(rtype,fname,params,args) \
static rtype _egl_ ## fname params \
{ \
EGLThreadInfo* thread = getEGLThreadInfo(); \
if (!thread->currentContext) { \
return (rtype)0; \
} \
int idx = (int)thread->currentContext->version - 1; \
if (!s_client_extensions[idx].fname) { \
return (rtype)0; \
} \
return (*s_client_extensions[idx].fname) args; \
}
#include "ClientAPIExts.in"
#undef API_ENTRY
#undef API_ENTRY_RET
//
// Define a table to map function names to the local _egl_ version of
// the extension function, to be used in eglGetProcAddress.
//
#define API_ENTRY(fname,params,args) \
{ #fname, (void*)_egl_ ## fname},
#define API_ENTRY_RET(rtype,fname,params,args) \
API_ENTRY(fname,params,args)
static const struct _client_ext_funcs {
const char *fname;
void* proc;
} s_client_ext_funcs[] = {
#include "ClientAPIExts.in"
};
static const int numExtFuncs = sizeof(s_client_ext_funcs) /
sizeof(s_client_ext_funcs[0]);
#undef API_ENTRY
#undef API_ENTRY_RET
//
// returns the __egl_ version of the givven extension function name.
//
void* getProcAddress(const char *fname)
{
for (int i=0; i<numExtFuncs; i++) {
if (!strcmp(fname, s_client_ext_funcs[i].fname)) {
return s_client_ext_funcs[i].proc;
}
}
return NULL;
}
} // of namespace ClientAPIExts

View file

@ -0,0 +1,29 @@
/*
* 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 _CLIENT_APIS_EXTS_H
#define _CLIENT_APIS_EXTS_H
#include "EGLClientIface.h"
namespace ClientAPIExts
{
void initClientFuncs(const EGLClient_glesInterface *iface, int idx);
void* getProcAddress(const char *fname);
} // of namespace ClientAPIExts
#endif

View file

@ -0,0 +1,201 @@
//
// Each extension function should have one of the following
// macro definitions:
// API_ENTRY(funcname, paramlist, arglist)
// -or- (if the function has a return value)
// API_ENTRY_RET(return_type,funcname, paramlist, arglist)
//
API_ENTRY(glEGLImageTargetTexture2DOES,
(GLenum target, GLeglImageOES image),
(target, image))
API_ENTRY(glEGLImageTargetRenderbufferStorageOES,
(GLenum target, GLeglImageOES image),
(target, image))
API_ENTRY(glBlendEquationSeparateOES,
(GLenum modeRGB, GLenum modeAlpha),
(modeRGB, modeAlpha))
API_ENTRY(glBlendFuncSeparateOES,
(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha),
(srcRGB, dstRGB, srcAlpha, dstAlpha))
API_ENTRY(glBlendEquationOES,
(GLenum mode),
(mode))
API_ENTRY(glCurrentPaletteMatrixOES,
(GLuint matrixpaletteindex),
(matrixpaletteindex))
API_ENTRY(glLoadPaletteFromModelViewMatrixOES,
(void),
())
API_ENTRY(glMatrixIndexPointerOES,
(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer),
(size, type, stride, pointer))
API_ENTRY(glWeightPointerOES,
(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer),
(size, type, stride, pointer))
API_ENTRY(glDepthRangefOES,
(GLclampf zNear, GLclampf zFar),
(zNear, zFar))
API_ENTRY(glFrustumfOES,
(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar),
(left, right, bottom, top, zNear, zFar))
API_ENTRY(glOrthofOES,
(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar),
(left, right, bottom, top, zNear, zFar))
API_ENTRY(glClipPlanefOES,
(GLenum plane, const GLfloat *equation),
(plane, equation))
API_ENTRY(glGetClipPlanefOES,
(GLenum pname, GLfloat * eqn),
(pname, eqn))
API_ENTRY(glClearDepthfOES,
(GLclampf depth),
(depth))
API_ENTRY(glPointSizePointerOES,
(GLenum type, GLsizei stride, const GLvoid *pointer),
(type, stride, pointer))
API_ENTRY(glTexGenfOES,
(GLenum coord, GLenum pname, GLfloat param),
(coord, pname, param))
API_ENTRY(glTexGenfvOES,
(GLenum coord, GLenum pname, const GLfloat *params),
(coord, pname, params))
API_ENTRY(glTexGeniOES,
(GLenum coord, GLenum pname, GLint param),
(coord, pname, param))
API_ENTRY(glTexGenivOES,
(GLenum coord, GLenum pname, const GLint *params),
(coord, pname, params))
API_ENTRY(glTexGenxOES,
(GLenum coord, GLenum pname, GLfixed param),
(coord, pname, param))
API_ENTRY(glTexGenxvOES,
(GLenum coord, GLenum pname, const GLfixed *params),
(coord, pname, params))
API_ENTRY(glGetTexGenfvOES,
(GLenum coord, GLenum pname, GLfloat *params),
(coord, pname, params))
API_ENTRY(glGetTexGenivOES,
(GLenum coord, GLenum pname, GLint *params),
(coord, pname, params))
API_ENTRY(glGetTexGenxvOES,
(GLenum coord, GLenum pname, GLfixed *params),
(coord, pname, params))
API_ENTRY_RET(GLboolean,
glIsRenderbufferOES,
(GLuint renderbuffer),
(renderbuffer))
API_ENTRY(glBindRenderbufferOES,
(GLenum target, GLuint renderbuffer),
(target, renderbuffer))
API_ENTRY(glDeleteRenderbuffersOES,
(GLsizei n, const GLuint* renderbuffers),
(n, renderbuffers))
API_ENTRY(glGenRenderbuffersOES,
(GLsizei n, GLuint* renderbuffers),
(n, renderbuffers))
API_ENTRY(glRenderbufferStorageOES,
(GLenum target, GLenum internalformat, GLsizei width, GLsizei height),
(target, internalformat, width, height))
API_ENTRY(glGetRenderbufferParameterivOES,
(GLenum target, GLenum pname, GLint* params),
(target, pname, params))
API_ENTRY_RET(GLboolean,
glIsFramebufferOES,
(GLuint framebuffer),
(framebuffer))
API_ENTRY(glBindFramebufferOES,
(GLenum target, GLuint framebuffer),
(target, framebuffer))
API_ENTRY(glDeleteFramebuffersOES,
(GLsizei n, const GLuint* framebuffers),
(n, framebuffers))
API_ENTRY(glGenFramebuffersOES,
(GLsizei n, GLuint* framebuffers),
(n, framebuffers))
API_ENTRY_RET(GLenum,
glCheckFramebufferStatusOES,
(GLenum target),
(target))
API_ENTRY(glFramebufferTexture2DOES,
(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level),
(target, attachment, textarget, texture, level))
API_ENTRY(glFramebufferRenderbufferOES,
(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer),
(target, attachment, renderbuffertarget, renderbuffer))
API_ENTRY(glGetFramebufferAttachmentParameterivOES,
(GLenum target, GLenum attachment, GLenum pname, GLint* params),
(target, attachment, pname, params))
API_ENTRY(glGenerateMipmapOES,
(GLenum target),
(target))
API_ENTRY(glDrawTexsOES,
(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height),
(x, y, z, width, height))
API_ENTRY(glDrawTexiOES,
(GLint x, GLint y, GLint z, GLint width, GLint height),
(x, y, z, width, height))
API_ENTRY(glDrawTexfOES,
(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height),
(x, y, z, width, height))
API_ENTRY(glDrawTexxOES,
(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height),
(x, y, z, width, height))
API_ENTRY(glDrawTexsvOES,
(const GLshort *coords),
(coords))
API_ENTRY(glDrawTexivOES,
(const GLint *coords),
(coords))
API_ENTRY(glDrawTexfvOES,
(const GLfloat *coords),
(coords))
API_ENTRY(glDrawTexxvOES,
(const GLfixed *coords),
(coords))

View file

@ -0,0 +1 @@
0 0 emulation

File diff suppressed because it is too large Load diff

View 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.
*/
#ifndef _EGL_CONTEXT_H
#define _EGL_CONTEXT_H
#include "GLClientState.h"
#include "GLSharedGroup.h"
struct EGLContext_t {
enum {
IS_CURRENT = 0x00010000,
NEVER_CURRENT = 0x00020000
};
EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* shareCtx);
~EGLContext_t();
uint32_t flags;
EGLDisplay dpy;
EGLConfig config;
EGLSurface read;
EGLSurface draw;
EGLContext_t * shareCtx;
EGLint version;
uint32_t rcContext;
const char* versionString;
const char* vendorString;
const char* rendererString;
const char* shaderVersionString;
const char* extensionString;
EGLint deletePending;
GLClientState * getClientState(){ return clientState; }
GLSharedGroupPtr getSharedGroup(){ return sharedGroup; }
private:
GLClientState * clientState;
GLSharedGroupPtr sharedGroup;
};
#endif

View file

@ -0,0 +1,485 @@
/*
* 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 "eglDisplay.h"
#include "HostConnection.h"
#include <dlfcn.h>
static const int systemEGLVersionMajor = 1;
static const int systemEGLVersionMinor = 4;
static const char systemEGLVendor[] = "Google Android emulator";
// list of extensions supported by this EGL implementation
// NOTE that each extension name should be suffixed with space
static const char systemStaticEGLExtensions[] =
"EGL_ANDROID_image_native_buffer "
"EGL_KHR_fence_sync "
"EGL_KHR_image_base "
"EGL_KHR_gl_texture_2d_image ";
static void *s_gles_lib = NULL;
static void *s_gles2_lib = NULL;
// The following function will be called when we (libEGL)
// gets unloaded
// At this point we want to unload the gles libraries we
// might have loaded during initialization
static void __attribute__ ((destructor)) do_on_unload(void)
{
if (s_gles_lib) {
dlclose(s_gles_lib);
}
if (s_gles2_lib) {
dlclose(s_gles2_lib);
}
}
eglDisplay::eglDisplay() :
m_initialized(false),
m_major(0),
m_minor(0),
m_hostRendererVersion(0),
m_numConfigs(0),
m_numConfigAttribs(0),
m_attribs(DefaultKeyedVector<EGLint, EGLint>(ATTRIBUTE_NONE)),
m_configs(NULL),
m_gles_iface(NULL),
m_gles2_iface(NULL),
m_versionString(NULL),
m_vendorString(NULL),
m_extensionString(NULL)
{
pthread_mutex_init(&m_lock, NULL);
}
eglDisplay::~eglDisplay()
{
pthread_mutex_destroy(&m_lock);
}
bool eglDisplay::initialize(EGLClient_eglInterface *eglIface)
{
pthread_mutex_lock(&m_lock);
if (!m_initialized) {
//
// load GLES client API
//
#if __LP64__
m_gles_iface = loadGLESClientAPI("/system/lib64/egl/libGLESv1_CM_emulation.so",
eglIface,
&s_gles_lib);
#else
m_gles_iface = loadGLESClientAPI("/system/lib/egl/libGLESv1_CM_emulation.so",
eglIface,
&s_gles_lib);
#endif
if (!m_gles_iface) {
pthread_mutex_unlock(&m_lock);
ALOGE("Failed to load gles1 iface");
return false;
}
#ifdef WITH_GLES2
#if __LP64__
m_gles2_iface = loadGLESClientAPI("/system/lib64/egl/libGLESv2_emulation.so",
eglIface,
&s_gles2_lib);
#else
m_gles2_iface = loadGLESClientAPI("/system/lib/egl/libGLESv2_emulation.so",
eglIface,
&s_gles2_lib);
#endif
// Note that if loading gles2 failed, we can still run with no
// GLES2 support, having GLES2 is not mandatory.
#endif
//
// establish connection with the host
//
HostConnection *hcon = HostConnection::get();
if (!hcon) {
pthread_mutex_unlock(&m_lock);
ALOGE("Failed to establish connection with the host\n");
return false;
}
//
// get renderControl encoder instance
//
renderControl_encoder_context_t *rcEnc = hcon->rcEncoder();
if (!rcEnc) {
pthread_mutex_unlock(&m_lock);
ALOGE("Failed to get renderControl encoder instance");
return false;
}
//
// Query host reneder and EGL version
//
m_hostRendererVersion = rcEnc->rcGetRendererVersion(rcEnc);
EGLint status = rcEnc->rcGetEGLVersion(rcEnc, &m_major, &m_minor);
if (status != EGL_TRUE) {
// host EGL initialization failed !!
pthread_mutex_unlock(&m_lock);
return false;
}
//
// Take minimum version beween what we support and what the host support
//
if (m_major > systemEGLVersionMajor) {
m_major = systemEGLVersionMajor;
m_minor = systemEGLVersionMinor;
}
else if (m_major == systemEGLVersionMajor &&
m_minor > systemEGLVersionMinor) {
m_minor = systemEGLVersionMinor;
}
//
// Query the host for the set of configs
//
m_numConfigs = rcEnc->rcGetNumConfigs(rcEnc, (uint32_t*)&m_numConfigAttribs);
if (m_numConfigs <= 0 || m_numConfigAttribs <= 0) {
// just sanity check - should never happen
pthread_mutex_unlock(&m_lock);
return false;
}
uint32_t nInts = m_numConfigAttribs * (m_numConfigs + 1);
EGLint tmp_buf[nInts];
m_configs = new EGLint[nInts-m_numConfigAttribs];
if (!m_configs) {
pthread_mutex_unlock(&m_lock);
return false;
}
//EGLint n = rcEnc->rcGetConfigs(rcEnc, nInts*sizeof(EGLint), m_configs);
EGLint n = rcEnc->rcGetConfigs(rcEnc, nInts*sizeof(EGLint), (GLuint*)tmp_buf);
if (n != m_numConfigs) {
pthread_mutex_unlock(&m_lock);
return false;
}
//Fill the attributes vector.
//The first m_numConfigAttribs values of tmp_buf are the actual attributes enums.
for (int i=0; i<m_numConfigAttribs; i++) {
m_attribs.add(tmp_buf[i], i);
}
//Copy the actual configs data to m_configs
memcpy(m_configs, tmp_buf + m_numConfigAttribs, m_numConfigs*m_numConfigAttribs*sizeof(EGLint));
m_initialized = true;
}
pthread_mutex_unlock(&m_lock);
processConfigs();
return true;
}
void eglDisplay::processConfigs()
{
for (intptr_t i=0; i<m_numConfigs; i++) {
EGLConfig config = (EGLConfig)i;
//Setup the EGL_NATIVE_VISUAL_ID attribute
PixelFormat format;
if (getConfigNativePixelFormat(config, &format)) {
setConfigAttrib(config, EGL_NATIVE_VISUAL_ID, format);
}
}
}
void eglDisplay::terminate()
{
pthread_mutex_lock(&m_lock);
if (m_initialized) {
m_initialized = false;
delete [] m_configs;
m_configs = NULL;
if (m_versionString) {
free(m_versionString);
m_versionString = NULL;
}
if (m_vendorString) {
free(m_vendorString);
m_vendorString = NULL;
}
if (m_extensionString) {
free(m_extensionString);
m_extensionString = NULL;
}
}
pthread_mutex_unlock(&m_lock);
}
EGLClient_glesInterface *eglDisplay::loadGLESClientAPI(const char *libName,
EGLClient_eglInterface *eglIface,
void **libHandle)
{
void *lib = dlopen(libName, RTLD_NOW);
if (!lib) {
ALOGE("Failed to dlopen %s", libName);
return NULL;
}
init_emul_gles_t init_gles_func = (init_emul_gles_t)dlsym(lib,"init_emul_gles");
if (!init_gles_func) {
ALOGE("Failed to find init_emul_gles");
dlclose((void*)lib);
return NULL;
}
*libHandle = lib;
return (*init_gles_func)(eglIface);
}
static char *queryHostEGLString(EGLint name)
{
HostConnection *hcon = HostConnection::get();
if (hcon) {
renderControl_encoder_context_t *rcEnc = hcon->rcEncoder();
if (rcEnc) {
int n = rcEnc->rcQueryEGLString(rcEnc, name, NULL, 0);
if (n < 0) {
// allocate space for the string with additional
// space charachter to be suffixed at the end.
char *str = (char *)malloc(-n+2);
n = rcEnc->rcQueryEGLString(rcEnc, name, str, -n);
if (n > 0) {
// add extra space at end of string which will be
// needed later when filtering the extension list.
strcat(str, " ");
return str;
}
free(str);
}
}
}
return NULL;
}
static bool findExtInList(const char* token, int tokenlen, const char* list)
{
const char* p = list;
while (*p != '\0') {
const char* q = strchr(p, ' ');
if (q == NULL) {
/* should not happen, list must be space-terminated */
break;
}
if (tokenlen == (q - p) && !memcmp(token, p, tokenlen)) {
return true; /* found it */
}
p = q+1;
}
return false; /* not found */
}
static char *buildExtensionString()
{
//Query host extension string
char *hostExt = queryHostEGLString(EGL_EXTENSIONS);
if (!hostExt || (hostExt[1] == '\0')) {
// no extensions on host - only static extension list supported
return strdup(systemStaticEGLExtensions);
}
int n = strlen(hostExt);
if (n > 0) {
char *str;
asprintf(&str,"%s%s", systemStaticEGLExtensions, hostExt);
free((char*)hostExt);
return str;
}
else {
free((char*)hostExt);
return strdup(systemStaticEGLExtensions);
}
}
const char *eglDisplay::queryString(EGLint name)
{
if (name == EGL_CLIENT_APIS) {
return "OpenGL_ES";
}
else if (name == EGL_VERSION) {
pthread_mutex_lock(&m_lock);
if (m_versionString) {
pthread_mutex_unlock(&m_lock);
return m_versionString;
}
// build version string
asprintf(&m_versionString, "%d.%d", m_major, m_minor);
pthread_mutex_unlock(&m_lock);
return m_versionString;
}
else if (name == EGL_VENDOR) {
pthread_mutex_lock(&m_lock);
if (m_vendorString) {
pthread_mutex_unlock(&m_lock);
return m_vendorString;
}
// build vendor string
const char *hostVendor = queryHostEGLString(EGL_VENDOR);
if (hostVendor) {
asprintf(&m_vendorString, "%s Host: %s",
systemEGLVendor, hostVendor);
free((char*)hostVendor);
}
else {
m_vendorString = (char *)systemEGLVendor;
}
pthread_mutex_unlock(&m_lock);
return m_vendorString;
}
else if (name == EGL_EXTENSIONS) {
pthread_mutex_lock(&m_lock);
if (m_extensionString) {
pthread_mutex_unlock(&m_lock);
return m_extensionString;
}
// build extension string
m_extensionString = buildExtensionString();
pthread_mutex_unlock(&m_lock);
return m_extensionString;
}
else {
ALOGE("[%s] Unknown name %d\n", __FUNCTION__, name);
return NULL;
}
}
/* To get the value of attribute <a> of config <c> use the following formula:
* value = *(m_configs + (int)c*m_numConfigAttribs + a);
*/
EGLBoolean eglDisplay::getAttribValue(EGLConfig config, EGLint attribIdx, EGLint * value)
{
if (attribIdx == ATTRIBUTE_NONE)
{
ALOGE("[%s] Bad attribute idx\n", __FUNCTION__);
return EGL_FALSE;
}
*value = *(m_configs + (intptr_t)config*m_numConfigAttribs + attribIdx);
return EGL_TRUE;
}
EGLBoolean eglDisplay::getConfigAttrib(EGLConfig config, EGLint attrib, EGLint * value)
{
//Though it seems that valueFor() is thread-safe, we don't take chanses
pthread_mutex_lock(&m_lock);
EGLBoolean ret = getAttribValue(config, m_attribs.valueFor(attrib), value);
pthread_mutex_unlock(&m_lock);
return ret;
}
void eglDisplay::dumpConfig(EGLConfig config)
{
EGLint value = 0;
DBG("^^^^^^^^^^ dumpConfig %d ^^^^^^^^^^^^^^^^^^", (int)config);
for (int i=0; i<m_numConfigAttribs; i++) {
getAttribValue(config, i, &value);
DBG("{%d}[%d] %d\n", (int)config, i, value);
}
}
/* To set the value of attribute <a> of config <c> use the following formula:
* *(m_configs + (int)c*m_numConfigAttribs + a) = value;
*/
EGLBoolean eglDisplay::setAttribValue(EGLConfig config, EGLint attribIdx, EGLint value)
{
if (attribIdx == ATTRIBUTE_NONE)
{
ALOGE("[%s] Bad attribute idx\n", __FUNCTION__);
return EGL_FALSE;
}
*(m_configs + (intptr_t)config*m_numConfigAttribs + attribIdx) = value;
return EGL_TRUE;
}
EGLBoolean eglDisplay::setConfigAttrib(EGLConfig config, EGLint attrib, EGLint value)
{
//Though it seems that valueFor() is thread-safe, we don't take chanses
pthread_mutex_lock(&m_lock);
EGLBoolean ret = setAttribValue(config, m_attribs.valueFor(attrib), value);
pthread_mutex_unlock(&m_lock);
return ret;
}
EGLBoolean eglDisplay::getConfigNativePixelFormat(EGLConfig config, PixelFormat * format)
{
EGLint redSize, blueSize, greenSize, alphaSize;
if ( !(getAttribValue(config, m_attribs.valueFor(EGL_RED_SIZE), &redSize) &&
getAttribValue(config, m_attribs.valueFor(EGL_BLUE_SIZE), &blueSize) &&
getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) &&
getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) )
{
ALOGE("Couldn't find value for one of the pixel format attributes");
return EGL_FALSE;
}
//calculate the GL internal format
if ((redSize==8)&&(greenSize==8)&&(blueSize==8)&&(alphaSize==8)) *format = PIXEL_FORMAT_RGBA_8888; //XXX: BGR?
else if ((redSize==8)&&(greenSize==8)&&(blueSize==8)&&(alphaSize==0)) *format = PIXEL_FORMAT_RGBX_8888; //XXX or PIXEL_FORMAT_RGB_888
else if ((redSize==5)&&(greenSize==6)&&(blueSize==5)&&(alphaSize==0)) *format = PIXEL_FORMAT_RGB_565;
else if ((redSize==5)&&(greenSize==5)&&(blueSize==5)&&(alphaSize==1)) *format = PIXEL_FORMAT_RGBA_5551;
else if ((redSize==4)&&(greenSize==4)&&(blueSize==4)&&(alphaSize==4)) *format = PIXEL_FORMAT_RGBA_4444;
else {
return EGL_FALSE;
}
return EGL_TRUE;
}
EGLBoolean eglDisplay::getConfigGLPixelFormat(EGLConfig config, GLenum * format)
{
EGLint redSize, blueSize, greenSize, alphaSize;
if ( !(getAttribValue(config, m_attribs.valueFor(EGL_RED_SIZE), &redSize) &&
getAttribValue(config, m_attribs.valueFor(EGL_BLUE_SIZE), &blueSize) &&
getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) &&
getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) )
{
ALOGE("Couldn't find value for one of the pixel format attributes");
return EGL_FALSE;
}
//calculate the GL internal format
if ((redSize == greenSize) && (redSize == blueSize) &&
((redSize == 8) || (redSize == 16) || (redSize == 32)))
{
if (alphaSize == 0) *format = GL_RGB;
else *format = GL_RGBA;
}
else if ((redSize==5)&&(greenSize==6)&&(blueSize==5)&&(alphaSize==0)) *format = GL_RGB565_OES;
else if ((redSize==5)&&(greenSize==5)&&(blueSize==5)&&(alphaSize==1)) *format = GL_RGB5_A1_OES;
else if ((redSize==4)&&(greenSize==4)&&(blueSize==4)&&(alphaSize==4)) *format = GL_RGBA4_OES;
else return EGL_FALSE;
return EGL_TRUE;
}

View file

@ -0,0 +1,89 @@
/*
* 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 _SYSTEM_EGL_DISPLAY_H
#define _SYSTEM_EGL_DISPLAY_H
#include <pthread.h>
#include "glUtils.h"
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "EGLClientIface.h"
#include <utils/KeyedVector.h>
#include <ui/PixelFormat.h>
#define ATTRIBUTE_NONE -1
//FIXME: are we in this namespace?
using namespace android;
class eglDisplay
{
public:
eglDisplay();
~eglDisplay();
bool initialize(EGLClient_eglInterface *eglIface);
void terminate();
int getVersionMajor() const { return m_major; }
int getVersionMinor() const { return m_minor; }
bool initialized() const { return m_initialized; }
const char *queryString(EGLint name);
const EGLClient_glesInterface *gles_iface() const { return m_gles_iface; }
const EGLClient_glesInterface *gles2_iface() const { return m_gles2_iface; }
int getNumConfigs(){ return m_numConfigs; }
EGLBoolean getConfigAttrib(EGLConfig config, EGLint attrib, EGLint * value);
EGLBoolean setConfigAttrib(EGLConfig config, EGLint attrib, EGLint value);
EGLBoolean getConfigGLPixelFormat(EGLConfig config, GLenum * format);
EGLBoolean getConfigNativePixelFormat(EGLConfig config, PixelFormat * format);
void dumpConfig(EGLConfig config);
private:
EGLClient_glesInterface *loadGLESClientAPI(const char *libName,
EGLClient_eglInterface *eglIface,
void **libHandle);
EGLBoolean getAttribValue(EGLConfig config, EGLint attribIdxi, EGLint * value);
EGLBoolean setAttribValue(EGLConfig config, EGLint attribIdxi, EGLint value);
void processConfigs();
private:
pthread_mutex_t m_lock;
bool m_initialized;
int m_major;
int m_minor;
int m_hostRendererVersion;
int m_numConfigs;
int m_numConfigAttribs;
/* This is the mapping between an attribute name to it's index in any given config */
DefaultKeyedVector<EGLint, EGLint> m_attribs;
/* This is an array of all config's attributes values stored in the following sequencial fasion (read: v[c,a] = the value of attribute <a> of config <c>)
* v[0,0],..,v[0,m_numConfigAttribs-1],
*...
* v[m_numConfigs-1,0],..,v[m_numConfigs-1,m_numConfigAttribs-1]
*/
EGLint *m_configs;
EGLClient_glesInterface *m_gles_iface;
EGLClient_glesInterface *m_gles2_iface;
char *m_versionString;
char *m_vendorString;
char *m_extensionString;
};
#endif

View file

@ -0,0 +1,64 @@
/*
* 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.
*/
static const struct _egl_funcs_by_name {
const char *name;
void *proc;
} egl_funcs_by_name[] = {
{"eglGetError", (void *)eglGetError},
{"eglGetDisplay", (void *)eglGetDisplay},
{"eglInitialize", (void *)eglInitialize},
{"eglTerminate", (void *)eglTerminate},
{"eglQueryString", (void *)eglQueryString},
{"eglGetConfigs", (void *)eglGetConfigs},
{"eglChooseConfig", (void *)eglChooseConfig},
{"eglGetConfigAttrib", (void *)eglGetConfigAttrib},
{"eglCreateWindowSurface", (void *)eglCreateWindowSurface},
{"eglCreatePbufferSurface", (void *)eglCreatePbufferSurface},
{"eglCreatePixmapSurface", (void *)eglCreatePixmapSurface},
{"eglDestroySurface", (void *)eglDestroySurface},
{"eglQuerySurface", (void *)eglQuerySurface},
{"eglBindAPI", (void *)eglBindAPI},
{"eglQueryAPI", (void *)eglQueryAPI},
{"eglWaitClient", (void *)eglWaitClient},
{"eglReleaseThread", (void *)eglReleaseThread},
{"eglCreatePbufferFromClientBuffer", (void *)eglCreatePbufferFromClientBuffer},
{"eglSurfaceAttrib", (void *)eglSurfaceAttrib},
{"eglBindTexImage", (void *)eglBindTexImage},
{"eglReleaseTexImage", (void *)eglReleaseTexImage},
{"eglSwapInterval", (void *)eglSwapInterval},
{"eglCreateContext", (void *)eglCreateContext},
{"eglDestroyContext", (void *)eglDestroyContext},
{"eglMakeCurrent", (void *)eglMakeCurrent},
{"eglGetCurrentContext", (void *)eglGetCurrentContext},
{"eglGetCurrentSurface", (void *)eglGetCurrentSurface},
{"eglGetCurrentDisplay", (void *)eglGetCurrentDisplay},
{"eglQueryContext", (void *)eglQueryContext},
{"eglWaitGL", (void *)eglWaitGL},
{"eglWaitNative", (void *)eglWaitNative},
{"eglSwapBuffers", (void *)eglSwapBuffers},
{"eglCopyBuffers", (void *)eglCopyBuffers},
{"eglGetProcAddress", (void *)eglGetProcAddress},
{"eglLockSurfaceKHR", (void *)eglLockSurfaceKHR},
{"eglUnlockSurfaceKHR", (void *)eglUnlockSurfaceKHR},
{"eglCreateImageKHR", (void *)eglCreateImageKHR},
{"eglDestroyImageKHR", (void *)eglDestroyImageKHR},
{"eglCreateSyncKHR", (void *)eglCreateSyncKHR},
{"eglDestroySyncKHR", (void *)eglDestroySyncKHR},
{"eglClientWaitSyncKHR", (void *)eglClientWaitSyncKHR},
{"eglGetSyncAttribKHR", (void *)eglGetSyncAttribKHR}
};
static const int egl_num_funcs = sizeof(egl_funcs_by_name) / sizeof(struct _egl_funcs_by_name);

View file

@ -0,0 +1,20 @@
ifneq (false,$(BUILD_EMULATOR_OPENGL_DRIVER))
LOCAL_PATH := $(call my-dir)
$(call emugl-begin-shared-library,gralloc.goldfish)
$(call emugl-import,libGLESv1_enc lib_renderControl_enc libOpenglSystemCommon)
$(call emugl-set-shared-library-subpath,hw)
LOCAL_CFLAGS += -DLOG_TAG=\"gralloc_goldfish\"
LOCAL_CFLAGS += -Wno-missing-field-initializers
LOCAL_SRC_FILES := gralloc.cpp
# Need to access the special OPENGL TLS Slot
LOCAL_C_INCLUDES += bionic/libc/private
LOCAL_SHARED_LIBRARIES += libdl
$(call emugl-end-module)
endif # BUILD_EMULATOR_OPENGL_DRIVER != false

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
LOCAL_PATH := $(call my-dir)
$(call emugl-begin-shared-library,lib_renderControl_enc)
LOCAL_SRC_FILES := \
renderControl_client_context.cpp \
renderControl_enc.cpp \
renderControl_entry.cpp
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-import,libOpenglCodecCommon)
$(call emugl-end-module)

View file

@ -0,0 +1,142 @@
The renderControl.in file in this directory defines an API which is decoded
on the android guest into a stream and get decoded and executed on the host.
It is used in order to query the host renderer as well as send the host renderer
control commands.
The following describes each of the entries defined by this renderControl API.
GLint rcGetRendererVersion();
This function queries the host renderer version number.
EGLint rcGetEGLVersion(EGLint* major, EGLint* minor);
This function queries the host renderer for the EGL version
it supports. returns EGL_FALSE on failure.
EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize);
This function queries the host for EGL string (.i.e EGL_EXTENSIONS).
if buffer is NULL or the bufferSize is not big enough the return value
is the negative number of bytes required to store the string value
otherwise the string value is copied to buffer and its size is
returned.
EGLint rcGetNumConfigs(uint32_t* numAttribs);
queries the host for the number of supported EGL configs.
The function returns the number of supported configs and returns in
numAttribs the number of attributes available for each config.
EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer);
This function queries the host for the all set of supported configs
with their attribute values.
bufSize is the size of buffer, the size should be at least equal to
(numConfigs + 1) * numAttribs * sizeof(GLuint)
where numConfigs and numAttribs are the values returned in
rcGetNumConfigs. if bufSize is not big enough then the negative number
of required bytes is returned otherwise the function returns the number
of configs and buffer is filled as follows: The first 'numAttribs'
integer values are filled with the EGL enumerant describing a config
attribute, next for each config there are 'numAttribs' integer values
holding the attribute values for that config, the values are specified
in the same order as the attribute vector.
EGLint rcChooseConfig(EGLint *attribs, uint32_t attribs_size, uint32_t *configs, uint32_t configs_size)
This function triggers an eglChooseConfig on the host, to get a list of
configs matching the given attribs values.
attribs - a list of attribute names followed by the desired values, terminated by EGL_NONE
attribs_size - the size of the list
configs - the returned matching configuration names (same names as familiar to the client in rcGetConfigs)
configs_size - the size of the configs buffers
returns - the actual number of matching configurations (<= configs_size)
EGLint rcGetFBParam(EGLint param);
queries the host for framebuffer parameter, see renderControl_types.h
for possible values of 'param'.
uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion);
This function creates a rendering context on the host and returns its
handle. config is the config index for the context, share is either zero
or a handle to a sharing context. glVersion is either 1 or 2 for GLES1
or GLES2 context respectively.
void rcDestroyContext(uint32_t context);
This function destroys a rendering context on the host.
context is a handle returned in rcCreateContext.
uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height);
This function creates a 'window' surface on the host which can be then
bind for rendering through rcMakeCurrent.
The function returns a handle to the created window surface.
void rcDestroyWindowSurface(uint32_t windowSurface);
This function destoys a window surface.
uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat);
This function creates a colorBuffer object on the host which can be then
be specified as a render target for a window surface through
rcSetWindowColorBuffer or to be displayed on the framebuffer window
through rcFBPost.
The function returns a handle to the colorBuffer object, with an initial
reference count of 1.
void rcOpenColorBuffer(uint32_t colorbuffer);
Adds an additional reference to the colorbuffer, typically from a
different Android process than the one which created it.
void rcCloseColorBuffer(uint32_t colorbuffer);
Removes a reference to the colorbuffer. When the reference count drops
to zero the colorbuffer is automatically destroyed.
void rcFlushWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer);
This flushes the current window color buffer
void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer);
This set the target color buffer for a windowSurface, when set the
previous target colorBuffer gets updated before switching to the new
colorBuffer.
EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf);
Binds a windowSurface(s) and current rendering context for the
calling thread.
void rcFBPost(uint32_t colorBuffer);
This function causes the content of the colorBuffer object to be
displayed on the host framebuffer window. The function returns
immediatly, the buffer will be displayed at the next swap interval.
void rcFBSetSwapInterval(EGLint interval);
Sets the swap interval for the host framebuffer window.
void rcBindTexture(uint32_t colorBuffer);
This function instruct the host to bind the content of the specified
colorBuffer to the current binded texture object of the calling thread.
This function should be used to implement eglBindTexImage.
EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead);
This function returns only after all rendering requests for the specified
colorBuffer rendering target has been processed and after all 'postCount'
posts for the buffer requested previously through rcFBPost has been
processed.
if 'forRead' is not-zero, the function returns positive value in case
there was rendering done to the buffer since the last CacheFlush request
with non-zero 'forRead' value, otherwise the function returns zero or
negative value on failure.
void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y,
GLint width, GLint height, GLenum format,
GLenum type, void* pixels);
This function queries the host for the pixel content of a colorBuffer's
subregion. It act the same as OpenGL glReadPixels however pixels
are always packed with alignment of 1.
void rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y,
GLint width, GLint height, GLenum format,
GLenum type, void* pixels);
Updates the content of a subregion of a colorBuffer object.
pixels are always unpacked with alignment of 1.
uint32_t rcCreateClientImage(uint32_t context, EGLenum target, GLuint buffer)
Create an EGLImage from a client object.
int rcDestroyClientImage(uint32_t image)
Destroy an EGLImage object.

View file

@ -0,0 +1,45 @@
GLOBAL
base_opcode 10000
encoder_headers <stdint.h> <EGL/egl.h> "glUtils.h"
rcGetEGLVersion
dir major out
len major sizeof(EGLint)
dir minor out
len minor sizeof(EGLint)
rcQueryEGLString
dir buffer out
len buffer bufferSize
rcGetGLString
dir buffer out
len buffer bufferSize
rcGetNumConfigs
dir numAttribs out
len numAttribs sizeof(uint32_t)
rcGetConfigs
dir buffer out
len buffer bufSize
rcChooseConfig
dir attribs in
len attribs attribs_size
dir configs out
var_flag configs nullAllowed
len configs configs_size*sizeof(uint32_t)
rcReadColorBuffer
dir pixels out
len pixels (((glUtilsPixelBitSize(format, type) * width) >> 3) * height)
rcUpdateColorBuffer
dir pixels in
len pixels (((glUtilsPixelBitSize(format, type) * width) >> 3) * height)
var_flag pixels isLarge
rcCloseColorBuffer
flag flushOnEncode

View file

@ -0,0 +1,35 @@
GL_ENRTY(GLint, rcGetRendererVersion)
GL_ENTRY(EGLint, rcGetEGLVersion, EGLint *major, EGLint *minor)
GL_ENTRY(EGLint, rcQueryEGLString, EGLenum name, void *buffer, EGLint bufferSize)
GL_ENTRY(EGLint, rcGetGLString, EGLenum name, void *buffer, EGLint bufferSize)
GL_ENTRY(EGLint, rcGetNumConfigs, uint32_t *numAttribs)
GL_ENTRY(EGLint, rcGetConfigs, uint32_t bufSize, GLuint *buffer)
GL_ENTRY(EGLint, rcChooseConfig, EGLint *attribs, uint32_t attribs_size, uint32_t *configs, uint32_t configs_size)
GL_ENTRY(EGLint, rcGetFBParam, EGLint param)
GL_ENTRY(uint32_t, rcCreateContext, uint32_t config, uint32_t share, uint32_t glVersion)
GL_ENTRY(void, rcDestroyContext, uint32_t context)
GL_ENTRY(uint32_t, rcCreateWindowSurface, uint32_t config, uint32_t width, uint32_t height)
GL_ENTRY(void, rcDestroyWindowSurface, uint32_t windowSurface)
GL_ENTRY(uint32_t, rcCreateColorBuffer, uint32_t width, uint32_t height, GLenum internalFormat)
GL_ENTRY(void, rcOpenColorBuffer, uint32_t colorbuffer)
GL_ENTRY(void, rcCloseColorBuffer, uint32_t colorbuffer)
GL_ENTRY(void, rcSetWindowColorBuffer, uint32_t windowSurface, uint32_t colorBuffer)
GL_ENTRY(int, rcFlushWindowColorBuffer, uint32_t windowSurface)
GL_ENTRY(EGLint, rcMakeCurrent, uint32_t context, uint32_t drawSurf, uint32_t readSurf)
GL_ENTRY(void, rcFBPost, uint32_t colorBuffer)
GL_ENTRY(void, rcFBSetSwapInterval, EGLint interval)
GL_ENTRY(void, rcBindTexture, uint32_t colorBuffer)
GL_ENTRY(void, rcBindRenderbuffer, uint32_t colorBuffer)
GL_ENTRY(EGLint, rcColorBufferCacheFlush, uint32_t colorbuffer, EGLint postCount,int forRead)
GL_ENTRY(void, rcReadColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
GL_ENTRY(int, rcUpdateColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
GL_ENTRY(int, rcOpenColorBuffer2, uint32_t colorbuffer)
GL_ENTRY(uint32_t, rcCreateClientImage, uint32_t context, EGLenum target, GLuint buffer)
GL_ENTRY(int, rcDestroyClientImage, uint32_t image)
GL_ENTRY(void, rcSelectChecksumHelper, uint32_t newProtocol, uint32_t reserved)
GL_ENTRY(int, rcGetNumDisplays)
GL_ENTRY(int, rcGetDisplayWidth, uint32_t displayId)
GL_ENTRY(int, rcGetDisplayHeight, uint32_t displayId)
GL_ENTRY(int, rcGetDisplayDpiX, uint32_t displayId)
GL_ENTRY(int, rcGetDisplayDpiY, uint32_t displayId)
GL_ENTRY(int, rcGetDisplayVsyncPeriod, uint32_t displayId)

View file

@ -0,0 +1,11 @@
uint32_t 32 0x%08x false
EGLint 32 0x%08x false
GLint 32 0x%08x false
GLuint 32 0x%08x false
GLenum 32 0x%08x false
EGLenum 32 0x%08x false
uint32_t* 32 0x%08x true
EGLint* 32 0x%08x true
GLint* 32 0x%08x true
GLuint* 32 0x%08x true
void* 32 0x%08x true

View file

@ -0,0 +1,41 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __renderControl_client_base_t_h
#define __renderControl_client_base_t_h
#include "renderControl_client_proc.h"
struct renderControl_client_base_t {
rcGetRendererVersion_client_proc_t rcGetRendererVersion;
rcGetEGLVersion_client_proc_t rcGetEGLVersion;
rcQueryEGLString_client_proc_t rcQueryEGLString;
rcGetGLString_client_proc_t rcGetGLString;
rcGetNumConfigs_client_proc_t rcGetNumConfigs;
rcGetConfigs_client_proc_t rcGetConfigs;
rcChooseConfig_client_proc_t rcChooseConfig;
rcGetFBParam_client_proc_t rcGetFBParam;
rcCreateContext_client_proc_t rcCreateContext;
rcDestroyContext_client_proc_t rcDestroyContext;
rcCreateWindowSurface_client_proc_t rcCreateWindowSurface;
rcDestroyWindowSurface_client_proc_t rcDestroyWindowSurface;
rcCreateColorBuffer_client_proc_t rcCreateColorBuffer;
rcOpenColorBuffer_client_proc_t rcOpenColorBuffer;
rcCloseColorBuffer_client_proc_t rcCloseColorBuffer;
rcSetWindowColorBuffer_client_proc_t rcSetWindowColorBuffer;
rcFlushWindowColorBuffer_client_proc_t rcFlushWindowColorBuffer;
rcMakeCurrent_client_proc_t rcMakeCurrent;
rcFBPost_client_proc_t rcFBPost;
rcFBSetSwapInterval_client_proc_t rcFBSetSwapInterval;
rcBindTexture_client_proc_t rcBindTexture;
rcBindRenderbuffer_client_proc_t rcBindRenderbuffer;
rcColorBufferCacheFlush_client_proc_t rcColorBufferCacheFlush;
rcReadColorBuffer_client_proc_t rcReadColorBuffer;
rcUpdateColorBuffer_client_proc_t rcUpdateColorBuffer;
rcOpenColorBuffer2_client_proc_t rcOpenColorBuffer2;
rcCreateClientImage_client_proc_t rcCreateClientImage;
rcDestroyClientImage_client_proc_t rcDestroyClientImage;
};
#endif

View file

@ -0,0 +1,52 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#include <string.h>
#include "renderControl_client_context.h"
#include <stdio.h>
int renderControl_client_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)
{
rcGetRendererVersion = (rcGetRendererVersion_client_proc_t) getProc("rcGetRendererVersion", userData);
rcGetEGLVersion = (rcGetEGLVersion_client_proc_t) getProc("rcGetEGLVersion", userData);
rcQueryEGLString = (rcQueryEGLString_client_proc_t) getProc("rcQueryEGLString", userData);
rcGetGLString = (rcGetGLString_client_proc_t) getProc("rcGetGLString", userData);
rcGetNumConfigs = (rcGetNumConfigs_client_proc_t) getProc("rcGetNumConfigs", userData);
rcGetConfigs = (rcGetConfigs_client_proc_t) getProc("rcGetConfigs", userData);
rcChooseConfig = (rcChooseConfig_client_proc_t) getProc("rcChooseConfig", userData);
rcGetFBParam = (rcGetFBParam_client_proc_t) getProc("rcGetFBParam", userData);
rcCreateContext = (rcCreateContext_client_proc_t) getProc("rcCreateContext", userData);
rcDestroyContext = (rcDestroyContext_client_proc_t) getProc("rcDestroyContext", userData);
rcCreateWindowSurface = (rcCreateWindowSurface_client_proc_t) getProc("rcCreateWindowSurface", userData);
rcDestroyWindowSurface = (rcDestroyWindowSurface_client_proc_t) getProc("rcDestroyWindowSurface", userData);
rcCreateColorBuffer = (rcCreateColorBuffer_client_proc_t) getProc("rcCreateColorBuffer", userData);
rcOpenColorBuffer = (rcOpenColorBuffer_client_proc_t) getProc("rcOpenColorBuffer", userData);
rcCloseColorBuffer = (rcCloseColorBuffer_client_proc_t) getProc("rcCloseColorBuffer", userData);
rcSetWindowColorBuffer = (rcSetWindowColorBuffer_client_proc_t) getProc("rcSetWindowColorBuffer", userData);
rcFlushWindowColorBuffer = (rcFlushWindowColorBuffer_client_proc_t) getProc("rcFlushWindowColorBuffer", userData);
rcMakeCurrent = (rcMakeCurrent_client_proc_t) getProc("rcMakeCurrent", userData);
rcFBPost = (rcFBPost_client_proc_t) getProc("rcFBPost", userData);
rcFBSetSwapInterval = (rcFBSetSwapInterval_client_proc_t) getProc("rcFBSetSwapInterval", userData);
rcBindTexture = (rcBindTexture_client_proc_t) getProc("rcBindTexture", userData);
rcBindRenderbuffer = (rcBindRenderbuffer_client_proc_t) getProc("rcBindRenderbuffer", userData);
rcColorBufferCacheFlush = (rcColorBufferCacheFlush_client_proc_t) getProc("rcColorBufferCacheFlush", userData);
rcReadColorBuffer = (rcReadColorBuffer_client_proc_t) getProc("rcReadColorBuffer", userData);
rcUpdateColorBuffer = (rcUpdateColorBuffer_client_proc_t) getProc("rcUpdateColorBuffer", userData);
rcOpenColorBuffer2 = (rcOpenColorBuffer2_client_proc_t) getProc("rcOpenColorBuffer2", userData);
rcCreateClientImage = (rcCreateClientImage_client_proc_t) getProc("rcCreateClientImage", userData);
rcDestroyClientImage = (rcDestroyClientImage_client_proc_t) getProc("rcDestroyClientImage", userData);
rcSelectChecksumCalculator = (rcSelectChecksumCalculator_client_proc_t) getProc("rcSelectChecksumCalculator", userData);
rcGetNumDisplays = (rcGetNumDisplays_client_proc_t) getProc("rcGetNumDisplays", userData);
rcGetDisplayWidth = (rcGetDisplayWidth_client_proc_t) getProc("rcGetDisplayWidth", userData);
rcGetDisplayHeight = (rcGetDisplayHeight_client_proc_t) getProc("rcGetDisplayHeight", userData);
rcGetDisplayDpiX = (rcGetDisplayDpiX_client_proc_t) getProc("rcGetDisplayDpiX", userData);
rcGetDisplayDpiY = (rcGetDisplayDpiY_client_proc_t) getProc("rcGetDisplayDpiY", userData);
rcGetDisplayVsyncPeriod = (rcGetDisplayVsyncPeriod_client_proc_t) getProc("rcGetDisplayVsyncPeriod", userData);
rcPostLayer = (rcPostLayer_client_proc_t) getProc("rcPostLayer", userData);
rcPostAllLayersDone = (rcPostAllLayersDone_client_proc_t) getProc("rcPostAllLayersDone", userData);
return 0;
}

View file

@ -0,0 +1,59 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __renderControl_client_context_t_h
#define __renderControl_client_context_t_h
#include "renderControl_client_proc.h"
#include "renderControl_types.h"
struct renderControl_client_context_t {
rcGetRendererVersion_client_proc_t rcGetRendererVersion;
rcGetEGLVersion_client_proc_t rcGetEGLVersion;
rcQueryEGLString_client_proc_t rcQueryEGLString;
rcGetGLString_client_proc_t rcGetGLString;
rcGetNumConfigs_client_proc_t rcGetNumConfigs;
rcGetConfigs_client_proc_t rcGetConfigs;
rcChooseConfig_client_proc_t rcChooseConfig;
rcGetFBParam_client_proc_t rcGetFBParam;
rcCreateContext_client_proc_t rcCreateContext;
rcDestroyContext_client_proc_t rcDestroyContext;
rcCreateWindowSurface_client_proc_t rcCreateWindowSurface;
rcDestroyWindowSurface_client_proc_t rcDestroyWindowSurface;
rcCreateColorBuffer_client_proc_t rcCreateColorBuffer;
rcOpenColorBuffer_client_proc_t rcOpenColorBuffer;
rcCloseColorBuffer_client_proc_t rcCloseColorBuffer;
rcSetWindowColorBuffer_client_proc_t rcSetWindowColorBuffer;
rcFlushWindowColorBuffer_client_proc_t rcFlushWindowColorBuffer;
rcMakeCurrent_client_proc_t rcMakeCurrent;
rcFBPost_client_proc_t rcFBPost;
rcFBSetSwapInterval_client_proc_t rcFBSetSwapInterval;
rcBindTexture_client_proc_t rcBindTexture;
rcBindRenderbuffer_client_proc_t rcBindRenderbuffer;
rcColorBufferCacheFlush_client_proc_t rcColorBufferCacheFlush;
rcReadColorBuffer_client_proc_t rcReadColorBuffer;
rcUpdateColorBuffer_client_proc_t rcUpdateColorBuffer;
rcOpenColorBuffer2_client_proc_t rcOpenColorBuffer2;
rcCreateClientImage_client_proc_t rcCreateClientImage;
rcDestroyClientImage_client_proc_t rcDestroyClientImage;
rcSelectChecksumCalculator_client_proc_t rcSelectChecksumCalculator;
rcGetNumDisplays_client_proc_t rcGetNumDisplays;
rcGetDisplayWidth_client_proc_t rcGetDisplayWidth;
rcGetDisplayHeight_client_proc_t rcGetDisplayHeight;
rcGetDisplayDpiX_client_proc_t rcGetDisplayDpiX;
rcGetDisplayDpiY_client_proc_t rcGetDisplayDpiY;
rcGetDisplayVsyncPeriod_client_proc_t rcGetDisplayVsyncPeriod;
rcPostLayer_client_proc_t rcPostLayer;
rcPostAllLayersDone_client_proc_t rcPostAllLayersDone;
virtual ~renderControl_client_context_t() {}
typedef renderControl_client_context_t *CONTEXT_ACCESSOR_TYPE(void);
static void setContextAccessor(CONTEXT_ACCESSOR_TYPE *f);
int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData);
virtual void setError(unsigned int error){ (void)error; };
virtual unsigned int getError(){ return 0; };
};
#endif

View file

@ -0,0 +1,52 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __renderControl_client_proc_t_h
#define __renderControl_client_proc_t_h
#include "renderControl_types.h"
#ifndef renderControl_APIENTRY
#define renderControl_APIENTRY
#endif
typedef GLint (renderControl_APIENTRY *rcGetRendererVersion_client_proc_t) (void * ctx);
typedef EGLint (renderControl_APIENTRY *rcGetEGLVersion_client_proc_t) (void * ctx, EGLint*, EGLint*);
typedef EGLint (renderControl_APIENTRY *rcQueryEGLString_client_proc_t) (void * ctx, EGLenum, void*, EGLint);
typedef EGLint (renderControl_APIENTRY *rcGetGLString_client_proc_t) (void * ctx, EGLenum, void*, EGLint);
typedef EGLint (renderControl_APIENTRY *rcGetNumConfigs_client_proc_t) (void * ctx, uint32_t*);
typedef EGLint (renderControl_APIENTRY *rcGetConfigs_client_proc_t) (void * ctx, uint32_t, GLuint*);
typedef EGLint (renderControl_APIENTRY *rcChooseConfig_client_proc_t) (void * ctx, EGLint*, uint32_t, uint32_t*, uint32_t);
typedef EGLint (renderControl_APIENTRY *rcGetFBParam_client_proc_t) (void * ctx, EGLint);
typedef uint32_t (renderControl_APIENTRY *rcCreateContext_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t);
typedef void (renderControl_APIENTRY *rcDestroyContext_client_proc_t) (void * ctx, uint32_t);
typedef uint32_t (renderControl_APIENTRY *rcCreateWindowSurface_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t);
typedef void (renderControl_APIENTRY *rcDestroyWindowSurface_client_proc_t) (void * ctx, uint32_t);
typedef uint32_t (renderControl_APIENTRY *rcCreateColorBuffer_client_proc_t) (void * ctx, uint32_t, uint32_t, GLenum);
typedef void (renderControl_APIENTRY *rcOpenColorBuffer_client_proc_t) (void * ctx, uint32_t);
typedef void (renderControl_APIENTRY *rcCloseColorBuffer_client_proc_t) (void * ctx, uint32_t);
typedef void (renderControl_APIENTRY *rcSetWindowColorBuffer_client_proc_t) (void * ctx, uint32_t, uint32_t);
typedef int (renderControl_APIENTRY *rcFlushWindowColorBuffer_client_proc_t) (void * ctx, uint32_t);
typedef EGLint (renderControl_APIENTRY *rcMakeCurrent_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t);
typedef void (renderControl_APIENTRY *rcFBPost_client_proc_t) (void * ctx, uint32_t);
typedef void (renderControl_APIENTRY *rcFBSetSwapInterval_client_proc_t) (void * ctx, EGLint);
typedef void (renderControl_APIENTRY *rcBindTexture_client_proc_t) (void * ctx, uint32_t);
typedef void (renderControl_APIENTRY *rcBindRenderbuffer_client_proc_t) (void * ctx, uint32_t);
typedef EGLint (renderControl_APIENTRY *rcColorBufferCacheFlush_client_proc_t) (void * ctx, uint32_t, EGLint, int);
typedef void (renderControl_APIENTRY *rcReadColorBuffer_client_proc_t) (void * ctx, uint32_t, GLint, GLint, GLint, GLint, GLenum, GLenum, void*);
typedef int (renderControl_APIENTRY *rcUpdateColorBuffer_client_proc_t) (void * ctx, uint32_t, GLint, GLint, GLint, GLint, GLenum, GLenum, void*);
typedef int (renderControl_APIENTRY *rcOpenColorBuffer2_client_proc_t) (void * ctx, uint32_t);
typedef uint32_t (renderControl_APIENTRY *rcCreateClientImage_client_proc_t) (void * ctx, uint32_t, EGLenum, GLuint);
typedef int (renderControl_APIENTRY *rcDestroyClientImage_client_proc_t) (void * ctx, uint32_t);
typedef void (renderControl_APIENTRY *rcSelectChecksumCalculator_client_proc_t) (void * ctx, uint32_t, uint32_t);
typedef int (renderControl_APIENTRY *rcGetNumDisplays_client_proc_t) (void * ctx);
typedef int (renderControl_APIENTRY *rcGetDisplayWidth_client_proc_t) (void * ctx, uint32_t);
typedef int (renderControl_APIENTRY *rcGetDisplayHeight_client_proc_t) (void * ctx, uint32_t);
typedef int (renderControl_APIENTRY *rcGetDisplayDpiX_client_proc_t) (void * ctx, uint32_t);
typedef int (renderControl_APIENTRY *rcGetDisplayDpiY_client_proc_t) (void * ctx, uint32_t);
typedef int (renderControl_APIENTRY *rcGetDisplayVsyncPeriod_client_proc_t) (void * ctx, uint32_t);
typedef void (renderControl_APIENTRY *rcPostLayer_client_proc_t) (void * ctx, const char*, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t);
typedef void (renderControl_APIENTRY *rcPostAllLayersDone_client_proc_t) (void * ctx);
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,24 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef GUARD_renderControl_encoder_context_t
#define GUARD_renderControl_encoder_context_t
#include "IOStream.h"
#include "ChecksumCalculator.h"
#include "renderControl_client_context.h"
#include <stdint.h>
#include <EGL/egl.h>
#include "glUtils.h"
struct renderControl_encoder_context_t : public renderControl_client_context_t {
IOStream *m_stream;
ChecksumCalculator *m_checksumCalculator;
renderControl_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator);
};
#endif // GUARD_renderControl_encoder_context_t

View file

@ -0,0 +1,276 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#include <stdio.h>
#include <stdlib.h>
#include "renderControl_client_context.h"
#ifndef GL_TRUE
extern "C" {
GLint rcGetRendererVersion();
EGLint rcGetEGLVersion(EGLint* major, EGLint* minor);
EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize);
EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize);
EGLint rcGetNumConfigs(uint32_t* numAttribs);
EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer);
EGLint rcChooseConfig(EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size);
EGLint rcGetFBParam(EGLint param);
uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion);
void rcDestroyContext(uint32_t context);
uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height);
void rcDestroyWindowSurface(uint32_t windowSurface);
uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat);
void rcOpenColorBuffer(uint32_t colorbuffer);
void rcCloseColorBuffer(uint32_t colorbuffer);
void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer);
int rcFlushWindowColorBuffer(uint32_t windowSurface);
EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf);
void rcFBPost(uint32_t colorBuffer);
void rcFBSetSwapInterval(EGLint interval);
void rcBindTexture(uint32_t colorBuffer);
void rcBindRenderbuffer(uint32_t colorBuffer);
EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead);
void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels);
int rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels);
int rcOpenColorBuffer2(uint32_t colorbuffer);
uint32_t rcCreateClientImage(uint32_t context, EGLenum target, GLuint buffer);
int rcDestroyClientImage(uint32_t image);
void rcSelectChecksumCalculator(uint32_t newProtocol, uint32_t reserved);
int rcGetNumDisplays();
int rcGetDisplayWidth(uint32_t displayId);
int rcGetDisplayHeight(uint32_t displayId);
int rcGetDisplayDpiX(uint32_t displayId);
int rcGetDisplayDpiY(uint32_t displayId);
int rcGetDisplayVsyncPeriod(uint32_t displayId);
void rcPostLayer(const char* name, uint32_t colorBuffer, int32_t sourceCropLeft, int32_t sourceCropTop, int32_t sourceCropRight, int32_t sourceCropBottom, int32_t displayFrameLeft, int32_t displayFrameTop, int32_t displayFrameRight, int32_t displayFrameBottom);
void rcPostAllLayersDone();
};
#endif
#ifndef GET_CONTEXT
static renderControl_client_context_t::CONTEXT_ACCESSOR_TYPE *getCurrentContext = NULL;
void renderControl_client_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; }
#define GET_CONTEXT renderControl_client_context_t * ctx = getCurrentContext()
#endif
GLint rcGetRendererVersion()
{
GET_CONTEXT;
return ctx->rcGetRendererVersion(ctx);
}
EGLint rcGetEGLVersion(EGLint* major, EGLint* minor)
{
GET_CONTEXT;
return ctx->rcGetEGLVersion(ctx, major, minor);
}
EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize)
{
GET_CONTEXT;
return ctx->rcQueryEGLString(ctx, name, buffer, bufferSize);
}
EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize)
{
GET_CONTEXT;
return ctx->rcGetGLString(ctx, name, buffer, bufferSize);
}
EGLint rcGetNumConfigs(uint32_t* numAttribs)
{
GET_CONTEXT;
return ctx->rcGetNumConfigs(ctx, numAttribs);
}
EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer)
{
GET_CONTEXT;
return ctx->rcGetConfigs(ctx, bufSize, buffer);
}
EGLint rcChooseConfig(EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size)
{
GET_CONTEXT;
return ctx->rcChooseConfig(ctx, attribs, attribs_size, configs, configs_size);
}
EGLint rcGetFBParam(EGLint param)
{
GET_CONTEXT;
return ctx->rcGetFBParam(ctx, param);
}
uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion)
{
GET_CONTEXT;
return ctx->rcCreateContext(ctx, config, share, glVersion);
}
void rcDestroyContext(uint32_t context)
{
GET_CONTEXT;
ctx->rcDestroyContext(ctx, context);
}
uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height)
{
GET_CONTEXT;
return ctx->rcCreateWindowSurface(ctx, config, width, height);
}
void rcDestroyWindowSurface(uint32_t windowSurface)
{
GET_CONTEXT;
ctx->rcDestroyWindowSurface(ctx, windowSurface);
}
uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat)
{
GET_CONTEXT;
return ctx->rcCreateColorBuffer(ctx, width, height, internalFormat);
}
void rcOpenColorBuffer(uint32_t colorbuffer)
{
GET_CONTEXT;
ctx->rcOpenColorBuffer(ctx, colorbuffer);
}
void rcCloseColorBuffer(uint32_t colorbuffer)
{
GET_CONTEXT;
ctx->rcCloseColorBuffer(ctx, colorbuffer);
}
void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer)
{
GET_CONTEXT;
ctx->rcSetWindowColorBuffer(ctx, windowSurface, colorBuffer);
}
int rcFlushWindowColorBuffer(uint32_t windowSurface)
{
GET_CONTEXT;
return ctx->rcFlushWindowColorBuffer(ctx, windowSurface);
}
EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf)
{
GET_CONTEXT;
return ctx->rcMakeCurrent(ctx, context, drawSurf, readSurf);
}
void rcFBPost(uint32_t colorBuffer)
{
GET_CONTEXT;
ctx->rcFBPost(ctx, colorBuffer);
}
void rcFBSetSwapInterval(EGLint interval)
{
GET_CONTEXT;
ctx->rcFBSetSwapInterval(ctx, interval);
}
void rcBindTexture(uint32_t colorBuffer)
{
GET_CONTEXT;
ctx->rcBindTexture(ctx, colorBuffer);
}
void rcBindRenderbuffer(uint32_t colorBuffer)
{
GET_CONTEXT;
ctx->rcBindRenderbuffer(ctx, colorBuffer);
}
EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead)
{
GET_CONTEXT;
return ctx->rcColorBufferCacheFlush(ctx, colorbuffer, postCount, forRead);
}
void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels)
{
GET_CONTEXT;
ctx->rcReadColorBuffer(ctx, colorbuffer, x, y, width, height, format, type, pixels);
}
int rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels)
{
GET_CONTEXT;
return ctx->rcUpdateColorBuffer(ctx, colorbuffer, x, y, width, height, format, type, pixels);
}
int rcOpenColorBuffer2(uint32_t colorbuffer)
{
GET_CONTEXT;
return ctx->rcOpenColorBuffer2(ctx, colorbuffer);
}
uint32_t rcCreateClientImage(uint32_t context, EGLenum target, GLuint buffer)
{
GET_CONTEXT;
return ctx->rcCreateClientImage(ctx, context, target, buffer);
}
int rcDestroyClientImage(uint32_t image)
{
GET_CONTEXT;
return ctx->rcDestroyClientImage(ctx, image);
}
void rcSelectChecksumCalculator(uint32_t newProtocol, uint32_t reserved)
{
GET_CONTEXT;
ctx->rcSelectChecksumCalculator(ctx, newProtocol, reserved);
}
int rcGetNumDisplays()
{
GET_CONTEXT;
return ctx->rcGetNumDisplays(ctx);
}
int rcGetDisplayWidth(uint32_t displayId)
{
GET_CONTEXT;
return ctx->rcGetDisplayWidth(ctx, displayId);
}
int rcGetDisplayHeight(uint32_t displayId)
{
GET_CONTEXT;
return ctx->rcGetDisplayHeight(ctx, displayId);
}
int rcGetDisplayDpiX(uint32_t displayId)
{
GET_CONTEXT;
return ctx->rcGetDisplayDpiX(ctx, displayId);
}
int rcGetDisplayDpiY(uint32_t displayId)
{
GET_CONTEXT;
return ctx->rcGetDisplayDpiY(ctx, displayId);
}
int rcGetDisplayVsyncPeriod(uint32_t displayId)
{
GET_CONTEXT;
return ctx->rcGetDisplayVsyncPeriod(ctx, displayId);
}
void rcPostLayer(const char* name, uint32_t colorBuffer, int32_t sourceCropLeft, int32_t sourceCropTop, int32_t sourceCropRight, int32_t sourceCropBottom, int32_t displayFrameLeft, int32_t displayFrameTop, int32_t displayFrameRight, int32_t displayFrameBottom)
{
GET_CONTEXT;
ctx->rcPostLayer(ctx, name, colorBuffer, sourceCropLeft, sourceCropTop, sourceCropRight, sourceCropBottom, displayFrameLeft, displayFrameTop, displayFrameRight, displayFrameBottom);
}
void rcPostAllLayersDone()
{
GET_CONTEXT;
ctx->rcPostAllLayersDone(ctx);
}

View file

@ -0,0 +1,52 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __renderControl_client_ftable_t_h
#define __renderControl_client_ftable_t_h
static const struct _renderControl_funcs_by_name {
const char *name;
void *proc;
} renderControl_funcs_by_name[] = {
{"rcGetRendererVersion", (void*)rcGetRendererVersion},
{"rcGetEGLVersion", (void*)rcGetEGLVersion},
{"rcQueryEGLString", (void*)rcQueryEGLString},
{"rcGetGLString", (void*)rcGetGLString},
{"rcGetNumConfigs", (void*)rcGetNumConfigs},
{"rcGetConfigs", (void*)rcGetConfigs},
{"rcChooseConfig", (void*)rcChooseConfig},
{"rcGetFBParam", (void*)rcGetFBParam},
{"rcCreateContext", (void*)rcCreateContext},
{"rcDestroyContext", (void*)rcDestroyContext},
{"rcCreateWindowSurface", (void*)rcCreateWindowSurface},
{"rcDestroyWindowSurface", (void*)rcDestroyWindowSurface},
{"rcCreateColorBuffer", (void*)rcCreateColorBuffer},
{"rcOpenColorBuffer", (void*)rcOpenColorBuffer},
{"rcCloseColorBuffer", (void*)rcCloseColorBuffer},
{"rcSetWindowColorBuffer", (void*)rcSetWindowColorBuffer},
{"rcFlushWindowColorBuffer", (void*)rcFlushWindowColorBuffer},
{"rcMakeCurrent", (void*)rcMakeCurrent},
{"rcFBPost", (void*)rcFBPost},
{"rcFBSetSwapInterval", (void*)rcFBSetSwapInterval},
{"rcBindTexture", (void*)rcBindTexture},
{"rcBindRenderbuffer", (void*)rcBindRenderbuffer},
{"rcColorBufferCacheFlush", (void*)rcColorBufferCacheFlush},
{"rcReadColorBuffer", (void*)rcReadColorBuffer},
{"rcUpdateColorBuffer", (void*)rcUpdateColorBuffer},
{"rcOpenColorBuffer2", (void*)rcOpenColorBuffer2},
{"rcCreateClientImage", (void*)rcCreateClientImage},
{"rcDestroyClientImage", (void*)rcDestroyClientImage},
{"rcSelectChecksumCalculator", (void*)rcSelectChecksumCalculator},
{"rcGetNumDisplays", (void*)rcGetNumDisplays},
{"rcGetDisplayWidth", (void*)rcGetDisplayWidth},
{"rcGetDisplayHeight", (void*)rcGetDisplayHeight},
{"rcGetDisplayDpiX", (void*)rcGetDisplayDpiX},
{"rcGetDisplayDpiY", (void*)rcGetDisplayDpiY},
{"rcGetDisplayVsyncPeriod", (void*)rcGetDisplayVsyncPeriod},
{"rcPostLayer", (void*)rcPostLayer},
{"rcPostAllLayersDone", (void*)rcPostAllLayersDone},
};
static const int renderControl_num_funcs = sizeof(renderControl_funcs_by_name) / sizeof(struct _renderControl_funcs_by_name);
#endif

View file

@ -0,0 +1,46 @@
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#ifndef __GUARD_renderControl_opcodes_h_
#define __GUARD_renderControl_opcodes_h_
#define OP_rcGetRendererVersion 10000
#define OP_rcGetEGLVersion 10001
#define OP_rcQueryEGLString 10002
#define OP_rcGetGLString 10003
#define OP_rcGetNumConfigs 10004
#define OP_rcGetConfigs 10005
#define OP_rcChooseConfig 10006
#define OP_rcGetFBParam 10007
#define OP_rcCreateContext 10008
#define OP_rcDestroyContext 10009
#define OP_rcCreateWindowSurface 10010
#define OP_rcDestroyWindowSurface 10011
#define OP_rcCreateColorBuffer 10012
#define OP_rcOpenColorBuffer 10013
#define OP_rcCloseColorBuffer 10014
#define OP_rcSetWindowColorBuffer 10015
#define OP_rcFlushWindowColorBuffer 10016
#define OP_rcMakeCurrent 10017
#define OP_rcFBPost 10018
#define OP_rcFBSetSwapInterval 10019
#define OP_rcBindTexture 10020
#define OP_rcBindRenderbuffer 10021
#define OP_rcColorBufferCacheFlush 10022
#define OP_rcReadColorBuffer 10023
#define OP_rcUpdateColorBuffer 10024
#define OP_rcOpenColorBuffer2 10025
#define OP_rcCreateClientImage 10026
#define OP_rcDestroyClientImage 10027
#define OP_rcSelectChecksumCalculator 10028
#define OP_rcGetNumDisplays 10029
#define OP_rcGetDisplayWidth 10030
#define OP_rcGetDisplayHeight 10031
#define OP_rcGetDisplayDpiX 10032
#define OP_rcGetDisplayDpiY 10033
#define OP_rcGetDisplayVsyncPeriod 10034
#define OP_rcPostLayer 10035
#define OP_rcPostAllLayersDone 10036
#define OP_last 10037
#endif

View file

@ -0,0 +1,28 @@
/*
* 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 <stdint.h>
#include <EGL/egl.h>
#include "glUtils.h"
// values for 'param' argument of rcGetFBParam
#define FB_WIDTH 1
#define FB_HEIGHT 2
#define FB_XDPI 3
#define FB_YDPI 4
#define FB_FPS 5
#define FB_MIN_SWAP_INTERVAL 6
#define FB_MAX_SWAP_INTERVAL 7

View file

@ -0,0 +1,74 @@
LOCAL_PATH := $(call my-dir)
#### libGLESv1_CM_emul.so
$(call emugl-begin-shared-library,libGLESv1_CM_emul)
$(call emugl-import,libGLESv1_enc)
$(call emugl-gen-wrapper,$(EMUGL_PATH)/system/GLESv1_enc,gl)
$(call emugl-set-shared-library-subpath,egl)
LOCAL_SRC_FILES += glesv1_emul_ifc.cpp
$(call emugl-end-module)
emulatorOpengl := $(LOCAL_PATH)/../..
logTag := -DLOG_TAG=\"eglWrapper\"
EMUGEN = $(BUILD_OUT_EXECUTABLES)/emugen
## comment for no debug
#debugFlags = -g -O0
#### libGLESv2_CM_emul.so
$(call emugl-begin-shared-library, libGLESv2_emul)
$(call emugl-import,libGLESv2_enc)
$(call emugl-gen-wrapper,$(EMUGL_PATH)/system/GLESv2_enc,gl2)
LOCAL_SRC_FILES += glesv2_emul_ifc.cpp
$(call emugl-set-shared-library-subpath,egl)
$(call emugl-end-module)
##### libEGL_emul.so ###########
# THE FOLLOWING DOESN'T WORK YET
#
$(call emugl-begin-shared-library,libEGL_emul)
$(call emugl-import,libut_rendercontrol_enc libGLESv1_CM_emul libGLESv2_emul libOpenglSystemCommon)
$(call emugl-set-shared-library-subpath,egl)
LOCAL_CFLAGS += $(logTag)
LOCAL_SRC_FILES := \
egl.cpp \
egl_dispatch.cpp \
ServerConnection.cpp \
ThreadInfo.cpp
$(call emugl-end-module)
#### egl.cfg ####
# Ensure that this file is only copied to emulator-specific builds.
# Other builds are device-specific and will provide their own
# version of this file to point to the appropriate HW EGL libraries.
#
ifneq (,$(filter full full_x86 full_mips sdk sdk_x86 sdk_mips,$(TARGET_PRODUCT)))
ifeq (,$(BUILD_EMULATOR_OPENGL_DRIVER))
include $(CLEAR_VARS)
LOCAL_MODULE := egl.cfg
LOCAL_SRC_FILES := $(LOCAL_MODULE)
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl
LOCAL_MODULE_CLASS := ETC
include $(BUILD_PREBUILT)
endif # building 'real' driver BUILD_EMULATOR_OPENGL_DRIVER
endif # TARGET_PRODUCT in 'full sdk full_x86 sdk_x86 full_mips sdk_mips'
#### gles_emul.cfg ####
include $(CLEAR_VARS)
LOCAL_MODULE := gles_emul.cfg
LOCAL_SRC_FILES := $(LOCAL_MODULE)
LOCAL_MODULE_PATH := $(TARGET_OUT)/etc
LOCAL_MODULE_CLASS := ETC
include $(BUILD_PREBUILT)

View file

@ -0,0 +1,42 @@
/*
* 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 _API_INITIALIZER_H_
#define _API_INITIALIZER_H_
#include <stdlib.h>
#include <dlfcn.h>
class ApiInitializer {
public:
ApiInitializer(void *dso) :
m_dso(dso) {
}
static void *s_getProc(const char *name, void *userData) {
ApiInitializer *self = (ApiInitializer *)userData;
return self->getProc(name);
}
private:
void *m_dso;
void *getProc(const char *name) {
void *symbol = NULL;
if (m_dso) {
symbol = dlsym(m_dso, name);
}
return symbol;
}
};
#endif

View file

@ -0,0 +1,50 @@
# Copyright (C) 2007 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.
#
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/SHARED_LIBRARIES/libGLES_emul_intermediates)

View file

@ -0,0 +1,125 @@
/*
* 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 <stdio.h>
#include <stdlib.h>
#include "ServerConnection.h"
#include "TcpStream.h"
#include "QemuPipeStream.h"
#include <cutils/log.h>
#include "ThreadInfo.h"
gl_client_context_t *ServerConnection::s_getGlContext()
{
EGLThreadInfo *ti = getEGLThreadInfo();
if (ti->serverConn) {
return ti->serverConn->m_glEnc;
}
return NULL;
}
gl2_client_context_t *ServerConnection::s_getGl2Context()
{
EGLThreadInfo *ti = getEGLThreadInfo();
if (ti->serverConn) {
return ti->serverConn->m_gl2Enc;
}
return NULL;
}
ServerConnection *ServerConnection::s_getServerConnection()
{
EGLThreadInfo *ti = getEGLThreadInfo();
if (!ti->serverConn)
{
ti->serverConn = new ServerConnection();
if (ti->serverConn->create() < 0) {
delete ti->serverConn;
ti->serverConn = NULL;
}
}
return ti->serverConn;
}
ServerConnection::ServerConnection() :
m_stream(NULL),
m_glEnc(NULL),
m_ut_enc(NULL)
{
}
ServerConnection::~ServerConnection()
{
delete m_ut_enc;
delete m_glEnc;
delete m_stream;
}
int ServerConnection::create(size_t bufsize,
const char *defaultServer)
{
/* XXX: Make configurable through system property */
int useQemuPipe = 1;
if (m_stream != NULL) delete(m_stream);
if (useQemuPipe) {
QemuPipeStream* pipeStream = new QemuPipeStream(bufsize);
if (pipeStream->connect() < 0) {
ALOGE("couldn't connect to host server\n");
delete pipeStream;
return -1;
}
m_stream = pipeStream;
}
else /* !useQemuPipe */
{
TcpStream* tcpStream = new TcpStream(bufsize);
char *s = getenv(ENV_RGL_SERVER);
char *hostname;
if (s == NULL) {
hostname = strdup(defaultServer);
} else {
hostname = strdup(s);
}
if (tcpStream->connect(hostname, CODEC_SERVER_PORT) < 0) {
ALOGE("couldn't connect to %s\n", hostname);
free(hostname);
delete tcpStream;
return -1;
}
LOGI("connecting to server %s\n", hostname);
free(hostname);
m_stream = tcpStream;
}
m_glEnc = new GLEncoder(m_stream);
m_glEnc->setContextAccessor(s_getGlContext);
m_gl2Enc = new GL2Encoder(m_stream);
m_gl2Enc->setContextAccessor(s_getGl2Context);
m_ut_enc = new ut_rendercontrol_encoder_context_t(m_stream);
return 0;
}

View file

@ -0,0 +1,55 @@
/*
* 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 _SERVER_CONNECTION_H
#define _SERVER_CONNECTION_H
#include "GLEncoder.h"
#include "GL2Encoder.h"
#include "IOStream.h"
#include "codec_defs.h"
#include "ut_rendercontrol_enc.h"
#include <pthread.h>
#define ENV_RGL_SERVER "RGL_SERVER"
#define RGL_DEFAULT_SERVER "10.0.2.2"
class ServerConnection {
public:
~ServerConnection();
int create(size_t buf_size = 4 * 1024 * 1024, const char *defaultServer = RGL_DEFAULT_SERVER);
static gl_client_context_t *s_getGlContext();
static ServerConnection *s_getServerConnection();
static gl2_client_context_t *s_getGl2Context();
GLEncoder *glEncoder() { return m_glEnc; }
GL2Encoder *gl2Encoder() { return m_gl2Enc; }
ut_rendercontrol_encoder_context_t * utEnc() { return m_ut_enc; }
private:
ServerConnection();
private:
static pthread_key_t s_glKey;
static pthread_key_t s_connectionKey;
static void s_initKeys();
IOStream *m_stream;
GLEncoder *m_glEnc;
GL2Encoder *m_gl2Enc;
ut_rendercontrol_encoder_context_t *m_ut_enc;
};
#endif

View 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 "ThreadInfo.h"
#include "cutils/threads.h"
thread_store_t s_tls = THREAD_STORE_INITIALIZER;
static void tlsDestruct(void *ptr)
{
if (ptr) {
EGLThreadInfo *ti = (EGLThreadInfo *)ptr;
delete ti->serverConn;
delete ti;
}
}
EGLThreadInfo *getEGLThreadInfo()
{
EGLThreadInfo *ti = (EGLThreadInfo *)thread_store_get(&s_tls);
if (ti) return ti;
ti = new EGLThreadInfo();
thread_store_set(&s_tls, ti, tlsDestruct);
return ti;
}

View 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.
*/
#ifndef _THREAD_INFO_H
#define _THREAD_INFO_H
#include "ServerConnection.h"
#include <EGL/egl.h>
struct EGLWrapperContext
{
EGLWrapperContext(EGLContext p_aglContext, int _version) {
aglContext = p_aglContext;
clientState = NULL;
version = _version;
}
~EGLWrapperContext() {
delete clientState;
}
EGLContext aglContext;
GLClientState *clientState;
int version;
};
struct EGLThreadInfo
{
EGLThreadInfo() : currentContext(NULL), serverConn(NULL) {}
EGLWrapperContext *currentContext;
ServerConnection *serverConn;
};
EGLThreadInfo *getEGLThreadInfo();
#endif

View file

@ -0,0 +1 @@
0 0 emul

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