Move emulator GLES from development.git to sdk.git

The emulator GLES support has two interfaces: a host shared library
interface used by QEMU, and a protocol between the platform and the
host. The host library interface is not versioned; QEMU and the GLES
renderer must match. The protocol on the other hand must be backwards
compatible: a new GLES renderer must support an older platform image.

Thus for branching purposes it makes more sense to put the GLES
renderer in sdk.git, which is branched along with qemu.git for SDK
releases. Platform images will be built against the protocol version
in the platform branch of sdk.git.

Change-Id: Ie73fce12815c9740e27d0f56caa53c6ceb3d30cc
This commit is contained in:
Jesse Hall
2012-04-18 06:25:38 -07:00
committed by Jean-Baptiste Queru
parent 46ead86b02
commit 80d4ba7716
315 changed files with 0 additions and 56386 deletions

View File

@@ -37,7 +37,6 @@ subdirs += \
development/host \ development/host \
development/tools/etc1tool \ development/tools/etc1tool \
development/tools/line_endings \ development/tools/line_endings \
development/tools/emulator/opengl \
external/clang \ external/clang \
external/easymock \ external/easymock \
external/expat \ external/expat \

View File

@@ -1,94 +0,0 @@
# 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.
#
# First, build the emugen host source-generation tool
#
# It will be used by other modules to generate wire protocol encode/decoder
# source files (see all emugl-gen-decoder/encoder in common.mk)
#
include $(EMUGL_PATH)/host/tools/emugen/Android.mk
include $(EMUGL_PATH)/shared/OpenglOsUtils/Android.mk
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
# Host static libraries
include $(EMUGL_PATH)/host/libs/GLESv1_dec/Android.mk
include $(EMUGL_PATH)/host/libs/GLESv2_dec/Android.mk
include $(EMUGL_PATH)/host/libs/renderControl_dec/Android.mk
include $(EMUGL_PATH)/tests/ut_rendercontrol_dec/Android.mk
include $(EMUGL_PATH)/host/libs/Translator/GLcommon/Android.mk
include $(EMUGL_PATH)/host/libs/Translator/GLES_CM/Android.mk
include $(EMUGL_PATH)/host/libs/Translator/GLES_V2/Android.mk
include $(EMUGL_PATH)/host/libs/Translator/EGL/Android.mk
# Host shared libraries
include $(EMUGL_PATH)/host/libs/libOpenglRender/Android.mk
# Host executables
include $(EMUGL_PATH)/host/renderer/Android.mk
# Host unit-test for the renderer.
include $(EMUGL_PATH)/tests/translator_tests/MacCommon/Android.mk
include $(EMUGL_PATH)/tests/translator_tests/GLES_CM/Android.mk
include $(EMUGL_PATH)/tests/translator_tests/GLES_V2/Android.mk
endif # BUILD_EMULATOR_OPENGL == true

View File

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

View File

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

View File

@@ -1,341 +0,0 @@
# 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)
emugl-begin-host-static-library = $(call emugl-begin-module,$1,HOST_STATIC_LIBRARY,HOST)
emugl-begin-host-shared-library = $(call emugl-begin-module,$1,HOST_SHARED_LIBRARY,HOST)
emugl-begin-host-executable = $(call emugl-begin-module,$1,HOST_EXECUTABLE,HOST)
# Internal list of all declared modules (used for sanity checking)
_emugl_modules :=
_emugl_HOST_modules :=
# do not use directly, see functions above instead
emugl-begin-module = \
$(eval include $(CLEAR_VARS)) \
$(eval LOCAL_MODULE := $1) \
$(eval LOCAL_MODULE_TAGS := debug) \
$(eval LOCAL_MODULE_CLASS := $(patsubst HOST_%,%,$(patsubst %EXECUTABLE,%EXECUTABLES,$(patsubst %LIBRARY,%LIBRARIES,$2)))) \
$(eval LOCAL_IS_HOST_MODULE := $(if $3,true,))\
$(eval LOCAL_C_INCLUDES := $(EMUGL_COMMON_INCLUDES)) \
$(eval LOCAL_CFLAGS := $(EMUGL_COMMON_CFLAGS)) \
$(eval LOCAL_PRELINK_MODULE := false)\
$(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 decoder source files.
# LOCAL_MODULE and LOCAL_MODULE_CLASS must be defined or the build will abort.
# Source files will be stored in the local intermediates directory that will
# be automatically added to your LOCAL_C_INCLUDES.
#
# Usage:
# $(call emugl-gen-decoder,<input-dir>,<basename>)
#
emugl-gen-decoder = \
$(eval _emugl_out := $(call local-intermediates-dir))\
$(call emugl-gen-decoder-generic,$(_emugl_out),$1,$2)\
$(call emugl-export,C_INCLUDES,$(_emugl_out))
# This function can be called to generate the encoder 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-encoder,<input-dir>,<basename>)
#
emugl-gen-encoder = \
$(eval _emugl_out := $(call local-intermediates-dir)) \
$(call emugl-gen-encoder-generic,$(_emugl_out),$1,$2) \
$(call emugl-export,C_INCLUDES,$(_emugl_out))
# 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))
# IMPORTANT: EMUGL_EMUGEN is defined under host/tools/emugen/Android.mk
#
# DO NOT CALL DIRECTLY, USE emugl-gen-decoder instead.
#
# The following function can be called to generate wire protocol decoder
# source files, Usage is:
#
# $(call emugl-gen-decoder-generic,<dst-dir>,<src-dir>,<basename>)
#
# <dst-dir> is the destination directory where the generated sources are stored
# <src-dir> is the source directory where to find <basename>.attrib, etc..
# <basename> is the emugen basename (see host/tools/emugen/README)
#
emugl-gen-decoder-generic = $(eval $(emugl-gen-decoder-generic-ev))
define emugl-gen-decoder-generic-ev
_emugl_dec := $$1/$$3
_emugl_src := $$2/$$3
GEN := $$(_emugl_dec)_dec.cpp \
$$(_emugl_dec)_dec.h \
$$(_emugl_dec)_opcodes.h \
$$(_emugl_dec)_server_context.h \
$$(_emugl_dec)_server_context.cpp
$$(GEN): PRIVATE_PATH := $$(LOCAL_PATH)
$$(GEN): PRIVATE_CUSTOM_TOOL := $$(EMUGL_EMUGEN) -D $$1 -i $$2 $$3
$$(GEN): $$(EMUGL_EMUGEN) $$(_emugl_src).attrib $$(_emugl_src).in $$(_emugl_src).types
$$(transform-generated-source)
$$(call emugl-export,ADDITIONAL_DEPENDENCIES,$$(GEN))
LOCAL_GENERATED_SOURCES += $$(GEN)
LOCAL_C_INCLUDES += $$1
endef
# DO NOT CALL DIRECTLY, USE emugl-gen-encoder instead.
#
# The following function can be called to generate wire protocol encoder
# source files, Usage is:
#
# $(call emugl-gen-encoder-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-encoder-generic = $(eval $(emugl-gen-encoder-generic-ev))
define emugl-gen-encoder-generic-ev
_emugl_enc := $$1/$$3
_emugl_src := $$2/$$3
GEN := $$(_emugl_enc)_entry.cpp \
$$(_emugl_enc)_enc.cpp \
$$(_emugl_enc)_enc.h \
$$(_emugl_enc)_ftable.h \
$$(_emugl_enc)_opcodes.h \
$$(_emugl_enc)_client_context.h \
$$(_emugl_enc)_client_context.cpp
$$(GEN): PRIVATE_PATH := $$(LOCAL_PATH)
$$(GEN): PRIVATE_CUSTOM_TOOL := $$(EMUGL_EMUGEN) -E $$1 -i $$2 $$3
$$(GEN): $$(EMUGL_EMUGEN) $$(_emugl_src).attrib $$(_emugl_src).in $$(_emugl_src).types
$$(transform-generated-source)
$$(call emugl-export,ADDITIONAL_DEPENDENCIES,$$(GEN))
LOCAL_GENERATED_SOURCES += $$(GEN)
LOCAL_C_INCLUDES += $$1
endef
# 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_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/$1)\
$(eval LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/$1)\
$(eval _emugl.$(LOCAL_MODULE).moved := true)\
$(call emugl-export-outer,ADDITIONAL_DEPENDENCIES,$(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)$(TARGET_SHLIB_SUFFIX))

View File

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

@@ -1,136 +0,0 @@
/*
* 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 _OPENGL_RENDERER_RENDER_API_H
#define _OPENGL_RENDERER_RENDER_API_H
#ifdef __cplusplus
extern "C" {
#endif
#include "render_api_platform_types.h"
/* If a function with this signature is passed to initOpenGLRenderer(),
* it will be called by the renderer just before each new frame is displayed,
* providing a copy of the framebuffer contents.
*
* The callback will be called from one of the renderer's threads, so will
* probably need synchronization on any data structures it modifies. The
* pixels buffer may be overwritten as soon as the callback returns; if it needs
* the pixels afterwards it must copy them.
*
* The pixels buffer is intentionally not const: the callback may modify the
* data without copying to another buffer if it wants, e.g. in-place RGBA to RGB
* conversion, or in-place y-inversion.
*
* Parameters are:
* context The pointer optionally provided when the callback was
* registered. The client can use this to pass whatever
* information it wants to the callback.
* width, height Dimensions of the image, in pixels. Rows are tightly packed;
* there is no inter-row padding.
* ydir Indicates row order: 1 means top-to-bottom order, -1 means
* bottom-to-top order.
* format, type Format and type GL enums, as used in glTexImage2D() or
* glReadPixels(), describing the pixel format.
* pixels The framebuffer image.
*
* In the first implementation, ydir is always -1 (bottom to top), format and
* type are always GL_RGBA and GL_UNSIGNED_BYTE, and the width and height will
* always be the same as the ones passed to initOpenGLRenderer().
*/
typedef void (*OnPostFn)(void* context, int width, int height, int ydir,
int format, int type, unsigned char* pixels);
// initLibrary - initialize the library and tries to load the corresponding
// GLES translator libraries. This function must be called before anything
// else to ensure that everything works. If it returns an error, then
// you cannot use the library at all (this can happen under certain
// environments where the desktop GL libraries are not available)
//
// returns true if the library could be initialized successfully;
//
bool initLibrary(void);
// list of constants to be passed to setStreamMode, which determines
// which
#define STREAM_MODE_DEFAULT 0
#define STREAM_MODE_TCP 1
#define STREAM_MODE_UNIX 2
#define STREAM_MODE_PIPE 3
// Change the stream mode. This must be called before initOpenGLRenderer
int setStreamMode(int mode);
//
// initOpenGLRenderer - initialize the OpenGL renderer process.
// portNum is the tcp port number the renderer is listening to.
// width and height are the framebuffer dimensions that will be
// reported to the guest display driver.
//
// returns true if renderer has been started successfully;
//
// This function is *NOT* thread safe and should be called first
// to initialize the renderer after initLibrary().
//
bool initOpenGLRenderer(int width, int height, int portNum,
OnPostFn onPost, void* onPostContext);
//
// createOpenGLSubwindow -
// Create a native subwindow which is a child of 'window'
// to be used for framebuffer display.
// Framebuffer will not get displayed if a subwindow is not
// created.
// x,y,width,height are the dimensions of the rendering subwindow.
// zRot is the rotation to apply on the framebuffer display image.
//
bool createOpenGLSubwindow(FBNativeWindowType window,
int x, int y, int width, int height, float zRot);
//
// destroyOpenGLSubwindow -
// destroys the created native subwindow. Once destroyed,
// Framebuffer content will not be visible until a new
// subwindow will be created.
//
bool destroyOpenGLSubwindow();
//
// setOpenGLDisplayRotation -
// set the framebuffer display image rotation in units
// of degrees around the z axis
//
void setOpenGLDisplayRotation(float zRot);
//
// repaintOpenGLDisplay -
// causes the OpenGL subwindow to get repainted with the
// latest framebuffer content.
//
void repaintOpenGLDisplay();
//
// stopOpenGLRenderer - stops the OpenGL renderer process.
// This functions is *NOT* thread safe and should be called
// only if previous initOpenGLRenderer has returned true.
//
bool stopOpenGLRenderer();
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,25 +0,0 @@
#ifndef _RENDER_API_PLATFORM_TYPES_H
#define _RENDER_API_PLATFORM_TYPES_H
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
#include <windows.h>
typedef HDC FBNativeDisplayType;
typedef HWND FBNativeWindowType;
#elif defined(__linux__)
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Window FBNativeWindowType;
#elif defined(__APPLE__)
typedef void* FBNativeWindowType;
#else
#warning "Unsupported platform"
#endif
#endif // of _RENDER_API_PLATFORM_TYPES_H

View File

@@ -1,43 +0,0 @@
LOCAL_PATH := $(call my-dir)
host_common_debug_CFLAGS :=
#For gl debbuging
#host_common_debug_CFLAGS += -DCHECK_GL_ERROR
#host_common_debug_CFLAGS += -DDEBUG_PRINTOUT
### host library #########################################
$(call emugl-begin-host-static-library,libGLESv1_dec)
$(call emugl-import, libOpenglCodecCommon libOpenglOsUtils)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv1_enc,gl)
LOCAL_SRC_FILES := GLDecoder.cpp
# for gl_types.h !
$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv1_enc)
$(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS))
$(call emugl-end-module)
### host library, 64-bit ####################################
$(call emugl-begin-host-static-library,lib64GLESv1_dec)
$(call emugl-import, lib64OpenglCodecCommon lib64OpenglOsUtils)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv1_enc,gl)
LOCAL_SRC_FILES := GLDecoder.cpp
# for gl_types.h !
$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv1_enc)
$(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS) -m64)
$(call emugl-end-module)

View File

@@ -1,238 +0,0 @@
/*
* 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 "GLDecoder.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <EGL/egl.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
GLDecoder::GLDecoder()
{
m_contextData = NULL;
m_glesDso = NULL;
}
GLDecoder::~GLDecoder()
{
if (m_glesDso != NULL) {
delete m_glesDso;
}
}
int GLDecoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
{
if (getProcFunc == NULL) {
const char *libname = GLES_LIBNAME;
if (getenv(GLES_LIBNAME_VAR) != NULL) {
libname = getenv(GLES_LIBNAME_VAR);
}
m_glesDso = osUtils::dynLibrary::open(libname);
if (m_glesDso == NULL) {
fprintf(stderr, "Couldn't find %s \n", GLES_LIBNAME);
return -1;
}
this->initDispatchByName(s_getProc, this);
} else {
this->initDispatchByName(getProcFunc, getProcFuncData);
}
set_glGetCompressedTextureFormats(s_glGetCompressedTextureFormats);
set_glVertexPointerOffset(s_glVertexPointerOffset);
set_glColorPointerOffset(s_glColorPointerOffset);
set_glNormalPointerOffset(s_glNormalPointerOffset);
set_glTexCoordPointerOffset(s_glTexCoordPointerOffset);
set_glPointSizePointerOffset(s_glPointSizePointerOffset);
set_glWeightPointerOffset(s_glWeightPointerOffset);
set_glMatrixIndexPointerOffset(s_glMatrixIndexPointerOffset);
set_glVertexPointerData(s_glVertexPointerData);
set_glColorPointerData(s_glColorPointerData);
set_glNormalPointerData(s_glNormalPointerData);
set_glTexCoordPointerData(s_glTexCoordPointerData);
set_glPointSizePointerData(s_glPointSizePointerData);
set_glWeightPointerData(s_glWeightPointerData);
set_glMatrixIndexPointerData(s_glMatrixIndexPointerData);
set_glDrawElementsOffset(s_glDrawElementsOffset);
set_glDrawElementsData(s_glDrawElementsData);
set_glFinishRoundTrip(s_glFinishRoundTrip);
return 0;
}
int GLDecoder::s_glFinishRoundTrip(void *self)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glFinish();
return 0;
}
void GLDecoder::s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glVertexPointer(size, type, stride, (void *)offset);
}
void GLDecoder::s_glColorPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glColorPointer(size, type, stride, (void *)offset);
}
void GLDecoder::s_glTexCoordPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glTexCoordPointer(size, type, stride, (void *) offset);
}
void GLDecoder::s_glNormalPointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glNormalPointer(type, stride, (void *)offset);
}
void GLDecoder::s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glPointSizePointerOES(type, stride, (void *)offset);
}
void GLDecoder::s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glWeightPointerOES(size, type, stride, (void*)offset);
}
void GLDecoder::s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glMatrixIndexPointerOES(size, type, stride, (void*)offset);
}
#define STORE_POINTER_DATA_OR_ABORT(location) \
if (ctx->m_contextData != NULL) { \
ctx->m_contextData->storePointerData((location), data, datalen); \
} else { \
return; \
}
void GLDecoder::s_glVertexPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
{
GLDecoder *ctx = (GLDecoder *)self;
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::VERTEX_LOCATION);
ctx->glVertexPointer(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::VERTEX_LOCATION));
}
void GLDecoder::s_glColorPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
{
GLDecoder *ctx = (GLDecoder *)self;
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::COLOR_LOCATION);
ctx->glColorPointer(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::COLOR_LOCATION));
}
void GLDecoder::s_glTexCoordPointerData(void *self, GLint unit, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
{
GLDecoder *ctx = (GLDecoder *)self;
STORE_POINTER_DATA_OR_ABORT((GLDecoderContextData::PointerDataLocation)
(GLDecoderContextData::TEXCOORD0_LOCATION + unit));
ctx->glTexCoordPointer(size, type, 0,
ctx->m_contextData->pointerData((GLDecoderContextData::PointerDataLocation)
(GLDecoderContextData::TEXCOORD0_LOCATION + unit)));
}
void GLDecoder::s_glNormalPointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen)
{
GLDecoder *ctx = (GLDecoder *)self;
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::NORMAL_LOCATION);
ctx->glNormalPointer(type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::NORMAL_LOCATION));
}
void GLDecoder::s_glPointSizePointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen)
{
GLDecoder *ctx = (GLDecoder *)self;
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::POINTSIZE_LOCATION);
ctx->glPointSizePointerOES(type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::POINTSIZE_LOCATION));
}
void GLDecoder::s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
{
GLDecoder *ctx = (GLDecoder *)self;
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::WEIGHT_LOCATION);
ctx->glWeightPointerOES(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::WEIGHT_LOCATION));
}
void GLDecoder::s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
{
GLDecoder *ctx = (GLDecoder *)self;
STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::MATRIXINDEX_LOCATION);
ctx->glMatrixIndexPointerOES(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::MATRIXINDEX_LOCATION));
}
void GLDecoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glDrawElements(mode, count, type, (void *)offset);
}
void GLDecoder::s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen)
{
GLDecoder *ctx = (GLDecoder *)self;
ctx->glDrawElements(mode, count, type, data);
}
void GLDecoder::s_glGetCompressedTextureFormats(void *self, GLint count, GLint *data)
{
GLDecoder *ctx = (GLDecoder *) self;
ctx->glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, data);
}
void *GLDecoder::s_getProc(const char *name, void *userData)
{
GLDecoder *ctx = (GLDecoder *)userData;
if (ctx == NULL || ctx->m_glesDso == NULL) {
return NULL;
}
void *func = NULL;
#ifdef USE_EGL_GETPROCADDRESS
func = (void *) eglGetProcAddress(name);
#endif
if (func == NULL) {
func = (void *)(ctx->m_glesDso->findSymbol(name));
}
return func;
}

View File

@@ -1,71 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _GL_DECODER_H_
#define _GL_DECODER_H_
#include "gl_dec.h"
#include "FixedBuffer.h"
#include "GLDecoderContextData.h"
#include <osDynLibrary.h>
#define GLES_LIBNAME_VAR "ANDROID_GLESv1_LIB"
#define GLES_LIBNAME "libGLES_CM.so"
class GLDecoder : public gl_decoder_context_t
{
public:
typedef void *(*get_proc_func_t)(const char *name, void *userData);
GLDecoder();
~GLDecoder();
int initGL(get_proc_func_t getProcFunc = NULL, void *getProcFuncData = NULL);
void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
private:
static void gl_APIENTRY s_glGetCompressedTextureFormats(void * self, GLint cont, GLint *data);
static void gl_APIENTRY s_glVertexPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
static void gl_APIENTRY s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
static void gl_APIENTRY s_glColorPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
static void gl_APIENTRY s_glColorPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
static void gl_APIENTRY s_glTexCoordPointerData(void *self, GLint unit, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
static void gl_APIENTRY s_glTexCoordPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
static void gl_APIENTRY s_glNormalPointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen);
static void gl_APIENTRY s_glNormalPointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset);
static void gl_APIENTRY s_glPointSizePointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen);
static void gl_APIENTRY s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset);
static void gl_APIENTRY s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset);
static void gl_APIENTRY s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen);
static void gl_APIENTRY s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
static void gl_APIENTRY s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
static void gl_APIENTRY s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
static void gl_APIENTRY s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
static int gl_APIENTRY s_glFinishRoundTrip(void *self);
static void * s_getProc(const char *name, void *userData);
GLDecoderContextData *m_contextData;
osUtils::dynLibrary* m_glesDso;
};
#endif

View File

@@ -1,38 +0,0 @@
LOCAL_PATH := $(call my-dir)
host_common_debug_CFLAGS :=
#For gl debbuging
#host_common_debug_CFLAGS += -DCHECK_GL_ERROR
#host_common_debug_CFLAGS += -DDEBUG_PRINTOUT
### host library ##########################################
$(call emugl-begin-host-static-library,libGLESv2_dec)
$(call emugl-import, libOpenglCodecCommon libOpenglOsUtils)
$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv2_enc,gl2)
# For gl2_types.h !
$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv2_enc)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS))
LOCAL_SRC_FILES := GL2Decoder.cpp
$(call emugl-end-module)
### host library, 64-bit ####################################
$(call emugl-begin-host-static-library,lib64GLESv2_dec)
$(call emugl-import, lib64OpenglCodecCommon lib64OpenglOsUtils)
$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv2_enc,gl2)
# For gl2_types.h !
$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv2_enc)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS) -m64)
LOCAL_SRC_FILES := GL2Decoder.cpp
$(call emugl-end-module)

View File

@@ -1,123 +0,0 @@
#include "GL2Decoder.h"
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
GL2Decoder::GL2Decoder()
{
m_contextData = NULL;
m_GL2library = NULL;
}
GL2Decoder::~GL2Decoder()
{
delete m_GL2library;
}
void *GL2Decoder::s_getProc(const char *name, void *userData)
{
GL2Decoder *ctx = (GL2Decoder *) userData;
if (ctx == NULL || ctx->m_GL2library == NULL) {
return NULL;
}
void *func = NULL;
#ifdef USE_EGL_GETPROCADDRESS
func = (void *) eglGetProcAddress(name);
#endif
if (func == NULL) {
func = (void *) ctx->m_GL2library->findSymbol(name);
}
return func;
}
int GL2Decoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
{
if (getProcFunc == NULL) {
const char *libname = GLES2_LIBNAME;
if (getenv(GLES2_LIBNAME_VAR) != NULL) {
libname = getenv(GLES2_LIBNAME_VAR);
}
m_GL2library = osUtils::dynLibrary::open(libname);
if (m_GL2library == NULL) {
fprintf(stderr, "%s: Couldn't find %s \n", __FUNCTION__, libname);
return -1;
}
this->initDispatchByName(s_getProc, this);
} else {
this->initDispatchByName(getProcFunc, getProcFuncData);
}
set_glGetCompressedTextureFormats(s_glGetCompressedTextureFormats);
set_glVertexAttribPointerData(s_glVertexAttribPointerData);
set_glVertexAttribPointerOffset(s_glVertexAttribPointerOffset);
set_glDrawElementsOffset(s_glDrawElementsOffset);
set_glDrawElementsData(s_glDrawElementsData);
set_glShaderString(s_glShaderString);
set_glFinishRoundTrip(s_glFinishRoundTrip);
return 0;
}
int GL2Decoder::s_glFinishRoundTrip(void *self)
{
GL2Decoder *ctx = (GL2Decoder *)self;
ctx->glFinish();
return 0;
}
void GL2Decoder::s_glGetCompressedTextureFormats(void *self, int count, GLint *formats)
{
GL2Decoder *ctx = (GL2Decoder *) self;
int nFormats;
ctx->glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &nFormats);
if (nFormats > count) {
fprintf(stderr, "%s: GetCompressedTextureFormats: The requested number of formats does not match the number that is reported by OpenGL\n", __FUNCTION__);
} else {
ctx->glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
}
}
void GL2Decoder::s_glVertexAttribPointerData(void *self, GLuint indx, GLint size, GLenum type,
GLboolean normalized, GLsizei stride, void * data, GLuint datalen)
{
GL2Decoder *ctx = (GL2Decoder *) self;
if (ctx->m_contextData != NULL) {
ctx->m_contextData->storePointerData(indx, data, datalen);
// note - the stride of the data is always zero when it comes out of the codec.
// See gl2.attrib for the packing function call.
ctx->glVertexAttribPointer(indx, size, type, normalized, 0, ctx->m_contextData->pointerData(indx));
}
}
void GL2Decoder::s_glVertexAttribPointerOffset(void *self, GLuint indx, GLint size, GLenum type,
GLboolean normalized, GLsizei stride, GLuint data)
{
GL2Decoder *ctx = (GL2Decoder *) self;
ctx->glVertexAttribPointer(indx, size, type, normalized, stride, (GLvoid *)data);
}
void GL2Decoder::s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen)
{
GL2Decoder *ctx = (GL2Decoder *)self;
ctx->glDrawElements(mode, count, type, data);
}
void GL2Decoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset)
{
GL2Decoder *ctx = (GL2Decoder *)self;
ctx->glDrawElements(mode, count, type, (void *)offset);
}
void GL2Decoder::s_glShaderString(void *self, GLuint shader, const GLchar* string, GLsizei len)
{
GL2Decoder *ctx = (GL2Decoder *)self;
ctx->glShaderSource(shader, 1, &string, NULL);
}

View File

@@ -1,36 +0,0 @@
#ifndef _GL2_DECODER_H_
#define _GL2_DECODER_H_
#define GLES2_LIBNAME_VAR "ANDROID_GLESv2_LIB"
#define GLES2_LIBNAME "libGLESv2.so"
#include "gl2_dec.h"
#include "osDynLibrary.h"
#include "GLDecoderContextData.h"
class GL2Decoder : public gl2_decoder_context_t
{
public:
typedef void *(*get_proc_func_t)(const char *name, void *userData);
GL2Decoder();
~GL2Decoder();
int initGL(get_proc_func_t getProcFunc = NULL, void *getProcFuncData = NULL);
void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
private:
GLDecoderContextData *m_contextData;
osUtils::dynLibrary * m_GL2library;
static void *s_getProc(const char *name, void *userData);
static void gl2_APIENTRY s_glGetCompressedTextureFormats(void *self, int count, GLint *formats);
static void gl2_APIENTRY s_glVertexAttribPointerData(void *self, GLuint indx, GLint size, GLenum type,
GLboolean normalized, GLsizei stride, void * data, GLuint datalen);
static void gl2_APIENTRY s_glVertexAttribPointerOffset(void *self, GLuint indx, GLint size, GLenum type,
GLboolean normalized, GLsizei stride, GLuint offset);
static void gl2_APIENTRY s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset);
static void gl2_APIENTRY s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen);
static void gl2_APIENTRY s_glShaderString(void *self, GLuint shader, const GLchar* string, GLsizei len);
static int gl2_APIENTRY s_glFinishRoundTrip(void *self);
};
#endif

View File

@@ -1,57 +0,0 @@
LOCAL_PATH := $(call my-dir)
host_OS_SRCS :=
host_common_LDLIBS :=
ifeq ($(HOST_OS),linux)
host_OS_SRCS = EglX11Api.cpp
host_common_LDLIBS += -lX11 -lGL -ldl -lpthread
endif
ifeq ($(HOST_OS),darwin)
host_OS_SRCS = EglMacApi.cpp \
MacNative.m \
MacPixelFormatsAttribs.m
host_common_LDLIBS += -Wl,-framework,AppKit
endif
ifeq ($(HOST_OS),windows)
host_OS_SRCS = EglWindowsApi.cpp
host_common_LDLIBS += -lopengl32 -lgdi32
endif
host_common_SRC_FILES := \
$(host_OS_SRCS) \
ThreadInfo.cpp \
EglImp.cpp \
EglConfig.cpp \
EglContext.cpp \
EglGlobalInfo.cpp \
EglValidate.cpp \
EglSurface.cpp \
EglWindowSurface.cpp \
EglPbufferSurface.cpp \
EglPixmapSurface.cpp \
EglThreadInfo.cpp \
EglDisplay.cpp \
ClientAPIExts.cpp
### EGL host implementation ########################
$(call emugl-begin-host-shared-library,libEGL_translator)
$(call emugl-import,libGLcommon)
LOCAL_LDLIBS += $(host_common_LDLIBS)
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-end-module)
### EGL host implementation, 64-bit ########################
$(call emugl-begin-host-shared-library,lib64EGL_translator)
$(call emugl-import,lib64GLcommon)
LOCAL_LDLIBS += $(host_common_LDLIBS) -m64
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-end-module)

View File

@@ -1,159 +0,0 @@
/*
* 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 "EglGlobalInfo.h"
#include "GLcommon/GLutils.h"
#include "GLcommon/TranslatorIfaces.h"
#include "ThreadInfo.h"
#include <GLES/gl.h>
#include <GLES/glext.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[MAX_GLES_VERSION-1];
#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(GLESiface *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 \
{ \
ThreadInfo* thread = getThreadInfo(); \
if (!thread->eglContext.Ptr()) { \
return; \
} \
int idx = (int)thread->eglContext->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 \
{ \
ThreadInfo* thread = getThreadInfo(); \
if (!thread->eglContext.Ptr()) { \
return (rtype)0; \
} \
int idx = (int)thread->eglContext->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, (__translatorMustCastToProperFunctionPointerType)_egl_ ## fname},
#define API_ENTRY_RET(rtype,fname,params,args) \
API_ENTRY(fname,params,args)
static struct _client_ext_funcs {
const char *fname;
__translatorMustCastToProperFunctionPointerType 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.
//
__translatorMustCastToProperFunctionPointerType 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

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

View File

@@ -1,201 +0,0 @@
//
// Each extension function should have one of the following
// macro definitions:
// API_ENTRY(funcname, paramlist, arglist)
// -or- (in case funciton has 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

@@ -1,348 +0,0 @@
/*
* 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 "EglConfig.h"
EglConfig::EglConfig(EGLint red_size,
EGLint green_size,
EGLint blue_size,
EGLint alpha_size,
EGLenum caveat,
EGLint config_id,
EGLint depth_size,
EGLint frame_buffer_level,
EGLint max_pbuffer_width,
EGLint max_pbuffer_height,
EGLint max_pbuffer_size,
EGLBoolean native_renderable,
EGLint renderable_type,
EGLint native_visual_id,
EGLint native_visual_type,
EGLint samples_per_pixel,
EGLint stencil_size,
EGLint surface_type,
EGLenum transparent_type,
EGLint trans_red_val,
EGLint trans_green_val,
EGLint trans_blue_val,
EGLNativePixelFormatType frmt):
m_buffer_size(red_size + green_size + blue_size + alpha_size),
m_red_size(red_size),
m_green_size(green_size),
m_blue_size(blue_size),
m_alpha_size(alpha_size),
m_bind_to_tex_rgb(EGL_FALSE), //not supported for now
m_bind_to_tex_rgba(EGL_FALSE), //not supported for now
m_caveat(caveat),
m_config_id(config_id),
m_native_config_id(config_id),
m_frame_buffer_level(frame_buffer_level),
m_depth_size(depth_size),
m_max_pbuffer_width(max_pbuffer_width),
m_max_pbuffer_height(max_pbuffer_height),
m_max_pbuffer_size(max_pbuffer_size),
m_max_swap_interval(MAX_SWAP_INTERVAL),
m_min_swap_interval(MIN_SWAP_INTERVAL),
m_native_renderable(native_renderable),
m_renderable_type(renderable_type),
m_native_visual_id(native_visual_id),
m_native_visual_type(native_visual_type),
m_sample_buffers_num(samples_per_pixel > 0 ?1:0),
m_samples_per_pixel(samples_per_pixel),
m_stencil_size(stencil_size),
m_surface_type(surface_type),
m_transparent_type(transparent_type),
m_trans_red_val(trans_red_val),
m_trans_green_val(trans_green_val),
m_trans_blue_val(trans_blue_val),
m_conformant(((red_size + green_size + blue_size + alpha_size > 0) &&
(caveat!=EGL_NON_CONFORMANT_CONFIG)) ?
m_renderable_type : 0),
m_nativeFormat(frmt) {};
EglConfig::EglConfig(const EglConfig& conf):m_buffer_size(conf.m_buffer_size),
m_red_size(conf.m_red_size),
m_green_size(conf.m_green_size),
m_blue_size(conf.m_blue_size),
m_alpha_size(conf.m_alpha_size),
m_bind_to_tex_rgb(conf.m_bind_to_tex_rgb),
m_bind_to_tex_rgba(conf.m_bind_to_tex_rgba),
m_caveat(conf.m_caveat),
m_config_id(conf.m_config_id),
m_native_config_id(conf.m_native_config_id),
m_frame_buffer_level(conf.m_frame_buffer_level),
m_depth_size(conf.m_depth_size),
m_max_pbuffer_width(conf.m_max_pbuffer_width),
m_max_pbuffer_height(conf.m_max_pbuffer_height),
m_max_pbuffer_size(conf.m_max_pbuffer_size),
m_max_swap_interval(conf.m_max_swap_interval),
m_min_swap_interval(conf.m_min_swap_interval),
m_native_renderable(conf.m_native_renderable),
m_renderable_type(conf.m_renderable_type),
m_native_visual_id(conf.m_native_visual_id),
m_native_visual_type(conf.m_native_visual_type),
m_sample_buffers_num(conf.m_sample_buffers_num),
m_samples_per_pixel(conf.m_samples_per_pixel),
m_stencil_size(conf.m_stencil_size),
m_surface_type(conf.m_surface_type),
m_transparent_type(conf.m_transparent_type),
m_trans_red_val(conf.m_trans_red_val),
m_trans_green_val(conf.m_trans_green_val),
m_trans_blue_val(conf.m_trans_blue_val),
m_conformant(conf.m_conformant),
m_nativeFormat(conf.m_nativeFormat) {};
EglConfig::EglConfig(const EglConfig& conf,
EGLint config_id,
EGLint red_size,
EGLint green_size,
EGLint blue_size,
EGLint alpha_size):
m_buffer_size(red_size + green_size + blue_size + alpha_size),
m_red_size(red_size),
m_green_size(green_size),
m_blue_size(blue_size),
m_alpha_size(alpha_size),
m_bind_to_tex_rgb(conf.m_bind_to_tex_rgb),
m_bind_to_tex_rgba(conf.m_bind_to_tex_rgba),
m_caveat(conf.m_caveat),
m_config_id(config_id),
m_native_config_id(conf.m_native_config_id),
m_frame_buffer_level(conf.m_frame_buffer_level),
m_depth_size(conf.m_depth_size),
m_max_pbuffer_width(conf.m_max_pbuffer_width),
m_max_pbuffer_height(conf.m_max_pbuffer_height),
m_max_pbuffer_size(conf.m_max_pbuffer_size),
m_max_swap_interval(conf.m_max_swap_interval),
m_min_swap_interval(conf.m_min_swap_interval),
m_native_renderable(conf.m_native_renderable),
m_renderable_type(conf.m_renderable_type),
m_native_visual_id(conf.m_native_visual_id),
m_native_visual_type(conf.m_native_visual_type),
m_sample_buffers_num(conf.m_sample_buffers_num),
m_samples_per_pixel(conf.m_samples_per_pixel),
m_stencil_size(conf.m_stencil_size),
m_surface_type(conf.m_surface_type),
m_transparent_type(conf.m_transparent_type),
m_trans_red_val(conf.m_trans_red_val),
m_trans_green_val(conf.m_trans_green_val),
m_trans_blue_val(conf.m_trans_blue_val),
m_conformant(conf.m_conformant),
m_nativeFormat(conf.m_nativeFormat) {};
bool EglConfig::getConfAttrib(EGLint attrib,EGLint* val) const {
switch(attrib) {
case EGL_BUFFER_SIZE:
*val = m_buffer_size;
break;
case EGL_RED_SIZE:
*val = m_red_size;
break;
case EGL_GREEN_SIZE:
*val = m_green_size;
break;
case EGL_BLUE_SIZE:
*val = m_blue_size;
break;
case EGL_ALPHA_SIZE:
*val = m_alpha_size;
break;
case EGL_BIND_TO_TEXTURE_RGB:
*val = m_bind_to_tex_rgb;
break;
case EGL_BIND_TO_TEXTURE_RGBA:
*val = m_bind_to_tex_rgba;
break;
case EGL_CONFIG_CAVEAT:
*val = m_caveat;
break;
case EGL_CONFIG_ID:
*val = m_config_id;
break;
case EGL_DEPTH_SIZE:
*val = m_depth_size;
break;
case EGL_LEVEL:
*val = m_frame_buffer_level;
break;
case EGL_MAX_PBUFFER_WIDTH:
*val = m_max_pbuffer_width;
break;
case EGL_MAX_PBUFFER_HEIGHT:
*val = m_max_pbuffer_height;
break;
case EGL_MAX_PBUFFER_PIXELS:
*val = m_max_pbuffer_size;
break;
case EGL_MAX_SWAP_INTERVAL:
*val = m_max_swap_interval;
break;
case EGL_MIN_SWAP_INTERVAL:
*val = m_min_swap_interval;
break;
case EGL_NATIVE_RENDERABLE:
*val = m_native_renderable;
break;
case EGL_NATIVE_VISUAL_ID:
*val = m_native_visual_id;
break;
case EGL_NATIVE_VISUAL_TYPE:
*val = m_native_visual_type;
break;
case EGL_RENDERABLE_TYPE:
*val = m_renderable_type;
break;
case EGL_SAMPLE_BUFFERS:
*val = m_sample_buffers_num;
break;
case EGL_SAMPLES:
*val = m_samples_per_pixel;
break;
case EGL_STENCIL_SIZE:
*val = m_stencil_size;
break;
case EGL_SURFACE_TYPE:
*val = m_surface_type;
break;
case EGL_TRANSPARENT_TYPE:
*val =m_transparent_type;
break;
case EGL_TRANSPARENT_RED_VALUE:
*val = m_trans_red_val;
break;
case EGL_TRANSPARENT_GREEN_VALUE:
*val = m_trans_green_val;
break;
case EGL_TRANSPARENT_BLUE_VALUE:
*val = m_trans_blue_val;
break;
case EGL_CONFORMANT:
*val = m_conformant;
break;
default:
return false;
}
return true;
}
// checking compitabilty between *this configuration and another configuration
// the compitability is checked againsed red,green,blue,buffer stencil and depth sizes
bool EglConfig::compitableWith(const EglConfig& conf) const {
if(m_buffer_size != conf.m_buffer_size) return false;
if(m_red_size != conf.m_red_size) return false;
if(m_green_size != conf.m_green_size) return false;
if(m_blue_size != conf.m_blue_size) return false;
if(m_depth_size != conf.m_depth_size) return false;
if(m_stencil_size != conf.m_stencil_size) return false;
return true;
}
//following the sorting EGLconfig as in spec
bool EglConfig::operator<(const EglConfig& conf) const {
//0
if(m_conformant != conf.m_conformant) {
return m_conformant != 0; //We want the conformant ones first
}
//1
if(m_caveat != conf.m_caveat) {
return m_caveat < conf.m_caveat; // EGL_NONE < EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG
}
//2 TODO:
//3
if(m_buffer_size != conf.m_buffer_size) {
return m_buffer_size < conf.m_buffer_size;
}
//4
if(m_sample_buffers_num != conf.m_sample_buffers_num) {
return m_sample_buffers_num < conf.m_sample_buffers_num;
}
//5
if(m_samples_per_pixel != conf.m_samples_per_pixel) {
return m_samples_per_pixel < conf.m_samples_per_pixel;
}
//6
if(m_depth_size != conf.m_depth_size) {
return m_depth_size < conf.m_depth_size;
}
//7
if(m_stencil_size != conf.m_stencil_size) {
return m_stencil_size < conf.m_stencil_size;
}
//8 implementation defined
if(m_native_visual_type != conf.m_native_visual_type) {
return m_native_visual_type < conf.m_native_visual_type;
}
//9
return m_config_id < conf.m_config_id;
}
bool EglConfig::operator>=(const EglConfig& conf) const {
return !((*this) < conf);
}
#define CHECK_PROP(dummy,prop_name,op) \
if((dummy.prop_name != EGL_DONT_CARE) && (dummy.prop_name op prop_name)) return false;
#define CHECK_PROP_CAST(dummy,prop_name,op) \
if((((EGLint)dummy.prop_name) != EGL_DONT_CARE) && (dummy.prop_name op prop_name)) return false;
//checking if config stands for all the selection crateria of dummy as defined by EGL spec
bool EglConfig::choosen(const EglConfig& dummy) {
//atleast
CHECK_PROP(dummy,m_buffer_size,>);
CHECK_PROP(dummy,m_red_size,>);
CHECK_PROP(dummy,m_green_size,>);
CHECK_PROP(dummy,m_blue_size,>);
CHECK_PROP(dummy,m_alpha_size,>);
CHECK_PROP(dummy,m_depth_size,>);
CHECK_PROP(dummy,m_stencil_size,>);
CHECK_PROP(dummy,m_sample_buffers_num,>);
CHECK_PROP(dummy,m_samples_per_pixel,>);
//exact
CHECK_PROP(dummy,m_frame_buffer_level,!=);
CHECK_PROP(dummy,m_config_id,!=);
CHECK_PROP(dummy,m_native_visual_type,!=);
CHECK_PROP(dummy,m_max_swap_interval ,!=);
CHECK_PROP(dummy,m_min_swap_interval ,!=);
CHECK_PROP(dummy,m_trans_red_val ,!=);
CHECK_PROP(dummy,m_trans_green_val ,!=);
CHECK_PROP(dummy,m_trans_blue_val ,!=);
//exact - when cast to EGLint is needed when comparing to EGL_DONT_CARE
CHECK_PROP_CAST(dummy,m_bind_to_tex_rgb ,!=);
CHECK_PROP_CAST(dummy,m_bind_to_tex_rgba,!=);
CHECK_PROP_CAST(dummy,m_caveat,!=);
CHECK_PROP_CAST(dummy,m_native_renderable ,!=);
CHECK_PROP_CAST(dummy,m_transparent_type ,!=);
//mask
if(dummy.m_surface_type != EGL_DONT_CARE &&
((dummy.m_surface_type & m_surface_type) != dummy.m_surface_type)) return false;
if(dummy.m_conformant != (EGLenum)EGL_DONT_CARE &&
((dummy.m_conformant & m_conformant) != dummy.m_conformant)) return false;
if(dummy.m_renderable_type != EGL_DONT_CARE &&
((dummy.m_renderable_type & m_renderable_type) != dummy.m_renderable_type)) return false;
//passed all checks
return true;
}

View File

@@ -1,107 +0,0 @@
/*
* 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_CONFIG_H
#define EGL_CONFIG_H
#include<EGL/egl.h>
#include<EGL/eglinternalplatform.h>
#define MIN_SWAP_INTERVAL 1
#define MAX_SWAP_INTERVAL 10
class EglConfig {
public:
bool getConfAttrib(EGLint attrib,EGLint* val) const;
bool operator<(const EglConfig& conf) const;
bool operator>=(const EglConfig& conf) const;
bool compitableWith(const EglConfig& conf) const; //compitability
bool choosen(const EglConfig& dummy);
EGLint surfaceType(){ return m_surface_type;};
EGLint id(){return m_config_id;};
EGLint nativeId(){return m_native_config_id;};
EGLNativePixelFormatType nativeConfig(){ return m_nativeFormat;}
EglConfig(EGLint red_size,
EGLint green_size,
EGLint blue_size,
EGLint alpha_size,
EGLenum caveat,
EGLint config_id,
EGLint depth_size,
EGLint frame_buffer_level,
EGLint max_pbuffer_width,
EGLint max_pbuffer_height,
EGLint max_pbuffer_size,
EGLBoolean native_renderable,
EGLint renderable_type,
EGLint native_visual_id,
EGLint native_visual_type,
EGLint samples_per_pixel,
EGLint stencil_size,
EGLint surface_type,
EGLenum transparent_type,
EGLint trans_red_val,
EGLint trans_green_val,
EGLint trans_blue_val,
EGLNativePixelFormatType frmt);
EglConfig(const EglConfig& conf);
EglConfig(const EglConfig& conf,
EGLint config_id,
EGLint red_size,
EGLint green_size,
EGLint blue_size,
EGLint alpha_size);
private:
const EGLint m_buffer_size;
const EGLint m_red_size;
const EGLint m_green_size;
const EGLint m_blue_size;
const EGLint m_alpha_size;
const EGLBoolean m_bind_to_tex_rgb;
const EGLBoolean m_bind_to_tex_rgba;
const EGLenum m_caveat;
const EGLint m_config_id;
const EGLint m_native_config_id;
const EGLint m_frame_buffer_level;
const EGLint m_depth_size;
const EGLint m_max_pbuffer_width;
const EGLint m_max_pbuffer_height;
const EGLint m_max_pbuffer_size;
const EGLint m_max_swap_interval;
const EGLint m_min_swap_interval;
const EGLBoolean m_native_renderable;
const EGLint m_renderable_type;
const EGLint m_native_visual_id;
const EGLint m_native_visual_type;
const EGLint m_sample_buffers_num;
const EGLint m_samples_per_pixel;
const EGLint m_stencil_size;
const EGLint m_surface_type;
const EGLenum m_transparent_type;
const EGLint m_trans_red_val;
const EGLint m_trans_green_val;
const EGLint m_trans_blue_val;
const EGLenum m_conformant;
const EGLNativePixelFormatType m_nativeFormat;
};
#endif

View File

@@ -1,93 +0,0 @@
/*
* 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 "EglContext.h"
#include "EglDisplay.h"
#include "EglGlobalInfo.h"
#include "EglOsApi.h"
unsigned int EglContext::s_nextContextHndl = 0;
extern EglGlobalInfo* g_eglInfo; // defined in EglImp.cpp
bool EglContext::usingSurface(SurfacePtr surface) {
return surface.Ptr() == m_read.Ptr() || surface.Ptr() == m_draw.Ptr();
}
EglContext::EglContext(EglDisplay *dpy, EGLNativeContextType context,ContextPtr shared_context,
EglConfig* config,GLEScontext* glesCtx,GLESVersion ver,ObjectNameManager* mngr):
m_dpy(dpy),
m_native(context),
m_config(config),
m_glesContext(glesCtx),
m_read(NULL),
m_draw(NULL),
m_version(ver),
m_mngr(mngr)
{
m_shareGroup = shared_context.Ptr()?
mngr->attachShareGroup(context,shared_context->nativeType()):
mngr->createShareGroup(context);
m_hndl = ++s_nextContextHndl;
}
EglContext::~EglContext()
{
//
// remove the context in the underlying OS layer
//
EglOS::destroyContext(m_dpy->nativeType(),m_native);
//
// call the client-api to remove the GLES context
//
g_eglInfo->getIface(version())->deleteGLESContext(m_glesContext);
if (m_mngr)
{
m_mngr->deleteShareGroup(m_native);
}
}
void EglContext::setSurfaces(SurfacePtr read,SurfacePtr draw)
{
m_read = read;
m_draw = draw;
}
bool EglContext::getAttrib(EGLint attrib,EGLint* value) {
switch(attrib) {
case EGL_CONFIG_ID:
*value = m_config->id();
break;
default:
return false;
}
return true;
}
bool EglContext::attachImage(unsigned int imageId,ImagePtr img){
if(m_attachedImages.find(imageId) == m_attachedImages.end()){
m_attachedImages[imageId] = img;
return true;
}
return false;
}
void EglContext::detachImage(unsigned int imageId){
m_attachedImages.erase(imageId);
}

View File

@@ -1,73 +0,0 @@
/*
* 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 <map>
#include <EGL/egl.h>
#include <GLcommon/GLutils.h>
#include <GLcommon/SmartPtr.h>
#include <GLcommon/TranslatorIfaces.h>
#include <GLcommon/objectNameManager.h>
#include "EglConfig.h"
#include "EglSurface.h"
class EglContext;
typedef SmartPtr<EglContext> ContextPtr;
class EglDisplay;
class EglContext {
public:
EglContext(EglDisplay *dpy, EGLNativeContextType context,ContextPtr shared_context,EglConfig* config,GLEScontext* glesCtx,GLESVersion ver,ObjectNameManager* mngr);
bool usingSurface(SurfacePtr surface);
EGLNativeContextType nativeType(){return m_native;};
bool getAttrib(EGLint attrib,EGLint* value);
SurfacePtr read(){ return m_read;};
SurfacePtr draw(){ return m_draw;};
ShareGroupPtr getShareGroup(){return m_shareGroup;}
EglConfig* getConfig(){ return m_config;};
GLESVersion version(){return m_version;};
GLEScontext* getGlesContext(){return m_glesContext;}
void setSurfaces(SurfacePtr read,SurfacePtr draw);
unsigned int getHndl(){return m_hndl;}
bool attachImage(unsigned int imageId,ImagePtr img);
void detachImage(unsigned int imageId);
~EglContext();
private:
static unsigned int s_nextContextHndl;
EglDisplay *m_dpy;
EGLNativeContextType m_native;
EglConfig* m_config;
GLEScontext* m_glesContext;
ShareGroupPtr m_shareGroup;
SurfacePtr m_read;
SurfacePtr m_draw;
GLESVersion m_version;
ObjectNameManager *m_mngr;
unsigned int m_hndl;
ImagesHndlMap m_attachedImages;
};
#endif

View File

@@ -1,363 +0,0 @@
/*
* 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 "EglOsApi.h"
#include <GLcommon/GLutils.h>
#include <utils/threads.h>
#include <assert.h>
EglDisplay::EglDisplay(EGLNativeInternalDisplayType dpy,bool isDefault) :
m_dpy(dpy),
m_initialized(false),
m_configInitialized(false),
m_isDefault(isDefault),
m_nextEglImageId(0),
m_globalSharedContext(NULL)
{
m_manager[GLES_1_1] = new ObjectNameManager(&m_globalNameSpace);
m_manager[GLES_2_0] = new ObjectNameManager(&m_globalNameSpace);
};
EglDisplay::~EglDisplay() {
android::Mutex::Autolock mutex(m_lock);
//
// Destroy the global context if one was created.
// (should be true for windows platform only)
//
if (m_globalSharedContext != NULL) {
EglOS::destroyContext( m_dpy, m_globalSharedContext);
}
if(m_isDefault) {
EglOS::releaseDisplay(m_dpy);
}
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end(); it++) {
EglConfig* pConfig = *it;
if(pConfig) delete pConfig;
}
delete m_manager[GLES_1_1];
delete m_manager[GLES_2_0];
EglOS::deleteDisplay(m_dpy);
}
EGLNativeInternalDisplayType EglDisplay::nativeType(){return m_dpy;}
void EglDisplay::initialize(int renderableType) {
android::Mutex::Autolock mutex(m_lock);
m_initialized = true;
initConfigurations(renderableType);
m_configInitialized = true;
}
bool EglDisplay::isInitialize() { return m_initialized;}
void EglDisplay::terminate(){
android::Mutex::Autolock mutex(m_lock);
m_contexts.clear();
m_surfaces.clear();
m_initialized = false;
}
static bool compareEglConfigsPtrs(EglConfig* first,EglConfig* second) {
return *first < *second ;
}
void EglDisplay::addMissingConfigs(void)
{
m_configs.sort(compareEglConfigsPtrs);
EGLConfig match;
EGLNativePixelFormatType tmpfrmt = PIXEL_FORMAT_INITIALIZER;
EglConfig dummy(5, 6, 5, 0, // RGB_565
EGL_DONT_CARE,EGL_DONT_CARE,
16, // Depth
EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,
EGL_DONT_CARE, EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,EGL_DONT_CARE,tmpfrmt);
if(!doChooseConfigs(dummy, &match, 1))
{
return;
}
const EglConfig* config = (EglConfig*)match;
int bSize;
config->getConfAttrib(EGL_BUFFER_SIZE,&bSize);
if(bSize == 16)
{
return;
}
int max_config_id = 0;
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() ;it++) {
EGLint id;
(*it)->getConfAttrib(EGL_CONFIG_ID, &id);
if(id > max_config_id)
max_config_id = id;
}
EglConfig* newConfig = new EglConfig(*config,max_config_id+1,5,6,5,0);
m_configs.push_back(newConfig);
}
void EglDisplay::initConfigurations(int renderableType) {
if(m_configInitialized) return;
EglOS::queryConfigs(m_dpy,renderableType,m_configs);
addMissingConfigs();
m_configs.sort(compareEglConfigsPtrs);
}
EglConfig* EglDisplay::getConfig(EGLConfig conf) {
android::Mutex::Autolock mutex(m_lock);
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() ;it++) {
if(static_cast<EGLConfig>(*it) == conf) {
return (*it);
}
}
return NULL;
}
SurfacePtr EglDisplay::getSurface(EGLSurface surface) {
android::Mutex::Autolock mutex(m_lock);
/* surface is "key" in map<unsigned int, SurfacePtr>.
In 64-bit the upper 32-bit should be all zero. Assert for that. */
uintptr_t hndlptr = (uintptr_t)surface;
unsigned int hndl = (unsigned int)hndlptr;
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
SurfacesHndlMap::iterator it = m_surfaces.find(hndl);
return it != m_surfaces.end() ?
(*it).second :
SurfacePtr(NULL);
}
ContextPtr EglDisplay::getContext(EGLContext ctx) {
android::Mutex::Autolock mutex(m_lock);
/* ctx is "key" in map<unsigned int, ContextPtr>.
In 64-bit the upper 32-bit should be all zero. Assert for that. */
uintptr_t hndlptr = (uintptr_t)ctx;
unsigned int hndl = (unsigned int)hndlptr;
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
ContextsHndlMap::iterator it = m_contexts.find(hndl);
return it != m_contexts.end() ?
(*it).second :
ContextPtr(NULL);
}
bool EglDisplay::removeSurface(EGLSurface s) {
android::Mutex::Autolock mutex(m_lock);
/* s is "key" in map<unsigned int, SurfacePtr>.
In 64-bit the upper 32-bit should be all zero. Assert for that. */
uintptr_t hndlptr = (uintptr_t)s;
unsigned int hndl = (unsigned int)hndlptr;
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
SurfacesHndlMap::iterator it = m_surfaces.find(hndl);
if(it != m_surfaces.end()) {
m_surfaces.erase(it);
return true;
}
return false;
}
bool EglDisplay::removeSurface(SurfacePtr s) {
android::Mutex::Autolock mutex(m_lock);
SurfacesHndlMap::iterator it;
for(it = m_surfaces.begin(); it!= m_surfaces.end();it++)
{
if((*it).second.Ptr() == s.Ptr()) {
break;
}
}
if(it != m_surfaces.end()) {
m_surfaces.erase(it);
return true;
}
return false;
}
bool EglDisplay::removeContext(EGLContext ctx) {
android::Mutex::Autolock mutex(m_lock);
/* ctx is "key" in map<unsigned int, ContextPtr>.
In 64-bit the upper 32-bit should be all zero. Assert for that. */
uintptr_t hndlptr = (uintptr_t)ctx;
unsigned int hndl = (unsigned int)hndlptr;
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
ContextsHndlMap::iterator it = m_contexts.find(hndl);
if(it != m_contexts.end()) {
m_contexts.erase(it);
return true;
}
return false;
}
bool EglDisplay::removeContext(ContextPtr ctx) {
android::Mutex::Autolock mutex(m_lock);
ContextsHndlMap::iterator it;
for(it = m_contexts.begin(); it != m_contexts.end();it++) {
if((*it).second.Ptr() == ctx.Ptr()){
break;
}
}
if(it != m_contexts.end()) {
m_contexts.erase(it);
return true;
}
return false;
}
EglConfig* EglDisplay::getConfig(EGLint id) {
android::Mutex::Autolock mutex(m_lock);
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() ;it++) {
if((*it)->id() == id) {
return (*it);
}
}
return NULL;
}
int EglDisplay::getConfigs(EGLConfig* configs,int config_size) {
android::Mutex::Autolock mutex(m_lock);
int i = 0;
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() && i < config_size ;i++,it++) {
configs[i] = static_cast<EGLConfig>(*it);
}
return i;
}
int EglDisplay::chooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size) {
android::Mutex::Autolock mutex(m_lock);
return doChooseConfigs(dummy, configs, config_size);
}
int EglDisplay::doChooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size) {
int added = 0;
for(ConfigsList::iterator it = m_configs.begin(); it != m_configs.end() && (added < config_size || !configs);it++) {
if( (*it)->choosen(dummy)){
if(configs) {
configs[added] = static_cast<EGLConfig>(*it);
}
added++;
}
}
//no need to sort since the configurations are saved already in sorted maner
return added;
}
EGLSurface EglDisplay::addSurface(SurfacePtr s ) {
android::Mutex::Autolock mutex(m_lock);
unsigned int hndl = s.Ptr()->getHndl();
EGLSurface ret =reinterpret_cast<EGLSurface> (hndl);
if(m_surfaces.find(hndl) != m_surfaces.end()) {
return ret;
}
m_surfaces[hndl] = s;
return ret;
}
EGLContext EglDisplay::addContext(ContextPtr ctx ) {
android::Mutex::Autolock mutex(m_lock);
unsigned int hndl = ctx.Ptr()->getHndl();
EGLContext ret = reinterpret_cast<EGLContext> (hndl);
if(m_contexts.find(hndl) != m_contexts.end()) {
return ret;
}
m_contexts[hndl] = ctx;
return ret;
}
EGLImageKHR EglDisplay::addImageKHR(ImagePtr img) {
android::Mutex::Autolock mutex(m_lock);
do { ++m_nextEglImageId; } while(m_nextEglImageId == 0);
img->imageId = m_nextEglImageId;
m_eglImages[m_nextEglImageId] = img;
return reinterpret_cast<EGLImageKHR>(m_nextEglImageId);
}
ImagePtr EglDisplay::getImage(EGLImageKHR img) {
android::Mutex::Autolock mutex(m_lock);
/* img is "key" in map<unsigned int, ImagePtr>.
In 64-bit the upper 32-bit should be all zero. Assert for that. */
uintptr_t hndlptr = (uintptr_t)img;
unsigned int hndl = (unsigned int)hndlptr;
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
ImagesHndlMap::iterator i( m_eglImages.find(hndl) );
return (i != m_eglImages.end()) ? (*i).second :ImagePtr(NULL);
}
bool EglDisplay:: destroyImageKHR(EGLImageKHR img) {
android::Mutex::Autolock mutex(m_lock);
/* img is "key" in map<unsigned int, ImagePtr>.
In 64-bit the upper 32-bit should be all zero. Assert for that. */
uintptr_t hndlptr = (uintptr_t)img;
unsigned int hndl = (unsigned int)hndlptr;
assert(sizeof(hndl) == sizeof(hndlptr) || hndl == hndlptr);
ImagesHndlMap::iterator i( m_eglImages.find(hndl) );
if (i != m_eglImages.end())
{
m_eglImages.erase(i);
return true;
}
return false;
}
EGLNativeContextType EglDisplay::getGlobalSharedContext(){
android::Mutex::Autolock mutex(m_lock);
#ifndef _WIN32
// find an existing OpenGL context to share with, if exist
EGLNativeContextType ret =
(EGLNativeContextType)m_manager[GLES_1_1]->getGlobalContext();
if (!ret)
ret = (EGLNativeContextType)m_manager[GLES_2_0]->getGlobalContext();
return ret;
#else
if (!m_globalSharedContext) {
//
// On windows we create a dummy context to serve as the
// "global context" which all contexts share with.
// This is because on windows it is not possible to share
// with a context which is already current. This dummy context
// will never be current to any thread so it is safe to share with.
// Create that context using the first config
if (m_configs.size() < 1) {
// Should not happen! config list should be initialized at this point
return NULL;
}
EglConfig *cfg = (*m_configs.begin());
m_globalSharedContext = EglOS::createContext(m_dpy,cfg,NULL);
}
return m_globalSharedContext;
#endif
}

View File

@@ -1,92 +0,0 @@
/*
* 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_DISPLAY_H
#define EGL_DISPLAY_H
#include <list>
#include <map>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <utils/threads.h>
#include <GLcommon/SmartPtr.h>
#include "EglConfig.h"
#include "EglContext.h"
#include "EglSurface.h"
#include "EglWindowSurface.h"
typedef std::list<EglConfig*> ConfigsList;
typedef std::map< unsigned int, ContextPtr> ContextsHndlMap;
typedef std::map< unsigned int, SurfacePtr> SurfacesHndlMap;
class EglDisplay {
public:
EglDisplay(EGLNativeInternalDisplayType dpy,bool isDefault = true);
EGLNativeInternalDisplayType nativeType();
int nConfigs(){ return m_configs.size();}
int getConfigs(EGLConfig* configs,int config_size);
int chooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size);
EglConfig* getConfig(EGLConfig conf);
EglConfig* getConfig(EGLint id );
EGLSurface addSurface(SurfacePtr s );
SurfacePtr getSurface(EGLSurface surface);
bool removeSurface(EGLSurface s);
bool removeSurface(SurfacePtr s);
EGLContext addContext(ContextPtr ctx );
ContextPtr getContext(EGLContext ctx);
bool removeContext(EGLContext ctx);
bool removeContext(ContextPtr ctx);
ObjectNameManager* getManager(GLESVersion ver){ return m_manager[ver];}
~EglDisplay();
void initialize(int renderableType);
void terminate();
bool isInitialize();
ImagePtr getImage(EGLImageKHR img);
EGLImageKHR addImageKHR(ImagePtr);
bool destroyImageKHR(EGLImageKHR img);
EGLNativeContextType getGlobalSharedContext();
private:
int doChooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size);
void addMissingConfigs(void);
void initConfigurations(int renderableType);
EGLNativeInternalDisplayType m_dpy;
bool m_initialized;
bool m_configInitialized;
bool m_isDefault;
ConfigsList m_configs;
ContextsHndlMap m_contexts;
SurfacesHndlMap m_surfaces;
GlobalNameSpace m_globalNameSpace;
ObjectNameManager *m_manager[MAX_GLES_VERSION];
android::Mutex m_lock;
ImagesHndlMap m_eglImages;
unsigned int m_nextEglImageId;
EGLNativeContextType m_globalSharedContext;
};
#endif

View File

@@ -1,104 +0,0 @@
/*
* 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 "EglGlobalInfo.h"
#include "EglOsApi.h"
#include <string.h>
#include "ClientAPIExts.h"
int EglGlobalInfo::m_refCount = 0;
EglGlobalInfo* EglGlobalInfo::m_singleton = NULL;
EglGlobalInfo::EglGlobalInfo(){
m_default = EglOS::getDefaultDisplay();
#ifdef _WIN32
EglOS::initPtrToWglFunctions();
#endif
memset(m_gles_ifaces,0,sizeof(m_gles_ifaces));
memset(m_gles_extFuncs_inited,0,sizeof(m_gles_extFuncs_inited));
}
EglGlobalInfo* EglGlobalInfo::getInstance() {
if(!m_singleton) {
m_singleton = new EglGlobalInfo();
m_refCount = 0;
}
m_refCount++;
return m_singleton;
}
void EglGlobalInfo::delInstance() {
m_refCount--;
if(m_refCount <= 0 && m_singleton) {
delete m_singleton;
m_singleton = NULL;
}
}
EglDisplay* EglGlobalInfo::addDisplay(EGLNativeDisplayType dpy,EGLNativeInternalDisplayType idpy) {
//search if it is not already exists
android::Mutex::Autolock mutex(m_lock);
for(DisplaysMap::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
if((*it).second == dpy) return (*it).first;
}
EglDisplay* p_dpy = new EglDisplay(idpy);
if(p_dpy) {
m_displays[p_dpy] = dpy;
return p_dpy;
}
return NULL;
}
bool EglGlobalInfo::removeDisplay(EGLDisplay dpy) {
android::Mutex::Autolock mutex(m_lock);
for(DisplaysMap::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
if(static_cast<EGLDisplay>((*it).first) == dpy) {
delete (*it).first;
m_displays.erase(it);
return true;
}
}
return false;
}
EglDisplay* EglGlobalInfo::getDisplay(EGLNativeDisplayType dpy) {
android::Mutex::Autolock mutex(m_lock);
for(DisplaysMap::iterator it = m_displays.begin(); it != m_displays.end() ;it++) {
if((*it).second == dpy) return (*it).first;
}
return NULL;
}
EglDisplay* EglGlobalInfo::getDisplay(EGLDisplay dpy) {
android::Mutex::Autolock mutex(m_lock);
DisplaysMap::iterator it = m_displays.find(static_cast<EglDisplay*>(dpy));
return (it != m_displays.end() ? (*it).first : NULL);
}
EGLNativeInternalDisplayType EglGlobalInfo::generateInternalDisplay(EGLNativeDisplayType dpy){
return EglOS::getInternalDisplay(dpy);
}
void EglGlobalInfo::initClientExtFuncTable(GLESVersion ver)
{
android::Mutex::Autolock mutex(m_lock);
if (!m_gles_extFuncs_inited[ver]) {
ClientAPIExts::initClientFuncs(m_gles_ifaces[ver], (int)ver - 1);
m_gles_extFuncs_inited[ver] = true;
}
}

View File

@@ -1,64 +0,0 @@
/*
* 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_GLOBAL_INFO
#define EGL_GLOBAL_INFO
#include <list>
#include <EGL/egl.h>
#include <utils/threads.h>
#include <GLcommon/TranslatorIfaces.h>
#include "EglDisplay.h"
#include "EglConfig.h"
#include "EglContext.h"
typedef std::map<EglDisplay*,EGLNativeDisplayType>DisplaysMap;
class EglGlobalInfo {
public:
EglDisplay* addDisplay(EGLNativeDisplayType dpy,EGLNativeInternalDisplayType idpy);
EglDisplay* getDisplay(EGLNativeDisplayType dpy);
EglDisplay* getDisplay(EGLDisplay dpy);
bool removeDisplay(EGLDisplay dpy);
EGLNativeInternalDisplayType getDefaultNativeDisplay(){ return m_default;};
EGLNativeInternalDisplayType generateInternalDisplay(EGLNativeDisplayType dpy);
void setIface(GLESiface* iface,GLESVersion ver) { m_gles_ifaces[ver] = iface;};
GLESiface* getIface(GLESVersion ver){ return m_gles_ifaces[ver];}
int nDisplays() const { return m_displays.size();};
void initClientExtFuncTable(GLESVersion ver);
static EglGlobalInfo* getInstance();
static void delInstance();
private:
EglGlobalInfo();
~EglGlobalInfo(){};
static EglGlobalInfo* m_singleton;
static int m_refCount;
DisplaysMap m_displays;
EGLNativeInternalDisplayType m_default;
GLESiface* m_gles_ifaces[MAX_GLES_VERSION];
bool m_gles_extFuncs_inited[MAX_GLES_VERSION];
android::Mutex m_lock;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,223 +0,0 @@
/*
* 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 "EglOsApi.h"
#include "MacNative.h"
#define MAX_PBUFFER_MIPMAP_LEVEL 1
namespace EglOS {
static std::list<EGLNativePixelFormatType> s_nativeConfigs;
EGLNativeDisplayType getDefaultDisplay() {return 0;}
bool releaseDisplay(EGLNativeDisplayType dpy) {
return true;
}
static EglConfig* pixelFormatToConfig(int index,int renderableType,EGLNativePixelFormatType* frmt){
if(!frmt) return NULL;
EGLint red,green,blue,alpha,depth,stencil;
EGLint supportedSurfaces,visualType,visualId;
EGLint transparentType,samples;
EGLint tRed,tGreen,tBlue;
EGLint pMaxWidth,pMaxHeight,pMaxPixels;
EGLint configId,level;
EGLint window,pbuffer;
EGLint doubleBuffer,colorSize;
getPixelFormatAttrib(*frmt,MAC_HAS_DOUBLE_BUFFER,&doubleBuffer);
if(!doubleBuffer) return NULL; //pixel double buffer
supportedSurfaces = 0;
getPixelFormatAttrib(*frmt,MAC_DRAW_TO_WINDOW,&window);
getPixelFormatAttrib(*frmt,MAC_DRAW_TO_PBUFFER,&pbuffer);
if(window) supportedSurfaces |= EGL_WINDOW_BIT;
if(pbuffer) supportedSurfaces |= EGL_PBUFFER_BIT;
if(!supportedSurfaces) return NULL;
//default values
visualId = 0;
visualType = EGL_NONE;
EGLenum caveat = EGL_NONE;
EGLBoolean renderable = EGL_FALSE;
pMaxWidth = PBUFFER_MAX_WIDTH;
pMaxHeight = PBUFFER_MAX_HEIGHT;
pMaxPixels = PBUFFER_MAX_PIXELS;
samples = 0;
level = 0;
tRed = tGreen = tBlue = 0;
transparentType = EGL_NONE;
getPixelFormatAttrib(*frmt,MAC_SAMPLES_PER_PIXEL,&samples);
getPixelFormatAttrib(*frmt,MAC_COLOR_SIZE,&colorSize);
getPixelFormatAttrib(*frmt,MAC_ALPHA_SIZE,&alpha);
getPixelFormatAttrib(*frmt,MAC_DEPTH_SIZE,&depth);
getPixelFormatAttrib(*frmt,MAC_STENCIL_SIZE,&stencil);
red = green = blue = (colorSize / 4); //TODO: ask guy if it is OK
return new EglConfig(red,green,blue,alpha,caveat,(EGLint)index,depth,level,pMaxWidth,pMaxHeight,pMaxPixels,renderable,renderableType,
visualId,visualType,samples,stencil,supportedSurfaces,transparentType,tRed,tGreen,tBlue,*frmt);
}
static void initNativeConfigs(){
int nConfigs = getNumPixelFormats();
if(s_nativeConfigs.empty()){
for(int i=0; i < nConfigs ;i++){
EGLNativePixelFormatType frmt = getPixelFormat(i);
if(frmt){
s_nativeConfigs.push_back(frmt);
}
}
}
}
void queryConfigs(EGLNativeDisplayType dpy,int renderableType,ConfigsList& listOut) {
int i = 0 ;
initNativeConfigs();
for(std::list<EGLNativePixelFormatType>::iterator it = s_nativeConfigs.begin(); it != s_nativeConfigs.end();it++){
EGLNativePixelFormatType frmt = *it;
EglConfig* conf = pixelFormatToConfig(i++,renderableType,&frmt);
if(conf){
listOut.push_front(conf);
};
}
}
bool validNativeWin(EGLNativeDisplayType dpy, EGLNativeWindowType win) {
unsigned int width,height;
return nsGetWinDims(win,&width,&height);
}
bool validNativeWin(EGLNativeDisplayType dpy, EGLNativeSurfaceType win) {
return validNativeWin(dpy,(EGLNativeWindowType)win);
}
//no support for pixmap in mac
bool validNativePixmap(EGLNativeDisplayType dpy, EGLNativeSurfaceType pix) {
return true;
}
bool checkWindowPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height) {
int r,g,b;
bool ret = nsGetWinDims(win,width,height);
cfg->getConfAttrib(EGL_RED_SIZE,&r);
cfg->getConfAttrib(EGL_GREEN_SIZE,&g);
cfg->getConfAttrib(EGL_BLUE_SIZE,&b);
bool match = nsCheckColor(win,r + g + b);
return ret && match;
}
//no support for pixmap in mac
bool checkPixmapPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativePixmapType pix,EglConfig* cfg,unsigned int* width,unsigned int* height) {
return false;
}
EGLNativeSurfaceType createPbufferSurface(EGLNativeDisplayType dpy,EglConfig* cfg,EglPbufferSurface* srfc){
EGLint width,height,hasMipmap,tmp;
EGLint target,format;
srfc->getDim(&width,&height,&tmp);
srfc->getTexInfo(&format,&target);
srfc->getAttrib(EGL_MIPMAP_TEXTURE,&hasMipmap);
EGLint maxMipmap = hasMipmap ? MAX_PBUFFER_MIPMAP_LEVEL:0;
return (EGLNativeSurfaceType)nsCreatePBuffer(target,format,maxMipmap,width,height);
}
bool releasePbuffer(EGLNativeDisplayType dis,EGLNativeSurfaceType pb) {
nsDestroyPBuffer(pb);
return true;
}
EGLNativeContextType createContext(EGLNativeDisplayType dpy,EglConfig* cfg,EGLNativeContextType sharedContext) {
return nsCreateContext(cfg->nativeConfig(),sharedContext);
}
bool destroyContext(EGLNativeDisplayType dpy,EGLNativeContextType ctx) {
nsDestroyContext(ctx);
return true;
}
bool makeCurrent(EGLNativeDisplayType dpy,EglSurface* read,EglSurface* draw,EGLNativeContextType ctx){
// check for unbind
if (ctx == NULL && read == NULL && draw == NULL) {
nsWindowMakeCurrent(NULL, NULL);
return true;
}
else if (ctx == NULL || read == NULL || draw == NULL) {
// error !
return false;
}
//dont supporting diffrent read & draw surfaces on Mac
if(read->native() != draw->native()) return false;
switch(draw->type()){
case EglSurface::WINDOW:
nsWindowMakeCurrent(ctx,draw->native());
break;
case EglSurface::PBUFFER:
{
EGLint hasMipmap;
draw->getAttrib(EGL_MIPMAP_TEXTURE,&hasMipmap);
int mipmapLevel = hasMipmap ? MAX_PBUFFER_MIPMAP_LEVEL:0;
nsPBufferMakeCurrent(ctx,draw->native(),mipmapLevel);
break;
}
case EglSurface::PIXMAP: // not supported on Mac
default:
return false;
}
return true;
}
void swapBuffers(EGLNativeDisplayType dpy,EGLNativeSurfaceType srfc){
nsSwapBuffers();
}
void waitNative(){}
void swapInterval(EGLNativeDisplayType dpy,EGLNativeSurfaceType win,int interval){
nsSwapInterval(&interval);
}
EGLNativeSurfaceType createWindowSurface(EGLNativeWindowType wnd){
return (EGLNativeSurfaceType)wnd;
}
EGLNativeSurfaceType createPixmapSurface(EGLNativePixmapType pix){
return (EGLNativeSurfaceType)pix;
}
void destroySurface(EGLNativeSurfaceType srfc){
}
EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType dpy){
return (EGLNativeInternalDisplayType)dpy;
}
void deleteDisplay(EGLNativeInternalDisplayType idpy){
}
};

View File

@@ -1,63 +0,0 @@
/*
* 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_OS_API_H
#define EGL_OS_API_H
#include <EGL/egl.h>
#include <EGL/eglinternalplatform.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include "EglConfig.h"
#include "EglDisplay.h"
#include "EglPbufferSurface.h"
#define PBUFFER_MAX_WIDTH 32767
#define PBUFFER_MAX_HEIGHT 32767
#define PBUFFER_MAX_PIXELS 32767*32767
namespace EglOS{
void queryConfigs(EGLNativeInternalDisplayType dpy,int renderable_type,ConfigsList& listOut);
bool releasePbuffer(EGLNativeInternalDisplayType dis,EGLNativeSurfaceType pb);
bool destroyContext(EGLNativeInternalDisplayType dpy,EGLNativeContextType ctx);
bool releaseDisplay(EGLNativeInternalDisplayType dpy);
bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win);
bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win);
bool validNativePixmap(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType pix);
bool checkWindowPixelFormatMatch(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height);
bool checkPixmapPixelFormatMatch(EGLNativeInternalDisplayType dpy,EGLNativePixmapType pix,EglConfig* cfg,unsigned int* width,unsigned int* height);
bool makeCurrent(EGLNativeInternalDisplayType dpy,EglSurface* read,EglSurface* draw,EGLNativeContextType);
void swapBuffers(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType srfc);
void swapInterval(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win,int interval);
void waitNative();
EGLNativeInternalDisplayType getDefaultDisplay();
EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType dpy);
void deleteDisplay(EGLNativeInternalDisplayType idpy);
EGLNativeSurfaceType createPbufferSurface(EGLNativeInternalDisplayType dpy,EglConfig* cfg,EglPbufferSurface* pb);
EGLNativeContextType createContext(EGLNativeInternalDisplayType dpy,EglConfig* cfg,EGLNativeContextType sharedContext);
EGLNativeSurfaceType createWindowSurface(EGLNativeWindowType wnd);
EGLNativeSurfaceType createPixmapSurface(EGLNativePixmapType pix);
void destroySurface(EGLNativeSurfaceType srfc);
#ifdef _WIN32
void initPtrToWglFunctions();
#endif
};
#endif

View File

@@ -1,75 +0,0 @@
/*
* 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 "EglPbufferSurface.h"
bool EglPbufferSurface::setAttrib(EGLint attrib,EGLint val) {
switch(attrib) {
case EGL_WIDTH:
if(val < 0) return false;
m_width = val;
break;
case EGL_HEIGHT:
if(val < 0) return false;
m_height = val;
break;
case EGL_LARGEST_PBUFFER:
m_largest = val;
break;
case EGL_TEXTURE_FORMAT:
if(val != EGL_NO_TEXTURE && val != EGL_TEXTURE_RGB && val != EGL_TEXTURE_RGBA) return false;
m_texFormat = val;
break;
case EGL_TEXTURE_TARGET:
if(val != EGL_NO_TEXTURE && val != EGL_TEXTURE_2D) return false;
m_texTarget = val;
break;
case EGL_MIPMAP_TEXTURE:
m_texMipmap = val;
break;
default:
return false;
}
return true;
}
bool EglPbufferSurface::getAttrib(EGLint attrib,EGLint* val) {
switch(attrib) {
case EGL_CONFIG_ID:
*val = m_config->id();
break;
case EGL_WIDTH:
*val = m_width;
break;
case EGL_HEIGHT:
*val = m_height;
break;
case EGL_LARGEST_PBUFFER:
*val = m_largest;
break;
case EGL_TEXTURE_FORMAT:
*val = m_texFormat;
break;
case EGL_TEXTURE_TARGET:
*val = m_texTarget;
break;
case EGL_MIPMAP_TEXTURE:
*val = m_texMipmap;
break;
default:
return false;
}
return true;
}

View File

@@ -1,49 +0,0 @@
/*
* 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_PBUFFER_SURFACE_H
#define EGL_PBUFFER_SURFACE_H
#include "EglSurface.h"
class EglDisplay;
class EglPbufferSurface:public EglSurface {
public:
EglPbufferSurface(EglDisplay *dpy, EglConfig* config):
EglSurface(dpy,PBUFFER,config,0,0),
m_texFormat(EGL_NO_TEXTURE),
m_texTarget(EGL_NO_TEXTURE),
m_texMipmap(EGL_FALSE),
m_largest(EGL_FALSE){};
void setNativePbuffer(EGLNativeSurfaceType srfc){ m_native = srfc;};
bool setAttrib(EGLint attrib,EGLint val);
bool getAttrib(EGLint attrib,EGLint* val);
void getDim(EGLint* width,EGLint* height,EGLint* largest){
*width = m_width;
*height = m_height;
*largest = m_largest;
};
void getTexInfo(EGLint* format,EGLint* target){ *format = m_texFormat; *target = m_texTarget;}
private:
EGLint m_texFormat;
EGLint m_texTarget;
EGLint m_texMipmap;
EGLint m_largest;
};
#endif

View File

@@ -1,60 +0,0 @@
/*
* 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 "EglPixmapSurface.h"
#include "EglOsApi.h"
std::set<EGLNativePixmapType> EglPixmapSurface::s_associatedPixmaps;
bool EglPixmapSurface::alreadyAssociatedWithConfig(EGLNativePixmapType pix) {
return s_associatedPixmaps.find(pix) != s_associatedPixmaps.end();
}
EglPixmapSurface::EglPixmapSurface(EglDisplay *dpy,
EGLNativePixmapType pix,
EglConfig* config) :
EglSurface(dpy, PIXMAP,config,0,0),
m_pixmap(pix)
{
s_associatedPixmaps.insert(pix);
m_native = EglOS::createPixmapSurface(pix);
}
EglPixmapSurface::~EglPixmapSurface() {
s_associatedPixmaps.erase(m_pixmap);
}
bool EglPixmapSurface::getAttrib(EGLint attrib,EGLint* val) {
switch(attrib) {
case EGL_CONFIG_ID:
*val = m_config->id();
break;
case EGL_WIDTH:
*val = m_width;
break;
case EGL_HEIGHT:
*val = m_height;
break;
case EGL_LARGEST_PBUFFER:
case EGL_TEXTURE_FORMAT:
case EGL_TEXTURE_TARGET:
case EGL_MIPMAP_TEXTURE:
break;
default:
return false;
}
return true;
}

View File

@@ -1,37 +0,0 @@
/*
* 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_PIXMAP_SURFACE_H
#define EGL_PIXMAP_SURFACE_H
#include <set>
#include <EGL/egl.h>
#include "EglSurface.h"
class EglDisplay;
class EglPixmapSurface: public EglSurface {
public:
EglPixmapSurface(EglDisplay *dpy, EGLNativePixmapType pix,EglConfig* config);
~EglPixmapSurface();
bool getAttrib(EGLint attrib,EGLint* val);
static bool alreadyAssociatedWithConfig(EGLNativePixmapType pix);
private:
EGLNativePixmapType m_pixmap;
static std::set<EGLNativePixmapType> s_associatedPixmaps;
};
#endif

View File

@@ -1,43 +0,0 @@
/*
* 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 "EglSurface.h"
#include "EglOsApi.h"
unsigned int EglSurface::s_nextSurfaceHndl = 0;
EglSurface::~EglSurface(){
if(m_type == EglSurface::PBUFFER) {
EglOS::releasePbuffer(m_dpy->nativeType(),m_native);
}
if(m_native) EglOS::destroySurface(m_native);
}
bool EglSurface::setAttrib(EGLint attrib,EGLint val) {
switch(attrib) {
case EGL_WIDTH:
case EGL_HEIGHT:
case EGL_LARGEST_PBUFFER:
case EGL_TEXTURE_FORMAT:
case EGL_TEXTURE_TARGET:
case EGL_MIPMAP_TEXTURE:
break;
default:
return false;
}
return true;
}

View File

@@ -1,74 +0,0 @@
/*
* 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_SURFACE_H
#define EGL_SURFACE_H
#include <EGL/egl.h>
#include <EGL/eglinternalplatform.h>
#include <map>
#include <GLcommon/SmartPtr.h>
#include "EglConfig.h"
class EglSurface;
typedef SmartPtr<EglSurface> SurfacePtr;
class EglDisplay;
class EglSurface {
public:
typedef enum {
WINDOW = 0,
PBUFFER = 1,
PIXMAP = 3
} ESurfaceType;
ESurfaceType type(){ return m_type;};
EGLNativeSurfaceType native(){return m_native;}
virtual bool setAttrib(EGLint attrib,EGLint val);
virtual bool getAttrib(EGLint attrib,EGLint* val) = 0;
void setDim(int width,int height){ m_width = width; m_height = height;};
EglConfig* getConfig(){return m_config;};
unsigned int getHndl(){return m_hndl;};
virtual ~EglSurface();
private:
static unsigned int s_nextSurfaceHndl;
ESurfaceType m_type;
unsigned int m_hndl;
protected:
EglSurface(EglDisplay *dpy,
ESurfaceType type,
EglConfig* config,
EGLint width,
EGLint height) :
m_type(type),
m_config(config),
m_width(width),
m_height(height),
m_native(NULL),
m_dpy(dpy)
{
m_hndl = ++s_nextSurfaceHndl;
}
protected:
EglConfig* m_config;
EGLint m_width;
EGLint m_height;
EGLNativeSurfaceType m_native;
EglDisplay *m_dpy;
};
#endif

View File

@@ -1,42 +0,0 @@
/*
* 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 "EglThreadInfo.h"
#include "EglOsApi.h"
EglThreadInfo::EglThreadInfo():m_err(EGL_SUCCESS),m_api(EGL_OPENGL_ES_API) {}
#include <cutils/threads.h>
static thread_store_t s_tls = THREAD_STORE_INITIALIZER;
static void tlsDestruct(void *ptr)
{
if (ptr) {
EglThreadInfo *ti = (EglThreadInfo *)ptr;
delete ti;
}
}
EglThreadInfo* EglThreadInfo::get(void)
{
EglThreadInfo *ti = (EglThreadInfo *)thread_store_get(&s_tls);
if (!ti) {
ti = new EglThreadInfo();
thread_store_set(&s_tls, ti, tlsDestruct);
}
return ti;
}

View File

@@ -1,43 +0,0 @@
/*
* 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_THREAD_INFO_H
#define EGL_THREAD_INFO_H
#include <EGL/egl.h>
#include "EglDisplay.h"
#include "EglContext.h"
#include "EglSurface.h"
#include "EglPbufferSurface.h"
class EglThreadInfo {
public:
EglThreadInfo();
void setError(EGLint err) { m_err = err;}
EGLint getError(){ return m_err;}
void destroyContextIfNotCurrent(ContextPtr context );
void setApi(EGLenum api){m_api = api;}
EGLenum getApi(){return m_api;}
static EglThreadInfo* get(void) __attribute__((const));
private:
EglDisplay* m_currentDisplay;
EGLint m_err;
EGLenum m_api;
};
#endif

View File

@@ -1,93 +0,0 @@
/*
* 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 "EglValidate.h"
#include <GLcommon/GLutils.h>
bool EglValidate::confAttrib(EGLint attrib) {
switch(attrib) {
case EGL_BUFFER_SIZE:
case EGL_RED_SIZE:
case EGL_GREEN_SIZE:
case EGL_BLUE_SIZE:
case EGL_ALPHA_SIZE:
case EGL_BIND_TO_TEXTURE_RGB:
case EGL_BIND_TO_TEXTURE_RGBA:
case EGL_CONFIG_CAVEAT:
case EGL_CONFIG_ID:
case EGL_DEPTH_SIZE:
case EGL_LEVEL:
case EGL_MAX_PBUFFER_WIDTH:
case EGL_MAX_PBUFFER_HEIGHT:
case EGL_MAX_PBUFFER_PIXELS:
case EGL_MAX_SWAP_INTERVAL:
case EGL_MIN_SWAP_INTERVAL:
case EGL_RENDERABLE_TYPE:
case EGL_NATIVE_RENDERABLE:
case EGL_NATIVE_VISUAL_ID:
case EGL_NATIVE_VISUAL_TYPE:
case EGL_SAMPLE_BUFFERS:
case EGL_SAMPLES:
case EGL_STENCIL_SIZE:
case EGL_SURFACE_TYPE:
case EGL_TRANSPARENT_TYPE:
case EGL_TRANSPARENT_RED_VALUE:
case EGL_TRANSPARENT_GREEN_VALUE:
case EGL_TRANSPARENT_BLUE_VALUE:
case EGL_CONFORMANT:
return true;
}
return false;
}
bool EglValidate::noAttribs(const EGLint* attrib) {
return !attrib || attrib[0] == EGL_NONE ;
}
bool EglValidate::pbufferAttribs(EGLint width,EGLint height,bool isTexFormatNoTex,bool isTexTargetNoTex) {
if(!isTexFormatNoTex) {
if (!(isPowerOf2(width) && isPowerOf2(height))) return false;
}
return isTexFormatNoTex == isTexTargetNoTex ;
}
bool EglValidate::releaseContext(EGLContext ctx,EGLSurface s1,EGLSurface s2) {
return (ctx == EGL_NO_CONTEXT) &&
(s1 == EGL_NO_SURFACE) &&
(s2 == EGL_NO_SURFACE);
}
bool EglValidate::badContextMatch(EGLContext ctx,EGLSurface s1,EGLSurface s2) {
return ctx != EGL_NO_CONTEXT ? (s1 == EGL_NO_SURFACE || s2 == EGL_NO_SURFACE):
(s1 != EGL_NO_SURFACE || s2 != EGL_NO_SURFACE);
}
bool EglValidate::surfaceTarget(EGLint target) {
return target == EGL_READ || target == EGL_DRAW;
}
bool EglValidate::engine(EGLint engine) {
return engine == EGL_CORE_NATIVE_ENGINE;
}
bool EglValidate::stringName(EGLint name) {
return name == EGL_VENDOR ||
name == EGL_VERSION ||
name == EGL_EXTENSIONS;
}
bool EglValidate::supportedApi(EGLenum api) {
return api == EGL_OPENGL_ES_API;
}

View File

@@ -1,33 +0,0 @@
/*
* 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_VALIDATE_H
#define EGL_VALIDATE_H
#include <EGL/egl.h>
class EglValidate {
public:
static bool confAttrib(EGLint attrib);
static bool noAttribs(const EGLint* attrib);
static bool pbufferAttribs(EGLint width,EGLint height,bool texFormatIsNoTex,bool texTargetIsNoTex);
static bool releaseContext(EGLContext ctx,EGLSurface s1,EGLSurface s2);
static bool badContextMatch(EGLContext ctx,EGLSurface s1,EGLSurface s2);
static bool surfaceTarget(EGLint target);
static bool engine(EGLint engine);
static bool stringName(EGLint name);
static bool supportedApi(EGLenum api);
};
#endif

View File

@@ -1,61 +0,0 @@
/*
* 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 "EglWindowSurface.h"
#include "EglOsApi.h"
std::set<EGLNativeWindowType> EglWindowSurface::s_associatedWins;
bool EglWindowSurface::alreadyAssociatedWithConfig(EGLNativeWindowType win) {
return s_associatedWins.find(win) != s_associatedWins.end();
}
EglWindowSurface::EglWindowSurface(EglDisplay *dpy,
EGLNativeWindowType win,
EglConfig* config,
unsigned int width,unsigned int height) :
EglSurface(dpy, WINDOW,config,width,height),
m_win(win)
{
s_associatedWins.insert(win);
m_native = EglOS::createWindowSurface(win);
}
EglWindowSurface:: ~EglWindowSurface() {
s_associatedWins.erase(m_win);
}
bool EglWindowSurface::getAttrib(EGLint attrib,EGLint* val) {
switch(attrib) {
case EGL_CONFIG_ID:
*val = m_config->id();
break;
case EGL_WIDTH:
*val = m_width;
break;
case EGL_HEIGHT:
*val = m_height;
break;
case EGL_LARGEST_PBUFFER:
case EGL_TEXTURE_FORMAT:
case EGL_TEXTURE_TARGET:
case EGL_MIPMAP_TEXTURE:
break;
default:
return false;
}
return true;
}

View File

@@ -1,37 +0,0 @@
/*
* 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_WINDOW_SURFACE_H
#define EGL_WINDOW_SURFACE_H
#include <set>
#include <EGL/egl.h>
#include "EglSurface.h"
#include "EglConfig.h"
class EglDisplay;
class EglWindowSurface: public EglSurface {
public:
EglWindowSurface(EglDisplay *dpy, EGLNativeWindowType win,EglConfig* config,unsigned width,unsigned int height);
~EglWindowSurface();
bool getAttrib(EGLint attrib,EGLint* val);
static bool alreadyAssociatedWithConfig(EGLNativeWindowType win);
private:
EGLNativeWindowType m_win;
static std::set<EGLNativeWindowType> s_associatedWins;
};
#endif

View File

@@ -1,592 +0,0 @@
/*
* 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 "EglOsApi.h"
#include <windows.h>
#include <wingdi.h>
#include <GL/wglext.h>
#include <stdio.h>
#define IS_TRUE(a) \
if(a != true) return false;
struct DisplayInfo{
DisplayInfo():dc(NULL),hwnd(NULL),isPixelFormatSet(false){};
DisplayInfo(HDC hdc,HWND wnd):isPixelFormatSet(false){dc = hdc; hwnd = wnd;};
HDC dc;
HWND hwnd;
bool isPixelFormatSet;
};
struct TlsData {
std::map<int,DisplayInfo> m_map;
};
static DWORD s_tlsIndex = 0;
static TlsData *getTLS() {
TlsData *tls = (TlsData *)TlsGetValue(s_tlsIndex);
if (!tls) {
tls = new TlsData();
TlsSetValue(s_tlsIndex, tls);
}
return tls;
}
class WinDisplay{
public:
typedef enum {
DEFAULT_DISPLAY = 0
};
WinDisplay(){};
DisplayInfo& getInfo(int configurationIndex){ return getTLS()->m_map[configurationIndex];}
HDC getDC(int configId){return getTLS()->m_map[configId].dc;}
void setInfo(int configurationIndex,const DisplayInfo& info);
bool isPixelFormatSet(int cfgId){ return getTLS()->m_map[cfgId].isPixelFormatSet;}
void pixelFormatWasSet(int cfgId){getTLS()->m_map[cfgId].isPixelFormatSet = true;}
bool infoExists(int configurationIndex);
void releaseAll();
};
void WinDisplay::releaseAll(){
TlsData * tls = getTLS();
for(std::map<int,DisplayInfo>::iterator it = tls->m_map.begin(); it != tls->m_map.end();it++){
if((*it).second.hwnd){
DestroyWindow((*it).second.hwnd);
}
DeleteDC((*it).second.dc);
}
}
bool WinDisplay::infoExists(int configurationIndex){
return getTLS()->m_map.find(configurationIndex) != getTLS()->m_map.end();
}
void WinDisplay::setInfo(int configurationIndex,const DisplayInfo& info){
getTLS()->m_map[configurationIndex] = info;
}
struct WglExtProcs{
PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB;
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB;
PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB;
PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB;
PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB;
PFNWGLMAKECONTEXTCURRENTARBPROC wglMakeContextCurrentARB;
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
};
static WglExtProcs* s_wglExtProcs = NULL;
class SrfcInfo{
public:
typedef enum {
WINDOW = 0,
PBUFFER = 1,
PIXMAP = 2
}SurfaceType;
explicit SrfcInfo(HWND wnd);
explicit SrfcInfo(HPBUFFERARB pb);
explicit SrfcInfo(HBITMAP bmap);
HWND getHwnd(){ return m_hwnd;};
HDC getDC(){ return m_hdc;};
HBITMAP getBmap(){ return m_bmap;};
HPBUFFERARB getPbuffer(){ return m_pb;};
~SrfcInfo();
private:
HWND m_hwnd;
HPBUFFERARB m_pb;
HBITMAP m_bmap;
HDC m_hdc;
SurfaceType m_type;
};
SrfcInfo::SrfcInfo(HBITMAP bmap):m_hwnd(NULL),
m_pb(NULL),
m_hdc(NULL),
m_type(PIXMAP){
m_bmap = bmap;
}
SrfcInfo::SrfcInfo(HWND wnd):m_pb(NULL),
m_bmap(NULL),
m_type(WINDOW){
m_hwnd = wnd;
m_hdc = GetDC(wnd);
}
SrfcInfo::SrfcInfo(HPBUFFERARB pb):m_hwnd(NULL),
m_bmap(NULL),
m_type(PBUFFER){
m_pb = pb;
if(s_wglExtProcs->wglGetPbufferDCARB){
m_hdc = s_wglExtProcs->wglGetPbufferDCARB(pb);
}
}
SrfcInfo::~SrfcInfo(){
if(m_type == WINDOW){
ReleaseDC(m_hwnd,m_hdc);
}
}
namespace EglOS{
PROC wglGetExtentionsProcAddress(HDC hdc,const char *extension_name,const char* proc_name)
{
// this is pointer to function which returns pointer to string with list of all wgl extensions
PFNWGLGETEXTENSIONSSTRINGARBPROC _wglGetExtensionsStringARB = NULL;
// determine pointer to wglGetExtensionsStringEXT function
_wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB");
if(!_wglGetExtensionsStringARB){
fprintf(stderr,"could not get wglGetExtensionsStringARB\n");
return NULL;
}
if (!_wglGetExtensionsStringARB || strstr(_wglGetExtensionsStringARB(hdc), extension_name) == NULL)
{
fprintf(stderr,"extension %s was not found\n",extension_name);
// string was not found
return NULL;
}
// extension is supported
return wglGetProcAddress(proc_name);
}
LRESULT CALLBACK dummyWndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
HWND createDummyWindow(){
WNDCLASSEX wcx;
wcx.cbSize = sizeof(wcx); // size of structure
wcx.style = CS_OWNDC |CS_HREDRAW |CS_VREDRAW; // redraw if size changes
wcx.lpfnWndProc = dummyWndProc; // points to window procedure
wcx.cbClsExtra = 0; // no extra class memory
wcx.cbWndExtra = sizeof(void*); // save extra window memory, to store VasWindow instance
wcx.hInstance = NULL; // handle to instance
wcx.hIcon = NULL; // predefined app. icon
wcx.hCursor = NULL;
wcx.hbrBackground = NULL; // no background brush
wcx.lpszMenuName = NULL; // name of menu resource
wcx.lpszClassName = "DummyWin"; // name of window class
wcx.hIconSm = (HICON) NULL; // small class icon
ATOM winClass = RegisterClassEx(&wcx);
HWND hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,
"DummyWin",
"Dummy",
WS_POPUP,
0,
0,
1,
1,
NULL,
NULL,
0,0);
return hwnd;
}
EGLNativeInternalDisplayType getDefaultDisplay() {
if (!s_tlsIndex) s_tlsIndex = TlsAlloc();
WinDisplay* dpy = new WinDisplay();
HWND hwnd = createDummyWindow();
HDC hdc = GetDC(hwnd);
dpy->setInfo(WinDisplay::DEFAULT_DISPLAY,DisplayInfo(hdc,hwnd));
return static_cast<EGLNativeInternalDisplayType>(dpy);
}
EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType display){
if (!s_tlsIndex) s_tlsIndex = TlsAlloc();
WinDisplay* dpy = new WinDisplay();
dpy->setInfo(WinDisplay::DEFAULT_DISPLAY,DisplayInfo(display,NULL));
return dpy;
}
static HDC getDummyDC(EGLNativeInternalDisplayType display,int cfgId){
HDC dpy = NULL;
if(!display->infoExists(cfgId)){
HWND hwnd = createDummyWindow();
dpy = GetDC(hwnd);
display->setInfo(cfgId,DisplayInfo(dpy,hwnd));
} else {
dpy = display->getDC(cfgId);
}
return dpy;
}
void initPtrToWglFunctions(){
HWND hwnd = createDummyWindow();
HDC dpy = GetDC(hwnd);
if(!hwnd || !dpy){
fprintf(stderr,"error while getting DC\n");
return;
}
EGLNativeContextType ctx = NULL;
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL | // support OpenGL
PFD_DOUBLEBUFFER, // double buffered
PFD_TYPE_RGBA, // RGBA type
24, // 24-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
0, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
32, // 32-bit z-buffer
0, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};
int iPixelFormat,err;
iPixelFormat = ChoosePixelFormat(dpy, &pfd);
if(iPixelFormat < 0){
fprintf(stderr,"error while choosing pixel format\n");
return;
}
if(!SetPixelFormat(dpy,iPixelFormat,&pfd)){
int err = GetLastError();
fprintf(stderr,"error while setting pixel format 0x%x\n",err);
return;
}
ctx = wglCreateContext(dpy);
if(!ctx){
err = GetLastError();
fprintf(stderr,"error while creating dummy context %d\n",err);
}
if(!wglMakeCurrent(dpy,ctx)){
err = GetLastError();
fprintf(stderr,"error while making dummy context current %d\n",err);
}
if(!s_wglExtProcs){
s_wglExtProcs = new WglExtProcs();
s_wglExtProcs->wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)wglGetExtentionsProcAddress(dpy,"WGL_ARB_pixel_format","wglGetPixelFormatAttribivARB");
s_wglExtProcs->wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetExtentionsProcAddress(dpy,"WGL_ARB_pixel_format","wglChoosePixelFormatARB");
s_wglExtProcs->wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC)wglGetExtentionsProcAddress(dpy,"WGL_ARB_pbuffer","wglCreatePbufferARB");
s_wglExtProcs->wglReleasePbufferDCARB = (PFNWGLRELEASEPBUFFERDCARBPROC)wglGetExtentionsProcAddress(dpy,"WGL_ARB_pbuffer","wglReleasePbufferDCARB");
s_wglExtProcs->wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC)wglGetExtentionsProcAddress(dpy,"WGL_ARB_pbuffer","wglDestroyPbufferARB");
s_wglExtProcs->wglGetPbufferDCARB = (PFNWGLGETPBUFFERDCARBPROC)wglGetExtentionsProcAddress(dpy,"WGL_ARB_pbuffer","wglGetPbufferDCARB");
s_wglExtProcs->wglMakeContextCurrentARB = (PFNWGLMAKECONTEXTCURRENTARBPROC)wglGetExtentionsProcAddress(dpy,"WGL_ARB_make_current_read","wglMakeContextCurrentARB");
s_wglExtProcs->wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetExtentionsProcAddress(dpy,"WGL_EXT_swap_control","wglSwapIntervalEXT");
}
wglMakeCurrent(dpy,NULL);
DestroyWindow(hwnd);
DeleteDC(dpy);
}
bool releaseDisplay(EGLNativeInternalDisplayType dpy) {
dpy->releaseAll();
return true;
}
void deleteDisplay(EGLNativeInternalDisplayType idpy){
if(idpy){
delete idpy;
}
}
static bool initPixelFormat(HDC dc){
PIXELFORMATDESCRIPTOR pfd;
unsigned int numpf;
int iPixelFormat;
if(s_wglExtProcs->wglChoosePixelFormatARB) {
int i0 = 0;
float f0 = 0.0f;
return s_wglExtProcs->wglChoosePixelFormatARB(dc,&i0, &f0, 1, &iPixelFormat, &numpf);
} else {
return ChoosePixelFormat(dc,&pfd);
}
}
EglConfig* pixelFormatToConfig(EGLNativeInternalDisplayType display,int renderableType,EGLNativePixelFormatType* frmt,int index){
EGLint red,green,blue,alpha,depth,stencil;
EGLint supportedSurfaces,visualType,visualId;
EGLint transparentType,samples;
EGLint tRed,tGreen,tBlue;
EGLint pMaxWidth,pMaxHeight,pMaxPixels;
EGLint configId,level;
EGLint window,bitmap,pbuffer,transparent;
HDC dpy = getDummyDC(display,WinDisplay::DEFAULT_DISPLAY);
if(frmt->iPixelType != PFD_TYPE_RGBA) return NULL; // other formats are not supported yet
if(!((frmt->dwFlags & PFD_SUPPORT_OPENGL) && (frmt->dwFlags & PFD_DOUBLEBUFFER))) return NULL; //pixel format does not supports opengl or double buffer
if( 0 != (frmt->dwFlags & (PFD_GENERIC_FORMAT | PFD_NEED_PALETTE )) ) return NULL; //discard generic pixel formats as well as pallete pixel formats
int attribs [] = {
WGL_DRAW_TO_WINDOW_ARB,
WGL_DRAW_TO_BITMAP_ARB,
WGL_DRAW_TO_PBUFFER_ARB,
WGL_TRANSPARENT_ARB,
WGL_TRANSPARENT_RED_VALUE_ARB,
WGL_TRANSPARENT_GREEN_VALUE_ARB,
WGL_TRANSPARENT_BLUE_VALUE_ARB
};
supportedSurfaces = 0;
if(!s_wglExtProcs->wglGetPixelFormatAttribivARB) return NULL;
IS_TRUE(s_wglExtProcs->wglGetPixelFormatAttribivARB(dpy,index,0,1,&attribs[0],&window));
IS_TRUE(s_wglExtProcs->wglGetPixelFormatAttribivARB(dpy,index,0,1,&attribs[1],&bitmap));
IS_TRUE(s_wglExtProcs->wglGetPixelFormatAttribivARB(dpy,index,0,1,&attribs[2],&pbuffer));
if(window) supportedSurfaces |= EGL_WINDOW_BIT;
if(bitmap) supportedSurfaces |= EGL_PIXMAP_BIT;
if(pbuffer) supportedSurfaces |= EGL_PBUFFER_BIT;
if(!supportedSurfaces) return NULL;
//default values
visualId = 0;
visualType = EGL_NONE;
EGLenum caveat = EGL_NONE;
EGLBoolean renderable = EGL_FALSE;
pMaxWidth = PBUFFER_MAX_WIDTH;
pMaxHeight = PBUFFER_MAX_HEIGHT;
pMaxPixels = PBUFFER_MAX_PIXELS;
samples = 0 ;
level = 0 ;
IS_TRUE(s_wglExtProcs->wglGetPixelFormatAttribivARB(dpy,index,0,1,&attribs[3],&transparent));
if(transparent) {
transparentType = EGL_TRANSPARENT_RGB;
IS_TRUE(s_wglExtProcs->wglGetPixelFormatAttribivARB(dpy,index,0,1,&attribs[4],&tRed));
IS_TRUE(s_wglExtProcs->wglGetPixelFormatAttribivARB(dpy,index,0,1,&attribs[5],&tGreen));
IS_TRUE(s_wglExtProcs->wglGetPixelFormatAttribivARB(dpy,index,0,1,&attribs[6],&tBlue));
} else {
transparentType = EGL_NONE;
}
red = frmt->cRedBits;
green = frmt->cGreenBits;
blue = frmt->cBlueBits;
alpha = frmt->cAlphaBits;
depth = frmt->cDepthBits;
stencil = frmt->cStencilBits;
return new EglConfig(red,green,blue,alpha,caveat,(EGLint)index,depth,level,pMaxWidth,pMaxHeight,pMaxPixels,renderable,renderableType,
visualId,visualType,samples,stencil,supportedSurfaces,transparentType,tRed,tGreen,tBlue,*frmt);
}
void queryConfigs(EGLNativeInternalDisplayType display,int renderableType,ConfigsList& listOut) {
PIXELFORMATDESCRIPTOR pfd;
int iPixelFormat = 1;
HDC dpy = getDummyDC(display,WinDisplay::DEFAULT_DISPLAY);
//
// We need to call wglChoosePixelFormat at least once,
// seems that the driver needs to initialize itself.
// do it here during initialization.
//
initPixelFormat(dpy);
//quering num of formats
int nFormats = DescribePixelFormat(dpy, iPixelFormat,sizeof(PIXELFORMATDESCRIPTOR), &pfd);
//inserting rest of formats
for(iPixelFormat;iPixelFormat < nFormats; iPixelFormat++) {
DescribePixelFormat(dpy, iPixelFormat,sizeof(PIXELFORMATDESCRIPTOR), &pfd);
EglConfig* pConfig = pixelFormatToConfig(display,renderableType,&pfd,iPixelFormat);
if(pConfig) listOut.push_back(pConfig);
}
}
bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win) {
return IsWindow(win);
}
bool validNativeWin(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win) {
if (!win) return false;
return validNativeWin(dpy,win->getHwnd());
}
bool validNativePixmap(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType pix) {
BITMAP bm;
if (!pix) return false;
return GetObject(pix->getBmap(), sizeof(BITMAP), (LPSTR)&bm);
}
bool checkWindowPixelFormatMatch(EGLNativeInternalDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height) {
RECT r;
if(!GetClientRect(win,&r)) return false;
*width = r.right - r.left;
*height = r.bottom - r.top;
HDC dc = GetDC(win);
EGLNativePixelFormatType nativeConfig = cfg->nativeConfig();
bool ret = SetPixelFormat(dc,cfg->nativeId(),&nativeConfig);
DeleteDC(dc);
return ret;
}
bool checkPixmapPixelFormatMatch(EGLNativeInternalDisplayType dpy,EGLNativePixmapType pix,EglConfig* cfg,unsigned int* width,unsigned int* height){
BITMAP bm;
if(!GetObject(pix, sizeof(BITMAP), (LPSTR)&bm)) return false;
*width = bm.bmWidth;
*height = bm.bmHeight;
return true;
}
EGLNativeSurfaceType createPbufferSurface(EGLNativeInternalDisplayType display,EglConfig* cfg,EglPbufferSurface* pbSurface) {
HDC dpy = getDummyDC(display,cfg->nativeId());
EGLint width,height,largest,texTarget,texFormat;
pbSurface->getDim(&width,&height,&largest);
pbSurface->getTexInfo(&texTarget,&texFormat);
int wglTexFormat = WGL_NO_TEXTURE_ARB;
int wglTexTarget = (texTarget == EGL_TEXTURE_2D)? WGL_TEXTURE_2D_ARB:
WGL_NO_TEXTURE_ARB;
switch(texFormat) {
case EGL_TEXTURE_RGB:
wglTexFormat = WGL_TEXTURE_RGB_ARB;
break;
case EGL_TEXTURE_RGBA:
wglTexFormat = WGL_TEXTURE_RGBA_ARB;
break;
}
int pbAttribs[] = {
WGL_TEXTURE_TARGET_ARB ,wglTexTarget,
WGL_TEXTURE_FORMAT_ARB ,wglTexFormat,
0
};
if(!s_wglExtProcs->wglCreatePbufferARB) return NULL;
EGLNativePbufferType pb = s_wglExtProcs->wglCreatePbufferARB(dpy,cfg->nativeId(),width,height,pbAttribs);
if(!pb) {
DWORD err = GetLastError();
return NULL;
}
return new SrfcInfo(pb);
}
bool releasePbuffer(EGLNativeInternalDisplayType display,EGLNativeSurfaceType pb) {
if (!pb) return false;
if(!s_wglExtProcs->wglReleasePbufferDCARB || !s_wglExtProcs->wglDestroyPbufferARB) return false;
if(!s_wglExtProcs->wglReleasePbufferDCARB(pb->getPbuffer(),pb->getDC()) || !s_wglExtProcs->wglDestroyPbufferARB(pb->getPbuffer())){
DWORD err = GetLastError();
return false;
}
return true;
}
EGLNativeContextType createContext(EGLNativeInternalDisplayType display,EglConfig* cfg,EGLNativeContextType sharedContext) {
EGLNativeContextType ctx = NULL;
HDC dpy = getDummyDC(display,cfg->nativeId());
if(!display->isPixelFormatSet(cfg->nativeId())){
EGLNativePixelFormatType nativeConfig = cfg->nativeConfig();
if(!SetPixelFormat(dpy,cfg->nativeId(),&nativeConfig)){
return NULL;
}
display->pixelFormatWasSet(cfg->nativeId());
}
ctx = wglCreateContext(dpy);
if(ctx && sharedContext) {
if(!wglShareLists(sharedContext,ctx)) {
wglDeleteContext(ctx);
return NULL;
}
}
return ctx;
}
bool destroyContext(EGLNativeInternalDisplayType dpy,EGLNativeContextType ctx) {
if(!wglDeleteContext(ctx)) {
DWORD err = GetLastError();
return false;
}
return true;
}
bool makeCurrent(EGLNativeInternalDisplayType display,EglSurface* read,EglSurface* draw,EGLNativeContextType ctx) {
HDC hdcRead = read ? read->native()->getDC(): NULL;
HDC hdcDraw = draw ? draw->native()->getDC(): NULL;
bool retVal = false;
if(hdcRead == hdcDraw){
bool ret = wglMakeCurrent(hdcDraw,ctx);
return ret;
} else if (!s_wglExtProcs->wglMakeContextCurrentARB ) {
return false;
}
retVal = s_wglExtProcs->wglMakeContextCurrentARB(hdcDraw,hdcRead,ctx);
return retVal;
}
void swapBuffers(EGLNativeInternalDisplayType display,EGLNativeSurfaceType srfc){
if(srfc && !SwapBuffers(srfc->getDC())) {
DWORD err = GetLastError();
}
}
void waitNative(){}
void swapInterval(EGLNativeInternalDisplayType dpy,EGLNativeSurfaceType win,int interval) {
if (s_wglExtProcs->wglSwapIntervalEXT){
s_wglExtProcs->wglSwapIntervalEXT(interval);
}
}
EGLNativeSurfaceType createWindowSurface(EGLNativeWindowType wnd){
return new SrfcInfo(wnd);
}
EGLNativeSurfaceType createPixmapSurface(EGLNativePixmapType pix){
return new SrfcInfo(pix);
}
void destroySurface(EGLNativeSurfaceType srfc){
delete srfc;
}
};

View File

@@ -1,310 +0,0 @@
/*
* 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 "EglOsApi.h"
#include <string.h>
#include <X11/Xlib.h>
#include <GL/glx.h>
#include <utils/threads.h>
class ErrorHandler{
public:
ErrorHandler(EGLNativeDisplayType dpy);
~ErrorHandler();
int getLastError(){ return s_lastErrorCode;};
private:
static int s_lastErrorCode;
int (*m_oldErrorHandler) (Display *, XErrorEvent *);
static android::Mutex s_lock;
static int errorHandlerProc(EGLNativeDisplayType dpy,XErrorEvent* event);
};
class SrfcInfo{
public:
typedef enum{
WINDOW = 0,
PBUFFER = 1,
PIXMAP
}SurfaceType;
SrfcInfo(GLXDrawable drawable,SurfaceType type):m_type(type),
m_srfc(drawable){};
GLXDrawable srfc(){return m_srfc;};
private:
SurfaceType m_type;
GLXDrawable m_srfc;
};
int ErrorHandler::s_lastErrorCode = 0;
android::Mutex ErrorHandler::s_lock;
ErrorHandler::ErrorHandler(EGLNativeDisplayType dpy){
android::Mutex::Autolock mutex(s_lock);
XSync(dpy,False);
s_lastErrorCode = 0;
m_oldErrorHandler = XSetErrorHandler(errorHandlerProc);
}
ErrorHandler::~ErrorHandler(){
android::Mutex::Autolock mutex(s_lock);
XSetErrorHandler(m_oldErrorHandler);
s_lastErrorCode = 0;
}
int ErrorHandler::errorHandlerProc(EGLNativeDisplayType dpy,XErrorEvent* event){
android::Mutex::Autolock mutex(s_lock);
s_lastErrorCode = event->error_code;
return 0;
}
#define IS_SUCCESS(a) \
if(a != Success) return false;
namespace EglOS {
EGLNativeDisplayType getDefaultDisplay() {return XOpenDisplay(0);}
bool releaseDisplay(EGLNativeDisplayType dpy) {
return XCloseDisplay(dpy);
}
EglConfig* pixelFormatToConfig(EGLNativeDisplayType dpy,int renderableType,EGLNativePixelFormatType* frmt){
int bSize,red,green,blue,alpha,depth,stencil;
int supportedSurfaces,visualType,visualId;
int caveat,transparentType,samples;
int tRed=0,tGreen=0,tBlue=0;
int pMaxWidth,pMaxHeight,pMaxPixels;
int tmp;
int configId,level,renderable;
int doubleBuffer;
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_TRANSPARENT_TYPE,&tmp));
if(tmp == GLX_TRANSPARENT_INDEX) {
return NULL; // not supporting transparent index
} else if( tmp == GLX_NONE) {
transparentType = EGL_NONE;
} else {
transparentType = EGL_TRANSPARENT_RGB;
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_TRANSPARENT_RED_VALUE,&tRed));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_TRANSPARENT_GREEN_VALUE,&tGreen));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_TRANSPARENT_BLUE_VALUE,&tBlue));
}
//
// filter out single buffer configurations
//
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_DOUBLEBUFFER,&doubleBuffer));
if (!doubleBuffer) return NULL;
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_BUFFER_SIZE,&bSize));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_RED_SIZE,&red));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_GREEN_SIZE,&green));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_BLUE_SIZE,&blue));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_ALPHA_SIZE,&alpha));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_DEPTH_SIZE,&depth));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_STENCIL_SIZE,&stencil));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_X_RENDERABLE,&renderable));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_X_VISUAL_TYPE,&visualType));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_VISUAL_ID,&visualId));
//supported surfaces types
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_DRAWABLE_TYPE,&tmp));
supportedSurfaces = 0;
if(tmp & GLX_WINDOW_BIT && visualId != 0) {
supportedSurfaces |= EGL_WINDOW_BIT;
} else {
visualId = 0;
visualType = EGL_NONE;
}
if(tmp & GLX_PBUFFER_BIT) supportedSurfaces |= EGL_PBUFFER_BIT;
caveat = 0;
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_CONFIG_CAVEAT,&tmp));
if (tmp == GLX_NONE) caveat = EGL_NONE;
else if(tmp == GLX_SLOW_CONFIG) caveat = EGL_SLOW_CONFIG;
else if(tmp == GLX_NON_CONFORMANT_CONFIG) caveat = EGL_NON_CONFORMANT_CONFIG;
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_MAX_PBUFFER_WIDTH,&pMaxWidth));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_MAX_PBUFFER_HEIGHT,&pMaxHeight));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_MAX_PBUFFER_HEIGHT,&pMaxPixels));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_LEVEL,&level));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_FBCONFIG_ID,&configId));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_SAMPLES,&samples));
//Filter out configs that does not support RGBA
IS_SUCCESS(glXGetFBConfigAttrib(dpy,*frmt,GLX_RENDER_TYPE,&tmp));
if (!(tmp & GLX_RGBA_BIT)) {
return NULL;
}
return new EglConfig(red,green,blue,alpha,caveat,configId,depth,level,pMaxWidth,pMaxHeight,
pMaxPixels,renderable,renderableType,visualId,visualType,samples,stencil,
supportedSurfaces,transparentType,tRed,tGreen,tBlue,*frmt);
}
void queryConfigs(EGLNativeDisplayType dpy,int renderableType,ConfigsList& listOut) {
int n;
EGLNativePixelFormatType* frmtList = glXGetFBConfigs(dpy,0,&n);
for(int i =0 ;i < n ; i++) {
EglConfig* conf = pixelFormatToConfig(dpy,renderableType,&frmtList[i]);
if(conf) listOut.push_back(conf);
}
XFree(frmtList);
}
bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeWindowType win) {
Window root;
int tmp;
unsigned int utmp;
ErrorHandler handler(dpy);
if(!XGetGeometry(dpy,win,&root,&tmp,&tmp,&utmp,&utmp,&utmp,&utmp)) return false;
return handler.getLastError() == 0;
}
bool validNativeWin(EGLNativeDisplayType dpy,EGLNativeSurfaceType win) {
if (!win) return false;
return validNativeWin(dpy,win->srfc());
}
bool validNativePixmap(EGLNativeDisplayType dpy,EGLNativeSurfaceType pix) {
Window root;
int tmp;
unsigned int utmp;
ErrorHandler handler(dpy);
if(!XGetGeometry(dpy,pix ? pix->srfc() : NULL,&root,&tmp,&tmp,&utmp,&utmp,&utmp,&utmp)) return false;
return handler.getLastError() == 0;
}
bool checkWindowPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height) {
//TODO: to check what does ATI & NVIDIA enforce on win pixelformat
unsigned int depth,configDepth,border;
int r,g,b,x,y;
IS_SUCCESS(glXGetFBConfigAttrib(dpy,cfg->nativeConfig(),GLX_RED_SIZE,&r));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,cfg->nativeConfig(),GLX_GREEN_SIZE,&g));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,cfg->nativeConfig(),GLX_BLUE_SIZE,&b));
configDepth = r + g + b;
Window root;
if(!XGetGeometry(dpy,win,&root,&x,&y,width,height,&border,&depth)) return false;
return depth >= configDepth;
}
bool checkPixmapPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativePixmapType pix,EglConfig* cfg,unsigned int* width,unsigned int* height) {
unsigned int depth,configDepth,border;
int r,g,b,x,y;
IS_SUCCESS(glXGetFBConfigAttrib(dpy,cfg->nativeConfig(),GLX_RED_SIZE,&r));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,cfg->nativeConfig(),GLX_GREEN_SIZE,&g));
IS_SUCCESS(glXGetFBConfigAttrib(dpy,cfg->nativeConfig(),GLX_BLUE_SIZE,&b));
configDepth = r + g + b;
Window root;
if(!XGetGeometry(dpy,pix,&root,&x,&y,width,height,&border,&depth)) return false;
return depth >= configDepth;
}
EGLNativeSurfaceType createPbufferSurface(EGLNativeDisplayType dpy,EglConfig* cfg,EglPbufferSurface* srfc){
EGLint width,height,largest;
srfc->getDim(&width,&height,&largest);
int attribs[] = {
GLX_PBUFFER_WIDTH ,width,
GLX_PBUFFER_HEIGHT ,height,
GLX_LARGEST_PBUFFER ,largest,
None
};
GLXPbuffer pb = glXCreatePbuffer(dpy,cfg->nativeConfig(),attribs);
return pb ? new SrfcInfo(pb,SrfcInfo::PBUFFER) : NULL;
}
bool releasePbuffer(EGLNativeDisplayType dis,EGLNativeSurfaceType pb) {
if (!pb) return false;
glXDestroyPbuffer(dis,pb->srfc());
return true;
}
EGLNativeContextType createContext(EGLNativeDisplayType dpy,EglConfig* cfg,EGLNativeContextType sharedContext) {
ErrorHandler handler(dpy);
EGLNativeContextType retVal = glXCreateNewContext(dpy,cfg->nativeConfig(),GLX_RGBA_TYPE,sharedContext,true);
return handler.getLastError() == 0 ? retVal : NULL;
}
bool destroyContext(EGLNativeDisplayType dpy,EGLNativeContextType ctx) {
glXDestroyContext(dpy,ctx);
return true;
}
bool makeCurrent(EGLNativeDisplayType dpy,EglSurface* read,EglSurface* draw,EGLNativeContextType ctx){
ErrorHandler handler(dpy);
bool retval = false;
if (!ctx && !read && !draw) {
// unbind
retval = glXMakeContextCurrent(dpy, NULL, NULL, NULL);
}
else if (ctx && read && draw) {
retval = glXMakeContextCurrent(dpy,draw->native()->srfc(),read->native()->srfc(),ctx);
}
return (handler.getLastError() == 0) && retval;
}
void swapBuffers(EGLNativeDisplayType dpy,EGLNativeSurfaceType srfc){
if (srfc) {
glXSwapBuffers(dpy,srfc->srfc());
}
}
void waitNative() {
glXWaitX();
}
void swapInterval(EGLNativeDisplayType dpy,EGLNativeSurfaceType win,int interval){
const char* extensions = glXQueryExtensionsString(dpy,DefaultScreen(dpy));
typedef void (*GLXSWAPINTERVALEXT)(Display*,GLXDrawable,int);
GLXSWAPINTERVALEXT glXSwapIntervalEXT = NULL;
if(strstr(extensions,"EXT_swap_control")) {
glXSwapIntervalEXT = (GLXSWAPINTERVALEXT)glXGetProcAddress((const GLubyte*)"glXSwapIntervalEXT");
}
if(glXSwapIntervalEXT && win) {
glXSwapIntervalEXT(dpy,win->srfc(),interval);
}
}
EGLNativeSurfaceType createWindowSurface(EGLNativeWindowType wnd){
return new SrfcInfo(wnd,SrfcInfo::WINDOW);
}
EGLNativeSurfaceType createPixmapSurface(EGLNativePixmapType pix){
return new SrfcInfo(pix,SrfcInfo::PIXMAP);
}
void destroySurface(EGLNativeSurfaceType srfc){
delete srfc;
};
EGLNativeInternalDisplayType getInternalDisplay(EGLNativeDisplayType dpy){
return dpy;
}
void deleteDisplay(EGLNativeInternalDisplayType idpy){
}
};

View File

@@ -1,50 +0,0 @@
#ifndef MAC_NATIVE_H
#define MAC_NATIVE_H
/*
* 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.
*/
typedef enum { // Mac equivalence
MAC_HAS_DOUBLE_BUFFER = 5, // NSOpenGLPFADoubleBuffer
MAC_DRAW_TO_WINDOW = 80, // NSOpenGLPFAWindow
MAC_DRAW_TO_PBUFFER = 90, // NSOpenGLPFAPixelBuffer
MAC_SAMPLES_PER_PIXEL = 56, // NSOpenGLPFASamples
MAC_COLOR_SIZE = 8, // NSOpenGLPFAColorSize
MAC_ALPHA_SIZE = 11, // NSOpenGLPFAAlphaSize
MAC_DEPTH_SIZE = 12, // NSOpenGLPFADepthSize
MAC_STENCIL_SIZE = 13 // NSOpenGLPFAStencilSize
} MacPixelFormatAttribs;
extern "C"{
int getNumPixelFormats();
void* getPixelFormat(int i);
void getPixelFormatAttrib(void* pixelFormat,int attrib,int* val);
void* nsCreateContext(void* format,void* share);
void nsWindowMakeCurrent(void* context,void* nativeWin);
void nsPBufferMakeCurrent(void* context,void* nativePBuffer,int level);
void nsSwapBuffers();
void nsSwapInterval(int *interval);
void nsDestroyContext(void* context);
void* nsCreatePBuffer(GLenum target,GLenum format,int maxMip,int width,int height);
void nsDestroyPBuffer(void* pbuffer);
bool nsGetWinDims(void* win,unsigned int* width,unsigned int* height);
bool nsCheckColor(void* win,int colorSize);
}
#endif

View File

@@ -1,179 +0,0 @@
/*
* 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 <Cocoa/Cocoa.h>
#include <OpenGL/OpenGL.h>
#include "MacPixelFormatsAttribs.h"
//
// EmuGLContext inherit from NSOpenGLContext
// and adds binding state for the context to know
// if it was last bounded to a pbuffer or a window.
// This is because after the context was bounded to
// a Pbuffer, before we bind it to a window we must
// release it form the pbuffer by calling the
// clearDrawable method. We do not want to call clearDrawable
// more than really needed since when it is called at a time
// that a window is bounded to the context it will clear the
// window content causing flickering effect.
// Thererfore we call clearDrawable only when we bind the context
// to a window and it was previously bound to a Pbuffer.
//
@interface EmuGLContext : NSOpenGLContext {
@private
int boundToPbuffer;
int boundToWin;
}
- (id) initWithFormat:(NSOpenGLPixelFormat *)pixelFormat shareContext:(NSOpenGLContext *)share;
- (void) preBind:(int)forPbuffer;
@end
@implementation EmuGLContext
- (id) initWithFormat:(NSOpenGLPixelFormat *)pixelFormat shareContext:(NSOpenGLContext *)share
{
self = [super initWithFormat:pixelFormat shareContext:share];
if (self != nil) {
boundToPbuffer = 0;
boundToWin = 0;
}
return self;
}
- (void) preBind:(int)forPbuffer
{
if ((!forPbuffer && boundToPbuffer)) {
[self clearDrawable];
}
boundToPbuffer = forPbuffer;
boundToWin = !boundToPbuffer;
}
@end
int getNumPixelFormats(){
int size;
NSOpenGLPixelFormatAttribute** attrib_lists = getPixelFormatsAttributes(&size);
return size;
}
void* getPixelFormat(int i){
int size;
NSOpenGLPixelFormatAttribute** attrib_lists = getPixelFormatsAttributes(&size);
return [[NSOpenGLPixelFormat alloc] initWithAttributes:attrib_lists[i]];
}
void getPixelFormatAttrib(void* pixelFormat,int attrib,int* val){
NSOpenGLPixelFormat *frmt = (NSOpenGLPixelFormat *)pixelFormat;
[frmt getValues:val forAttribute:attrib forVirtualScreen:0];
}
void* nsCreateContext(void* format,void* share){
NSOpenGLPixelFormat* frmt = (NSOpenGLPixelFormat*)format;
return [[EmuGLContext alloc] initWithFormat:frmt shareContext:share];
}
void nsPBufferMakeCurrent(void* context,void* nativePBuffer,int level){
EmuGLContext* ctx = (EmuGLContext *)context;
NSOpenGLPixelBuffer* pbuff = (NSOpenGLPixelBuffer *)nativePBuffer;
if(ctx == nil){
[NSOpenGLContext clearCurrentContext];
} else {
if(pbuff != nil){
[ctx preBind:1];
[ctx setPixelBuffer:pbuff cubeMapFace:0 mipMapLevel:level currentVirtualScreen:0];
[ctx makeCurrentContext];
}
}
}
void nsWindowMakeCurrent(void* context,void* nativeWin){
EmuGLContext* ctx = (EmuGLContext *)context;
NSView* win = (NSView *)nativeWin;
if(ctx == nil){
[NSOpenGLContext clearCurrentContext];
} else if (win != nil) {
[ctx preBind:0];
[ctx setView: win];
[ctx makeCurrentContext];
}
}
void nsSwapBuffers(){
NSOpenGLContext* ctx = [NSOpenGLContext currentContext];
if(ctx != nil){
[ctx flushBuffer];
}
}
void nsSwapInterval(int *interval){
NSOpenGLContext* ctx = [NSOpenGLContext currentContext];
if( ctx != nil){
[ctx setValues:interval forParameter:NSOpenGLCPSwapInterval];
}
}
void nsDestroyContext(void* context){
EmuGLContext *ctx = (EmuGLContext*)context;
if(ctx != nil){
[ctx release];
}
}
void* nsCreatePBuffer(GLenum target,GLenum format,int maxMip,int width,int height){
return [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:target
textureInternalFormat:format
textureMaxMipMapLevel:maxMip
pixelsWide:width pixelsHigh:height];
}
void nsDestroyPBuffer(void* pbuffer){
NSOpenGLPixelBuffer *pbuf = (NSOpenGLPixelBuffer*)pbuffer;
if(pbuf != nil){
[pbuf release];
}
}
bool nsGetWinDims(void* win,unsigned int* width,unsigned int* height){
NSView* view = (NSView*)win;
if(view != nil){
NSRect rect = [view bounds];
*width = rect.size.width;
*height = rect.size.height;
return true;
}
return false;
}
bool nsCheckColor(void* win,int colorSize){
NSView* view = (NSView*)win;
if(view != nil){
NSWindow* wnd = [view window];
if(wnd != nil){
NSWindowDepth limit = [wnd depthLimit];
NSWindowDepth defaultLimit = [NSWindow defaultDepthLimit];
int depth = (limit != 0) ? NSBitsPerPixelFromDepth(limit):
NSBitsPerPixelFromDepth(defaultLimit);
return depth >= colorSize;
}
}
return false;
}

View File

@@ -1,23 +0,0 @@
#ifndef MAC_PIXELS_FORMATS_ATTRIBS_H
#define MAC_PIXELS_FORMATS_ATTRIBS_H
/*
* 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 <Cocoa/Cocoa.h>
NSOpenGLPixelFormatAttribute** getPixelFormatsAttributes(int* size);
#endif

View File

@@ -1,214 +0,0 @@
#include "MacPixelFormatsAttribs.h"
/*
* 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 NSOpenGLPixelFormatAttribute attrs32_1[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,32,
NSOpenGLPFADepthSize ,24,
NSOpenGLPFAStencilSize ,8,
0
};
static NSOpenGLPixelFormatAttribute attrs32_2[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,32,
NSOpenGLPFAAlphaSize ,8,
NSOpenGLPFADepthSize ,24,
NSOpenGLPFAStencilSize ,8,
0
};
static NSOpenGLPixelFormatAttribute attrs32_3[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,32,
NSOpenGLPFAAlphaSize ,8,
0
};
static NSOpenGLPixelFormatAttribute attrs32_4[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,32,
0
};
static NSOpenGLPixelFormatAttribute attrs32_5[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,32,
NSOpenGLPFADepthSize ,24,
NSOpenGLPFASamples ,2,
0
};
static NSOpenGLPixelFormatAttribute attrs32_6[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,32,
NSOpenGLPFADepthSize ,24,
NSOpenGLPFASamples ,4,
0
};
static NSOpenGLPixelFormatAttribute attrs32_7[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,32,
NSOpenGLPFAAlphaSize ,8,
NSOpenGLPFADepthSize ,24,
NSOpenGLPFAStencilSize ,8,
NSOpenGLPFASamples ,4,
0
};
static NSOpenGLPixelFormatAttribute attrs16_1[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,16,
NSOpenGLPFADepthSize ,24,
0
};
static NSOpenGLPixelFormatAttribute attrs16_2[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,16,
NSOpenGLPFADepthSize ,24,
NSOpenGLPFAStencilSize ,8,
0
};
static NSOpenGLPixelFormatAttribute attrs64_1[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,64,
NSOpenGLPFAAlphaSize ,16,
0
};
static NSOpenGLPixelFormatAttribute attrs64_2[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,64,
NSOpenGLPFAAlphaSize ,16,
NSOpenGLPFADepthSize ,24,
NSOpenGLPFAStencilSize ,8,
0
};
static NSOpenGLPixelFormatAttribute attrs64_3[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,64,
NSOpenGLPFAAlphaSize ,16,
NSOpenGLPFADepthSize ,24,
0
};
static NSOpenGLPixelFormatAttribute attrs64_4[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,64,
NSOpenGLPFADepthSize ,24,
0
};
static NSOpenGLPixelFormatAttribute attrs64_5[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,64,
NSOpenGLPFADepthSize ,24,
NSOpenGLPFAStencilSize ,8,
0
};
static NSOpenGLPixelFormatAttribute attrs128_1[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,128,
NSOpenGLPFAAlphaSize ,32,
0
};
static NSOpenGLPixelFormatAttribute attrs128_2[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAWindow,
NSOpenGLPFAPixelBuffer,
NSOpenGLPFAColorSize ,128,
NSOpenGLPFAAlphaSize ,32,
NSOpenGLPFADepthSize ,24,
0
};
NSOpenGLPixelFormatAttribute** getPixelFormatsAttributes(int* size){
static NSOpenGLPixelFormatAttribute* arr[] =
{
attrs16_1,
attrs16_2,
attrs32_1,
attrs32_2,
attrs32_3,
attrs32_4,
attrs32_5,
attrs32_6,
attrs32_7,
attrs64_1,
attrs64_2,
attrs64_3,
attrs64_4,
attrs64_5,
attrs128_1,
attrs128_2
};
*size = sizeof(arr)/sizeof(arr[0]);
return arr;
}

View File

@@ -1,67 +0,0 @@
/*
* 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"
void ThreadInfo::updateInfo(ContextPtr eglCtx,
EglDisplay* dpy,
GLEScontext* glesCtx,
ShareGroupPtr share,
ObjectNameManager* manager) {
eglContext = eglCtx;
eglDisplay = dpy;
glesContext = glesCtx;
shareGroup = share;
objManager = manager;
}
#ifdef __linux__
__thread ThreadInfo* thread = NULL;
ThreadInfo* getThreadInfo(){
if(!thread) {
thread = new ThreadInfo();
}
return thread;
}
#else
#include <cutils/threads.h>
static thread_store_t s_tls = THREAD_STORE_INITIALIZER;
static void tlsDestruct(void *ptr)
{
if (ptr) {
ThreadInfo *ti = (ThreadInfo *)ptr;
delete ti;
}
}
ThreadInfo *getThreadInfo()
{
ThreadInfo *ti = (ThreadInfo *)thread_store_get(&s_tls);
if (!ti) {
ti = new ThreadInfo();
thread_store_set(&s_tls, ti, tlsDestruct);
}
return ti;
}
#endif

View File

@@ -1,42 +0,0 @@
/*
* 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 "EglContext.h"
class EglDisplay;
class GLEScontext;
struct ThreadInfo {
ThreadInfo():eglDisplay(NULL),glesContext(NULL),objManager(NULL){}
void updateInfo(ContextPtr eglctx,
EglDisplay* dpy,
GLEScontext* glesCtx,
ShareGroupPtr share,
ObjectNameManager* manager);
ContextPtr eglContext;
EglDisplay* eglDisplay;
GLEScontext* glesContext;
ShareGroupPtr shareGroup;
ObjectNameManager* objManager;
};
ThreadInfo* getThreadInfo();
#endif

View File

@@ -1,28 +0,0 @@
LOCAL_PATH := $(call my-dir)
host_common_SRC_FILES := \
GLEScmImp.cpp \
GLEScmUtils.cpp \
GLEScmContext.cpp \
GLEScmValidate.cpp
### GLES_CM host implementation (On top of OpenGL) ########################
$(call emugl-begin-host-shared-library,libGLES_CM_translator)
$(call emugl-import,libGLcommon)
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-end-module)
### GLES_CM host implementation, 64-bit ########################
$(call emugl-begin-host-shared-library,lib64GLES_CM_translator)
$(call emugl-import,lib64GLcommon)
LOCAL_LDLIBS += -m64
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-end-module)

View File

@@ -1,178 +0,0 @@
/*
* 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 "GLDispatch.h"
#include <stdio.h>
#include <OpenglOsUtils/osDynLibrary.h>
#ifdef __linux__
#include <GL/glx.h>
#elif defined(WIN32)
#include <windows.h>
#endif
typedef void (*GL_FUNC_PTR)();
static GL_FUNC_PTR getGLFuncAddress(const char *funcName) {
GL_FUNC_PTR ret = NULL;
#ifdef __linux__
static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("libGL.so");
ret = (GL_FUNC_PTR)glXGetProcAddress((const GLubyte*)funcName);
#elif defined(WIN32)
static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("opengl32");
ret = (GL_FUNC_PTR)wglGetProcAddress(funcName);
#endif
if(!ret && libGL){
ret = libGL->findSymbol(funcName);
}
return ret;
}
#define LOAD_GL_FUNC(name) { void * funcAddrs = NULL; \
funcAddrs = (void *)getGLFuncAddress(#name); \
if(funcAddrs) \
*(void**)(&name) = funcAddrs; \
else \
fprintf(stderr,"could not load func %s\n",#name); }
GLDispatch::GLDispatch():m_isLoaded(false){};
void GLDispatch::dispatchFuncs() {
android::Mutex::Autolock mutex(m_lock);
if(m_isLoaded)
return;
LOAD_GL_FUNC(glActiveTexture);
LOAD_GL_FUNC(glAlphaFunc);
LOAD_GL_FUNC(glBegin);
LOAD_GL_FUNC(glBindBuffer);
LOAD_GL_FUNC(glBindTexture);
LOAD_GL_FUNC(glBlendFunc);
LOAD_GL_FUNC(glBufferData);
LOAD_GL_FUNC(glBufferSubData);
LOAD_GL_FUNC(glClear);
LOAD_GL_FUNC(glClearColor);
LOAD_GL_FUNC(glClearDepth);
LOAD_GL_FUNC(glClearStencil);
LOAD_GL_FUNC(glClientActiveTexture);
LOAD_GL_FUNC(glClipPlane);
LOAD_GL_FUNC(glColor4d);
LOAD_GL_FUNC(glColor4f);
LOAD_GL_FUNC(glColor4fv);
LOAD_GL_FUNC(glColor4ub);
LOAD_GL_FUNC(glColor4ubv);
LOAD_GL_FUNC(glColorMask);
LOAD_GL_FUNC(glColorPointer);
LOAD_GL_FUNC(glCompressedTexImage2D);
LOAD_GL_FUNC(glCompressedTexSubImage2D);
LOAD_GL_FUNC(glCopyTexImage2D);
LOAD_GL_FUNC(glCopyTexSubImage2D);
LOAD_GL_FUNC(glCullFace);
LOAD_GL_FUNC(glDeleteBuffers);
LOAD_GL_FUNC(glDeleteTextures);
LOAD_GL_FUNC(glDepthFunc);
LOAD_GL_FUNC(glDepthMask);
LOAD_GL_FUNC(glDepthRange);
LOAD_GL_FUNC(glDisable);
LOAD_GL_FUNC(glDisableClientState);
LOAD_GL_FUNC(glDrawArrays);
LOAD_GL_FUNC(glDrawElements);
LOAD_GL_FUNC(glEnable);
LOAD_GL_FUNC(glEnableClientState);
LOAD_GL_FUNC(glEnd);
LOAD_GL_FUNC(glFinish);
LOAD_GL_FUNC(glFlush);
LOAD_GL_FUNC(glFogf);
LOAD_GL_FUNC(glFogfv);
LOAD_GL_FUNC(glFrontFace);
LOAD_GL_FUNC(glFrustum);
LOAD_GL_FUNC(glGenBuffers);
LOAD_GL_FUNC(glGenTextures);
LOAD_GL_FUNC(glGetBooleanv);
LOAD_GL_FUNC(glGetBufferParameteriv);
LOAD_GL_FUNC(glGetClipPlane);
LOAD_GL_FUNC(glGetDoublev);
LOAD_GL_FUNC(glGetError);
LOAD_GL_FUNC(glGetFloatv);
LOAD_GL_FUNC(glGetIntegerv);
LOAD_GL_FUNC(glGetLightfv);
LOAD_GL_FUNC(glGetMaterialfv);
LOAD_GL_FUNC(glGetPointerv);
LOAD_GL_FUNC(glGetString);
LOAD_GL_FUNC(glGetTexEnvfv);
LOAD_GL_FUNC(glGetTexEnviv);
LOAD_GL_FUNC(glGetTexParameterfv);
LOAD_GL_FUNC(glGetTexParameteriv);
LOAD_GL_FUNC(glHint);
LOAD_GL_FUNC(glIsBuffer);
LOAD_GL_FUNC(glIsEnabled);
LOAD_GL_FUNC(glIsTexture);
LOAD_GL_FUNC(glLightf);
LOAD_GL_FUNC(glLightfv);
LOAD_GL_FUNC(glLightModelf);
LOAD_GL_FUNC(glLightModelfv);
LOAD_GL_FUNC(glLineWidth);
LOAD_GL_FUNC(glLoadIdentity);
LOAD_GL_FUNC(glLoadMatrixf);
LOAD_GL_FUNC(glLogicOp);
LOAD_GL_FUNC(glMaterialf);
LOAD_GL_FUNC(glMaterialfv);
LOAD_GL_FUNC(glMultiTexCoord2fv);
LOAD_GL_FUNC(glMultiTexCoord2sv);
LOAD_GL_FUNC(glMultiTexCoord3fv);
LOAD_GL_FUNC(glMultiTexCoord3sv);
LOAD_GL_FUNC(glMultiTexCoord4fv);
LOAD_GL_FUNC(glMultiTexCoord4sv);
LOAD_GL_FUNC(glMultiTexCoord4f);
LOAD_GL_FUNC(glMultMatrixf);
LOAD_GL_FUNC(glNormal3f);
LOAD_GL_FUNC(glNormal3fv);
LOAD_GL_FUNC(glNormal3sv);
LOAD_GL_FUNC(glOrtho);
LOAD_GL_FUNC(glPointParameterf);
LOAD_GL_FUNC(glPointParameterfv);
LOAD_GL_FUNC(glPointSize);
LOAD_GL_FUNC(glPolygonOffset);
LOAD_GL_FUNC(glRotatef);
LOAD_GL_FUNC(glScalef);
LOAD_GL_FUNC(glTexEnvf);
LOAD_GL_FUNC(glTexEnvfv);
LOAD_GL_FUNC(glTexParameterf);
LOAD_GL_FUNC(glTexParameterfv);
LOAD_GL_FUNC(glMatrixMode);
LOAD_GL_FUNC(glNormalPointer);
LOAD_GL_FUNC(glPixelStorei);
LOAD_GL_FUNC(glPopMatrix);
LOAD_GL_FUNC(glPushMatrix);
LOAD_GL_FUNC(glReadPixels);
LOAD_GL_FUNC(glSampleCoverage);
LOAD_GL_FUNC(glScissor);
LOAD_GL_FUNC(glShadeModel);
LOAD_GL_FUNC(glStencilFunc);
LOAD_GL_FUNC(glStencilMask);
LOAD_GL_FUNC(glStencilOp);
LOAD_GL_FUNC(glTexCoordPointer);
LOAD_GL_FUNC(glTexEnvi);
LOAD_GL_FUNC(glTexEnviv);
LOAD_GL_FUNC(glTexImage2D);
LOAD_GL_FUNC(glTexParameteri);
LOAD_GL_FUNC(glTexParameteriv);
LOAD_GL_FUNC(glTexSubImage2D);
LOAD_GL_FUNC(glTranslatef);
LOAD_GL_FUNC(glVertexPointer);
LOAD_GL_FUNC(glViewport);
m_isLoaded = true;
}

View File

@@ -1,158 +0,0 @@
/*
* 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 GLDISPATCHH
#define GLDISPATCHH
#include <GLES/gl.h>
#include <utils/threads.h>
#define GLAPIENTRY GL_APIENTRY
typedef double GLclampd; /* double precision float in [0,1] */
typedef double GLdouble; /* double precision float */
class GLDispatch
{
public:
GLDispatch();
void dispatchFuncs();
void (GLAPIENTRY *glActiveTexture) ( GLenum texture );
void (GLAPIENTRY *glAlphaFunc) (GLenum func, GLclampf ref);
void (GLAPIENTRY *glBegin)( GLenum mode );
void (GLAPIENTRY *glBindBuffer) (GLenum target, GLuint buffer);
void (GLAPIENTRY *glBindTexture) (GLenum target, GLuint texture);
void (GLAPIENTRY *glBlendFunc) (GLenum sfactor, GLenum dfactor);
void (GLAPIENTRY *glBufferData) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
void (GLAPIENTRY *glBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
void (GLAPIENTRY *glClear) (GLbitfield mask);
void (GLAPIENTRY *glClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void (GLAPIENTRY *glClearDepth) (GLclampd depth);
void (GLAPIENTRY *glClearStencil) (GLint s);
void (GLAPIENTRY *glClientActiveTexture) ( GLenum texture );
void (GLAPIENTRY *glClipPlane) (GLenum plane, const GLdouble *equation);
void (GLAPIENTRY *glColor4d) (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
void (GLAPIENTRY *glColor4f) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void (GLAPIENTRY *glColor4fv) ( const GLfloat *v );
void (GLAPIENTRY *glColor4ub) (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
void (GLAPIENTRY *glColor4ubv) ( const GLubyte *v );
void (GLAPIENTRY *glColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
void (GLAPIENTRY *glColorPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void (GLAPIENTRY *glCompressedTexImage2D) ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
void (GLAPIENTRY *glCompressedTexSubImage2D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
void (GLAPIENTRY *glCopyTexImage2D) (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
void (GLAPIENTRY *glCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
void (GLAPIENTRY *glCullFace) (GLenum mode);
void (GLAPIENTRY *glDeleteBuffers) (GLsizei n, const GLuint *buffers);
void (GLAPIENTRY *glDeleteTextures) (GLsizei n, const GLuint *textures);
void (GLAPIENTRY *glDepthFunc) (GLenum func);
void (GLAPIENTRY *glDepthMask) (GLboolean flag);
void (GLAPIENTRY *glDepthRange) (GLclampd zNear, GLclampd zFar);
void (GLAPIENTRY *glDisable) (GLenum cap);
void (GLAPIENTRY *glDisableClientState) (GLenum array);
void (GLAPIENTRY *glDrawArrays) (GLenum mode, GLint first, GLsizei count);
void (GLAPIENTRY *glDrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
void (GLAPIENTRY *glEnable) (GLenum cap);
void (GLAPIENTRY *glEnableClientState) (GLenum array);
void (GLAPIENTRY *glEnd) ( void );
void (GLAPIENTRY *glFinish) (void);
void (GLAPIENTRY *glFlush) (void);
void (GLAPIENTRY *glFogf) (GLenum pname, GLfloat param);
void (GLAPIENTRY *glFogfv) (GLenum pname, const GLfloat *params);
void (GLAPIENTRY *glFrontFace) (GLenum mode);
void (GLAPIENTRY *glFrustum) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
void (GLAPIENTRY *glGenBuffers) (GLsizei n, GLuint *buffers);
void (GLAPIENTRY *glGenTextures) (GLsizei n, GLuint *textures);
void (GLAPIENTRY *glGetBooleanv) (GLenum pname, GLboolean *params);
void (GLAPIENTRY *glGetBufferParameteriv) (GLenum, GLenum, GLint *);
void (GLAPIENTRY *glGetClipPlane) (GLenum plane, GLdouble *equation);
void (GLAPIENTRY *glGetDoublev) ( GLenum pname, GLdouble *params );
GLenum (GLAPIENTRY *glGetError) (void);
void (GLAPIENTRY *glGetFloatv) (GLenum pname, GLfloat *params);
void (GLAPIENTRY *glGetIntegerv) (GLenum pname, GLint *params);
void (GLAPIENTRY *glGetLightfv) (GLenum light, GLenum pname, GLfloat *params);
void (GLAPIENTRY *glGetMaterialfv) (GLenum face, GLenum pname, GLfloat *params);
void (GLAPIENTRY *glGetPointerv) (GLenum pname, GLvoid* *params);
const GLubyte * (GLAPIENTRY *glGetString) (GLenum name);
void (GLAPIENTRY *glGetTexEnvfv) (GLenum target, GLenum pname, GLfloat *params);
void (GLAPIENTRY *glGetTexEnviv) (GLenum target, GLenum pname, GLint *params);
void (GLAPIENTRY *glGetTexParameterfv) (GLenum target, GLenum pname, GLfloat *params);
void (GLAPIENTRY *glGetTexParameteriv) (GLenum target, GLenum pname, GLint *params);
void (GLAPIENTRY *glHint) (GLenum target, GLenum mode);
GLboolean (GLAPIENTRY *glIsBuffer) (GLuint);
GLboolean (GLAPIENTRY *glIsEnabled) (GLenum cap);
GLboolean (GLAPIENTRY *glIsTexture) (GLuint texture);
void (GLAPIENTRY *glLightf) (GLenum light, GLenum pname, GLfloat param);
void (GLAPIENTRY *glLightfv) (GLenum light, GLenum pname, const GLfloat *params);
void (GLAPIENTRY *glLightModelf) (GLenum pname, GLfloat param);
void (GLAPIENTRY *glLightModelfv) (GLenum pname, const GLfloat *params);
void (GLAPIENTRY *glLineWidth) (GLfloat width);
void (GLAPIENTRY *glLoadIdentity) (void);
void (GLAPIENTRY *glLoadMatrixf) (const GLfloat *m);
void (GLAPIENTRY *glLogicOp) (GLenum opcode);
void (GLAPIENTRY *glMaterialf) (GLenum face, GLenum pname, GLfloat param);
void (GLAPIENTRY *glMaterialfv) (GLenum face, GLenum pname, const GLfloat *params);
void (GLAPIENTRY *glMultiTexCoord2fv) ( GLenum target, const GLfloat *v );
void (GLAPIENTRY *glMultiTexCoord2sv) ( GLenum target, const GLshort *v );
void (GLAPIENTRY *glMultiTexCoord3fv) ( GLenum target, const GLfloat *v );
void (GLAPIENTRY *glMultiTexCoord3sv) ( GLenum target, const GLshort *v );
void (GLAPIENTRY *glMultiTexCoord4f) ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
void (GLAPIENTRY *glMultiTexCoord4fv) ( GLenum target, const GLfloat *v );
void (GLAPIENTRY *glMultiTexCoord4sv) ( GLenum target, const GLshort *v );
void (GLAPIENTRY *glMultMatrixf) (const GLfloat *m);
void (GLAPIENTRY *glNormal3f) (GLfloat nx, GLfloat ny, GLfloat nz);
void (GLAPIENTRY *glNormal3fv) ( const GLfloat *v );
void (GLAPIENTRY *glNormal3sv) ( const GLshort *v );
void (GLAPIENTRY *glOrtho) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
void (GLAPIENTRY *glPointParameterf) (GLenum, GLfloat);
void (GLAPIENTRY *glPointParameterfv) (GLenum, const GLfloat *);
void (GLAPIENTRY *glPointSize) (GLfloat size);
void (GLAPIENTRY *glPolygonOffset) (GLfloat factor, GLfloat units);
void (GLAPIENTRY *glRotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
void (GLAPIENTRY *glScalef) (GLfloat x, GLfloat y, GLfloat z);
void (GLAPIENTRY *glTexEnvf) (GLenum target, GLenum pname, GLfloat param);
void (GLAPIENTRY *glTexEnvfv) (GLenum target, GLenum pname, const GLfloat *params);
void (GLAPIENTRY *glTexParameterf) (GLenum target, GLenum pname, GLfloat param);
void (GLAPIENTRY *glTexParameterfv) (GLenum target, GLenum pname, const GLfloat *params);
void (GLAPIENTRY *glMatrixMode) (GLenum mode);
void (GLAPIENTRY *glNormalPointer) (GLenum type, GLsizei stride, const GLvoid *pointer);
void (GLAPIENTRY *glPixelStorei) (GLenum pname, GLint param);
void (GLAPIENTRY *glPopMatrix) (void);
void (GLAPIENTRY *glPushMatrix) (void);
void (GLAPIENTRY *glReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
void (GLAPIENTRY *glSampleCoverage) ( GLclampf value, GLboolean invert );
void (GLAPIENTRY *glScissor) (GLint x, GLint y, GLsizei width, GLsizei height);
void (GLAPIENTRY *glShadeModel) (GLenum mode);
void (GLAPIENTRY *glStencilFunc) (GLenum func, GLint ref, GLuint mask);
void (GLAPIENTRY *glStencilMask) (GLuint mask);
void (GLAPIENTRY *glStencilOp) (GLenum fail, GLenum zfail, GLenum zpass);
void (GLAPIENTRY *glTexCoordPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void (GLAPIENTRY *glTexEnvi) (GLenum target, GLenum pname, GLint param);
void (GLAPIENTRY *glTexEnviv) (GLenum target, GLenum pname, const GLint *params);
void (GLAPIENTRY *glTexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
void (GLAPIENTRY *glTexParameteri) (GLenum target, GLenum pname, GLint param);
void (GLAPIENTRY *glTexParameteriv) (GLenum target, GLenum pname, const GLint *params);
void (GLAPIENTRY *glTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
void (GLAPIENTRY *glTranslatef) (GLfloat x, GLfloat y, GLfloat z);
void (GLAPIENTRY *glVertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void (GLAPIENTRY *glViewport) (GLint x, GLint y, GLsizei width, GLsizei height);
private:
bool m_isLoaded;
android::Mutex m_lock;
};
#endif

View File

@@ -1,420 +0,0 @@
/*
* 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 "GLEScmContext.h"
#include "GLEScmUtils.h"
#include <GLcommon/GLutils.h>
#include <GLcommon/GLconversion_macros.h>
#include <string.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
void GLEScmContext::init() {
android::Mutex::Autolock mutex(s_lock);
if(!m_initialized) {
s_glDispatch.dispatchFuncs(GLES_1_1);
GLEScontext::init();
m_texCoords = new GLESpointer[s_glSupport.maxTexUnits];
m_map[GL_TEXTURE_COORD_ARRAY] = &m_texCoords[m_clientActiveTexture];
const char* baseRenderer = (const char*)dispatcher().glGetString(GL_RENDERER);
size_t baseRendererLen = strlen(baseRenderer);
s_glRenderer.clear();
s_glRenderer.reserve(19 + baseRendererLen);
s_glRenderer.append("OpenGL ES-CM 1.1 (", 18);
s_glRenderer.append(baseRenderer, baseRendererLen);
s_glRenderer.append(")", 1);
}
m_initialized = true;
}
GLEScmContext::GLEScmContext():GLEScontext(),m_texCoords(NULL),m_pointsIndex(-1), m_clientActiveTexture(0) {
m_map[GL_COLOR_ARRAY] = new GLESpointer();
m_map[GL_NORMAL_ARRAY] = new GLESpointer();
m_map[GL_VERTEX_ARRAY] = new GLESpointer();
m_map[GL_POINT_SIZE_ARRAY_OES] = new GLESpointer();
}
void GLEScmContext::setActiveTexture(GLenum tex) {
m_activeTexture = tex - GL_TEXTURE0;
}
void GLEScmContext::setClientActiveTexture(GLenum tex) {
m_clientActiveTexture = tex - GL_TEXTURE0;
m_map[GL_TEXTURE_COORD_ARRAY] = &m_texCoords[m_clientActiveTexture];
}
GLEScmContext::~GLEScmContext(){
if(m_texCoords){
delete[] m_texCoords;
m_texCoords = NULL;
}
m_map[GL_TEXTURE_COORD_ARRAY] = NULL;
}
//setting client side arr
void GLEScmContext::setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int index){
if( arr == NULL) return;
switch(arrayType) {
case GL_VERTEX_ARRAY:
s_glDispatch.glVertexPointer(size,dataType,stride,arr);
break;
case GL_NORMAL_ARRAY:
s_glDispatch.glNormalPointer(dataType,stride,arr);
break;
case GL_TEXTURE_COORD_ARRAY:
s_glDispatch.glTexCoordPointer(size,dataType,stride,arr);
break;
case GL_COLOR_ARRAY:
s_glDispatch.glColorPointer(size,dataType,stride,arr);
break;
case GL_POINT_SIZE_ARRAY_OES:
m_pointsIndex = index;
break;
}
}
void GLEScmContext::setupArrayPointerHelper(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLenum array_id,GLESpointer* p){
unsigned int size = p->getSize();
GLenum dataType = p->getType();
if(needConvert(cArrs,first,count,type,indices,direct,p,array_id)){
//conversion has occured
ArrayData currentArr = cArrs.getCurrentArray();
setupArr(currentArr.data,array_id,currentArr.type,size,currentArr.stride,GL_FALSE, cArrs.getCurrentIndex());
++cArrs;
} else {
setupArr(p->getData(),array_id,dataType,size,p->getStride(), GL_FALSE);
}
}
void GLEScmContext::setupArraysPointers(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct) {
ArraysMap::iterator it;
m_pointsIndex = -1;
//going over all clients arrays Pointers
for ( it=m_map.begin() ; it != m_map.end(); it++ ) {
GLenum array_id = (*it).first;
GLESpointer* p = (*it).second;
if(!isArrEnabled(array_id)) continue;
if(array_id == GL_TEXTURE_COORD_ARRAY) continue; //handling textures later
setupArrayPointerHelper(cArrs,first,count,type,indices,direct,array_id,p);
}
unsigned int activeTexture = m_clientActiveTexture + GL_TEXTURE0;
s_lock.lock();
int maxTexUnits = s_glSupport.maxTexUnits;
s_lock.unlock();
//converting all texture coords arrays
for(int i=0; i< maxTexUnits;i++) {
unsigned int tex = GL_TEXTURE0+i;
setClientActiveTexture(tex);
s_glDispatch.glClientActiveTexture(tex);
GLenum array_id = GL_TEXTURE_COORD_ARRAY;
GLESpointer* p = m_map[array_id];
if(!isArrEnabled(array_id)) continue;
setupArrayPointerHelper(cArrs,first,count,type,indices,direct,array_id,p);
}
setClientActiveTexture(activeTexture);
s_glDispatch.glClientActiveTexture(activeTexture);
}
void GLEScmContext::drawPointsData(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw) {
const char *pointsArr = NULL;
int stride = 0;
GLESpointer* p = m_map[GL_POINT_SIZE_ARRAY_OES];
//choosing the right points sizes array source
if(m_pointsIndex >= 0) { //point size array was converted
pointsArr = (const char*)(cArrs[m_pointsIndex].data);
stride = cArrs[m_pointsIndex].stride;
} else {
pointsArr = static_cast<const char*>(p->getData());
stride = p->getStride();
}
if(stride == 0){
stride = sizeof(GLfloat);
}
if(isElemsDraw) {
int tSize = type == GL_UNSIGNED_SHORT ? 2 : 1;
int i = 0;
while(i<count)
{
int sStart = i;
int sCount = 1;
#define INDEX \
(type == GL_UNSIGNED_SHORT ? \
static_cast<const GLushort*>(indices_in)[i]: \
static_cast<const GLubyte*>(indices_in)[i])
GLfloat pSize = *((GLfloat*)(pointsArr+(INDEX*stride)));
i++;
while(i < count && pSize == *((GLfloat*)(pointsArr+(INDEX*stride))))
{
sCount++;
i++;
}
s_glDispatch.glPointSize(pSize);
s_glDispatch.glDrawElements(GL_POINTS, sCount, type, (char*)indices_in+sStart*tSize);
}
} else {
int i = 0;
while(i<count)
{
int sStart = i;
int sCount = 1;
GLfloat pSize = *((GLfloat*)(pointsArr+((first+i)*stride)));
i++;
while(i < count && pSize == *((GLfloat*)(pointsArr+((first+i)*stride))))
{
sCount++;
i++;
}
s_glDispatch.glPointSize(pSize);
s_glDispatch.glDrawArrays(GL_POINTS, first+sStart, sCount);
}
}
}
void GLEScmContext::drawPointsArrs(GLESConversionArrays& arrs,GLint first,GLsizei count) {
drawPointsData(arrs,first,count,0,NULL,false);
}
void GLEScmContext::drawPointsElems(GLESConversionArrays& arrs,GLsizei count,GLenum type,const GLvoid* indices_in) {
drawPointsData(arrs,0,count,type,indices_in,true);
}
bool GLEScmContext::needConvert(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) {
bool usingVBO = p->isVBO();
GLenum arrType = p->getType();
/*
conversion is not necessary in the following cases:
(*) array type is byte but it is not vertex or texture array
(*) array type is not fixed
*/
if((arrType != GL_FIXED) && (arrType != GL_BYTE)) return false;
if((arrType == GL_BYTE && (array_id != GL_VERTEX_ARRAY)) &&
(arrType == GL_BYTE && (array_id != GL_TEXTURE_COORD_ARRAY)) ) return false;
bool byteVBO = (arrType == GL_BYTE) && usingVBO;
if(byteVBO){
p->redirectPointerData();
}
if(!usingVBO || byteVBO) {
if (direct) {
convertDirect(cArrs,first,count,array_id,p);
} else {
convertIndirect(cArrs,count,type,indices,array_id,p);
}
} else {
if (direct) {
convertDirectVBO(cArrs,first,count,array_id,p) ;
} else {
convertIndirectVBO(cArrs,count,type,indices,array_id,p);
}
}
return true;
}
const GLESpointer* GLEScmContext::getPointer(GLenum arrType) {
GLenum type =
arrType == GL_VERTEX_ARRAY_POINTER ? GL_VERTEX_ARRAY :
arrType == GL_NORMAL_ARRAY_POINTER ? GL_NORMAL_ARRAY :
arrType == GL_TEXTURE_COORD_ARRAY_POINTER ? GL_TEXTURE_COORD_ARRAY :
arrType == GL_COLOR_ARRAY_POINTER ? GL_COLOR_ARRAY :
arrType == GL_POINT_SIZE_ARRAY_POINTER_OES ? GL_POINT_SIZE_ARRAY_OES :
0;
if(type != 0)
{
return GLEScontext::getPointer(type);
}
return NULL;
}
void GLEScmContext::initExtensionString() {
*s_glExtensions = "GL_OES_blend_func_separate GL_OES_blend_equation_separate GL_OES_blend_subtract "
"GL_OES_byte_coordinates GL_OES_compressed_paletted_texture GL_OES_point_size_array "
"GL_OES_point_sprite GL_OES_single_precision GL_OES_stencil_wrap GL_OES_texture_env_crossbar "
"GL_OES_texture_mirored_repeat GL_OES_EGL_image GL_OES_element_index_uint GL_OES_draw_texture "
"GL_OES_texture_cube_map GL_OES_draw_texture ";
if (s_glSupport.GL_OES_READ_FORMAT)
*s_glExtensions+="GL_OES_read_format ";
if (s_glSupport.GL_EXT_FRAMEBUFFER_OBJECT) {
*s_glExtensions+="GL_OES_framebuffer_object GL_OES_depth24 GL_OES_depth32 GL_OES_fbo_render_mipmap "
"GL_OES_rgb8_rgba8 GL_OES_stencil1 GL_OES_stencil4 GL_OES_stencil8 ";
}
if (s_glSupport.GL_EXT_PACKED_DEPTH_STENCIL)
*s_glExtensions+="GL_OES_packed_depth_stencil ";
if (s_glSupport.GL_EXT_TEXTURE_FORMAT_BGRA8888)
*s_glExtensions+="GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 ";
if (s_glSupport.GL_ARB_MATRIX_PALETTE && s_glSupport.GL_ARB_VERTEX_BLEND) {
*s_glExtensions+="GL_OES_matrix_palette ";
GLint max_palette_matrices=0;
GLint max_vertex_units=0;
dispatcher().glGetIntegerv(GL_MAX_PALETTE_MATRICES_OES,&max_palette_matrices);
dispatcher().glGetIntegerv(GL_MAX_VERTEX_UNITS_OES,&max_vertex_units);
if (max_palette_matrices>=32 && max_vertex_units>=4)
*s_glExtensions+="GL_OES_extended_matrix_palette ";
}
*s_glExtensions+="GL_OES_compressed_ETC1_RGB8_texture ";
}
int GLEScmContext::getMaxTexUnits() {
return getCaps()->maxTexUnits;
}
bool GLEScmContext::glGetBooleanv(GLenum pname, GLboolean *params)
{
GLint iParam;
if(glGetIntegerv(pname, &iParam))
{
*params = (iParam != 0);
return true;
}
return false;
}
bool GLEScmContext::glGetFixedv(GLenum pname, GLfixed *params)
{
GLint iParam;
if(glGetIntegerv(pname, &iParam))
{
*params = I2X(iParam);
return true;
}
return false;
}
bool GLEScmContext::glGetFloatv(GLenum pname, GLfloat *params)
{
GLint iParam;
if(glGetIntegerv(pname, &iParam))
{
*params = (GLfloat)iParam;
return true;
}
return false;
}
bool GLEScmContext::glGetIntegerv(GLenum pname, GLint *params)
{
if(GLEScontext::glGetIntegerv(pname, params))
return true;
const GLESpointer* ptr = NULL;
switch(pname){
case GL_VERTEX_ARRAY_BUFFER_BINDING:
case GL_VERTEX_ARRAY_SIZE:
case GL_VERTEX_ARRAY_STRIDE:
case GL_VERTEX_ARRAY_TYPE:
ptr = getPointer(GL_VERTEX_ARRAY_POINTER);
break;
case GL_NORMAL_ARRAY_BUFFER_BINDING:
case GL_NORMAL_ARRAY_STRIDE:
case GL_NORMAL_ARRAY_TYPE:
ptr = getPointer(GL_NORMAL_ARRAY_POINTER);
break;
case GL_COLOR_ARRAY_BUFFER_BINDING:
case GL_COLOR_ARRAY_SIZE:
case GL_COLOR_ARRAY_STRIDE:
case GL_COLOR_ARRAY_TYPE:
ptr = getPointer(GL_COLOR_ARRAY_POINTER);
break;
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:
ptr = getPointer(GL_TEXTURE_COORD_ARRAY_POINTER);
break;
case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
case GL_POINT_SIZE_ARRAY_STRIDE_OES:
case GL_POINT_SIZE_ARRAY_TYPE_OES:
ptr = getPointer(GL_POINT_SIZE_ARRAY_POINTER_OES);
break;
default:
return false;
}
switch(pname)
{
case GL_VERTEX_ARRAY_BUFFER_BINDING:
case GL_NORMAL_ARRAY_BUFFER_BINDING:
case GL_COLOR_ARRAY_BUFFER_BINDING:
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
*params = ptr ? ptr->getBufferName() : 0;
break;
case GL_VERTEX_ARRAY_STRIDE:
case GL_NORMAL_ARRAY_STRIDE:
case GL_COLOR_ARRAY_STRIDE:
case GL_TEXTURE_COORD_ARRAY_STRIDE:
case GL_POINT_SIZE_ARRAY_STRIDE_OES:
*params = ptr ? ptr->getStride() : 0;
break;
case GL_VERTEX_ARRAY_SIZE:
case GL_COLOR_ARRAY_SIZE:
case GL_TEXTURE_COORD_ARRAY_SIZE:
*params = ptr ? ptr->getSize() : 0;
break;
case GL_VERTEX_ARRAY_TYPE:
case GL_NORMAL_ARRAY_TYPE:
case GL_COLOR_ARRAY_TYPE:
case GL_TEXTURE_COORD_ARRAY_TYPE:
case GL_POINT_SIZE_ARRAY_TYPE_OES:
*params = ptr ? ptr->getType() : 0;
break;
}
return true;
}

View File

@@ -1,69 +0,0 @@
/*
* 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 GLES_CM_CONTEX_H
#define GLES_CM_CONTEX_H
#include <GLcommon/GLDispatch.h>
#include <GLcommon/GLESpointer.h>
#include <GLcommon/GLESbuffer.h>
#include <GLcommon/GLEScontext.h>
#include <map>
#include <vector>
#include <string>
#include <utils/threads.h>
typedef std::map<GLfloat,std::vector<int> > PointSizeIndices;
class GLEScmContext: public GLEScontext
{
public:
void init();
GLEScmContext();
void setActiveTexture(GLenum tex);
void setClientActiveTexture(GLenum tex);
GLenum getActiveTexture() { return GL_TEXTURE0 + m_activeTexture;};
GLenum getClientActiveTexture() { return GL_TEXTURE0 + m_clientActiveTexture;};
void setupArraysPointers(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct);
void drawPointsArrs(GLESConversionArrays& arrs,GLint first,GLsizei count);
void drawPointsElems(GLESConversionArrays& arrs,GLsizei count,GLenum type,const GLvoid* indices);
virtual const GLESpointer* getPointer(GLenum arrType);
int getMaxTexUnits();
virtual bool glGetIntegerv(GLenum pname, GLint *params);
virtual bool glGetBooleanv(GLenum pname, GLboolean *params);
virtual bool glGetFloatv(GLenum pname, GLfloat *params);
virtual bool glGetFixedv(GLenum pname, GLfixed *params);
~GLEScmContext();
protected:
bool needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id);
private:
void setupArrayPointerHelper(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLenum array_id,GLESpointer* p);
void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int pointsIndex = -1);
void drawPoints(PointSizeIndices* points);
void drawPointsData(GLESConversionArrays& arrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw);
void initExtensionString();
GLESpointer* m_texCoords;
int m_pointsIndex;
unsigned int m_clientActiveTexture;
};
#endif

View File

@@ -1,101 +0,0 @@
/*
* 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 "GLEScmUtils.h"
size_t glParamSize(GLenum param)
{
size_t s = 0;
switch(param)
{
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_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_BLEND_DST:
case GL_BLEND_SRC:
case GL_LOGIC_OP_MODE:
case GL_SCISSOR_TEST:
case GL_MAX_TEXTURE_UNITS:
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_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:
s = 4;
break;
case GL_MODELVIEW_MATRIX:
case GL_PROJECTION_MATRIX:
case GL_TEXTURE_MATRIX:
s = 16;
default:
s = 1; // assume 1
}
return s;
}

View File

@@ -1,22 +0,0 @@
/*
* 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 GLES_UTILS_H
#define GLES_UTILS_H
#include <GLES/gl.h>
#include <stdlib.h>
size_t glParamSize(GLenum param);
#endif

View File

@@ -1,305 +0,0 @@
/*
* 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 "GLEScmValidate.h"
#include <GLcommon/GLutils.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLcommon/GLEScontext.h>
#include "GLEScmValidate.h"
bool GLEScmValidate::lightEnum(GLenum e,unsigned int maxLights) {
return e >=GL_LIGHT0 && e <= (GL_LIGHT0+maxLights);
}
bool GLEScmValidate::clipPlaneEnum(GLenum e,unsigned int maxClipPlanes) {
return e >=GL_CLIP_PLANE0 && e <= (GL_CLIP_PLANE0+maxClipPlanes);
}
bool GLEScmValidate::alphaFunc(GLenum f) {
switch(f) {
case GL_NEVER:
case GL_LESS:
case GL_EQUAL:
case GL_LEQUAL:
case GL_GREATER:
case GL_NOTEQUAL:
case GL_GEQUAL:
case GL_ALWAYS:
return true;
}
return false;
}
bool GLEScmValidate::blendSrc(GLenum s) {
switch(s) {
case GL_ZERO:
case GL_ONE:
case GL_DST_COLOR:
case GL_ONE_MINUS_DST_COLOR:
case GL_SRC_ALPHA:
case GL_ONE_MINUS_SRC_ALPHA:
case GL_DST_ALPHA:
case GL_ONE_MINUS_DST_ALPHA:
case GL_SRC_ALPHA_SATURATE:
return true;
}
return false;
}
bool GLEScmValidate::vertexPointerParams(GLint size,GLsizei stride) {
return ((size >=2) && (size <= 4)) && (stride >=0) ;
}
bool GLEScmValidate::colorPointerParams(GLint size,GLsizei stride) {
return ((size >=3) && (size <= 4)) && (stride >=0) ;
}
bool GLEScmValidate::texCoordPointerParams(GLint size,GLsizei stride) {
return ((size >=2) && (size <= 4)) && (stride >=0) ;
}
bool GLEScmValidate::supportedArrays(GLenum arr) {
switch(arr) {
case GL_COLOR_ARRAY:
case GL_NORMAL_ARRAY:
case GL_POINT_SIZE_ARRAY_OES:
case GL_TEXTURE_COORD_ARRAY:
case GL_VERTEX_ARRAY:
return true;
}
return false;
}
bool GLEScmValidate::hintTargetMode(GLenum target,GLenum mode) {
switch(target) {
case GL_FOG_HINT:
case GL_GENERATE_MIPMAP_HINT:
case GL_LINE_SMOOTH_HINT:
case GL_PERSPECTIVE_CORRECTION_HINT:
case GL_POINT_SMOOTH_HINT:
break;
default: return false;
}
switch(mode) {
case GL_FASTEST:
case GL_NICEST:
case GL_DONT_CARE:
break;
default: return false;
}
return true;
}
bool GLEScmValidate::texParams(GLenum target,GLenum pname) {
switch(pname) {
case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
case GL_TEXTURE_CROP_RECT_OES:
case GL_GENERATE_MIPMAP:
break;
default:
return false;
}
return (target == GL_TEXTURE_2D)||(target == GL_TEXTURE_CUBE_MAP_OES);
}
bool GLEScmValidate::texEnv(GLenum target,GLenum pname) {
switch(pname) {
case GL_TEXTURE_ENV_MODE:
case GL_TEXTURE_ENV_COLOR:
case GL_COMBINE_RGB:
case GL_COMBINE_ALPHA:
case GL_SRC0_RGB:
case GL_SRC1_RGB:
case GL_SRC2_RGB:
case GL_SRC0_ALPHA:
case GL_SRC1_ALPHA:
case GL_SRC2_ALPHA:
case GL_OPERAND0_RGB:
case GL_OPERAND1_RGB:
case GL_OPERAND2_RGB:
case GL_OPERAND0_ALPHA:
case GL_OPERAND1_ALPHA:
case GL_OPERAND2_ALPHA:
case GL_RGB_SCALE:
case GL_ALPHA_SCALE:
case GL_COORD_REPLACE_OES:
break;
default:
return false;
}
return (target == GL_TEXTURE_ENV || target == GL_POINT_SPRITE_OES);
}
bool GLEScmValidate::capability(GLenum cap,int maxLights,int maxClipPlanes) {
switch(cap) {
case GL_ALPHA_TEST:
case GL_BLEND:
case GL_COLOR_ARRAY:
case GL_COLOR_LOGIC_OP:
case GL_COLOR_MATERIAL:
case GL_CULL_FACE:
case GL_DEPTH_TEST:
case GL_DITHER:
case GL_FOG:
case GL_LIGHTING:
case GL_LINE_SMOOTH:
case GL_MULTISAMPLE:
case GL_NORMAL_ARRAY:
case GL_NORMALIZE:
case GL_POINT_SIZE_ARRAY_OES:
case GL_POINT_SMOOTH:
case GL_POINT_SPRITE_OES:
case GL_POLYGON_OFFSET_FILL:
case GL_RESCALE_NORMAL:
case GL_SAMPLE_ALPHA_TO_COVERAGE:
case GL_SAMPLE_ALPHA_TO_ONE:
case GL_SAMPLE_COVERAGE:
case GL_SCISSOR_TEST:
case GL_STENCIL_TEST:
case GL_TEXTURE_2D:
case GL_TEXTURE_COORD_ARRAY:
case GL_VERTEX_ARRAY:
return true;
}
return GLEScmValidate::lightEnum(cap,maxLights) || GLEScmValidate::clipPlaneEnum(cap,maxClipPlanes);
}
bool GLEScmValidate::texCompImgFrmt(GLenum format) {
switch(format) {
case GL_PALETTE4_RGB8_OES:
case GL_PALETTE4_RGBA8_OES:
case GL_PALETTE4_R5_G6_B5_OES:
case GL_PALETTE4_RGBA4_OES:
case GL_PALETTE4_RGB5_A1_OES:
case GL_PALETTE8_RGB8_OES:
case GL_PALETTE8_RGBA8_OES:
case GL_PALETTE8_R5_G6_B5_OES:
case GL_PALETTE8_RGBA4_OES:
case GL_PALETTE8_RGB5_A1_OES:
return true;
}
return false;
}
bool GLEScmValidate::blendDst(GLenum d) {
switch(d) {
case GL_ZERO:
case GL_ONE:
case GL_SRC_COLOR:
case GL_ONE_MINUS_SRC_COLOR:
case GL_SRC_ALPHA:
case GL_ONE_MINUS_SRC_ALPHA:
case GL_DST_ALPHA:
case GL_ONE_MINUS_DST_ALPHA:
return true;
}
return false;
}
bool GLEScmValidate::renderbufferInternalFrmt(GLEScontext* ctx, GLenum internalformat)
{
switch (internalformat) {
case GL_DEPTH_COMPONENT16_OES:
case GL_RGBA4_OES:
case GL_RGB5_A1_OES:
case GL_RGB565_OES:
case GL_STENCIL_INDEX1_OES:
case GL_STENCIL_INDEX4_OES:
case GL_STENCIL_INDEX8_OES:
case GL_RGB8_OES:
case GL_RGBA8_OES:
case GL_DEPTH_COMPONENT24_OES:
case GL_DEPTH_COMPONENT32_OES:
return true;
}
if (ctx->getCaps()->GL_EXT_PACKED_DEPTH_STENCIL && internalformat==GL_DEPTH24_STENCIL8_OES)
return true;
return false;
}
bool GLEScmValidate::stencilOp(GLenum param) {
switch (param) {
case GL_KEEP:
case GL_ZERO:
case GL_REPLACE:
case GL_INCR:
case GL_DECR:
case GL_INVERT:
case GL_INCR_WRAP_OES:
case GL_DECR_WRAP_OES:
return true;
}
return false;
}
bool GLEScmValidate::texGen(GLenum coord, GLenum pname) {
return (coord == GL_TEXTURE_GEN_STR_OES && pname == GL_TEXTURE_GEN_MODE_OES);
}
bool GLEScmValidate::colorPointerType(GLenum type){
switch(type){
case GL_UNSIGNED_BYTE:
case GL_FIXED:
case GL_FLOAT:
return true;
}
return false;
}
bool GLEScmValidate::normalPointerType(GLenum type){
switch(type){
case GL_BYTE:
case GL_SHORT:
case GL_FLOAT:
case GL_FIXED:
return true;
}
return false;
}
bool GLEScmValidate::pointPointerType(GLenum type){
return type == GL_FIXED || type == GL_FLOAT;
}
bool GLEScmValidate::texCoordPointerType(GLenum type){
switch(type){
case GL_BYTE:
case GL_SHORT:
case GL_FLOAT:
case GL_FIXED:
return true;
}
return false;
}
bool GLEScmValidate::vertexPointerType(GLenum type){
switch(type){
case GL_BYTE:
case GL_SHORT:
case GL_FLOAT:
case GL_FIXED:
return true;
}
return false;
}

View File

@@ -1,50 +0,0 @@
/*
* 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 GLES_CM_VALIDATE_H
#define GLES_CM_VALIDATE_H
#include <GLES/gl.h>
#include <GLcommon/GLESvalidate.h>
struct GLEScmValidate : public GLESvalidate
{
static bool blendSrc(GLenum s);
static bool blendDst(GLenum d);
static bool lightEnum(GLenum e,unsigned int maxLIghts);
static bool clipPlaneEnum(GLenum e,unsigned int maxClipPlanes);
static bool alphaFunc(GLenum f);
static bool vertexPointerParams(GLint size,GLsizei stride);
static bool colorPointerParams(GLint size,GLsizei stride);
static bool supportedArrays(GLenum arr);
static bool hintTargetMode(GLenum target,GLenum mode);
static bool capability(GLenum cap,int maxLights,int maxClipPlanes);
static bool texParams(GLenum target,GLenum pname);
static bool texCoordPointerParams(GLint size,GLsizei stride);
static bool texEnv(GLenum target,GLenum pname);
static bool texCompImgFrmt(GLenum format);
static bool renderbufferInternalFrmt(GLEScontext * ctx, GLenum internalformat);
static bool stencilOp(GLenum param);
static bool texGen(GLenum coord,GLenum pname);
static bool colorPointerType(GLenum type);
static bool normalPointerType(GLenum type);
static bool pointPointerType(GLenum type);
static bool texCoordPointerType(GLenum type);
static bool vertexPointerType(GLenum type);
};
#endif

View File

@@ -1,27 +0,0 @@
LOCAL_PATH := $(call my-dir)
host_common_SRC_FILES := \
GLESv2Imp.cpp \
GLESv2Context.cpp \
GLESv2Validate.cpp \
ShaderParser.cpp \
ProgramData.cpp
### GLES_V2 host implementation (On top of OpenGL) ########################
$(call emugl-begin-host-shared-library,libGLES_V2_translator)
$(call emugl-import, libGLcommon)
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-end-module)
### GLES_V2 host implementation, 64-bit ##############################
$(call emugl-begin-host-shared-library,lib64GLES_V2_translator)
$(call emugl-import, lib64GLcommon)
LOCAL_LDLIBS += -m64
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-end-module)

View File

@@ -1,164 +0,0 @@
/*
* 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 "GLESv2Context.h"
void GLESv2Context::init() {
android::Mutex::Autolock mutex(s_lock);
if(!m_initialized) {
s_glDispatch.dispatchFuncs(GLES_2_0);
GLEScontext::init();
for(int i=0; i < s_glSupport.maxVertexAttribs;i++){
m_map[i] = new GLESpointer();
}
setAttribute0value(0.0, 0.0, 0.0, 1.0);
const char* baseRenderer = (const char*)dispatcher().glGetString(GL_RENDERER);
size_t baseRendererLen = strlen(baseRenderer);
s_glRenderer.clear();
s_glRenderer.reserve(16 + baseRendererLen);
s_glRenderer.append("OpenGL ES 2.0 (", 15);
s_glRenderer.append(baseRenderer, baseRendererLen);
s_glRenderer.append(")", 1);
}
m_initialized = true;
}
GLESv2Context::GLESv2Context():GLEScontext(), m_att0Array(NULL), m_att0ArrayLength(0), m_att0NeedsDisable(false){};
GLESv2Context::~GLESv2Context()
{
delete[] m_att0Array;
}
void GLESv2Context::setAttribute0value(float x, float y, float z, float w)
{
m_attribute0value[0] = x;
m_attribute0value[1] = y;
m_attribute0value[2] = z;
m_attribute0value[3] = w;
}
void GLESv2Context::validateAtt0PreDraw(unsigned int count)
{
m_att0NeedsDisable = false;
if(count == 0)
return;
int enabled = 0;
s_glDispatch.glGetVertexAttribiv(0, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &enabled);
if(enabled)
return;
if(count > m_att0ArrayLength)
{
delete [] m_att0Array;
m_att0Array = new GLfloat[4*count];
m_att0ArrayLength = count;
}
for(unsigned int i=0; i<count; i++)
memcpy(m_att0Array+i*4, m_attribute0value, 4*sizeof(GLfloat));
s_glDispatch.glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, m_att0Array);
s_glDispatch.glEnableVertexAttribArray(0);
m_att0NeedsDisable = true;
}
void GLESv2Context::validateAtt0PostDraw(void)
{
if(m_att0NeedsDisable)
s_glDispatch.glDisableVertexAttribArray(0);
m_att0NeedsDisable = false;
}
void GLESv2Context::setupArraysPointers(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct) {
ArraysMap::iterator it;
//going over all clients arrays Pointers
for ( it=m_map.begin() ; it != m_map.end(); it++ ) {
GLenum array_id = (*it).first;
GLESpointer* p = (*it).second;
if(!isArrEnabled(array_id)) continue;
unsigned int size = p->getSize();
if(needConvert(cArrs,first,count,type,indices,direct,p,array_id)){
//conversion has occured
ArrayData currentArr = cArrs.getCurrentArray();
setupArr(currentArr.data,array_id,currentArr.type,size,currentArr.stride, p->getNormalized());
++cArrs;
} else {
setupArr(p->getData(),array_id,p->getType(),
size,p->getStride(), p->getNormalized());
}
}
}
//setting client side arr
void GLESv2Context::setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int index){
if(arr == NULL) return;
s_glDispatch.glVertexAttribPointer(arrayType,size,dataType,normalized,stride,arr);
}
bool GLESv2Context::needConvert(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) {
bool usingVBO = p->isVBO();
GLenum arrType = p->getType();
/*
conversion is not necessary in the following cases:
(*) array type is not fixed
*/
if(arrType != GL_FIXED) return false;
if(!usingVBO) {
if (direct) {
convertDirect(cArrs,first,count,array_id,p);
} else {
convertIndirect(cArrs,count,type,indices,array_id,p);
}
} else {
if (direct) {
convertDirectVBO(cArrs,first,count,array_id,p) ;
} else {
convertIndirectVBO(cArrs,count,type,indices,array_id,p);
}
}
return true;
}
void GLESv2Context::initExtensionString() {
*s_glExtensions = "GL_OES_EGL_image GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint "
"GL_OES_texture_float GL_OES_texture_float_linear "
"GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture ";
if (s_glSupport.GL_ARB_HALF_FLOAT_PIXEL || s_glSupport.GL_NV_HALF_FLOAT)
*s_glExtensions+="GL_OES_texture_half_float GL_OES_texture_half_float_linear ";
if (s_glSupport.GL_EXT_PACKED_DEPTH_STENCIL)
*s_glExtensions+="GL_OES_packed_depth_stencil ";
if (s_glSupport.GL_ARB_HALF_FLOAT_VERTEX)
*s_glExtensions+="GL_OES_vertex_half_float ";
if (s_glSupport.GL_OES_STANDARD_DERIVATIVES)
*s_glExtensions+="GL_OES_standard_derivatives ";
}
int GLESv2Context::getMaxTexUnits() {
return getCaps()->maxTexImageUnits;
}

View File

@@ -1,56 +0,0 @@
#ifndef GLES_V2_CONTEXT_H
#define GLES_V2_CONTEXT_H
/*
* 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 <GLcommon/GLDispatch.h>
#include <GLcommon/GLEScontext.h>
#include <GLcommon/objectNameManager.h>
#include <utils/threads.h>
class GLESv2Context : public GLEScontext{
public:
void init();
GLESv2Context();
virtual ~GLESv2Context();
void setupArraysPointers(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct);
int getMaxTexUnits();
// This whole att0 thing is about a incompatibility between GLES and OpenGL.
// GLES allows a vertex shader attribute to be in location 0 and have a
// current value, while OpenGL is not very clear about this, which results
// in each implementation doing something different.
void setAttribute0value(float x, float y, float z, float w);
void validateAtt0PreDraw(unsigned int count);
void validateAtt0PostDraw(void);
const float* getAtt0(void) {return m_attribute0value;}
protected:
bool needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id);
private:
void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int pointsIndex = -1);
void initExtensionString();
float m_attribute0value[4];
GLfloat* m_att0Array;
unsigned int m_att0ArrayLength;
bool m_att0NeedsDisable;
};
#endif

View File

@@ -1,182 +0,0 @@
/*
* 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 "GLESv2Validate.h"
bool GLESv2Validate::blendEquationMode(GLenum mode){
return mode == GL_FUNC_ADD ||
mode == GL_FUNC_SUBTRACT ||
mode == GL_FUNC_REVERSE_SUBTRACT;
}
bool GLESv2Validate::blendSrc(GLenum s) {
switch(s) {
case GL_ZERO:
case GL_ONE:
case GL_SRC_COLOR:
case GL_ONE_MINUS_SRC_COLOR:
case GL_DST_COLOR:
case GL_ONE_MINUS_DST_COLOR:
case GL_SRC_ALPHA:
case GL_ONE_MINUS_SRC_ALPHA:
case GL_DST_ALPHA:
case GL_ONE_MINUS_DST_ALPHA:
case GL_CONSTANT_COLOR:
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
case GL_SRC_ALPHA_SATURATE:
return true;
}
return false;
}
bool GLESv2Validate::blendDst(GLenum d) {
switch(d) {
case GL_ZERO:
case GL_ONE:
case GL_SRC_COLOR:
case GL_ONE_MINUS_SRC_COLOR:
case GL_DST_COLOR:
case GL_ONE_MINUS_DST_COLOR:
case GL_SRC_ALPHA:
case GL_ONE_MINUS_SRC_ALPHA:
case GL_DST_ALPHA:
case GL_ONE_MINUS_DST_ALPHA:
case GL_CONSTANT_COLOR:
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
return true;
}
return false;
}
bool GLESv2Validate::textureParams(GLenum param){
switch(param) {
case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
return true;
default:
return false;
}
}
bool GLESv2Validate::hintTargetMode(GLenum target,GLenum mode){
switch(mode) {
case GL_FASTEST:
case GL_NICEST:
case GL_DONT_CARE:
break;
default: return false;
}
return target == GL_GENERATE_MIPMAP_HINT || target == GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES;
}
bool GLESv2Validate::capability(GLenum cap){
switch(cap){
case GL_BLEND:
case GL_CULL_FACE:
case GL_DEPTH_TEST:
case GL_DITHER:
case GL_POLYGON_OFFSET_FILL:
case GL_SAMPLE_ALPHA_TO_COVERAGE:
case GL_SAMPLE_COVERAGE:
case GL_SCISSOR_TEST:
case GL_STENCIL_TEST:
return true;
}
return false;
}
bool GLESv2Validate::pixelStoreParam(GLenum param){
return param == GL_PACK_ALIGNMENT || param == GL_UNPACK_ALIGNMENT;
}
bool GLESv2Validate::readPixelFrmt(GLenum format){
switch(format) {
case GL_ALPHA:
case GL_RGB:
case GL_RGBA:
return true;
}
return false;
}
bool GLESv2Validate::shaderType(GLenum type){
return type == GL_VERTEX_SHADER || type == GL_FRAGMENT_SHADER;
}
bool GLESv2Validate::precisionType(GLenum type){
switch(type){
case GL_LOW_FLOAT:
case GL_MEDIUM_FLOAT:
case GL_HIGH_FLOAT:
case GL_LOW_INT:
case GL_MEDIUM_INT:
case GL_HIGH_INT:
return true;
}
return false;
}
bool GLESv2Validate::arrayIndex(GLEScontext * ctx,GLuint index) {
return index < (GLuint)ctx->getCaps()->maxVertexAttribs;
}
bool GLESv2Validate::pixelType(GLEScontext * ctx,GLenum type) {
if(type == GL_UNSIGNED_SHORT || type == GL_UNSIGNED_INT)
return true;
return GLESvalidate::pixelType(ctx, type);
}
bool GLESv2Validate::pixelFrmt(GLEScontext* ctx,GLenum format) {
if(format == GL_DEPTH_COMPONENT)
return true;
return GLESvalidate::pixelFrmt(ctx, format);
}
bool GLESv2Validate::attribName(const GLchar* name){
const GLchar* found = strstr(name,"gl_");
return (!found) ||
(found != name) ; // attrib name does not start with gl_
}
bool GLESv2Validate::attribIndex(int index){
return index >=0 && index < GL_MAX_VERTEX_ATTRIBS;
}
bool GLESv2Validate::programParam(GLenum pname){
switch(pname){
case GL_DELETE_STATUS:
case GL_LINK_STATUS:
case GL_VALIDATE_STATUS:
case GL_INFO_LOG_LENGTH:
case GL_ATTACHED_SHADERS:
case GL_ACTIVE_ATTRIBUTES:
case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
case GL_ACTIVE_UNIFORMS:
case GL_ACTIVE_UNIFORM_MAX_LENGTH:
return true;
}
return false;
}

View File

@@ -1,43 +0,0 @@
#ifndef GLES_V2_VALIDATE_H
#define GLES_V2_VALIDATE_H
/*
* 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 <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLcommon/GLESvalidate.h>
struct GLESv2Validate:public GLESvalidate{
static bool blendEquationMode(GLenum mode);
static bool blendSrc(GLenum s);
static bool blendDst(GLenum d);
static bool textureParams(GLenum param);
static bool hintTargetMode(GLenum target,GLenum mode);
static bool capability(GLenum cap);
static bool pixelStoreParam(GLenum param);
static bool readPixelFrmt(GLenum format);
static bool shaderType(GLenum type);
static bool precisionType(GLenum type);
static bool arrayIndex(GLEScontext * ctx,GLuint index);
static bool pixelType(GLEScontext * ctx,GLenum type);
static bool pixelFrmt(GLEScontext* ctx,GLenum format);
static bool attribName(const GLchar* name);
static bool attribIndex(int index);
static bool programParam(GLenum pname);
};
#endif

View File

@@ -1,96 +0,0 @@
/*
* 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 <GLES2/gl2.h>
#include <GLcommon/objectNameManager.h>
#include "ProgramData.h"
ProgramData::ProgramData() : ObjectData(PROGRAM_DATA),
AttachedVertexShader(0),
AttachedFragmentShader(0),
LinkStatus(GL_FALSE) {
infoLog = new GLchar[1];
infoLog[0] = '\0';
}
ProgramData::~ProgramData () {
delete[] infoLog;
};
void ProgramData::setInfoLog(GLchar* log) {
delete[] infoLog;
infoLog = log;
}
GLchar* ProgramData::getInfoLog() {
return infoLog;
}
GLuint ProgramData::getAttachedVertexShader() {
return AttachedVertexShader;
}
GLuint ProgramData::getAttachedFragmentShader() {
return AttachedFragmentShader;
}
GLuint ProgramData::getAttachedShader(GLenum type) {
GLuint shader = 0;
switch (type) {
case GL_VERTEX_SHADER:
shader = AttachedVertexShader;
break;
case GL_FRAGMENT_SHADER:
shader = AttachedFragmentShader;
break;
}
return shader;
}
bool ProgramData::attachShader(GLuint shader,GLenum type) {
if (type==GL_VERTEX_SHADER && AttachedVertexShader==0) {
AttachedVertexShader=shader;
return true;
}
else if (type==GL_FRAGMENT_SHADER && AttachedFragmentShader==0) {
AttachedFragmentShader=shader;
return true;
}
return false;
}
bool ProgramData::isAttached(GLuint shader) {
return (AttachedFragmentShader==shader || AttachedVertexShader==shader);
}
bool ProgramData::detachShader(GLuint shader) {
if (AttachedVertexShader==shader) {
AttachedVertexShader = 0;
return true;
}
else if (AttachedFragmentShader==shader) {
AttachedFragmentShader = 0;
return true;
}
return false;
}
void ProgramData::setLinkStatus(GLint status) {
LinkStatus = status;
}
GLint ProgramData::getLinkStatus() {
return LinkStatus;
}

View File

@@ -1,44 +0,0 @@
/*
* 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 PROGRAM_DATA_H
#define PROGRAM_DATA_H
class ProgramData:public ObjectData{
public:
ProgramData();
virtual ~ProgramData();
GLuint getAttachedVertexShader();
GLuint getAttachedFragmentShader();
GLuint getAttachedShader(GLenum type);
bool attachShader(GLuint shader,GLenum type);
bool isAttached(GLuint shader);
bool detachShader(GLuint shader);
void setLinkStatus(GLint status);
GLint getLinkStatus();
void setInfoLog(GLchar *log);
GLchar* getInfoLog();
private:
GLuint AttachedVertexShader;
GLuint AttachedFragmentShader;
GLint LinkStatus;
GLchar* infoLog;
};
#endif

View File

@@ -1,327 +0,0 @@
#include "ShaderParser.h"
#include <string.h>
ShaderParser::ShaderParser():ObjectData(SHADER_DATA),
m_type(0),
m_originalSrc(NULL),
m_parsedLines(NULL) {
m_infoLog = new GLchar[1];
m_infoLog[0] = '\0';
};
ShaderParser::ShaderParser(GLenum type):ObjectData(SHADER_DATA),
m_type(type),
m_originalSrc(NULL),
m_parsedLines(NULL) {
m_infoLog = new GLchar[1];
m_infoLog[0] = '\0';
};
void ShaderParser::setSrc(const Version& ver,GLsizei count,const GLchar** strings,const GLint* length){
for(int i = 0;i<count;i++){
m_src.append(strings[i]);
}
//store original source
if (m_originalSrc)
free(m_originalSrc);
m_originalSrc = strdup(m_src.c_str());
clearParsedSrc();
// parseGLSLversion must be called first since #version should be the
// first token in the shader source.
parseGLSLversion();
parseBuiltinConstants();
/*
version 1.30.10 is the first version of GLSL Language containing precision qualifiers
if the glsl version is less than 1.30.10 than we will use a shader parser which omits
all precision qualifiers from the shader source , otherwise we will use a shader parser
which set the default precisions to be the same as the default precisions of GLSL ES
*/
#if 0
if(ver < Version(1,30,10)){
parseOmitPrecision();
} else {
parseExtendDefaultPrecision();
}
#else
//XXX: Until proved otherwise, glsl doesn't know/use those precision macros, so we omit then
parseOmitPrecision();
#endif
parseLineNumbers();
parseOriginalSrc();
}
const GLchar** ShaderParser::parsedLines() {
m_parsedLines = (GLchar*)m_parsedSrc.c_str();
return const_cast<const GLchar**> (&m_parsedLines);
};
const char* ShaderParser::getOriginalSrc(){
return m_originalSrc;
}
void ShaderParser::parseLineNumbers()
{
m_parsedSrc += "#line 1\n";
}
void ShaderParser::parseOriginalSrc() {
m_parsedSrc+=m_src;
}
void ShaderParser::parseGLSLversion() {
//
// find in shader the #version token if exist.
// That token should be the first non-comment or blank token
//
const char *src = m_src.c_str();
const int minGLSLVersion = 120;
int glslVersion = minGLSLVersion;
enum {
PARSE_NONE,
PARSE_IN_C_COMMENT,
PARSE_IN_LINE_COMMENT
} parseState = PARSE_NONE;
const char *c = src;
while( c && *c != '\0') {
if (parseState == PARSE_IN_C_COMMENT) {
if (*c == '*' && *(c+1) == '/') {
parseState = PARSE_NONE;
c += 2;
}
else c++;
}
else if (parseState == PARSE_IN_LINE_COMMENT) {
if (*c == '\n') {
parseState = PARSE_NONE;
}
c++;
}
else if (*c == '/' && *(c+1) == '/') {
parseState = PARSE_IN_LINE_COMMENT;
c += 2;
}
else if (*c == '/' && *(c+1) == '*') {
parseState = PARSE_IN_C_COMMENT;
c += 2;
}
else if (*c == ' ' || *c == '\t' || *c == '\r' || *c == '\n') {
c++;
}
else {
//
// We have reached the first non-blank character outside
// a comment, this must be a #version token or else #version
// token does not exist in this shader source.
//
if (!strncmp(c,"#version",8)) {
int ver;
if (sscanf(c+8,"%d",&ver) == 1) {
//
// parsed version string correctly, blank out the
// version token from the source, we will add it later at
// the begining of the shader.
//
char *cc = (char *)c;
for (int i=0; i<8; i++,cc++) *cc = ' ';
while (*cc < '0' || *cc > '9') { *cc = ' '; cc++; }
while (*cc >= '0' && *cc <= '9') { *cc = ' '; cc++; }
// Use the version from the source but only if
// it is larger than our minGLSLVersion
if (ver > minGLSLVersion) glslVersion = ver;
}
}
//
// break the loop, no need to go further on the source.
break;
}
}
//
// allow to force GLSL version through environment variable
//
const char *forceVersion = getenv("GOOGLE_GLES_FORCE_GLSL_VERSION");
if (forceVersion) {
int ver;
if (sscanf(forceVersion,"%d",&ver) == 1) {
glslVersion = ver;
}
}
//
// if glslVersion is defined, add it to the parsed source
//
if (glslVersion > 0) {
char vstr[16];
sprintf(vstr,"%d",glslVersion);
m_parsedSrc += std::string("#version ") +
std::string(vstr) +
std::string("\n");
}
}
void ShaderParser::parseBuiltinConstants()
{
m_parsedSrc +=
"const int _translator_gl_MaxVertexUniformVectors = 256;\n"
"const int _translator_gl_MaxFragmentUniformVectors = 256;\n"
"const int _translator_gl_MaxVaryingVectors = 15;\n"
"#define gl_MaxVertexUniformVectors _translator_gl_MaxVertexUniformVectors\n"
"#define gl_MaxFragmentUniformVectors _translator_gl_MaxFragmentUniformVectors\n"
"#define gl_MaxVaryingVectors _translator_gl_MaxVaryingVectors\n";
}
void ShaderParser::parseOmitPrecision(){
//defines we need to add in order to Omit precisions qualifiers
static const GLchar defines[] = {
"#define GLES 1\n"
"#define lowp \n"
"#define mediump \n"
"#define highp \n"
};
m_parsedSrc+=defines;
//
// parse the source and blank out precision statements
// which has the following syntax:
// precision {qualifier} {type};
// where {qualifier} is one of lowp,mediump or hightp
// type is any valid GLES defined type (we do not check that here!)
// NOTE: This is needed in order to workaround driver bug in
// Intel/Linux where the compiler does not get statement like
// "float;", otherwise we could just define a macro named
// precision to be empty.
//
const char *src = m_src.c_str();
enum {
PRECISION,
QUALIFIER,
SEMICOLON
} statementState = PRECISION;
const char *precision = NULL;
const char *delimiter = NULL;
enum {
PARSE_NONE,
PARSE_IN_C_COMMENT,
PARSE_IN_LINE_COMMENT
} parseState = PARSE_NONE;
const char *c = src;
const char *t = NULL;
#define IS_DELIMITER(c) ( (c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n' )
#define IS_TOKEN_START(c) ( ((c) >= 'a' && (c) <='z') || ((c) >= 'A' && (c) <= 'Z') )
#define IS_TOKEN_DELIMITER(c) ( IS_DELIMITER(c) || (c) == ';' )
while( c && *c != '\0') {
if (parseState == PARSE_IN_C_COMMENT) {
if (*c == '*' && *(c+1) == '/') {
parseState = PARSE_NONE;
c += 2;
}
else c++;
}
else if (parseState == PARSE_IN_LINE_COMMENT) {
if (*c == '\n') {
parseState = PARSE_NONE;
}
c++;
}
else if (*c == '/' && *(c+1) == '/') {
parseState = PARSE_IN_LINE_COMMENT;
c += 2;
}
else if (*c == '/' && *(c+1) == '*') {
parseState = PARSE_IN_C_COMMENT;
c += 2;
}
else if (t && IS_TOKEN_DELIMITER(*c)) {
int tokenLen = c - t;
switch (statementState) {
case PRECISION:
if (tokenLen == 9 && !strncmp(t,"precision",9)) {
statementState = QUALIFIER;
precision = t;
}
break;
case QUALIFIER:
if ((tokenLen == 4 && !strncmp(t,"lowp",4)) ||
(tokenLen == 7 && !strncmp(t,"mediump",7)) ||
(tokenLen == 5 && !strncmp(t,"highp",5))) {
statementState = SEMICOLON;
}
else {
statementState = PRECISION;
}
break;
case SEMICOLON:
if (*c == ';') {
for (char *r = (char *)precision; r<=c ; ++r) {
*r = ' '; //blank the character
}
}
statementState = PRECISION; //search for the next precision line
break;
default:
break;
}
c++;
t = NULL;
}
else if (IS_DELIMITER(*c)) {
c++;
}
else {
if (!t && IS_TOKEN_START(*c)) {
t = c;
}
c++;
}
}
}
void ShaderParser::parseExtendDefaultPrecision(){
//the precision lines which we need to add to the shader
static const GLchar extend[] = {
"#define GLES 1\n"
"precision lowp sampler2D;\n"
"precision lowp samplerCube;\n"
};
m_parsedSrc+=extend;
}
void ShaderParser::clearParsedSrc(){
m_parsedSrc.clear();
}
GLenum ShaderParser::getType() {
return m_type;
}
void ShaderParser::setInfoLog(GLchar* infoLog)
{
delete[] m_infoLog;
m_infoLog = infoLog;
}
GLchar* ShaderParser::getInfoLog()
{
return m_infoLog;
}
ShaderParser::~ShaderParser(){
clearParsedSrc();
if (m_originalSrc)
free(m_originalSrc);
delete[] m_infoLog;
}

View File

@@ -1,38 +0,0 @@
#ifndef SHADER_PARSER_H
#define SHADER_PARSER_H
#include "GLESv2Context.h"
#include <string>
#include <GLES2/gl2.h>
#include <GLcommon/objectNameManager.h>
class ShaderParser:public ObjectData{
public:
ShaderParser();
ShaderParser(GLenum type);
void setSrc(const Version& ver,GLsizei count,const GLchar** strings,const GLint* length);
const char* getOriginalSrc();
const GLchar** parsedLines();
GLenum getType();
~ShaderParser();
void setInfoLog(GLchar * infoLog);
GLchar* getInfoLog();
private:
void parseOriginalSrc();
void parseGLSLversion();
void parseBuiltinConstants();
void parseOmitPrecision();
void parseExtendDefaultPrecision();
void parseLineNumbers();
void clearParsedSrc();
GLenum m_type;
char* m_originalSrc;
std::string m_src;
std::string m_parsedSrc;
GLchar* m_parsedLines;
GLchar* m_infoLog;
};
#endif

View File

@@ -1,61 +0,0 @@
LOCAL_PATH := $(call my-dir)
host_common_SRC_FILES := \
GLDispatch.cpp \
GLutils.cpp \
GLEScontext.cpp \
GLESvalidate.cpp \
GLESpointer.cpp \
GLESbuffer.cpp \
DummyGLfuncs.cpp \
RangeManip.cpp \
TextureUtils.cpp \
PaletteTexture.cpp \
etc1.cpp \
objectNameManager.cpp \
FramebufferData.cpp
host_GL_COMMON_LINKER_FLAGS :=
host_common_LDLIBS :=
host_common_LDFLAGS :=
ifeq ($(HOST_OS),linux)
# host_common_LDFLAGS += -Wl,--whole-archive
host_common_LDLIBS += -lGL -ldl
host_common_LDFLAGS += -Wl,-Bsymbolic
endif
ifeq ($(HOST_OS),windows)
host_common_LDLIBS += -lopengl32 -lgdi32
host_common_LDFLAGS += -Wl,--add-stdcall-alias
endif
### EGL host implementation ########################
$(call emugl-begin-host-static-library,libGLcommon)
$(call emugl-import,libOpenglOsUtils)
translator_path := $(LOCAL_PATH)/..
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-export,LDLIBS,$(host_common_LDLIBS))
$(call emugl-export,LDFLAGS,$(host_common_LDFLAGS))
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/../include $(EMUGL_PATH)/shared)
$(call emugl-export,STATIC_LIBRARIES, libcutils libutils liblog)
$(call emugl-end-module)
### EGL host implementation, 64-bit ################
$(call emugl-begin-host-static-library,lib64GLcommon)
$(call emugl-import,lib64OpenglOsUtils)
translator_path := $(LOCAL_PATH)/..
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-export,LDLIBS,$(host_common_LDLIBS))
$(call emugl-export,LDFLAGS,$(host_common_LDFLAGS))
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/../include $(EMUGL_PATH)/shared)
$(call emugl-export,STATIC_LIBRARIES, lib64cutils lib64utils lib64log)
$(call emugl-end-module)

View File

@@ -1,256 +0,0 @@
#include "DummyGLfuncs.h"
/*
* 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.
*/
void GLAPIENTRY dummy_glActiveTexture ( GLenum texture ){}
void GLAPIENTRY dummy_glBindBuffer (GLenum target, GLuint buffer){}
void GLAPIENTRY dummy_glBindTexture (GLenum target, GLuint texture){}
void GLAPIENTRY dummy_glBlendFunc (GLenum sfactor, GLenum dfactor){}
void GLAPIENTRY dummy_glBlendEquation( GLenum mode ){}
void GLAPIENTRY dummy_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha){}
void GLAPIENTRY dummy_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha){}
void GLAPIENTRY dummy_glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage){}
void GLAPIENTRY dummy_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data){}
void GLAPIENTRY dummy_glClear(GLbitfield mask){}
void GLAPIENTRY dummy_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha){}
void GLAPIENTRY dummy_glClearStencil(GLint s){}
void GLAPIENTRY dummy_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha){}
void GLAPIENTRY dummy_glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ){}
void GLAPIENTRY dummy_glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ){}
void GLAPIENTRY dummy_glCopyTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border){}
void GLAPIENTRY dummy_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height){}
void GLAPIENTRY dummy_glCullFace(GLenum mode){}
void GLAPIENTRY dummy_glDeleteBuffers(GLsizei n, const GLuint *buffers){}
void GLAPIENTRY dummy_glDeleteTextures(GLsizei n, const GLuint *textures){}
void GLAPIENTRY dummy_glDepthFunc(GLenum func){}
void GLAPIENTRY dummy_glDepthMask(GLboolean flag){}
void GLAPIENTRY dummy_glDepthRange(GLclampd zNear, GLclampd zFar){}
void GLAPIENTRY dummy_glDisable(GLenum cap){}
void GLAPIENTRY dummy_glDrawArrays(GLenum mode, GLint first, GLsizei count){}
void GLAPIENTRY dummy_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices){}
void GLAPIENTRY dummy_glEnable(GLenum cap){}
void GLAPIENTRY dummy_glFinish(void){}
void GLAPIENTRY dummy_glFlush(void){}
void GLAPIENTRY dummy_glFrontFace(GLenum mode){}
void GLAPIENTRY dummy_glGenBuffers(GLsizei n, GLuint *buffers){}
void GLAPIENTRY dummy_glGenTextures(GLsizei n, GLuint *textures){}
void GLAPIENTRY dummy_glGetBooleanv(GLenum pname, GLboolean *params){}
void GLAPIENTRY dummy_glGetBufferParameteriv(GLenum, GLenum, GLint *){}
GLenum GLAPIENTRY dummy_glGetError(void){ return 0;}
void GLAPIENTRY dummy_glGetFloatv(GLenum pname, GLfloat *params){}
void GLAPIENTRY dummy_glGetIntegerv(GLenum pname, GLint *params){}
const GLubyte * GLAPIENTRY dummy_glGetString(GLenum name){ return 0;}
void GLAPIENTRY dummy_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params){}
void GLAPIENTRY dummy_glGetTexParameteriv(GLenum target, GLenum pname, GLint *params){}
void GLAPIENTRY dummy_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params){}
void GLAPIENTRY dummy_glHint(GLenum target, GLenum mode){}
GLboolean GLAPIENTRY dummy_glIsBuffer(GLuint){ return false;}
GLboolean GLAPIENTRY dummy_glIsEnabled(GLenum cap){ return false;}
GLboolean GLAPIENTRY dummy_glIsTexture(GLuint texture){return false;}
void GLAPIENTRY dummy_glLineWidth(GLfloat width){}
void GLAPIENTRY dummy_glPolygonOffset(GLfloat factor, GLfloat units){}
void GLAPIENTRY dummy_glPixelStorei(GLenum pname, GLint param){}
void GLAPIENTRY dummy_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels){}
void GLAPIENTRY dummy_glSampleCoverage(GLclampf value, GLboolean invert ){}
void GLAPIENTRY dummy_glScissor(GLint x, GLint y, GLsizei width, GLsizei height){}
void GLAPIENTRY dummy_glStencilFunc(GLenum func, GLint ref, GLuint mask){}
void GLAPIENTRY dummy_glStencilMask(GLuint mask){}
void GLAPIENTRY dummy_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass){}
void GLAPIENTRY dummy_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels){}
void GLAPIENTRY dummy_glTexParameteri(GLenum target, GLenum pname, GLint param){}
void GLAPIENTRY dummy_glTexParameteriv(GLenum target, GLenum pname, const GLint *params){}
void GLAPIENTRY dummy_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels){}
void GLAPIENTRY dummy_glViewport(GLint x, GLint y, GLsizei width, GLsizei height){}
void GLAPIENTRY dummy_glPushAttrib( GLbitfield mask ){}
void GLAPIENTRY dummy_glPopAttrib( void ){}
void GLAPIENTRY dummy_glPushClientAttrib( GLbitfield mask ){}
void GLAPIENTRY dummy_glPopClientAttrib( void ){}
/* OpenGL functions which are needed ONLY for implementing GLES 1.1*/
void GLAPIENTRY dummy_glAlphaFunc(GLenum func, GLclampf ref){}
void GLAPIENTRY dummy_glBegin( GLenum mode ){}
void GLAPIENTRY dummy_glClearDepth(GLclampd depth){}
void GLAPIENTRY dummy_glClientActiveTexture( GLenum texture ){}
void GLAPIENTRY dummy_glClipPlane(GLenum plane, const GLdouble *equation){}
void GLAPIENTRY dummy_glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha){}
void GLAPIENTRY dummy_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha){}
void GLAPIENTRY dummy_glColor4fv( const GLfloat *v ){}
void GLAPIENTRY dummy_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha){}
void GLAPIENTRY dummy_glColor4ubv( const GLubyte *v ){}
void GLAPIENTRY dummy_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){}
void GLAPIENTRY dummy_glDisableClientState(GLenum array){}
void GLAPIENTRY dummy_glEnableClientState(GLenum array){}
void GLAPIENTRY dummy_glEnd(void){}
void GLAPIENTRY dummy_glFogf(GLenum pname, GLfloat param){}
void GLAPIENTRY dummy_glFogfv(GLenum pname, const GLfloat *params){}
void GLAPIENTRY dummy_glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar){}
void GLAPIENTRY dummy_glGetClipPlane(GLenum plane, GLdouble *equation){}
void GLAPIENTRY dummy_glGetDoublev( GLenum pname, GLdouble *params ){}
void GLAPIENTRY dummy_glGetLightfv(GLenum light, GLenum pname, GLfloat *params){}
void GLAPIENTRY dummy_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params){}
void GLAPIENTRY dummy_glGetPointerv(GLenum pname, GLvoid* *params){}
void GLAPIENTRY dummy_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params){}
void GLAPIENTRY dummy_glGetTexEnviv(GLenum target, GLenum pname, GLint *params){}
void GLAPIENTRY dummy_glLightf(GLenum light, GLenum pname, GLfloat param){}
void GLAPIENTRY dummy_glLightfv(GLenum light, GLenum pname, const GLfloat *params){}
void GLAPIENTRY dummy_glLightModelf(GLenum pname, GLfloat param){}
void GLAPIENTRY dummy_glLightModelfv(GLenum pname, const GLfloat *params){}
void GLAPIENTRY dummy_glLoadIdentity(void){}
void GLAPIENTRY dummy_glLoadMatrixf(const GLfloat *m){}
void GLAPIENTRY dummy_glLogicOp(GLenum opcode){}
void GLAPIENTRY dummy_glMaterialf(GLenum face, GLenum pname, GLfloat param){}
void GLAPIENTRY dummy_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params){}
void GLAPIENTRY dummy_glMultiTexCoord2fv( GLenum target, const GLfloat *v ){}
void GLAPIENTRY dummy_glMultiTexCoord2sv( GLenum target, const GLshort *v ){}
void GLAPIENTRY dummy_glMultiTexCoord3fv( GLenum target, const GLfloat *v ){}
void GLAPIENTRY dummy_glMultiTexCoord3sv( GLenum target, const GLshort *v ){}
void GLAPIENTRY dummy_glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ){}
void GLAPIENTRY dummy_glMultiTexCoord4fv( GLenum target, const GLfloat *v ){}
void GLAPIENTRY dummy_glMultiTexCoord4sv( GLenum target, const GLshort *v ){}
void GLAPIENTRY dummy_glMultMatrixf(const GLfloat *m){}
void GLAPIENTRY dummy_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz){}
void GLAPIENTRY dummy_glNormal3fv( const GLfloat *v ){}
void GLAPIENTRY dummy_glNormal3sv(const GLshort *v ){}
void GLAPIENTRY dummy_glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar){}
void GLAPIENTRY dummy_glPointParameterf(GLenum, GLfloat){}
void GLAPIENTRY dummy_glPointParameterfv(GLenum, const GLfloat *){}
void GLAPIENTRY dummy_glPointSize(GLfloat size){}
void GLAPIENTRY dummy_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z){}
void GLAPIENTRY dummy_glScalef(GLfloat x, GLfloat y, GLfloat z){}
void GLAPIENTRY dummy_glTexEnvf(GLenum target, GLenum pname, GLfloat param){}
void GLAPIENTRY dummy_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params){}
void GLAPIENTRY dummy_glTexParameterf(GLenum target, GLenum pname, GLfloat param){}
void GLAPIENTRY dummy_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params){}
void GLAPIENTRY dummy_glMatrixMode(GLenum mode){}
void GLAPIENTRY dummy_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer){}
void GLAPIENTRY dummy_glPopMatrix(void){}
void GLAPIENTRY dummy_glPushMatrix(void){}
void GLAPIENTRY dummy_glShadeModel(GLenum mode){}
void GLAPIENTRY dummy_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){}
void GLAPIENTRY dummy_glTexEnvi(GLenum target, GLenum pname, GLint param){}
void GLAPIENTRY dummy_glTexEnviv(GLenum target, GLenum pname, const GLint *params){}
void GLAPIENTRY dummy_glTranslatef(GLfloat x, GLfloat y, GLfloat z){}
void GLAPIENTRY dummy_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){}
/* OpenGL functions which are needed ONLY for implementing GLES 1.1 EXTENSIONS*/
GLboolean GLAPIENTRY dummy_glIsRenderbufferEXT(GLuint renderbuffer){ return false;}
void GLAPIENTRY dummy_glBindRenderbufferEXT(GLenum target, GLuint renderbuffer){}
void GLAPIENTRY dummy_glDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers){}
void GLAPIENTRY dummy_glGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers){}
void GLAPIENTRY dummy_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height){}
void GLAPIENTRY dummy_glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params){}
GLboolean GLAPIENTRY dummy_glIsFramebufferEXT(GLuint framebuffer){ return false;}
void GLAPIENTRY dummy_glBindFramebufferEXT(GLenum target, GLuint framebuffer){}
void GLAPIENTRY dummy_glDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers){}
void GLAPIENTRY dummy_glGenFramebuffersEXT(GLsizei n, GLuint *framebuffers){}
GLenum GLAPIENTRY dummy_glCheckFramebufferStatusEXT(GLenum target){ return 0;}
void GLAPIENTRY dummy_glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level){}
void GLAPIENTRY dummy_glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level){}
void GLAPIENTRY dummy_glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset){}
void GLAPIENTRY dummy_glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer){}
void GLAPIENTRY dummy_glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params){}
void GLAPIENTRY dummy_glGenerateMipmapEXT(GLenum target){}
void GLAPIENTRY dummy_glCurrentPaletteMatrixARB(GLint index){}
void GLAPIENTRY dummy_glMatrixIndexuivARB(GLint size, GLuint * indices){}
void GLAPIENTRY dummy_glMatrixIndexPointerARB(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer){}
void GLAPIENTRY dummy_glWeightPointerARB(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer){}
void GLAPIENTRY dummy_glTexGenf(GLenum coord, GLenum pname, GLfloat param ){}
void GLAPIENTRY dummy_glTexGeni(GLenum coord, GLenum pname, GLint param ){}
void GLAPIENTRY dummy_glTexGenf(GLenum coord, GLenum pname, const GLfloat *params ){}
void GLAPIENTRY dummy_glTexGeniv(GLenum coord, GLenum pname, const GLint *params ){}
void GLAPIENTRY dummy_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params ){}
void GLAPIENTRY dummy_glGetTexGeniv(GLenum coord, GLenum pname, GLint *params ){}
/* Loading OpenGL functions which are needed ONLY for implementing GLES 2.0*/
void GL_APIENTRY dummy_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha){}
void GL_APIENTRY dummy_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask){}
void GL_APIENTRY dummy_glStencilMaskSeparate(GLenum face, GLuint mask){}
void GL_APIENTRY dummy_glGenerateMipmap(GLenum target){}
void GL_APIENTRY dummy_glBindFramebuffer(GLenum target, GLuint framebuffer){}
void GL_APIENTRY dummy_glBindRenderbuffer(GLenum target, GLuint renderbuffer){}
void GL_APIENTRY dummy_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers){}
void GL_APIENTRY dummy_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers){}
GLboolean GL_APIENTRY dummy_glIsProgram(GLuint program){ return false;}
GLboolean GL_APIENTRY dummy_glIsShader(GLuint shader){ return false;}
void GL_APIENTRY dummy_glVertexAttrib1f(GLuint indx, GLfloat x){}
void GL_APIENTRY dummy_glVertexAttrib1fv(GLuint indx, const GLfloat* values){}
void GL_APIENTRY dummy_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y){}
void GL_APIENTRY dummy_glVertexAttrib2fv(GLuint indx, const GLfloat* values){}
void GL_APIENTRY dummy_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z){}
void GL_APIENTRY dummy_glVertexAttrib3fv(GLuint indx, const GLfloat* values){}
void GL_APIENTRY dummy_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w){}
void GL_APIENTRY dummy_glVertexAttrib4fv(GLuint indx, const GLfloat* values){}
void GL_APIENTRY dummy_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr){}
void GL_APIENTRY dummy_glDisableVertexAttribArray(GLuint index){}
void GL_APIENTRY dummy_glEnableVertexAttribArray(GLuint index){}
void GL_APIENTRY dummy_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params){}
void GL_APIENTRY dummy_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params){}
void GL_APIENTRY dummy_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer){}
void GL_APIENTRY dummy_glUniform1f(GLint location, GLfloat x){}
void GL_APIENTRY dummy_glUniform1fv(GLint location, GLsizei count, const GLfloat* v){}
void GL_APIENTRY dummy_glUniform1i(GLint location, GLint x){}
void GL_APIENTRY dummy_glUniform1iv(GLint location, GLsizei count, const GLint* v){}
void GL_APIENTRY dummy_glUniform2f(GLint location, GLfloat x, GLfloat y){}
void GL_APIENTRY dummy_glUniform2fv(GLint location, GLsizei count, const GLfloat* v){}
void GL_APIENTRY dummy_glUniform2i(GLint location, GLint x, GLint y){}
void GL_APIENTRY dummy_glUniform2iv(GLint location, GLsizei count, const GLint* v){}
void GL_APIENTRY dummy_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z){}
void GL_APIENTRY dummy_glUniform3fv(GLint location, GLsizei count, const GLfloat* v){}
void GL_APIENTRY dummy_glUniform3i(GLint location, GLint x, GLint y, GLint z){}
void GL_APIENTRY dummy_glUniform3iv(GLint location, GLsizei count, const GLint* v){}
void GL_APIENTRY dummy_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w){}
void GL_APIENTRY dummy_glUniform4fv(GLint location, GLsizei count, const GLfloat* v){}
void GL_APIENTRY dummy_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w){}
void GL_APIENTRY dummy_glUniform4iv(GLint location, GLsizei count, const GLint* v){}
void GL_APIENTRY dummy_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value){}
void GL_APIENTRY dummy_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value){}
void GL_APIENTRY dummy_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value){}
void GL_APIENTRY dummy_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params){}
void GL_APIENTRY dummy_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params){}
GLboolean GL_APIENTRY dummy_glIsFramebuffer(GLuint framebuffer){ return false;}
GLboolean GL_APIENTRY dummy_glIsRenderbuffer(GLuint renderbuffer){ return false;}
GLenum GL_APIENTRY dummy_glCheckFramebufferStatus(GLenum target){ return 0;}
void GL_APIENTRY dummy_glAttachShader(GLuint program, GLuint shader){}
void GL_APIENTRY dummy_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name){}
void GL_APIENTRY dummy_glCompileShader(GLuint shader){}
GLuint GL_APIENTRY dummy_glCreateProgram(void){ return 0;}
GLuint GL_APIENTRY dummy_glCreateShader(GLenum type){ return 0;}
void GL_APIENTRY dummy_glDeleteProgram(GLuint program){}
void GL_APIENTRY dummy_glDeleteShader(GLuint shader){}
void GL_APIENTRY dummy_glDetachShader(GLuint program, GLuint shader){}
void GL_APIENTRY dummy_glLinkProgram(GLuint program){}
void GL_APIENTRY dummy_glUseProgram(GLuint program){}
void GL_APIENTRY dummy_glValidateProgram(GLuint program){}
void GL_APIENTRY dummy_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name){}
void GL_APIENTRY dummy_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name){}
void GL_APIENTRY dummy_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders){}
int GL_APIENTRY dummy_glGetAttribLocation(GLuint program, const GLchar* name){ return 0;}
void GL_APIENTRY dummy_glGetProgramiv(GLuint program, GLenum pname, GLint* params){}
void GL_APIENTRY dummy_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog){}
void GL_APIENTRY dummy_glGetShaderiv(GLuint shader, GLenum pname, GLint* params){}
void GL_APIENTRY dummy_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog){}
void GL_APIENTRY dummy_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision){}
void GL_APIENTRY dummy_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source){}
void GL_APIENTRY dummy_glGetUniformfv(GLuint program, GLint location, GLfloat* params){}
void GL_APIENTRY dummy_glGetUniformiv(GLuint program, GLint location, GLint* params){}
int GL_APIENTRY dummy_glGetUniformLocation(GLuint program, const GLchar* name){ return 0;}
void GL_APIENTRY dummy_glReleaseShaderCompiler(void){}
void GL_APIENTRY dummy_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height){}
void GL_APIENTRY dummy_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length){}
void GL_APIENTRY dummy_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length){}
void GL_APIENTRY dummy_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer){}
void GL_APIENTRY dummy_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level){}

View File

@@ -1,265 +0,0 @@
#ifndef DUMMY_GL_FUNCS_H
#define DUMMY_GL_FUNCS_H
/*
* 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 <GLES/gl.h>
#include <GLES2/gl2.h>
#include <GLcommon/gldefs.h>
#define GLAPIENTRY GL_APIENTRY
void GLAPIENTRY dummy_glActiveTexture ( GLenum texture );
void GLAPIENTRY dummy_glBindBuffer (GLenum target, GLuint buffer);
void GLAPIENTRY dummy_glBindTexture (GLenum target, GLuint texture);
void GLAPIENTRY dummy_glBlendFunc (GLenum sfactor, GLenum dfactor);
void GLAPIENTRY dummy_glBlendEquation( GLenum mode );
void GLAPIENTRY dummy_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
void GLAPIENTRY dummy_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
void GLAPIENTRY dummy_glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
void GLAPIENTRY dummy_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
void GLAPIENTRY dummy_glClear(GLbitfield mask);
void GLAPIENTRY dummy_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void GLAPIENTRY dummy_glClearStencil(GLint s);
void GLAPIENTRY dummy_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
void GLAPIENTRY dummy_glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
void GLAPIENTRY dummy_glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
void GLAPIENTRY dummy_glCopyTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
void GLAPIENTRY dummy_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
void GLAPIENTRY dummy_glCullFace(GLenum mode);
void GLAPIENTRY dummy_glDeleteBuffers(GLsizei n, const GLuint *buffers);
void GLAPIENTRY dummy_glDeleteTextures(GLsizei n, const GLuint *textures);
void GLAPIENTRY dummy_glDepthFunc(GLenum func);
void GLAPIENTRY dummy_glDepthMask(GLboolean flag);
void GLAPIENTRY dummy_glDepthRange(GLclampd zNear, GLclampd zFar);
void GLAPIENTRY dummy_glDisable(GLenum cap);
void GLAPIENTRY dummy_glDrawArrays(GLenum mode, GLint first, GLsizei count);
void GLAPIENTRY dummy_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
void GLAPIENTRY dummy_glEnable(GLenum cap);
void GLAPIENTRY dummy_glFinish(void);
void GLAPIENTRY dummy_glFlush(void);
void GLAPIENTRY dummy_glFrontFace(GLenum mode);
void GLAPIENTRY dummy_glGenBuffers(GLsizei n, GLuint *buffers);
void GLAPIENTRY dummy_glGenTextures(GLsizei n, GLuint *textures);
void GLAPIENTRY dummy_glGetBooleanv(GLenum pname, GLboolean *params);
void GLAPIENTRY dummy_glGetBufferParameteriv(GLenum, GLenum, GLint *);
GLenum GLAPIENTRY dummy_glGetError(void);
void GLAPIENTRY dummy_glGetFloatv(GLenum pname, GLfloat *params);
void GLAPIENTRY dummy_glGetIntegerv(GLenum pname, GLint *params);
const GLubyte * GLAPIENTRY dummy_glGetString(GLenum name);
void GLAPIENTRY dummy_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
void GLAPIENTRY dummy_glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
void GLAPIENTRY dummy_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
void GLAPIENTRY dummy_glHint(GLenum target, GLenum mode);
GLboolean GLAPIENTRY dummy_glIsBuffer(GLuint);
GLboolean GLAPIENTRY dummy_glIsEnabled(GLenum cap);
GLboolean GLAPIENTRY dummy_glIsTexture(GLuint texture);
void GLAPIENTRY dummy_glLineWidth(GLfloat width);
void GLAPIENTRY dummy_glPolygonOffset(GLfloat factor, GLfloat units);
void GLAPIENTRY dummy_glPixelStorei(GLenum pname, GLint param);
void GLAPIENTRY dummy_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
void GLAPIENTRY dummy_glSampleCoverage(GLclampf value, GLboolean invert );
void GLAPIENTRY dummy_glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
void GLAPIENTRY dummy_glStencilFunc(GLenum func, GLint ref, GLuint mask);
void GLAPIENTRY dummy_glStencilMask(GLuint mask);
void GLAPIENTRY dummy_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
void GLAPIENTRY dummy_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
void GLAPIENTRY dummy_glTexParameteri(GLenum target, GLenum pname, GLint param);
void GLAPIENTRY dummy_glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
void GLAPIENTRY dummy_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
void GLAPIENTRY dummy_glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
void GLAPIENTRY dummy_glPushAttrib( GLbitfield mask );
void GLAPIENTRY dummy_glPopAttrib( void );
void GLAPIENTRY dummy_glPushClientAttrib( GLbitfield mask );
void GLAPIENTRY dummy_glPopClientAttrib( void );
/* OpenGL functions which are needed ONLY for implementing GLES 1.1*/
void GLAPIENTRY dummy_glAlphaFunc(GLenum func, GLclampf ref);
void GLAPIENTRY dummy_glBegin( GLenum mode );
void GLAPIENTRY dummy_glClearDepth(GLclampd depth);
void GLAPIENTRY dummy_glClientActiveTexture( GLenum texture );
void GLAPIENTRY dummy_glClipPlane(GLenum plane, const GLdouble *equation);
void GLAPIENTRY dummy_glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
void GLAPIENTRY dummy_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void GLAPIENTRY dummy_glColor4fv( const GLfloat *v );
void GLAPIENTRY dummy_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
void GLAPIENTRY dummy_glColor4ubv( const GLubyte *v );
void GLAPIENTRY dummy_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void GLAPIENTRY dummy_glDisableClientState(GLenum array);
void GLAPIENTRY dummy_glEnableClientState(GLenum array);
void GLAPIENTRY dummy_glEnd(void);
void GLAPIENTRY dummy_glFogf(GLenum pname, GLfloat param);
void GLAPIENTRY dummy_glFogfv(GLenum pname, const GLfloat *params);
void GLAPIENTRY dummy_glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
void GLAPIENTRY dummy_glGetClipPlane(GLenum plane, GLdouble *equation);
void GLAPIENTRY dummy_glGetDoublev( GLenum pname, GLdouble *params );
void GLAPIENTRY dummy_glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
void GLAPIENTRY dummy_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
void GLAPIENTRY dummy_glGetPointerv(GLenum pname, GLvoid* *params);
void GLAPIENTRY dummy_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
void GLAPIENTRY dummy_glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
void GLAPIENTRY dummy_glLightf(GLenum light, GLenum pname, GLfloat param);
void GLAPIENTRY dummy_glLightfv(GLenum light, GLenum pname, const GLfloat *params);
void GLAPIENTRY dummy_glLightModelf(GLenum pname, GLfloat param);
void GLAPIENTRY dummy_glLightModelfv(GLenum pname, const GLfloat *params);
void GLAPIENTRY dummy_glLoadIdentity(void);
void GLAPIENTRY dummy_glLoadMatrixf(const GLfloat *m);
void GLAPIENTRY dummy_glLogicOp(GLenum opcode);
void GLAPIENTRY dummy_glMaterialf(GLenum face, GLenum pname, GLfloat param);
void GLAPIENTRY dummy_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
void GLAPIENTRY dummy_glMultiTexCoord2fv( GLenum target, const GLfloat *v );
void GLAPIENTRY dummy_glMultiTexCoord2sv( GLenum target, const GLshort *v );
void GLAPIENTRY dummy_glMultiTexCoord3fv( GLenum target, const GLfloat *v );
void GLAPIENTRY dummy_glMultiTexCoord3sv( GLenum target, const GLshort *v );
void GLAPIENTRY dummy_glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
void GLAPIENTRY dummy_glMultiTexCoord4fv( GLenum target, const GLfloat *v );
void GLAPIENTRY dummy_glMultiTexCoord4sv( GLenum target, const GLshort *v );
void GLAPIENTRY dummy_glMultMatrixf(const GLfloat *m);
void GLAPIENTRY dummy_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
void GLAPIENTRY dummy_glNormal3fv( const GLfloat *v );
void GLAPIENTRY dummy_glNormal3sv(const GLshort *v );
void GLAPIENTRY dummy_glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
void GLAPIENTRY dummy_glPointParameterf(GLenum, GLfloat);
void GLAPIENTRY dummy_glPointParameterfv(GLenum, const GLfloat *);
void GLAPIENTRY dummy_glPointSize(GLfloat size);
void GLAPIENTRY dummy_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
void GLAPIENTRY dummy_glScalef(GLfloat x, GLfloat y, GLfloat z);
void GLAPIENTRY dummy_glTexEnvf(GLenum target, GLenum pname, GLfloat param);
void GLAPIENTRY dummy_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
void GLAPIENTRY dummy_glTexParameterf(GLenum target, GLenum pname, GLfloat param);
void GLAPIENTRY dummy_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
void GLAPIENTRY dummy_glMatrixMode(GLenum mode);
void GLAPIENTRY dummy_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
void GLAPIENTRY dummy_glPopMatrix(void);
void GLAPIENTRY dummy_glPushMatrix(void);
void GLAPIENTRY dummy_glShadeModel(GLenum mode);
void GLAPIENTRY dummy_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void GLAPIENTRY dummy_glTexEnvi(GLenum target, GLenum pname, GLint param);
void GLAPIENTRY dummy_glTexEnviv(GLenum target, GLenum pname, const GLint *params);
void GLAPIENTRY dummy_glTranslatef(GLfloat x, GLfloat y, GLfloat z);
void GLAPIENTRY dummy_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
/* OpenGL functions which are needed ONLY for implementing GLES 1.1 EXTENSIONS*/
GLboolean GLAPIENTRY dummy_glIsRenderbufferEXT(GLuint renderbuffer);
void GLAPIENTRY dummy_glBindRenderbufferEXT(GLenum target, GLuint renderbuffer);
void GLAPIENTRY dummy_glDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers);
void GLAPIENTRY dummy_glGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers);
void GLAPIENTRY dummy_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
void GLAPIENTRY dummy_glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params);
GLboolean GLAPIENTRY dummy_glIsFramebufferEXT(GLuint framebuffer);
void GLAPIENTRY dummy_glBindFramebufferEXT(GLenum target, GLuint framebuffer);
void GLAPIENTRY dummy_glDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers);
void GLAPIENTRY dummy_glGenFramebuffersEXT(GLsizei n, GLuint *framebuffers);
GLenum GLAPIENTRY dummy_glCheckFramebufferStatusEXT(GLenum target);
void GLAPIENTRY dummy_glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
void GLAPIENTRY dummy_glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
void GLAPIENTRY dummy_glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
void GLAPIENTRY dummy_glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
void GLAPIENTRY dummy_glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params);
void GLAPIENTRY dummy_glGenerateMipmapEXT(GLenum target);
void GLAPIENTRY dummy_glCurrentPaletteMatrixARB(GLint index);
void GLAPIENTRY dummy_glMatrixIndexuivARB(GLint size, GLuint * indices);
void GLAPIENTRY dummy_glMatrixIndexPointerARB(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
void GLAPIENTRY dummy_glWeightPointerARB(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
void GLAPIENTRY dummy_glTexGenf(GLenum coord, GLenum pname, GLfloat param );
void GLAPIENTRY dummy_glTexGeni(GLenum coord, GLenum pname, GLint param );
void GLAPIENTRY dummy_glTexGenf(GLenum coord, GLenum pname, const GLfloat *params );
void GLAPIENTRY dummy_glTexGeniv(GLenum coord, GLenum pname, const GLint *params );
void GLAPIENTRY dummy_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params );
void GLAPIENTRY dummy_glGetTexGeniv(GLenum coord, GLenum pname, GLint *params );
/* Loading OpenGL functions which are needed ONLY for implementing GLES 2.0*/
void GL_APIENTRY dummy_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void GL_APIENTRY dummy_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
void GL_APIENTRY dummy_glStencilMaskSeparate(GLenum face, GLuint mask);
void GL_APIENTRY dummy_glGenerateMipmap(GLenum target);
void GL_APIENTRY dummy_glBindFramebuffer(GLenum target, GLuint framebuffer);
void GL_APIENTRY dummy_glBindRenderbuffer(GLenum target, GLuint renderbuffer);
void GL_APIENTRY dummy_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
void GL_APIENTRY dummy_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
GLboolean GL_APIENTRY dummy_glIsProgram(GLuint program);
GLboolean GL_APIENTRY dummy_glIsShader(GLuint shader);
void GL_APIENTRY dummy_glVertexAttrib1f(GLuint indx, GLfloat x);
void GL_APIENTRY dummy_glVertexAttrib1fv(GLuint indx, const GLfloat* values);
void GL_APIENTRY dummy_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
void GL_APIENTRY dummy_glVertexAttrib2fv(GLuint indx, const GLfloat* values);
void GL_APIENTRY dummy_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
void GL_APIENTRY dummy_glVertexAttrib3fv(GLuint indx, const GLfloat* values);
void GL_APIENTRY dummy_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void GL_APIENTRY dummy_glVertexAttrib4fv(GLuint indx, const GLfloat* values);
void GL_APIENTRY dummy_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
void GL_APIENTRY dummy_glDisableVertexAttribArray(GLuint index);
void GL_APIENTRY dummy_glEnableVertexAttribArray(GLuint index);
void GL_APIENTRY dummy_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
void GL_APIENTRY dummy_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
void GL_APIENTRY dummy_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
void GL_APIENTRY dummy_glUniform1f(GLint location, GLfloat x);
void GL_APIENTRY dummy_glUniform1fv(GLint location, GLsizei count, const GLfloat* v);
void GL_APIENTRY dummy_glUniform1i(GLint location, GLint x);
void GL_APIENTRY dummy_glUniform1iv(GLint location, GLsizei count, const GLint* v);
void GL_APIENTRY dummy_glUniform2f(GLint location, GLfloat x, GLfloat y);
void GL_APIENTRY dummy_glUniform2fv(GLint location, GLsizei count, const GLfloat* v);
void GL_APIENTRY dummy_glUniform2i(GLint location, GLint x, GLint y);
void GL_APIENTRY dummy_glUniform2iv(GLint location, GLsizei count, const GLint* v);
void GL_APIENTRY dummy_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
void GL_APIENTRY dummy_glUniform3fv(GLint location, GLsizei count, const GLfloat* v);
void GL_APIENTRY dummy_glUniform3i(GLint location, GLint x, GLint y, GLint z);
void GL_APIENTRY dummy_glUniform3iv(GLint location, GLsizei count, const GLint* v);
void GL_APIENTRY dummy_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void GL_APIENTRY dummy_glUniform4fv(GLint location, GLsizei count, const GLfloat* v);
void GL_APIENTRY dummy_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
void GL_APIENTRY dummy_glUniform4iv(GLint location, GLsizei count, const GLint* v);
void GL_APIENTRY dummy_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void GL_APIENTRY dummy_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void GL_APIENTRY dummy_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
void GL_APIENTRY dummy_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
void GL_APIENTRY dummy_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
GLboolean GL_APIENTRY dummy_glIsFramebuffer(GLuint framebuffer);
GLboolean GL_APIENTRY dummy_glIsRenderbuffer(GLuint renderbuffer);
GLenum GL_APIENTRY dummy_glCheckFramebufferStatus(GLenum target);
void GL_APIENTRY dummy_glAttachShader(GLuint program, GLuint shader);
void GL_APIENTRY dummy_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name);
void GL_APIENTRY dummy_glCompileShader(GLuint shader);
GLuint GL_APIENTRY dummy_glCreateProgram(void);
GLuint GL_APIENTRY dummy_glCreateShader(GLenum type);
void GL_APIENTRY dummy_glDeleteProgram(GLuint program);
void GL_APIENTRY dummy_glDeleteShader(GLuint shader);
void GL_APIENTRY dummy_glDetachShader(GLuint program, GLuint shader);
void GL_APIENTRY dummy_glLinkProgram(GLuint program);
void GL_APIENTRY dummy_glUseProgram(GLuint program);
void GL_APIENTRY dummy_glValidateProgram(GLuint program);
void GL_APIENTRY dummy_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
void GL_APIENTRY dummy_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
void GL_APIENTRY dummy_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
int GL_APIENTRY dummy_glGetAttribLocation(GLuint program, const GLchar* name);
void GL_APIENTRY dummy_glGetProgramiv(GLuint program, GLenum pname, GLint* params);
void GL_APIENTRY dummy_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
void GL_APIENTRY dummy_glGetShaderiv(GLuint shader, GLenum pname, GLint* params);
void GL_APIENTRY dummy_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
void GL_APIENTRY dummy_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
void GL_APIENTRY dummy_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
void GL_APIENTRY dummy_glGetUniformfv(GLuint program, GLint location, GLfloat* params);
void GL_APIENTRY dummy_glGetUniformiv(GLuint program, GLint location, GLint* params);
int GL_APIENTRY dummy_glGetUniformLocation(GLuint program, const GLchar* name);
void GL_APIENTRY dummy_glReleaseShaderCompiler(void);
void GL_APIENTRY dummy_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
void GL_APIENTRY dummy_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
void GL_APIENTRY dummy_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
void GL_APIENTRY dummy_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
void GL_APIENTRY dummy_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
#endif

View File

@@ -1,212 +0,0 @@
/*
* 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 <GLES/gl.h>
#include <GLES/glext.h>
#include <GLcommon/FramebufferData.h>
#include <GLcommon/GLEScontext.h>
RenderbufferData::RenderbufferData() : sourceEGLImage(0),
eglImageDetach(NULL),
attachedFB(0),
attachedPoint(0),
eglImageGlobalTexName(0) {
}
RenderbufferData::~RenderbufferData() {
if (sourceEGLImage && eglImageDetach) (*eglImageDetach)(sourceEGLImage);
}
FramebufferData::FramebufferData(GLuint name):m_dirty(false) {
m_fbName = name;
for (int i=0; i<MAX_ATTACH_POINTS; i++) {
m_attachPoints[i].target = 0;
m_attachPoints[i].name = 0;
m_attachPoints[i].obj = ObjectDataPtr(NULL);
m_attachPoints[i].owned = false;
}
}
FramebufferData::~FramebufferData() {
for (int i=0; i<MAX_ATTACH_POINTS; i++) {
detachObject(i);
}
}
void FramebufferData::setAttachment(GLenum attachment,
GLenum target,
GLuint name,
ObjectDataPtr obj,
bool takeOwnership) {
int idx = attachmentPointIndex(attachment);
if (m_attachPoints[idx].target != target ||
m_attachPoints[idx].name != name ||
m_attachPoints[idx].obj.Ptr() != obj.Ptr() ||
m_attachPoints[idx].owned != takeOwnership) {
detachObject(idx);
m_attachPoints[idx].target = target;
m_attachPoints[idx].name = name;
m_attachPoints[idx].obj = obj;
m_attachPoints[idx].owned = takeOwnership;
if (target == GL_RENDERBUFFER_OES && obj.Ptr() != NULL) {
RenderbufferData *rbData = (RenderbufferData *)obj.Ptr();
rbData->attachedFB = m_fbName;
rbData->attachedPoint = attachment;
}
m_dirty = true;
}
}
GLuint FramebufferData::getAttachment(GLenum attachment,
GLenum *outTarget,
ObjectDataPtr *outObj) {
int idx = attachmentPointIndex(attachment);
if (outTarget) *outTarget = m_attachPoints[idx].target;
if (outObj) *outObj = m_attachPoints[idx].obj;
return m_attachPoints[idx].name;
}
int FramebufferData::attachmentPointIndex(GLenum attachment)
{
switch(attachment) {
case GL_COLOR_ATTACHMENT0_OES:
return 0;
case GL_DEPTH_ATTACHMENT_OES:
return 1;
case GL_STENCIL_ATTACHMENT_OES:
return 2;
default:
return MAX_ATTACH_POINTS;
}
}
void FramebufferData::detachObject(int idx) {
if (m_attachPoints[idx].target == GL_RENDERBUFFER_OES && m_attachPoints[idx].obj.Ptr() != NULL) {
RenderbufferData *rbData = (RenderbufferData *)m_attachPoints[idx].obj.Ptr();
rbData->attachedFB = 0;
rbData->attachedPoint = 0;
}
if(m_attachPoints[idx].owned)
{
switch(m_attachPoints[idx].target)
{
case GL_RENDERBUFFER_OES:
GLEScontext::dispatcher().glDeleteRenderbuffersEXT(1, &(m_attachPoints[idx].name));
break;
case GL_TEXTURE_2D:
GLEScontext::dispatcher().glDeleteTextures(1, &(m_attachPoints[idx].name));
break;
}
}
m_attachPoints[idx].target = 0;
m_attachPoints[idx].name = 0;
m_attachPoints[idx].obj = ObjectDataPtr(NULL);
m_attachPoints[idx].owned = false;
}
void FramebufferData::validate(GLEScontext* ctx)
{
if(!getAttachment(GL_COLOR_ATTACHMENT0_OES, NULL, NULL))
{
// GLES does not require the framebuffer to have a color attachment.
// OpenGL does. Therefore, if no color is attached, create a dummy
// color texture and attach it.
// This dummy color texture will is owned by the FramebufferObject,
// and will be released by it when its object is detached.
GLint type = GL_NONE;
GLint name = 0;
ctx->dispatcher().glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT_OES, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type);
if(type != GL_NONE)
{
ctx->dispatcher().glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT_OES, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &name);
}
else
{
ctx->dispatcher().glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT_OES, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type);
if(type != GL_NONE)
{
ctx->dispatcher().glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT_OES, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &name);
}
else
{
// No color, depth or stencil attachments - do nothing
return;
}
}
// Find the existing attachment(s) dimensions
GLint width = 0;
GLint height = 0;
if(type == GL_RENDERBUFFER)
{
GLint prev;
ctx->dispatcher().glGetIntegerv(GL_RENDERBUFFER_BINDING, &prev);
ctx->dispatcher().glBindRenderbufferEXT(GL_RENDERBUFFER, name);
ctx->dispatcher().glGetRenderbufferParameterivEXT(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width);
ctx->dispatcher().glGetRenderbufferParameterivEXT(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &height);
ctx->dispatcher().glBindRenderbufferEXT(GL_RENDERBUFFER, prev);
}
else if(type == GL_TEXTURE)
{
GLint prev;
ctx->dispatcher().glGetIntegerv(GL_TEXTURE_BINDING_2D, &prev);
ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, name);
ctx->dispatcher().glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
ctx->dispatcher().glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height);
ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, prev);
}
// Create the color attachment and attch it
unsigned int tex = ctx->shareGroup()->genGlobalName(TEXTURE);
GLint prev;
ctx->dispatcher().glGetIntegerv(GL_TEXTURE_BINDING_2D, &prev);
ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, tex);
ctx->dispatcher().glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
ctx->dispatcher().glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
ctx->dispatcher().glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
ctx->dispatcher().glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
ctx->dispatcher().glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
ctx->dispatcher().glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, tex, 0);
setAttachment(GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, tex, ObjectDataPtr(NULL), true);
ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, prev);
}
if(m_dirty)
{
// This is a workaround for a bug found in several OpenGL
// drivers (e.g. ATI's) - after the framebuffer attachments
// have changed, and before the next draw, unbind and rebind
// the framebuffer to sort things out.
ctx->dispatcher().glBindFramebufferEXT(GL_FRAMEBUFFER,0);
ctx->dispatcher().glBindFramebufferEXT(GL_FRAMEBUFFER,ctx->shareGroup()->getGlobalName(FRAMEBUFFER,m_fbName));
m_dirty = false;
}
}

View File

@@ -1,537 +0,0 @@
/*
* 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 <GLcommon/GLDispatch.h>
#include <stdio.h>
#include <OpenglOsUtils/osDynLibrary.h>
#ifdef __linux__
#include <GL/glx.h>
#elif defined(WIN32)
#include <windows.h>
#endif
#include "DummyGLfuncs.h"
typedef void (*GL_FUNC_PTR)();
static GL_FUNC_PTR getGLFuncAddress(const char *funcName) {
GL_FUNC_PTR ret = NULL;
#ifdef __linux__
static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("libGL.so");
ret = (GL_FUNC_PTR)glXGetProcAddress((const GLubyte*)funcName);
#elif defined(WIN32)
static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("opengl32");
ret = (GL_FUNC_PTR)wglGetProcAddress(funcName);
#elif defined(__APPLE__)
static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("/System/Library/Frameworks/OpenGL.framework/OpenGL");
#endif
if(!ret && libGL){
ret = libGL->findSymbol(funcName);
}
return ret;
}
#define LOAD_GL_FUNC(name) { void * funcAddrs = NULL; \
if(name == NULL){ \
funcAddrs = (void *)getGLFuncAddress(#name); \
if(funcAddrs){ \
*(void**)(&name) = funcAddrs; \
} else { \
fprintf(stderr,"could not load func %s\n",#name); \
*(void**)(&name) = (void *)dummy_##name; \
} \
} \
}
#define LOAD_GLEXT_FUNC(name) { void * funcAddrs = NULL; \
if(name == NULL){ \
funcAddrs = (void *)getGLFuncAddress(#name); \
if(funcAddrs) \
*(void**)(&name) = funcAddrs; \
} \
}
/* initializing static GLDispatch members*/
android::Mutex GLDispatch::s_lock;
void (GLAPIENTRY *GLDispatch::glActiveTexture)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glBindBuffer)(GLenum,GLuint) = NULL;
void (GLAPIENTRY *GLDispatch::glBindTexture)(GLenum, GLuint) = NULL;
void (GLAPIENTRY *GLDispatch::glBlendFunc)(GLenum,GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glBlendEquation)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glBlendEquationSeparate)(GLenum,GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glBlendFuncSeparate)(GLenum,GLenum,GLenum,GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glBufferData)(GLenum,GLsizeiptr,const GLvoid *,GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glBufferSubData)(GLenum,GLintptr,GLsizeiptr,const GLvoid *) = NULL;
void (GLAPIENTRY *GLDispatch::glClear)(GLbitfield) = NULL;
void (GLAPIENTRY *GLDispatch::glClearColor)(GLclampf,GLclampf,GLclampf,GLclampf) = NULL;
void (GLAPIENTRY *GLDispatch::glClearStencil)(GLint) = NULL;
void (GLAPIENTRY *GLDispatch::glColorMask)(GLboolean,GLboolean,GLboolean,GLboolean) = NULL;
void (GLAPIENTRY *GLDispatch::glCompressedTexImage2D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei, const GLvoid *) = NULL;
void (GLAPIENTRY *GLDispatch::glCompressedTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid *) = NULL;
void (GLAPIENTRY *GLDispatch::glCopyTexImage2D)(GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLsizei,GLint) = NULL;
void (GLAPIENTRY *GLDispatch::glCopyTexSubImage2D)(GLenum,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei) = NULL;
void (GLAPIENTRY *GLDispatch::glCullFace)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glDeleteBuffers)(GLsizei,const GLuint *) = NULL;
void (GLAPIENTRY *GLDispatch::glDeleteTextures)(GLsizei,const GLuint *) = NULL;
void (GLAPIENTRY *GLDispatch::glDepthFunc)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glDepthMask)(GLboolean) = NULL;
void (GLAPIENTRY *GLDispatch::glDepthRange)(GLclampd,GLclampd) = NULL;
void (GLAPIENTRY *GLDispatch::glDisable)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glDrawArrays)(GLenum,GLint,GLsizei) = NULL;
void (GLAPIENTRY *GLDispatch::glDrawElements)(GLenum,GLsizei,GLenum,const GLvoid *) = NULL;
void (GLAPIENTRY *GLDispatch::glEnable)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glFinish)() = NULL;
void (GLAPIENTRY *GLDispatch::glFlush)() = NULL;
void (GLAPIENTRY *GLDispatch::glFrontFace)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glGenBuffers)(GLsizei,GLuint *) = NULL;
void (GLAPIENTRY *GLDispatch::glGenTextures)(GLsizei,GLuint *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetBooleanv)(GLenum,GLboolean *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetBufferParameteriv)(GLenum, GLenum, GLint *) = NULL;
GLenum (GLAPIENTRY *GLDispatch::glGetError)() = NULL;
void (GLAPIENTRY *GLDispatch::glGetFloatv)(GLenum,GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetIntegerv)(GLenum,GLint *) = NULL;
const GLubyte * (GLAPIENTRY *GLDispatch::glGetString) (GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glGetTexParameterfv)(GLenum,GLenum,GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetTexParameteriv)(GLenum,GLenum,GLint *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetTexLevelParameteriv) (GLenum target, GLint level, GLenum pname, GLint *params) = NULL;
void (GLAPIENTRY *GLDispatch::glHint)(GLenum,GLenum) = NULL;
GLboolean (GLAPIENTRY *GLDispatch::glIsBuffer)(GLuint) = NULL;
GLboolean (GLAPIENTRY *GLDispatch::glIsEnabled)(GLenum) = NULL;
GLboolean (GLAPIENTRY *GLDispatch::glIsTexture)(GLuint) = NULL;
void (GLAPIENTRY *GLDispatch::glLineWidth)(GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glPolygonOffset)(GLfloat, GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glPixelStorei)(GLenum,GLint) = NULL;
void (GLAPIENTRY *GLDispatch::glReadPixels)(GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,GLvoid *) = NULL;
void (GLAPIENTRY *GLDispatch::glSampleCoverage)(GLclampf,GLboolean) = NULL;
void (GLAPIENTRY *GLDispatch::glScissor)(GLint,GLint,GLsizei,GLsizei) = NULL;
void (GLAPIENTRY *GLDispatch::glStencilFunc)(GLenum,GLint,GLuint) = NULL;
void (GLAPIENTRY *GLDispatch::glStencilMask)(GLuint) = NULL;
void (GLAPIENTRY *GLDispatch::glStencilOp)(GLenum, GLenum,GLenum);
void (GLAPIENTRY *GLDispatch::glTexImage2D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid *) = NULL;
void (GLAPIENTRY *GLDispatch::glTexParameterf)(GLenum,GLenum, GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glTexParameterfv)(GLenum,GLenum,const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glTexParameteri)(GLenum,GLenum,GLint) = NULL;
void (GLAPIENTRY *GLDispatch::glTexParameteriv)(GLenum,GLenum,const GLint *) = NULL;
void (GLAPIENTRY *GLDispatch::glTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid *) = NULL;
void (GLAPIENTRY *GLDispatch::glViewport)(GLint,GLint,GLsizei,GLsizei) = NULL;
void (GLAPIENTRY *GLDispatch::glPushAttrib) ( GLbitfield mask ) = NULL;
void (GLAPIENTRY *GLDispatch::glPopAttrib) ( void ) = NULL;
void (GLAPIENTRY *GLDispatch::glPushClientAttrib) ( GLbitfield mask ) = NULL;
void (GLAPIENTRY *GLDispatch::glPopClientAttrib) ( void ) = NULL;
/*GLES 1.1*/
void (GLAPIENTRY *GLDispatch::glAlphaFunc)(GLenum,GLclampf) = NULL;
void (GLAPIENTRY *GLDispatch::glBegin)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glClearDepth)(GLclampd) = NULL;
void (GLAPIENTRY *GLDispatch::glClientActiveTexture)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glClipPlane)(GLenum,const GLdouble *) = NULL;
void (GLAPIENTRY *GLDispatch::glColor4d)(GLdouble,GLdouble,GLdouble,GLdouble) = NULL;
void (GLAPIENTRY *GLDispatch::glColor4f)(GLfloat,GLfloat,GLfloat,GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glColor4fv)(const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glColor4ub)(GLubyte,GLubyte,GLubyte,GLubyte) = NULL;
void (GLAPIENTRY *GLDispatch::glColor4ubv)(const GLubyte *) = NULL;
void (GLAPIENTRY *GLDispatch::glColorPointer)(GLint,GLenum,GLsizei,const GLvoid *) = NULL;
void (GLAPIENTRY *GLDispatch::glDisableClientState)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glEnableClientState)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glEnd)() = NULL;
void (GLAPIENTRY *GLDispatch::glFogf)(GLenum, GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glFogfv)(GLenum,const GLfloat *);
void (GLAPIENTRY *GLDispatch::glFrustum)(GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble) = NULL;
void (GLAPIENTRY *GLDispatch::glGetClipPlane)(GLenum,GLdouble *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetDoublev)(GLenum,GLdouble *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetLightfv)(GLenum,GLenum,GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetMaterialfv)(GLenum,GLenum,GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetPointerv)(GLenum,GLvoid**) = NULL;
void (GLAPIENTRY *GLDispatch::glGetTexEnvfv)(GLenum,GLenum,GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glGetTexEnviv)(GLenum,GLenum,GLint *)= NULL;
void (GLAPIENTRY *GLDispatch::glLightf)(GLenum,GLenum,GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glLightfv)(GLenum,GLenum,const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glLightModelf)(GLenum,GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glLightModelfv)(GLenum,const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glLoadIdentity)() = NULL;
void (GLAPIENTRY *GLDispatch::glLoadMatrixf)(const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glLogicOp)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glMaterialf)(GLenum,GLenum,GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glMaterialfv)(GLenum,GLenum,const GLfloat *);
void (GLAPIENTRY *GLDispatch::glMultiTexCoord2fv)(GLenum, const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glMultiTexCoord2sv)(GLenum, const GLshort *) = NULL;
void (GLAPIENTRY *GLDispatch::glMultiTexCoord3fv)(GLenum, const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glMultiTexCoord3sv)(GLenum,const GLshort *) = NULL;
void (GLAPIENTRY *GLDispatch::glMultiTexCoord4f)(GLenum,GLfloat,GLfloat,GLfloat,GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glMultiTexCoord4fv)(GLenum,const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glMultiTexCoord4sv)(GLenum,const GLshort *) = NULL;
void (GLAPIENTRY *GLDispatch::glMultMatrixf)(const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glNormal3f)(GLfloat,GLfloat,GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glNormal3fv)(const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glNormal3sv)(const GLshort *) = NULL;
void (GLAPIENTRY *GLDispatch::glOrtho)(GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble) = NULL;
void (GLAPIENTRY *GLDispatch::glPointParameterf)(GLenum, GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glPointParameterfv)(GLenum, const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glPointSize)(GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glRotatef)(GLfloat,GLfloat,GLfloat,GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glScalef)(GLfloat,GLfloat,GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glTexEnvf)(GLenum,GLenum,GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glTexEnvfv)(GLenum,GLenum,const GLfloat *) = NULL;
void (GLAPIENTRY *GLDispatch::glMatrixMode)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glNormalPointer)(GLenum,GLsizei,const GLvoid *) = NULL;
void (GLAPIENTRY *GLDispatch::glPopMatrix)() = NULL;
void (GLAPIENTRY *GLDispatch::glPushMatrix)() = NULL;
void (GLAPIENTRY *GLDispatch::glShadeModel)(GLenum) = NULL;
void (GLAPIENTRY *GLDispatch::glTexCoordPointer)(GLint,GLenum, GLsizei, const GLvoid*) = NULL;
void (GLAPIENTRY *GLDispatch::glTexEnvi)(GLenum ,GLenum,GLint) = NULL;
void (GLAPIENTRY *GLDispatch::glTexEnviv)(GLenum, GLenum, const GLint *) = NULL;
void (GLAPIENTRY *GLDispatch::glTranslatef)(GLfloat,GLfloat, GLfloat) = NULL;
void (GLAPIENTRY *GLDispatch::glVertexPointer)(GLint,GLenum,GLsizei, const GLvoid *) = NULL;
/* GLES 1.1 EXTENSIONS*/
GLboolean (GLAPIENTRY *GLDispatch::glIsRenderbufferEXT) (GLuint renderbuffer) = NULL;
void (GLAPIENTRY *GLDispatch::glBindRenderbufferEXT) (GLenum target, GLuint renderbuffer) = NULL;
void (GLAPIENTRY *GLDispatch::glDeleteRenderbuffersEXT) (GLsizei n, const GLuint *renderbuffers) = NULL;
void (GLAPIENTRY *GLDispatch::glGenRenderbuffersEXT) (GLsizei n, GLuint *renderbuffers) = NULL;
void (GLAPIENTRY *GLDispatch::glRenderbufferStorageEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) = NULL;
void (GLAPIENTRY *GLDispatch::glGetRenderbufferParameterivEXT) (GLenum target, GLenum pname, GLint *params) = NULL;
GLboolean (GLAPIENTRY *GLDispatch::glIsFramebufferEXT) (GLuint framebuffer) = NULL;
void (GLAPIENTRY *GLDispatch::glBindFramebufferEXT) (GLenum target, GLuint framebuffer) = NULL;
void (GLAPIENTRY *GLDispatch::glDeleteFramebuffersEXT) (GLsizei n, const GLuint *framebuffers) = NULL;
void (GLAPIENTRY *GLDispatch::glGenFramebuffersEXT) (GLsizei n, GLuint *framebuffers) = NULL;
GLenum (GLAPIENTRY *GLDispatch::glCheckFramebufferStatusEXT) (GLenum target) = NULL;
void (GLAPIENTRY *GLDispatch::glFramebufferTexture1DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) = NULL;
void (GLAPIENTRY *GLDispatch::glFramebufferTexture2DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) = NULL;
void (GLAPIENTRY *GLDispatch::glFramebufferTexture3DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) = NULL;
void (GLAPIENTRY *GLDispatch::glFramebufferRenderbufferEXT) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) = NULL;
void (GLAPIENTRY *GLDispatch::glGetFramebufferAttachmentParameterivEXT) (GLenum target, GLenum attachment, GLenum pname, GLint *params) = NULL;
void (GLAPIENTRY *GLDispatch::glGenerateMipmapEXT) (GLenum target) = NULL;
void (GLAPIENTRY *GLDispatch::glCurrentPaletteMatrixARB) (GLint index) = NULL;
void (GLAPIENTRY *GLDispatch::glMatrixIndexuivARB) (GLint size, GLuint * indices) = NULL;
void (GLAPIENTRY *GLDispatch::glMatrixIndexPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) = NULL;
void (GLAPIENTRY *GLDispatch::glWeightPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) = NULL;
void (GLAPIENTRY *GLDispatch::glTexGenf) (GLenum coord, GLenum pname, GLfloat param ) = NULL;
void (GLAPIENTRY *GLDispatch::glTexGeni) (GLenum coord, GLenum pname, GLint param ) = NULL;
void (GLAPIENTRY *GLDispatch::glTexGenfv) (GLenum coord, GLenum pname, const GLfloat *params ) = NULL;
void (GLAPIENTRY *GLDispatch::glTexGeniv) (GLenum coord, GLenum pname, const GLint *params ) = NULL;
void (GLAPIENTRY *GLDispatch::glGetTexGenfv) (GLenum coord, GLenum pname, GLfloat *params ) = NULL;
void (GLAPIENTRY *GLDispatch::glGetTexGeniv) (GLenum coord, GLenum pname, GLint *params ) = NULL;
/* GLES 2.0*/
void (GL_APIENTRY *GLDispatch::glBlendColor)(GLclampf,GLclampf,GLclampf,GLclampf) = NULL;
void (GL_APIENTRY *GLDispatch::glStencilFuncSeparate)(GLenum,GLenum,GLint,GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glStencilMaskSeparate)(GLenum,GLuint) = NULL;
GLboolean (GL_APIENTRY *GLDispatch::glIsProgram)(GLuint program) = NULL;
GLboolean (GL_APIENTRY *GLDispatch::glIsShader)(GLuint shader) = NULL;
void (GL_APIENTRY *GLDispatch::glVertexAttrib1f)(GLuint,GLfloat) = NULL;
void (GL_APIENTRY *GLDispatch::glVertexAttrib1fv)(GLuint,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glVertexAttrib2f)(GLuint,GLfloat, GLfloat) = NULL;
void (GL_APIENTRY *GLDispatch::glVertexAttrib2fv)(GLuint,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glVertexAttrib3f)(GLuint,GLfloat, GLfloat,GLfloat) = NULL;
void (GL_APIENTRY *GLDispatch::glVertexAttrib3fv)(GLuint,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glVertexAttrib4f)(GLuint,GLfloat,GLfloat,GLfloat,GLfloat ) = NULL;
void (GL_APIENTRY *GLDispatch::glVertexAttrib4fv)(GLuint,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glVertexAttribPointer)(GLuint,GLint,GLenum,GLboolean,GLsizei,const GLvoid*) = NULL;
void (GL_APIENTRY *GLDispatch::glDisableVertexAttribArray)(GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glEnableVertexAttribArray)(GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glGetVertexAttribfv)(GLuint,GLenum,GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetVertexAttribiv)(GLuint,GLenum,GLint*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetVertexAttribPointerv)(GLuint,GLenum,GLvoid**) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform1f)(GLint,GLfloat) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform1fv)(GLint,GLsizei,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform1i)(GLint,GLint) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform1iv)(GLint,GLsizei,const GLint*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform2f)(GLint,GLfloat,GLfloat) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform2fv)(GLint,GLsizei,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform2i)(GLint,GLint,GLint) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform2iv)(GLint ,GLsizei,const GLint*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform3f)(GLint,GLfloat,GLfloat,GLfloat) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform3fv)(GLint,GLsizei,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform3i)(GLint,GLint,GLint,GLint) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform3iv)(GLint,GLsizei,const GLint*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform4f)(GLint,GLfloat,GLfloat,GLfloat,GLfloat) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform4fv)(GLint,GLsizei,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform4i)(GLint,GLint,GLint,GLint,GLint) = NULL;
void (GL_APIENTRY *GLDispatch::glUniform4iv)(GLint,GLsizei,const GLint*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniformMatrix2fv)(GLint,GLsizei,GLboolean,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniformMatrix3fv)(GLint,GLsizei,GLboolean,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glUniformMatrix4fv)(GLint,GLsizei,GLboolean,const GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glAttachShader)(GLuint,GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glBindAttribLocation)(GLuint,GLuint,const GLchar*) = NULL;
void (GL_APIENTRY *GLDispatch::glCompileShader)(GLuint) = NULL;
GLuint (GL_APIENTRY *GLDispatch::glCreateProgram)() = NULL;
GLuint (GL_APIENTRY *GLDispatch::glCreateShader)(GLenum) = NULL;
void (GL_APIENTRY *GLDispatch::glDeleteProgram)(GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glDeleteShader)(GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glDetachShader)(GLuint,GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glLinkProgram)(GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glUseProgram)(GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glValidateProgram)(GLuint) = NULL;
void (GL_APIENTRY *GLDispatch::glGetActiveAttrib)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetActiveUniform)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetAttachedShaders)(GLuint,GLsizei,GLsizei*,GLuint*) = NULL;
int (GL_APIENTRY *GLDispatch::glGetAttribLocation)(GLuint,const GLchar*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetProgramiv)(GLuint,GLenum,GLint*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetProgramInfoLog)(GLuint,GLsizei,GLsizei*,GLchar*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetShaderiv)(GLuint,GLenum,GLint*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetShaderInfoLog)(GLuint,GLsizei,GLsizei*,GLchar*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetShaderPrecisionFormat)(GLenum,GLenum,GLint*,GLint*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetShaderSource)(GLuint,GLsizei,GLsizei*,GLchar*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetUniformfv)(GLuint,GLint,GLfloat*) = NULL;
void (GL_APIENTRY *GLDispatch::glGetUniformiv)(GLuint,GLint,GLint*) = NULL;
int (GL_APIENTRY *GLDispatch::glGetUniformLocation)(GLuint,const GLchar*) = NULL;
void (GL_APIENTRY *GLDispatch::glReleaseShaderCompiler)() = NULL;
void (GL_APIENTRY *GLDispatch::glShaderBinary)(GLsizei,const GLuint*,GLenum,const GLvoid*,GLsizei) = NULL;
void (GL_APIENTRY *GLDispatch::glShaderSource)(GLuint,GLsizei,const GLchar**,const GLint*) = NULL;
GLDispatch::GLDispatch():m_isLoaded(false){};
void GLDispatch::dispatchFuncs(GLESVersion version){
android::Mutex::Autolock mutex(s_lock);
if(m_isLoaded)
return;
/* Loading OpenGL functions which are needed for implementing BOTH GLES 1.1 & GLES 2.0*/
LOAD_GL_FUNC(glActiveTexture);
LOAD_GL_FUNC(glBindBuffer);
LOAD_GL_FUNC(glBindTexture);
LOAD_GL_FUNC(glBlendFunc);
LOAD_GL_FUNC(glBlendEquation);
LOAD_GL_FUNC(glBlendEquationSeparate);
LOAD_GL_FUNC(glBlendFuncSeparate);
LOAD_GL_FUNC(glBufferData);
LOAD_GL_FUNC(glBufferSubData);
LOAD_GL_FUNC(glClear);
LOAD_GL_FUNC(glClearColor);
LOAD_GL_FUNC(glClearDepth);
LOAD_GL_FUNC(glClearStencil);
LOAD_GL_FUNC(glColorMask);
LOAD_GL_FUNC(glCompressedTexImage2D);
LOAD_GL_FUNC(glCompressedTexSubImage2D);
LOAD_GL_FUNC(glCopyTexImage2D);
LOAD_GL_FUNC(glCopyTexSubImage2D);
LOAD_GL_FUNC(glCullFace);
LOAD_GL_FUNC(glDeleteBuffers);
LOAD_GL_FUNC(glDeleteTextures);
LOAD_GL_FUNC(glDepthFunc);
LOAD_GL_FUNC(glDepthMask);
LOAD_GL_FUNC(glDepthRange);
LOAD_GL_FUNC(glDisable);
LOAD_GL_FUNC(glDrawArrays);
LOAD_GL_FUNC(glDrawElements);
LOAD_GL_FUNC(glEnable);
LOAD_GL_FUNC(glFinish);
LOAD_GL_FUNC(glFlush);
LOAD_GL_FUNC(glFrontFace);
LOAD_GL_FUNC(glGenBuffers);
LOAD_GL_FUNC(glGenTextures);
LOAD_GL_FUNC(glGetBooleanv);
LOAD_GL_FUNC(glGetBufferParameteriv);
LOAD_GL_FUNC(glGetError);
LOAD_GL_FUNC(glGetFloatv);
LOAD_GL_FUNC(glGetIntegerv);
LOAD_GL_FUNC(glGetString);
LOAD_GL_FUNC(glTexParameterf);
LOAD_GL_FUNC(glTexParameterfv);
LOAD_GL_FUNC(glGetTexParameterfv);
LOAD_GL_FUNC(glGetTexParameteriv);
LOAD_GL_FUNC(glGetTexLevelParameteriv);
LOAD_GL_FUNC(glHint);
LOAD_GL_FUNC(glIsBuffer);
LOAD_GL_FUNC(glIsEnabled);
LOAD_GL_FUNC(glIsTexture);
LOAD_GL_FUNC(glLineWidth);
LOAD_GL_FUNC(glPolygonOffset);
LOAD_GL_FUNC(glPixelStorei);
LOAD_GL_FUNC(glReadPixels);
LOAD_GL_FUNC(glSampleCoverage);
LOAD_GL_FUNC(glScissor);
LOAD_GL_FUNC(glStencilFunc);
LOAD_GL_FUNC(glStencilMask);
LOAD_GL_FUNC(glStencilOp);
LOAD_GL_FUNC(glTexImage2D);
LOAD_GL_FUNC(glTexParameteri);
LOAD_GL_FUNC(glTexParameteriv);
LOAD_GL_FUNC(glTexSubImage2D);
LOAD_GL_FUNC(glViewport);
LOAD_GL_FUNC(glPushAttrib);
LOAD_GL_FUNC(glPushClientAttrib);
LOAD_GL_FUNC(glPopAttrib);
LOAD_GL_FUNC(glPopClientAttrib);
LOAD_GLEXT_FUNC(glIsRenderbufferEXT);
LOAD_GLEXT_FUNC(glBindRenderbufferEXT);
LOAD_GLEXT_FUNC(glDeleteRenderbuffersEXT);
LOAD_GLEXT_FUNC(glGenRenderbuffersEXT);
LOAD_GLEXT_FUNC(glRenderbufferStorageEXT);
LOAD_GLEXT_FUNC(glGetRenderbufferParameterivEXT);
LOAD_GLEXT_FUNC(glIsFramebufferEXT);
LOAD_GLEXT_FUNC(glBindFramebufferEXT);
LOAD_GLEXT_FUNC(glDeleteFramebuffersEXT);
LOAD_GLEXT_FUNC(glGenFramebuffersEXT);
LOAD_GLEXT_FUNC(glCheckFramebufferStatusEXT);
LOAD_GLEXT_FUNC(glFramebufferTexture1DEXT);
LOAD_GLEXT_FUNC(glFramebufferTexture2DEXT);
LOAD_GLEXT_FUNC(glFramebufferTexture3DEXT);
LOAD_GLEXT_FUNC(glFramebufferRenderbufferEXT);
LOAD_GLEXT_FUNC(glGetFramebufferAttachmentParameterivEXT);
LOAD_GLEXT_FUNC(glGenerateMipmapEXT);
/* Loading OpenGL functions which are needed ONLY for implementing GLES 1.1*/
if(version == GLES_1_1){
LOAD_GL_FUNC(glAlphaFunc);
LOAD_GL_FUNC(glBegin);
LOAD_GL_FUNC(glClientActiveTexture);
LOAD_GL_FUNC(glClipPlane);
LOAD_GL_FUNC(glColor4d);
LOAD_GL_FUNC(glColor4f);
LOAD_GL_FUNC(glColor4fv);
LOAD_GL_FUNC(glColor4ub);
LOAD_GL_FUNC(glColor4ubv);
LOAD_GL_FUNC(glColorPointer);
LOAD_GL_FUNC(glDisableClientState);
LOAD_GL_FUNC(glEnableClientState);
LOAD_GL_FUNC(glEnd);
LOAD_GL_FUNC(glFogf);
LOAD_GL_FUNC(glFogfv);
LOAD_GL_FUNC(glFrustum);
LOAD_GL_FUNC(glGetClipPlane);
LOAD_GL_FUNC(glGetDoublev);
LOAD_GL_FUNC(glGetLightfv);
LOAD_GL_FUNC(glGetMaterialfv);
LOAD_GL_FUNC(glGetPointerv);
LOAD_GL_FUNC(glGetTexEnvfv);
LOAD_GL_FUNC(glGetTexEnviv);
LOAD_GL_FUNC(glLightf);
LOAD_GL_FUNC(glLightfv);
LOAD_GL_FUNC(glLightModelf);
LOAD_GL_FUNC(glLightModelfv);
LOAD_GL_FUNC(glLoadIdentity);
LOAD_GL_FUNC(glLoadMatrixf);
LOAD_GL_FUNC(glLogicOp);
LOAD_GL_FUNC(glMaterialf);
LOAD_GL_FUNC(glMaterialfv);
LOAD_GL_FUNC(glMultiTexCoord2fv);
LOAD_GL_FUNC(glMultiTexCoord2sv);
LOAD_GL_FUNC(glMultiTexCoord3fv);
LOAD_GL_FUNC(glMultiTexCoord3sv);
LOAD_GL_FUNC(glMultiTexCoord4fv);
LOAD_GL_FUNC(glMultiTexCoord4sv);
LOAD_GL_FUNC(glMultiTexCoord4f);
LOAD_GL_FUNC(glMultMatrixf);
LOAD_GL_FUNC(glNormal3f);
LOAD_GL_FUNC(glNormal3fv);
LOAD_GL_FUNC(glNormal3sv);
LOAD_GL_FUNC(glOrtho);
LOAD_GL_FUNC(glPointParameterf);
LOAD_GL_FUNC(glPointParameterfv);
LOAD_GL_FUNC(glPointSize);
LOAD_GL_FUNC(glRotatef);
LOAD_GL_FUNC(glScalef);
LOAD_GL_FUNC(glTexEnvf);
LOAD_GL_FUNC(glTexEnvfv);
LOAD_GL_FUNC(glMatrixMode);
LOAD_GL_FUNC(glNormalPointer);
LOAD_GL_FUNC(glPopMatrix);
LOAD_GL_FUNC(glPushMatrix);
LOAD_GL_FUNC(glShadeModel);
LOAD_GL_FUNC(glTexCoordPointer);
LOAD_GL_FUNC(glTexEnvi);
LOAD_GL_FUNC(glTexEnviv);
LOAD_GL_FUNC(glTranslatef);
LOAD_GL_FUNC(glVertexPointer);
LOAD_GLEXT_FUNC(glCurrentPaletteMatrixARB);
LOAD_GLEXT_FUNC(glMatrixIndexuivARB);
LOAD_GLEXT_FUNC(glMatrixIndexPointerARB);
LOAD_GLEXT_FUNC(glWeightPointerARB);
LOAD_GLEXT_FUNC(glTexGenf);
LOAD_GLEXT_FUNC(glTexGeni);
LOAD_GLEXT_FUNC(glTexGenfv);
LOAD_GLEXT_FUNC(glTexGeniv);
LOAD_GLEXT_FUNC(glGetTexGenfv);
LOAD_GLEXT_FUNC(glGetTexGeniv);
} else if (version == GLES_2_0){
/* Loading OpenGL functions which are needed ONLY for implementing GLES 2.0*/
LOAD_GL_FUNC(glBlendColor);
LOAD_GL_FUNC(glBlendFuncSeparate);
LOAD_GL_FUNC(glStencilFuncSeparate);
LOAD_GL_FUNC(glIsProgram);
LOAD_GL_FUNC(glIsShader);
LOAD_GL_FUNC(glVertexAttrib1f);
LOAD_GL_FUNC(glVertexAttrib1fv);
LOAD_GL_FUNC(glVertexAttrib2f);
LOAD_GL_FUNC(glVertexAttrib2fv);
LOAD_GL_FUNC(glVertexAttrib3f);
LOAD_GL_FUNC(glVertexAttrib3fv);
LOAD_GL_FUNC(glVertexAttrib4f);
LOAD_GL_FUNC(glVertexAttrib4fv);
LOAD_GL_FUNC(glVertexAttribPointer);
LOAD_GL_FUNC(glDisableVertexAttribArray);
LOAD_GL_FUNC(glEnableVertexAttribArray);
LOAD_GL_FUNC(glGetVertexAttribfv);
LOAD_GL_FUNC(glGetVertexAttribiv);
LOAD_GL_FUNC(glGetVertexAttribPointerv);
LOAD_GL_FUNC(glUniform1f);
LOAD_GL_FUNC(glUniform1fv);
LOAD_GL_FUNC(glUniform1i);
LOAD_GL_FUNC(glUniform1iv);
LOAD_GL_FUNC(glUniform2f);
LOAD_GL_FUNC(glUniform2fv);
LOAD_GL_FUNC(glUniform2i);
LOAD_GL_FUNC(glUniform2iv);
LOAD_GL_FUNC(glUniform3f);
LOAD_GL_FUNC(glUniform3fv);
LOAD_GL_FUNC(glUniform3i);
LOAD_GL_FUNC(glUniform3iv);
LOAD_GL_FUNC(glUniform4f);
LOAD_GL_FUNC(glUniform4fv);
LOAD_GL_FUNC(glUniform4i);
LOAD_GL_FUNC(glUniform4iv);
LOAD_GL_FUNC(glUniformMatrix2fv);
LOAD_GL_FUNC(glUniformMatrix3fv);
LOAD_GL_FUNC(glUniformMatrix4fv);
LOAD_GL_FUNC(glAttachShader);
LOAD_GL_FUNC(glBindAttribLocation);
LOAD_GL_FUNC(glCompileShader);
LOAD_GL_FUNC(glCreateProgram);
LOAD_GL_FUNC(glCreateShader);
LOAD_GL_FUNC(glDeleteProgram);
LOAD_GL_FUNC(glDeleteShader);
LOAD_GL_FUNC(glDetachShader);
LOAD_GL_FUNC(glLinkProgram);
LOAD_GL_FUNC(glUseProgram);
LOAD_GL_FUNC(glValidateProgram);
LOAD_GL_FUNC(glGetActiveAttrib);
LOAD_GL_FUNC(glGetActiveUniform);
LOAD_GL_FUNC(glGetAttachedShaders);
LOAD_GL_FUNC(glGetAttribLocation);
LOAD_GL_FUNC(glGetProgramiv);
LOAD_GL_FUNC(glGetProgramInfoLog);
LOAD_GL_FUNC(glGetShaderiv);
LOAD_GL_FUNC(glGetShaderInfoLog);
LOAD_GLEXT_FUNC(glGetShaderPrecisionFormat);
LOAD_GL_FUNC(glGetShaderSource);
LOAD_GL_FUNC(glGetUniformfv);
LOAD_GL_FUNC(glGetUniformiv);
LOAD_GL_FUNC(glGetUniformLocation);
LOAD_GLEXT_FUNC(glReleaseShaderCompiler);
LOAD_GLEXT_FUNC(glShaderBinary);
LOAD_GL_FUNC(glShaderSource);
LOAD_GL_FUNC(glStencilMaskSeparate);
}
m_isLoaded = true;
}

View File

@@ -1,55 +0,0 @@
/*
* 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 <GLcommon/GLESbuffer.h>
#include <string.h>
bool GLESbuffer::setBuffer(GLuint size,GLuint usage,const GLvoid* data) {
m_size = size;
m_usage = usage;
if(m_data) {
delete [] m_data;
m_data = NULL;
}
m_data = new unsigned char[size];
if(m_data) {
if(data) {
memcpy(m_data,data,size);
}
m_conversionManager.clear();
m_conversionManager.addRange(Range(0,m_size));
return true;
}
return false;
}
bool GLESbuffer::setSubBuffer(GLint offset,GLuint size,const GLvoid* data) {
if(offset + size > m_size) return false;
memcpy(m_data+offset,data,size);
m_conversionManager.addRange(Range(offset,size));
m_conversionManager.merge();
return true;
}
void GLESbuffer::getConversions(const RangeList& rIn,RangeList& rOut) {
m_conversionManager.delRanges(rIn,rOut);
rOut.merge();
}
GLESbuffer::~GLESbuffer() {
if(m_data) {
delete [] m_data;
}
}

View File

@@ -1,703 +0,0 @@
#include <GLcommon/GLEScontext.h>
#include <GLcommon/GLconversion_macros.h>
#include <GLcommon/GLESmacros.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLcommon/GLESvalidate.h>
#include <GLcommon/TextureUtils.h>
#include <GLcommon/FramebufferData.h>
#include <strings.h>
#include <assert.h>
//decleration
static void convertFixedDirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,unsigned int nBytes,unsigned int strideOut,int attribSize);
static void convertFixedIndirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,GLsizei count,GLenum indices_type,const GLvoid* indices,unsigned int strideOut,int attribSize);
static void convertByteDirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,unsigned int nBytes,unsigned int strideOut,int attribSize);
static void convertByteIndirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,GLsizei count,GLenum indices_type,const GLvoid* indices,unsigned int strideOut,int attribSize);
GLESConversionArrays::~GLESConversionArrays() {
for(std::map<GLenum,ArrayData>::iterator it = m_arrays.begin(); it != m_arrays.end();it++) {
if((*it).second.allocated){
if((*it).second.type == GL_FLOAT){
GLfloat* p = (GLfloat *)((*it).second.data);
if(p) delete[] p;
} else if((*it).second.type == GL_SHORT){
GLshort* p = (GLshort *)((*it).second.data);
if(p) delete[] p;
}
}
}
}
void GLESConversionArrays::allocArr(unsigned int size,GLenum type){
if(type == GL_FIXED){
m_arrays[m_current].data = new GLfloat[size];
m_arrays[m_current].type = GL_FLOAT;
} else if(type == GL_BYTE){
m_arrays[m_current].data = new GLshort[size];
m_arrays[m_current].type = GL_SHORT;
}
m_arrays[m_current].stride = 0;
m_arrays[m_current].allocated = true;
}
void GLESConversionArrays::setArr(void* data,unsigned int stride,GLenum type){
m_arrays[m_current].type = type;
m_arrays[m_current].data = data;
m_arrays[m_current].stride = stride;
m_arrays[m_current].allocated = false;
}
void* GLESConversionArrays::getCurrentData(){
return m_arrays[m_current].data;
}
ArrayData& GLESConversionArrays::getCurrentArray(){
return m_arrays[m_current];
}
unsigned int GLESConversionArrays::getCurrentIndex(){
return m_current;
}
ArrayData& GLESConversionArrays::operator[](int i){
return m_arrays[i];
}
void GLESConversionArrays::operator++(){
m_current++;
}
GLDispatch GLEScontext::s_glDispatch;
android::Mutex GLEScontext::s_lock;
std::string* GLEScontext::s_glExtensions= NULL;
std::string GLEScontext::s_glRenderer;
GLSupport GLEScontext::s_glSupport;
Version::Version():m_major(0),
m_minor(0),
m_release(0){};
Version::Version(int major,int minor,int release):m_major(major),
m_minor(minor),
m_release(release){};
Version::Version(const Version& ver):m_major(ver.m_major),
m_minor(ver.m_minor),
m_release(ver.m_release){}
Version::Version(const char* versionString){
m_release = 0;
if((!versionString) ||
((!(sscanf(versionString,"%d.%d" ,&m_major,&m_minor) == 2)) &&
(!(sscanf(versionString,"%d.%d.%d",&m_major,&m_minor,&m_release) == 3)))){
m_major = m_minor = 0; // the version is not in the right format
}
}
Version& Version::operator=(const Version& ver){
m_major = ver.m_major;
m_minor = ver.m_minor;
m_release = ver.m_release;
return *this;
}
bool Version::operator<(const Version& ver) const{
if(m_major < ver.m_major) return true;
if(m_major == ver.m_major){
if(m_minor < ver.m_minor) return true;
if(m_minor == ver.m_minor){
return m_release < ver.m_release;
}
}
return false;
}
void GLEScontext::init() {
if (!s_glExtensions) {
initCapsLocked(s_glDispatch.glGetString(GL_EXTENSIONS));
s_glExtensions = new std::string("");
}
if (!m_initialized) {
initExtensionString();
int maxTexUnits = getMaxTexUnits();
m_texState = new textureUnitState[maxTexUnits];
for (int i=0;i<maxTexUnits;++i) {
for (int j=0;j<NUM_TEXTURE_TARGETS;++j)
{
m_texState[i][j].texture = 0;
m_texState[i][j].enabled = GL_FALSE;
}
}
}
}
GLEScontext::GLEScontext():
m_initialized(false) ,
m_activeTexture(0) ,
m_unpackAlignment(4) ,
m_glError(GL_NO_ERROR) ,
m_texState(0) ,
m_arrayBuffer(0) ,
m_elementBuffer(0),
m_renderbuffer(0),
m_framebuffer(0)
{
};
GLenum GLEScontext::getGLerror() {
return m_glError;
}
void GLEScontext::setGLerror(GLenum err) {
m_glError = err;
}
void GLEScontext::setActiveTexture(GLenum tex) {
m_activeTexture = tex - GL_TEXTURE0;
}
GLEScontext::~GLEScontext() {
for(ArraysMap::iterator it = m_map.begin(); it != m_map.end();it++) {
GLESpointer* p = (*it).second;
if(p) {
delete p;
}
}
delete[] m_texState;
m_texState = NULL;
}
const GLvoid* GLEScontext::setPointer(GLenum arrType,GLint size,GLenum type,GLsizei stride,const GLvoid* data,bool normalize) {
GLuint bufferName = m_arrayBuffer;
if(bufferName) {
uintptr_t offsetptr = (uintptr_t)data;
unsigned int offset = offsetptr;
assert(sizeof(offset) == sizeof(offsetptr) || offset == offsetptr);
GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr());
m_map[arrType]->setBuffer(size,type,stride,vbo,bufferName,offset,normalize);
return static_cast<const unsigned char*>(vbo->getData()) + offset;
}
m_map[arrType]->setArray(size,type,stride,data,normalize);
return data;
}
void GLEScontext::enableArr(GLenum arr,bool enable) {
m_map[arr]->enable(enable);
}
bool GLEScontext::isArrEnabled(GLenum arr) {
return m_map[arr]->isEnable();
}
const GLESpointer* GLEScontext::getPointer(GLenum arrType) {
if (m_map.find(arrType) != m_map.end()) return m_map[arrType];
return NULL;
}
static void convertFixedDirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,unsigned int nBytes,unsigned int strideOut,int attribSize) {
for(unsigned int i = 0; i < nBytes;i+=strideOut) {
const GLfixed* fixed_data = (const GLfixed *)dataIn;
//filling attrib
for(int j=0;j<attribSize;j++) {
reinterpret_cast<GLfloat*>(&static_cast<unsigned char*>(dataOut)[i])[j] = X2F(fixed_data[j]);
}
dataIn += strideIn;
}
}
static void convertFixedIndirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,GLsizei count,GLenum indices_type,const GLvoid* indices,unsigned int strideOut,int attribSize) {
for(int i = 0 ;i < count ;i++) {
unsigned short index = indices_type == GL_UNSIGNED_BYTE? ((GLubyte *)indices)[i]:
((GLushort *)indices)[i];
const GLfixed* fixed_data = (GLfixed *)(dataIn + index*strideIn);
GLfloat* float_data = reinterpret_cast<GLfloat*>(static_cast<unsigned char*>(dataOut) + index*strideOut);
for(int j=0;j<attribSize;j++) {
float_data[j] = X2F(fixed_data[j]);
}
}
}
static void convertByteDirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,unsigned int nBytes,unsigned int strideOut,int attribSize) {
for(unsigned int i = 0; i < nBytes;i+=strideOut) {
const GLbyte* byte_data = (const GLbyte *)dataIn;
//filling attrib
for(int j=0;j<attribSize;j++) {
reinterpret_cast<GLshort*>(&static_cast<unsigned char*>(dataOut)[i])[j] = B2S(byte_data[j]);
}
dataIn += strideIn;
}
}
static void convertByteIndirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,GLsizei count,GLenum indices_type,const GLvoid* indices,unsigned int strideOut,int attribSize) {
for(int i = 0 ;i < count ;i++) {
unsigned short index = indices_type == GL_UNSIGNED_BYTE? ((GLubyte *)indices)[i]:
((GLushort *)indices)[i];
const GLbyte* bytes_data = (GLbyte *)(dataIn + index*strideIn);
GLshort* short_data = reinterpret_cast<GLshort*>(static_cast<unsigned char*>(dataOut) + index*strideOut);
for(int j=0;j<attribSize;j++) {
short_data[j] = B2S(bytes_data[j]);
}
}
}
static void directToBytesRanges(GLint first,GLsizei count,GLESpointer* p,RangeList& list) {
int attribSize = p->getSize()*4; //4 is the sizeof GLfixed or GLfloat in bytes
int stride = p->getStride()?p->getStride():attribSize;
int start = p->getBufferOffset()+first*attribSize;
if(!p->getStride()) {
list.addRange(Range(start,count*attribSize));
} else {
for(int i = 0 ;i < count; i++,start+=stride) {
list.addRange(Range(start,attribSize));
}
}
}
static void indirectToBytesRanges(const GLvoid* indices,GLenum indices_type,GLsizei count,GLESpointer* p,RangeList& list) {
int attribSize = p->getSize() * 4; //4 is the sizeof GLfixed or GLfloat in bytes
int stride = p->getStride()?p->getStride():attribSize;
int start = p->getBufferOffset();
for(int i=0 ; i < count; i++) {
GLushort index = (indices_type == GL_UNSIGNED_SHORT?
static_cast<const GLushort*>(indices)[i]:
static_cast<const GLubyte*>(indices)[i]);
list.addRange(Range(start+index*stride,attribSize));
}
}
int bytesRangesToIndices(RangeList& ranges,GLESpointer* p,GLushort* indices) {
int attribSize = p->getSize() * 4; //4 is the sizeof GLfixed or GLfloat in bytes
int stride = p->getStride()?p->getStride():attribSize;
int offset = p->getBufferOffset();
int n = 0;
for(int i=0;i<ranges.size();i++) {
int startIndex = (ranges[i].getStart() - offset) / stride;
int nElements = ranges[i].getSize()/attribSize;
for(int j=0;j<nElements;j++) {
indices[n++] = startIndex+j;
}
}
return n;
}
void GLEScontext::convertDirect(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p) {
GLenum type = p->getType();
int attribSize = p->getSize();
unsigned int size = attribSize*count + first;
unsigned int bytes = type == GL_FIXED ? sizeof(GLfixed):sizeof(GLbyte);
cArrs.allocArr(size,type);
int stride = p->getStride()?p->getStride():bytes*attribSize;
const char* data = (const char*)p->getArrayData() + (first*stride);
if(type == GL_FIXED) {
convertFixedDirectLoop(data,stride,cArrs.getCurrentData(),size*sizeof(GLfloat),attribSize*sizeof(GLfloat),attribSize);
} else if(type == GL_BYTE) {
convertByteDirectLoop(data,stride,cArrs.getCurrentData(),size*sizeof(GLshort),attribSize*sizeof(GLshort),attribSize);
}
}
void GLEScontext::convertDirectVBO(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p) {
RangeList ranges;
RangeList conversions;
GLushort* indices = NULL;
GLenum type = p->getType();
int attribSize = p->getSize();
int stride = p->getStride()?p->getStride():sizeof(GLfixed)*attribSize;
unsigned int size = p->getStride()?p->getStride()*count:attribSize*count*sizeof(GLfixed);
char* data = (char*)p->getBufferData() + (first*stride);
if(p->bufferNeedConversion()) {
directToBytesRanges(first,count,p,ranges); //converting indices range to buffer bytes ranges by offset
p->getBufferConversions(ranges,conversions); // getting from the buffer the relevant ranges that still needs to be converted
if(conversions.size()) { // there are some elements to convert
indices = new GLushort[count];
int nIndices = bytesRangesToIndices(conversions,p,indices); //converting bytes ranges by offset to indices in this array
convertFixedIndirectLoop(data,stride,data,nIndices,GL_UNSIGNED_SHORT,indices,stride,attribSize);
}
}
if(indices) delete[] indices;
cArrs.setArr(data,p->getStride(),GL_FLOAT);
}
int GLEScontext::findMaxIndex(GLsizei count,GLenum type,const GLvoid* indices) {
//finding max index
int max = 0;
if(type == GL_UNSIGNED_BYTE) {
GLubyte* b_indices =(GLubyte *)indices;
for(int i=0;i<count;i++) {
if(b_indices[i] > max) max = b_indices[i];
}
} else {
GLushort* us_indices =(GLushort *)indices;
for(int i=0;i<count;i++) {
if(us_indices[i] > max) max = us_indices[i];
}
}
return max;
}
void GLEScontext::convertIndirect(GLESConversionArrays& cArrs,GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p) {
GLenum type = p->getType();
int maxElements = findMaxIndex(count,type,indices) + 1;
int attribSize = p->getSize();
int size = attribSize * maxElements;
unsigned int bytes = type == GL_FIXED ? sizeof(GLfixed):sizeof(GLbyte);
cArrs.allocArr(size,type);
int stride = p->getStride()?p->getStride():bytes*attribSize;
const char* data = (const char*)p->getArrayData();
if(type == GL_FIXED) {
convertFixedIndirectLoop(data,stride,cArrs.getCurrentData(),count,indices_type,indices,attribSize*sizeof(GLfloat),attribSize);
} else if(type == GL_BYTE){
convertByteIndirectLoop(data,stride,cArrs.getCurrentData(),count,indices_type,indices,attribSize*sizeof(GLshort),attribSize);
}
}
void GLEScontext::convertIndirectVBO(GLESConversionArrays& cArrs,GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p) {
RangeList ranges;
RangeList conversions;
GLushort* conversionIndices = NULL;
GLenum type = p->getType();
int attribSize = p->getSize();
int stride = p->getStride()?p->getStride():sizeof(GLfixed)*attribSize;
char* data = static_cast<char*>(p->getBufferData());
if(p->bufferNeedConversion()) {
indirectToBytesRanges(indices,indices_type,count,p,ranges); //converting indices range to buffer bytes ranges by offset
p->getBufferConversions(ranges,conversions); // getting from the buffer the relevant ranges that still needs to be converted
if(conversions.size()) { // there are some elements to convert
conversionIndices = new GLushort[count];
int nIndices = bytesRangesToIndices(conversions,p,conversionIndices); //converting bytes ranges by offset to indices in this array
convertFixedIndirectLoop(data,stride,data,nIndices,GL_UNSIGNED_SHORT,conversionIndices,stride,attribSize);
}
}
if(conversionIndices) delete[] conversionIndices;
cArrs.setArr(data,p->getStride(),GL_FLOAT);
}
void GLEScontext::bindBuffer(GLenum target,GLuint buffer) {
if(target == GL_ARRAY_BUFFER) {
m_arrayBuffer = buffer;
} else {
m_elementBuffer = buffer;
}
}
void GLEScontext::unbindBuffer(GLuint buffer) {
if(m_arrayBuffer == buffer)
{
m_arrayBuffer = 0;
}
if(m_elementBuffer == buffer)
{
m_elementBuffer = 0;
}
}
//checks if any buffer is binded to target
bool GLEScontext::isBindedBuffer(GLenum target) {
if(target == GL_ARRAY_BUFFER) {
return m_arrayBuffer != 0;
} else {
return m_elementBuffer != 0;
}
}
GLuint GLEScontext::getBuffer(GLenum target) {
return target == GL_ARRAY_BUFFER ? m_arrayBuffer:m_elementBuffer;
}
GLvoid* GLEScontext::getBindedBuffer(GLenum target) {
GLuint bufferName = getBuffer(target);
if(!bufferName) return NULL;
GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr());
return vbo->getData();
}
void GLEScontext::getBufferSize(GLenum target,GLint* param) {
GLuint bufferName = getBuffer(target);
GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr());
*param = vbo->getSize();
}
void GLEScontext::getBufferUsage(GLenum target,GLint* param) {
GLuint bufferName = getBuffer(target);
GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr());
*param = vbo->getUsage();
}
bool GLEScontext::setBufferData(GLenum target,GLsizeiptr size,const GLvoid* data,GLenum usage) {
GLuint bufferName = getBuffer(target);
if(!bufferName) return false;
GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr());
return vbo->setBuffer(size,usage,data);
}
bool GLEScontext::setBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const GLvoid* data) {
GLuint bufferName = getBuffer(target);
if(!bufferName) return false;
GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr());
return vbo->setSubBuffer(offset,size,data);
}
const char * GLEScontext::getExtensionString() {
const char * ret;
s_lock.lock();
if (s_glExtensions)
ret = s_glExtensions->c_str();
else
ret="";
s_lock.unlock();
return ret;
}
const char * GLEScontext::getRendererString() const {
return s_glRenderer.c_str();
}
void GLEScontext::getGlobalLock() {
s_lock.lock();
}
void GLEScontext::releaseGlobalLock() {
s_lock.unlock();
}
void GLEScontext::initCapsLocked(const GLubyte * extensionString)
{
const char* cstring = (const char*)extensionString;
s_glDispatch.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&s_glSupport.maxVertexAttribs);
s_glDispatch.glGetIntegerv(GL_MAX_CLIP_PLANES,&s_glSupport.maxClipPlane);
s_glDispatch.glGetIntegerv(GL_MAX_LIGHTS,&s_glSupport.maxLights);
s_glDispatch.glGetIntegerv(GL_MAX_TEXTURE_SIZE,&s_glSupport.maxTexSize);
s_glDispatch.glGetIntegerv(GL_MAX_TEXTURE_UNITS,&s_glSupport.maxTexUnits);
s_glDispatch.glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,&s_glSupport.maxTexImageUnits);
const GLubyte* glslVersion = s_glDispatch.glGetString(GL_SHADING_LANGUAGE_VERSION);
s_glSupport.glslVersion = Version((const char*)(glslVersion));
if (strstr(cstring,"GL_EXT_bgra ")!=NULL)
s_glSupport.GL_EXT_TEXTURE_FORMAT_BGRA8888 = true;
if (strstr(cstring,"GL_EXT_framebuffer_object ")!=NULL)
s_glSupport.GL_EXT_FRAMEBUFFER_OBJECT = true;
if (strstr(cstring,"GL_ARB_vertex_blend ")!=NULL)
s_glSupport.GL_ARB_VERTEX_BLEND = true;
if (strstr(cstring,"GL_ARB_matrix_palette ")!=NULL)
s_glSupport.GL_ARB_MATRIX_PALETTE = true;
if (strstr(cstring,"GL_EXT_packed_depth_stencil ")!=NULL )
s_glSupport.GL_EXT_PACKED_DEPTH_STENCIL = true;
if (strstr(cstring,"GL_OES_read_format ")!=NULL)
s_glSupport.GL_OES_READ_FORMAT = true;
if (strstr(cstring,"GL_ARB_half_float_pixel ")!=NULL)
s_glSupport.GL_ARB_HALF_FLOAT_PIXEL = true;
if (strstr(cstring,"GL_NV_half_float ")!=NULL)
s_glSupport.GL_NV_HALF_FLOAT = true;
if (strstr(cstring,"GL_ARB_half_float_vertex ")!=NULL)
s_glSupport.GL_ARB_HALF_FLOAT_VERTEX = true;
if (strstr(cstring,"GL_SGIS_generate_mipmap ")!=NULL)
s_glSupport.GL_SGIS_GENERATE_MIPMAP = true;
if (strstr(cstring,"GL_ARB_ES2_compatibility ")!=NULL)
s_glSupport.GL_ARB_ES2_COMPATIBILITY = true;
if (strstr(cstring,"GL_OES_standard_derivatives ")!=NULL)
s_glSupport.GL_OES_STANDARD_DERIVATIVES = true;
}
bool GLEScontext::isTextureUnitEnabled(GLenum unit) {
for (int i=0;i<NUM_TEXTURE_TARGETS;++i) {
if (m_texState[unit-GL_TEXTURE0][i].enabled)
return true;
}
return false;
}
bool GLEScontext::glGetBooleanv(GLenum pname, GLboolean *params)
{
GLint iParam;
if(glGetIntegerv(pname, &iParam))
{
*params = (iParam != 0);
return true;
}
return false;
}
bool GLEScontext::glGetFixedv(GLenum pname, GLfixed *params)
{
bool result = false;
GLint numParams = 1;
GLint* iParams = new GLint[numParams];
if (numParams>0 && glGetIntegerv(pname,iParams)) {
while(numParams >= 0)
{
params[numParams] = I2X(iParams[numParams]);
numParams--;
}
result = true;
}
delete [] iParams;
return result;
}
bool GLEScontext::glGetFloatv(GLenum pname, GLfloat *params)
{
bool result = false;
GLint numParams = 1;
GLint* iParams = new GLint[numParams];
if (numParams>0 && glGetIntegerv(pname,iParams)) {
while(numParams >= 0)
{
params[numParams] = (GLfloat)iParams[numParams];
numParams--;
}
result = true;
}
delete [] iParams;
return result;
}
bool GLEScontext::glGetIntegerv(GLenum pname, GLint *params)
{
switch(pname)
{
case GL_ARRAY_BUFFER_BINDING:
*params = m_arrayBuffer;
break;
case GL_ELEMENT_ARRAY_BUFFER_BINDING:
*params = m_elementBuffer;
break;
case GL_TEXTURE_BINDING_CUBE_MAP:
*params = m_texState[m_activeTexture][TEXTURE_CUBE_MAP].texture;
break;
case GL_TEXTURE_BINDING_2D:
*params = m_texState[m_activeTexture][TEXTURE_2D].texture;
break;
case GL_ACTIVE_TEXTURE:
*params = m_activeTexture+GL_TEXTURE0;
break;
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
*params = GL_UNSIGNED_BYTE;
break;
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
*params = GL_RGBA;
break;
default:
return false;
}
return true;
}
TextureTarget GLEScontext::GLTextureTargetToLocal(GLenum target) {
TextureTarget value=TEXTURE_2D;
switch (target) {
case GL_TEXTURE_CUBE_MAP:
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
value = TEXTURE_CUBE_MAP;
break;
case GL_TEXTURE_2D:
value = TEXTURE_2D;
break;
}
return value;
}
unsigned int GLEScontext::getBindedTexture(GLenum target) {
TextureTarget pos = GLTextureTargetToLocal(target);
return m_texState[m_activeTexture][pos].texture;
}
unsigned int GLEScontext::getBindedTexture(GLenum unit, GLenum target) {
TextureTarget pos = GLTextureTargetToLocal(target);
return m_texState[unit-GL_TEXTURE0][pos].texture;
}
void GLEScontext::setBindedTexture(GLenum target, unsigned int tex) {
TextureTarget pos = GLTextureTargetToLocal(target);
m_texState[m_activeTexture][pos].texture = tex;
}
void GLEScontext::setTextureEnabled(GLenum target, GLenum enable) {
TextureTarget pos = GLTextureTargetToLocal(target);
m_texState[m_activeTexture][pos].enabled = enable;
}
#define INTERNAL_NAME(x) (x +0x100000000ll);
ObjectLocalName GLEScontext::getDefaultTextureName(GLenum target) {
ObjectLocalName name = 0;
switch (GLTextureTargetToLocal(target)) {
case TEXTURE_2D:
name = INTERNAL_NAME(0);
break;
case TEXTURE_CUBE_MAP:
name = INTERNAL_NAME(1);
break;
default:
name = 0;
break;
}
return name;
}
void GLEScontext::drawValidate(void)
{
if(m_framebuffer == 0)
return;
ObjectDataPtr fbObj = m_shareGroup->getObjectData(FRAMEBUFFER,m_framebuffer);
if (fbObj.Ptr() == NULL)
return;
FramebufferData *fbData = (FramebufferData *)fbObj.Ptr();
fbData->validate(this);
}

View File

@@ -1,109 +0,0 @@
/*
* 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 <GLcommon/GLESpointer.h>
#include <stdlib.h>
GLESpointer::GLESpointer():m_size(4),
m_type(GL_FLOAT),
m_stride(0),
m_enabled(false),
m_normalize(false),
m_data(NULL),
m_buffer(NULL),
m_bufferName(0),
m_buffOffset(0),
m_isVBO(false){};
GLenum GLESpointer:: getType() const {
return m_type;
}
GLint GLESpointer::getSize() const {
return m_size;
}
GLsizei GLESpointer::getStride() const {
return m_stride;
}
const GLvoid* GLESpointer::getArrayData() const {
return m_data;
}
GLvoid* GLESpointer::getBufferData() const {
return m_buffer ? static_cast<unsigned char*>(m_buffer->getData()) + m_buffOffset : NULL;
}
const GLvoid* GLESpointer::getData() const{
return m_isVBO ? getBufferData():getArrayData();
}
void GLESpointer::redirectPointerData(){
m_data = getBufferData();
}
GLuint GLESpointer::getBufferName() const {
return m_bufferName;
}
unsigned int GLESpointer::getBufferOffset() const {
return m_buffOffset;
}
bool GLESpointer::isEnable() const {
return m_enabled;
}
bool GLESpointer::isNormalize() const {
return m_normalize;
}
bool GLESpointer::isVBO() const {
return m_isVBO;
}
void GLESpointer::enable(bool b) {
m_enabled = b;
}
void GLESpointer::setArray(GLint size,GLenum type,GLsizei stride,const GLvoid* data,bool normalize) {
m_size = size;
m_type = type;
m_stride = stride;
m_data = data;
m_buffer = NULL;
m_bufferName = 0;
m_normalize = normalize;
m_isVBO = false;
}
void GLESpointer::setBuffer(GLint size,GLenum type,GLsizei stride,GLESbuffer* buf,GLuint bufferName,int offset,bool normalize) {
m_size = size;
m_type = type;
m_stride = stride;
m_data = NULL;
m_buffer = buf;
m_bufferName = bufferName;
m_buffOffset = offset;
m_normalize = normalize;
m_isVBO = true;
}
void GLESpointer::getBufferConversions(const RangeList& rl,RangeList& rlOut) {
m_buffer->getConversions(rl,rlOut);
}

View File

@@ -1,168 +0,0 @@
#include <GLcommon/GLESvalidate.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <OpenglCodecCommon/ErrorLog.h>
bool GLESvalidate::textureEnum(GLenum e,unsigned int maxTex) {
return e >= GL_TEXTURE0 && e <= (GL_TEXTURE0 + maxTex);
}
bool GLESvalidate::pixelType(GLEScontext * ctx, GLenum type) {
if ((ctx && ctx->getCaps()->GL_EXT_PACKED_DEPTH_STENCIL) &&
(type == GL_UNSIGNED_INT_24_8_OES) )
return true;
if (ctx &&
(ctx->getCaps()->GL_ARB_HALF_FLOAT_PIXEL || ctx->getCaps()->GL_NV_HALF_FLOAT) &&
(type == GL_HALF_FLOAT_OES))
return true;
switch(type) {
case GL_UNSIGNED_BYTE:
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_FLOAT:
return true;
}
return false;
}
bool GLESvalidate::pixelOp(GLenum format,GLenum type) {
switch(type) {
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_5_5_5_1:
return format == GL_RGBA;
case GL_UNSIGNED_SHORT_5_6_5:
return format == GL_RGB;
}
return true;
}
bool GLESvalidate::pixelFrmt(GLEScontext* ctx ,GLenum format) {
if (ctx && ctx->getCaps()->GL_EXT_TEXTURE_FORMAT_BGRA8888 && format == GL_BGRA_EXT)
return true;
if (ctx && ctx->getCaps()->GL_EXT_PACKED_DEPTH_STENCIL && format == GL_DEPTH_STENCIL_OES)
return true;
switch(format) {
case GL_ALPHA:
case GL_RGB:
case GL_RGBA:
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
return true;
}
return false;
}
bool GLESvalidate::bufferTarget(GLenum target) {
return target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER;
}
bool GLESvalidate::bufferParam(GLenum param) {
return (param == GL_BUFFER_SIZE) || (param == GL_BUFFER_USAGE);
}
bool GLESvalidate::drawMode(GLenum mode) {
switch(mode) {
case GL_POINTS:
case GL_LINE_STRIP:
case GL_LINE_LOOP:
case GL_LINES:
case GL_TRIANGLE_STRIP:
case GL_TRIANGLE_FAN:
case GL_TRIANGLES:
return true;
}
return false;
}
bool GLESvalidate::drawType(GLenum mode) {
return mode == GL_UNSIGNED_BYTE ||
mode == GL_UNSIGNED_SHORT ||
mode == GL_UNSIGNED_INT;
}
bool GLESvalidate::textureTarget(GLenum target) {
return target==GL_TEXTURE_2D || target==GL_TEXTURE_CUBE_MAP;
}
bool GLESvalidate::textureTargetLimited(GLenum target) {
return target==GL_TEXTURE_2D;
}
bool GLESvalidate::textureTargetEx(GLenum target) {
switch(target) {
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES:
case GL_TEXTURE_2D:
return true;
}
return false;
}
bool GLESvalidate::blendEquationMode(GLenum mode){
return mode == GL_FUNC_ADD ||
mode == GL_FUNC_SUBTRACT ||
mode == GL_FUNC_REVERSE_SUBTRACT;
}
bool GLESvalidate::framebufferTarget(GLenum target){
return target == GL_FRAMEBUFFER;
}
bool GLESvalidate::framebufferAttachment(GLenum attachment){
switch(attachment){
case GL_COLOR_ATTACHMENT0:
case GL_DEPTH_ATTACHMENT:
case GL_STENCIL_ATTACHMENT:
return true;
}
return false;
}
bool GLESvalidate::framebufferAttachmentParams(GLenum pname){
switch(pname){
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
return true;
}
return false;
}
bool GLESvalidate::renderbufferTarget(GLenum target){
return target == GL_RENDERBUFFER;
}
bool GLESvalidate::renderbufferParams(GLenum pname){
switch(pname){
case GL_RENDERBUFFER_WIDTH:
case GL_RENDERBUFFER_HEIGHT:
case GL_RENDERBUFFER_INTERNAL_FORMAT:
case GL_RENDERBUFFER_RED_SIZE:
case GL_RENDERBUFFER_GREEN_SIZE:
case GL_RENDERBUFFER_BLUE_SIZE:
case GL_RENDERBUFFER_ALPHA_SIZE:
case GL_RENDERBUFFER_DEPTH_SIZE:
case GL_RENDERBUFFER_STENCIL_SIZE:
return true;
}
return false;
}
bool GLESvalidate::texImgDim(GLsizei width,GLsizei height,int maxTexSize) {
if( width < 0 || height < 0 || width > maxTexSize || height > maxTexSize)
return false;
return isPowerOf2(width) && isPowerOf2(height);
}

View File

@@ -1,20 +0,0 @@
/*
* 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 <GLcommon/GLutils.h>
bool isPowerOf2(int num) {
return (num & (num -1)) == 0;
}

View File

@@ -1,170 +0,0 @@
/*
* 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 "GLcommon/PaletteTexture.h"
#include <stdio.h>
struct Color
{
Color(unsigned char r, unsigned char g,unsigned char b, unsigned char a):red(r),green(g),blue(b),alpha(a){};
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char alpha;
};
void getPaletteInfo(GLenum internalFormat,unsigned int& indexSizeBits,unsigned int& colorSizeBytes,GLenum& colorFrmt) {
colorFrmt = GL_RGB;
switch(internalFormat)
{
case GL_PALETTE4_RGB8_OES:
indexSizeBits = 4;
colorSizeBytes = 3;
break;
case GL_PALETTE4_RGBA8_OES:
indexSizeBits = 4;
colorSizeBytes = 4;
colorFrmt = GL_RGBA;
break;
case GL_PALETTE4_RGBA4_OES:
case GL_PALETTE4_RGB5_A1_OES:
colorFrmt = GL_RGBA;
/* fall-through */
case GL_PALETTE4_R5_G6_B5_OES:
indexSizeBits = 4;
colorSizeBytes = 2;
break;
case GL_PALETTE8_RGB8_OES:
indexSizeBits = 8;
colorSizeBytes = 3;
break;
case GL_PALETTE8_RGBA8_OES:
indexSizeBits = 8;
colorSizeBytes = 4;
colorFrmt = GL_RGBA;
break;
case GL_PALETTE8_RGBA4_OES:
case GL_PALETTE8_RGB5_A1_OES:
colorFrmt = GL_RGBA;
/* fall-through */
case GL_PALETTE8_R5_G6_B5_OES:
indexSizeBits = 8;
colorSizeBytes = 2;
break;
}
}
Color paletteColor(const unsigned char* pallete,unsigned int index,GLenum format)
{
short s;
switch(format) {
//RGB
case GL_PALETTE4_RGB8_OES:
case GL_PALETTE8_RGB8_OES:
return Color(pallete[index],pallete[index+1],pallete[index+2],0);
case GL_PALETTE8_R5_G6_B5_OES:
case GL_PALETTE4_R5_G6_B5_OES:
s = *((short *)(pallete+index));
return Color((s >> 11)*255/31,((s >> 5) & 0x3f)*255/63 ,(s & 0x1f)*255/31,0);
//RGBA
case GL_PALETTE4_RGBA8_OES:
case GL_PALETTE8_RGBA8_OES:
return Color(pallete[index],pallete[index+1],pallete[index+2],pallete[index+3]);
case GL_PALETTE4_RGBA4_OES:
case GL_PALETTE8_RGBA4_OES:
s = *((short *)(pallete+index));
return Color(((s >> 12) & 0xf)*255/15,((s >> 8) & 0xf)*255/15,((s >> 4) & 0xf)*255/15 ,(s & 0xf)*255/15);
case GL_PALETTE4_RGB5_A1_OES:
case GL_PALETTE8_RGB5_A1_OES:
s = *((short *)(pallete+index));
return Color(((s >> 11) & 0x1f)*255/31,((s >> 6) & 0x1f)*255/31,((s >> 1) & 0x1f)*255/31 ,(s & 0x1) * 255);
default:
return Color(255,255,255,255);
}
}
unsigned char* uncompressTexture(GLenum internalformat,GLenum& formatOut,GLsizei width,GLsizei height,GLsizei imageSize, const GLvoid* data,GLint level) {
unsigned int indexSizeBits; //the size of the color index in the pallete
unsigned int colorSizeBytes; //the size of each color cell in the pallete
getPaletteInfo(internalformat,indexSizeBits,colorSizeBytes,formatOut);
if(!data)
{
return NULL;
}
const unsigned char* palette = static_cast<const unsigned char *>(data);
//the pallete positioned in the begininng of the data
// so we jump over it to get to the colos indices in the palette
int nColors = 2 << (indexSizeBits -1); //2^indexSizeBits
int paletteSizeBytes = nColors*colorSizeBytes;
const unsigned char* imageIndices = palette + paletteSizeBytes;
//jumping to the the correct mipmap level
for(int i=0;i<level;i++) {
imageIndices+= (width*height*indexSizeBits)/8;
width = width >> 1;
height = height >> 1;
}
int colorSizeOut = (formatOut == GL_RGB? 3:4);
int nPixels = width*height;
unsigned char* pixelsOut = new unsigned char[nPixels*colorSizeOut];
if(!pixelsOut) return NULL;
int leftBytes = ((palette + imageSize) /* the end of data pointer*/
- imageIndices);
int leftPixels = (leftBytes * 8 )/indexSizeBits;
int maxIndices = (leftPixels < nPixels) ? leftPixels:nPixels;
//filling the pixels array
for(int i =0 ; i < maxIndices ; i++) {
int paletteIndex = 0;
int indexOut = i*colorSizeOut;
if(indexSizeBits == 4) {
paletteIndex = (i%2) == 0 ?
imageIndices[i/2] >> 4: //upper bits
imageIndices[i/2] & 0xf; //lower bits
} else {
paletteIndex = imageIndices[i];
}
paletteIndex*=colorSizeBytes;
Color c = paletteColor(palette,paletteIndex,internalformat);
pixelsOut[indexOut] = c.red;
pixelsOut[indexOut+1] = c.green;
pixelsOut[indexOut+2] = c.blue;
if(formatOut == GL_RGBA) {
pixelsOut[indexOut+3] = c.alpha;
}
}
return pixelsOut;
}

View File

@@ -1,126 +0,0 @@
/*
* 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 <GLcommon/RangeManip.h>
bool Range::rangeIntersection(const Range& r,Range& rOut) const {
if(m_start > r.getEnd() || r.getStart() > m_end) return false;
int max_start = (m_start > r.getStart())? m_start:r.getStart();
int min_end = (m_end < r.getEnd())?m_end:r.getEnd();
int size = min_end - max_start;
if(size) {
rOut.setRange(max_start,min_end-max_start);
return true;
}
return false;
}
bool Range::rangeUnion(const Range& r,Range& rOut) const {
if(m_start > r.getEnd() || r.getStart() > m_end) return false;
int min_start = (m_start < r.getStart())?m_start:r.getStart();
int max_end = (m_end > r.getEnd())?m_end:r.getEnd();
int size = max_end - min_start;
if(size) {
rOut.setRange(min_start,max_end-min_start);
return false;
}
return false;
}
void RangeList::addRange(const Range& r) {
list.push_back(r);
}
void RangeList::addRanges(const RangeList& rl) {
for(int i =0; i< rl.size();i++) {
addRange(rl.list[i]);
}
}
void RangeList::delRanges(const RangeList& rl,RangeList& deleted) {
for(int i =0; i< rl.size();i++) {
delRange(rl.list[i],deleted);
}
}
bool RangeList::empty() const{
return list.empty();
}
int RangeList::size() const{
return list.size();
}
void RangeList::clear() {
return list.clear();
}
void RangeList::erase(unsigned int i) {
if(i > list.size()) return;
list.erase(list.begin() +i);
}
void RangeList::delRange(const Range& r,RangeList& deleted) {
if(r.getSize() == 0) return;
Range intersection;
Range temp;
// compare new rect to each and any of the rects on the list
for (int i=0;i<(int)list.size();i++) { // i must be signed for i-- below
// if there is intersection
if (r.rangeIntersection(list[i],intersection)) {
Range old=list[i];
// remove old as it is about to be split
erase(i);
i--;
if (intersection!=old) { // otherwise split:
//intersection on right side
if(old.getStart() != intersection.getStart()) {
list.insert(list.begin(),Range(old.getStart(),intersection.getStart() - old.getStart()));
}
//intersection on left side
if(old.getEnd() != intersection.getEnd()) {
list.insert(list.begin(),Range(intersection.getEnd(),old.getEnd() - intersection.getEnd()));
}
}
deleted.addRange(intersection);
}
}
}
void RangeList::merge() {
if(list.empty()) return;
Range temp;
bool changed;
do { // re-run if changed in last run
changed=0;
// run for each combinations of two rects in the list
for (int i=0;i<(((int)list.size())-1) && !changed ;i++)
{
for (int j=i+1;j<(int)list.size() && !changed ;j++)
{
if (list[i].rangeUnion(list[j],temp)) {
// are them exactly one on left of the other
list[i] = temp;
erase(j);
changed=1;
}
}
}
} while (changed);
}

View File

@@ -1,109 +0,0 @@
/*
* 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 <GLcommon/TextureUtils.h>
#include <GLcommon/GLESmacros.h>
#include <GLcommon/GLDispatch.h>
#include <GLcommon/GLESvalidate.h>
#include <stdio.h>
#include <cmath>
int getCompressedFormats(int* formats){
if(formats){
//Palette
formats[0] = GL_PALETTE4_RGBA8_OES;
formats[1] = GL_PALETTE4_RGBA4_OES;
formats[2] = GL_PALETTE8_RGBA8_OES;
formats[3] = GL_PALETTE8_RGBA4_OES;
formats[4] = GL_PALETTE4_RGB8_OES;
formats[5] = GL_PALETTE8_RGB8_OES;
formats[6] = GL_PALETTE4_RGB5_A1_OES;
formats[7] = GL_PALETTE8_RGB5_A1_OES;
formats[8] = GL_PALETTE4_R5_G6_B5_OES;
formats[9] = GL_PALETTE8_R5_G6_B5_OES;
//ETC
formats[MAX_SUPPORTED_PALETTE] = GL_ETC1_RGB8_OES;
}
return MAX_SUPPORTED_PALETTE + MAX_ETC_SUPPORTED;
}
void doCompressedTexImage2D(GLEScontext * ctx, GLenum target, GLint level,
GLenum internalformat, GLsizei width,
GLsizei height, GLint border,
GLsizei imageSize, const GLvoid* data, void * funcPtr)
{
/* XXX: This is just a hack to fix the resolve of glTexImage2D problem
It will be removed when we'll no longer link against ligGL */
typedef void (GLAPIENTRY *glTexImage2DPtr_t ) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
glTexImage2DPtr_t glTexImage2DPtr;
glTexImage2DPtr = (glTexImage2DPtr_t)funcPtr;
switch (internalformat) {
case GL_ETC1_RGB8_OES:
{
GLint format = GL_RGB;
GLint type = GL_UNSIGNED_BYTE;
GLsizei compressedSize = etc1_get_encoded_data_size(width, height);
SET_ERROR_IF((compressedSize > imageSize), GL_INVALID_VALUE);
const int32_t align = ctx->getUnpackAlignment()-1;
const int32_t bpr = ((width * 3) + align) & ~align;
const size_t size = bpr * height;
etc1_byte* pOut = new etc1_byte[size];
int res = etc1_decode_image((const etc1_byte*)data, pOut, width, height, 3, bpr);
SET_ERROR_IF(res!=0, GL_INVALID_VALUE);
glTexImage2DPtr(target,level,format,width,height,border,format,type,pOut);
delete [] pOut;
}
break;
case GL_PALETTE4_RGB8_OES:
case GL_PALETTE4_RGBA8_OES:
case GL_PALETTE4_R5_G6_B5_OES:
case GL_PALETTE4_RGBA4_OES:
case GL_PALETTE4_RGB5_A1_OES:
case GL_PALETTE8_RGB8_OES:
case GL_PALETTE8_RGBA8_OES:
case GL_PALETTE8_R5_G6_B5_OES:
case GL_PALETTE8_RGBA4_OES:
case GL_PALETTE8_RGB5_A1_OES:
{
SET_ERROR_IF(level > log2(ctx->getMaxTexSize()) ||
border !=0 || level > 0 ||
!GLESvalidate::texImgDim(width,height,ctx->getMaxTexSize()+2),GL_INVALID_VALUE)
int nMipmaps = -level + 1;
GLsizei tmpWidth = width;
GLsizei tmpHeight = height;
for(int i = 0; i < nMipmaps ; i++)
{
GLenum uncompressedFrmt;
unsigned char* uncompressed = uncompressTexture(internalformat,uncompressedFrmt,width,height,imageSize,data,i);
glTexImage2DPtr(target,i,uncompressedFrmt,tmpWidth,tmpHeight,border,uncompressedFrmt,GL_UNSIGNED_BYTE,uncompressed);
tmpWidth/=2;
tmpHeight/=2;
delete[] uncompressed;
}
}
break;
default:
SET_ERROR_IF(1, GL_INVALID_ENUM);
break;
}
}

View File

@@ -1,670 +0,0 @@
// Copyright 2009 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <ETC1/etc1.h>
#include <string.h>
/* From http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
The number of bits that represent a 4x4 texel block is 64 bits if
<internalformat> is given by ETC1_RGB8_OES.
The data for a block is a number of bytes,
{q0, q1, q2, q3, q4, q5, q6, q7}
where byte q0 is located at the lowest memory address and q7 at
the highest. The 64 bits specifying the block is then represented
by the following 64 bit integer:
int64bit = 256*(256*(256*(256*(256*(256*(256*q0+q1)+q2)+q3)+q4)+q5)+q6)+q7;
ETC1_RGB8_OES:
a) bit layout in bits 63 through 32 if diffbit = 0
63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
-----------------------------------------------
| base col1 | base col2 | base col1 | base col2 |
| R1 (4bits)| R2 (4bits)| G1 (4bits)| G2 (4bits)|
-----------------------------------------------
47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
---------------------------------------------------
| base col1 | base col2 | table | table |diff|flip|
| B1 (4bits)| B2 (4bits)| cw 1 | cw 2 |bit |bit |
---------------------------------------------------
b) bit layout in bits 63 through 32 if diffbit = 1
63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
-----------------------------------------------
| base col1 | dcol 2 | base col1 | dcol 2 |
| R1' (5 bits) | dR2 | G1' (5 bits) | dG2 |
-----------------------------------------------
47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
---------------------------------------------------
| base col 1 | dcol 2 | table | table |diff|flip|
| B1' (5 bits) | dB2 | cw 1 | cw 2 |bit |bit |
---------------------------------------------------
c) bit layout in bits 31 through 0 (in both cases)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
-----------------------------------------------
| most significant pixel index bits |
| p| o| n| m| l| k| j| i| h| g| f| e| d| c| b| a|
-----------------------------------------------
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
--------------------------------------------------
| least significant pixel index bits |
| p| o| n| m| l| k| j| i| h| g| f| e| d| c | b | a |
--------------------------------------------------
Add table 3.17.2: Intensity modifier sets for ETC1 compressed textures:
table codeword modifier table
------------------ ----------------------
0 -8 -2 2 8
1 -17 -5 5 17
2 -29 -9 9 29
3 -42 -13 13 42
4 -60 -18 18 60
5 -80 -24 24 80
6 -106 -33 33 106
7 -183 -47 47 183
Add table 3.17.3 Mapping from pixel index values to modifier values for
ETC1 compressed textures:
pixel index value
---------------
msb lsb resulting modifier value
----- ----- -------------------------
1 1 -b (large negative value)
1 0 -a (small negative value)
0 0 a (small positive value)
0 1 b (large positive value)
*/
static const int kModifierTable[] = {
/* 0 */2, 8, -2, -8,
/* 1 */5, 17, -5, -17,
/* 2 */9, 29, -9, -29,
/* 3 */13, 42, -13, -42,
/* 4 */18, 60, -18, -60,
/* 5 */24, 80, -24, -80,
/* 6 */33, 106, -33, -106,
/* 7 */47, 183, -47, -183 };
static const int kLookup[8] = { 0, 1, 2, 3, -4, -3, -2, -1 };
static inline etc1_byte clamp(int x) {
return (etc1_byte) (x >= 0 ? (x < 255 ? x : 255) : 0);
}
static
inline int convert4To8(int b) {
int c = b & 0xf;
return (c << 4) | c;
}
static
inline int convert5To8(int b) {
int c = b & 0x1f;
return (c << 3) | (c >> 2);
}
static
inline int convert6To8(int b) {
int c = b & 0x3f;
return (c << 2) | (c >> 4);
}
static
inline int divideBy255(int d) {
return (d + 128 + (d >> 8)) >> 8;
}
static
inline int convert8To4(int b) {
int c = b & 0xff;
return divideBy255(b * 15);
}
static
inline int convert8To5(int b) {
int c = b & 0xff;
return divideBy255(b * 31);
}
static
inline int convertDiff(int base, int diff) {
return convert5To8((0x1f & base) + kLookup[0x7 & diff]);
}
static
void decode_subblock(etc1_byte* pOut, int r, int g, int b, const int* table,
etc1_uint32 low, bool second, bool flipped) {
int baseX = 0;
int baseY = 0;
if (second) {
if (flipped) {
baseY = 2;
} else {
baseX = 2;
}
}
for (int i = 0; i < 8; i++) {
int x, y;
if (flipped) {
x = baseX + (i >> 1);
y = baseY + (i & 1);
} else {
x = baseX + (i >> 2);
y = baseY + (i & 3);
}
int k = y + (x * 4);
int offset = ((low >> k) & 1) | ((low >> (k + 15)) & 2);
int delta = table[offset];
etc1_byte* q = pOut + 3 * (x + 4 * y);
*q++ = clamp(r + delta);
*q++ = clamp(g + delta);
*q++ = clamp(b + delta);
}
}
// Input is an ETC1 compressed version of the data.
// Output is a 4 x 4 square of 3-byte pixels in form R, G, B
void etc1_decode_block(const etc1_byte* pIn, etc1_byte* pOut) {
etc1_uint32 high = (pIn[0] << 24) | (pIn[1] << 16) | (pIn[2] << 8) | pIn[3];
etc1_uint32 low = (pIn[4] << 24) | (pIn[5] << 16) | (pIn[6] << 8) | pIn[7];
int r1, r2, g1, g2, b1, b2;
if (high & 2) {
// differential
int rBase = high >> 27;
int gBase = high >> 19;
int bBase = high >> 11;
r1 = convert5To8(rBase);
r2 = convertDiff(rBase, high >> 24);
g1 = convert5To8(gBase);
g2 = convertDiff(gBase, high >> 16);
b1 = convert5To8(bBase);
b2 = convertDiff(bBase, high >> 8);
} else {
// not differential
r1 = convert4To8(high >> 28);
r2 = convert4To8(high >> 24);
g1 = convert4To8(high >> 20);
g2 = convert4To8(high >> 16);
b1 = convert4To8(high >> 12);
b2 = convert4To8(high >> 8);
}
int tableIndexA = 7 & (high >> 5);
int tableIndexB = 7 & (high >> 2);
const int* tableA = kModifierTable + tableIndexA * 4;
const int* tableB = kModifierTable + tableIndexB * 4;
bool flipped = (high & 1) != 0;
decode_subblock(pOut, r1, g1, b1, tableA, low, false, flipped);
decode_subblock(pOut, r2, g2, b2, tableB, low, true, flipped);
}
typedef struct {
etc1_uint32 high;
etc1_uint32 low;
etc1_uint32 score; // Lower is more accurate
} etc_compressed;
static
inline void take_best(etc_compressed* a, const etc_compressed* b) {
if (a->score > b->score) {
*a = *b;
}
}
static
void etc_average_colors_subblock(const etc1_byte* pIn, etc1_uint32 inMask,
etc1_byte* pColors, bool flipped, bool second) {
int r = 0;
int g = 0;
int b = 0;
if (flipped) {
int by = 0;
if (second) {
by = 2;
}
for (int y = 0; y < 2; y++) {
int yy = by + y;
for (int x = 0; x < 4; x++) {
int i = x + 4 * yy;
if (inMask & (1 << i)) {
const etc1_byte* p = pIn + i * 3;
r += *(p++);
g += *(p++);
b += *(p++);
}
}
}
} else {
int bx = 0;
if (second) {
bx = 2;
}
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 2; x++) {
int xx = bx + x;
int i = xx + 4 * y;
if (inMask & (1 << i)) {
const etc1_byte* p = pIn + i * 3;
r += *(p++);
g += *(p++);
b += *(p++);
}
}
}
}
pColors[0] = (etc1_byte)((r + 4) >> 3);
pColors[1] = (etc1_byte)((g + 4) >> 3);
pColors[2] = (etc1_byte)((b + 4) >> 3);
}
static
inline int square(int x) {
return x * x;
}
static etc1_uint32 chooseModifier(const etc1_byte* pBaseColors,
const etc1_byte* pIn, etc1_uint32 *pLow, int bitIndex,
const int* pModifierTable) {
etc1_uint32 bestScore = ~0;
int bestIndex = 0;
int pixelR = pIn[0];
int pixelG = pIn[1];
int pixelB = pIn[2];
int r = pBaseColors[0];
int g = pBaseColors[1];
int b = pBaseColors[2];
for (int i = 0; i < 4; i++) {
int modifier = pModifierTable[i];
int decodedG = clamp(g + modifier);
etc1_uint32 score = (etc1_uint32) (6 * square(decodedG - pixelG));
if (score >= bestScore) {
continue;
}
int decodedR = clamp(r + modifier);
score += (etc1_uint32) (3 * square(decodedR - pixelR));
if (score >= bestScore) {
continue;
}
int decodedB = clamp(b + modifier);
score += (etc1_uint32) square(decodedB - pixelB);
if (score < bestScore) {
bestScore = score;
bestIndex = i;
}
}
etc1_uint32 lowMask = (((bestIndex >> 1) << 16) | (bestIndex & 1))
<< bitIndex;
*pLow |= lowMask;
return bestScore;
}
static
void etc_encode_subblock_helper(const etc1_byte* pIn, etc1_uint32 inMask,
etc_compressed* pCompressed, bool flipped, bool second,
const etc1_byte* pBaseColors, const int* pModifierTable) {
int score = pCompressed->score;
if (flipped) {
int by = 0;
if (second) {
by = 2;
}
for (int y = 0; y < 2; y++) {
int yy = by + y;
for (int x = 0; x < 4; x++) {
int i = x + 4 * yy;
if (inMask & (1 << i)) {
score += chooseModifier(pBaseColors, pIn + i * 3,
&pCompressed->low, yy + x * 4, pModifierTable);
}
}
}
} else {
int bx = 0;
if (second) {
bx = 2;
}
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 2; x++) {
int xx = bx + x;
int i = xx + 4 * y;
if (inMask & (1 << i)) {
score += chooseModifier(pBaseColors, pIn + i * 3,
&pCompressed->low, y + xx * 4, pModifierTable);
}
}
}
}
pCompressed->score = score;
}
static bool inRange4bitSigned(int color) {
return color >= -4 && color <= 3;
}
static void etc_encodeBaseColors(etc1_byte* pBaseColors,
const etc1_byte* pColors, etc_compressed* pCompressed) {
int r1, g1, b1, r2, g2, b2; // 8 bit base colors for sub-blocks
bool differential;
{
int r51 = convert8To5(pColors[0]);
int g51 = convert8To5(pColors[1]);
int b51 = convert8To5(pColors[2]);
int r52 = convert8To5(pColors[3]);
int g52 = convert8To5(pColors[4]);
int b52 = convert8To5(pColors[5]);
r1 = convert5To8(r51);
g1 = convert5To8(g51);
b1 = convert5To8(b51);
int dr = r52 - r51;
int dg = g52 - g51;
int db = b52 - b51;
differential = inRange4bitSigned(dr) && inRange4bitSigned(dg)
&& inRange4bitSigned(db);
if (differential) {
r2 = convert5To8(r51 + dr);
g2 = convert5To8(g51 + dg);
b2 = convert5To8(b51 + db);
pCompressed->high |= (r51 << 27) | ((7 & dr) << 24) | (g51 << 19)
| ((7 & dg) << 16) | (b51 << 11) | ((7 & db) << 8) | 2;
}
}
if (!differential) {
int r41 = convert8To4(pColors[0]);
int g41 = convert8To4(pColors[1]);
int b41 = convert8To4(pColors[2]);
int r42 = convert8To4(pColors[3]);
int g42 = convert8To4(pColors[4]);
int b42 = convert8To4(pColors[5]);
r1 = convert4To8(r41);
g1 = convert4To8(g41);
b1 = convert4To8(b41);
r2 = convert4To8(r42);
g2 = convert4To8(g42);
b2 = convert4To8(b42);
pCompressed->high |= (r41 << 28) | (r42 << 24) | (g41 << 20) | (g42
<< 16) | (b41 << 12) | (b42 << 8);
}
pBaseColors[0] = r1;
pBaseColors[1] = g1;
pBaseColors[2] = b1;
pBaseColors[3] = r2;
pBaseColors[4] = g2;
pBaseColors[5] = b2;
}
static
void etc_encode_block_helper(const etc1_byte* pIn, etc1_uint32 inMask,
const etc1_byte* pColors, etc_compressed* pCompressed, bool flipped) {
pCompressed->score = ~0;
pCompressed->high = (flipped ? 1 : 0);
pCompressed->low = 0;
etc1_byte pBaseColors[6];
etc_encodeBaseColors(pBaseColors, pColors, pCompressed);
int originalHigh = pCompressed->high;
const int* pModifierTable = kModifierTable;
for (int i = 0; i < 8; i++, pModifierTable += 4) {
etc_compressed temp;
temp.score = 0;
temp.high = originalHigh | (i << 5);
temp.low = 0;
etc_encode_subblock_helper(pIn, inMask, &temp, flipped, false,
pBaseColors, pModifierTable);
take_best(pCompressed, &temp);
}
pModifierTable = kModifierTable;
etc_compressed firstHalf = *pCompressed;
for (int i = 0; i < 8; i++, pModifierTable += 4) {
etc_compressed temp;
temp.score = firstHalf.score;
temp.high = firstHalf.high | (i << 2);
temp.low = firstHalf.low;
etc_encode_subblock_helper(pIn, inMask, &temp, flipped, true,
pBaseColors + 3, pModifierTable);
if (i == 0) {
*pCompressed = temp;
} else {
take_best(pCompressed, &temp);
}
}
}
static void writeBigEndian(etc1_byte* pOut, etc1_uint32 d) {
pOut[0] = (etc1_byte)(d >> 24);
pOut[1] = (etc1_byte)(d >> 16);
pOut[2] = (etc1_byte)(d >> 8);
pOut[3] = (etc1_byte) d;
}
// Input is a 4 x 4 square of 3-byte pixels in form R, G, B
// inmask is a 16-bit mask where bit (1 << (x + y * 4)) tells whether the corresponding (x,y)
// pixel is valid or not. Invalid pixel color values are ignored when compressing.
// Output is an ETC1 compressed version of the data.
void etc1_encode_block(const etc1_byte* pIn, etc1_uint32 inMask,
etc1_byte* pOut) {
etc1_byte colors[6];
etc1_byte flippedColors[6];
etc_average_colors_subblock(pIn, inMask, colors, false, false);
etc_average_colors_subblock(pIn, inMask, colors + 3, false, true);
etc_average_colors_subblock(pIn, inMask, flippedColors, true, false);
etc_average_colors_subblock(pIn, inMask, flippedColors + 3, true, true);
etc_compressed a, b;
etc_encode_block_helper(pIn, inMask, colors, &a, false);
etc_encode_block_helper(pIn, inMask, flippedColors, &b, true);
take_best(&a, &b);
writeBigEndian(pOut, a.high);
writeBigEndian(pOut + 4, a.low);
}
// Return the size of the encoded image data (does not include size of PKM header).
etc1_uint32 etc1_get_encoded_data_size(etc1_uint32 width, etc1_uint32 height) {
return (((width + 3) & ~3) * ((height + 3) & ~3)) >> 1;
}
// Encode an entire image.
// pIn - pointer to the image data. Formatted such that the Red component of
// pixel (x,y) is at pIn + pixelSize * x + stride * y + redOffset;
// pOut - pointer to encoded data. Must be large enough to store entire encoded image.
int etc1_encode_image(const etc1_byte* pIn, etc1_uint32 width, etc1_uint32 height,
etc1_uint32 pixelSize, etc1_uint32 stride, etc1_byte* pOut) {
if (pixelSize < 2 || pixelSize > 3) {
return -1;
}
static const unsigned short kYMask[] = { 0x0, 0xf, 0xff, 0xfff, 0xffff };
static const unsigned short kXMask[] = { 0x0, 0x1111, 0x3333, 0x7777,
0xffff };
etc1_byte block[ETC1_DECODED_BLOCK_SIZE];
etc1_byte encoded[ETC1_ENCODED_BLOCK_SIZE];
etc1_uint32 encodedWidth = (width + 3) & ~3;
etc1_uint32 encodedHeight = (height + 3) & ~3;
for (etc1_uint32 y = 0; y < encodedHeight; y += 4) {
etc1_uint32 yEnd = height - y;
if (yEnd > 4) {
yEnd = 4;
}
int ymask = kYMask[yEnd];
for (etc1_uint32 x = 0; x < encodedWidth; x += 4) {
etc1_uint32 xEnd = width - x;
if (xEnd > 4) {
xEnd = 4;
}
int mask = ymask & kXMask[xEnd];
for (etc1_uint32 cy = 0; cy < yEnd; cy++) {
etc1_byte* q = block + (cy * 4) * 3;
const etc1_byte* p = pIn + pixelSize * x + stride * (y + cy);
if (pixelSize == 3) {
memcpy(q, p, xEnd * 3);
} else {
for (etc1_uint32 cx = 0; cx < xEnd; cx++) {
int pixel = (p[1] << 8) | p[0];
*q++ = convert5To8(pixel >> 11);
*q++ = convert6To8(pixel >> 5);
*q++ = convert5To8(pixel);
p += pixelSize;
}
}
}
etc1_encode_block(block, mask, encoded);
memcpy(pOut, encoded, sizeof(encoded));
pOut += sizeof(encoded);
}
}
return 0;
}
// Decode an entire image.
// pIn - pointer to encoded data.
// pOut - pointer to the image data. Will be written such that the Red component of
// pixel (x,y) is at pIn + pixelSize * x + stride * y + redOffset. Must be
// large enough to store entire image.
int etc1_decode_image(const etc1_byte* pIn, etc1_byte* pOut,
etc1_uint32 width, etc1_uint32 height,
etc1_uint32 pixelSize, etc1_uint32 stride) {
if (pixelSize < 2 || pixelSize > 3) {
return -1;
}
etc1_byte block[ETC1_DECODED_BLOCK_SIZE];
etc1_uint32 encodedWidth = (width + 3) & ~3;
etc1_uint32 encodedHeight = (height + 3) & ~3;
for (etc1_uint32 y = 0; y < encodedHeight; y += 4) {
etc1_uint32 yEnd = height - y;
if (yEnd > 4) {
yEnd = 4;
}
for (etc1_uint32 x = 0; x < encodedWidth; x += 4) {
etc1_uint32 xEnd = width - x;
if (xEnd > 4) {
xEnd = 4;
}
etc1_decode_block(pIn, block);
pIn += ETC1_ENCODED_BLOCK_SIZE;
for (etc1_uint32 cy = 0; cy < yEnd; cy++) {
const etc1_byte* q = block + (cy * 4) * 3;
etc1_byte* p = pOut + pixelSize * x + stride * (y + cy);
if (pixelSize == 3) {
memcpy(p, q, xEnd * 3);
} else {
for (etc1_uint32 cx = 0; cx < xEnd; cx++) {
etc1_byte r = *q++;
etc1_byte g = *q++;
etc1_byte b = *q++;
etc1_uint32 pixel = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
*p++ = (etc1_byte) pixel;
*p++ = (etc1_byte) (pixel >> 8);
}
}
}
}
}
return 0;
}
static const char kMagic[] = { 'P', 'K', 'M', ' ', '1', '0' };
static const etc1_uint32 ETC1_PKM_FORMAT_OFFSET = 6;
static const etc1_uint32 ETC1_PKM_ENCODED_WIDTH_OFFSET = 8;
static const etc1_uint32 ETC1_PKM_ENCODED_HEIGHT_OFFSET = 10;
static const etc1_uint32 ETC1_PKM_WIDTH_OFFSET = 12;
static const etc1_uint32 ETC1_PKM_HEIGHT_OFFSET = 14;
static const etc1_uint32 ETC1_RGB_NO_MIPMAPS = 0;
static void writeBEUint16(etc1_byte* pOut, etc1_uint32 data) {
pOut[0] = (etc1_byte) (data >> 8);
pOut[1] = (etc1_byte) data;
}
static etc1_uint32 readBEUint16(const etc1_byte* pIn) {
return (pIn[0] << 8) | pIn[1];
}
// Format a PKM header
void etc1_pkm_format_header(etc1_byte* pHeader, etc1_uint32 width, etc1_uint32 height) {
memcpy(pHeader, kMagic, sizeof(kMagic));
etc1_uint32 encodedWidth = (width + 3) & ~3;
etc1_uint32 encodedHeight = (height + 3) & ~3;
writeBEUint16(pHeader + ETC1_PKM_FORMAT_OFFSET, ETC1_RGB_NO_MIPMAPS);
writeBEUint16(pHeader + ETC1_PKM_ENCODED_WIDTH_OFFSET, encodedWidth);
writeBEUint16(pHeader + ETC1_PKM_ENCODED_HEIGHT_OFFSET, encodedHeight);
writeBEUint16(pHeader + ETC1_PKM_WIDTH_OFFSET, width);
writeBEUint16(pHeader + ETC1_PKM_HEIGHT_OFFSET, height);
}
// Check if a PKM header is correctly formatted.
etc1_bool etc1_pkm_is_valid(const etc1_byte* pHeader) {
if (memcmp(pHeader, kMagic, sizeof(kMagic))) {
return false;
}
etc1_uint32 format = readBEUint16(pHeader + ETC1_PKM_FORMAT_OFFSET);
etc1_uint32 encodedWidth = readBEUint16(pHeader + ETC1_PKM_ENCODED_WIDTH_OFFSET);
etc1_uint32 encodedHeight = readBEUint16(pHeader + ETC1_PKM_ENCODED_HEIGHT_OFFSET);
etc1_uint32 width = readBEUint16(pHeader + ETC1_PKM_WIDTH_OFFSET);
etc1_uint32 height = readBEUint16(pHeader + ETC1_PKM_HEIGHT_OFFSET);
return format == ETC1_RGB_NO_MIPMAPS &&
encodedWidth >= width && encodedWidth - width < 4 &&
encodedHeight >= height && encodedHeight - height < 4;
}
// Read the image width from a PKM header
etc1_uint32 etc1_pkm_get_width(const etc1_byte* pHeader) {
return readBEUint16(pHeader + ETC1_PKM_WIDTH_OFFSET);
}
// Read the image height from a PKM header
etc1_uint32 etc1_pkm_get_height(const etc1_byte* pHeader){
return readBEUint16(pHeader + ETC1_PKM_HEIGHT_OFFSET);
}

View File

@@ -1,411 +0,0 @@
/*
* 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 <map>
#include <GLcommon/objectNameManager.h>
#include <GLcommon/GLEScontext.h>
NameSpace::NameSpace(NamedObjectType p_type, GlobalNameSpace *globalNameSpace) :
m_nextName(0),
m_type(p_type),
m_globalNameSpace(globalNameSpace)
{
}
NameSpace::~NameSpace()
{
for (NamesMap::iterator n = m_localToGlobalMap.begin();
n != m_localToGlobalMap.end();
n++) {
m_globalNameSpace->deleteName(m_type, (*n).second);
}
}
ObjectLocalName
NameSpace::genName(ObjectLocalName p_localName, bool genGlobal, bool genLocal)
{
ObjectLocalName localName = p_localName;
if (genLocal) {
do {
localName = ++m_nextName;
} while( localName == 0 || m_localToGlobalMap.find(localName) != m_localToGlobalMap.end() );
}
if (genGlobal) {
unsigned int globalName = m_globalNameSpace->genName(m_type);
m_localToGlobalMap[localName] = globalName;
}
return localName;
}
unsigned int
NameSpace::genGlobalName(void)
{
return m_globalNameSpace->genName(m_type);
}
unsigned int
NameSpace::getGlobalName(ObjectLocalName p_localName)
{
NamesMap::iterator n( m_localToGlobalMap.find(p_localName) );
if (n != m_localToGlobalMap.end()) {
// object found - return its global name map
return (*n).second;
}
// object does not exist;
return 0;
}
ObjectLocalName
NameSpace::getLocalName(unsigned int p_globalName)
{
for(NamesMap::iterator it = m_localToGlobalMap.begin(); it != m_localToGlobalMap.end();it++){
if((*it).second == p_globalName){
// object found - return its local name
return (*it).first;
}
}
// object does not exist;
return 0;
}
void
NameSpace::deleteName(ObjectLocalName p_localName)
{
NamesMap::iterator n( m_localToGlobalMap.find(p_localName) );
if (n != m_localToGlobalMap.end()) {
m_globalNameSpace->deleteName(m_type, (*n).second);
m_localToGlobalMap.erase(p_localName);
}
}
bool
NameSpace::isObject(ObjectLocalName p_localName)
{
return (m_localToGlobalMap.find(p_localName) != m_localToGlobalMap.end() );
}
void
NameSpace::replaceGlobalName(ObjectLocalName p_localName, unsigned int p_globalName)
{
NamesMap::iterator n( m_localToGlobalMap.find(p_localName) );
if (n != m_localToGlobalMap.end()) {
m_globalNameSpace->deleteName(m_type, (*n).second);
(*n).second = p_globalName;
}
}
GlobalNameSpace::GlobalNameSpace()
{
mutex_init(&m_lock);
}
GlobalNameSpace::~GlobalNameSpace()
{
mutex_destroy(&m_lock);
}
unsigned int
GlobalNameSpace::genName(NamedObjectType p_type)
{
if ( p_type >= NUM_OBJECT_TYPES ) return 0;
unsigned int name = 0;
mutex_lock(&m_lock);
switch (p_type) {
case VERTEXBUFFER:
GLEScontext::dispatcher().glGenBuffers(1,&name);
break;
case TEXTURE:
GLEScontext::dispatcher().glGenTextures(1,&name);
break;
case RENDERBUFFER:
GLEScontext::dispatcher().glGenRenderbuffersEXT(1,&name);
break;
case FRAMEBUFFER:
GLEScontext::dispatcher().glGenFramebuffersEXT(1,&name);
break;
case SHADER: //objects in shader namepace are not handled
default:
name = 0;
}
mutex_unlock(&m_lock);
return name;
}
void
GlobalNameSpace::deleteName(NamedObjectType p_type, unsigned int p_name)
{
}
typedef std::pair<NamedObjectType, ObjectLocalName> ObjectIDPair;
typedef std::map<ObjectIDPair, ObjectDataPtr> ObjectDataMap;
ShareGroup::ShareGroup(GlobalNameSpace *globalNameSpace)
{
mutex_init(&m_lock);
for (int i=0; i<NUM_OBJECT_TYPES; i++) {
m_nameSpace[i] = new NameSpace((NamedObjectType)i, globalNameSpace);
}
m_objectsData = NULL;
}
ShareGroup::~ShareGroup()
{
mutex_lock(&m_lock);
for (int t = 0; t < NUM_OBJECT_TYPES; t++) {
delete m_nameSpace[t];
}
ObjectDataMap *map = (ObjectDataMap *)m_objectsData;
if (map) delete map;
mutex_unlock(&m_lock);
mutex_destroy(&m_lock);
}
ObjectLocalName
ShareGroup::genName(NamedObjectType p_type, ObjectLocalName p_localName, bool genLocal)
{
if (p_type >= NUM_OBJECT_TYPES) return 0;
mutex_lock(&m_lock);
ObjectLocalName localName = m_nameSpace[p_type]->genName(p_localName,true,genLocal);
mutex_unlock(&m_lock);
return localName;
}
unsigned int
ShareGroup::genGlobalName(NamedObjectType p_type)
{
if (p_type >= NUM_OBJECT_TYPES) return 0;
mutex_lock(&m_lock);
unsigned int name = m_nameSpace[p_type]->genGlobalName();
mutex_unlock(&m_lock);
return name;
}
unsigned int
ShareGroup::getGlobalName(NamedObjectType p_type, ObjectLocalName p_localName)
{
if (p_type >= NUM_OBJECT_TYPES) return 0;
mutex_lock(&m_lock);
unsigned int globalName = m_nameSpace[p_type]->getGlobalName(p_localName);
mutex_unlock(&m_lock);
return globalName;
}
ObjectLocalName
ShareGroup::getLocalName(NamedObjectType p_type, unsigned int p_globalName)
{
if (p_type >= NUM_OBJECT_TYPES) return 0;
mutex_lock(&m_lock);
ObjectLocalName localName = m_nameSpace[p_type]->getLocalName(p_globalName);
mutex_unlock(&m_lock);
return localName;
}
void
ShareGroup::deleteName(NamedObjectType p_type, ObjectLocalName p_localName)
{
if (p_type >= NUM_OBJECT_TYPES) return;
mutex_lock(&m_lock);
m_nameSpace[p_type]->deleteName(p_localName);
ObjectDataMap *map = (ObjectDataMap *)m_objectsData;
if (map) {
map->erase( ObjectIDPair(p_type, p_localName) );
}
mutex_unlock(&m_lock);
}
bool
ShareGroup::isObject(NamedObjectType p_type, ObjectLocalName p_localName)
{
if (p_type >= NUM_OBJECT_TYPES) return 0;
mutex_lock(&m_lock);
bool exist = m_nameSpace[p_type]->isObject(p_localName);
mutex_unlock(&m_lock);
return exist;
}
void
ShareGroup::replaceGlobalName(NamedObjectType p_type, ObjectLocalName p_localName, unsigned int p_globalName)
{
if (p_type >= NUM_OBJECT_TYPES) return;
mutex_lock(&m_lock);
m_nameSpace[p_type]->replaceGlobalName(p_localName, p_globalName);
mutex_unlock(&m_lock);
}
void
ShareGroup::setObjectData(NamedObjectType p_type, ObjectLocalName p_localName, ObjectDataPtr data)
{
if (p_type >= NUM_OBJECT_TYPES) return;
mutex_lock(&m_lock);
ObjectDataMap *map = (ObjectDataMap *)m_objectsData;
if (!map) {
map = new ObjectDataMap();
m_objectsData = map;
}
ObjectIDPair id( p_type, p_localName );
map->insert( std::pair<ObjectIDPair, ObjectDataPtr>(id, data) );
mutex_unlock(&m_lock);
}
ObjectDataPtr
ShareGroup::getObjectData(NamedObjectType p_type, ObjectLocalName p_localName)
{
ObjectDataPtr ret;
if (p_type >= NUM_OBJECT_TYPES) return ret;
mutex_lock(&m_lock);
ObjectDataMap *map = (ObjectDataMap *)m_objectsData;
if (map) {
ObjectDataMap::iterator i = map->find( ObjectIDPair(p_type, p_localName) );
if (i != map->end()) ret = (*i).second;
}
mutex_unlock(&m_lock);
return ret;
}
ObjectNameManager::ObjectNameManager(GlobalNameSpace *globalNameSpace) :
m_globalNameSpace(globalNameSpace)
{
mutex_init(&m_lock);
}
ObjectNameManager::~ObjectNameManager()
{
mutex_destroy(&m_lock);
}
ShareGroupPtr
ObjectNameManager::createShareGroup(void *p_groupName)
{
mutex_lock(&m_lock);
ShareGroupPtr shareGroupReturn;
ShareGroupsMap::iterator s( m_groups.find(p_groupName) );
if (s != m_groups.end()) {
shareGroupReturn = (*s).second;
}
else {
//
// Group does not exist, create new group
//
shareGroupReturn = ShareGroupPtr( new ShareGroup(m_globalNameSpace) );
m_groups.insert( std::pair<void *, ShareGroupPtr>(p_groupName, shareGroupReturn) );
}
mutex_unlock(&m_lock);
return shareGroupReturn;
}
ShareGroupPtr
ObjectNameManager::getShareGroup(void *p_groupName)
{
mutex_lock(&m_lock);
ShareGroupPtr shareGroupReturn(NULL);
ShareGroupsMap::iterator s( m_groups.find(p_groupName) );
if (s != m_groups.end()) {
shareGroupReturn = (*s).second;
}
mutex_unlock(&m_lock);
return shareGroupReturn;
}
ShareGroupPtr
ObjectNameManager::attachShareGroup(void *p_groupName, void *p_existingGroupName)
{
mutex_lock(&m_lock);
ShareGroupPtr shareGroupReturn;
ShareGroupsMap::iterator s( m_groups.find(p_existingGroupName) );
if (s == m_groups.end()) {
// ShareGroup did not found !!!
mutex_unlock(&m_lock);
return ShareGroupPtr(NULL);
}
shareGroupReturn = (*s).second;
if (m_groups.find(p_groupName) == m_groups.end())
{
m_groups.insert( std::pair<void *, ShareGroupPtr>(p_groupName, shareGroupReturn) );
}
mutex_unlock(&m_lock);
return shareGroupReturn;
}
void
ObjectNameManager::deleteShareGroup(void *p_groupName)
{
mutex_lock(&m_lock);
ShareGroupsMap::iterator s( m_groups.find(p_groupName) );
if (s != m_groups.end()) {
m_groups.erase(s);
}
mutex_unlock(&m_lock);
}
void *ObjectNameManager::getGlobalContext()
{
void *ret = NULL;
mutex_lock(&m_lock);
if (m_groups.size() > 0) ret = (*m_groups.begin()).first;
mutex_unlock(&m_lock);
return ret;
}

View File

@@ -1,329 +0,0 @@
/* -*- mode: c; tab-width: 8; -*- */
/* vi: set sw=4 ts=8: */
/* Reference version of egl.h for EGL 1.4.
* $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
*/
/*
** Copyright (c) 2007-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
#ifndef __egl_h_
#define __egl_h_
/* All platform-dependent types and macro boilerplate (such as EGLAPI
* and EGLAPIENTRY) should go in eglplatform.h.
*/
#include <EGL/eglplatform.h>
#ifdef __cplusplus
extern "C" {
#endif
/* EGL Types */
/* EGLint is defined in eglplatform.h */
typedef unsigned int EGLBoolean;
typedef unsigned int EGLenum;
typedef void *EGLConfig;
typedef void *EGLContext;
typedef void *EGLDisplay;
typedef void *EGLSurface;
typedef void *EGLClientBuffer;
/* EGL Versioning */
#define EGL_VERSION_1_0 1
#define EGL_VERSION_1_1 1
#define EGL_VERSION_1_2 1
#define EGL_VERSION_1_3 1
#define EGL_VERSION_1_4 1
/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
* enums are assigned unique values starting at 0x3000.
*/
/* EGL aliases */
#define EGL_FALSE 0
#define EGL_TRUE 1
/* Out-of-band handle values */
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
#define EGL_NO_CONTEXT ((EGLContext)0)
#define EGL_NO_DISPLAY ((EGLDisplay)0)
#define EGL_NO_SURFACE ((EGLSurface)0)
/* Out-of-band attribute value */
#define EGL_DONT_CARE ((EGLint)-1)
/* Errors / GetError return values */
#define EGL_SUCCESS 0x3000
#define EGL_NOT_INITIALIZED 0x3001
#define EGL_BAD_ACCESS 0x3002
#define EGL_BAD_ALLOC 0x3003
#define EGL_BAD_ATTRIBUTE 0x3004
#define EGL_BAD_CONFIG 0x3005
#define EGL_BAD_CONTEXT 0x3006
#define EGL_BAD_CURRENT_SURFACE 0x3007
#define EGL_BAD_DISPLAY 0x3008
#define EGL_BAD_MATCH 0x3009
#define EGL_BAD_NATIVE_PIXMAP 0x300A
#define EGL_BAD_NATIVE_WINDOW 0x300B
#define EGL_BAD_PARAMETER 0x300C
#define EGL_BAD_SURFACE 0x300D
#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
/* Reserved 0x300F-0x301F for additional errors */
/* Config attributes */
#define EGL_BUFFER_SIZE 0x3020
#define EGL_ALPHA_SIZE 0x3021
#define EGL_BLUE_SIZE 0x3022
#define EGL_GREEN_SIZE 0x3023
#define EGL_RED_SIZE 0x3024
#define EGL_DEPTH_SIZE 0x3025
#define EGL_STENCIL_SIZE 0x3026
#define EGL_CONFIG_CAVEAT 0x3027
#define EGL_CONFIG_ID 0x3028
#define EGL_LEVEL 0x3029
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
#define EGL_MAX_PBUFFER_PIXELS 0x302B
#define EGL_MAX_PBUFFER_WIDTH 0x302C
#define EGL_NATIVE_RENDERABLE 0x302D
#define EGL_NATIVE_VISUAL_ID 0x302E
#define EGL_NATIVE_VISUAL_TYPE 0x302F
#define EGL_SAMPLES 0x3031
#define EGL_SAMPLE_BUFFERS 0x3032
#define EGL_SURFACE_TYPE 0x3033
#define EGL_TRANSPARENT_TYPE 0x3034
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
#define EGL_TRANSPARENT_RED_VALUE 0x3037
#define EGL_NONE 0x3038 /* Attrib list terminator */
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
#define EGL_MIN_SWAP_INTERVAL 0x303B
#define EGL_MAX_SWAP_INTERVAL 0x303C
#define EGL_LUMINANCE_SIZE 0x303D
#define EGL_ALPHA_MASK_SIZE 0x303E
#define EGL_COLOR_BUFFER_TYPE 0x303F
#define EGL_RENDERABLE_TYPE 0x3040
#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
#define EGL_CONFORMANT 0x3042
/* Reserved 0x3041-0x304F for additional config attributes */
/* Config attribute values */
#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
/* More config attribute values, for EGL_TEXTURE_FORMAT */
#define EGL_NO_TEXTURE 0x305C
#define EGL_TEXTURE_RGB 0x305D
#define EGL_TEXTURE_RGBA 0x305E
#define EGL_TEXTURE_2D 0x305F
/* Config attribute mask bits */
#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
/* QueryString targets */
#define EGL_VENDOR 0x3053
#define EGL_VERSION 0x3054
#define EGL_EXTENSIONS 0x3055
#define EGL_CLIENT_APIS 0x308D
/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
#define EGL_HEIGHT 0x3056
#define EGL_WIDTH 0x3057
#define EGL_LARGEST_PBUFFER 0x3058
#define EGL_TEXTURE_FORMAT 0x3080
#define EGL_TEXTURE_TARGET 0x3081
#define EGL_MIPMAP_TEXTURE 0x3082
#define EGL_MIPMAP_LEVEL 0x3083
#define EGL_RENDER_BUFFER 0x3086
#define EGL_VG_COLORSPACE 0x3087
#define EGL_VG_ALPHA_FORMAT 0x3088
#define EGL_HORIZONTAL_RESOLUTION 0x3090
#define EGL_VERTICAL_RESOLUTION 0x3091
#define EGL_PIXEL_ASPECT_RATIO 0x3092
#define EGL_SWAP_BEHAVIOR 0x3093
#define EGL_MULTISAMPLE_RESOLVE 0x3099
/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
#define EGL_BACK_BUFFER 0x3084
#define EGL_SINGLE_BUFFER 0x3085
/* OpenVG color spaces */
#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
/* OpenVG alpha formats */
#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
/* Constant scale factor by which fractional display resolutions &
* aspect ratio are scaled when queried as integer values.
*/
#define EGL_DISPLAY_SCALING 10000
/* Unknown display resolution/aspect ratio */
#define EGL_UNKNOWN ((EGLint)-1)
/* Back buffer swap behaviors */
#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
/* CreatePbufferFromClientBuffer buffer types */
#define EGL_OPENVG_IMAGE 0x3096
/* QueryContext targets */
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
/* CreateContext attributes */
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
/* Multisample resolution behaviors */
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
/* BindAPI/QueryAPI targets */
#define EGL_OPENGL_ES_API 0x30A0
#define EGL_OPENVG_API 0x30A1
#define EGL_OPENGL_API 0x30A2
/* GetCurrentSurface targets */
#define EGL_DRAW 0x3059
#define EGL_READ 0x305A
/* WaitNative engines */
#define EGL_CORE_NATIVE_ENGINE 0x305B
/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
#define EGL_COLORSPACE EGL_VG_COLORSPACE
#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
/* EGL extensions must request enum blocks from the Khronos
* API Registrar, who maintains the enumerant registry. Submit
* a bug in Khronos Bugzilla against task "Registry".
*/
/* EGL Functions */
EGLAPI EGLint EGLAPIENTRY eglGetError(void);
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
EGLint config_size, EGLint *num_config);
EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
EGLConfig *configs, EGLint config_size,
EGLint *num_config);
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
EGLint attribute, EGLint *value);
EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
EGLNativeWindowType win,
const EGLint *attrib_list);
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
const EGLint *attrib_list);
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
EGLNativePixmapType pixmap,
const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
EGLint attribute, EGLint *value);
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
EGLConfig config, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
EGLint attribute, EGLint value);
EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
EGLContext share_context,
const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
EGLSurface read, EGLContext ctx);
EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
EGLint attribute, EGLint *value);
EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
EGLNativePixmapType target);
/* This is a generic function pointer type, whose name indicates it must
* be cast to the proper type *and calling convention* before use.
*/
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
/* Now, define eglGetProcAddress using the generic function ptr. type */
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
eglGetProcAddress(const char *procname);
#ifdef __cplusplus
}
#endif
#endif /* __egl_h_ */

View File

@@ -1,244 +0,0 @@
#ifndef __eglext_h_
#define __eglext_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2007-2010 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
#include <EGL/eglplatform.h>
/*************************************************************/
/* Header file version number */
/* Current version at http://www.khronos.org/registry/egl/ */
/* $Revision: 11249 $ on $Date: 2010-05-05 09:54:28 -0700 (Wed, 05 May 2010) $ */
#define EGL_EGLEXT_VERSION 5
#ifndef EGL_KHR_config_attribs
#define EGL_KHR_config_attribs 1
#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
#endif
#ifndef EGL_KHR_lock_surface
#define EGL_KHR_lock_surface 1
#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
#endif
#ifndef EGL_KHR_image
#define EGL_KHR_image 1
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
typedef void *EGLImageKHR;
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
#endif
#ifndef EGL_KHR_vg_parent_image
#define EGL_KHR_vg_parent_image 1
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
#endif
#ifndef EGL_KHR_gl_texture_2D_image
#define EGL_KHR_gl_texture_2D_image 1
#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_gl_texture_cubemap_image
#define EGL_KHR_gl_texture_cubemap_image 1
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
#endif
#ifndef EGL_KHR_gl_texture_3D_image
#define EGL_KHR_gl_texture_3D_image 1
#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_gl_renderbuffer_image
#define EGL_KHR_gl_renderbuffer_image 1
#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
#endif
#ifndef EGL_KHR_reusable_sync
#define EGL_KHR_reusable_sync 1
typedef void* EGLSyncKHR;
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
#define EGL_SYNC_STATUS_KHR 0x30F1
#define EGL_SIGNALED_KHR 0x30F2
#define EGL_UNSIGNALED_KHR 0x30F3
#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
#define EGL_CONDITION_SATISFIED_KHR 0x30F6
#define EGL_SYNC_TYPE_KHR 0x30F7
#define EGL_SYNC_REUSABLE_KHR 0x30FA
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#endif
#ifndef EGL_KHR_image_base
#define EGL_KHR_image_base 1
/* Most interfaces defined by EGL_KHR_image_pixmap above */
#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_image_pixmap
#define EGL_KHR_image_pixmap 1
/* Interfaces defined by EGL_KHR_image above */
#endif
#ifndef EGL_IMG_context_priority
#define EGL_IMG_context_priority 1
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
#endif
#ifndef EGL_NV_coverage_sample
#define EGL_NV_coverage_sample 1
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
#endif
#ifndef EGL_NV_depth_nonlinear
#define EGL_NV_depth_nonlinear 1
#define EGL_DEPTH_ENCODING_NV 0x30E2
#define EGL_DEPTH_ENCODING_NONE_NV 0
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
#endif
#ifndef EGL_NV_sync
#define EGL_NV_sync 1
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
#define EGL_SYNC_STATUS_NV 0x30E7
#define EGL_SIGNALED_NV 0x30E8
#define EGL_UNSIGNALED_NV 0x30E9
#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
#define EGL_ALREADY_SIGNALED_NV 0x30EA
#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
#define EGL_CONDITION_SATISFIED_NV 0x30EC
#define EGL_SYNC_TYPE_NV 0x30ED
#define EGL_SYNC_CONDITION_NV 0x30EE
#define EGL_SYNC_FENCE_NV 0x30EF
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
typedef void* EGLSyncNV;
typedef unsigned long long EGLTimeNV;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
EGLBoolean eglFenceNV (EGLSyncNV sync);
EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif
#ifndef EGL_KHR_fence_sync
#define EGL_KHR_fence_sync 1
/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
#define EGL_SYNC_CONDITION_KHR 0x30F8
#define EGL_SYNC_FENCE_KHR 0x30F9
#endif
#ifndef EGL_ANDROID_image_native_buffer
#define EGL_ANDROID_image_native_buffer 1
struct android_native_buffer_t;
#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
#endif
#ifndef EGL_ANDROID_swap_rectangle
#define EGL_ANDROID_swap_rectangle 1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglSetSwapRectangleANDROID (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSWAPRECTANGLEANDROIDPROC) (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,69 +0,0 @@
#ifndef EGL_INTERNAL_PLATFORM_H
#define EGL_INTERNAL_PLATFORM_H
/*
* 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.
*/
class SrfcInfo; //defined in Egl{$platform}Api.cpp
typedef SrfcInfo* SURFACE;
typedef SURFACE EGLNativeSurfaceType;
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <GL/gl.h>
#define WGL_WGLEXT_PROTOTYPES
#include <GL/wglext.h>
class WinDisplay; //defined in EglWindows.cpp
typedef WinDisplay* DISPLAY;
typedef PIXELFORMATDESCRIPTOR EGLNativePixelFormatType;
#define PIXEL_FORMAT_INITIALIZER {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
typedef HGLRC EGLNativeContextType;
typedef HPBUFFERARB EGLNativePbufferType;
typedef DISPLAY EGLNativeInternalDisplayType;
#elif defined(__APPLE__)
typedef void* EGLNativePixelFormatType;
#define PIXEL_FORMAT_INITIALIZER NULL
typedef void* EGLNativeContextType;
typedef void* EGLNativePbufferType;
typedef EGLNativeDisplayType EGLNativeInternalDisplayType;
#elif defined(__unix__)
/* X11 (tentative) */
#include <GL/glx.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef GLXFBConfig EGLNativePixelFormatType;
#define PIXEL_FORMAT_INITIALIZER 0;
typedef GLXContext EGLNativeContextType;
typedef GLXPbuffer EGLNativePbufferType;
typedef EGLNativeDisplayType EGLNativeInternalDisplayType;
#else
#error "Platform not recognized"
#endif
#endif

View File

@@ -1,111 +0,0 @@
#ifndef __eglplatform_h_
#define __eglplatform_h_
/*
** Copyright (c) 2007-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Platform-specific types and definitions for egl.h
* $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "EGL" component "Registry".
*/
#include <KHR/khrplatform.h>
/* Macros used in EGL function prototype declarations.
*
* EGL functions should be prototyped as:
*
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
*
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
*/
#ifndef EGLAPI
#define EGLAPI KHRONOS_APICALL
#endif
#ifndef EGLAPIENTRY
#define EGLAPIENTRY KHRONOS_APIENTRY
#endif
#define EGLAPIENTRYP EGLAPIENTRY*
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
* are aliases of window-system-dependent types, such as X Display * or
* Windows Device Context. They must be defined in platform-specific
* code below. The EGL-prefixed versions of Native*Type are the same
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
*/
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType;
#elif defined(__APPLE__)
typedef unsigned int EGLNativeDisplayType;
typedef void* EGLNativePixmapType;
typedef void* EGLNativeWindowType;
#elif defined(__unix__)
/* X11 (tentative) */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display * EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#else
#error "Platform not recognized"
#endif
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
typedef EGLNativeDisplayType NativeDisplayType;
typedef EGLNativePixmapType NativePixmapType;
typedef EGLNativeWindowType NativeWindowType;
/* Define EGLint. This must be a signed integral type large enough to contain
* all legal attribute names and values passed into and out of EGL, whether
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
* handle, or other. While in general a 32-bit integer will suffice, if
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
* integer type.
*/
typedef khronos_int32_t EGLint;
#endif /* __eglplatform_h */

View File

@@ -1,901 +0,0 @@
#ifndef __wglext_h_
#define __wglext_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2007-2010 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Function declaration macros - to move into glplatform.h */
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef APIENTRYP
#define APIENTRYP APIENTRY *
#endif
#ifndef GLAPI
#define GLAPI extern
#endif
/*************************************************************/
/* Header file version number */
/* wglext.h last updated 2010/08/06 */
/* Current version at http://www.opengl.org/registry/ */
#define WGL_WGLEXT_VERSION 22
#ifndef WGL_ARB_buffer_region
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
#endif
#ifndef WGL_ARB_multisample
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
#endif
#ifndef WGL_ARB_extensions_string
#endif
#ifndef WGL_ARB_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NEED_PALETTE_ARB 0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
#define WGL_SWAP_METHOD_ARB 0x2007
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
#define WGL_TRANSPARENT_ARB 0x200A
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
#define WGL_SHARE_DEPTH_ARB 0x200C
#define WGL_SHARE_STENCIL_ARB 0x200D
#define WGL_SHARE_ACCUM_ARB 0x200E
#define WGL_SUPPORT_GDI_ARB 0x200F
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_STEREO_ARB 0x2012
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201A
#define WGL_ALPHA_BITS_ARB 0x201B
#define WGL_ALPHA_SHIFT_ARB 0x201C
#define WGL_ACCUM_BITS_ARB 0x201D
#define WGL_ACCUM_RED_BITS_ARB 0x201E
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_SWAP_EXCHANGE_ARB 0x2028
#define WGL_SWAP_COPY_ARB 0x2029
#define WGL_SWAP_UNDEFINED_ARB 0x202A
#define WGL_TYPE_RGBA_ARB 0x202B
#define WGL_TYPE_COLORINDEX_ARB 0x202C
#endif
#ifndef WGL_ARB_make_current_read
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
#endif
#ifndef WGL_ARB_pbuffer
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
#define WGL_PBUFFER_LARGEST_ARB 0x2033
#define WGL_PBUFFER_WIDTH_ARB 0x2034
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
#define WGL_PBUFFER_LOST_ARB 0x2036
#endif
#ifndef WGL_ARB_render_texture
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
#define WGL_TEXTURE_FORMAT_ARB 0x2072
#define WGL_TEXTURE_TARGET_ARB 0x2073
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
#define WGL_TEXTURE_RGB_ARB 0x2075
#define WGL_TEXTURE_RGBA_ARB 0x2076
#define WGL_NO_TEXTURE_ARB 0x2077
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
#define WGL_TEXTURE_1D_ARB 0x2079
#define WGL_TEXTURE_2D_ARB 0x207A
#define WGL_MIPMAP_LEVEL_ARB 0x207B
#define WGL_CUBE_MAP_FACE_ARB 0x207C
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
#define WGL_FRONT_LEFT_ARB 0x2083
#define WGL_FRONT_RIGHT_ARB 0x2084
#define WGL_BACK_LEFT_ARB 0x2085
#define WGL_BACK_RIGHT_ARB 0x2086
#define WGL_AUX0_ARB 0x2087
#define WGL_AUX1_ARB 0x2088
#define WGL_AUX2_ARB 0x2089
#define WGL_AUX3_ARB 0x208A
#define WGL_AUX4_ARB 0x208B
#define WGL_AUX5_ARB 0x208C
#define WGL_AUX6_ARB 0x208D
#define WGL_AUX7_ARB 0x208E
#define WGL_AUX8_ARB 0x208F
#define WGL_AUX9_ARB 0x2090
#endif
#ifndef WGL_ARB_pixel_format_float
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
#endif
#ifndef WGL_ARB_framebuffer_sRGB
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
#endif
#ifndef WGL_ARB_create_context
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define ERROR_INVALID_VERSION_ARB 0x2095
#endif
#ifndef WGL_ARB_create_context_profile
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define ERROR_INVALID_PROFILE_ARB 0x2096
#endif
#ifndef WGL_ARB_create_context_robustness
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
#endif
#ifndef WGL_EXT_make_current_read
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
#endif
#ifndef WGL_EXT_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
#define WGL_ACCELERATION_EXT 0x2003
#define WGL_NEED_PALETTE_EXT 0x2004
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
#define WGL_SWAP_METHOD_EXT 0x2007
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
#define WGL_TRANSPARENT_EXT 0x200A
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
#define WGL_SHARE_DEPTH_EXT 0x200C
#define WGL_SHARE_STENCIL_EXT 0x200D
#define WGL_SHARE_ACCUM_EXT 0x200E
#define WGL_SUPPORT_GDI_EXT 0x200F
#define WGL_SUPPORT_OPENGL_EXT 0x2010
#define WGL_DOUBLE_BUFFER_EXT 0x2011
#define WGL_STEREO_EXT 0x2012
#define WGL_PIXEL_TYPE_EXT 0x2013
#define WGL_COLOR_BITS_EXT 0x2014
#define WGL_RED_BITS_EXT 0x2015
#define WGL_RED_SHIFT_EXT 0x2016
#define WGL_GREEN_BITS_EXT 0x2017
#define WGL_GREEN_SHIFT_EXT 0x2018
#define WGL_BLUE_BITS_EXT 0x2019
#define WGL_BLUE_SHIFT_EXT 0x201A
#define WGL_ALPHA_BITS_EXT 0x201B
#define WGL_ALPHA_SHIFT_EXT 0x201C
#define WGL_ACCUM_BITS_EXT 0x201D
#define WGL_ACCUM_RED_BITS_EXT 0x201E
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
#define WGL_DEPTH_BITS_EXT 0x2022
#define WGL_STENCIL_BITS_EXT 0x2023
#define WGL_AUX_BUFFERS_EXT 0x2024
#define WGL_NO_ACCELERATION_EXT 0x2025
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
#define WGL_FULL_ACCELERATION_EXT 0x2027
#define WGL_SWAP_EXCHANGE_EXT 0x2028
#define WGL_SWAP_COPY_EXT 0x2029
#define WGL_SWAP_UNDEFINED_EXT 0x202A
#define WGL_TYPE_RGBA_EXT 0x202B
#define WGL_TYPE_COLORINDEX_EXT 0x202C
#endif
#ifndef WGL_EXT_pbuffer
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
#define WGL_PBUFFER_LARGEST_EXT 0x2033
#define WGL_PBUFFER_WIDTH_EXT 0x2034
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
#endif
#ifndef WGL_EXT_depth_float
#define WGL_DEPTH_FLOAT_EXT 0x2040
#endif
#ifndef WGL_3DFX_multisample
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
#define WGL_SAMPLES_3DFX 0x2061
#endif
#ifndef WGL_EXT_multisample
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
#define WGL_SAMPLES_EXT 0x2042
#endif
#ifndef WGL_I3D_digital_video_control
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
#endif
#ifndef WGL_I3D_gamma
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
#endif
#ifndef WGL_I3D_genlock
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
#endif
#ifndef WGL_I3D_image_buffer
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
#endif
#ifndef WGL_I3D_swap_frame_lock
#endif
#ifndef WGL_NV_render_depth_texture
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
#define WGL_DEPTH_COMPONENT_NV 0x20A7
#endif
#ifndef WGL_NV_render_texture_rectangle
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
#endif
#ifndef WGL_ATI_pixel_format_float
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
#endif
#ifndef WGL_NV_float_buffer
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
#endif
#ifndef WGL_3DL_stereo_control
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
#endif
#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
#endif
#ifndef WGL_EXT_framebuffer_sRGB
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
#endif
#ifndef WGL_NV_present_video
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
#endif
#ifndef WGL_NV_video_out
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
#define WGL_VIDEO_OUT_FRAME 0x20C8
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
#endif
#ifndef WGL_NV_swap_group
#endif
#ifndef WGL_NV_gpu_affinity
#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
#endif
#ifndef WGL_AMD_gpu_association
#define WGL_GPU_VENDOR_AMD 0x1F00
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
#define WGL_GPU_RAM_AMD 0x21A3
#define WGL_GPU_CLOCK_AMD 0x21A4
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
#define WGL_GPU_NUM_RB_AMD 0x21A7
#define WGL_GPU_NUM_SPI_AMD 0x21A8
#endif
#ifndef WGL_NV_video_capture
#define WGL_UNIQUE_ID_NV 0x20CE
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
#endif
#ifndef WGL_NV_copy_image
#endif
#ifndef WGL_NV_multisample_coverage
#define WGL_COVERAGE_SAMPLES_NV 0x2042
#define WGL_COLOR_SAMPLES_NV 0x20B9
#endif
#ifndef WGL_EXT_create_context_es2_profile
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
#endif
/*************************************************************/
#ifndef WGL_ARB_pbuffer
DECLARE_HANDLE(HPBUFFERARB);
#endif
#ifndef WGL_EXT_pbuffer
DECLARE_HANDLE(HPBUFFEREXT);
#endif
#ifndef WGL_NV_present_video
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
#endif
#ifndef WGL_NV_video_output
DECLARE_HANDLE(HPVIDEODEV);
#endif
#ifndef WGL_NV_gpu_affinity
DECLARE_HANDLE(HPGPUNV);
DECLARE_HANDLE(HGPUNV);
typedef struct _GPU_DEVICE {
DWORD cb;
CHAR DeviceName[32];
CHAR DeviceString[128];
DWORD Flags;
RECT rcVirtualScreen;
} GPU_DEVICE, *PGPU_DEVICE;
#endif
#ifndef WGL_NV_video_capture
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
#endif
#ifndef WGL_ARB_buffer_region
#define WGL_ARB_buffer_region 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#endif
#ifndef WGL_ARB_multisample
#define WGL_ARB_multisample 1
#endif
#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern const char * WINAPI wglGetExtensionsStringARB (HDC hdc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
#endif
#ifndef WGL_ARB_pixel_format
#define WGL_ARB_pixel_format 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
extern BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#ifndef WGL_ARB_make_current_read
#define WGL_ARB_make_current_read 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
extern HDC WINAPI wglGetCurrentReadDCARB (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
#endif
#ifndef WGL_ARB_pbuffer
#define WGL_ARB_pbuffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#endif
#ifndef WGL_ARB_render_texture
#define WGL_ARB_render_texture 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
#endif
#ifndef WGL_ARB_pixel_format_float
#define WGL_ARB_pixel_format_float 1
#endif
#ifndef WGL_ARB_framebuffer_sRGB
#define WGL_ARB_framebuffer_sRGB 1
#endif
#ifndef WGL_ARB_create_context
#define WGL_ARB_create_context 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif
#ifndef WGL_ARB_create_context_profile
#define WGL_ARB_create_context_profile 1
#endif
#ifndef WGL_ARB_create_context_robustness
#define WGL_ARB_create_context_robustness 1
#endif
#ifndef WGL_EXT_display_color_table
#define WGL_EXT_display_color_table 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
#endif
#ifndef WGL_EXT_extensions_string
#define WGL_EXT_extensions_string 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern const char * WINAPI wglGetExtensionsStringEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
#endif
#ifndef WGL_EXT_make_current_read
#define WGL_EXT_make_current_read 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
extern HDC WINAPI wglGetCurrentReadDCEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
#endif
#ifndef WGL_EXT_pbuffer
#define WGL_EXT_pbuffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#endif
#ifndef WGL_EXT_pixel_format
#define WGL_EXT_pixel_format 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
extern BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#ifndef WGL_EXT_swap_control
#define WGL_EXT_swap_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglSwapIntervalEXT (int interval);
extern int WINAPI wglGetSwapIntervalEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
#endif
#ifndef WGL_EXT_depth_float
#define WGL_EXT_depth_float 1
#endif
#ifndef WGL_NV_vertex_array_range
#define WGL_NV_vertex_array_range 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern void* WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
extern void WINAPI wglFreeMemoryNV (void *pointer);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
#endif
#ifndef WGL_3DFX_multisample
#define WGL_3DFX_multisample 1
#endif
#ifndef WGL_EXT_multisample
#define WGL_EXT_multisample 1
#endif
#ifndef WGL_OML_sync_control
#define WGL_OML_sync_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
extern BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
extern INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
extern BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
extern BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif
#ifndef WGL_I3D_digital_video_control
#define WGL_I3D_digital_video_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
#endif
#ifndef WGL_I3D_gamma
#define WGL_I3D_gamma 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
extern BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
extern BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#endif
#ifndef WGL_I3D_genlock
#define WGL_I3D_genlock 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
extern BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
extern BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
extern BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
extern BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#endif
#ifndef WGL_I3D_image_buffer
#define WGL_I3D_image_buffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
extern BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
#endif
#ifndef WGL_I3D_swap_frame_lock
#define WGL_I3D_swap_frame_lock 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnableFrameLockI3D (void);
extern BOOL WINAPI wglDisableFrameLockI3D (void);
extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
#endif
#ifndef WGL_I3D_swap_frame_usage
#define WGL_I3D_swap_frame_usage 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
extern BOOL WINAPI wglEndFrameTrackingI3D (void);
extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#endif
#ifndef WGL_ATI_pixel_format_float
#define WGL_ATI_pixel_format_float 1
#endif
#ifndef WGL_NV_float_buffer
#define WGL_NV_float_buffer 1
#endif
#ifndef WGL_3DL_stereo_control
#define WGL_3DL_stereo_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
#endif
#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_EXT_pixel_format_packed_float 1
#endif
#ifndef WGL_EXT_framebuffer_sRGB
#define WGL_EXT_framebuffer_sRGB 1
#endif
#ifndef WGL_NV_present_video
#define WGL_NV_present_video 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
extern BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
extern BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
#endif
#ifndef WGL_NV_video_output
#define WGL_NV_video_output 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif
#ifndef WGL_NV_swap_group
#define WGL_NV_swap_group 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
extern BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
extern BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
extern BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
extern BOOL WINAPI wglResetFrameCountNV (HDC hDC);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
#endif
#ifndef WGL_NV_gpu_affinity
#define WGL_NV_gpu_affinity 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
extern BOOL WINAPI wglDeleteDCNV (HDC hdc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
#endif
#ifndef WGL_AMD_gpu_association
#define WGL_AMD_gpu_association 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
extern INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
#ifndef WGL_NV_video_capture
#define WGL_NV_video_capture 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#endif
#ifndef WGL_NV_copy_image
#define WGL_NV_copy_image 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif
#ifndef WGL_NV_multisample_coverage
#define WGL_NV_multisample_coverage 1
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1,621 +0,0 @@
#ifndef __gl2_h_
#define __gl2_h_
/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
#include <GLES2/gl2platform.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/*-------------------------------------------------------------------------
* Data type definitions
*-----------------------------------------------------------------------*/
typedef void GLvoid;
typedef char GLchar;
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef khronos_int8_t GLbyte;
typedef short GLshort;
typedef int GLint;
typedef int GLsizei;
typedef khronos_uint8_t GLubyte;
typedef unsigned short GLushort;
typedef unsigned int GLuint;
typedef khronos_float_t GLfloat;
typedef khronos_float_t GLclampf;
typedef khronos_int32_t GLfixed;
/* GL types for handling large vertex buffer objects */
typedef khronos_intptr_t GLintptr;
typedef khronos_ssize_t GLsizeiptr;
/* OpenGL ES core versions */
#define GL_ES_VERSION_2_0 1
/* ClearBufferMask */
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
/* Boolean */
#define GL_FALSE 0
#define GL_TRUE 1
/* BeginMode */
#define GL_POINTS 0x0000
#define GL_LINES 0x0001
#define GL_LINE_LOOP 0x0002
#define GL_LINE_STRIP 0x0003
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
/* AlphaFunction (not supported in ES20) */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* BlendingFactorDest */
#define GL_ZERO 0
#define GL_ONE 1
#define GL_SRC_COLOR 0x0300
#define GL_ONE_MINUS_SRC_COLOR 0x0301
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
#define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307
#define GL_SRC_ALPHA_SATURATE 0x0308
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* BlendEquationSeparate */
#define GL_FUNC_ADD 0x8006
#define GL_BLEND_EQUATION 0x8009
#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
#define GL_BLEND_EQUATION_ALPHA 0x883D
/* BlendSubtract */
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
/* Separate Blend Functions */
#define GL_BLEND_DST_RGB 0x80C8
#define GL_BLEND_SRC_RGB 0x80C9
#define GL_BLEND_DST_ALPHA 0x80CA
#define GL_BLEND_SRC_ALPHA 0x80CB
#define GL_CONSTANT_COLOR 0x8001
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
#define GL_CONSTANT_ALPHA 0x8003
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
#define GL_BLEND_COLOR 0x8005
/* Buffer Objects */
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
#define GL_STREAM_DRAW 0x88E0
#define GL_STATIC_DRAW 0x88E4
#define GL_DYNAMIC_DRAW 0x88E8
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
/* CullFaceMode */
#define GL_FRONT 0x0404
#define GL_BACK 0x0405
#define GL_FRONT_AND_BACK 0x0408
/* DepthFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* EnableCap */
#define GL_TEXTURE_2D 0x0DE1
#define GL_CULL_FACE 0x0B44
#define GL_BLEND 0x0BE2
#define GL_DITHER 0x0BD0
#define GL_STENCIL_TEST 0x0B90
#define GL_DEPTH_TEST 0x0B71
#define GL_SCISSOR_TEST 0x0C11
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_COVERAGE 0x80A0
/* ErrorCode */
#define GL_NO_ERROR 0
#define GL_INVALID_ENUM 0x0500
#define GL_INVALID_VALUE 0x0501
#define GL_INVALID_OPERATION 0x0502
#define GL_OUT_OF_MEMORY 0x0505
/* FrontFaceDirection */
#define GL_CW 0x0900
#define GL_CCW 0x0901
/* GetPName */
#define GL_LINE_WIDTH 0x0B21
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#define GL_CULL_FACE_MODE 0x0B45
#define GL_FRONT_FACE 0x0B46
#define GL_DEPTH_RANGE 0x0B70
#define GL_DEPTH_WRITEMASK 0x0B72
#define GL_DEPTH_CLEAR_VALUE 0x0B73
#define GL_DEPTH_FUNC 0x0B74
#define GL_STENCIL_CLEAR_VALUE 0x0B91
#define GL_STENCIL_FUNC 0x0B92
#define GL_STENCIL_FAIL 0x0B94
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
#define GL_STENCIL_REF 0x0B97
#define GL_STENCIL_VALUE_MASK 0x0B93
#define GL_STENCIL_WRITEMASK 0x0B98
#define GL_STENCIL_BACK_FUNC 0x8800
#define GL_STENCIL_BACK_FAIL 0x8801
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
#define GL_STENCIL_BACK_REF 0x8CA3
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
#define GL_VIEWPORT 0x0BA2
#define GL_SCISSOR_BOX 0x0C10
/* GL_SCISSOR_TEST */
#define GL_COLOR_CLEAR_VALUE 0x0C22
#define GL_COLOR_WRITEMASK 0x0C23
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
#define GL_MAX_TEXTURE_SIZE 0x0D33
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
#define GL_SUBPIXEL_BITS 0x0D50
#define GL_RED_BITS 0x0D52
#define GL_GREEN_BITS 0x0D53
#define GL_BLUE_BITS 0x0D54
#define GL_ALPHA_BITS 0x0D55
#define GL_DEPTH_BITS 0x0D56
#define GL_STENCIL_BITS 0x0D57
#define GL_POLYGON_OFFSET_UNITS 0x2A00
/* GL_POLYGON_OFFSET_FILL */
#define GL_POLYGON_OFFSET_FACTOR 0x8038
#define GL_TEXTURE_BINDING_2D 0x8069
#define GL_SAMPLE_BUFFERS 0x80A8
#define GL_SAMPLES 0x80A9
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
/* GetTextureParameter */
/* GL_TEXTURE_MAG_FILTER */
/* GL_TEXTURE_MIN_FILTER */
/* GL_TEXTURE_WRAP_S */
/* GL_TEXTURE_WRAP_T */
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
/* HintMode */
#define GL_DONT_CARE 0x1100
#define GL_FASTEST 0x1101
#define GL_NICEST 0x1102
/* HintTarget */
#define GL_GENERATE_MIPMAP_HINT 0x8192
/* DataType */
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
#define GL_SHORT 0x1402
#define GL_UNSIGNED_SHORT 0x1403
#define GL_INT 0x1404
#define GL_UNSIGNED_INT 0x1405
#define GL_FLOAT 0x1406
#define GL_FIXED 0x140C
/* PixelFormat */
#define GL_DEPTH_COMPONENT 0x1902
#define GL_ALPHA 0x1906
#define GL_RGB 0x1907
#define GL_RGBA 0x1908
#define GL_LUMINANCE 0x1909
#define GL_LUMINANCE_ALPHA 0x190A
/* PixelType */
/* GL_UNSIGNED_BYTE */
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
/* Shaders */
#define GL_FRAGMENT_SHADER 0x8B30
#define GL_VERTEX_SHADER 0x8B31
#define GL_MAX_VERTEX_ATTRIBS 0x8869
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
#define GL_MAX_VARYING_VECTORS 0x8DFC
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
#define GL_SHADER_TYPE 0x8B4F
#define GL_DELETE_STATUS 0x8B80
#define GL_LINK_STATUS 0x8B82
#define GL_VALIDATE_STATUS 0x8B83
#define GL_ATTACHED_SHADERS 0x8B85
#define GL_ACTIVE_UNIFORMS 0x8B86
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
#define GL_ACTIVE_ATTRIBUTES 0x8B89
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
#define GL_CURRENT_PROGRAM 0x8B8D
/* StencilFunction */
#define GL_NEVER 0x0200
#define GL_LESS 0x0201
#define GL_EQUAL 0x0202
#define GL_LEQUAL 0x0203
#define GL_GREATER 0x0204
#define GL_NOTEQUAL 0x0205
#define GL_GEQUAL 0x0206
#define GL_ALWAYS 0x0207
/* StencilOp */
/* GL_ZERO */
#define GL_KEEP 0x1E00
#define GL_REPLACE 0x1E01
#define GL_INCR 0x1E02
#define GL_DECR 0x1E03
#define GL_INVERT 0x150A
#define GL_INCR_WRAP 0x8507
#define GL_DECR_WRAP 0x8508
/* StringName */
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03
/* TextureMagFilter */
#define GL_NEAREST 0x2600
#define GL_LINEAR 0x2601
/* TextureMinFilter */
/* GL_NEAREST */
/* GL_LINEAR */
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
/* TextureParameterName */
#define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
/* TextureTarget */
/* GL_TEXTURE_2D */
#define GL_TEXTURE 0x1702
#define GL_TEXTURE_CUBE_MAP 0x8513
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
/* TextureUnit */
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#define GL_TEXTURE2 0x84C2
#define GL_TEXTURE3 0x84C3
#define GL_TEXTURE4 0x84C4
#define GL_TEXTURE5 0x84C5
#define GL_TEXTURE6 0x84C6
#define GL_TEXTURE7 0x84C7
#define GL_TEXTURE8 0x84C8
#define GL_TEXTURE9 0x84C9
#define GL_TEXTURE10 0x84CA
#define GL_TEXTURE11 0x84CB
#define GL_TEXTURE12 0x84CC
#define GL_TEXTURE13 0x84CD
#define GL_TEXTURE14 0x84CE
#define GL_TEXTURE15 0x84CF
#define GL_TEXTURE16 0x84D0
#define GL_TEXTURE17 0x84D1
#define GL_TEXTURE18 0x84D2
#define GL_TEXTURE19 0x84D3
#define GL_TEXTURE20 0x84D4
#define GL_TEXTURE21 0x84D5
#define GL_TEXTURE22 0x84D6
#define GL_TEXTURE23 0x84D7
#define GL_TEXTURE24 0x84D8
#define GL_TEXTURE25 0x84D9
#define GL_TEXTURE26 0x84DA
#define GL_TEXTURE27 0x84DB
#define GL_TEXTURE28 0x84DC
#define GL_TEXTURE29 0x84DD
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
/* TextureWrapMode */
#define GL_REPEAT 0x2901
#define GL_CLAMP_TO_EDGE 0x812F
#define GL_MIRRORED_REPEAT 0x8370
/* Uniform Types */
#define GL_FLOAT_VEC2 0x8B50
#define GL_FLOAT_VEC3 0x8B51
#define GL_FLOAT_VEC4 0x8B52
#define GL_INT_VEC2 0x8B53
#define GL_INT_VEC3 0x8B54
#define GL_INT_VEC4 0x8B55
#define GL_BOOL 0x8B56
#define GL_BOOL_VEC2 0x8B57
#define GL_BOOL_VEC3 0x8B58
#define GL_BOOL_VEC4 0x8B59
#define GL_FLOAT_MAT2 0x8B5A
#define GL_FLOAT_MAT3 0x8B5B
#define GL_FLOAT_MAT4 0x8B5C
#define GL_SAMPLER_2D 0x8B5E
#define GL_SAMPLER_CUBE 0x8B60
/* Vertex Arrays */
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
/* Read Format */
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
/* Shader Source */
#define GL_COMPILE_STATUS 0x8B81
#define GL_INFO_LOG_LENGTH 0x8B84
#define GL_SHADER_SOURCE_LENGTH 0x8B88
#define GL_SHADER_COMPILER 0x8DFA
/* Shader Binary */
#define GL_SHADER_BINARY_FORMATS 0x8DF8
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
/* Shader Precision-Specified Types */
#define GL_LOW_FLOAT 0x8DF0
#define GL_MEDIUM_FLOAT 0x8DF1
#define GL_HIGH_FLOAT 0x8DF2
#define GL_LOW_INT 0x8DF3
#define GL_MEDIUM_INT 0x8DF4
#define GL_HIGH_INT 0x8DF5
/* Framebuffer Object. */
#define GL_FRAMEBUFFER 0x8D40
#define GL_RENDERBUFFER 0x8D41
#define GL_RGBA4 0x8056
#define GL_RGB5_A1 0x8057
#define GL_RGB565 0x8D62
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_STENCIL_INDEX 0x1901
#define GL_STENCIL_INDEX8 0x8D48
#define GL_RENDERBUFFER_WIDTH 0x8D42
#define GL_RENDERBUFFER_HEIGHT 0x8D43
#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
#define GL_RENDERBUFFER_RED_SIZE 0x8D50
#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
#define GL_COLOR_ATTACHMENT0 0x8CE0
#define GL_DEPTH_ATTACHMENT 0x8D00
#define GL_STENCIL_ATTACHMENT 0x8D20
#define GL_NONE 0
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
#define GL_FRAMEBUFFER_BINDING 0x8CA6
#define GL_RENDERBUFFER_BINDING 0x8CA7
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
/*-------------------------------------------------------------------------
* GL core functions.
*-----------------------------------------------------------------------*/
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
GL_APICALL void GL_APIENTRY glFinish (void);
GL_APICALL void GL_APIENTRY glFlush (void);
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL GLenum GL_APIENTRY glGetError (void);
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
#ifdef __cplusplus
}
#endif
#endif /* __gl2_h_ */

View File

@@ -1,973 +0,0 @@
#ifndef __gl2ext_h_
#define __gl2ext_h_
/* $Revision: 13239 $ on $Date:: 2010-12-17 15:13:56 -0800 #$ */
#ifdef __cplusplus
extern "C" {
#endif
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
#ifndef GL_APIENTRYP
# define GL_APIENTRYP GL_APIENTRY*
#endif
/*------------------------------------------------------------------------*
* OES extension tokens
*------------------------------------------------------------------------*/
/* GL_OES_compressed_ETC1_RGB8_texture */
#ifndef GL_OES_compressed_ETC1_RGB8_texture
#define GL_ETC1_RGB8_OES 0x8D64
#endif
/* GL_OES_compressed_paletted_texture */
#ifndef GL_OES_compressed_paletted_texture
#define GL_PALETTE4_RGB8_OES 0x8B90
#define GL_PALETTE4_RGBA8_OES 0x8B91
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
#define GL_PALETTE4_RGBA4_OES 0x8B93
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
#define GL_PALETTE8_RGB8_OES 0x8B95
#define GL_PALETTE8_RGBA8_OES 0x8B96
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
#define GL_PALETTE8_RGBA4_OES 0x8B98
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
#endif
/* GL_OES_depth24 */
#ifndef GL_OES_depth24
#define GL_DEPTH_COMPONENT24_OES 0x81A6
#endif
/* GL_OES_depth32 */
#ifndef GL_OES_depth32
#define GL_DEPTH_COMPONENT32_OES 0x81A7
#endif
/* GL_OES_depth_texture */
/* No new tokens introduced by this extension. */
/* GL_OES_EGL_image */
#ifndef GL_OES_EGL_image
typedef void* GLeglImageOES;
#endif
/* GL_OES_EGL_image_external */
#ifndef GL_OES_EGL_image_external
/* GLeglImageOES defined in GL_OES_EGL_image already. */
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
#define GL_SAMPLER_EXTERNAL_OES 0x8D66
#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
#endif
/* GL_OES_element_index_uint */
#ifndef GL_OES_element_index_uint
#define GL_UNSIGNED_INT 0x1405
#endif
/* GL_OES_get_program_binary */
#ifndef GL_OES_get_program_binary
#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
#endif
/* GL_OES_mapbuffer */
#ifndef GL_OES_mapbuffer
#define GL_WRITE_ONLY_OES 0x88B9
#define GL_BUFFER_ACCESS_OES 0x88BB
#define GL_BUFFER_MAPPED_OES 0x88BC
#define GL_BUFFER_MAP_POINTER_OES 0x88BD
#endif
/* GL_OES_packed_depth_stencil */
#ifndef GL_OES_packed_depth_stencil
#define GL_DEPTH_STENCIL_OES 0x84F9
#define GL_UNSIGNED_INT_24_8_OES 0x84FA
#define GL_DEPTH24_STENCIL8_OES 0x88F0
#endif
/* GL_OES_rgb8_rgba8 */
#ifndef GL_OES_rgb8_rgba8
#define GL_RGB8_OES 0x8051
#define GL_RGBA8_OES 0x8058
#endif
/* GL_OES_standard_derivatives */
#ifndef GL_OES_standard_derivatives
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
#endif
/* GL_OES_stencil1 */
#ifndef GL_OES_stencil1
#define GL_STENCIL_INDEX1_OES 0x8D46
#endif
/* GL_OES_stencil4 */
#ifndef GL_OES_stencil4
#define GL_STENCIL_INDEX4_OES 0x8D47
#endif
/* GL_OES_texture_3D */
#ifndef GL_OES_texture_3D
#define GL_TEXTURE_WRAP_R_OES 0x8072
#define GL_TEXTURE_3D_OES 0x806F
#define GL_TEXTURE_BINDING_3D_OES 0x806A
#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
#define GL_SAMPLER_3D_OES 0x8B5F
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
#endif
/* GL_OES_texture_float */
/* No new tokens introduced by this extension. */
/* GL_OES_texture_float_linear */
/* No new tokens introduced by this extension. */
/* GL_OES_texture_half_float */
#ifndef GL_OES_texture_half_float
#define GL_HALF_FLOAT_OES 0x8D61
#endif
/* GL_OES_texture_half_float_linear */
/* No new tokens introduced by this extension. */
/* GL_OES_texture_npot */
/* No new tokens introduced by this extension. */
/* GL_OES_vertex_array_object */
#ifndef GL_OES_vertex_array_object
#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
#endif
/* GL_OES_vertex_half_float */
/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
/* GL_OES_vertex_type_10_10_10_2 */
#ifndef GL_OES_vertex_type_10_10_10_2
#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
#define GL_INT_10_10_10_2_OES 0x8DF7
#endif
/*------------------------------------------------------------------------*
* AMD extension tokens
*------------------------------------------------------------------------*/
/* GL_AMD_compressed_3DC_texture */
#ifndef GL_AMD_compressed_3DC_texture
#define GL_3DC_X_AMD 0x87F9
#define GL_3DC_XY_AMD 0x87FA
#endif
/* GL_AMD_compressed_ATC_texture */
#ifndef GL_AMD_compressed_ATC_texture
#define GL_ATC_RGB_AMD 0x8C92
#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
#endif
/* GL_AMD_performance_monitor */
#ifndef GL_AMD_performance_monitor
#define GL_COUNTER_TYPE_AMD 0x8BC0
#define GL_COUNTER_RANGE_AMD 0x8BC1
#define GL_UNSIGNED_INT64_AMD 0x8BC2
#define GL_PERCENTAGE_AMD 0x8BC3
#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
#define GL_PERFMON_RESULT_AMD 0x8BC6
#endif
/* GL_AMD_program_binary_Z400 */
#ifndef GL_AMD_program_binary_Z400
#define GL_Z400_BINARY_AMD 0x8740
#endif
/*------------------------------------------------------------------------*
* ANGLE extension tokens
*------------------------------------------------------------------------*/
/* GL_ANGLE_framebuffer_blit */
#ifndef GL_ANGLE_framebuffer_blit
#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
#endif
/* GL_ANGLE_framebuffer_multisample */
#ifndef GL_ANGLE_framebuffer_multisample
#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
#define GL_MAX_SAMPLES_ANGLE 0x8D57
#endif
/*------------------------------------------------------------------------*
* APPLE extension tokens
*------------------------------------------------------------------------*/
/* GL_APPLE_rgb_422 */
#ifndef GL_APPLE_rgb_422
#define GL_RGB_422_APPLE 0x8A1F
#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
#endif
/* GL_APPLE_framebuffer_multisample */
#ifndef GL_APPLE_framebuffer_multisample
#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
#define GL_MAX_SAMPLES_APPLE 0x8D57
#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
#endif
/* GL_APPLE_texture_format_BGRA8888 */
#ifndef GL_APPLE_texture_format_BGRA8888
#define GL_BGRA_EXT 0x80E1
#endif
/* GL_APPLE_texture_max_level */
#ifndef GL_APPLE_texture_max_level
#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
#endif
/*------------------------------------------------------------------------*
* ARM extension tokens
*------------------------------------------------------------------------*/
/* GL_ARM_mali_shader_binary */
#ifndef GL_ARM_mali_shader_binary
#define GL_MALI_SHADER_BINARY_ARM 0x8F60
#endif
/* GL_ARM_rgba8 */
/* No new tokens introduced by this extension. */
/*------------------------------------------------------------------------*
* EXT extension tokens
*------------------------------------------------------------------------*/
/* GL_EXT_blend_minmax */
#ifndef GL_EXT_blend_minmax
#define GL_MIN_EXT 0x8007
#define GL_MAX_EXT 0x8008
#endif
/* GL_EXT_discard_framebuffer */
#ifndef GL_EXT_discard_framebuffer
#define GL_COLOR_EXT 0x1800
#define GL_DEPTH_EXT 0x1801
#define GL_STENCIL_EXT 0x1802
#endif
/* GL_EXT_multi_draw_arrays */
/* No new tokens introduced by this extension. */
/* GL_EXT_read_format_bgra */
#ifndef GL_EXT_read_format_bgra
#define GL_BGRA_EXT 0x80E1
#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
#endif
/* GL_EXT_texture_filter_anisotropic */
#ifndef GL_EXT_texture_filter_anisotropic
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
#endif
/* GL_EXT_texture_format_BGRA8888 */
#ifndef GL_EXT_texture_format_BGRA8888
#define GL_BGRA_EXT 0x80E1
#endif
/* GL_EXT_texture_type_2_10_10_10_REV */
#ifndef GL_EXT_texture_type_2_10_10_10_REV
#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
#endif
/* GL_EXT_texture_compression_dxt1 */
#ifndef GL_EXT_texture_compression_dxt1
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
#endif
/* GL_EXT_shader_texture_lod */
/* No new tokens introduced by this extension. */
/*------------------------------------------------------------------------*
* IMG extension tokens
*------------------------------------------------------------------------*/
/* GL_IMG_program_binary */
#ifndef GL_IMG_program_binary
#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
#endif
/* GL_IMG_read_format */
#ifndef GL_IMG_read_format
#define GL_BGRA_IMG 0x80E1
#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
#endif
/* GL_IMG_shader_binary */
#ifndef GL_IMG_shader_binary
#define GL_SGX_BINARY_IMG 0x8C0A
#endif
/* GL_IMG_texture_compression_pvrtc */
#ifndef GL_IMG_texture_compression_pvrtc
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
#endif
/* GL_IMG_multisampled_render_to_texture */
#ifndef GL_IMG_multisampled_render_to_texture
#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
#define GL_MAX_SAMPLES_IMG 0x9135
#define GL_TEXTURE_SAMPLES_IMG 0x9136
#endif
/*------------------------------------------------------------------------*
* NV extension tokens
*------------------------------------------------------------------------*/
/* GL_NV_fence */
#ifndef GL_NV_fence
#define GL_ALL_COMPLETED_NV 0x84F2
#define GL_FENCE_STATUS_NV 0x84F3
#define GL_FENCE_CONDITION_NV 0x84F4
#endif
/* GL_NV_coverage_sample */
#ifndef GL_NV_coverage_sample
#define GL_COVERAGE_COMPONENT_NV 0x8ED0
#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
#define GL_COVERAGE_BUFFERS_NV 0x8ED3
#define GL_COVERAGE_SAMPLES_NV 0x8ED4
#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
#define GL_COVERAGE_BUFFER_BIT_NV 0x8000
#endif
/* GL_NV_depth_nonlinear */
#ifndef GL_NV_depth_nonlinear
#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
#endif
/*------------------------------------------------------------------------*
* QCOM extension tokens
*------------------------------------------------------------------------*/
/* GL_QCOM_driver_control */
/* No new tokens introduced by this extension. */
/* GL_QCOM_extended_get */
#ifndef GL_QCOM_extended_get
#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
#define GL_TEXTURE_TYPE_QCOM 0x8BD7
#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
#define GL_TEXTURE_TARGET_QCOM 0x8BDA
#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
#define GL_STATE_RESTORE 0x8BDC
#endif
/* GL_QCOM_extended_get2 */
/* No new tokens introduced by this extension. */
/* GL_QCOM_perfmon_global_mode */
#ifndef GL_QCOM_perfmon_global_mode
#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
#endif
/* GL_QCOM_writeonly_rendering */
#ifndef GL_QCOM_writeonly_rendering
#define GL_WRITEONLY_RENDERING_QCOM 0x8823
#endif
/* GL_QCOM_tiled_rendering */
#ifndef GL_QCOM_tiled_rendering
#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
#endif
/*------------------------------------------------------------------------*
* VIV extension tokens
*------------------------------------------------------------------------*/
/* GL_VIV_shader_binary */
#ifndef GL_VIV_shader_binary
#define GL_SHADER_BINARY_VIV 0x8FC4
#endif
/*------------------------------------------------------------------------*
* End of extension tokens, start of corresponding extension functions
*------------------------------------------------------------------------*/
/*------------------------------------------------------------------------*
* OES extension functions
*------------------------------------------------------------------------*/
/* GL_OES_compressed_ETC1_RGB8_texture */
#ifndef GL_OES_compressed_ETC1_RGB8_texture
#define GL_OES_compressed_ETC1_RGB8_texture 1
#endif
/* GL_OES_compressed_paletted_texture */
#ifndef GL_OES_compressed_paletted_texture
#define GL_OES_compressed_paletted_texture 1
#endif
/* GL_OES_depth24 */
#ifndef GL_OES_depth24
#define GL_OES_depth24 1
#endif
/* GL_OES_depth32 */
#ifndef GL_OES_depth32
#define GL_OES_depth32 1
#endif
/* GL_OES_depth_texture */
#ifndef GL_OES_depth_texture
#define GL_OES_depth_texture 1
#endif
/* GL_OES_EGL_image */
#ifndef GL_OES_EGL_image
#define GL_OES_EGL_image 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
#endif
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
#endif
/* GL_OES_EGL_image_external */
#ifndef GL_OES_EGL_image_external
#define GL_OES_EGL_image_external 1
/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */
#endif
/* GL_OES_element_index_uint */
#ifndef GL_OES_element_index_uint
#define GL_OES_element_index_uint 1
#endif
/* GL_OES_fbo_render_mipmap */
#ifndef GL_OES_fbo_render_mipmap
#define GL_OES_fbo_render_mipmap 1
#endif
/* GL_OES_fragment_precision_high */
#ifndef GL_OES_fragment_precision_high
#define GL_OES_fragment_precision_high 1
#endif
/* GL_OES_get_program_binary */
#ifndef GL_OES_get_program_binary
#define GL_OES_get_program_binary 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
#endif
typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
#endif
/* GL_OES_mapbuffer */
#ifndef GL_OES_mapbuffer
#define GL_OES_mapbuffer 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params);
#endif
typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params);
#endif
/* GL_OES_packed_depth_stencil */
#ifndef GL_OES_packed_depth_stencil
#define GL_OES_packed_depth_stencil 1
#endif
/* GL_OES_rgb8_rgba8 */
#ifndef GL_OES_rgb8_rgba8
#define GL_OES_rgb8_rgba8 1
#endif
/* GL_OES_standard_derivatives */
#ifndef GL_OES_standard_derivatives
#define GL_OES_standard_derivatives 1
#endif
/* GL_OES_stencil1 */
#ifndef GL_OES_stencil1
#define GL_OES_stencil1 1
#endif
/* GL_OES_stencil4 */
#ifndef GL_OES_stencil4
#define GL_OES_stencil4 1
#endif
/* GL_OES_texture_3D */
#ifndef GL_OES_texture_3D
#define GL_OES_texture_3D 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
#endif
typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
#endif
/* GL_OES_texture_float */
#ifndef GL_OES_texture_float
#define GL_OES_texture_float 1
#endif
/* GL_OES_texture_float_linear */
#ifndef GL_OES_texture_float_linear
#define GL_OES_texture_float_linear 1
#endif
/* GL_OES_texture_half_float */
#ifndef GL_OES_texture_half_float
#define GL_OES_texture_half_float 1
#endif
/* GL_OES_texture_half_float_linear */
#ifndef GL_OES_texture_half_float_linear
#define GL_OES_texture_half_float_linear 1
#endif
/* GL_OES_texture_npot */
#ifndef GL_OES_texture_npot
#define GL_OES_texture_npot 1
#endif
/* GL_OES_vertex_array_object */
#ifndef GL_OES_vertex_array_object
#define GL_OES_vertex_array_object 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
#endif
typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
#endif
/* GL_OES_vertex_half_float */
#ifndef GL_OES_vertex_half_float
#define GL_OES_vertex_half_float 1
#endif
/* GL_OES_vertex_type_10_10_10_2 */
#ifndef GL_OES_vertex_type_10_10_10_2
#define GL_OES_vertex_type_10_10_10_2 1
#endif
/*------------------------------------------------------------------------*
* AMD extension functions
*------------------------------------------------------------------------*/
/* GL_AMD_compressed_3DC_texture */
#ifndef GL_AMD_compressed_3DC_texture
#define GL_AMD_compressed_3DC_texture 1
#endif
/* GL_AMD_compressed_ATC_texture */
#ifndef GL_AMD_compressed_ATC_texture
#define GL_AMD_compressed_ATC_texture 1
#endif
/* AMD_performance_monitor */
#ifndef GL_AMD_performance_monitor
#define GL_AMD_performance_monitor 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
#endif
typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
#endif
/* GL_AMD_program_binary_Z400 */
#ifndef GL_AMD_program_binary_Z400
#define GL_AMD_program_binary_Z400 1
#endif
/*------------------------------------------------------------------------*
* ANGLE extension functions
*------------------------------------------------------------------------*/
/* GL_ANGLE_framebuffer_blit */
#ifndef GL_ANGLE_framebuffer_blit
#define GL_ANGLE_framebuffer_blit 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
/* GL_ANGLE_framebuffer_multisample */
#ifndef GL_ANGLE_framebuffer_multisample
#define GL_ANGLE_framebuffer_multisample 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
#endif
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
#endif
/*------------------------------------------------------------------------*
* APPLE extension functions
*------------------------------------------------------------------------*/
/* GL_APPLE_rgb_422 */
#ifndef GL_APPLE_rgb_422
#define GL_APPLE_rgb_422 1
#endif
/* GL_APPLE_framebuffer_multisample */
#ifndef GL_APPLE_framebuffer_multisample
#define GL_APPLE_framebuffer_multisample 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
#endif
/* GL_APPLE_texture_format_BGRA8888 */
#ifndef GL_APPLE_texture_format_BGRA8888
#define GL_APPLE_texture_format_BGRA8888 1
#endif
/* GL_APPLE_texture_max_level */
#ifndef GL_APPLE_texture_max_level
#define GL_APPLE_texture_max_level 1
#endif
/*------------------------------------------------------------------------*
* ARM extension functions
*------------------------------------------------------------------------*/
/* GL_ARM_mali_shader_binary */
#ifndef GL_ARM_mali_shader_binary
#define GL_ARM_mali_shader_binary 1
#endif
/* GL_ARM_rgba8 */
#ifndef GL_ARM_rgba8
#define GL_ARM_rgba8 1
#endif
/*------------------------------------------------------------------------*
* EXT extension functions
*------------------------------------------------------------------------*/
/* GL_EXT_blend_minmax */
#ifndef GL_EXT_blend_minmax
#define GL_EXT_blend_minmax 1
#endif
/* GL_EXT_discard_framebuffer */
#ifndef GL_EXT_discard_framebuffer
#define GL_EXT_discard_framebuffer 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
#endif
typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
#endif
#ifndef GL_EXT_multi_draw_arrays
#define GL_EXT_multi_draw_arrays 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
#endif
/* GL_EXT_read_format_bgra */
#ifndef GL_EXT_read_format_bgra
#define GL_EXT_read_format_bgra 1
#endif
/* GL_EXT_texture_filter_anisotropic */
#ifndef GL_EXT_texture_filter_anisotropic
#define GL_EXT_texture_filter_anisotropic 1
#endif
/* GL_EXT_texture_format_BGRA8888 */
#ifndef GL_EXT_texture_format_BGRA8888
#define GL_EXT_texture_format_BGRA8888 1
#endif
/* GL_EXT_texture_type_2_10_10_10_REV */
#ifndef GL_EXT_texture_type_2_10_10_10_REV
#define GL_EXT_texture_type_2_10_10_10_REV 1
#endif
/* GL_EXT_texture_compression_dxt1 */
#ifndef GL_EXT_texture_compression_dxt1
#define GL_EXT_texture_compression_dxt1 1
#endif
/* GL_EXT_shader_texture_lod */
#ifndef GL_EXT_shader_texture_lod
#define GL_EXT_shader_texture_lod 1
#endif
/*------------------------------------------------------------------------*
* IMG extension functions
*------------------------------------------------------------------------*/
/* GL_IMG_program_binary */
#ifndef GL_IMG_program_binary
#define GL_IMG_program_binary 1
#endif
/* GL_IMG_read_format */
#ifndef GL_IMG_read_format
#define GL_IMG_read_format 1
#endif
/* GL_IMG_shader_binary */
#ifndef GL_IMG_shader_binary
#define GL_IMG_shader_binary 1
#endif
/* GL_IMG_texture_compression_pvrtc */
#ifndef GL_IMG_texture_compression_pvrtc
#define GL_IMG_texture_compression_pvrtc 1
#endif
/* GL_IMG_multisampled_render_to_texture */
#ifndef GL_IMG_multisampled_render_to_texture
#define GL_IMG_multisampled_render_to_texture 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
#endif
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
#endif
/*------------------------------------------------------------------------*
* NV extension functions
*------------------------------------------------------------------------*/
/* GL_NV_fence */
#ifndef GL_NV_fence
#define GL_NV_fence 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *);
GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *);
GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint);
GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint);
GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *);
GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint);
GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum);
#endif
typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
#endif
/* GL_NV_coverage_sample */
#ifndef GL_NV_coverage_sample
#define GL_NV_coverage_sample 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
#endif
typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
#endif
/* GL_NV_depth_nonlinear */
#ifndef GL_NV_depth_nonlinear
#define GL_NV_depth_nonlinear 1
#endif
/*------------------------------------------------------------------------*
* QCOM extension functions
*------------------------------------------------------------------------*/
/* GL_QCOM_driver_control */
#ifndef GL_QCOM_driver_control
#define GL_QCOM_driver_control 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
#endif
typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
#endif
/* GL_QCOM_extended_get */
#ifndef GL_QCOM_extended_get
#define GL_QCOM_extended_get 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params);
#endif
typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params);
#endif
/* GL_QCOM_extended_get2 */
#ifndef GL_QCOM_extended_get2
#define GL_QCOM_extended_get2 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
#endif
typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
#endif
/* GL_QCOM_perfmon_global_mode */
#ifndef GL_QCOM_perfmon_global_mode
#define GL_QCOM_perfmon_global_mode 1
#endif
/* GL_QCOM_writeonly_rendering */
#ifndef GL_QCOM_writeonly_rendering
#define GL_QCOM_writeonly_rendering 1
#endif
/* GL_QCOM_tiled_rendering */
#ifndef GL_QCOM_tiled_rendering
#define GL_QCOM_tiled_rendering 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
#endif
typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
#endif
/*------------------------------------------------------------------------*
* VIV extension tokens
*------------------------------------------------------------------------*/
/* GL_VIV_shader_binary */
#ifndef GL_VIV_shader_binary
#define GL_VIV_shader_binary 1
#endif
#ifdef __cplusplus
}
#endif
#endif /* __gl2ext_h_ */

View File

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

View File

@@ -1,72 +0,0 @@
/*
* 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 _FRAMEBUFFER_DATA_H
#define _FRAMEBUFFER_DATA_H
#include "objectNameManager.h"
#include <GLES/gl.h>
#include <GLES/glext.h>
class RenderbufferData : public ObjectData
{
public:
RenderbufferData();
~RenderbufferData();
unsigned int sourceEGLImage;
void (*eglImageDetach)(unsigned int imageId);
GLuint attachedFB;
GLenum attachedPoint;
GLuint eglImageGlobalTexName;
};
const int MAX_ATTACH_POINTS = 3;
class FramebufferData : public ObjectData
{
public:
explicit FramebufferData(GLuint name);
~FramebufferData();
void setAttachment(GLenum attachment,
GLenum target,
GLuint name,
ObjectDataPtr obj,
bool takeOwnership = false);
GLuint getAttachment(GLenum attachment,
GLenum *outTarget,
ObjectDataPtr *outObj);
void validate(class GLEScontext* ctx);
private:
inline int attachmentPointIndex(GLenum attachment);
void detachObject(int idx);
private:
GLuint m_fbName;
struct attachPoint {
GLenum target; // OGL if owned, GLES otherwise
GLuint name; // OGL if owned, GLES otherwise
ObjectDataPtr obj;
bool owned;
} m_attachPoints[MAX_ATTACH_POINTS+1];
bool m_dirty;
};
#endif

View File

@@ -1,267 +0,0 @@
/*
* 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 GLDISPATCHH
#define GLDISPATCHH
#include <GLES/gl.h>
#include <GLES2/gl2.h>
#include <utils/threads.h>
#include "gldefs.h"
#include "GLutils.h"
#define GLAPIENTRY GL_APIENTRY
typedef void(*FUNCPTR)();
class GLDispatch
{
public:
GLDispatch();
void dispatchFuncs(GLESVersion version);
/* OpenGL functions which are needed for implementing BOTH GLES 1.1 & GLES 2.0*/
static void (GLAPIENTRY *glActiveTexture) ( GLenum texture );
static void (GLAPIENTRY *glBindBuffer) (GLenum target, GLuint buffer);
static void (GLAPIENTRY *glBindTexture) (GLenum target, GLuint texture);
static void (GLAPIENTRY *glBlendFunc) (GLenum sfactor, GLenum dfactor);
static void (GLAPIENTRY *glBlendEquation)( GLenum mode );
static void (GLAPIENTRY *glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
static void (GLAPIENTRY *glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
static void (GLAPIENTRY *glBufferData) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
static void (GLAPIENTRY *glBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
static void (GLAPIENTRY *glClear) (GLbitfield mask);
static void (GLAPIENTRY *glClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
static void (GLAPIENTRY *glClearStencil) (GLint s);
static void (GLAPIENTRY *glColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
static void (GLAPIENTRY *glCompressedTexImage2D) ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
static void (GLAPIENTRY *glCompressedTexSubImage2D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
static void (GLAPIENTRY *glCopyTexImage2D) (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
static void (GLAPIENTRY *glCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
static void (GLAPIENTRY *glCullFace) (GLenum mode);
static void (GLAPIENTRY *glDeleteBuffers) (GLsizei n, const GLuint *buffers);
static void (GLAPIENTRY *glDeleteTextures) (GLsizei n, const GLuint *textures);
static void (GLAPIENTRY *glDepthFunc) (GLenum func);
static void (GLAPIENTRY *glDepthMask) (GLboolean flag);
static void (GLAPIENTRY *glDepthRange) (GLclampd zNear, GLclampd zFar);
static void (GLAPIENTRY *glDisable) (GLenum cap);
static void (GLAPIENTRY *glDrawArrays) (GLenum mode, GLint first, GLsizei count);
static void (GLAPIENTRY *glDrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
static void (GLAPIENTRY *glEnable) (GLenum cap);
static void (GLAPIENTRY *glFinish) (void);
static void (GLAPIENTRY *glFlush) (void);
static void (GLAPIENTRY *glFrontFace) (GLenum mode);
static void (GLAPIENTRY *glGenBuffers) (GLsizei n, GLuint *buffers);
static void (GLAPIENTRY *glGenTextures) (GLsizei n, GLuint *textures);
static void (GLAPIENTRY *glGetBooleanv) (GLenum pname, GLboolean *params);
static void (GLAPIENTRY *glGetBufferParameteriv) (GLenum, GLenum, GLint *);
static GLenum (GLAPIENTRY *glGetError) (void);
static void (GLAPIENTRY *glGetFloatv) (GLenum pname, GLfloat *params);
static void (GLAPIENTRY *glGetIntegerv) (GLenum pname, GLint *params);
static const GLubyte * (GLAPIENTRY *glGetString) (GLenum name);
static void (GLAPIENTRY *glGetTexParameterfv) (GLenum target, GLenum pname, GLfloat *params);
static void (GLAPIENTRY *glGetTexParameteriv) (GLenum target, GLenum pname, GLint *params);
static void (GLAPIENTRY *glGetTexLevelParameteriv) (GLenum target, GLint level, GLenum pname, GLint *params);
static void (GLAPIENTRY *glHint) (GLenum target, GLenum mode);
static GLboolean (GLAPIENTRY *glIsBuffer) (GLuint);
static GLboolean (GLAPIENTRY *glIsEnabled) (GLenum cap);
static GLboolean (GLAPIENTRY *glIsTexture) (GLuint texture);
static void (GLAPIENTRY *glLineWidth) (GLfloat width);
static void (GLAPIENTRY *glPolygonOffset) (GLfloat factor, GLfloat units);
static void (GLAPIENTRY *glPixelStorei) (GLenum pname, GLint param);
static void (GLAPIENTRY *glReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
static void (GLAPIENTRY *glSampleCoverage) ( GLclampf value, GLboolean invert );
static void (GLAPIENTRY *glScissor) (GLint x, GLint y, GLsizei width, GLsizei height);
static void (GLAPIENTRY *glStencilFunc) (GLenum func, GLint ref, GLuint mask);
static void (GLAPIENTRY *glStencilMask) (GLuint mask);
static void (GLAPIENTRY *glStencilOp) (GLenum fail, GLenum zfail, GLenum zpass);
static void (GLAPIENTRY *glTexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
static void (GLAPIENTRY *glTexParameteri) (GLenum target, GLenum pname, GLint param);
static void (GLAPIENTRY *glTexParameteriv) (GLenum target, GLenum pname, const GLint *params);
static void (GLAPIENTRY *glTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
static void (GLAPIENTRY *glViewport) (GLint x, GLint y, GLsizei width, GLsizei height);
static void (GLAPIENTRY *glPushAttrib) ( GLbitfield mask );
static void (GLAPIENTRY *glPopAttrib) ( void );
static void (GLAPIENTRY *glPushClientAttrib) ( GLbitfield mask );
static void (GLAPIENTRY *glPopClientAttrib) ( void );
static GLboolean (GLAPIENTRY *glIsRenderbufferEXT) (GLuint renderbuffer);
static void (GLAPIENTRY *glBindRenderbufferEXT) (GLenum target, GLuint renderbuffer);
static void (GLAPIENTRY *glDeleteRenderbuffersEXT) (GLsizei n, const GLuint *renderbuffers);
static void (GLAPIENTRY *glGenRenderbuffersEXT) (GLsizei n, GLuint *renderbuffers);
static void (GLAPIENTRY *glRenderbufferStorageEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
static void (GLAPIENTRY *glGetRenderbufferParameterivEXT) (GLenum target, GLenum pname, GLint *params);
static GLboolean (GLAPIENTRY *glIsFramebufferEXT) (GLuint framebuffer);
static void (GLAPIENTRY *glBindFramebufferEXT) (GLenum target, GLuint framebuffer);
static void (GLAPIENTRY *glDeleteFramebuffersEXT) (GLsizei n, const GLuint *framebuffers);
static void (GLAPIENTRY *glGenFramebuffersEXT) (GLsizei n, GLuint *framebuffers);
static GLenum (GLAPIENTRY *glCheckFramebufferStatusEXT) (GLenum target);
static void (GLAPIENTRY *glFramebufferTexture1DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
static void (GLAPIENTRY *glFramebufferTexture2DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
static void (GLAPIENTRY *glFramebufferTexture3DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
static void (GLAPIENTRY *glFramebufferRenderbufferEXT) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
static void (GLAPIENTRY *glGetFramebufferAttachmentParameterivEXT) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
static void (GLAPIENTRY *glGenerateMipmapEXT) (GLenum target);
/* OpenGL functions which are needed ONLY for implementing GLES 1.1*/
static void (GLAPIENTRY *glAlphaFunc) (GLenum func, GLclampf ref);
static void (GLAPIENTRY *glBegin)( GLenum mode );
static void (GLAPIENTRY *glClearDepth) (GLclampd depth);
static void (GLAPIENTRY *glClientActiveTexture) ( GLenum texture );
static void (GLAPIENTRY *glClipPlane) (GLenum plane, const GLdouble *equation);
static void (GLAPIENTRY *glColor4d) (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
static void (GLAPIENTRY *glColor4f) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
static void (GLAPIENTRY *glColor4fv) ( const GLfloat *v );
static void (GLAPIENTRY *glColor4ub) (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
static void (GLAPIENTRY *glColor4ubv) ( const GLubyte *v );
static void (GLAPIENTRY *glColorPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
static void (GLAPIENTRY *glDisableClientState) (GLenum array);
static void (GLAPIENTRY *glEnableClientState) (GLenum array);
static void (GLAPIENTRY *glEnd) (void);
static void (GLAPIENTRY *glFogf) (GLenum pname, GLfloat param);
static void (GLAPIENTRY *glFogfv) (GLenum pname, const GLfloat *params);
static void (GLAPIENTRY *glFrustum) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
static void (GLAPIENTRY *glGetClipPlane) (GLenum plane, GLdouble *equation);
static void (GLAPIENTRY *glGetDoublev) ( GLenum pname, GLdouble *params );
static void (GLAPIENTRY *glGetLightfv) (GLenum light, GLenum pname, GLfloat *params);
static void (GLAPIENTRY *glGetMaterialfv) (GLenum face, GLenum pname, GLfloat *params);
static void (GLAPIENTRY *glGetPointerv) (GLenum pname, GLvoid* *params);
static void (GLAPIENTRY *glGetTexEnvfv) (GLenum target, GLenum pname, GLfloat *params);
static void (GLAPIENTRY *glGetTexEnviv) (GLenum target, GLenum pname, GLint *params);
static void (GLAPIENTRY *glLightf) (GLenum light, GLenum pname, GLfloat param);
static void (GLAPIENTRY *glLightfv) (GLenum light, GLenum pname, const GLfloat *params);
static void (GLAPIENTRY *glLightModelf) (GLenum pname, GLfloat param);
static void (GLAPIENTRY *glLightModelfv) (GLenum pname, const GLfloat *params);
static void (GLAPIENTRY *glLoadIdentity) (void);
static void (GLAPIENTRY *glLoadMatrixf) (const GLfloat *m);
static void (GLAPIENTRY *glLogicOp) (GLenum opcode);
static void (GLAPIENTRY *glMaterialf) (GLenum face, GLenum pname, GLfloat param);
static void (GLAPIENTRY *glMaterialfv) (GLenum face, GLenum pname, const GLfloat *params);
static void (GLAPIENTRY *glMultiTexCoord2fv) ( GLenum target, const GLfloat *v );
static void (GLAPIENTRY *glMultiTexCoord2sv) ( GLenum target, const GLshort *v );
static void (GLAPIENTRY *glMultiTexCoord3fv) ( GLenum target, const GLfloat *v );
static void (GLAPIENTRY *glMultiTexCoord3sv) ( GLenum target, const GLshort *v );
static void (GLAPIENTRY *glMultiTexCoord4f) ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
static void (GLAPIENTRY *glMultiTexCoord4fv) ( GLenum target, const GLfloat *v );
static void (GLAPIENTRY *glMultiTexCoord4sv) ( GLenum target, const GLshort *v );
static void (GLAPIENTRY *glMultMatrixf) (const GLfloat *m);
static void (GLAPIENTRY *glNormal3f) (GLfloat nx, GLfloat ny, GLfloat nz);
static void (GLAPIENTRY *glNormal3fv) ( const GLfloat *v );
static void (GLAPIENTRY *glNormal3sv) ( const GLshort *v );
static void (GLAPIENTRY *glOrtho) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
static void (GLAPIENTRY *glPointParameterf) (GLenum, GLfloat);
static void (GLAPIENTRY *glPointParameterfv) (GLenum, const GLfloat *);
static void (GLAPIENTRY *glPointSize) (GLfloat size);
static void (GLAPIENTRY *glRotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
static void (GLAPIENTRY *glScalef) (GLfloat x, GLfloat y, GLfloat z);
static void (GLAPIENTRY *glTexEnvf) (GLenum target, GLenum pname, GLfloat param);
static void (GLAPIENTRY *glTexEnvfv) (GLenum target, GLenum pname, const GLfloat *params);
static void (GLAPIENTRY *glTexParameterf) (GLenum target, GLenum pname, GLfloat param);
static void (GLAPIENTRY *glTexParameterfv) (GLenum target, GLenum pname, const GLfloat *params);
static void (GLAPIENTRY *glMatrixMode) (GLenum mode);
static void (GLAPIENTRY *glNormalPointer) (GLenum type, GLsizei stride, const GLvoid *pointer);
static void (GLAPIENTRY *glPopMatrix) (void);
static void (GLAPIENTRY *glPushMatrix) (void);
static void (GLAPIENTRY *glShadeModel) (GLenum mode);
static void (GLAPIENTRY *glTexCoordPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
static void (GLAPIENTRY *glTexEnvi) (GLenum target, GLenum pname, GLint param);
static void (GLAPIENTRY *glTexEnviv) (GLenum target, GLenum pname, const GLint *params);
static void (GLAPIENTRY *glTranslatef) (GLfloat x, GLfloat y, GLfloat z);
static void (GLAPIENTRY *glVertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
/* OpenGL functions which are needed ONLY for implementing GLES 1.1 EXTENSIONS*/
static void (GLAPIENTRY *glCurrentPaletteMatrixARB) (GLint index);
static void (GLAPIENTRY *glMatrixIndexuivARB) (GLint size, GLuint * indices);
static void (GLAPIENTRY *glMatrixIndexPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
static void (GLAPIENTRY *glWeightPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
static void (GLAPIENTRY *glTexGenf) (GLenum coord, GLenum pname, GLfloat param );
static void (GLAPIENTRY *glTexGeni) (GLenum coord, GLenum pname, GLint param );
static void (GLAPIENTRY *glTexGenfv) (GLenum coord, GLenum pname, const GLfloat *params );
static void (GLAPIENTRY *glTexGeniv) (GLenum coord, GLenum pname, const GLint *params );
static void (GLAPIENTRY *glGetTexGenfv) (GLenum coord, GLenum pname, GLfloat *params );
static void (GLAPIENTRY *glGetTexGeniv) (GLenum coord, GLenum pname, GLint *params );
/* Loading OpenGL functions which are needed ONLY for implementing GLES 2.0*/
static void (GL_APIENTRY *glBlendColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
static void (GL_APIENTRY *glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask);
static void (GL_APIENTRY *glStencilMaskSeparate)(GLenum face, GLuint mask);
static GLboolean (GL_APIENTRY *glIsProgram)(GLuint program);
static GLboolean (GL_APIENTRY *glIsShader)(GLuint shader);
static void (GL_APIENTRY *glVertexAttrib1f)(GLuint indx, GLfloat x);
static void (GL_APIENTRY *glVertexAttrib1fv)(GLuint indx, const GLfloat* values);
static void (GL_APIENTRY *glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y);
static void (GL_APIENTRY *glVertexAttrib2fv)(GLuint indx, const GLfloat* values);
static void (GL_APIENTRY *glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
static void (GL_APIENTRY *glVertexAttrib3fv)(GLuint indx, const GLfloat* values);
static void (GL_APIENTRY *glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
static void (GL_APIENTRY *glVertexAttrib4fv)(GLuint indx, const GLfloat* values);
static void (GL_APIENTRY *glVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
static void (GL_APIENTRY *glDisableVertexAttribArray)(GLuint index);
static void (GL_APIENTRY *glEnableVertexAttribArray)(GLuint index);
static void (GL_APIENTRY *glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params);
static void (GL_APIENTRY *glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params);
static void (GL_APIENTRY *glGetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid** pointer);
static void (GL_APIENTRY *glUniform1f)(GLint location, GLfloat x);
static void (GL_APIENTRY *glUniform1fv)(GLint location, GLsizei count, const GLfloat* v);
static void (GL_APIENTRY *glUniform1i)(GLint location, GLint x);
static void (GL_APIENTRY *glUniform1iv)(GLint location, GLsizei count, const GLint* v);
static void (GL_APIENTRY *glUniform2f)(GLint location, GLfloat x, GLfloat y);
static void (GL_APIENTRY *glUniform2fv)(GLint location, GLsizei count, const GLfloat* v);
static void (GL_APIENTRY *glUniform2i)(GLint location, GLint x, GLint y);
static void (GL_APIENTRY *glUniform2iv)(GLint location, GLsizei count, const GLint* v);
static void (GL_APIENTRY *glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z);
static void (GL_APIENTRY *glUniform3fv)(GLint location, GLsizei count, const GLfloat* v);
static void (GL_APIENTRY *glUniform3i)(GLint location, GLint x, GLint y, GLint z);
static void (GL_APIENTRY *glUniform3iv)(GLint location, GLsizei count, const GLint* v);
static void (GL_APIENTRY *glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
static void (GL_APIENTRY *glUniform4fv)(GLint location, GLsizei count, const GLfloat* v);
static void (GL_APIENTRY *glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w);
static void (GL_APIENTRY *glUniform4iv)(GLint location, GLsizei count, const GLint* v);
static void (GL_APIENTRY *glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
static void (GL_APIENTRY *glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
static void (GL_APIENTRY *glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
static void (GL_APIENTRY *glAttachShader)(GLuint program, GLuint shader);
static void (GL_APIENTRY *glBindAttribLocation)(GLuint program, GLuint index, const GLchar* name);
static void (GL_APIENTRY *glCompileShader)(GLuint shader);
static GLuint (GL_APIENTRY *glCreateProgram)(void);
static GLuint (GL_APIENTRY *glCreateShader)(GLenum type);
static void (GL_APIENTRY *glDeleteProgram)(GLuint program);
static void (GL_APIENTRY *glDeleteShader)(GLuint shader);
static void (GL_APIENTRY *glDetachShader)(GLuint program, GLuint shader);
static void (GL_APIENTRY *glLinkProgram)(GLuint program);
static void (GL_APIENTRY *glUseProgram)(GLuint program);
static void (GL_APIENTRY *glValidateProgram)(GLuint program);
static void (GL_APIENTRY *glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
static void (GL_APIENTRY *glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
static void (GL_APIENTRY *glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
static int (GL_APIENTRY *glGetAttribLocation)(GLuint program, const GLchar* name);
static void (GL_APIENTRY *glGetProgramiv)(GLuint program, GLenum pname, GLint* params);
static void (GL_APIENTRY *glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
static void (GL_APIENTRY *glGetShaderiv)(GLuint shader, GLenum pname, GLint* params);
static void (GL_APIENTRY *glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
static void (GL_APIENTRY *glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
static void (GL_APIENTRY *glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
static void (GL_APIENTRY *glGetUniformfv)(GLuint program, GLint location, GLfloat* params);
static void (GL_APIENTRY *glGetUniformiv)(GLuint program, GLint location, GLint* params);
static int (GL_APIENTRY *glGetUniformLocation)(GLuint program, const GLchar* name);
static void (GL_APIENTRY *glReleaseShaderCompiler)(void);
static void (GL_APIENTRY *glShaderBinary)(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
static void (GL_APIENTRY *glShaderSource)(GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
private:
bool m_isLoaded;
static android::Mutex s_lock;
};
#endif

View File

@@ -1,47 +0,0 @@
/*
* 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 GLES_BUFFER_H
#define GLES_BUFFER_H
#include <stdio.h>
#include <GLES/gl.h>
#include <GLcommon/objectNameManager.h>
#include <GLcommon/RangeManip.h>
class GLESbuffer: public ObjectData {
public:
GLESbuffer():ObjectData(BUFFER_DATA),m_size(0),m_usage(GL_STATIC_DRAW),m_data(NULL),m_wasBound(false){}
GLuint getSize(){return m_size;};
GLuint getUsage(){return m_usage;};
GLvoid* getData(){ return m_data;}
bool setBuffer(GLuint size,GLuint usage,const GLvoid* data);
bool setSubBuffer(GLint offset,GLuint size,const GLvoid* data);
void getConversions(const RangeList& rIn,RangeList& rOut);
bool fullyConverted(){return m_conversionManager.size() == 0;};
void setBinded(){m_wasBound = true;};
bool wasBinded(){return m_wasBound;};
~GLESbuffer();
private:
GLuint m_size;
GLuint m_usage;
unsigned char* m_data;
RangeList m_conversionManager;
bool m_wasBound;
};
typedef SmartPtr<GLESbuffer> GLESbufferPtr;
#endif

View File

@@ -1,195 +0,0 @@
#ifndef GLES_CONTEXT_H
#define GLES_CONTEXT_H
#include "GLDispatch.h"
#include "GLESpointer.h"
#include "objectNameManager.h"
#include <utils/threads.h>
#include <string>
typedef std::map<GLenum,GLESpointer*> ArraysMap;
enum TextureTarget {
TEXTURE_2D,
TEXTURE_CUBE_MAP,
NUM_TEXTURE_TARGETS
};
typedef struct _textureTargetState {
GLuint texture;
GLboolean enabled;
} textureTargetState;
typedef textureTargetState textureUnitState[NUM_TEXTURE_TARGETS];
class Version{
public:
Version();
Version(int major,int minor,int release);
Version(const char* versionString);
Version(const Version& ver);
bool operator<(const Version& ver) const;
Version& operator=(const Version& ver);
private:
int m_major;
int m_minor;
int m_release;
};
struct GLSupport {
GLSupport():maxLights(0),maxVertexAttribs(0),maxClipPlane(0),maxTexUnits(0), \
maxTexImageUnits(0),maxTexSize(0) , \
GL_EXT_TEXTURE_FORMAT_BGRA8888(false), GL_EXT_FRAMEBUFFER_OBJECT(false), \
GL_ARB_VERTEX_BLEND(false), GL_ARB_MATRIX_PALETTE(false), \
GL_EXT_PACKED_DEPTH_STENCIL(false) , GL_OES_READ_FORMAT(false), \
GL_ARB_HALF_FLOAT_PIXEL(false), GL_NV_HALF_FLOAT(false), \
GL_ARB_HALF_FLOAT_VERTEX(false),GL_SGIS_GENERATE_MIPMAP(false),
GL_ARB_ES2_COMPATIBILITY(false),GL_OES_STANDARD_DERIVATIVES(false) {} ;
int maxLights;
int maxVertexAttribs;
int maxClipPlane;
int maxTexUnits;
int maxTexImageUnits;
int maxTexSize;
Version glslVersion;
bool GL_EXT_TEXTURE_FORMAT_BGRA8888;
bool GL_EXT_FRAMEBUFFER_OBJECT;
bool GL_ARB_VERTEX_BLEND;
bool GL_ARB_MATRIX_PALETTE;
bool GL_EXT_PACKED_DEPTH_STENCIL;
bool GL_OES_READ_FORMAT;
bool GL_ARB_HALF_FLOAT_PIXEL;
bool GL_NV_HALF_FLOAT;
bool GL_ARB_HALF_FLOAT_VERTEX;
bool GL_SGIS_GENERATE_MIPMAP;
bool GL_ARB_ES2_COMPATIBILITY;
bool GL_OES_STANDARD_DERIVATIVES;
};
struct ArrayData{
ArrayData():data(NULL),
type(0),
stride(0),
allocated(false){};
void* data;
GLenum type;
unsigned int stride;
bool allocated;
};
class GLESConversionArrays
{
public:
GLESConversionArrays():m_current(0){};
void setArr(void* data,unsigned int stride,GLenum type);
void allocArr(unsigned int size,GLenum type);
ArrayData& operator[](int i);
void* getCurrentData();
ArrayData& getCurrentArray();
unsigned int getCurrentIndex();
void operator++();
~GLESConversionArrays();
private:
std::map<GLenum,ArrayData> m_arrays;
unsigned int m_current;
};
class GLEScontext{
public:
virtual void init();
GLEScontext();
GLenum getGLerror();
void setGLerror(GLenum err);
void setShareGroup(ShareGroupPtr grp){m_shareGroup = grp;};
ShareGroupPtr shareGroup() const { return m_shareGroup; }
virtual void setActiveTexture(GLenum tex);
unsigned int getBindedTexture(GLenum target);
unsigned int getBindedTexture(GLenum unit,GLenum target);
void setBindedTexture(GLenum target,unsigned int tex);
bool isTextureUnitEnabled(GLenum unit);
void setTextureEnabled(GLenum target, GLenum enable);
ObjectLocalName getDefaultTextureName(GLenum target);
bool isInitialized() { return m_initialized; };
void setUnpackAlignment(GLint param){ m_unpackAlignment = param; };
GLint getUnpackAlignment(){ return m_unpackAlignment; };
bool isArrEnabled(GLenum);
void enableArr(GLenum arr,bool enable);
const GLvoid* setPointer(GLenum arrType,GLint size,GLenum type,GLsizei stride,const GLvoid* data,bool normalize = false);
virtual const GLESpointer* getPointer(GLenum arrType);
virtual void setupArraysPointers(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct) = 0;
void bindBuffer(GLenum target,GLuint buffer);
void unbindBuffer(GLuint buffer);
bool isBuffer(GLuint buffer);
bool isBindedBuffer(GLenum target);
GLvoid* getBindedBuffer(GLenum target);
void getBufferSize(GLenum target,GLint* param);
void getBufferUsage(GLenum target,GLint* param);
bool setBufferData(GLenum target,GLsizeiptr size,const GLvoid* data,GLenum usage);
bool setBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const GLvoid* data);
const char * getExtensionString();
const char * getRendererString() const;
void getGlobalLock();
void releaseGlobalLock();
virtual GLSupport* getCaps(){return &s_glSupport;};
virtual ~GLEScontext();
virtual int getMaxTexUnits() = 0;
virtual void drawValidate(void);
void setRenderbufferBinding(GLuint rb) { m_renderbuffer = rb; }
GLuint getRenderbufferBinding() const { return m_renderbuffer; }
void setFramebufferBinding(GLuint fb) { m_framebuffer = fb; }
GLuint getFramebufferBinding() const { return m_framebuffer; }
static GLDispatch& dispatcher(){return s_glDispatch;};
static int getMaxLights(){return s_glSupport.maxLights;}
static int getMaxClipPlanes(){return s_glSupport.maxClipPlane;}
static int getMaxTexSize(){return s_glSupport.maxTexSize;}
static Version glslVersion(){return s_glSupport.glslVersion;}
static bool isAutoMipmapSupported(){return s_glSupport.GL_SGIS_GENERATE_MIPMAP;}
static TextureTarget GLTextureTargetToLocal(GLenum target);
static int findMaxIndex(GLsizei count,GLenum type,const GLvoid* indices);
virtual bool glGetIntegerv(GLenum pname, GLint *params);
virtual bool glGetBooleanv(GLenum pname, GLboolean *params);
virtual bool glGetFloatv(GLenum pname, GLfloat *params);
virtual bool glGetFixedv(GLenum pname, GLfixed *params);
protected:
virtual bool needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) = 0;
void convertDirect(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p);
void convertDirectVBO(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p);
void convertIndirect(GLESConversionArrays& fArrs,GLsizei count,GLenum type,const GLvoid* indices,GLenum array_id,GLESpointer* p);
void convertIndirectVBO(GLESConversionArrays& fArrs,GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p);
void initCapsLocked(const GLubyte * extensionString);
virtual void initExtensionString() =0;
static android::Mutex s_lock;
static GLDispatch s_glDispatch;
bool m_initialized;
unsigned int m_activeTexture;
GLint m_unpackAlignment;
ArraysMap m_map;
static std::string* s_glExtensions;
static std::string s_glRenderer;
static GLSupport s_glSupport;
private:
virtual void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride, GLboolean normalized, int pointsIndex = -1) = 0 ;
GLuint getBuffer(GLenum target);
ShareGroupPtr m_shareGroup;
GLenum m_glError;
textureUnitState* m_texState;
unsigned int m_arrayBuffer;
unsigned int m_elementBuffer;
GLuint m_renderbuffer;
GLuint m_framebuffer;
};
#endif

View File

@@ -1,47 +0,0 @@
#ifndef GLES_MACROS_H
#define GLES_MACROS_H
#define GET_CTX() \
if(!s_eglIface) return; \
GLEScontext *ctx = s_eglIface->getGLESContext(); \
#define GET_CTX_CM() \
if(!s_eglIface) return; \
GLEScmContext *ctx = static_cast<GLEScmContext *>(s_eglIface->getGLESContext()); \
if(!ctx) return;
#define GET_CTX_V2() \
if(!s_eglIface) return; \
GLESv2Context *ctx = static_cast<GLESv2Context *>(s_eglIface->getGLESContext()); \
if(!ctx) return;
#define GET_CTX_RET(failure_ret) \
if(!s_eglIface) return failure_ret; \
GLEScontext *ctx = s_eglIface->getGLESContext(); \
if(!ctx) return failure_ret;
#define GET_CTX_CM_RET(failure_ret) \
if(!s_eglIface) return failure_ret; \
GLEScmContext *ctx = static_cast<GLEScmContext *>(s_eglIface->getGLESContext()); \
if(!ctx) return failure_ret;
#define GET_CTX_V2_RET(failure_ret) \
if(!s_eglIface) return failure_ret; \
GLESv2Context *ctx = static_cast<GLESv2Context *>(s_eglIface->getGLESContext()); \
if(!ctx) return failure_ret;
#define SET_ERROR_IF(condition,err) if((condition)) { \
fprintf(stderr, "%s:%s:%d error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
ctx->setGLerror(err); \
return; \
}
#define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \
fprintf(stderr, "%s:%s:%d error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \
ctx->setGLerror(err); \
return ret; \
}
#endif

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