summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2016-11-17 16:31:28 +0100
committerGreg Hartman <ghartman@google.com>2018-08-23 17:24:53 -0700
commit62101ac9d3b7add327a1c8fcbf74b5c59aa027d9 (patch)
tree51597e77ff42e139e4c652b1e42a6bbc1c1b9324
parenta20a1baf99448665e1fb295d97470d4dfa28036a (diff)
downloadopengl-transport-62101ac9d3b7add327a1c8fcbf74b5c59aa027d9.tar.gz
Move android-emugl from distrib/ to android/
Since this is no longer a side-project, move it under android/ where it logically belong. distrib/ should now only contains sources and build files related to third-party libraries used by the emulator. Change-Id: I012c2d8c875d018b0c97891773fa5e8e2811087e
-rw-r--r--android/base/containers/SmallVector.h386
-rw-r--r--android/base/containers/SmallVector_unittest.cpp222
-rw-r--r--android/opengl/GLProcessPipe.cpp92
-rw-r--r--android/opengl/GLProcessPipe.h22
-rw-r--r--android/opengl/logger.cpp200
-rw-r--r--android/opengl/logger.h39
-rwxr-xr-xandroid/scripts/tests/gen-entries/run-tests.sh96
-rw-r--r--android/scripts/tests/gen-entries/t.001/test._symbols10
-rw-r--r--android/scripts/tests/gen-entries/t.001/test.def11
-rw-r--r--android/scripts/tests/gen-entries/t.001/test.entries106
-rw-r--r--android/scripts/tests/gen-entries/t.001/test.funcargs26
-rw-r--r--android/scripts/tests/gen-entries/t.001/test.functions26
-rw-r--r--android/scripts/tests/gen-entries/t.001/test.sym15
-rw-r--r--android/scripts/tests/gen-entries/t.001/test.symbols10
-rw-r--r--android/scripts/tests/gen-entries/t.001/test.wrapper98
-rw-r--r--distrib/android-emugl/Android.mk102
-rw-r--r--distrib/android-emugl/DESIGN614
-rw-r--r--distrib/android-emugl/README96
-rw-r--r--distrib/android-emugl/common.mk237
-rwxr-xr-xdistrib/android-emugl/gen-encoder.sh35
-rw-r--r--distrib/android-emugl/googletest.mk40
-rw-r--r--distrib/android-emugl/host/include/GLES3/gl3.h939
-rw-r--r--distrib/android-emugl/host/include/GLES3/gl31.h1184
-rw-r--r--distrib/android-emugl/host/include/GLES3/gl3ext.h23
-rw-r--r--distrib/android-emugl/host/include/GLES3/gl3platform.h30
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_extensions_functions.h18
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_functions.h32
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gldefs.h45
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr.h17
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr_internal.h331
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles1_extensions_functions.h20
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles1_only_functions.h71
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles2_extensions_functions.h13
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles2_only_functions.h85
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles3_only_functions.h17
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles_common_functions.h79
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles_extensions_functions.h29
-rw-r--r--distrib/android-emugl/host/include/OpenGLESDispatch/gles_functions.h53
-rw-r--r--distrib/android-emugl/host/include/libOpenglRender/RenderChannel.h0
-rw-r--r--distrib/android-emugl/host/include/libOpenglRender/RenderLib.h50
-rw-r--r--distrib/android-emugl/host/include/libOpenglRender/Renderer.h143
-rw-r--r--distrib/android-emugl/host/include/libOpenglRender/render_api.h160
-rw-r--r--distrib/android-emugl/host/include/libOpenglRender/render_api_platform_types.h41
-rw-r--r--distrib/android-emugl/host/include/libOpenglRender/render_api_types.h23
-rw-r--r--distrib/android-emugl/host/libs/GLESv1_dec/Android.mk16
-rw-r--r--distrib/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.cpp245
-rw-r--r--distrib/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.h72
-rw-r--r--distrib/android-emugl/host/libs/GLESv2_dec/Android.mk15
-rw-r--r--distrib/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.cpp146
-rw-r--r--distrib/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.h51
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/Android.mk46
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.cpp159
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.h29
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.in201
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglConfig.cpp348
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglConfig.h107
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglContext.cpp94
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglContext.h76
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglDisplay.cpp412
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglDisplay.h115
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglGlobalInfo.cpp106
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglGlobalInfo.h111
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglImp.cpp1030
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglMacApi.cpp244
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglOsApi.h64
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglPbufferSurface.cpp75
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglPbufferSurface.h49
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglPixmapSurface.cpp60
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglPixmapSurface.h37
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglSurface.cpp43
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglSurface.h86
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglThreadInfo.cpp49
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglThreadInfo.h43
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglValidate.cpp93
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglValidate.h33
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglWindowSurface.cpp61
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglWindowSurface.h37
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglWindowsApi.cpp594
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/EglX11Api.cpp314
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/MacNative.h51
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/MacNative.m207
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/MacPixelFormatsAttribs.h23
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/MacPixelFormatsAttribs.m214
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/ThreadInfo.cpp83
-rw-r--r--distrib/android-emugl/host/libs/Translator/EGL/ThreadInfo.h40
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/Android.mk14
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/GLDispatch.cpp178
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/GLDispatch.h158
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmContext.cpp416
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmContext.h66
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmImp.cpp2449
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmUtils.cpp101
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmUtils.h22
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmValidate.cpp305
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmValidate.h50
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/Android.mk18
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Context.cpp158
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Context.h53
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp2307
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp184
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.h43
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/ProgramData.cpp98
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/ProgramData.h51
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/ShaderParser.cpp353
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/ShaderParser.h73
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/Android.mk44
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/FramebufferData.cpp196
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/GLDispatch.cpp117
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/GLESbuffer.cpp55
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/GLEScontext.cpp826
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/GLESpointer.cpp109
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/GLESvalidate.cpp194
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/GLutils.cpp20
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/PaletteTexture.cpp170
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/RangeManip.cpp127
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/TextureUtils.cpp109
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/etc1.cpp670
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLcommon/objectNameManager.cpp379
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/EGL/egl.h329
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/EGL/eglext.h244
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/EGL/eglinternalplatform.h69
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/EGL/eglplatform.h111
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/ETC1/etc1.h106
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GL/wglext.h901
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLES/gl.h770
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLES/glext.h1073
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLES/glplatform.h30
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLES2/gl2.h525
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLES2/gl2ext.h1932
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLES2/gl2platform.h30
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/FramebufferData.h70
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/GLDispatch.h52
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESbuffer.h47
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/GLEScontext.h205
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESmacros.h47
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESpointer.h58
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESvalidate.h44
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/GLconversion_macros.h31
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/GLutils.h52
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/PaletteTexture.h25
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/RangeManip.h69
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/TextureUtils.h31
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/TranslatorIfaces.h107
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/etc1.h108
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/GLcommon/objectNameManager.h263
-rw-r--r--distrib/android-emugl/host/libs/Translator/include/KHR/khrplatform.h282
-rw-r--r--distrib/android-emugl/host/libs/libGLES12Translator/gles/gles12_internal_dispatch.h44
-rw-r--r--distrib/android-emugl/host/libs/libOpenGLESDispatch/Android.mk14
-rw-r--r--distrib/android-emugl/host/libs/libOpenGLESDispatch/gles12tr_internal.entries327
-rw-r--r--distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_only.entries65
-rw-r--r--distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_common.entries74
-rw-r--r--distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_extensions.entries24
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/Android.mk66
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/ChannelStream.cpp93
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/ChannelStream.h44
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/ColorBuffer.cpp366
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/ColorBuffer.h159
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/DispatchTables.h22
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/FBConfig.cpp259
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/FBConfig.h60
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/FenceSync.cpp70
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/FenceSync.h120
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/FrameBuffer.cpp1264
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/FrameBuffer.h398
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/NativeLinuxSubWindow.cpp50
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/NativeMacSubWindow.m64
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/NativeSubWindow.h37
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/NativeWindowsSubWindow.cpp57
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/ReadBuffer.cpp76
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/ReadBuffer.h32
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderChannelImpl.cpp152
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderChannelImpl.h89
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderContext.cpp49
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderContext.h49
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderControl.cpp715
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderControl.h23
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderLibImpl.cpp46
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderLibImpl.h42
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderThread.cpp227
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RenderThread.h56
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RendererImpl.cpp187
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/RendererImpl.h75
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/ThreadInfo.cpp42
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/ThreadInfo.h0
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/WindowSurface.cpp185
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/WindowSurface.h102
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/gl_proc.h296
-rw-r--r--distrib/android-emugl/host/libs/libOpenglRender/render_api.cpp56
-rw-r--r--distrib/android-emugl/host/libs/renderControl_dec/Android.mk12
-rw-r--r--distrib/android-emugl/host/libs/renderControl_dec/renderControl_types.h28
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/Android.mk24
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.cpp95
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/ErrorLog.h27
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/FixedBuffer.h53
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/GLClientState.cpp416
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/GLClientState.h441
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/GLDecoderContextData.h69
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/GLErrorLog.h0
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/GLSharedGroup.cpp453
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/GLSharedGroup.h145
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/Makefile13
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/SocketStream.cpp176
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/SocketStream.h53
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/TcpStream.cpp78
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/TcpStream.h32
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/TimeUtils.cpp69
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/TimeUtils.h22
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/UnixStream.cpp132
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/UnixStream.h31
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/Win32PipeStream.cpp241
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/Win32PipeStream.h42
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/codec_defs.h0
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/glUtils.cpp471
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/glUtils.h95
-rw-r--r--distrib/android-emugl/shared/OpenglCodecCommon/gl_base_types.h62
-rw-r--r--distrib/android-emugl/shared/emugl/common/Android.mk46
-rw-r--r--distrib/android-emugl/shared/emugl/common/id_to_object_map.cpp236
-rw-r--r--distrib/android-emugl/shared/emugl/common/id_to_object_map.h176
-rw-r--r--distrib/android-emugl/shared/emugl/common/id_to_object_map_unittest.cpp116
-rw-r--r--distrib/android-emugl/shared/emugl/common/lazy_instance.cpp101
-rw-r--r--distrib/android-emugl/shared/emugl/common/lazy_instance.h156
-rw-r--r--distrib/android-emugl/shared/emugl/common/lazy_instance_unittest.cpp146
-rw-r--r--distrib/android-emugl/shared/emugl/common/logging.cpp38
-rw-r--r--distrib/android-emugl/shared/emugl/common/mutex.h92
-rw-r--r--distrib/android-emugl/shared/emugl/common/mutex_unittest.cpp108
-rw-r--r--distrib/android-emugl/shared/emugl/common/pod_vector.cpp150
-rw-r--r--distrib/android-emugl/shared/emugl/common/pod_vector.h265
-rw-r--r--distrib/android-emugl/shared/emugl/common/pod_vector_unittest.cpp127
-rw-r--r--distrib/android-emugl/shared/emugl/common/scoped_pointer_vector.h27
-rw-r--r--distrib/android-emugl/shared/emugl/common/shared_library.cpp115
-rw-r--r--distrib/android-emugl/shared/emugl/common/shared_library.h92
-rw-r--r--distrib/android-emugl/shared/emugl/common/shared_library_unittest.cpp164
-rw-r--r--distrib/android-emugl/shared/emugl/common/smart_ptr.cpp113
-rw-r--r--distrib/android-emugl/shared/emugl/common/smart_ptr.h23
-rw-r--r--distrib/android-emugl/shared/emugl/common/smart_ptr_unittest.cpp140
-rw-r--r--distrib/android-emugl/shared/emugl/common/sockets.cpp222
-rw-r--r--distrib/android-emugl/shared/emugl/common/sockets.h57
-rw-r--r--distrib/android-emugl/shared/emugl/common/testing/test_shared_library.cpp22
-rw-r--r--distrib/android-emugl/shared/emugl/common/testing/test_thread.h78
-rw-r--r--distrib/android-emugl/shared/emugl/common/thread.h102
-rw-r--r--distrib/android-emugl/shared/emugl/common/thread_pthread.cpp114
-rw-r--r--distrib/android-emugl/shared/emugl/common/thread_store.cpp242
-rw-r--r--distrib/android-emugl/shared/emugl/common/thread_store.h110
-rw-r--r--distrib/android-emugl/shared/emugl/common/thread_store_unittest.cpp146
-rw-r--r--distrib/android-emugl/shared/emugl/common/thread_unittest.cpp109
-rw-r--r--distrib/android-emugl/shared/emugl/common/thread_win32.cpp122
-rw-r--r--distrib/android-emugl/shared/emugl/common/unique_integer_map.h225
-rw-r--r--distrib/android-emugl/shared/emugl/common/unique_integer_map_unittest.cpp103
-rw-r--r--host/commands/emugen/Android.mk (renamed from distrib/android-emugl/host/tools/emugen/Android.mk)0
-rw-r--r--host/commands/emugen/ApiGen.cpp (renamed from distrib/android-emugl/host/tools/emugen/ApiGen.cpp)0
-rw-r--r--host/commands/emugen/ApiGen.h (renamed from distrib/android-emugl/host/tools/emugen/ApiGen.h)0
-rw-r--r--host/commands/emugen/EntryPoint.cpp (renamed from distrib/android-emugl/host/tools/emugen/EntryPoint.cpp)0
-rw-r--r--host/commands/emugen/EntryPoint.h (renamed from distrib/android-emugl/host/tools/emugen/EntryPoint.h)0
-rw-r--r--host/commands/emugen/Parser.cpp (renamed from distrib/android-emugl/host/tools/emugen/Parser.cpp)0
-rw-r--r--host/commands/emugen/Parser.h (renamed from distrib/android-emugl/host/tools/emugen/Parser.h)0
-rw-r--r--host/commands/emugen/Parser_unittest.cpp (renamed from distrib/android-emugl/host/tools/emugen/Parser_unittest.cpp)0
-rw-r--r--host/commands/emugen/README (renamed from distrib/android-emugl/host/tools/emugen/README)0
-rw-r--r--host/commands/emugen/TypeFactory.cpp (renamed from distrib/android-emugl/host/tools/emugen/TypeFactory.cpp)0
-rw-r--r--host/commands/emugen/TypeFactory.h (renamed from distrib/android-emugl/host/tools/emugen/TypeFactory.h)0
-rw-r--r--host/commands/emugen/Var.h (renamed from distrib/android-emugl/host/tools/emugen/Var.h)0
-rw-r--r--host/commands/emugen/VarType.h (renamed from distrib/android-emugl/host/tools/emugen/VarType.h)0
-rw-r--r--host/commands/emugen/errors.h (renamed from distrib/android-emugl/host/tools/emugen/errors.h)0
-rw-r--r--host/commands/emugen/getopt.c (renamed from distrib/android-emugl/host/tools/emugen/getopt.c)0
-rw-r--r--host/commands/emugen/getopt.h (renamed from distrib/android-emugl/host/tools/emugen/getopt.h)0
-rw-r--r--host/commands/emugen/main.cpp (renamed from distrib/android-emugl/host/tools/emugen/main.cpp)0
-rw-r--r--host/commands/emugen/strUtils.cpp (renamed from distrib/android-emugl/host/tools/emugen/strUtils.cpp)0
-rw-r--r--host/commands/emugen/strUtils.h (renamed from distrib/android-emugl/host/tools/emugen/strUtils.h)0
-rwxr-xr-xhost/commands/emugen/tests/run-tests.sh (renamed from distrib/android-emugl/host/tools/emugen/tests/run-tests.sh)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_dec.cpp (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_dec.cpp)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_dec.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_dec.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_opcodes.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_opcodes.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.cpp (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_server_context.cpp)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_server_context.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_server_proc.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_server_proc.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.cpp (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_client_context.cpp)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_client_context.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_client_proc.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_client_proc.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_enc.cpp (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_enc.cpp)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_enc.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_enc.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_entry.cpp (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_entry.cpp)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_ftable.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_ftable.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_opcodes.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_opcodes.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp)0
-rw-r--r--host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h)0
-rw-r--r--host/commands/emugen/tests/t.001/input/foo.attrib (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/input/foo.attrib)0
-rw-r--r--host/commands/emugen/tests/t.001/input/foo.in (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/input/foo.in)0
-rw-r--r--host/commands/emugen/tests/t.001/input/foo.types (renamed from distrib/android-emugl/host/tools/emugen/tests/t.001/input/foo.types)0
-rwxr-xr-xhost/commands/gen-entries.py (renamed from android/scripts/gen-entries.py)0
-rw-r--r--host/libs/virglrenderer/ChecksumCalculator.cpp (renamed from distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.cpp)0
-rw-r--r--host/libs/virglrenderer/ChecksumCalculator.h (renamed from distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.h)0
-rw-r--r--host/libs/virglrenderer/ChecksumCalculatorThreadInfo.h (renamed from distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h)0
-rw-r--r--host/libs/virglrenderer/GLESv1_dec/gles1.addon (renamed from distrib/android-emugl/host/libs/GLESv1_dec/gles1.addon)0
-rw-r--r--host/libs/virglrenderer/GLESv1_dec/gles1.attrib (renamed from distrib/android-emugl/host/libs/GLESv1_dec/gles1.attrib)0
-rw-r--r--host/libs/virglrenderer/GLESv1_dec/gles1.in (renamed from distrib/android-emugl/host/libs/GLESv1_dec/gles1.in)0
-rw-r--r--host/libs/virglrenderer/GLESv1_dec/gles1.types (renamed from distrib/android-emugl/host/libs/GLESv1_dec/gles1.types)0
-rw-r--r--host/libs/virglrenderer/GLESv1_dec/gles1_types.h (renamed from distrib/android-emugl/host/libs/GLESv1_dec/gles1_types.h)0
-rw-r--r--host/libs/virglrenderer/GLESv3_dec/gles3.attrib (renamed from distrib/android-emugl/host/libs/GLESv2_dec/gles2.attrib)0
-rw-r--r--host/libs/virglrenderer/GLESv3_dec/gles3.in (renamed from distrib/android-emugl/host/libs/GLESv2_dec/gles2.in)0
-rw-r--r--host/libs/virglrenderer/GLESv3_dec/gles3.types (renamed from distrib/android-emugl/host/libs/GLESv2_dec/gles2.types)0
-rw-r--r--host/libs/virglrenderer/GLESv3_dec/gles3_types.h (renamed from distrib/android-emugl/host/libs/GLESv2_dec/gles2_types.h)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/EGLDispatch.cpp (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/EGLDispatch.cpp)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/EGLDispatch.h (renamed from distrib/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/GLESv1Dispatch.cpp (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/GLESv1Dispatch.cpp)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/GLESv1Dispatch.h (renamed from distrib/android-emugl/host/include/OpenGLESDispatch/GLESv1Dispatch.h)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/GLESv3Dispatch.cpp (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/GLESv2Dispatch.cpp)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/GLESv3Dispatch.h (renamed from distrib/android-emugl/host/include/OpenGLESDispatch/GLESv2Dispatch.h)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/egl.entries (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl.entries)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/egl_extensions.entries (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl_extensions.entries)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/gles1_core.entries (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/gles12tr.entries)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/gles1_extensions.entries (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_extensions.entries)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/gles2_core.entries (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_only.entries)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/gles2_extensions.entries (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_extensions.entries)0
-rw-r--r--host/libs/virglrenderer/OpenGLESDispatch/gles3_only.entries (renamed from distrib/android-emugl/host/libs/libOpenGLESDispatch/gles3_only.entries)0
-rw-r--r--host/libs/virglrenderer/OpenglRender/IOStream.h (renamed from distrib/android-emugl/host/include/OpenglRender/IOStream.h)0
-rw-r--r--host/libs/virglrenderer/ProtocolUtils.h (renamed from distrib/android-emugl/shared/OpenglCodecCommon/ProtocolUtils.h)0
-rw-r--r--host/libs/virglrenderer/emugl/common/logging.h (renamed from distrib/android-emugl/shared/emugl/common/logging.h)0
-rw-r--r--host/libs/virglrenderer/renderControl_dec/renderControl.attrib (renamed from distrib/android-emugl/host/libs/renderControl_dec/renderControl.attrib)2
-rw-r--r--host/libs/virglrenderer/renderControl_dec/renderControl.in (renamed from distrib/android-emugl/host/libs/renderControl_dec/renderControl.in)0
-rw-r--r--host/libs/virglrenderer/renderControl_dec/renderControl.types (renamed from distrib/android-emugl/host/libs/renderControl_dec/renderControl.types)0
321 files changed, 1 insertions, 43029 deletions
diff --git a/android/base/containers/SmallVector.h b/android/base/containers/SmallVector.h
deleted file mode 100644
index d7ffb6bca..000000000
--- a/android/base/containers/SmallVector.h
+++ /dev/null
@@ -1,386 +0,0 @@
-// Copyright 2016 The Android Open Source Project
-//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-#pragma once
-
-#include "android/base/TypeTraits.h"
-
-#include <algorithm>
-#include <initializer_list>
-#include <type_traits>
-#include <utility>
-
-#include <stddef.h>
-
-//
-// SmallVector<T>, SmallFixedVector<T, SmallSize>
-//
-// This header defines a replacement for a std::vector<> that uses small buffer
-// optimization technique - for some preset number of elements |SmallSize| it
-// stores them inside of the object, and falls back to the dynamically allocated
-// array only if one needs to add more elements.
-// This is useful for the performance-critical places where common number of
-// processed items is small, but it may still be quite large for a stack array.
-//
-// SmallFixedVector<> is the class you use to store elements, while
-// SmallVector<> is its base class that erases the small size from the type.
-//
-// NOTE: SmallVector<> cannot guarantee std::vector<>'s iterator invalidation
-// rules for move() and swap() operations - std::vector<>s just exchange
-// their iterators on swap() and pass the moved ones over, while SmallVector<>
-// may leave the iterators pointing to nowhere if they were for the in-place
-// array storage.
-//
-// Currenly only a limited subset of std::vector<>'s operations is implemented,
-// but fill free to add the ones you need.
-//
-
-namespace android {
-namespace base {
-
-//
-// Forward-declare the 'real' small vector class.
-template <class T, size_t S>
-class SmallFixedVector;
-
-//
-// SmallVector<T> - an interface for a small-buffer-optimized vector.
-// It hides the fixed size from its type, so one can use it to pass small
-// vectors around and not leak the buffer size to all callers:
-//
-// void process(SmallVector<Foo>& data);
-// ...
-// ...
-// SmallFixedVector<Foo, 100> aLittleBitOfFoos = ...;
-// process(aLittleBitOfFoos);
-// ...
-// SmallFixedVector<Foo, 1000> moreFoos = ...;
-// process(moreFoos);
-//
-template <class T>
-class SmallVector {
- // Make them friends so SmallFixedVector is able to refer to SmallVector's
- // protected members in static_assert()s.
- template <class U, size_t S>
- friend class SmallFixedVector;
-
-public:
- // Common set of type aliases.
- using value_type = T;
- using iterator = T*;
- using const_iterator = const T*;
- using pointer = T*;
- using const_pointer = const T*;
- using reference = T&;
- using const_reference = const T&;
- using size_type = size_t;
-
- // It's ok to delete SmallVector<> through the base class - dtor() actually
- // takes care of all living elements and the allocated memory.
- ~SmallVector() { dtor(); }
-
- // std::vector<> interface operations.
- iterator begin() { return mBegin; }
- const_iterator begin() const { return mBegin; }
- const_iterator cbegin() const { return mBegin; }
-
- iterator end() { return mEnd; }
- const_iterator end() const { return mEnd; }
- const_iterator cend() const { return mEnd; }
-
- size_type size() const { return end() - begin(); }
- size_type capacity() const { return mCapacity; }
- bool empty() const { return begin() == end(); }
-
- reference operator[](size_t i) { return *(begin() + i); }
- const_reference operator[](size_t i) const { return *(cbegin() + i); }
-
- pointer data() { return mBegin; }
- const_pointer data() const { return mBegin; }
- const_pointer cdata() const { return mBegin; }
-
- template <class... Args>
- void emplace_back(Args&&... args) {
- grow_for_size(size() + 1);
- new (mEnd) T(std::forward<Args>(args)...);
- ++mEnd;
- }
-
- void push_back(const T& t) { emplace_back(t); }
- void push_back(T&& t) { emplace_back(std::move(t)); }
-
- void clear() {
- destruct(begin(), end());
- mEnd = mBegin;
- }
-
- void reserve(size_type newCap) {
- if (newCap <= this->capacity()) {
- return;
- }
- set_capacity(newCap);
- }
-
- void resize(size_type newSize) { resize_impl<true>(newSize); }
-
- // This version of resizing doesn't initialize the newly allocated elements
- // Useful for the cases when value-initialization is noticeably slow and
- // one wants to directly construct or memcpy the elements into the resized
- // place.
- void resize_noinit(size_type newSize) { resize_impl<false>(newSize); }
-
- // Returns if the current vector's buffer is dynamically allocated.
- bool isAllocated() const { return this->cbegin() != smallBufferStart(); }
-
-protected:
- // Hide the default constructor so only SmallFixedVector can be
- // instantiated.
- SmallVector() = default;
-
- // Destroy all elements in the vector and free the array if it was allocated
- // dynamically.
- void dtor() {
- this->destruct(this->begin(), this->end());
- if (isAllocated()) {
- free(this->mBegin);
- }
- }
-
- // Just a convenience setter function to init all members at once.
- void init(iterator begin, iterator end, size_type capacity) {
- this->mBegin = begin;
- this->mEnd = end;
- this->mCapacity = capacity;
- }
-
- // An implementation of different resizing versions.
- template <bool init>
- void resize_impl(size_type newSize) {
- if (newSize < this->size()) {
- const auto newEnd = this->begin() + newSize;
- this->destruct(newEnd, this->end());
- this->mEnd = newEnd;
- } else if (newSize > this->size()) {
- grow_for_size(newSize);
- const auto newEnd = this->begin() + newSize;
- if (init) {
- std::uninitialized_fill(this->end(), newEnd, T());
- }
- this->mEnd = newEnd;
- }
- }
-
- // Templated append operation for a range of elements.
- template <class Iter>
- void insert_back(Iter b, Iter e) {
- if (b == e) {
- return;
- }
- const auto newSize = this->size() + (e - b);
- grow_for_size(newSize);
- this->mEnd = std::uninitialized_copy(b, e, this->mEnd);
- }
-
- // Multiplicative grow for the internal array so it can hold |newSize|
- // elements.
- // Doesn't change size(), only capacity().
- void grow_for_size(size_type newSize) {
- // Grow by 1.5x by default.
- if (newSize > capacity()) {
- set_capacity(std::max(newSize, capacity() + capacity() / 2));
- }
- }
-
- // Sets the capacity() to be exacly |newCap|. Allocates the array
- // dynamically, moves all elements over and (potentially) deallocates the
- // old array.
- // Doesn't change size(), only capacity().
- void set_capacity(size_type newCap) {
- // Here we can only be switching to the dynamic vector, as static one
- // always has its capacity on the maximum.
- const auto newBegin = (T*)malloc(sizeof(T) * newCap);
- if (!newBegin) {
- abort(); // what else can we do here?
- }
- const auto newEnd = std::uninitialized_copy(
- std::make_move_iterator(this->begin()),
- std::make_move_iterator(this->end()), newBegin);
- dtor();
- this->mBegin = newBegin;
- this->mEnd = newEnd;
- this->mCapacity = newCap;
- }
-
- // A convenience function to call destructor for a range of elements.
- static void destruct(T* b, T* e) {
- if (!std::is_trivially_destructible<T>::value) {
- for (; b != e; ++b) {
- b->~T();
- }
- }
- }
-
- // By design of the class, SmallFixedVector<> will be inheriting from
- // SmallVector<>, so its in-place storage array is going to be the very next
- // member after the last one here.
- // This function returns that address, and SmallFixedVector<> has a static
- // assert to make sure it remains correct.
- constexpr const void* smallBufferStart() const {
- return (const void*)(&mCapacity + 1);
- }
-
- // Standard set of members for a vector - begin, end and capacity.
- // These point to the currently used chunk of memory, no matter if it's a
- // heap-allocated one or an in-place array.
- iterator mBegin;
- iterator mEnd;
- size_type mCapacity;
-};
-
-// The implementation of a SmallVector with a fixed in-place size, |SmallSize|.
-template <class T, size_t SmallSize>
-class SmallFixedVector : public SmallVector<T> {
- using base = SmallVector<T>;
-
-public:
- // Grab these from the base class.
- using value_type = typename base::value_type;
- using iterator = typename base::iterator;
- using const_iterator = typename base::const_iterator;
- using pointer = typename base::pointer;
- using const_pointer = typename base::const_pointer;
- using reference = typename base::reference;
- using const_reference = typename base::const_reference;
- using size_type = typename base::size_type;
-
- static constexpr size_type kSmallSize = SmallSize;
-
- // Default constructor - set up an empty vector with capacity at full
- // internal array size.
- SmallFixedVector() {
- // Make sure that the small array starts exactly where base class
- // expects it: right after the |mCapacity|.
- static_assert(offsetof(base, mCapacity) + sizeof(base::mCapacity) ==
- offsetof(SmallFixedVector, mData) &&
- offsetof(Data, array) == 0,
- "SmallFixedVector<> class layout is wrong, "
- "|mData| needs to follow |mCapacity|");
-
- init_inplace();
- }
-
- // Ctor from a range of iterators
- template <class Iter>
- SmallFixedVector(Iter b, Iter e) : SmallFixedVector() {
- this->insert_back(b, e);
- }
-
- // Ctor from a range - anything that has begin and end.
- // Note: template constructor is never a copy/move-ctor.
- template <class Range,
- class = enable_if_c<!std::is_same<Range, T>::value &&
- is_range<Range>::value>>
- explicit SmallFixedVector(const Range& r)
- : SmallFixedVector(std::begin(r), std::end(r)) {}
- template <class Range,
- class = enable_if_c<!std::is_same<Range, T>::value &&
- is_range<Range>::value>>
- explicit SmallFixedVector(Range&& r)
- : SmallFixedVector(std::make_move_iterator(std::begin(r)),
- std::make_move_iterator(std::end(r))) {}
- template <class U,
- class = enable_if_convertible<U, T>>
- SmallFixedVector(std::initializer_list<U> list)
- : SmallFixedVector(std::begin(list), std::end(list)) {}
-
-
- SmallFixedVector(const SmallFixedVector& other)
- : SmallFixedVector(other.begin(), other.end()) {}
-
- SmallFixedVector(SmallFixedVector&& other) {
- if (other.isAllocated()) {
- // Just steal the allocated memory from the |other|.
- this->mBegin = other.mBegin;
- this->mEnd = other.mEnd;
- this->mCapacity = other.mCapacity;
- other.init_inplace();
- } else {
- // Have to move individual elements.
- this->mBegin = mData.array;
- this->mEnd = std::uninitialized_copy(
- std::make_move_iterator(other.begin()),
- std::make_move_iterator(other.end()), this->begin());
- this->mCapacity = kSmallSize;
- }
- }
-
- SmallFixedVector& operator=(const SmallFixedVector& other) {
- if (&other != this) {
- this->clear();
- this->insert_back(other.begin(), other.end());
- }
- return *this;
- }
-
- SmallFixedVector& operator=(SmallFixedVector&& other) {
- if (other.isAllocated()) {
- // Steal it and we're done.
- this->dtor();
- this->mBegin = other.mBegin;
- this->mEnd = other.mEnd;
- this->mCapacity = other.mCapacity;
- other.init_inplace();
- return *this;
- }
-
- if (this->isAllocated() && this->mCapacity < other.size()) {
- // Not enough dynamic memory, switch to in-place.
- this->dtor();
- init_inplace();
- } else {
- // This could potentially be improved by move-assigning
- // only needed items and destroying the rest, but
- // destroy-all+construct-all is just simpler. For PODs it actually
- // is even faster as it's always a single memcpy().
- this->destruct(this->begin(), this->end());
- }
-
- // Move the whole |other| into the pre-cleaned memory
- const auto newEnd = std::uninitialized_copy(
- std::make_move_iterator(other.begin()),
- std::make_move_iterator(other.end()), this->mBegin);
- this->mEnd = newEnd;
- // |other| is valid as-is.
- return *this;
- }
-
- // Make sure we don't end up trying to move from an interface - it's just
- // inefficient with the current code.
- SmallFixedVector(base&& other) = delete;
- SmallFixedVector& operator=(base&& other) = delete;
-
-private:
- // A shortcut for initialization for in-place storage.
- void init_inplace() { this->init(mData.array, mData.array, kSmallSize); }
-
- // A union with empty constructor and destructor makes sure that the array
- // elements are not default-constructed in ctor and not destructed in dtor:
- // the class needs to be able manage their lifetime more precisely.
- union Data {
- alignas(size_type) T array[kSmallSize];
-
- Data() {}
- ~Data() {}
- } mData;
-};
-
-} // namespace base
-} // namespace android
diff --git a/android/base/containers/SmallVector_unittest.cpp b/android/base/containers/SmallVector_unittest.cpp
deleted file mode 100644
index ea85dc201..000000000
--- a/android/base/containers/SmallVector_unittest.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright 2016 The Android Open Source Project
-//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-#include "android/base/containers/SmallVector.h"
-
-#include "android/base/memory/ScopedPtr.h"
-#include "android/base/testing/GTestUtils.h"
-
-#include <gtest/gtest.h>
-
-#include <string>
-
-namespace android {
-namespace base {
-
-TEST(SmallVector, basic) {
- SmallFixedVector<char, 10> sv;
- EXPECT_EQ(sv.size(), 0);
- EXPECT_TRUE(sv.empty());
-
- EXPECT_EQ(10, sv.capacity());
- EXPECT_FALSE(sv.isAllocated());
-
- const int values[] = {1, 2, 3};
- sv = SmallFixedVector<char, 10>(values, values + 3);
- EXPECT_EQ(3, sv.size());
- EXPECT_FALSE(sv.empty());
- EXPECT_EQ(10, sv.capacity());
- EXPECT_FALSE(sv.isAllocated());
- EXPECT_TRUE(RangesMatch(values, sv));
-
- sv.clear();
- EXPECT_EQ(0, sv.size());
- EXPECT_TRUE(sv.empty());
-
- const char str[] = "this is a long string for insertion";
- sv = SmallFixedVector<char, 10>(str);
- EXPECT_EQ(sizeof(str), sv.size());
- EXPECT_GT(sv.capacity(), 10);
- EXPECT_TRUE(sv.isAllocated());
- EXPECT_TRUE(RangesMatch(str, sv));
-
- // make sure explicit loops over indices and iterators work
- for (size_t i = 0; i != sv.size(); ++i) {
- EXPECT_EQ(str[i], sv[i]);
- }
- const char* c = str;
- for (auto i : sv) {
- EXPECT_EQ(*c++, i);
- }
- c = str;
- for (auto it = sv.begin(); it != sv.end(); ++it, ++c) {
- EXPECT_EQ(*c, *it);
- }
-
- c = str;
- for (auto it = sv.data(); it != sv.data() + sv.size(); ++it, ++c) {
- EXPECT_EQ(*c, *it);
- }
-}
-
-TEST(SmallVector, ctor) {
- {
- SmallFixedVector<int, 1> sv;
- EXPECT_EQ(sv.size(), 0);
- }
-
- {
- const int values[] = {1, 2, 3};
- SmallFixedVector<int, 10> sv(values, values + 3);
- EXPECT_TRUE(RangesMatch(values, sv));
- }
-
- {
- const int values[] = {1, 2, 3};
- SmallFixedVector<int, 10> sv(values);
- EXPECT_TRUE(RangesMatch(values, sv));
- }
-
- {
- const int values[] = {1, 2, 3};
- SmallFixedVector<int, 10> sv(values);
- EXPECT_TRUE(RangesMatch(values, sv));
- }
-
- {
- const int values[] = {1, 2, 3};
- SmallFixedVector<int, 10> sv = {1, 2, 3};
- EXPECT_TRUE(RangesMatch(values, sv));
- }
-
- {
- const int values[] = {1, 2, 3};
- SmallFixedVector<int, 10> sv1(values);
- SmallFixedVector<int, 10> sv2(sv1);
-
- EXPECT_TRUE(RangesMatch(values, sv1));
- EXPECT_TRUE(RangesMatch(sv2, sv1));
-
- SmallFixedVector<int, 10> sv3(std::move(sv1));
- EXPECT_TRUE(RangesMatch(sv3, values));
- // don't check |sv1| - it is not required to be empty.
- }
-}
-
-TEST(SmallVector, dtor) {
- // Count all destructor calls for the elements and make sure they're called
- // enough times.
- int destructedTimes = 0;
- auto deleter = [](int* p) { ++(*p); };
- auto item1 = makeCustomScopedPtr(&destructedTimes, deleter);
- auto item2 = makeCustomScopedPtr(&destructedTimes, deleter);
- auto item3 = makeCustomScopedPtr(&destructedTimes, deleter);
-
- {
- SmallFixedVector<decltype(item1), 1> sv;
- sv.emplace_back(std::move(item1));
- sv.emplace_back(std::move(item2));
- // this one is already empty, so it won't add to |destructedTimes|.
- sv.emplace_back(std::move(item2));
- sv.emplace_back(std::move(item3));
- }
-
- EXPECT_EQ(3, destructedTimes);
-}
-
-TEST(SmallVector, modifiers) {
- SmallFixedVector<unsigned, 5> sv;
-
- EXPECT_EQ(0, sv.size());
- EXPECT_EQ(5, sv.capacity());
-
- sv.reserve(4);
- EXPECT_EQ(0, sv.size());
- EXPECT_EQ(5, sv.capacity());
- EXPECT_FALSE(sv.isAllocated());
-
- sv.reserve(6);
- EXPECT_EQ(0, sv.size());
- EXPECT_EQ(6, sv.capacity());
- EXPECT_TRUE(sv.isAllocated());
-
- sv.resize(3);
- EXPECT_EQ(3, sv.size());
- EXPECT_EQ(6, sv.capacity());
- EXPECT_TRUE(sv.isAllocated());
-
- sv.resize(10);
- EXPECT_EQ(10, sv.size());
- EXPECT_GE(sv.capacity(), 10);
- EXPECT_TRUE(sv.isAllocated());
-
- sv.push_back(1);
- EXPECT_EQ(11, sv.size());
- EXPECT_GE(sv.capacity(), 11);
-
- sv.emplace_back(2);
- EXPECT_EQ(12, sv.size());
- EXPECT_GE(sv.capacity(), 12);
-
- sv.clear();
- EXPECT_EQ(0, sv.size());
- EXPECT_GE(sv.capacity(), 12);
-
- // resize_noinit() doesn't really have anything specific we can test
- // compared to resize()
- sv.resize_noinit(1);
- EXPECT_EQ(1, sv.size());
- EXPECT_GE(sv.capacity(), 12);
-
- sv.resize_noinit(100);
- EXPECT_EQ(100, sv.size());
- EXPECT_GE(sv.capacity(), 100);
-
- SmallFixedVector<std::string, 5> strings = {"a", "b", "c"};
- strings.emplace_back("d");
- strings.push_back("e");
- EXPECT_EQ(5, strings.size());
- EXPECT_EQ(5, strings.capacity());
- EXPECT_FALSE(strings.isAllocated());
-
- strings.push_back(std::string("e"));
- EXPECT_EQ(6, strings.size());
- EXPECT_GE(strings.capacity(), 6);
- EXPECT_TRUE(strings.isAllocated());
-}
-
-TEST(SmallVector, useThroughInterface) {
- SmallFixedVector<int, 10> sfv = {1, 2, 3};
- SmallVector<int>& sv = sfv;
- EXPECT_TRUE(RangesMatch(sv, sfv));
- EXPECT_EQ(sv.isAllocated(), sfv.isAllocated());
-
- sv.reserve(20);
- EXPECT_TRUE(sv.isAllocated());
- EXPECT_EQ(sv.isAllocated(), sfv.isAllocated());
-
- // now make sure that deleting through base class cleans up the memory
- {
- int destructedTimes = 0;
- auto deleter = [](int* p) { ++(*p); };
- auto item1 = makeCustomScopedPtr(&destructedTimes, deleter);
- auto item2 = makeCustomScopedPtr(&destructedTimes, deleter);
- SmallVector<decltype(item1)>* sv =
- new SmallFixedVector<decltype(item1), 1>();
- sv->push_back(std::move(item1));
- sv->emplace_back(std::move(item2));
- delete sv;
- EXPECT_EQ(2, destructedTimes);
- }
-}
-
-} // namespace android
-} // namespace base
diff --git a/android/opengl/GLProcessPipe.cpp b/android/opengl/GLProcessPipe.cpp
deleted file mode 100644
index 8915612de..000000000
--- a/android/opengl/GLProcessPipe.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2016 The Android Open Source Project
-//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-#include "android/emulation/AndroidPipe.h"
-
-#include "android/opengles.h"
-#include <assert.h>
-#include <atomic>
-#include <memory>
-
-namespace android {
-namespace opengl {
-
-namespace {
-
-// GLProcessPipe is a pipe service that is used for releasing graphics resources
-// per guest process. At the time being, guest processes can acquires host color
-// buffer handles / EGLImage handles and they need to be properly released when
-// guest process exits unexpectedly. This class is used to detect if guest
-// process exits, so that a proper cleanup function can be called.
-
-// It is done by setting up a pipe per guest process before acquiring color
-// buffer handles. When guest process exits, the pipe will be closed, and
-// onGuestClose() will trigger the cleanup path.
-
-class GLProcessPipe : public AndroidPipe {
-public:
- //////////////////////////////////////////////////////////////////////////
- // The pipe service class for this implementation.
- class Service : public AndroidPipe::Service {
- public:
- Service() : AndroidPipe::Service("GLProcessPipe") {}
-
- virtual AndroidPipe* create(void* mHwPipe, const char* args) override {
- return new GLProcessPipe(mHwPipe, this);
- }
- };
-
- GLProcessPipe(void* hwPipe, Service* service) : AndroidPipe(hwPipe, service) {
- m_uniqueId = ++s_headId;
- }
-
- void onGuestClose() override {
- // process died on the guest, cleanup gralloc memory on the host
- android_cleanupProcGLObjects(m_uniqueId);
- }
- unsigned onGuestPoll() const override {
- return PIPE_POLL_IN | PIPE_POLL_OUT;
- }
- int onGuestRecv(AndroidPipeBuffer* buffers, int numBuffers) override {
- assert(buffers[0].size >= 8);
- memcpy(buffers[0].data, (const char*)&m_uniqueId, sizeof(m_uniqueId));
- return sizeof(m_uniqueId);
- }
- int onGuestSend(const AndroidPipeBuffer* buffers,
- int numBuffers) override {
- // The guest is supposed to send us a confirm code first. The code is
- // 100 (4 byte integer).
- assert(buffers[0].size >= 4);
- int32_t confirmInt = *((int32_t*)buffers[0].data);
- assert(confirmInt == 100);
- return buffers[0].size;
- }
- void onGuestWantWakeOn(int flags) override {}
-private:
- // An identifier for the guest process corresponding to this pipe.
- // With very high probability, all currently-active processes have unique
- // identifiers, since the IDs are assigned sequentially from a 64-bit ID
- // space.
- // Please change it if you ever have a use case that exhausts them
- uint64_t m_uniqueId;
- static std::atomic_ullong s_headId;
-};
-
-std::atomic_ullong GLProcessPipe::s_headId(0);
-
-}
-
-void registerGLProcessPipeService() {
- android::AndroidPipe::Service::add(new GLProcessPipe::Service());
-}
-
-}
-}
diff --git a/android/opengl/GLProcessPipe.h b/android/opengl/GLProcessPipe.h
deleted file mode 100644
index fd3d81fb4..000000000
--- a/android/opengl/GLProcessPipe.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 The Android Open Source Project
-//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-#pragma once
-
-namespace android {
-namespace opengl {
-
-// registerGLProcessPipeService() registers a "GLProcessPipe" pipe service that is
-// used to detect GL process exits.
-void registerGLProcessPipeService();
-
-} // namespace opengl
-} // namespace android
-
diff --git a/android/opengl/logger.cpp b/android/opengl/logger.cpp
deleted file mode 100644
index 175c1daf9..000000000
--- a/android/opengl/logger.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright 2016 The Android Open Source Project
-//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-#include "android/opengl/logger.h"
-
-#include "android/base/files/PathUtils.h"
-#include "android/base/memory/LazyInstance.h"
-#include "android/base/synchronization/Lock.h"
-#include "android/crashreport/CrashReporter.h"
-
-#include <algorithm>
-#include <fstream>
-#include <inttypes.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string>
-#include <sys/time.h>
-#include <vector>
-
-using android::base::AutoLock;
-using android::base::Lock;
-using android::base::PathUtils;
-using android::crashreport::CrashReporter;
-
-// The purpose of the OpenGL logger is to log
-// information about such things as EGL initialization
-// and possibly miscellanous OpenGL commands,
-// in order to get a better idea of what is going on
-// in crash reports.
-
-// The OpenGLLogger implementation's initialization method
-// by default uses the crash reporter's data directory.
-
-static const int kBufferLen = 2048;
-
-typedef std::pair<uint64_t, std::string> TimestampedLogEntry;
-
-class OpenGLLogger {
-public:
- OpenGLLogger();
- OpenGLLogger(const char* filename);
- // Coarse log: Call this infrequently.
- void writeCoarse(const char* str);
-
- // Fine log: When we want to log very frequent events.
- // Fine logs can be toggled on/off.
- void writeFine(uint64_t time, const char* str);
- void writeFineTimestamped(const char* str);
-
- void startFineLog();
- void stopFineLog();
- static OpenGLLogger* get();
-private:
- Lock mLock;
- bool mFineLogActive;
- std::string mFileName;
- std::ofstream mFileHandle;
- std::string mFineLogFileName;
- std::ofstream mFineLogFileHandle;
- std::vector<TimestampedLogEntry> mFineLog;
- DISALLOW_COPY_ASSIGN_AND_MOVE(OpenGLLogger);
-};
-
-::android::base::LazyInstance<OpenGLLogger> sOpenGLLogger = LAZY_INSTANCE_INIT;
-
-OpenGLLogger* OpenGLLogger::get() {
- return sOpenGLLogger.ptr();
-}
-
-OpenGLLogger::OpenGLLogger() :
- mFineLogActive(false) {
- const std::string& data_dir =
- CrashReporter::get()->getDataExchangeDir();
- mFileName = PathUtils::join(data_dir,
- "opengl_log.txt");
- mFileHandle.open(mFileName, std::ios::app);
- mFineLogFileName = PathUtils::join(data_dir,
- "opengl_cxt_log.txt");
- mFineLogFileHandle.open(mFineLogFileName, std::ios::app);
-}
-
-OpenGLLogger::OpenGLLogger(const char* filename) :
- mFileName(filename) {
- mFileHandle.open(mFileName, std::ios::app);
-}
-
-void OpenGLLogger::writeCoarse(const char* str) {
- if (mFileHandle) {
- mFileHandle << str;
- mFileHandle << std::endl;
- }
-}
-
-void OpenGLLogger::writeFine(uint64_t time, const char* str) {
- if (mFineLogActive) {
- AutoLock lock(mLock);
- mFineLog.emplace_back(time, str);
- }
-}
-
-void OpenGLLogger::writeFineTimestamped(const char* str) {
- if (mFineLogActive) {
- char buf[kBufferLen] = {};
- struct timeval tv;
- gettimeofday(&tv, NULL);
-
- uint64_t curr_micros = (tv.tv_usec) % 1000;
- uint64_t curr_millis = (tv.tv_usec / 1000) % 1000;
- uint64_t curr_secs = tv.tv_sec;
- snprintf(buf, sizeof(buf) - 1,
- "time_us="
- "%" PRIu64 " s "
- "%" PRIu64 " ms "
- "%" PRIu64 " us | %s",
- curr_secs,
- curr_millis,
- curr_micros,
- str);
- writeFine(curr_micros + 1000ULL * curr_millis +
- 1000ULL * 1000ULL * curr_secs, buf);
- }
-}
-
-void OpenGLLogger::startFineLog() {
- mFineLogActive = true;
-}
-
-void OpenGLLogger::stopFineLog() {
- if (mFineLogActive) {
- mFineLogActive = false;
- // Only print message when fine-grained
- // logging is turned on.
- if (!mFineLog.empty()) {
- fprintf(stderr,
- "Writing fine-grained GL log to %s...",
- mFineLogFileName.c_str());
- }
-
- // Sort log entries according to their timestamps.
- // This is because the log entries might arrive
- // out of order.
- std::sort(mFineLog.begin(), mFineLog.end(),
- [](const TimestampedLogEntry& x,
- const TimestampedLogEntry& y) {
- return x.first < y.first;
- });
-
- for (const auto& entry : mFineLog) {
- // The fine log does not print newlines
- // as it is used with the opengl debug
- // printout in emugl, which adds
- // newlines of its own.
- mFineLogFileHandle << entry.second;
- }
- mFineLogFileHandle.close();
- if (!mFineLog.empty()) {
- fprintf(stderr, "done\n");
- }
- mFineLog.clear();
- }
-}
-
-// C interface
-
-void android_init_opengl_logger() {
- OpenGLLogger* gl_log = OpenGLLogger::get();
- gl_log->startFineLog();
-}
-
-void android_opengl_logger_write(const char* fmt, ...) {
- char buf[kBufferLen] = {};
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
- va_end(ap);
- OpenGLLogger::get()->writeCoarse(buf);
-}
-
-void android_opengl_cxt_logger_write(const char* fmt, ...) {
- char buf[kBufferLen] = {};
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
- va_end(ap);
- OpenGLLogger::get()->writeFineTimestamped(buf);
-}
-
-void android_stop_opengl_logger() {
- OpenGLLogger* gl_log = OpenGLLogger::get();
- gl_log->stopFineLog();
-}
-
diff --git a/android/opengl/logger.h b/android/opengl/logger.h
deleted file mode 100644
index 3e800c9ce..000000000
--- a/android/opengl/logger.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2016 The Android Open Source Project
-//
-// This software is licensed under the terms of the GNU General Public
-// License version 2, as published by the Free Software Foundation, and
-// may be copied, distributed, and modified under those terms.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-#include "android/utils/compiler.h"
-
-ANDROID_BEGIN_HEADER
-
-// The purpose of the OpenGL logger is to log
-// information about such things as EGL initialization
-// and possibly miscellanous OpenGL commands,
-// in order to get a better idea of what is going on
-// in crash reports.
-
-// C interface for android-emugl
-void android_init_opengl_logger();
-void android_opengl_logger_write(const char* fmt, ...);
-void android_stop_opengl_logger();
-
-// This is for logging what goes on in individual OpenGL
-// contexts (cxts). Only called when emugl is compiled
-// with -DOPENGL_DEBUG_PRINTOUT.
-void android_opengl_cxt_logger_write(const char* fmt, ...);
-
-typedef void (*android_opengl_logger_t)(const char* fmt, ...);
-
-typedef struct {
- android_opengl_logger_t coarse;
- android_opengl_logger_t fine;
-} emugl_logger_struct;
-
-ANDROID_END_HEADER
diff --git a/android/scripts/tests/gen-entries/run-tests.sh b/android/scripts/tests/gen-entries/run-tests.sh
deleted file mode 100755
index 89774127e..000000000
--- a/android/scripts/tests/gen-entries/run-tests.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/sh
-
-# Copyright 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-PROGDIR=$(dirname "$0")
-
-TOPDIR=$(cd $PROGDIR/../.. && pwd -P)
-
-# Remove leading ./ if applicable.
-PROGDIR=${PROGDIR#./}
-
-# Assume we are under .../android/scripts/tests/gen-entries/
-# and look for .../android/scripts/utils/common.shi
-
-_SHU_PROGDIR=$TOPDIR/utils
-. $_SHU_PROGDIR/common.shi
-
-shell_import option_parser.shi
-
-PROGRAM_PARAMETERS=
-
-PROGRAM_DESCRIPTION=\
-"Run the test suite for the gen-entries.py script. This looks for
-files named t.<number>/<name>.entries, and uses them as input to
-'gen-entries.py'. It then compares the output to t.<number>/<name>.<mode> ."
-
-OPT_SCRIPT=$TOPDIR/gen-entries.py
-option_register_var "--script=<script>" OPT_SCRIPT "Specify alternate gen-entries.py script." "$SCRIPT"
-
-OPT_OUT_DIR=
-option_register_var "--out-dir=<dir>" OPT_OUT_DIR "Generate outputs into <dir>"
-
-OPT_TOOL=
-option_register_var "--tool=<tool>" OPT_TOOL "Launch visual diff tool in case of differences."
-
-option_parse "$@"
-
-# Check gen-entries.py script.
-if [ ! -f "$OPT_SCRIPT" ]; then
- panic "Cannot find script: $OPT_SCRIPT"
-fi
-
-# Create output directory.
-OUT_DIR=
-if [ "$OPT_OUT_DIR" ]; then
- OUT_DIR=$OPT_OUT_DIR
-else
- OUT_DIR=/tmp/emulator-gen-entries-testing
- echo "Auto-config: --out-dir=$OUT_DIR"
-fi
-mkdir -p "$OUT_DIR" && rm -rf "$OUT_DIR/gen-entries"
-
-OUT_DIR=$OUT_DIR/gen-entries
-
-MODES="def sym wrapper symbols _symbols functions funcargs"
-
-# Find test directories
-TEST_DIRS=$(cd "$PROGDIR" && find . -name "t.*" | sed -e 's|^\./||')
-for TEST_DIR in $TEST_DIRS; do
- IN=$PROGDIR/$TEST_DIR
- NAMES=$(cd $IN && find . -name "*.entries" | sed -e 's|^\./||g' -e 's|\.entries$||g')
- OUT=$OUT_DIR/$TEST_DIR
- mkdir -p "$OUT"
- for NAME in $NAMES; do
- echo "Processing $TEST_DIR/$NAME.entries"
- run cp -f "$IN/$NAME.entries" "$OUT/$NAME.entries"
- for MODE in $MODES; do
- run $OPT_SCRIPT --mode=$MODE "$IN/$NAME.entries" --output=$OUT/$NAME.$MODE
- done
- done
- if ! diff -qr "$IN" "$OUT"; then
- if [ "$OPT_TOOL" ]; then
- $OPT_TOOL "$IN" "$OUT"
- else
- echo "ERROR: Invalid differences between actual and expected output!"
- diff -burN "$IN" "$OUT"
- exit 1
- fi
- fi
-done
-
-echo "All good!"
-exit 0
diff --git a/android/scripts/tests/gen-entries/t.001/test._symbols b/android/scripts/tests/gen-entries/t.001/test._symbols
deleted file mode 100644
index 7ab43ac14..000000000
--- a/android/scripts/tests/gen-entries/t.001/test._symbols
+++ /dev/null
@@ -1,10 +0,0 @@
-_initLibrary
-_setStreamMode
-_initOpenGLRenderer
-_getHardwareStrings
-_setPostCallback
-_createOpenGLSubwindow
-_destroyOpenGLSubwindow
-_setOpenGLDisplayRotation
-_repaintOpenGLDisplay
-_stopOpenGLRenderer
diff --git a/android/scripts/tests/gen-entries/t.001/test.def b/android/scripts/tests/gen-entries/t.001/test.def
deleted file mode 100644
index 6ba0d73a5..000000000
--- a/android/scripts/tests/gen-entries/t.001/test.def
+++ /dev/null
@@ -1,11 +0,0 @@
-EXPORTS
- initLibrary
- setStreamMode
- initOpenGLRenderer
- getHardwareStrings
- setPostCallback
- createOpenGLSubwindow
- destroyOpenGLSubwindow
- setOpenGLDisplayRotation
- repaintOpenGLDisplay
- stopOpenGLRenderer
diff --git a/android/scripts/tests/gen-entries/t.001/test.entries b/android/scripts/tests/gen-entries/t.001/test.entries
deleted file mode 100644
index 35ef9232a..000000000
--- a/android/scripts/tests/gen-entries/t.001/test.entries
+++ /dev/null
@@ -1,106 +0,0 @@
-!render_api
-
-%#include "render_api_platform_types.h"
-%#include <stdbool.h>
-%#include <stddef.h>
-%#include <stdint.h>
-
-%typedef void (*OnPostFn)(void* context, int width, int height, int ydir,
-% int format, int type, unsigned char* pixels);
-
-# Initialize the library and tries to load the corresponding EGL/GLES
-# translation libraries. Must be called before anything else to ensure that
-# everything works. Returns 0 on success, error code otherwise.
-# If it returns an error, you cannot use the library at all.
-int initLibrary(void);
-
-# Change the stream mode. This must be called before initOpenGLRenderer()
-# |mode| is one of STREAM_DEFAULT, STREAM_UNIX, STREAM_TCP or STREAM_PIPE.
-int setStreamMode(int mode);
-
-
-# initOpenGLRenderer - initialize the OpenGL renderer process.
-#
-# width and height are the framebuffer dimensions that will be reported to the
-# guest display driver.
-#
-# addr is a buffer of addrLen bytes that will receive the address that clients
-# should connect to. The interpretation depends on the transport:
-# - TCP: The buffer contains the port number as a string. The server is
-# listening only on the loopback address.
-# - Win32 and UNIX named pipes: The buffer contains the full path clients
-# should connect to.
-#
-# This function is *NOT* thread safe and should be called first
-# to initialize the renderer after initLibrary().
-int initOpenGLRenderer(int width, int height, char* addr, size_t addrLen);
-
-# getHardwareStrings - describe the GPU hardware and driver.
-# The underlying GL's vendor/renderer/version strings are returned to the
-# caller. The pointers become invalid after a call to stopOpenGLRenderer().
-void getHardwareStrings(const char** vendor, const char** renderer, const char** version);
-
-# A per-frame callback can be registered with setPostCallback(); to remove it
-# pass NULL for both parameters. While a callback is registered, the renderer
-# will call it 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().
-void setPostCallback(OnPostFn onPost, void* onPostContext);
-
-# createOpenGLSubwindow -
-# Create a native subwindow which is a child of 'window'
-# to be used for framebuffer display.
-# x,y,width,height are the dimensions of the rendering subwindow.
-# zRot is the rotation to apply on the framebuffer display image.
-#
-# Return true on success, false on failure, which can happen when using
-# a software-only renderer like OSMesa. In this case, the client should
-# call setPostCallback to get the content of each new frame when it is
-# posted, and will be responsible for displaying it.
-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.
-# Return true on success, false otherwise.
-bool destroyOpenGLSubwindow(void);
-
-# 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(void);
-
-# stopOpenGLRenderer - stops the OpenGL renderer process.
-# This functions is#NOT* thread safe and should be called
-# only if previous initOpenGLRenderer has returned true.
-int stopOpenGLRenderer(void);
diff --git a/android/scripts/tests/gen-entries/t.001/test.funcargs b/android/scripts/tests/gen-entries/t.001/test.funcargs
deleted file mode 100644
index 09b56be4d..000000000
--- a/android/scripts/tests/gen-entries/t.001/test.funcargs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs android/scripts/tests/gen-entries/t.001/test.entries --output=/tmp/emulator-gen-entries-testing/gen-entries/t.001/test.funcargs
-// DO NOT EDIT THIS FILE
-
-#ifndef RENDER_API_FUNCTIONS_H
-#define RENDER_API_FUNCTIONS_H
-
-#include "render_api_platform_types.h"
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-typedef void (*OnPostFn)(void* context, int width, int height, int ydir,
- int format, int type, unsigned char* pixels);
-#define LIST_RENDER_API_FUNCTIONS(X) \
- X(int, initLibrary, (), ()) \
- X(int, setStreamMode, (int mode), (mode)) \
- X(int, initOpenGLRenderer, (int width, int height, char* addr, size_t addrLen), (width, height, addr, addrLen)) \
- X(void, getHardwareStrings, (const char** vendor, const char** renderer, const char** version), (vendor, renderer, version)) \
- X(void, setPostCallback, (OnPostFn onPost, void* onPostContext), (onPost, onPostContext)) \
- X(bool, createOpenGLSubwindow, (FBNativeWindowType window, int x, int y, int width, int height, float zRot), (window, x, y, width, height, zRot)) \
- X(bool, destroyOpenGLSubwindow, (), ()) \
- X(void, setOpenGLDisplayRotation, (float zRot), (zRot)) \
- X(void, repaintOpenGLDisplay, (), ()) \
- X(int, stopOpenGLRenderer, (), ()) \
-
-
-#endif // RENDER_API_FUNCTIONS_H
diff --git a/android/scripts/tests/gen-entries/t.001/test.functions b/android/scripts/tests/gen-entries/t.001/test.functions
deleted file mode 100644
index c187d6cee..000000000
--- a/android/scripts/tests/gen-entries/t.001/test.functions
+++ /dev/null
@@ -1,26 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=functions android/scripts/tests/gen-entries/t.001/test.entries --output=/tmp/emulator-gen-entries-testing/gen-entries/t.001/test.functions
-// DO NOT EDIT THIS FILE
-
-#ifndef RENDER_API_FUNCTIONS_H
-#define RENDER_API_FUNCTIONS_H
-
-#include "render_api_platform_types.h"
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-typedef void (*OnPostFn)(void* context, int width, int height, int ydir,
- int format, int type, unsigned char* pixels);
-#define LIST_RENDER_API_FUNCTIONS(X) \
- X(int, initLibrary, ()) \
- X(int, setStreamMode, (int mode)) \
- X(int, initOpenGLRenderer, (int width, int height, char* addr, size_t addrLen)) \
- X(void, getHardwareStrings, (const char** vendor, const char** renderer, const char** version)) \
- X(void, setPostCallback, (OnPostFn onPost, void* onPostContext)) \
- X(bool, createOpenGLSubwindow, (FBNativeWindowType window, int x, int y, int width, int height, float zRot)) \
- X(bool, destroyOpenGLSubwindow, ()) \
- X(void, setOpenGLDisplayRotation, (float zRot)) \
- X(void, repaintOpenGLDisplay, ()) \
- X(int, stopOpenGLRenderer, ()) \
-
-
-#endif // RENDER_API_FUNCTIONS_H
diff --git a/android/scripts/tests/gen-entries/t.001/test.sym b/android/scripts/tests/gen-entries/t.001/test.sym
deleted file mode 100644
index 8e5f544eb..000000000
--- a/android/scripts/tests/gen-entries/t.001/test.sym
+++ /dev/null
@@ -1,15 +0,0 @@
-VERSION {
- global:
- initLibrary;
- setStreamMode;
- initOpenGLRenderer;
- getHardwareStrings;
- setPostCallback;
- createOpenGLSubwindow;
- destroyOpenGLSubwindow;
- setOpenGLDisplayRotation;
- repaintOpenGLDisplay;
- stopOpenGLRenderer;
- local:
- *;
-};
diff --git a/android/scripts/tests/gen-entries/t.001/test.symbols b/android/scripts/tests/gen-entries/t.001/test.symbols
deleted file mode 100644
index 17de287c0..000000000
--- a/android/scripts/tests/gen-entries/t.001/test.symbols
+++ /dev/null
@@ -1,10 +0,0 @@
-initLibrary
-setStreamMode
-initOpenGLRenderer
-getHardwareStrings
-setPostCallback
-createOpenGLSubwindow
-destroyOpenGLSubwindow
-setOpenGLDisplayRotation
-repaintOpenGLDisplay
-stopOpenGLRenderer
diff --git a/android/scripts/tests/gen-entries/t.001/test.wrapper b/android/scripts/tests/gen-entries/t.001/test.wrapper
deleted file mode 100644
index c8e0ab0bb..000000000
--- a/android/scripts/tests/gen-entries/t.001/test.wrapper
+++ /dev/null
@@ -1,98 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=wrapper android/scripts/tests/gen-entries/t.001/test.entries --output=/tmp/emulator-gen-entries-testing/gen-entries/t.001/test.wrapper
-// DO NOT EDIT THIS FILE
-
-#include <dlfcn.h>
-#include "render_api_platform_types.h"
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-typedef void (*OnPostFn)(void* context, int width, int height, int ydir,
- int format, int type, unsigned char* pixels);
-
-///
-/// W R A P P E R P O I N T E R S
-///
-
-static int (*__dll_initLibrary)() = 0;
-static int (*__dll_setStreamMode)(int mode) = 0;
-static int (*__dll_initOpenGLRenderer)(int width, int height, char* addr, size_t addrLen) = 0;
-static void (*__dll_getHardwareStrings)(const char** vendor, const char** renderer, const char** version) = 0;
-static void (*__dll_setPostCallback)(OnPostFn onPost, void* onPostContext) = 0;
-static bool (*__dll_createOpenGLSubwindow)(FBNativeWindowType window, int x, int y, int width, int height, float zRot) = 0;
-static bool (*__dll_destroyOpenGLSubwindow)() = 0;
-static void (*__dll_setOpenGLDisplayRotation)(float zRot) = 0;
-static void (*__dll_repaintOpenGLDisplay)() = 0;
-static int (*__dll_stopOpenGLRenderer)() = 0;
-
-///
-/// W R A P P E R F U N C T I O N S
-///
-
-int initLibrary() {
- return __dll_initLibrary();
-}
-
-int setStreamMode(int mode) {
- return __dll_setStreamMode(mode);
-}
-
-int initOpenGLRenderer(int width, int height, char* addr, size_t addrLen) {
- return __dll_initOpenGLRenderer(width, height, addr, addrLen);
-}
-
-void getHardwareStrings(const char** vendor, const char** renderer, const char** version) {
- __dll_getHardwareStrings(vendor, renderer, version);
-}
-
-void setPostCallback(OnPostFn onPost, void* onPostContext) {
- __dll_setPostCallback(onPost, onPostContext);
-}
-
-bool createOpenGLSubwindow(FBNativeWindowType window, int x, int y, int width, int height, float zRot) {
- return __dll_createOpenGLSubwindow(window, x, y, width, height, zRot);
-}
-
-bool destroyOpenGLSubwindow() {
- return __dll_destroyOpenGLSubwindow();
-}
-
-void setOpenGLDisplayRotation(float zRot) {
- __dll_setOpenGLDisplayRotation(zRot);
-}
-
-void repaintOpenGLDisplay() {
- __dll_repaintOpenGLDisplay();
-}
-
-int stopOpenGLRenderer() {
- return __dll_stopOpenGLRenderer();
-}
-
-
-///
-/// I N I T I A L I Z A T I O N F U N C T I O N
-///
-
-int render_api_dynlink_init(void* lib) {
- __dll_initLibrary = (int(*)())dlsym(lib, "initLibrary");
- if (!__dll_initLibrary) return -1;
- __dll_setStreamMode = (int(*)(int mode))dlsym(lib, "setStreamMode");
- if (!__dll_setStreamMode) return -1;
- __dll_initOpenGLRenderer = (int(*)(int width, int height, char* addr, size_t addrLen))dlsym(lib, "initOpenGLRenderer");
- if (!__dll_initOpenGLRenderer) return -1;
- __dll_getHardwareStrings = (void(*)(const char** vendor, const char** renderer, const char** version))dlsym(lib, "getHardwareStrings");
- if (!__dll_getHardwareStrings) return -1;
- __dll_setPostCallback = (void(*)(OnPostFn onPost, void* onPostContext))dlsym(lib, "setPostCallback");
- if (!__dll_setPostCallback) return -1;
- __dll_createOpenGLSubwindow = (bool(*)(FBNativeWindowType window, int x, int y, int width, int height, float zRot))dlsym(lib, "createOpenGLSubwindow");
- if (!__dll_createOpenGLSubwindow) return -1;
- __dll_destroyOpenGLSubwindow = (bool(*)())dlsym(lib, "destroyOpenGLSubwindow");
- if (!__dll_destroyOpenGLSubwindow) return -1;
- __dll_setOpenGLDisplayRotation = (void(*)(float zRot))dlsym(lib, "setOpenGLDisplayRotation");
- if (!__dll_setOpenGLDisplayRotation) return -1;
- __dll_repaintOpenGLDisplay = (void(*)())dlsym(lib, "repaintOpenGLDisplay");
- if (!__dll_repaintOpenGLDisplay) return -1;
- __dll_stopOpenGLRenderer = (int(*)())dlsym(lib, "stopOpenGLRenderer");
- if (!__dll_stopOpenGLRenderer) return -1;
- return 0;
-}
diff --git a/distrib/android-emugl/Android.mk b/distrib/android-emugl/Android.mk
deleted file mode 100644
index 41f542525..000000000
--- a/distrib/android-emugl/Android.mk
+++ /dev/null
@@ -1,102 +0,0 @@
-# This is the top-level build file for the Android HW OpenGL ES emulation
-# in Android.
-#
-# You must define BUILD_EMULATOR_HOST_OPENGL to 'true' in your environment to
-# build the following files.
-#
-# Top-level for all modules
-EMUGL_PATH := $(call my-dir)
-
-EMUGL_OLD_LOCAL_PATH := $(LOCAL_PATH)
-
-# Directory containing common headers 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 \
- $(EMUGL_PATH)/shared
-
-EMUGL_COMMON_INCLUDES := $(EMUGL_PATH)/host/libs/Translator/include
-
-# common cflags used by several modules
-# This is always set to a module's LOCAL_CFLAGS
-# See the definition of emugl-begin-module in common.mk
-
-# Needed to ensure SIZE_MAX is properly defined when including <stdint.h>
-EMUGL_COMMON_CFLAGS += -D__STDC_LIMIT_MACROS=1
-
-# Define EMUGL_BUILD_DEBUG=1 in your environment to build a
-# debug version of the EmuGL host binaries.
-ifneq (,$(strip $(EMUGL_BUILD_DEBUG)))
-EMUGL_COMMON_CFLAGS += -O0 -g -DEMUGL_DEBUG=1
-endif
-
-EMUGL_COMMON_CFLAGS += -DEMUGL_BUILD=1
-ifeq (linux,$(HOST_OS))
-EMUGL_COMMON_CFLAGS += -fvisibility=internal
-endif
-ifeq (darwin,$(HOST_OS))
-EMUGL_COMMON_CFLAGS += -fvisibility=hidden
-endif
-
-# 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.
-#
-
-# Required by our units test.
-include $(EMUGL_PATH)/googletest.mk
-
-# First, build the emugen host source-generation tool
-#
-# It will be used by other modules to generate wire protocol encode/decoder
-# source files (see all emugl-gen-decoder/encoder in common.mk)
-#
-include $(EMUGL_PATH)/host/tools/emugen/Android.mk
-
-include $(EMUGL_PATH)/shared/emugl/common/Android.mk
-include $(EMUGL_PATH)/shared/OpenglCodecCommon/Android.mk
-
-ifeq (true,$(EMULATOR_USE_ANGLE))
-# Alternative graphics translation (GT) implementation, stripped off
-# and adjust from the equivalent mod in the ARC project.
-# This GT acts as a thin wrapper + GLESv1-to-v2 translator
-# and forwards GLES calls to underlying GLES API (e.g. ANGLE)
-#
-include $(EMUGL_PATH)/host/libs/graphics_translation/common/Android.mk
-include $(EMUGL_PATH)/host/libs/graphics_translation/gles/Android.mk
-endif
-
-# Host static libraries
-include $(EMUGL_PATH)/host/libs/GLESv1_dec/Android.mk
-include $(EMUGL_PATH)/host/libs/GLESv2_dec/Android.mk
-include $(EMUGL_PATH)/host/libs/renderControl_dec/Android.mk
-include $(EMUGL_PATH)/host/libs/Translator/GLcommon/Android.mk
-include $(EMUGL_PATH)/host/libs/Translator/GLES_CM/Android.mk
-include $(EMUGL_PATH)/host/libs/Translator/GLES_V2/Android.mk
-include $(EMUGL_PATH)/host/libs/Translator/EGL/Android.mk
-include $(EMUGL_PATH)/host/libs/libOpenGLESDispatch/Android.mk
-
-# Host shared libraries
-include $(EMUGL_PATH)/host/libs/libOpenglRender/Android.mk
-
-LOCAL_PATH := $(EMUGL_OLD_LOCAL_PATH)
diff --git a/distrib/android-emugl/DESIGN b/distrib/android-emugl/DESIGN
deleted file mode 100644
index e1a262f27..000000000
--- a/distrib/android-emugl/DESIGN
+++ /dev/null
@@ -1,614 +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 libraries are under
- $ANDROID/development/tools/emulator/opengl, which we'll call $EMUGL_GUEST
-
- - The host renderer and translator libraries are under
- $ANDROID/sdk/emulator/opengl, which we'll call $EMUGL_HOST
-
- - 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_GUEST/system -> system libraries
- $EMUGL_GUEST/shared -> guest copy of shared libraries
- $EMUGL_GUEST/tests -> various test programs
- $EMUGL_HOST/host -> host libraries (translator + renderer)
- $EMUGL_HOST/shared -> host copy of shared libraries
- $EMUGL_HOST/tests -> various test programs
-
-The reason the shared libraries aren't actually shared is historical: at one
-point both guest and host code lived in the same place. That turned out to be
-impractical with the way the Android SDK is branched, and didn't support the
-requirement that a single emulator binary be able to run several generations
-of Android.
-
-
-Translator libraries:
----------------------
-
-There are three translator host libraries provided by this project:
-
- libEGL_translator -> EGL 1.2 translation
- libGLES_CM_translator -> GLES 1.1 translation
- libGLES_V2_translator -> GLES 2.0 translation
-
-The full name of the library will depend on the host system.
-For simplicity, only the library name suffix will change (i.e. the
-'lib' prefix is not dropped on Windows), i.e.:
-
- libEGL_translator.so -> for Linux
- libEGL_translator.dylib -> for OS X
- libEGL_translator.dll -> for Windows
-
-The source code for these libraries is located under the following
-path in the Android source tree:
-
- $EMUGL_HOST/host/libs/Translator/EGL
- $EMUGL_HOST/host/libs/Translator/GLES_CM
- $EMUGL_HOST/host/libs/Translator/GLES_V2
-
-The translator libraries also use a common routines defined under:
-
- $EMUGL_HOST/host/libs/Translator/GLcommon
-
-
-Wire Protocol Overiew:
-----------------------
-
-The "wire protocol" is implemented as follows:
-
- - EGL/GLES function calls are described through several "specification"
- files, which describes the types, function signatures and various
- attributes for each one of them.
-
- - These files are read by a tool called "emugen" which generates C
- source files and headers based on the specification. These correspond
- to both encoding, decoding and "wrappers" (more on this later).
-
- - System "encoder" static libraries are built using some of these generated
- files. They contain code that can serialize EGL/GLES calls into simple
- byte messages and send it through a generic "IOStream" object.
-
- - Host "decoder" static libraries are also built using some of these
- generated files. Their code retrieves byte messages from an "IOStream"
- object, and translates them into function callbacks.
-
-IOStream abstraction:
-- - - - - - - - - - -
-
-The "IOStream" is a very simple abstract class used to send byte messages
-both in the guest and host. It is defined through a shared header under
-$EMUGL/host/include/OpenglRender/IOStream.h
-
-Note that despite the path, this header is included by *both* host and guest
-source code. The main idea around IOStream's design is that to send a message,
-one does the following:
-
- 1/ call stream->allocBuffer(size), which returns the address of a
- memory buffer of at least 'size' bytes.
-
- 2/ write the content of the serialized command (usually a header + some
- payload) directly into the buffer
-
- 3/ call stream->commitBuffer() to send it.
-
-Alternatively, one can also pack several commands into a single buffer with
-stream->alloc() and stream->flush(), as in:
-
- 1/ buf1 = stream->alloc(size1)
- 2/ write first command bytes into buf1
- 3/ buf2 = stream->alloc(size2)
- 4/ write second command bytes into buf2
- 5/ stream->flush()
-
-Finally, there are also explict read/write methods like stream->readFully()
-or stream->writeFully() which can be used when you don't want an intermediate
-buffer. This is used in certain cases by the implementation, e.g. to avoid
-an intermediate memory copy when sending texture data from the guest to the
-host.
-
-The host IOStream implementations are under $EMUGL/shared/OpenglCodecCommon/,
-see in particular:
-
- $EMUGL_HOST/shared/OpenglCodecCommon/TcpStream.cpp
- -> using local TCP sockets
- $EMUGL_HOST/shared/OpenglCodecCommon/UnixStream.cpp
- -> using Unix sockets
- $EMUGL_HOST/shared/OpenglCodecCommon/Win32PipeStream.cpp
- -> using Win32 named pipes
-
-The guest IOStream implementation uses the TcpStream.cpp above, as well as
-an alternative QEMU-specific source:
-
- $EMUGL_GUEST/system/OpenglSystemCommon/QemuPipeStream.cpp
- -> uses QEMU pipe from the guest
-
-The QEMU Pipe implementation is _significantly_ faster (about 20x) due to
-several reasons:
-
- - all succesful read() and write() operations through it are instantaneous
- from the guest's point of view.
-
- - all buffer/memory copies are performed directly by the emulator, and thus
- much faster than performing the same thing inside the kernel with emulated
- ARM instructions.
-
- - it doesn't need to go through a kernel TCP/IP stack that will wrap the
- data into TCP/IP/MAC packets, send them to an emulated ethernet device,
- which is itself connected to an internal firewall implementation that
- will unwrap the packets, re-assemble them, then send them through BSD
- sockets to the host kernel.
-
-However, would it be necessary, you could write a guest IOStream implementation
-that uses a different transport. If you do, please look at
-$EMUGL_GUEST/system/OpenglCodecCommon/HostConnection.cpp which contains the
-code used to connect the guest to the host, on a per-thread basis.
-
-
-Source code auto-generation:
-- - - - - - - - - - - - - -
-
-The 'emugen' tool is located under $EMUGL_HOST/host/tools/emugen. There is a
-README file that explains how it works.
-
-You can also look at the following specifications files:
-
-For GLES 1.1:
- $EMUGL_HOST/host/GLESv1_dec/gl.types
- $EMUGL_HOST/host/GLESv1_dec/gl.in
- $EMUGL_HOST/host/GLESv1_dec/gl.attrib
-
-For GLES 2.0:
- $EMUGL_HOST/host/GLESv2_dec/gl2.types
- $EMUGL_HOST/host/GLESv2_dec/gl2.in
- $EMUGL_HOST/host/GLESv2_dec/gl2.attrib
-
-For EGL:
- $EMUGL_HOST/host/renderControl_dec/renderControl.types
- $EMUGL_HOST/host/renderControl_dec/renderControl.in
- $EMUGL_HOST/host/renderControl_dec/renderControl.attrib
-
-Note that the EGL specification files are under a directory named
-"renderControl_dec" and have filenames that begin with "renderControl"
-
-This is mainly for historic reasons now, but is also related to the fact that
-this part of the wire protocol contains support functions/calls/specifications
-that are not part of the EGL specification itself, but add a few features
-required to make everything works. For example, they have calls related to
-the "gralloc" system library module used to manage graphics surfaces at a
-lower level than EGL.
-
-Generally speaking, guest encoder sources are located under directories
-named $EMUGL_GUEST/system/<name>_enc/, while the corresponding host decoder
-sources will be under $EMUGL_HOST/host/libs/<name>_dec/
-
-However, all these sources use the same spec files located under the
-decoding directories.
-
-The encoder files are built from emugen and spec files located in $EMUGL_HOST
-and copied to the encoder directories in $EMUGL_GUEST by the gen-encoder.sh
-script. They are checked in, so that a given version of Android supports a
-specific version of the protocol, even if newer versions of the renderer (and
-future Android versions) support a newer protocol version. This step needs to
-be done manually when the protocol changes; these changes also need to be
-accompanied by changes in the renderer to handle the old version of the
-protocol.
-
-
-System libraries:
------------------
-
-Meta EGL/GLES system libraries, and egl.cfg:
-- - - - - - - - - - - - - - - - - - - - - -
-
-It is important to understand that the emulation-specific EGL/GLES libraries
-are not directly linked by applications at runtime. Instead, the system
-provides a set of "meta" EGL/GLES libraries that will load the appropriate
-hardware-specific libraries on first use.
-
-More specifically, the system libEGL.so contains a "loader" which will try
-to load:
-
- - hardware-specific EGL/GLES libraries
- - the software-based rendering libraries (called "libagl")
-
-The system libEGL.so is also capable of merging the EGL configs of both the
-hardware and software libraries transparently to the application. The system
-libGLESv1_CM.so and libGLESv2.so, work with it to ensure that the thread's
-current context will be linked to either the hardware or software libraries
-depending on the config selected.
-
-For the record, the loader's source code in under
-frameworks/base/opengl/libs/EGL/Loader.cpp. It depends on a file named
-/system/lib/egl/egl.cfg which must contain two lines that look like:
-
- 0 1 <name>
- 0 0 android
-
-The first number in each line is a display number, and must be 0 since the
-system's EGL/GLES libraries don't support anything else.
-
-The second number must be 1 to indicate hardware libraries, and 0 to indicate
-a software one. The line corresponding to the hardware library, if any, must
-always appear before the one for the software library.
-
-The third field is a name corresponding to a shared library suffix. It really
-means that the corresponding libraries will be named libEGL_<name>.so,
-libGLESv1_CM_<name>.so and libGLESv2_<name>.so. Moreover these libraries must
-be placed under /system/lib/egl/
-
-The name "android" is reserved for the system software renderer.
-
-The egl.cfg that comes with this project uses the name "emulation" for the
-hardware libraries. This means that it provides an egl.cfg file that contains
-the following lines:
-
- 0 1 emulation
- 0 0 android
-
-See $EMUGL_GUEST/system/egl/egl.cfg and more generally the following build
-files:
-
- $EMUGL_GUEST/system/egl/Android.mk
- $EMUGL_GUEST/system/GLESv1/Android.mk
- $EMUGL_GUEST/system/GLESv2/Android.mk
-
-to see how the libraries are named and placed under /system/lib/egl/ by the
-build system.
-
-
-Emulation libraries:
-- - - - - - - - - - -
-
-The emulator-specific libraries are under the following:
-
- $EMUGL_GUEST/system/egl/
- $EMUGL_GUEST/system/GLESv1/
- $EMUGL_GUEST/system/GLESv2/
-
-The code for GLESv1 and GLESv2 is pretty small, since it mostly link against
-the static encoding libraries.
-
-The code for EGL is a bit more complex, because it needs to deal with
-extensions dynamically. I.e. if an extension is not available on the host
-it shouldn't be exposed by the library at runtime. So the EGL code queries
-the host for the list of available extensions in order to return them to
-clients. Similarly, it must query the list of valid EGLConfigs for the
-current host system.
-
-
-"gralloc" module implementation:
-- - - - - - - - - - - - - - - - -
-
-In addition to EGL/GLES libraries, the Android system requires a
-hardware-specific library to manage graphics surfaces at a level lower than
-EGL. This library must be what is called in Android land as a "HAL module".
-
-A "HAL module" must provide interfaces defined by Android's HAL
-(Hardware Abstraction Library). These interface definitions can be found
-under $ANDROID/hardware/libhardware/include/
-
-Of all possible HAL modules, the "gralloc" one is used by the system's
-SurfaceFlinger to allocate framebuffers and other graphics memory regions,
-as well as eventually lock/unlock/swap them when needed.
-
-The code under $EMUGL/system/gralloc/ implements the module required by the
-GLES emulation project. It's not very long, but there are a few things to
-notice here:
-
-- first, it will probe the guest system to determine if the emulator that
- is running the virtual device really supports GPU emulation. In certain
- circumstances this may not be possible.
-
- If this is the case, then the module will redirect all calls to the
- "default" gralloc module that is normally used by the system when
- software-only rendering is enabled.
-
- The probing happens in the function "fallback_init" which gets called
- when the module is first opened. This initializes the 'sFallback' variable
- to a pointer to the default gralloc module when required.
-
-- second, this module is used by SurfaceFlinger to display "software surfaces",
- i.e. those that are backed by system memory pixel buffers, and written to
- directly through the Skia graphics library (i.e. the non-accelerated ones).
-
- the default module simply copies the pixel data from the surface to the
- virtual framebuffer i/o memory, but this project's gralloc module sends it
- to the renderer through the QEMU Pipe instead.
-
- It turns out that this results in _faster_ rendering/frame-rates overall,
- because memory copies inside the guest are slow, while QEMU pipe transfers
- are done directly in the emulator.
-
-
-Host Renderer:
---------------
-
-The host renderer library is located under
-$EMUGL_HOST/host/libs/libOpenglRender, and it provides an interface described
-by the headers under $EMUGL_HOST/host/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).
-
diff --git a/distrib/android-emugl/README b/distrib/android-emugl/README
deleted file mode 100644
index f806b4103..000000000
--- a/distrib/android-emugl/README
+++ /dev/null
@@ -1,96 +0,0 @@
-This directory contains the host-side modules related to hardware OpenGL ES
-emulation. The guest-side modules are in
-$ANDROID_BUILD_TOP/development/tools/emulator/opengl.
-
-I. Overview of components:
-==========================
-
-The 'emugen' tool is used to generate several source files related to the
-EGL/GLES command stream used between the guest and the host during emulation.
-
- host/tools/emugen -> emugen program
-
-Note that emugen is capable of generating, from a single set of specification
-files, three types of auto-generated sources:
-
- - sources to encode commands into a byte stream.
- - sources to decode the byte stream into commands.
- - sources to wrap normal procedural EGL/GLES calls into context-aware ones.
-
-Modules under the system/ directory corresponds to code that runs on the
-guest, and implement the marshalling of EGL/GLES commands into a stream of
-bytes sent to the host through a fast pipe mechanism.
-
- system/GLESv1_enc -> encoder for GLES 1.1 commands
- system/GLESv2_enc -> encoder for GLES 2.0 commands
- system/renderControl_enc -> encoder for rendering control commands
- system/egl -> emulator-specific guest EGL library
- system/GLESv1 -> emulator-specific guest GLES 1.1 library
- system/gralloc -> emulator-specific gralloc module
- system/OpenglSystemCommon -> library of common routines
-
-Modules under the host/ directory corresponds to code that runs on the
-host, and implement the decoding of the command stream, translation of
-EGL/GLES commands into desktop GL 2.0 ones, and rendering to an off-screen
-buffer.
-
- host/libs/GLESv1_dec -> decoder for GLES 1.1 commands
- host/libs/GLESv2_dec -> decoder for GLES 2.0 commands
- host/libs/renderControl_dec -> decoder for rendering control commands
-
- host/libs/Translator/EGL -> translator for EGL commands
- host/libs/Translator/GLES_CM -> translator for GLES 1.1 commands
- host/libs/Translator/GLES_V2 -> translator for GLES 2.0 commands
- host/libs/Translator/GLcommon -> library of common translation routines
-
- host/libs/libOpenglRender -> rendering library (uses all host libs above)
- can be used by the 'renderer' program below,
- or directly linked into the emulator UI program.
-
- host/renderer/ -> stand-alone renderer program executable.
- this can run in head-less mode and receive requests from
- several emulators at the same time. It is the receiving
- end of all command streams.
-
-Modules under the test/ directory correspond to test programs that are useful
-to debug the various modules described above:
-
- tests/EGL_host_wrapper -> a small library used to dynamically load the
- desktop libEGL.so or a replacement named by the
- ANDROID_EGL_LIB environment variable. This lib
- provides all EGL entry points.
-
- tests/emulator_test_renderer -> a small program to run the rendering library
- in a single SDL window on the host desktop.
-
- tests/gles_android_wrapper -> guest EGL / GLES libraries that are run on
- the device to run some tests. Replace the
- system/egl and system/GLESv1 modules for now.
-
- tests/translator_tests/GLES_CM -> desktop GLESv1 translation unit test
- tests/translator_tests/GLES_V2 -> desktop GLESv2 translation unit test
- tests/translator_tests/MacCommon -> used by translation tests on Mac only.
-
- tests/ut_rendercontrol_enc -> guest library used by tests/ut_renderer
- tests/ut_rendercontrol_dec -> host library used by tests/ut_renderer
- tests/ut_renderer -> unit-test for render control and rendering library.
-
-
-II. Build system considerations:
---------------------------------
-
-The dependencies on the more than 20 components described in the previous
-section are pretty sophisticated, involving lots of auto-generated code and
-non-trivial placement for guest/device libraries.
-
-To simplify the development and maintenance of these modules, a set of
-helper GNU Make function is defined in common.mk, and included from the
-Android.mk in this directory.
-
-These functions all begin with the "emugl-" prefix, and can be used to
-declare modules, what information they export to other modules, or import
-from them, and also what kind of auto-generated sources they depend on.
-
-Look at the comments inside common.mk and the Android.mk of the modules
-to better understand what's happening.
-
diff --git a/distrib/android-emugl/common.mk b/distrib/android-emugl/common.mk
deleted file mode 100644
index 72d44680b..000000000
--- a/distrib/android-emugl/common.mk
+++ /dev/null
@@ -1,237 +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,HOST_STATIC_LIBRARY)
-emugl-begin-shared-library = $(call emugl-begin-module,$1,HOST_SHARED_LIBRARY)
-emugl-begin-executable = $(call emugl-begin-module,$1,HOST_EXECUTABLE)
-
-# Variants of emugl-begin-<module-type> for host binaries, i.e. those generated
-# for the build machine's operating system (which will be different from the
-# target one in case of cross-compilation). This is useful for the 'emugen'
-# tool for example, since it is invoked later by the build system to generate
-# decoder sources.
-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_CLASS := $(patsubst HOST_%,%,$(patsubst %EXECUTABLE,%EXECUTABLES,$(patsubst %LIBRARY,%LIBRARIES,$2)))) \
- $(eval LOCAL_C_INCLUDES += $(if $3,,$(ANDROID_EMU_BASE_INCLUDES)) $(EMUGL_COMMON_INCLUDES)) \
- $(eval LOCAL_CFLAGS += $(EMUGL_COMMON_CFLAGS)) \
- $(eval LOCAL_STATIC_LIBRARIES += $(if $3,,$(ANDROID_EMU_BASE_STATIC_LIBRARIES))) \
- $(eval LOCAL_LDLIBS += $(if $3,,$(ANDROID_EMU_BASE_LDLIBS)) $(CXX_STD_LIB)) \
- $(eval LOCAL_BUILD_FILE := $(BUILD_$2)) \
- $(call _emugl-init-module,$1,$2,$3)
-
-# Used to end a module definition, see function definitions above
-emugl-end-module = \
- $(if $(_emugl_HOST),$(eval LOCAL_HOST_BUILD := true))\
- $(eval $(end-emulator-module-ev)) \
- $(eval LOCAL_BUILD_FILE :=) \
- $(eval _emugl_$(_emugl_HOST)modules += $(_emugl_MODULE))\
- $(if $(EMUGL_DEBUG),$(call emugl-dump-module))
-
-# Managing module exports and imports.
-#
-# A module can 'import' another module, by calling emugl-import. This will
-# make the current LOCAL_MODULE inherit various definitions exported from
-# the imported module.
-#
-# Module exports are defined by calling emugl-export. Here is an example:
-#
-# $(call emugl-begin-static-library,foo)
-# LOCAL_SRC_FILES := foo.c
-# $(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-# $(call emugl-export,SHARED_LIBRARIES,libcutils)
-# $(call emugl-end-module)
-#
-# $(call emugl-begin-shared-library,bar)
-# LOCAL_SRC_FILES := bar.cpp
-# $(call emugl-import,foo)
-# $(call emugl-end-module)
-#
-# Here, we define a static library named 'foo' which exports an include
-# path and a shared library requirement, and a shared library 'bar' which
-# imports it.
-#
-# What this means is that:
-#
-# - 'bar' will automatically inherit foo's LOCAL_PATH in its LOCAL_C_INCLUDES
-# - 'bar' will automatically inherit libcutils in its own LOCAL_SHARED_LIBRARIES
-#
-# Note that order of declaration matters. If 'foo' is defined after 'bar' in
-# the example above, nothing will work correctly because dependencies are
-# computed at import time.
-#
-#
-# IMPORTANT: Imports are transitive, i.e. when module A imports B,
-# it automatically imports anything imported by B too.
-
-# This is the list of recognized export types we support for now.
-EMUGL_EXPORT_TYPES := \
- CFLAGS \
- CXXFLAGS \
- LDLIBS \
- LDFLAGS \
- C_INCLUDES \
- SHARED_LIBRARIES \
- STATIC_LIBRARIES \
- ADDITIONAL_DEPENDENCIES
-
-# Initialize a module in our database
-# $1: Module name
-# $2: Module type
-# $3: "HOST" for a host module, empty for a target one.
-_emugl-init-module = \
- $(eval _emugl_HOST := $(if $3,HOST_,))\
- $(eval _emugl_MODULE := $(_emugl_HOST)$1)\
- $(if $(filter $(_emugl_$(_emugl_HOST)modules),$(_emugl_MODULE)),\
- $(error There is already a $(if $3,host,) module named $1!)\
- )\
- $(eval _mod = $(_emugl_MODULE)) \
- $(eval _emugl.$(_mod).type := $(patsubst HOST_%,%,$2))\
- $(eval _emugl.$(_mod).imports :=) \
- $(eval _emugl,$(_mod).moved :=) \
- $(foreach _type,$(EMUGL_EXPORT_TYPES),\
- $(eval _emugl.$(_mod).export.$(_type) :=)\
- )
-
-# Called to indicate that a module exports a given local variable for its
-# users. This also adds this to LOCAL_$1
-# $1: Local variable type (e.g. CFLAGS, LDLIBS, etc...)
-# $2: Value(s) to append to the export
-emugl-export = \
- $(eval _emugl.$(_emugl_MODULE).export.$1 += $2)\
- $(eval LOCAL_$1 := $(LOCAL_$1) $2)
-
-# Called to indicate that a module imports the exports of another module
-# $1: list of modules to import
-#
-emugl-import = \
- $(foreach _imod,$1,\
- $(call _emugl-module-import,$(_emugl_HOST)$(_imod))\
- )
-
-_emugl-module-import = \
- $(eval _mod := $(_emugl_MODULE))\
- $(if $(filter-out $(_emugl_$(_emugl_HOST)modules),$1),\
- $(info Unknown imported emugles module: $1)\
- $(if $(_emugl_HOST),\
- $(eval _names := $(patsubst HOST_%,%,$(_emugl_HOST_modules))),\
- $(eval _names := $(_emugl_modules))\
- )\
- $(info Please one of the following names: $(_names))\
- $(error Aborting)\
- )\
- $(if $(filter-out $(_emugl.$(_mod).imports),$1),\
- $(eval _emugl.$(_mod).imports += $1)\
- $(foreach _sub,$(_emugl.$1.imports),\
- $(call _emugl-module-import,$(_sub))\
- )\
- $(foreach _type,$(EMUGL_EXPORT_TYPES),\
- $(eval LOCAL_$(_type) := $(LOCAL_$(_type)) $(_emugl.$1.export.$(_type)))\
- )\
- $(if $(filter EXECUTABLE SHARED_LIBRARY,$(_emugl.$(_emugl_MODULE).type)),\
- $(if $(filter STATIC_LIBRARY,$(_emugl.$1.type)),\
- $(eval LOCAL_STATIC_LIBRARIES := $(1:HOST_%=%) $(LOCAL_STATIC_LIBRARIES))\
- )\
- $(if $(filter SHARED_LIBRARY,$(_emugl.$1.type)),\
- $(if $(_emugl.$1.moved),,\
- $(eval LOCAL_SHARED_LIBRARIES := $(1:HOST_%=%) $(LOCAL_SHARED_LIBRARIES))\
- )\
- )\
- )\
- )
-
-_emugl-dump-list = \
- $(foreach _list_item,$(strip $1),$(info . $(_list_item)))
-
-emugl-dump-module = \
- $(info MODULE=$(_emugl_MODULE))\
- $(info . HOST=$(_emugl_HOST))\
- $(info . TYPE=$(_emugl.$(_emugl_MODULE).type))\
- $(info . IMPORTS=$(_emugl.$(_emugl_MODULE).imports))\
- $(foreach _type,$(EMUGL_EXPORT_TYPES),\
- $(if $(filter C_INCLUDES ADDITIONAL_DEPENDENCIES,$(_type)),\
- $(info . EXPORT.$(_type) :=)\
- $(call _emugl-dump-list,$(_emugl.$(_emugl_MODULE).export.$(_type)))\
- $(info . LOCAL_$(_type) :=)\
- $(call _emugl-dump-list,$(LOCAL_$(_type)))\
- ,\
- $(info . EXPORT.$(_type) := $(strip $(_emugl.$(_emugl_MODULE).export.$(_type))))\
- $(info . LOCAL_$(_type) := $(strip $(LOCAL_$(_type))))\
- )\
- )\
- $(info . LOCAL_SRC_FILES := $(LOCAL_SRC_FILES))\
-
-# This function can be called to generate the decoder source files.
-# LOCAL_MODULE and LOCAL_MODULE_CLASS must be defined or the build will abort.
-# Source files will be stored in the local intermediates directory that will
-# be automatically added to your LOCAL_C_INCLUDES.
-#
-# Usage:
-# $(call emugl-gen-decoder,<input-dir>,<basename>)
-#
-emugl-gen-decoder = \
- $(eval _emugl_out := $(call intermediates-dir-for,$(HOST_BITS),$2))\
- $(call emugl-gen-decoder-generic,$(_emugl_out),$1,$2)\
- $(call emugl-export,C_INCLUDES,$(_emugl_out))
-
-# DO NOT CALL DIRECTLY, USE emugl-gen-decoder instead.
-#
-# The following function can be called to generate wire protocol decoder
-# source files, Usage is:
-#
-# $(call emugl-gen-decoder-generic,<dst-dir>,<src-dir>,<basename>)
-#
-# <dst-dir> is the destination directory where the generated sources are stored
-# <src-dir> is the source directory where to find <basename>.attrib, etc..
-# <basename> is the emugen basename (see host/tools/emugen/README)
-#
-emugl-gen-decoder-generic = $(eval $(emugl-gen-decoder-generic-ev))
-
-define emugl-gen-decoder-generic-ev
-_emugl_dec := $$1/$$3
-_emugl_src := $$2/$$3
-GEN := $$(_emugl_dec)_dec.cpp \
- $$(_emugl_dec)_dec.h \
- $$(_emugl_dec)_opcodes.h \
- $$(_emugl_dec)_server_context.h \
- $$(_emugl_dec)_server_context.cpp
-
-$$(GEN): PRIVATE_PATH := $$(LOCAL_PATH)
-$$(GEN): PRIVATE_CUSTOM_TOOL := $$(EMUGL_EMUGEN) -D $$1 -i $$2 $$3
-$$(GEN): $$(EMUGL_EMUGEN) $$(_emugl_src).attrib $$(_emugl_src).in $$(_emugl_src).types
- $$(transform-generated-source)
-
-$$(call emugl-export,ADDITIONAL_DEPENDENCIES,$$(GEN))
-LOCAL_GENERATED_SOURCES += $$(GEN)
-LOCAL_C_INCLUDES += $$1
-endef
-
diff --git a/distrib/android-emugl/gen-encoder.sh b/distrib/android-emugl/gen-encoder.sh
deleted file mode 100755
index c55a170c1..000000000
--- a/distrib/android-emugl/gen-encoder.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-# Generate the Android-side encoder source files.
-# Requirements:
-# (a) The ANDROID_BUILD_TOP and ANDROID_HOST_OUT environment variables must be
-# defined appropriately. The Android "lunch" bash function will do this.
-# (b) The emugen binary must already be built. Any normal build that includes
-# the emulator will do this.
-
-if [ -z "$ANDROID_BUILD_TOP" ]; then
- echo error: ANDROID_BUILD_TOP not set
- exit 1
-fi
-cd "$ANDROID_BUILD_TOP" >/dev/null
-SRCDIR="sdk/emulator/opengl/host/libs"
-DSTDIR="device/generic/goldfish/opengl/system"
-EMUGEN="external/qemu/objs/emugen"
-if [ ! -d "$SRCDIR" -o ! -d "$DSTDIR" ]; then
- echo error: can\'t find source and/or destination directory
- exit 1
-fi
-if [ ! -x "$EMUGEN" ]; then
- echo error: emugen not available, did you forget to build?
- exit 1
-fi
-
-function gen() {
- local src="$SRCDIR/$1_dec"
- local dst="$DSTDIR/$1_enc"
- local name="$2"
- echo "${EMUGEN}" -E "$dst" -i "$src" "$name" "$src/$name".{attrib,in,types}
-}
-
-$(gen GLESv1 gl)
-$(gen GLESv2 gl2)
-$(gen renderControl renderControl)
diff --git a/distrib/android-emugl/googletest.mk b/distrib/android-emugl/googletest.mk
deleted file mode 100644
index 6cf57e26d..000000000
--- a/distrib/android-emugl/googletest.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# This contains common definitions used to define a host module
-# to link GoogleTest with the EmuGL test programs.
-#
-# This is used instead of including external/gtest/Android.mk to
-# be able to build both the 32-bit and 64-bit binaries while
-# building a 32-bit only SDK (sdk-eng, sdk_x86-eng, sdk_mips-eng).
-
-
-ifeq (true,$(BUILD_STANDALONE_EMULATOR))
-LOCAL_PATH := $(EMULATOR_GTEST_SOURCES_DIR)
-else
-LOCAL_PATH := $(EMUGL_PATH)/../../../external/gtest
-endif
-
-common_SRC_FILES := \
- src/gtest-all.cc \
- src/gtest_main.cc
-
-common_CFLAGS := -O0
-
-ifneq (windows,$(HOST_OS))
- common_LDLIBS += -lpthread
-endif
-
-$(call emugl-begin-static-library,libemugl_gtest)
-LOCAL_SRC_FILES := $(common_SRC_FILES)
-LOCAL_CFLAGS += $(common_CFLAGS)
-LOCAL_CPP_EXTENSION := .cc
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include)
-$(call emugl-export,LDLIBS,$(common_LDLIBS))
-$(call emugl-end-module)
-
-$(call emugl-begin-host-static-library,libemugl_gtest_host)
-LOCAL_SRC_FILES := $(common_SRC_FILES)
-LOCAL_CFLAGS += $(common_CFLAGS)
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
-LOCAL_CPP_EXTENSION := .cc
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)/include)
-$(call emugl-export,LDLIBS,$(common_LDLIBS) -lpthread)
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/host/include/GLES3/gl3.h b/distrib/android-emugl/host/include/GLES3/gl3.h
deleted file mode 100644
index c9a31752c..000000000
--- a/distrib/android-emugl/host/include/GLES3/gl3.h
+++ /dev/null
@@ -1,939 +0,0 @@
-#ifndef __gl3_h_
-#define __gl3_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2014 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.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision: 26696 $ on $Date: 2014-05-17 14:48:55 -0700 (Sat, 17 May 2014) $
-*/
-
-#include <GLES3/gl3platform.h>
-
-/* Generated on date 20140517 */
-
-/* Generated C header for:
- * API: gles2
- * Profile: common
- * Versions considered: 2\.[0-9]|3.0
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_ES_VERSION_2_0
-#define GL_ES_VERSION_2_0 1
-#include <KHR/khrplatform.h>
-typedef khronos_int8_t GLbyte;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef short GLshort;
-typedef unsigned short GLushort;
-typedef void GLvoid;
-typedef struct __GLsync *GLsync;
-typedef khronos_int64_t GLint64;
-typedef khronos_uint64_t GLuint64;
-typedef unsigned int GLenum;
-typedef unsigned int GLuint;
-typedef char GLchar;
-typedef khronos_float_t GLfloat;
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-typedef unsigned int GLbitfield;
-typedef int GLint;
-typedef unsigned char GLboolean;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_FALSE 0
-#define GL_TRUE 1
-#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
-#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
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_FUNC_ADD 0x8006
-#define GL_BLEND_EQUATION 0x8009
-#define GL_BLEND_EQUATION_RGB 0x8009
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#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
-#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
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-#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
-#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
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#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
-#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
-#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
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-#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
-#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
-#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
-#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
-#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
-#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
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#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_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
-#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_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_MIRRORED_REPEAT 0x8370
-#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
-#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
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_SHADER_COMPILER 0x8DFA
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-#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
-#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_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_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 (GLfloat red, GLfloat green, GLfloat blue, GLfloat 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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
-GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
-GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
-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 void *data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *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 (GLfloat n, GLfloat f);
-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 void *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 GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
-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 *data);
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
-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 GLint 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, void **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, void *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 (GLfloat value, GLboolean invert);
-GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*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 sfail, GLenum dpfail, GLenum dppass);
-GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *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 void *pixels);
-GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
-GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
-GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
-GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
-GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
-GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
-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 index, GLfloat x);
-GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-#endif /* GL_ES_VERSION_2_0 */
-
-#ifndef GL_ES_VERSION_3_0
-#define GL_ES_VERSION_3_0 1
-typedef unsigned short GLhalf;
-#define GL_READ_BUFFER 0x0C02
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
-#define GL_PACK_ROW_LENGTH 0x0D02
-#define GL_PACK_SKIP_ROWS 0x0D03
-#define GL_PACK_SKIP_PIXELS 0x0D04
-#define GL_COLOR 0x1800
-#define GL_DEPTH 0x1801
-#define GL_STENCIL 0x1802
-#define GL_RED 0x1903
-#define GL_RGB8 0x8051
-#define GL_RGBA8 0x8058
-#define GL_RGB10_A2 0x8059
-#define GL_TEXTURE_BINDING_3D 0x806A
-#define GL_UNPACK_SKIP_IMAGES 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT 0x806E
-#define GL_TEXTURE_3D 0x806F
-#define GL_TEXTURE_WRAP_R 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE 0x8073
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_TEXTURE_MIN_LOD 0x813A
-#define GL_TEXTURE_MAX_LOD 0x813B
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-#define GL_DEPTH_COMPONENT24 0x81A6
-#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
-#define GL_CURRENT_QUERY 0x8865
-#define GL_QUERY_RESULT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE 0x8867
-#define GL_BUFFER_MAPPED 0x88BC
-#define GL_BUFFER_MAP_POINTER 0x88BD
-#define GL_STREAM_READ 0x88E1
-#define GL_STREAM_COPY 0x88E2
-#define GL_STATIC_READ 0x88E5
-#define GL_STATIC_COPY 0x88E6
-#define GL_DYNAMIC_READ 0x88E9
-#define GL_DYNAMIC_COPY 0x88EA
-#define GL_MAX_DRAW_BUFFERS 0x8824
-#define GL_DRAW_BUFFER0 0x8825
-#define GL_DRAW_BUFFER1 0x8826
-#define GL_DRAW_BUFFER2 0x8827
-#define GL_DRAW_BUFFER3 0x8828
-#define GL_DRAW_BUFFER4 0x8829
-#define GL_DRAW_BUFFER5 0x882A
-#define GL_DRAW_BUFFER6 0x882B
-#define GL_DRAW_BUFFER7 0x882C
-#define GL_DRAW_BUFFER8 0x882D
-#define GL_DRAW_BUFFER9 0x882E
-#define GL_DRAW_BUFFER10 0x882F
-#define GL_DRAW_BUFFER11 0x8830
-#define GL_DRAW_BUFFER12 0x8831
-#define GL_DRAW_BUFFER13 0x8832
-#define GL_DRAW_BUFFER14 0x8833
-#define GL_DRAW_BUFFER15 0x8834
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
-#define GL_SAMPLER_3D 0x8B5F
-#define GL_SAMPLER_2D_SHADOW 0x8B62
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
-#define GL_PIXEL_PACK_BUFFER 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
-#define GL_FLOAT_MAT2x3 0x8B65
-#define GL_FLOAT_MAT2x4 0x8B66
-#define GL_FLOAT_MAT3x2 0x8B67
-#define GL_FLOAT_MAT3x4 0x8B68
-#define GL_FLOAT_MAT4x2 0x8B69
-#define GL_FLOAT_MAT4x3 0x8B6A
-#define GL_SRGB 0x8C40
-#define GL_SRGB8 0x8C41
-#define GL_SRGB8_ALPHA8 0x8C43
-#define GL_COMPARE_REF_TO_TEXTURE 0x884E
-#define GL_MAJOR_VERSION 0x821B
-#define GL_MINOR_VERSION 0x821C
-#define GL_NUM_EXTENSIONS 0x821D
-#define GL_RGBA32F 0x8814
-#define GL_RGB32F 0x8815
-#define GL_RGBA16F 0x881A
-#define GL_RGB16F 0x881B
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
-#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
-#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
-#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
-#define GL_MAX_VARYING_COMPONENTS 0x8B4B
-#define GL_TEXTURE_2D_ARRAY 0x8C1A
-#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
-#define GL_R11F_G11F_B10F 0x8C3A
-#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
-#define GL_RGB9_E5 0x8C3D
-#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
-#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
-#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
-#define GL_RASTERIZER_DISCARD 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
-#define GL_INTERLEAVED_ATTRIBS 0x8C8C
-#define GL_SEPARATE_ATTRIBS 0x8C8D
-#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
-#define GL_RGBA32UI 0x8D70
-#define GL_RGB32UI 0x8D71
-#define GL_RGBA16UI 0x8D76
-#define GL_RGB16UI 0x8D77
-#define GL_RGBA8UI 0x8D7C
-#define GL_RGB8UI 0x8D7D
-#define GL_RGBA32I 0x8D82
-#define GL_RGB32I 0x8D83
-#define GL_RGBA16I 0x8D88
-#define GL_RGB16I 0x8D89
-#define GL_RGBA8I 0x8D8E
-#define GL_RGB8I 0x8D8F
-#define GL_RED_INTEGER 0x8D94
-#define GL_RGB_INTEGER 0x8D98
-#define GL_RGBA_INTEGER 0x8D99
-#define GL_SAMPLER_2D_ARRAY 0x8DC1
-#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
-#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
-#define GL_UNSIGNED_INT_VEC2 0x8DC6
-#define GL_UNSIGNED_INT_VEC3 0x8DC7
-#define GL_UNSIGNED_INT_VEC4 0x8DC8
-#define GL_INT_SAMPLER_2D 0x8DCA
-#define GL_INT_SAMPLER_3D 0x8DCB
-#define GL_INT_SAMPLER_CUBE 0x8DCC
-#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
-#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
-#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
-#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
-#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
-#define GL_BUFFER_ACCESS_FLAGS 0x911F
-#define GL_BUFFER_MAP_LENGTH 0x9120
-#define GL_BUFFER_MAP_OFFSET 0x9121
-#define GL_DEPTH_COMPONENT32F 0x8CAC
-#define GL_DEPTH32F_STENCIL8 0x8CAD
-#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
-#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
-#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
-#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
-#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
-#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
-#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
-#define GL_FRAMEBUFFER_DEFAULT 0x8218
-#define GL_FRAMEBUFFER_UNDEFINED 0x8219
-#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#define GL_DEPTH_STENCIL 0x84F9
-#define GL_UNSIGNED_INT_24_8 0x84FA
-#define GL_DEPTH24_STENCIL8 0x88F0
-#define GL_UNSIGNED_NORMALIZED 0x8C17
-#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
-#define GL_RENDERBUFFER_SAMPLES 0x8CAB
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
-#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
-#define GL_COLOR_ATTACHMENT1 0x8CE1
-#define GL_COLOR_ATTACHMENT2 0x8CE2
-#define GL_COLOR_ATTACHMENT3 0x8CE3
-#define GL_COLOR_ATTACHMENT4 0x8CE4
-#define GL_COLOR_ATTACHMENT5 0x8CE5
-#define GL_COLOR_ATTACHMENT6 0x8CE6
-#define GL_COLOR_ATTACHMENT7 0x8CE7
-#define GL_COLOR_ATTACHMENT8 0x8CE8
-#define GL_COLOR_ATTACHMENT9 0x8CE9
-#define GL_COLOR_ATTACHMENT10 0x8CEA
-#define GL_COLOR_ATTACHMENT11 0x8CEB
-#define GL_COLOR_ATTACHMENT12 0x8CEC
-#define GL_COLOR_ATTACHMENT13 0x8CED
-#define GL_COLOR_ATTACHMENT14 0x8CEE
-#define GL_COLOR_ATTACHMENT15 0x8CEF
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
-#define GL_MAX_SAMPLES 0x8D57
-#define GL_HALF_FLOAT 0x140B
-#define GL_MAP_READ_BIT 0x0001
-#define GL_MAP_WRITE_BIT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
-#define GL_RG 0x8227
-#define GL_RG_INTEGER 0x8228
-#define GL_R8 0x8229
-#define GL_RG8 0x822B
-#define GL_R16F 0x822D
-#define GL_R32F 0x822E
-#define GL_RG16F 0x822F
-#define GL_RG32F 0x8230
-#define GL_R8I 0x8231
-#define GL_R8UI 0x8232
-#define GL_R16I 0x8233
-#define GL_R16UI 0x8234
-#define GL_R32I 0x8235
-#define GL_R32UI 0x8236
-#define GL_RG8I 0x8237
-#define GL_RG8UI 0x8238
-#define GL_RG16I 0x8239
-#define GL_RG16UI 0x823A
-#define GL_RG32I 0x823B
-#define GL_RG32UI 0x823C
-#define GL_VERTEX_ARRAY_BINDING 0x85B5
-#define GL_R8_SNORM 0x8F94
-#define GL_RG8_SNORM 0x8F95
-#define GL_RGB8_SNORM 0x8F96
-#define GL_RGBA8_SNORM 0x8F97
-#define GL_SIGNED_NORMALIZED 0x8F9C
-#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
-#define GL_COPY_READ_BUFFER 0x8F36
-#define GL_COPY_WRITE_BUFFER 0x8F37
-#define GL_COPY_READ_BUFFER_BINDING 0x8F36
-#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
-#define GL_UNIFORM_BUFFER 0x8A11
-#define GL_UNIFORM_BUFFER_BINDING 0x8A28
-#define GL_UNIFORM_BUFFER_START 0x8A29
-#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
-#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
-#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
-#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
-#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
-#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
-#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
-#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
-#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
-#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
-#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
-#define GL_UNIFORM_TYPE 0x8A37
-#define GL_UNIFORM_SIZE 0x8A38
-#define GL_UNIFORM_NAME_LENGTH 0x8A39
-#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
-#define GL_UNIFORM_OFFSET 0x8A3B
-#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
-#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
-#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
-#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
-#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
-#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
-#define GL_INVALID_INDEX 0xFFFFFFFFu
-#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
-#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
-#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
-#define GL_OBJECT_TYPE 0x9112
-#define GL_SYNC_CONDITION 0x9113
-#define GL_SYNC_STATUS 0x9114
-#define GL_SYNC_FLAGS 0x9115
-#define GL_SYNC_FENCE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
-#define GL_UNSIGNALED 0x9118
-#define GL_SIGNALED 0x9119
-#define GL_ALREADY_SIGNALED 0x911A
-#define GL_TIMEOUT_EXPIRED 0x911B
-#define GL_CONDITION_SATISFIED 0x911C
-#define GL_WAIT_FAILED 0x911D
-#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
-#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
-#define GL_ANY_SAMPLES_PASSED 0x8C2F
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
-#define GL_SAMPLER_BINDING 0x8919
-#define GL_RGB10_A2UI 0x906F
-#define GL_TEXTURE_SWIZZLE_R 0x8E42
-#define GL_TEXTURE_SWIZZLE_G 0x8E43
-#define GL_TEXTURE_SWIZZLE_B 0x8E44
-#define GL_TEXTURE_SWIZZLE_A 0x8E45
-#define GL_GREEN 0x1904
-#define GL_BLUE 0x1905
-#define GL_INT_2_10_10_10_REV 0x8D9F
-#define GL_TRANSFORM_FEEDBACK 0x8E22
-#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
-#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
-#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
-#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
-#define GL_PROGRAM_BINARY_LENGTH 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS 0x87FF
-#define GL_COMPRESSED_R11_EAC 0x9270
-#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
-#define GL_COMPRESSED_RG11_EAC 0x9272
-#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
-#define GL_COMPRESSED_RGB8_ETC2 0x9274
-#define GL_COMPRESSED_SRGB8_ETC2 0x9275
-#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
-#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
-#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
-#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
-#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
-#define GL_MAX_ELEMENT_INDEX 0x8D6B
-#define GL_NUM_SAMPLE_COUNTS 0x9380
-#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
-GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode);
-GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint *ids);
-GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
-GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
-GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
-GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
-GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
-GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
-GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
-GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
-GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
-GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
-GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
-GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
-GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
-GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
-GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
-GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
-GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
-GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
-GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
-GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
-GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
-GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
-GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
-GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
-GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
-GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index);
-GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
-GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
-GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
-GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
-GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
-GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
-GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
-GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
-GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
-GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
-GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
-GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
-GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
-GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
-GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
-GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
-GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
-GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
-GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
-GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
-GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
-GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
-GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
-GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
-GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
-#endif /* GL_ES_VERSION_3_0 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/distrib/android-emugl/host/include/GLES3/gl31.h b/distrib/android-emugl/host/include/GLES3/gl31.h
deleted file mode 100644
index cfb906912..000000000
--- a/distrib/android-emugl/host/include/GLES3/gl31.h
+++ /dev/null
@@ -1,1184 +0,0 @@
-#ifndef __gl31_h_
-#define __gl31_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2014 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.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision$ on $Date$
-*/
-
-#include <GLES3/gl3platform.h>
-
-/* Generated on date 20140517 */
-
-/* Generated C header for:
- * API: gles2
- * Profile: common
- * Versions considered: 2.[0-9]|3.[01]
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_ES_VERSION_2_0
-#define GL_ES_VERSION_2_0 1
-#include <KHR/khrplatform.h>
-typedef khronos_int8_t GLbyte;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef short GLshort;
-typedef unsigned short GLushort;
-typedef void GLvoid;
-typedef struct __GLsync *GLsync;
-typedef khronos_int64_t GLint64;
-typedef khronos_uint64_t GLuint64;
-typedef unsigned int GLenum;
-typedef unsigned int GLuint;
-typedef char GLchar;
-typedef khronos_float_t GLfloat;
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-typedef unsigned int GLbitfield;
-typedef int GLint;
-typedef unsigned char GLboolean;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_FALSE 0
-#define GL_TRUE 1
-#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
-#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
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_FUNC_ADD 0x8006
-#define GL_BLEND_EQUATION 0x8009
-#define GL_BLEND_EQUATION_RGB 0x8009
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#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
-#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
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-#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
-#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
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#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
-#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
-#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
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-#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
-#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
-#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
-#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
-#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
-#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
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#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_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
-#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_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_MIRRORED_REPEAT 0x8370
-#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
-#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
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_SHADER_COMPILER 0x8DFA
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-#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
-#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_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_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 (GLfloat red, GLfloat green, GLfloat blue, GLfloat 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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
-GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
-GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
-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 void *data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *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 (GLfloat n, GLfloat f);
-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 void *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 GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
-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 *data);
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
-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 GLint 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, void **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, void *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 (GLfloat value, GLboolean invert);
-GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*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 sfail, GLenum dpfail, GLenum dppass);
-GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *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 void *pixels);
-GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
-GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
-GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
-GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
-GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
-GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
-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 index, GLfloat x);
-GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-#endif /* GL_ES_VERSION_2_0 */
-
-#ifndef GL_ES_VERSION_3_0
-#define GL_ES_VERSION_3_0 1
-typedef unsigned short GLhalf;
-#define GL_READ_BUFFER 0x0C02
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
-#define GL_PACK_ROW_LENGTH 0x0D02
-#define GL_PACK_SKIP_ROWS 0x0D03
-#define GL_PACK_SKIP_PIXELS 0x0D04
-#define GL_COLOR 0x1800
-#define GL_DEPTH 0x1801
-#define GL_STENCIL 0x1802
-#define GL_RED 0x1903
-#define GL_RGB8 0x8051
-#define GL_RGBA8 0x8058
-#define GL_RGB10_A2 0x8059
-#define GL_TEXTURE_BINDING_3D 0x806A
-#define GL_UNPACK_SKIP_IMAGES 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT 0x806E
-#define GL_TEXTURE_3D 0x806F
-#define GL_TEXTURE_WRAP_R 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE 0x8073
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_TEXTURE_MIN_LOD 0x813A
-#define GL_TEXTURE_MAX_LOD 0x813B
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-#define GL_DEPTH_COMPONENT24 0x81A6
-#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
-#define GL_CURRENT_QUERY 0x8865
-#define GL_QUERY_RESULT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE 0x8867
-#define GL_BUFFER_MAPPED 0x88BC
-#define GL_BUFFER_MAP_POINTER 0x88BD
-#define GL_STREAM_READ 0x88E1
-#define GL_STREAM_COPY 0x88E2
-#define GL_STATIC_READ 0x88E5
-#define GL_STATIC_COPY 0x88E6
-#define GL_DYNAMIC_READ 0x88E9
-#define GL_DYNAMIC_COPY 0x88EA
-#define GL_MAX_DRAW_BUFFERS 0x8824
-#define GL_DRAW_BUFFER0 0x8825
-#define GL_DRAW_BUFFER1 0x8826
-#define GL_DRAW_BUFFER2 0x8827
-#define GL_DRAW_BUFFER3 0x8828
-#define GL_DRAW_BUFFER4 0x8829
-#define GL_DRAW_BUFFER5 0x882A
-#define GL_DRAW_BUFFER6 0x882B
-#define GL_DRAW_BUFFER7 0x882C
-#define GL_DRAW_BUFFER8 0x882D
-#define GL_DRAW_BUFFER9 0x882E
-#define GL_DRAW_BUFFER10 0x882F
-#define GL_DRAW_BUFFER11 0x8830
-#define GL_DRAW_BUFFER12 0x8831
-#define GL_DRAW_BUFFER13 0x8832
-#define GL_DRAW_BUFFER14 0x8833
-#define GL_DRAW_BUFFER15 0x8834
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
-#define GL_SAMPLER_3D 0x8B5F
-#define GL_SAMPLER_2D_SHADOW 0x8B62
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
-#define GL_PIXEL_PACK_BUFFER 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
-#define GL_FLOAT_MAT2x3 0x8B65
-#define GL_FLOAT_MAT2x4 0x8B66
-#define GL_FLOAT_MAT3x2 0x8B67
-#define GL_FLOAT_MAT3x4 0x8B68
-#define GL_FLOAT_MAT4x2 0x8B69
-#define GL_FLOAT_MAT4x3 0x8B6A
-#define GL_SRGB 0x8C40
-#define GL_SRGB8 0x8C41
-#define GL_SRGB8_ALPHA8 0x8C43
-#define GL_COMPARE_REF_TO_TEXTURE 0x884E
-#define GL_MAJOR_VERSION 0x821B
-#define GL_MINOR_VERSION 0x821C
-#define GL_NUM_EXTENSIONS 0x821D
-#define GL_RGBA32F 0x8814
-#define GL_RGB32F 0x8815
-#define GL_RGBA16F 0x881A
-#define GL_RGB16F 0x881B
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
-#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
-#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
-#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
-#define GL_MAX_VARYING_COMPONENTS 0x8B4B
-#define GL_TEXTURE_2D_ARRAY 0x8C1A
-#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
-#define GL_R11F_G11F_B10F 0x8C3A
-#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
-#define GL_RGB9_E5 0x8C3D
-#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
-#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
-#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
-#define GL_RASTERIZER_DISCARD 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
-#define GL_INTERLEAVED_ATTRIBS 0x8C8C
-#define GL_SEPARATE_ATTRIBS 0x8C8D
-#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
-#define GL_RGBA32UI 0x8D70
-#define GL_RGB32UI 0x8D71
-#define GL_RGBA16UI 0x8D76
-#define GL_RGB16UI 0x8D77
-#define GL_RGBA8UI 0x8D7C
-#define GL_RGB8UI 0x8D7D
-#define GL_RGBA32I 0x8D82
-#define GL_RGB32I 0x8D83
-#define GL_RGBA16I 0x8D88
-#define GL_RGB16I 0x8D89
-#define GL_RGBA8I 0x8D8E
-#define GL_RGB8I 0x8D8F
-#define GL_RED_INTEGER 0x8D94
-#define GL_RGB_INTEGER 0x8D98
-#define GL_RGBA_INTEGER 0x8D99
-#define GL_SAMPLER_2D_ARRAY 0x8DC1
-#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
-#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
-#define GL_UNSIGNED_INT_VEC2 0x8DC6
-#define GL_UNSIGNED_INT_VEC3 0x8DC7
-#define GL_UNSIGNED_INT_VEC4 0x8DC8
-#define GL_INT_SAMPLER_2D 0x8DCA
-#define GL_INT_SAMPLER_3D 0x8DCB
-#define GL_INT_SAMPLER_CUBE 0x8DCC
-#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
-#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
-#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
-#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
-#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
-#define GL_BUFFER_ACCESS_FLAGS 0x911F
-#define GL_BUFFER_MAP_LENGTH 0x9120
-#define GL_BUFFER_MAP_OFFSET 0x9121
-#define GL_DEPTH_COMPONENT32F 0x8CAC
-#define GL_DEPTH32F_STENCIL8 0x8CAD
-#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
-#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
-#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
-#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
-#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
-#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
-#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
-#define GL_FRAMEBUFFER_DEFAULT 0x8218
-#define GL_FRAMEBUFFER_UNDEFINED 0x8219
-#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#define GL_DEPTH_STENCIL 0x84F9
-#define GL_UNSIGNED_INT_24_8 0x84FA
-#define GL_DEPTH24_STENCIL8 0x88F0
-#define GL_UNSIGNED_NORMALIZED 0x8C17
-#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
-#define GL_RENDERBUFFER_SAMPLES 0x8CAB
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
-#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
-#define GL_COLOR_ATTACHMENT1 0x8CE1
-#define GL_COLOR_ATTACHMENT2 0x8CE2
-#define GL_COLOR_ATTACHMENT3 0x8CE3
-#define GL_COLOR_ATTACHMENT4 0x8CE4
-#define GL_COLOR_ATTACHMENT5 0x8CE5
-#define GL_COLOR_ATTACHMENT6 0x8CE6
-#define GL_COLOR_ATTACHMENT7 0x8CE7
-#define GL_COLOR_ATTACHMENT8 0x8CE8
-#define GL_COLOR_ATTACHMENT9 0x8CE9
-#define GL_COLOR_ATTACHMENT10 0x8CEA
-#define GL_COLOR_ATTACHMENT11 0x8CEB
-#define GL_COLOR_ATTACHMENT12 0x8CEC
-#define GL_COLOR_ATTACHMENT13 0x8CED
-#define GL_COLOR_ATTACHMENT14 0x8CEE
-#define GL_COLOR_ATTACHMENT15 0x8CEF
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
-#define GL_MAX_SAMPLES 0x8D57
-#define GL_HALF_FLOAT 0x140B
-#define GL_MAP_READ_BIT 0x0001
-#define GL_MAP_WRITE_BIT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
-#define GL_RG 0x8227
-#define GL_RG_INTEGER 0x8228
-#define GL_R8 0x8229
-#define GL_RG8 0x822B
-#define GL_R16F 0x822D
-#define GL_R32F 0x822E
-#define GL_RG16F 0x822F
-#define GL_RG32F 0x8230
-#define GL_R8I 0x8231
-#define GL_R8UI 0x8232
-#define GL_R16I 0x8233
-#define GL_R16UI 0x8234
-#define GL_R32I 0x8235
-#define GL_R32UI 0x8236
-#define GL_RG8I 0x8237
-#define GL_RG8UI 0x8238
-#define GL_RG16I 0x8239
-#define GL_RG16UI 0x823A
-#define GL_RG32I 0x823B
-#define GL_RG32UI 0x823C
-#define GL_VERTEX_ARRAY_BINDING 0x85B5
-#define GL_R8_SNORM 0x8F94
-#define GL_RG8_SNORM 0x8F95
-#define GL_RGB8_SNORM 0x8F96
-#define GL_RGBA8_SNORM 0x8F97
-#define GL_SIGNED_NORMALIZED 0x8F9C
-#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
-#define GL_COPY_READ_BUFFER 0x8F36
-#define GL_COPY_WRITE_BUFFER 0x8F37
-#define GL_COPY_READ_BUFFER_BINDING 0x8F36
-#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
-#define GL_UNIFORM_BUFFER 0x8A11
-#define GL_UNIFORM_BUFFER_BINDING 0x8A28
-#define GL_UNIFORM_BUFFER_START 0x8A29
-#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
-#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
-#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
-#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
-#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
-#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
-#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
-#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
-#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
-#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
-#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
-#define GL_UNIFORM_TYPE 0x8A37
-#define GL_UNIFORM_SIZE 0x8A38
-#define GL_UNIFORM_NAME_LENGTH 0x8A39
-#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
-#define GL_UNIFORM_OFFSET 0x8A3B
-#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
-#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
-#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
-#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
-#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
-#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
-#define GL_INVALID_INDEX 0xFFFFFFFFu
-#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
-#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
-#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
-#define GL_OBJECT_TYPE 0x9112
-#define GL_SYNC_CONDITION 0x9113
-#define GL_SYNC_STATUS 0x9114
-#define GL_SYNC_FLAGS 0x9115
-#define GL_SYNC_FENCE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
-#define GL_UNSIGNALED 0x9118
-#define GL_SIGNALED 0x9119
-#define GL_ALREADY_SIGNALED 0x911A
-#define GL_TIMEOUT_EXPIRED 0x911B
-#define GL_CONDITION_SATISFIED 0x911C
-#define GL_WAIT_FAILED 0x911D
-#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
-#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
-#define GL_ANY_SAMPLES_PASSED 0x8C2F
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
-#define GL_SAMPLER_BINDING 0x8919
-#define GL_RGB10_A2UI 0x906F
-#define GL_TEXTURE_SWIZZLE_R 0x8E42
-#define GL_TEXTURE_SWIZZLE_G 0x8E43
-#define GL_TEXTURE_SWIZZLE_B 0x8E44
-#define GL_TEXTURE_SWIZZLE_A 0x8E45
-#define GL_GREEN 0x1904
-#define GL_BLUE 0x1905
-#define GL_INT_2_10_10_10_REV 0x8D9F
-#define GL_TRANSFORM_FEEDBACK 0x8E22
-#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
-#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
-#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
-#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
-#define GL_PROGRAM_BINARY_LENGTH 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS 0x87FF
-#define GL_COMPRESSED_R11_EAC 0x9270
-#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
-#define GL_COMPRESSED_RG11_EAC 0x9272
-#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
-#define GL_COMPRESSED_RGB8_ETC2 0x9274
-#define GL_COMPRESSED_SRGB8_ETC2 0x9275
-#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
-#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
-#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
-#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
-#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
-#define GL_MAX_ELEMENT_INDEX 0x8D6B
-#define GL_NUM_SAMPLE_COUNTS 0x9380
-#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
-GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode);
-GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint *ids);
-GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
-GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
-GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
-GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
-GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
-GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
-GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
-GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
-GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
-GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
-GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
-GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
-GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
-GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
-GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
-GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
-GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
-GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
-GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
-GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
-GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
-GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
-GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
-GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
-GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
-GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index);
-GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
-GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
-GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
-GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
-GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
-GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
-GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
-GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
-GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
-GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
-GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
-GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
-GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
-GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
-GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
-GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
-GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
-GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
-GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
-GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
-GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
-GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
-GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
-GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
-GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
-#endif /* GL_ES_VERSION_3_0 */
-
-#ifndef GL_ES_VERSION_3_1
-#define GL_ES_VERSION_3_1 1
-#define GL_COMPUTE_SHADER 0x91B9
-#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB
-#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
-#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD
-#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
-#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
-#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
-#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265
-#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
-#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
-#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
-#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
-#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267
-#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
-#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
-#define GL_COMPUTE_SHADER_BIT 0x00000020
-#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
-#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
-#define GL_MAX_UNIFORM_LOCATIONS 0x826E
-#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310
-#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311
-#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313
-#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
-#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315
-#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316
-#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318
-#define GL_UNIFORM 0x92E1
-#define GL_UNIFORM_BLOCK 0x92E2
-#define GL_PROGRAM_INPUT 0x92E3
-#define GL_PROGRAM_OUTPUT 0x92E4
-#define GL_BUFFER_VARIABLE 0x92E5
-#define GL_SHADER_STORAGE_BLOCK 0x92E6
-#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
-#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4
-#define GL_ACTIVE_RESOURCES 0x92F5
-#define GL_MAX_NAME_LENGTH 0x92F6
-#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
-#define GL_NAME_LENGTH 0x92F9
-#define GL_TYPE 0x92FA
-#define GL_ARRAY_SIZE 0x92FB
-#define GL_OFFSET 0x92FC
-#define GL_BLOCK_INDEX 0x92FD
-#define GL_ARRAY_STRIDE 0x92FE
-#define GL_MATRIX_STRIDE 0x92FF
-#define GL_IS_ROW_MAJOR 0x9300
-#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
-#define GL_BUFFER_BINDING 0x9302
-#define GL_BUFFER_DATA_SIZE 0x9303
-#define GL_NUM_ACTIVE_VARIABLES 0x9304
-#define GL_ACTIVE_VARIABLES 0x9305
-#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306
-#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A
-#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B
-#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C
-#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D
-#define GL_LOCATION 0x930E
-#define GL_VERTEX_SHADER_BIT 0x00000001
-#define GL_FRAGMENT_SHADER_BIT 0x00000002
-#define GL_ALL_SHADER_BITS 0xFFFFFFFF
-#define GL_PROGRAM_SEPARABLE 0x8258
-#define GL_ACTIVE_PROGRAM 0x8259
-#define GL_PROGRAM_PIPELINE_BINDING 0x825A
-#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
-#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
-#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
-#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
-#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
-#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
-#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2
-#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6
-#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7
-#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
-#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
-#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9
-#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
-#define GL_MAX_IMAGE_UNITS 0x8F38
-#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
-#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
-#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
-#define GL_IMAGE_BINDING_NAME 0x8F3A
-#define GL_IMAGE_BINDING_LEVEL 0x8F3B
-#define GL_IMAGE_BINDING_LAYERED 0x8F3C
-#define GL_IMAGE_BINDING_LAYER 0x8F3D
-#define GL_IMAGE_BINDING_ACCESS 0x8F3E
-#define GL_IMAGE_BINDING_FORMAT 0x906E
-#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
-#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
-#define GL_UNIFORM_BARRIER_BIT 0x00000004
-#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
-#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
-#define GL_COMMAND_BARRIER_BIT 0x00000040
-#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
-#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
-#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
-#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
-#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
-#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
-#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
-#define GL_IMAGE_2D 0x904D
-#define GL_IMAGE_3D 0x904E
-#define GL_IMAGE_CUBE 0x9050
-#define GL_IMAGE_2D_ARRAY 0x9053
-#define GL_INT_IMAGE_2D 0x9058
-#define GL_INT_IMAGE_3D 0x9059
-#define GL_INT_IMAGE_CUBE 0x905B
-#define GL_INT_IMAGE_2D_ARRAY 0x905E
-#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
-#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
-#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
-#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
-#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
-#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
-#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
-#define GL_READ_ONLY 0x88B8
-#define GL_WRITE_ONLY 0x88B9
-#define GL_READ_WRITE 0x88BA
-#define GL_SHADER_STORAGE_BUFFER 0x90D2
-#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3
-#define GL_SHADER_STORAGE_BUFFER_START 0x90D4
-#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5
-#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
-#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
-#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
-#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
-#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
-#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
-#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
-#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
-#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
-#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
-#define GL_STENCIL_INDEX 0x1901
-#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
-#define GL_SAMPLE_POSITION 0x8E50
-#define GL_SAMPLE_MASK 0x8E51
-#define GL_SAMPLE_MASK_VALUE 0x8E52
-#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
-#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
-#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
-#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
-#define GL_MAX_INTEGER_SAMPLES 0x9110
-#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
-#define GL_TEXTURE_SAMPLES 0x9106
-#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
-#define GL_TEXTURE_WIDTH 0x1000
-#define GL_TEXTURE_HEIGHT 0x1001
-#define GL_TEXTURE_DEPTH 0x8071
-#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
-#define GL_TEXTURE_RED_SIZE 0x805C
-#define GL_TEXTURE_GREEN_SIZE 0x805D
-#define GL_TEXTURE_BLUE_SIZE 0x805E
-#define GL_TEXTURE_ALPHA_SIZE 0x805F
-#define GL_TEXTURE_DEPTH_SIZE 0x884A
-#define GL_TEXTURE_STENCIL_SIZE 0x88F1
-#define GL_TEXTURE_SHARED_SIZE 0x8C3F
-#define GL_TEXTURE_RED_TYPE 0x8C10
-#define GL_TEXTURE_GREEN_TYPE 0x8C11
-#define GL_TEXTURE_BLUE_TYPE 0x8C12
-#define GL_TEXTURE_ALPHA_TYPE 0x8C13
-#define GL_TEXTURE_DEPTH_TYPE 0x8C16
-#define GL_TEXTURE_COMPRESSED 0x86A1
-#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
-#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
-#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
-#define GL_VERTEX_ATTRIB_BINDING 0x82D4
-#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
-#define GL_VERTEX_BINDING_DIVISOR 0x82D6
-#define GL_VERTEX_BINDING_OFFSET 0x82D7
-#define GL_VERTEX_BINDING_STRIDE 0x82D8
-#define GL_VERTEX_BINDING_BUFFER 0x8F4F
-#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
-#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
-#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5
-GL_APICALL void GL_APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
-GL_APICALL void GL_APIENTRY glDispatchComputeIndirect (GLintptr indirect);
-GL_APICALL void GL_APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
-GL_APICALL void GL_APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
-GL_APICALL void GL_APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
-GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
-GL_APICALL void GL_APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
-GL_APICALL void GL_APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
-GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
-GL_APICALL void GL_APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
-GL_APICALL void GL_APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
-GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
-GL_APICALL void GL_APIENTRY glBindProgramPipeline (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
-GL_APICALL void GL_APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
-GL_APICALL GLboolean GL_APIENTRY glIsProgramPipeline (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
-GL_APICALL void GL_APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
-GL_APICALL void GL_APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-GL_APICALL void GL_APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GL_APICALL void GL_APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
-GL_APICALL void GL_APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
-GL_APICALL void GL_APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-GL_APICALL void GL_APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GL_APICALL void GL_APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
-GL_APICALL void GL_APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-GL_APICALL void GL_APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GL_APICALL void GL_APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GL_APICALL void GL_APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glValidateProgramPipeline (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GL_APICALL void GL_APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
-GL_APICALL void GL_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
-GL_APICALL void GL_APIENTRY glMemoryBarrier (GLbitfield barriers);
-GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion (GLbitfield barriers);
-GL_APICALL void GL_APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-GL_APICALL void GL_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
-GL_APICALL void GL_APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask);
-GL_APICALL void GL_APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
-GL_APICALL void GL_APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-GL_APICALL void GL_APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-GL_APICALL void GL_APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GL_APICALL void GL_APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
-GL_APICALL void GL_APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
-#endif /* GL_ES_VERSION_3_1 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/distrib/android-emugl/host/include/GLES3/gl3ext.h b/distrib/android-emugl/host/include/GLES3/gl3ext.h
deleted file mode 100644
index 1cce7024f..000000000
--- a/distrib/android-emugl/host/include/GLES3/gl3ext.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __gl3ext_h_
-#define __gl3ext_h_
-
-/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-/* OpenGL ES 3 Extensions
- *
- * After an OES extension's interactions with OpenGl ES 3.0 have been documented,
- * its tokens and function definitions should be added to this file in a manner
- * that does not conflict with gl2ext.h or gl3.h.
- *
- * Tokens and function definitions for extensions that have become standard
- * features in OpenGL ES 3.0 will not be added to this file.
- *
- * Applications using OpenGL-ES-2-only extensions should include gl2ext.h
- */
-
-#endif /* __gl3ext_h_ */
diff --git a/distrib/android-emugl/host/include/GLES3/gl3platform.h b/distrib/android-emugl/host/include/GLES3/gl3platform.h
deleted file mode 100644
index 1bd1a850f..000000000
--- a/distrib/android-emugl/host/include/GLES3/gl3platform.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __gl3platform_h_
-#define __gl3platform_h_
-
-/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */
-
-/*
- * 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 3.X gl3.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 /* __gl3platform_h_ */
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_extensions_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_extensions_functions.h
deleted file mode 100644
index 8e738fbf7..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_extensions_functions.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=functions distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl_extensions.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_extensions_functions.h
-// DO NOT EDIT THIS FILE
-
-#ifndef RENDER_EGL_EXTENSIONS_FUNCTIONS_H
-#define RENDER_EGL_EXTENSIONS_FUNCTIONS_H
-
-#include <EGL/egl.h>
-#define EGL_EGLEXT_PROTOTYPES
-#include <EGL/eglext.h>
-#define LIST_RENDER_EGL_EXTENSIONS_FUNCTIONS(X) \
- X(EGLImageKHR, eglCreateImageKHR, (EGLDisplay display, EGLContext context, EGLenum target, EGLClientBuffer buffer, const EGLint* attrib_list)) \
- X(EGLBoolean, eglDestroyImageKHR, (EGLDisplay display, EGLImageKHR image)) \
- X(EGLSyncKHR, eglCreateSyncKHR, (EGLDisplay display, EGLenum type, const EGLint* attribs)) \
- X(EGLint, eglClientWaitSyncKHR, (EGLDisplay display, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)) \
- X(EGLBoolean, eglDestroySyncKHR, (EGLDisplay display, EGLSyncKHR sync)) \
-
-
-#endif // RENDER_EGL_EXTENSIONS_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_functions.h
deleted file mode 100644
index c9a23c8a9..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_functions.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=functions distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/RenderEGL_functions.h
-// DO NOT EDIT THIS FILE
-
-#ifndef RENDER_EGL_FUNCTIONS_H
-#define RENDER_EGL_FUNCTIONS_H
-
-#include <EGL/egl.h>
-#define LIST_RENDER_EGL_FUNCTIONS(X) \
- X(EGLint, eglGetError, ()) \
- X(EGLDisplay, eglGetDisplay, (EGLNativeDisplayType dpy)) \
- X(EGLBoolean, eglTerminate, (EGLDisplay dpy)) \
- X(EGLBoolean, eglInitialize, (EGLDisplay dpy, EGLint* major, EGLint* minor)) \
- X(char*, eglQueryString, (EGLDisplay dpy, EGLint id)) \
- X(EGLBoolean, eglGetConfigs, (EGLDisplay display, EGLConfig* configs, EGLint config_size, EGLint* num_config)) \
- X(EGLBoolean, eglChooseConfig, (EGLDisplay display, const EGLint* attribs, EGLConfig* configs, EGLint config_size, EGLint* num_config)) \
- X(EGLBoolean, eglGetConfigAttrib, (EGLDisplay display, EGLConfig config, EGLint attribute, EGLint* value)) \
- X(EGLSurface, eglCreateWindowSurface, (EGLDisplay display, EGLConfig config, EGLNativeWindowType native_window, const EGLint* attrib_list)) \
- X(EGLSurface, eglCreatePbufferSurface, (EGLDisplay display, EGLConfig config, const EGLint* attrib_list)) \
- X(EGLBoolean, eglDestroySurface, (EGLDisplay display, EGLSurface surface)) \
- X(EGLBoolean, eglBindAPI, (EGLenum api)) \
- X(EGLenum, eglQueryAPI, ()) \
- X(EGLBoolean, eglReleaseThread, ()) \
- X(EGLContext, eglCreateContext, (EGLDisplay display, EGLConfig config, EGLContext share_context, const EGLint* attrib_list)) \
- X(EGLBoolean, eglDestroyContext, (EGLDisplay display, EGLContext context)) \
- X(EGLBoolean, eglMakeCurrent, (EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context)) \
- X(EGLContext, eglGetCurrentContext, ()) \
- X(EGLSurface, eglGetCurrentSurface, (EGLint readdraw)) \
- X(EGLBoolean, eglSwapBuffers, (EGLDisplay display, EGLSurface surface)) \
- X(void*, eglGetProcAddress, (const char* function_name)) \
-
-
-#endif // RENDER_EGL_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gldefs.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gldefs.h
deleted file mode 100644
index 77df11735..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gldefs.h
+++ /dev/null
@@ -1,45 +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.
-*/
-
-#pragma once
-
-typedef double GLclampd; /* double precision float in [0,1] */
-typedef double GLdouble; /* double precision float */
-typedef void* GLeglImageOES;
-
-#define GL_S 0x2000
-#define GL_T 0x2001
-#define GL_R 0x2002
-#define GL_Q 0x2003
-#define GL_TEXTURE_GEN_S 0x0C60
-#define GL_TEXTURE_GEN_T 0x0C61
-#define GL_TEXTURE_GEN_R 0x0C62
-#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
-#define GL_TRANSFORM_BIT 0x00001000
-#define GL_INT 0x1404
-#define GL_HALF_FLOAT_NV 0x140B
-#define GL_HALF_FLOAT 0x140B
-#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
-#define GL_POINT_SPRITE 0x8861
-#define GL_FRAMEBUFFER_EXT 0x8D40
-#define GL_TEXTURE_WIDTH 0x1000
-#define GL_TEXTURE_HEIGHT 0x1001
-#define GL_TEXTURE_RED_SIZE 0x805C
-#define GL_TEXTURE_GREEN_SIZE 0x805D
-#define GL_TEXTURE_BLUE_SIZE 0x805E
-#define GL_TEXTURE_ALPHA_SIZE 0x805F
-#define GL_TEXTURE_DEPTH_SIZE 0x884A
-#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr.h
deleted file mode 100644
index 693b3d2db..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles12tr.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr.h
-// DO NOT EDIT THIS FILE
-
-#ifndef GLES12_TR_FUNCTIONS_H
-#define GLES12_TR_FUNCTIONS_H
-
-typedef void* voidptr;
-#define LIST_GLES12_TR_FUNCTIONS(X) \
- X(voidptr, create_gles1_context, (void* share, const void* underlying_apis), (share, underlying_apis)) \
- X(voidptr, get_current_gles_context, (), ()) \
- X(void, set_current_gles_context, (void* ctx), (ctx)) \
- X(voidptr, create_underlying_api, (), ()) \
- X(void, make_current_setup, (uint32_t surf_width, uint32_t surf_height), (surf_width, surf_height)) \
- X(void, destroy_gles1_context, (void* ctx), (ctx)) \
-
-
-#endif // GLES12_TR_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr_internal.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr_internal.h
deleted file mode 100644
index 45fb77818..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr_internal.h
+++ /dev/null
@@ -1,331 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles12tr_internal.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles12tr_internal.h
-// DO NOT EDIT THIS FILE
-
-#ifndef GLES12TR_INTERNAL_FUNCTIONS_H
-#define GLES12TR_INTERNAL_FUNCTIONS_H
-
-typedef GLvoid* GLvoidptr;
-typedef const GLubyte* constGLubyte;
-#define LIST_GLES12TR_INTERNAL_FUNCTIONS(X) \
- X(void, glActiveTexture, (GLenum texture), (texture)) \
- X(void, glAlphaFunc, (GLenum func, GLclampf ref), (func, ref)) \
- X(void, glAlphaFuncx, (GLenum func, GLclampx ref), (func, ref)) \
- X(void, glAlphaFuncxOES, (GLenum func, GLclampx ref), (func, ref)) \
- X(void, glAttachShader, (GLuint program, GLuint shader), (program, shader)) \
- X(void, glBindAttribLocation, (GLuint program, GLuint index, const GLchar* name), (program, index, name)) \
- X(void, glBindBuffer, (GLenum target, GLuint buffer), (target, buffer)) \
- X(void, glBindFramebuffer, (GLenum target, GLuint framebuffer), (target, framebuffer)) \
- X(void, glBindFramebufferOES, (GLenum target, GLuint framebuffer), (target, framebuffer)) \
- X(void, glBindRenderbuffer, (GLenum target, GLuint renderbuffer), (target, renderbuffer)) \
- X(void, glBindRenderbufferOES, (GLenum target, GLuint renderbuffer), (target, renderbuffer)) \
- X(void, glBindTexture, (GLenum target, GLuint texture), (target, texture)) \
- X(void, glBlendColor, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha)) \
- X(void, glBlendEquation, (GLenum mode), (mode)) \
- X(void, glBlendEquationOES, (GLenum mode), (mode)) \
- X(void, glBlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha)) \
- X(void, glBlendEquationSeparateOES, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha)) \
- X(void, glBlendFunc, (GLenum sfactor, GLenum dfactor), (sfactor, dfactor)) \
- X(void, glBlendFuncSeparate, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha)) \
- X(void, glBlendFuncSeparateOES, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha)) \
- X(void, glBufferData, (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage), (target, size, data, usage)) \
- X(void, glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data), (target, offset, size, data)) \
- X(GLenum, glCheckFramebufferStatus, (GLenum target), (target)) \
- X(GLenum, glCheckFramebufferStatusOES, (GLenum target), (target)) \
- X(void, glClear, (GLbitfield mask), (mask)) \
- X(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red, green, blue, alpha)) \
- X(void, glClearColorx, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha)) \
- X(void, glClearColorxOES, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha)) \
- X(void, glClearDepthf, (GLfloat depth), (depth)) \
- X(void, glClearDepthfOES, (GLclampf depth), (depth)) \
- X(void, glClearDepthx, (GLclampx depth), (depth)) \
- X(void, glClearDepthxOES, (GLclampx depth), (depth)) \
- X(void, glClearStencil, (GLint s), (s)) \
- X(void, glClientActiveTexture, (GLenum texture), (texture)) \
- X(void, glClipPlanef, (GLenum pname, const GLfloat* equation), (pname, equation)) \
- X(void, glClipPlanefOES, (GLenum pname, const GLfloat* equation), (pname, equation)) \
- X(void, glClipPlanex, (GLenum pname, const GLfixed* equation), (pname, equation)) \
- X(void, glClipPlanexOES, (GLenum pname, const GLfixed* equation), (pname, equation)) \
- X(void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha)) \
- X(void, glColor4fv, (const GLfloat* components), (components)) \
- X(void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha), (red, green, blue, alpha)) \
- X(void, glColor4ubv, (const GLubyte* components), (components)) \
- X(void, glColor4x, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha)) \
- X(void, glColor4xOES, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha)) \
- X(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha), (red, green, blue, alpha)) \
- X(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer), (size, type, stride, pointer)) \
- X(void, glColorPointerBounds, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count), (size, type, stride, pointer, count)) \
- X(void, glCompileShader, (GLuint shader), (shader)) \
- X(void, glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei image_size, const GLvoid* data), (target, level, internalformat, width, height, border, image_size, data)) \
- X(void, glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei image_size, const GLvoid* data), (target, level, xoffset, yoffset, width, height, format, image_size, data)) \
- X(void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border), (target, level, internalformat, x, y, width, height, border)) \
- X(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, x, y, width, height)) \
- X(GLuint, glCreateProgram, (), ()) \
- X(GLuint, glCreateShader, (GLenum type), (type)) \
- X(void, glCullFace, (GLenum mode), (mode)) \
- X(void, glCurrentPaletteMatrixOES, (GLuint index), (index)) \
- X(void, glDeleteBuffers, (GLsizei n, const GLuint* buffers), (n, buffers)) \
- X(void, glDeleteFramebuffers, (GLsizei n, const GLuint* framebuffers), (n, framebuffers)) \
- X(void, glDeleteFramebuffersOES, (GLsizei n, const GLuint* framebuffers), (n, framebuffers)) \
- X(void, glDeleteProgram, (GLuint program), (program)) \
- X(void, glDeleteRenderbuffers, (GLsizei n, const GLuint* renderbuffers), (n, renderbuffers)) \
- X(void, glDeleteRenderbuffersOES, (GLsizei n, const GLuint* renderbuffers), (n, renderbuffers)) \
- X(void, glDeleteShader, (GLuint shader), (shader)) \
- X(void, glDeleteTextures, (GLsizei n, const GLuint* textures), (n, textures)) \
- X(void, glDepthFunc, (GLenum func), (func)) \
- X(void, glDepthMask, (GLboolean flag), (flag)) \
- X(void, glDepthRangef, (GLfloat zNear, GLfloat zFar), (zNear, zFar)) \
- X(void, glDepthRangefOES, (GLclampf zNear, GLclampf zFar), (zNear, zFar)) \
- X(void, glDepthRangex, (GLclampx zNear, GLclampx zFar), (zNear, zFar)) \
- X(void, glDepthRangexOES, (GLclampx zNear, GLclampx zFar), (zNear, zFar)) \
- X(void, glDetachShader, (GLuint program, GLuint shader), (program, shader)) \
- X(void, glDisable, (GLenum cap), (cap)) \
- X(void, glDisableClientState, (GLenum cap), (cap)) \
- X(void, glDisableVertexAttribArray, (GLuint index), (index)) \
- X(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count), (mode, first, count)) \
- X(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices), (mode, count, type, indices)) \
- X(void, glDrawTexfOES, (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height), (x, y, z, width, height)) \
- X(void, glDrawTexfvOES, (const GLfloat* coords), (coords)) \
- X(void, glDrawTexiOES, (GLint x, GLint y, GLint z, GLint width, GLint height), (x, y, z, width, height)) \
- X(void, glDrawTexivOES, (const GLint* coords), (coords)) \
- X(void, glDrawTexsOES, (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height), (x, y, z, width, height)) \
- X(void, glDrawTexsvOES, (const GLshort* coords), (coords)) \
- X(void, glDrawTexxOES, (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height), (x, y, z, width, height)) \
- X(void, glDrawTexxvOES, (const GLfixed* coords), (coords)) \
- X(void, glEGLImageTargetRenderbufferStorageOES, (GLenum target, GLeglImageOES buffer), (target, buffer)) \
- X(void, glEGLImageTargetTexture2DOES, (GLenum target, GLeglImageOES buffer), (target, buffer)) \
- X(void, glEnable, (GLenum cap), (cap)) \
- X(void, glEnableClientState, (GLenum cap), (cap)) \
- X(void, glEnableVertexAttribArray, (GLuint index), (index)) \
- X(void, glFinish, (), ()) \
- X(void, glFlush, (), ()) \
- X(void, glFogf, (GLenum name, GLfloat param), (name, param)) \
- X(void, glFogfv, (GLenum name, const GLfloat* params), (name, params)) \
- X(void, glFogx, (GLenum pname, GLfixed param), (pname, param)) \
- X(void, glFogxOES, (GLenum pname, GLfixed param), (pname, param)) \
- X(void, glFogxv, (GLenum pname, const GLfixed* params), (pname, params)) \
- X(void, glFogxvOES, (GLenum pname, const GLfixed* params), (pname, params)) \
- X(void, glFramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer)) \
- X(void, glFramebufferRenderbufferOES, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer)) \
- X(void, glFramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level)) \
- X(void, glFramebufferTexture2DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level)) \
- X(void, glFrontFace, (GLenum mode), (mode)) \
- X(void, glFrustumf, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar)) \
- X(void, glFrustumfOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar)) \
- X(void, glFrustumx, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar)) \
- X(void, glFrustumxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar)) \
- X(void, glGenBuffers, (GLsizei n, GLuint* buffers), (n, buffers)) \
- X(void, glGenFramebuffers, (GLsizei n, GLuint* framebuffers), (n, framebuffers)) \
- X(void, glGenFramebuffersOES, (GLsizei n, GLuint* framebuffers), (n, framebuffers)) \
- X(void, glGenRenderbuffers, (GLsizei n, GLuint* renderbuffers), (n, renderbuffers)) \
- X(void, glGenRenderbuffersOES, (GLsizei n, GLuint* renderbuffers), (n, renderbuffers)) \
- X(void, glGenTextures, (GLsizei n, GLuint* textures), (n, textures)) \
- X(void, glGenerateMipmap, (GLenum target), (target)) \
- X(void, glGenerateMipmapOES, (GLenum target), (target)) \
- X(void, glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name)) \
- X(void, glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name)) \
- X(void, glGetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders), (program, maxcount, count, shaders)) \
- X(GLint, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name)) \
- X(void, glGetBooleanv, (GLenum pname, GLboolean* params), (pname, params)) \
- X(void, glGetBufferParameteriv, (GLenum target, GLenum pname, GLint* params), (target, pname, params)) \
- X(void, glGetClipPlanef, (GLenum pname, GLfloat* eqn), (pname, eqn)) \
- X(void, glGetClipPlanefOES, (GLenum pname, GLfloat* eqn), (pname, eqn)) \
- X(void, glGetClipPlanex, (GLenum pname, GLfixed* eqn), (pname, eqn)) \
- X(void, glGetClipPlanexOES, (GLenum pname, GLfixed* eqn), (pname, eqn)) \
- X(GLenum, glGetError, (), ()) \
- X(void, glGetFixedv, (GLenum pname, GLfixed* params), (pname, params)) \
- X(void, glGetFixedvOES, (GLenum pname, GLfixed* params), (pname, params)) \
- X(void, glGetFloatv, (GLenum pname, GLfloat* params), (pname, params)) \
- X(void, glGetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint* params), (target, attachment, pname, params)) \
- X(void, glGetFramebufferAttachmentParameterivOES, (GLenum target, GLenum attachment, GLenum pname, GLint* params), (target, attachment, pname, params)) \
- X(void, glGetIntegerv, (GLenum pname, GLint* params), (pname, params)) \
- X(void, glGetLightfv, (GLenum lightid, GLenum name, GLfloat* params), (lightid, name, params)) \
- X(void, glGetLightxv, (GLenum light, GLenum pname, GLfixed* params), (light, pname, params)) \
- X(void, glGetLightxvOES, (GLenum light, GLenum pname, GLfixed* params), (light, pname, params)) \
- X(void, glGetMaterialfv, (GLenum face, GLenum name, GLfloat* params), (face, name, params)) \
- X(void, glGetMaterialxv, (GLenum face, GLenum pname, GLfixed* params), (face, pname, params)) \
- X(void, glGetMaterialxvOES, (GLenum face, GLenum pname, GLfixed* params), (face, pname, params)) \
- X(void, glGetPointerv, (GLenum pname, void** params), (pname, params)) \
- X(void, glGetProgramInfoLog, (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog), (program, bufsize, length, infolog)) \
- X(void, glGetProgramiv, (GLuint program, GLenum pname, GLint* params), (program, pname, params)) \
- X(void, glGetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint* params), (target, pname, params)) \
- X(void, glGetRenderbufferParameterivOES, (GLenum target, GLenum pname, GLint* params), (target, pname, params)) \
- X(void, glGetShaderInfoLog, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog), (shader, bufsize, length, infolog)) \
- X(void, glGetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision), (shadertype, precisiontype, range, precision)) \
- X(void, glGetShaderSource, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source), (shader, bufsize, length, source)) \
- X(void, glGetShaderiv, (GLuint shader, GLenum pname, GLint* params), (shader, pname, params)) \
- X(constGLubyte, glGetString, (GLenum name), (name)) \
- X(void, glGetTexEnvfv, (GLenum env, GLenum pname, GLfloat* params), (env, pname, params)) \
- X(void, glGetTexEnviv, (GLenum env, GLenum pname, GLint* params), (env, pname, params)) \
- X(void, glGetTexEnvxv, (GLenum env, GLenum pname, GLfixed* params), (env, pname, params)) \
- X(void, glGetTexEnvxvOES, (GLenum env, GLenum pname, GLfixed* params), (env, pname, params)) \
- X(void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat* params), (target, pname, params)) \
- X(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint* params), (target, pname, params)) \
- X(void, glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed* params), (target, pname, params)) \
- X(void, glGetTexParameterxvOES, (GLenum target, GLenum pname, GLfixed* params), (target, pname, params)) \
- X(void, glGetUniformfv, (GLuint program, GLint location, GLfloat* params), (program, location, params)) \
- X(void, glGetUniformiv, (GLuint program, GLint location, GLint* params), (program, location, params)) \
- X(GLint, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name)) \
- X(void, glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid** pointer), (index, pname, pointer)) \
- X(void, glGetVertexAttribfv, (GLuint index, GLenum pname, GLfloat* params), (index, pname, params)) \
- X(void, glGetVertexAttribiv, (GLuint index, GLenum pname, GLint* params), (index, pname, params)) \
- X(void, glHint, (GLenum target, GLenum mode), (target, mode)) \
- X(GLboolean, glIsBuffer, (GLuint buffer), (buffer)) \
- X(GLboolean, glIsEnabled, (GLenum cap), (cap)) \
- X(GLboolean, glIsFramebuffer, (GLuint framebuffer), (framebuffer)) \
- X(GLboolean, glIsFramebufferOES, (GLuint framebuffer), (framebuffer)) \
- X(GLboolean, glIsProgram, (GLuint program), (program)) \
- X(GLboolean, glIsRenderbuffer, (GLuint renderbuffer), (renderbuffer)) \
- X(GLboolean, glIsRenderbufferOES, (GLuint renderbuffer), (renderbuffer)) \
- X(GLboolean, glIsShader, (GLuint shader), (shader)) \
- X(GLboolean, glIsTexture, (GLuint texture), (texture)) \
- X(void, glLightModelf, (GLenum name, GLfloat param), (name, param)) \
- X(void, glLightModelfv, (GLenum name, const GLfloat* params), (name, params)) \
- X(void, glLightModelx, (GLenum pname, GLfixed param), (pname, param)) \
- X(void, glLightModelxOES, (GLenum pname, GLfixed param), (pname, param)) \
- X(void, glLightModelxv, (GLenum pname, const GLfixed* params), (pname, params)) \
- X(void, glLightModelxvOES, (GLenum pname, const GLfixed* params), (pname, params)) \
- X(void, glLightf, (GLenum lightid, GLenum name, GLfloat param), (lightid, name, param)) \
- X(void, glLightfv, (GLenum lightid, GLenum name, const GLfloat* params), (lightid, name, params)) \
- X(void, glLightx, (GLenum light, GLenum pname, GLfixed param), (light, pname, param)) \
- X(void, glLightxOES, (GLenum light, GLenum pname, GLfixed param), (light, pname, param)) \
- X(void, glLightxv, (GLenum light, GLenum pname, const GLfixed* params), (light, pname, params)) \
- X(void, glLightxvOES, (GLenum light, GLenum pname, const GLfixed* params), (light, pname, params)) \
- X(void, glLineWidth, (GLfloat width), (width)) \
- X(void, glLineWidthx, (GLfixed width), (width)) \
- X(void, glLineWidthxOES, (GLfixed width), (width)) \
- X(void, glLinkProgram, (GLuint program), (program)) \
- X(void, glLoadIdentity, (), ()) \
- X(void, glLoadMatrixf, (const GLfloat* m), (m)) \
- X(void, glLoadMatrixx, (const GLfixed* m), (m)) \
- X(void, glLoadMatrixxOES, (const GLfixed* m), (m)) \
- X(void, glLoadPaletteFromModelViewMatrixOES, (), ()) \
- X(GLvoidptr, glMapTexSubImage2DCHROMIUM, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access), (target, level, xoffset, yoffset, width, height, format, type, access)) \
- X(void, glMaterialf, (GLenum face, GLenum name, GLfloat param), (face, name, param)) \
- X(void, glMaterialfv, (GLenum face, GLenum name, const GLfloat* params), (face, name, params)) \
- X(void, glMaterialx, (GLenum face, GLenum pname, GLfixed param), (face, pname, param)) \
- X(void, glMaterialxOES, (GLenum face, GLenum pname, GLfixed param), (face, pname, param)) \
- X(void, glMaterialxv, (GLenum face, GLenum pname, const GLfixed* params), (face, pname, params)) \
- X(void, glMaterialxvOES, (GLenum face, GLenum pname, const GLfixed* params), (face, pname, params)) \
- X(void, glMatrixMode, (GLenum mode), (mode)) \
- X(void, glMatrixIndexPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer), (size, type, stride, pointer)) \
- X(void, glMatrixIndexPointerOESBounds, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count), (size, type, stride, pointer, count)) \
- X(void, glMultMatrixf, (const GLfloat* m), (m)) \
- X(void, glMultMatrixx, (const GLfixed* m), (m)) \
- X(void, glMultMatrixxOES, (const GLfixed* m), (m)) \
- X(void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz), (nx, ny, nz)) \
- X(void, glNormal3fv, (const GLfloat* coords), (coords)) \
- X(void, glNormal3sv, (const GLshort* coords), (coords)) \
- X(void, glNormal3x, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz)) \
- X(void, glNormal3xOES, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz)) \
- X(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid* pointer), (type, stride, pointer)) \
- X(void, glNormalPointerBounds, (GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count), (type, stride, pointer, count)) \
- X(void, glOrthof, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat z_near, GLfloat z_far), (left, right, bottom, top, z_near, z_far)) \
- X(void, glOrthofOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar)) \
- X(void, glOrthox, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar)) \
- X(void, glOrthoxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar)) \
- X(void, glPixelStorei, (GLenum pname, GLint param), (pname, param)) \
- X(void, glPointParameterf, (GLenum pname, GLfloat param), (pname, param)) \
- X(void, glPointParameterfv, (GLenum pname, const GLfloat* params), (pname, params)) \
- X(void, glPointParameterx, (GLenum pname, GLfixed param), (pname, param)) \
- X(void, glPointParameterxOES, (GLenum pname, GLfixed param), (pname, param)) \
- X(void, glPointParameterxv, (GLenum pname, const GLfixed* params), (pname, params)) \
- X(void, glPointParameterxvOES, (GLenum pname, const GLfixed* params), (pname, params)) \
- X(void, glPointSize, (GLfloat size), (size)) \
- X(void, glPointSizex, (GLfixed size), (size)) \
- X(void, glPointSizexOES, (GLfixed size), (size)) \
- X(void, glPointSizePointerOES, (GLenum type, GLsizei stride, const GLvoid* pointer), (type, stride, pointer)) \
- X(void, glPointSizePointer, (GLenum type, GLsizei stride, const GLvoid* pointer), (type, stride, pointer)) \
- X(void, glPointSizePointerOESBounds, (GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count), (type, stride, pointer, count)) \
- X(void, glPolygonOffset, (GLfloat factor, GLfloat units), (factor, units)) \
- X(void, glPolygonOffsetx, (GLfixed factor, GLfixed units), (factor, units)) \
- X(void, glPolygonOffsetxOES, (GLfixed factor, GLfixed units), (factor, units)) \
- X(void, glPopMatrix, (), ()) \
- X(void, glPushMatrix, (), ()) \
- X(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels), (x, y, width, height, format, type, pixels)) \
- X(void, glReleaseShaderCompiler, (), ()) \
- X(void, glRenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height)) \
- X(void, glRenderbufferStorageOES, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height)) \
- X(void, glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z), (angle, x, y, z)) \
- X(void, glRotatex, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z)) \
- X(void, glRotatexOES, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z)) \
- X(void, glSampleCoverage, (GLclampf value, GLboolean invert), (value, invert)) \
- X(void, glSampleCoveragex, (GLclampx value, GLboolean invert), (value, invert)) \
- X(void, glSampleCoveragexOES, (GLclampx value, GLboolean invert), (value, invert)) \
- X(void, glScalef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z)) \
- X(void, glScalex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z)) \
- X(void, glScalexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z)) \
- X(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height)) \
- X(void, glShadeModel, (GLenum mode), (mode)) \
- X(void, glShaderSource, (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length), (shader, count, string, length)) \
- X(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask), (func, ref, mask)) \
- X(void, glStencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask), (face, func, ref, mask)) \
- X(void, glStencilMask, (GLuint mask), (mask)) \
- X(void, glStencilMaskSeparate, (GLenum face, GLuint mask), (face, mask)) \
- X(void, glStencilOp, (GLenum sfail, GLenum zfail, GLenum zpass), (sfail, zfail, zpass)) \
- X(void, glStencilOpSeparate, (GLenum face, GLenum sfail, GLenum zfail, GLenum zpass), (face, sfail, zfail, zpass)) \
- X(void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer), (size, type, stride, pointer)) \
- X(void, glTexCoordPointerBounds, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count), (size, type, stride, pointer, count)) \
- X(void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param)) \
- X(void, glTexEnvfv, (GLenum target, GLenum pname, const GLfloat* params), (target, pname, params)) \
- X(void, glTexEnvi, (GLenum target, GLenum pname, GLint param), (target, pname, param)) \
- X(void, glTexEnviv, (GLenum target, GLenum pname, const GLint* params), (target, pname, params)) \
- X(void, glTexEnvx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param)) \
- X(void, glTexEnvxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param)) \
- X(void, glTexEnvxv, (GLenum target, GLenum pname, const GLfixed* params), (target, pname, params)) \
- X(void, glTexEnvxvOES, (GLenum target, GLenum pname, const GLfixed* params), (target, pname, params)) \
- X(void, glTexGeniOES, (GLenum coord, GLenum pname, GLint param), (coord, pname, param)) \
- X(void, glTexGenivOES, (GLenum coord, GLenum pname, const GLint* params), (coord, pname, params)) \
- X(void, glTexGenxOES, (GLenum coord, GLenum pname, GLfixed param), (coord, pname, param)) \
- X(void, glTexGenxvOES, (GLenum coord, GLenum pname, const GLfixed* params), (coord, pname, params)) \
- X(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels), (target, level, internalformat, width, height, border, format, type, pixels)) \
- X(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param)) \
- X(void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat* params), (target, pname, params)) \
- X(void, glTexParameteri, (GLenum target, GLenum pname, GLint param), (target, pname, param)) \
- X(void, glTexParameteriv, (GLenum target, GLenum pname, const GLint* params), (target, pname, params)) \
- X(void, glTexParameterx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param)) \
- X(void, glTexParameterxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param)) \
- X(void, glTexParameterxv, (GLenum target, GLenum pname, const GLfixed* params), (target, pname, params)) \
- X(void, glTexParameterxvOES, (GLenum target, GLenum pname, const GLfixed* params), (target, pname, params)) \
- X(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels), (target, level, xoffset, yoffset, width, height, format, type, pixels)) \
- X(void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z)) \
- X(void, glTranslatex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z)) \
- X(void, glTranslatexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z)) \
- X(void, glUniform1f, (GLint location, GLfloat x), (location, x)) \
- X(void, glUniform1fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
- X(void, glUniform1i, (GLint location, GLint x), (location, x)) \
- X(void, glUniform1iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
- X(void, glUniform2f, (GLint location, GLfloat x, GLfloat y), (location, x, y)) \
- X(void, glUniform2fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
- X(void, glUniform2i, (GLint location, GLint x, GLint y), (location, x, y)) \
- X(void, glUniform2iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
- X(void, glUniform3f, (GLint location, GLfloat x, GLfloat y, GLfloat z), (location, x, y, z)) \
- X(void, glUniform3fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
- X(void, glUniform3i, (GLint location, GLint x, GLint y, GLint z), (location, x, y, z)) \
- X(void, glUniform3iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
- X(void, glUniform4f, (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (location, x, y, z, w)) \
- X(void, glUniform4fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
- X(void, glUniform4i, (GLint location, GLint x, GLint y, GLint z, GLint w), (location, x, y, z, w)) \
- X(void, glUniform4iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
- X(void, glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value)) \
- X(void, glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value)) \
- X(void, glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value)) \
- X(void, glUnmapTexSubImage2DCHROMIUM, (const GLvoid* mem), (mem)) \
- X(void, glUseProgram, (GLuint program), (program)) \
- X(void, glValidateProgram, (GLuint program), (program)) \
- X(void, glVertexAttrib1f, (GLuint indx, GLfloat x), (indx, x)) \
- X(void, glVertexAttrib1fv, (GLuint indx, const GLfloat* values), (indx, values)) \
- X(void, glVertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y), (indx, x, y)) \
- X(void, glVertexAttrib2fv, (GLuint indx, const GLfloat* values), (indx, values)) \
- X(void, glVertexAttrib3f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z), (indx, x, y, z)) \
- X(void, glVertexAttrib3fv, (GLuint indx, const GLfloat* values), (indx, values)) \
- X(void, glVertexAttrib4f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (indx, x, y, z, w)) \
- X(void, glVertexAttrib4fv, (GLuint indx, const GLfloat* values), (indx, values)) \
- X(void, glVertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer), (indx, size, type, normalized, stride, pointer)) \
- X(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer), (size, type, stride, pointer)) \
- X(void, glVertexPointerBounds, (GLint size, GLenum type, GLsizei stride, GLvoid* pointer, GLsizei count), (size, type, stride, pointer, count)) \
- X(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height)) \
- X(void, glWeightPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer), (size, type, stride, pointer)) \
- X(void, glWeightPointerOESBounds, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count), (size, type, stride, pointer, count)) \
-
-
-#endif // GLES12TR_INTERNAL_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles1_extensions_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles1_extensions_functions.h
deleted file mode 100644
index 9a73666da..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles1_extensions_functions.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_extensions.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles1_extensions_functions.h
-// DO NOT EDIT THIS FILE
-
-#ifndef GLES1_EXTENSIONS_FUNCTIONS_H
-#define GLES1_EXTENSIONS_FUNCTIONS_H
-
-#define LIST_GLES1_EXTENSIONS_FUNCTIONS(X) \
- X(void, glCurrentPaletteMatrixARB, (GLint index), (index)) \
- X(void, glMatrixIndexuivARB, (GLint size, GLuint * indices), (size, indices)) \
- X(void, glMatrixIndexPointerARB, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer), (size, type, stride, pointer)) \
- X(void, glWeightPointerARB, (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer), (size, type, stride, pointer)) \
- X(void, glTexGenf, (GLenum coord, GLenum pname, GLfloat param), (coord, pname, param)) \
- X(void, glTexGeni, (GLenum coord, GLenum pname, GLint param), (coord, pname, param)) \
- X(void, glTexGenfv, (GLenum coord, GLenum pname, const GLfloat * params), (coord, pname, params)) \
- X(void, glTexGeniv, (GLenum coord, GLenum pname, const GLint * params), (coord, pname, params)) \
- X(void, glGetTexGenfv, (GLenum coord, GLenum pname, GLfloat * params), (coord, pname, params)) \
- X(void, glGetTexGeniv, (GLenum coord, GLenum pname, GLint * params), (coord, pname, params)) \
-
-
-#endif // GLES1_EXTENSIONS_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles1_only_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles1_only_functions.h
deleted file mode 100644
index 6a9824cde..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles1_only_functions.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_only.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles1_only_functions.h
-// DO NOT EDIT THIS FILE
-
-#ifndef GLES1_ONLY_FUNCTIONS_H
-#define GLES1_ONLY_FUNCTIONS_H
-
-#define LIST_GLES1_ONLY_FUNCTIONS(X) \
- X(void, glAlphaFunc, (GLenum func, GLclampf ref), (func, ref)) \
- X(void, glBegin, (GLenum mode), (mode)) \
- X(void, glClientActiveTexture, (GLenum texture), (texture)) \
- X(void, glClipPlane, (GLenum plane, const GLdouble * equation), (plane, equation)) \
- X(void, glColor4d, (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha), (red, green, blue, alpha)) \
- X(void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha)) \
- X(void, glColor4fv, (const GLfloat * v), (v)) \
- X(void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha), (red, green, blue, alpha)) \
- X(void, glColor4ubv, (const GLubyte * v), (v)) \
- X(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), (size, type, stride, pointer)) \
- X(void, glDisableClientState, (GLenum array), (array)) \
- X(void, glEnableClientState, (GLenum array), (array)) \
- X(void, glEnd, (), ()) \
- X(void, glFogf, (GLenum pname, GLfloat param), (pname, param)) \
- X(void, glFogfv, (GLenum pname, const GLfloat * params), (pname, params)) \
- X(void, glFrustum, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar), (left, right, bottom, top, zNear, zFar)) \
- X(void, glGetClipPlane, (GLenum plane, GLdouble * equation), (plane, equation)) \
- X(void, glGetDoublev, (GLenum pname, GLdouble * params), (pname, params)) \
- X(void, glGetLightfv, (GLenum light, GLenum pname, GLfloat * params), (light, pname, params)) \
- X(void, glGetMaterialfv, (GLenum face, GLenum pname, GLfloat * params), (face, pname, params)) \
- X(void, glGetPointerv, (GLenum pname, GLvoid* * params), (pname, params)) \
- X(void, glGetTexEnvfv, (GLenum target, GLenum pname, GLfloat * params), (target, pname, params)) \
- X(void, glGetTexEnviv, (GLenum target, GLenum pname, GLint * params), (target, pname, params)) \
- X(void, glLightf, (GLenum light, GLenum pname, GLfloat param), (light, pname, param)) \
- X(void, glLightfv, (GLenum light, GLenum pname, const GLfloat * params), (light, pname, params)) \
- X(void, glLightModelf, (GLenum pname, GLfloat param), (pname, param)) \
- X(void, glLightModelfv, (GLenum pname, const GLfloat * params), (pname, params)) \
- X(void, glLoadIdentity, (), ()) \
- X(void, glLoadMatrixf, (const GLfloat * m), (m)) \
- X(void, glLogicOp, (GLenum opcode), (opcode)) \
- X(void, glMaterialf, (GLenum face, GLenum pname, GLfloat param), (face, pname, param)) \
- X(void, glMaterialfv, (GLenum face, GLenum pname, const GLfloat * params), (face, pname, params)) \
- X(void, glMultiTexCoord2fv, (GLenum target, const GLfloat * v), (target, v)) \
- X(void, glMultiTexCoord2sv, (GLenum target, const GLshort * v), (target, v)) \
- X(void, glMultiTexCoord3fv, (GLenum target, const GLfloat * v), (target, v)) \
- X(void, glMultiTexCoord3sv, (GLenum target, const GLshort * v), (target, v)) \
- X(void, glMultiTexCoord4f, (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q), (target, s, t, r, q)) \
- X(void, glMultiTexCoord4fv, (GLenum target, const GLfloat * v), (target, v)) \
- X(void, glMultiTexCoord4sv, (GLenum target, const GLshort * v), (target, v)) \
- X(void, glMultMatrixf, (const GLfloat * m), (m)) \
- X(void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz), (nx, ny, nz)) \
- X(void, glNormal3fv, (const GLfloat * v), (v)) \
- X(void, glNormal3sv, (const GLshort * v), (v)) \
- X(void, glOrtho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar), (left, right, bottom, top, zNear, zFar)) \
- X(void, glPointParameterf, (GLenum param, GLfloat value), (param, value)) \
- X(void, glPointParameterfv, (GLenum param, const GLfloat * values), (param, values)) \
- X(void, glPointSize, (GLfloat size), (size)) \
- X(void, glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z), (angle, x, y, z)) \
- X(void, glScalef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z)) \
- X(void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param)) \
- X(void, glTexEnvfv, (GLenum target, GLenum pname, const GLfloat * params), (target, pname, params)) \
- X(void, glMatrixMode, (GLenum mode), (mode)) \
- X(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid * pointer), (type, stride, pointer)) \
- X(void, glPopMatrix, (), ()) \
- X(void, glPushMatrix, (), ()) \
- X(void, glShadeModel, (GLenum mode), (mode)) \
- X(void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), (size, type, stride, pointer)) \
- X(void, glTexEnvi, (GLenum target, GLenum pname, GLint param), (target, pname, param)) \
- X(void, glTexEnviv, (GLenum target, GLenum pname, const GLint * params), (target, pname, params)) \
- X(void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z)) \
- X(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), (size, type, stride, pointer)) \
-
-
-#endif // GLES1_ONLY_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles2_extensions_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles2_extensions_functions.h
deleted file mode 100644
index 980963f3d..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles2_extensions_functions.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_extensions.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles2_extensions_functions.h
-// DO NOT EDIT THIS FILE
-
-#ifndef GLES2_EXTENSIONS_FUNCTIONS_H
-#define GLES2_EXTENSIONS_FUNCTIONS_H
-
-#define LIST_GLES2_EXTENSIONS_FUNCTIONS(X) \
- X(void, glGetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision), (shadertype, precisiontype, range, precision)) \
- X(void, glReleaseShaderCompiler, (), ()) \
- X(void, glShaderBinary, (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length), (n, shaders, binaryformat, binary, length)) \
-
-
-#endif // GLES2_EXTENSIONS_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles2_only_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles2_only_functions.h
deleted file mode 100644
index b05a4967a..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles2_only_functions.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_only.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles2_only_functions.h
-// DO NOT EDIT THIS FILE
-
-#ifndef GLES2_ONLY_FUNCTIONS_H
-#define GLES2_ONLY_FUNCTIONS_H
-
-#define LIST_GLES2_ONLY_FUNCTIONS(X) \
- X(void, glBlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red, green, blue, alpha)) \
- X(void, glStencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask), (face, func, ref, mask)) \
- X(void, glStencilMaskSeparate, (GLenum face, GLuint mask), (face, mask)) \
- X(GLboolean, glIsProgram, (GLuint program), (program)) \
- X(GLboolean, glIsShader, (GLuint shader), (shader)) \
- X(void, glVertexAttrib1f, (GLuint indx, GLfloat x), (indx, x)) \
- X(void, glVertexAttrib1fv, (GLuint indx, const GLfloat* values), (indx, values)) \
- X(void, glVertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y), (indx, x, y)) \
- X(void, glVertexAttrib2fv, (GLuint indx, const GLfloat* values), (indx, values)) \
- X(void, glVertexAttrib3f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z), (indx, x, y, z)) \
- X(void, glVertexAttrib3fv, (GLuint indx, const GLfloat* values), (indx, values)) \
- X(void, glVertexAttrib4f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (indx, x, y, z, w)) \
- X(void, glVertexAttrib4fv, (GLuint indx, const GLfloat* values), (indx, values)) \
- X(void, glVertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr), (indx, size, type, normalized, stride, ptr)) \
- X(void, glDisableVertexAttribArray, (GLuint index), (index)) \
- X(void, glEnableVertexAttribArray, (GLuint index), (index)) \
- X(void, glGetVertexAttribfv, (GLuint index, GLenum pname, GLfloat* params), (index, pname, params)) \
- X(void, glGetVertexAttribiv, (GLuint index, GLenum pname, GLint* params), (index, pname, params)) \
- X(void, glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid** pointer), (index, pname, pointer)) \
- X(void, glUniform1f, (GLint location, GLfloat x), (location, x)) \
- X(void, glUniform1fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
- X(void, glUniform1i, (GLint location, GLint x), (location, x)) \
- X(void, glUniform1iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
- X(void, glUniform2f, (GLint location, GLfloat x, GLfloat y), (location, x, y)) \
- X(void, glUniform2fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
- X(void, glUniform2i, (GLint location, GLint x, GLint y), (location, x, y)) \
- X(void, glUniform2iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
- X(void, glUniform3f, (GLint location, GLfloat x, GLfloat y, GLfloat z), (location, x, y, z)) \
- X(void, glUniform3fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
- X(void, glUniform3i, (GLint location, GLint x, GLint y, GLint z), (location, x, y, z)) \
- X(void, glUniform3iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
- X(void, glUniform4f, (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (location, x, y, z, w)) \
- X(void, glUniform4fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v)) \
- X(void, glUniform4i, (GLint location, GLint x, GLint y, GLint z, GLint w), (location, x, y, z, w)) \
- X(void, glUniform4iv, (GLint location, GLsizei count, const GLint* v), (location, count, v)) \
- X(void, glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value)) \
- X(void, glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value)) \
- X(void, glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value)) \
- X(void, glAttachShader, (GLuint program, GLuint shader), (program, shader)) \
- X(void, glBindAttribLocation, (GLuint program, GLuint index, const GLchar* name), (program, index, name)) \
- X(void, glCompileShader, (GLuint shader), (shader)) \
- X(GLuint, glCreateProgram, (), ()) \
- X(GLuint, glCreateShader, (GLenum type), (type)) \
- X(void, glDeleteProgram, (GLuint program), (program)) \
- X(void, glDeleteShader, (GLuint shader), (shader)) \
- X(void, glDetachShader, (GLuint program, GLuint shader), (program, shader)) \
- X(void, glLinkProgram, (GLuint program), (program)) \
- X(void, glUseProgram, (GLuint program), (program)) \
- X(void, glValidateProgram, (GLuint program), (program)) \
- X(void, glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name)) \
- X(void, glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name)) \
- X(void, glGetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders), (program, maxcount, count, shaders)) \
- X(int, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name)) \
- X(void, glGetProgramiv, (GLuint program, GLenum pname, GLint* params), (program, pname, params)) \
- X(void, glGetProgramInfoLog, (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog), (program, bufsize, length, infolog)) \
- X(void, glGetShaderiv, (GLuint shader, GLenum pname, GLint* params), (shader, pname, params)) \
- X(void, glGetShaderInfoLog, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog), (shader, bufsize, length, infolog)) \
- X(void, glGetShaderSource, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source), (shader, bufsize, length, source)) \
- X(void, glGetUniformfv, (GLuint program, GLint location, GLfloat* params), (program, location, params)) \
- X(void, glGetUniformiv, (GLuint program, GLint location, GLint* params), (program, location, params)) \
- X(int, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name)) \
- X(void, glShaderSource, (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length), (shader, count, string, length)) \
- X(void, glBindFramebuffer, (GLenum target, GLuint framebuffer), (target, framebuffer)) \
- X(void, glGenFramebuffers, (GLsizei n, GLuint* framebuffers), (n, framebuffers)) \
- X(void, glFramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level)) \
- X(GLenum, glCheckFramebufferStatus, (GLenum target), (target)) \
- X(void, glDeleteFramebuffers, (GLsizei n, const GLuint* framebuffers), (n, framebuffers)) \
- X(GLboolean, glIsRenderbuffer, (GLuint renderbuffer), (renderbuffer)) \
- X(void, glBindRenderbuffer, (GLenum target, GLuint renderbuffer), (target, renderbuffer)) \
- X(void, glDeleteRenderbuffers, (GLsizei n, const GLuint * renderbuffers), (n, renderbuffers)) \
- X(void, glGenRenderbuffers, (GLsizei n, GLuint * renderbuffers), (n, renderbuffers)) \
- X(void, glRenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height)) \
- X(void, glGetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint * params), (target, pname, params)) \
- X(void, glFramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer)) \
- X(void, glGenerateMipmap, (GLenum target), (target)) \
-
-
-#endif // GLES2_ONLY_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles3_only_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles3_only_functions.h
deleted file mode 100644
index 9b17cfaa0..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles3_only_functions.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles3_only.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles3_only_functions.h
-// DO NOT EDIT THIS FILE
-
-#ifndef GLES3_ONLY_FUNCTIONS_H
-#define GLES3_ONLY_FUNCTIONS_H
-
-#include <GLES/gl.h>
-#include <GLES3/gl3.h>
-#define LIST_GLES3_ONLY_FUNCTIONS(X) \
- X(GLconstubyteptr, glGetStringi, (GLenum name, GLint index), (name, index)) \
- X(GLsync, glFenceSync, (GLenum condition, GLbitfield flags), (condition, flags)) \
- X(GLenum, glClientWaitSync, (GLsync wait_on, GLbitfield flags, GLuint64 timeout), (wait_on, flags, timeout)) \
- X(void, glWaitSync, (GLsync wait_on, GLbitfield flags, GLuint64 timeout), (wait_on, flags, timeout)) \
- X(void, glDeleteSync, (GLsync to_delete), (to_delete)) \
-
-
-#endif // GLES3_ONLY_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles_common_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles_common_functions.h
deleted file mode 100644
index bef2236bf..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles_common_functions.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_common.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles_common_functions.h
-// DO NOT EDIT THIS FILE
-
-#ifndef GLES_COMMON_FUNCTIONS_H
-#define GLES_COMMON_FUNCTIONS_H
-
-#include <GLES/gl.h>
-// Return types must be single words, see GLDispatch.cpp
-typedef const GLubyte* GLconstubyteptr;
-#define LIST_GLES_COMMON_FUNCTIONS(X) \
- X(void, glActiveTexture, (GLenum texture), (texture)) \
- X(void, glBindBuffer, (GLenum target, GLuint buffer), (target, buffer)) \
- X(void, glBindTexture, (GLenum target, GLuint texture), (target, texture)) \
- X(void, glBlendFunc, (GLenum sfactor, GLenum dfactor), (sfactor, dfactor)) \
- X(void, glBlendEquation, (GLenum mode), (mode)) \
- X(void, glBlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha)) \
- X(void, glBlendFuncSeparate, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha)) \
- X(void, glBufferData, (GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage), (target, size, data, usage)) \
- X(void, glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data), (target, offset, size, data)) \
- X(void, glClear, (GLbitfield mask), (mask)) \
- X(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red, green, blue, alpha)) \
- X(void, glClearDepth, (GLclampd depth), (depth)) \
- X(void, glClearStencil, (GLint s), (s)) \
- X(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha), (red, green, blue, alpha)) \
- X(void, glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data), (target, level, internalformat, width, height, border, imageSize, data)) \
- X(void, glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data), (target, level, xoffset, yoffset, width, height, format, imageSize, data)) \
- X(void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border), (target, level, internalFormat, x, y, width, height, border)) \
- X(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, x, y, width, height)) \
- X(void, glCullFace, (GLenum mode), (mode)) \
- X(void, glDeleteBuffers, (GLsizei n, const GLuint * buffers), (n, buffers)) \
- X(void, glDeleteTextures, (GLsizei n, const GLuint * textures), (n, textures)) \
- X(void, glDepthFunc, (GLenum func), (func)) \
- X(void, glDepthMask, (GLboolean flag), (flag)) \
- X(void, glDepthRange, (GLclampd zNear, GLclampd zFar), (zNear, zFar)) \
- X(void, glDisable, (GLenum cap), (cap)) \
- X(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count), (mode, first, count)) \
- X(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid * indices), (mode, count, type, indices)) \
- X(void, glEnable, (GLenum cap), (cap)) \
- X(void, glFinish, (), ()) \
- X(void, glFlush, (), ()) \
- X(void, glFrontFace, (GLenum mode), (mode)) \
- X(void, glGenBuffers, (GLsizei n, GLuint * buffers), (n, buffers)) \
- X(void, glGenTextures, (GLsizei n, GLuint * textures), (n, textures)) \
- X(void, glGetBooleanv, (GLenum pname, GLboolean * params), (pname, params)) \
- X(void, glGetBufferParameteriv, (GLenum buffer, GLenum parameter, GLint * value), (buffer, parameter, value)) \
- X(GLenum, glGetError, (), ()) \
- X(void, glGetFloatv, (GLenum pname, GLfloat * params), (pname, params)) \
- X(void, glGetIntegerv, (GLenum pname, GLint * params), (pname, params)) \
- X(GLconstubyteptr, glGetString, (GLenum name), (name)) \
- X(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param)) \
- X(void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat * params), (target, pname, params)) \
- X(void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat * params), (target, pname, params)) \
- X(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint * params), (target, pname, params)) \
- X(void, glGetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint * params), (target, level, pname, params)) \
- X(void, glHint, (GLenum target, GLenum mode), (target, mode)) \
- X(GLboolean, glIsBuffer, (GLuint buffer), (buffer)) \
- X(GLboolean, glIsEnabled, (GLenum cap), (cap)) \
- X(GLboolean, glIsTexture, (GLuint texture), (texture)) \
- X(void, glLineWidth, (GLfloat width), (width)) \
- X(void, glPolygonOffset, (GLfloat factor, GLfloat units), (factor, units)) \
- X(void, glPixelStorei, (GLenum pname, GLint param), (pname, param)) \
- X(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels), (x, y, width, height, format, type, pixels)) \
- X(void, glSampleCoverage, (GLclampf value, GLboolean invert), (value, invert)) \
- X(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height)) \
- X(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask), (func, ref, mask)) \
- X(void, glStencilMask, (GLuint mask), (mask)) \
- X(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass), (fail, zfail, zpass)) \
- X(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels), (target, level, internalformat, width, height, border, format, type, pixels)) \
- X(void, glTexParameteri, (GLenum target, GLenum pname, GLint param), (target, pname, param)) \
- X(void, glTexParameteriv, (GLenum target, GLenum pname, const GLint * params), (target, pname, params)) \
- X(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels), (target, level, xoffset, yoffset, width, height, format, type, pixels)) \
- X(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height)) \
- X(void, glPushAttrib, (GLbitfield mask), (mask)) \
- X(void, glPushClientAttrib, (GLbitfield mask), (mask)) \
- X(void, glPopAttrib, (), ()) \
- X(void, glPopClientAttrib, (), ()) \
-
-
-#endif // GLES_COMMON_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles_extensions_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles_extensions_functions.h
deleted file mode 100644
index f67324013..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles_extensions_functions.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_extensions.entries --output=distrib/android-emugl/host/include/OpenGLESDispatch/gles_extensions_functions.h
-// DO NOT EDIT THIS FILE
-
-#ifndef GLES_EXTENSIONS_FUNCTIONS_H
-#define GLES_EXTENSIONS_FUNCTIONS_H
-
-#define LIST_GLES_EXTENSIONS_FUNCTIONS(X) \
- X(GLboolean, glIsRenderbufferEXT, (GLuint renderbuffer), (renderbuffer)) \
- X(void, glBindRenderbufferEXT, (GLenum target, GLuint renderbuffer), (target, renderbuffer)) \
- X(void, glDeleteRenderbuffersEXT, (GLsizei n, const GLuint * renderbuffers), (n, renderbuffers)) \
- X(void, glGenRenderbuffersEXT, (GLsizei n, GLuint * renderbuffers), (n, renderbuffers)) \
- X(void, glRenderbufferStorageEXT, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height)) \
- X(void, glGetRenderbufferParameterivEXT, (GLenum target, GLenum pname, GLint * params), (target, pname, params)) \
- X(GLboolean, glIsFramebufferEXT, (GLuint framebuffer), (framebuffer)) \
- X(void, glBindFramebufferEXT, (GLenum target, GLuint framebuffer), (target, framebuffer)) \
- X(void, glDeleteFramebuffersEXT, (GLsizei n, const GLuint * framebuffers), (n, framebuffers)) \
- X(void, glGenFramebuffersEXT, (GLsizei n, GLuint * framebuffers), (n, framebuffers)) \
- X(GLenum, glCheckFramebufferStatusEXT, (GLenum target), (target)) \
- X(void, glFramebufferTexture1DEXT, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level)) \
- X(void, glFramebufferTexture2DEXT, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level)) \
- X(void, glFramebufferTexture3DEXT, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset), (target, attachment, textarget, texture, level, zoffset)) \
- X(void, glFramebufferRenderbufferEXT, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer)) \
- X(void, glGetFramebufferAttachmentParameterivEXT, (GLenum target, GLenum attachment, GLenum pname, GLint * params), (target, attachment, pname, params)) \
- X(void, glGenerateMipmapEXT, (GLenum target), (target)) \
- X(void, glEGLImageTargetTexture2DOES, (GLenum target, GLeglImageOES image), (target, image)) \
- X(void, glEGLImageTargetRenderbufferStorageOES, (GLenum target, GLeglImageOES image), (target, image)) \
-
-
-#endif // GLES_EXTENSIONS_FUNCTIONS_H
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/gles_functions.h b/distrib/android-emugl/host/include/OpenGLESDispatch/gles_functions.h
deleted file mode 100644
index 91ee15abe..000000000
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/gles_functions.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#pragma once
-
-#include "OpenGLESDispatch/gles_common_functions.h"
-#include "OpenGLESDispatch/gles_extensions_functions.h"
-#include "OpenGLESDispatch/gles1_only_functions.h"
-#include "OpenGLESDispatch/gles1_extensions_functions.h"
-#include "OpenGLESDispatch/gles12tr.h"
-#include "OpenGLESDispatch/gles2_only_functions.h"
-#include "OpenGLESDispatch/gles2_extensions_functions.h"
-#include "OpenGLESDispatch/gles3_only_functions.h"
-
-// As a special case, LIST_GLES3_ONLY_FUNCTIONS below uses the Y parameter
-// instead of the X one, meaning that the corresponding functions are
-// optional extensions. For example, glGetStringi is part of GLESv3
-// and is not always provided by host desktop GL drivers.
-// If there are any more GLES3 functions on top of that, they're assumed
-// to extend the GLES2 driver.
-#define LIST_GLES_FUNCTIONS(X,Y) \
- LIST_GLES_COMMON_FUNCTIONS(X) \
- LIST_GLES_EXTENSIONS_FUNCTIONS(Y) \
- LIST_GLES1_ONLY_FUNCTIONS(X) \
- LIST_GLES1_EXTENSIONS_FUNCTIONS(Y) \
- LIST_GLES2_ONLY_FUNCTIONS(X) \
- LIST_GLES2_EXTENSIONS_FUNCTIONS(Y) \
- LIST_GLES3_ONLY_FUNCTIONS(Y) \
-
-#define LIST_GLES1_FUNCTIONS(X, Y) \
- LIST_GLES_COMMON_FUNCTIONS(X) \
- LIST_GLES_EXTENSIONS_FUNCTIONS(Y) \
- LIST_GLES1_ONLY_FUNCTIONS(X) \
- LIST_GLES1_EXTENSIONS_FUNCTIONS(Y) \
-
-#define LIST_GLES2_FUNCTIONS(X, Y) \
- LIST_GLES_COMMON_FUNCTIONS(X) \
- LIST_GLES_EXTENSIONS_FUNCTIONS(Y) \
- LIST_GLES2_ONLY_FUNCTIONS(X) \
- LIST_GLES2_EXTENSIONS_FUNCTIONS(Y) \
- LIST_GLES3_ONLY_FUNCTIONS(Y) \
-
diff --git a/distrib/android-emugl/host/include/libOpenglRender/RenderChannel.h b/distrib/android-emugl/host/include/libOpenglRender/RenderChannel.h
deleted file mode 100644
index e69de29bb..000000000
--- a/distrib/android-emugl/host/include/libOpenglRender/RenderChannel.h
+++ /dev/null
diff --git a/distrib/android-emugl/host/include/libOpenglRender/RenderLib.h b/distrib/android-emugl/host/include/libOpenglRender/RenderLib.h
deleted file mode 100644
index 001a0a982..000000000
--- a/distrib/android-emugl/host/include/libOpenglRender/RenderLib.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#pragma once
-
-#include <memory>
-
-#include "OpenglRender/Renderer.h"
-#include "OpenglRender/render_api_types.h"
-
-namespace emugl {
-
-// RenderLib - root interface for the GPU emulation library
-// Use it to set the library-wide parameters (logging, crash reporting) and
-// create indivudual renderers that take care of drawing windows.
-class RenderLib {
-public:
- virtual void setLogger(emugl_logger_struct logger) = 0;
- virtual void setCrashReporter(emugl_crash_reporter_t reporter) = 0;
-
- // initRenderer - initialize the OpenGL renderer object.
- //
- // |width| and |height| are the framebuffer dimensions that will be reported
- // to the guest display driver.
- //
- // |useSubWindow| is true to indicate that renderer has to support an
- // OpenGL subwindow. If false, it only supports setPostCallback().
- // See Renderer.h for more info.
- //
- // There might be only one renderer.
- virtual RendererPtr initRenderer(int width, int height,
- bool useSubWindow) = 0;
-
-protected:
- ~RenderLib() = default;
-};
-
-using RenderLibPtr = std::unique_ptr<RenderLib>;
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/include/libOpenglRender/Renderer.h b/distrib/android-emugl/host/include/libOpenglRender/Renderer.h
deleted file mode 100644
index 5806adc02..000000000
--- a/distrib/android-emugl/host/include/libOpenglRender/Renderer.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#pragma once
-
-#include "OpenglRender/RenderChannel.h"
-#include "OpenglRender/render_api_platform_types.h"
-
-#include <functional>
-#include <memory>
-#include <string>
-
-namespace emugl {
-
-// Renderer - an object that manages a single OpenGL window used for drawing
-// and is able to create individual render channels for that window.
-//
-class Renderer {
-public:
- // createRenderChannel - create a separate channel for the rendering data.
- // This call instantiates a new object that waits for the serialized data
- // from the guest, deserializes it, executes the passed GL commands and
- // returns the results back.
- virtual RenderChannelPtr createRenderChannel() = 0;
-
- // getHardwareStrings - describe the GPU hardware and driver.
- // The underlying GL's vendor/renderer/version strings are returned to the
- // caller.
- struct HardwareStrings {
- std::string vendor;
- std::string renderer;
- std::string version;
- };
- virtual HardwareStrings getHardwareStrings() = 0;
-
- // A per-frame callback can be registered with setPostCallback(); to remove
- // it pass an empty callback. While a callback is registered, the renderer
- // will call it 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; it
- // doesn't need to be synchronized, but if the callback 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:
- // 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 used to create the renderer.
- using OnPostCallback = void (*)(void* context,
- int width,
- int height,
- int ydir,
- int format,
- int type,
- unsigned char* pixels);
- virtual void setPostCallback(OnPostCallback onPost, void* context) = 0;
-
- // showOpenGLSubwindow -
- // Create or modify a native subwindow which is a child of 'window'
- // to be used for framebuffer display. If a subwindow already exists,
- // its properties will be updated to match the given parameters.
- // wx,wy is the top left corner of the rendering subwindow.
- // ww,wh are the dimensions of the rendering subwindow.
- // fbw,fbh are the dimensions of the underlying guest framebuffer.
- // dpr is the device pixel ratio, which is needed for higher density
- // displays like retina.
- // zRot is the rotation to apply on the framebuffer display image.
- //
- // Return true on success, false on failure, which can happen when using
- // a software-only renderer like OSMesa. In this case, the client should
- // call setPostCallback to get the content of each new frame when it is
- // posted, and will be responsible for displaying it.
- virtual bool showOpenGLSubwindow(FBNativeWindowType window,
- int wx,
- int wy,
- int ww,
- int wh,
- int fbw,
- int fbh,
- float dpr,
- float zRot) = 0;
-
- // destroyOpenGLSubwindow -
- // destroys the created native subwindow. Once destroyed,
- // Framebuffer content will not be visible until a new
- // subwindow will be created.
- virtual bool destroyOpenGLSubwindow() = 0;
-
- // setOpenGLDisplayRotation -
- // set the framebuffer display image rotation in units
- // of degrees around the z axis
- virtual void setOpenGLDisplayRotation(float zRot) = 0;
-
- // setOpenGLDisplayTranslation
- // change what coordinate of the guest framebuffer will be displayed at
- // the corner of the GPU sub-window. Specifically, |px| and |py| = 0
- // means
- // align the bottom-left of the framebuffer with the bottom-left of the
- // sub-window, and |px| and |py| = 1 means align the top right of the
- // framebuffer with the top right of the sub-window. Intermediate values
- // interpolate between these states.
- virtual void setOpenGLDisplayTranslation(float px, float py) = 0;
-
- // repaintOpenGLDisplay -
- // causes the OpenGL subwindow to get repainted with the
- // latest framebuffer content.
- virtual void repaintOpenGLDisplay() = 0;
-
- // cleanupProcGLObjects -
- // clean up all per-process resources when guest process exits (or is
- // killed). Such resources include color buffer handles and EglImage handles.
- virtual void cleanupProcGLObjects(uint64_t puid) = 0;
-protected:
- ~Renderer() = default;
-};
-
-using RendererPtr = std::shared_ptr<Renderer>;
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/include/libOpenglRender/render_api.h b/distrib/android-emugl/host/include/libOpenglRender/render_api.h
deleted file mode 100644
index 990903e27..000000000
--- a/distrib/android-emugl/host/include/libOpenglRender/render_api.h
+++ /dev/null
@@ -1,160 +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
-
-/* This header and its declarations must be usable from C code.
- *
- * If RENDER_API_NO_PROTOTYPES is #defined before including this header, only
- * the interface function pointer types will be declared, not the prototypes.
- * This allows the client to use those names for its function pointer variables.
- *
- * All interfaces which can fail return an int, with zero indicating failure
- * and anything else indicating success.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdlib.h>
-#include "render_api_platform_types.h"
-
-#if defined(RENDER_API_NO_PROTOTYPES)
-#define DECL(ret, name, args) \
- typedef ret (* name##Fn) args
-#else
-#define DECL(ret, name, args) \
- typedef ret (* name##Fn) args ; \
- ret name args
-#endif
-
-/* 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)
- */
-DECL(int, initLibrary, (void));
-
-/* list of constants to be passed to setStreamMode */
-#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 */
-DECL(int, setStreamMode, (int mode));
-
-/* initOpenGLRenderer - initialize the OpenGL renderer process.
- *
- * width and height are the framebuffer dimensions that will be reported to the
- * guest display driver.
- *
- * addr is a buffer of addrLen bytes that will receive the address that clients
- * should connect to. The interpretation depends on the transport:
- * - TCP: The buffer contains the port number as a string. The server is
- * listening only on the loopback address.
- * - Win32 and UNIX named pipes: The buffer contains the full path clients
- * should connect to.
- *
- * This function is *NOT* thread safe and should be called first
- * to initialize the renderer after initLibrary().
- */
-DECL(int, initOpenGLRenderer, (int width, int height, char* addr, size_t addrLen));
-
-/* getHardwareStrings - describe the GPU hardware and driver.
- * The underlying GL's vendor/renderer/version strings are returned to the
- * caller. The pointers become invalid after a call to stopOpenGLRenderer().
- */
-DECL(void, getHardwareStrings, (const char** vendor, const char** renderer,
- const char** version));
-
-/* A per-frame callback can be registered with setPostCallback(); to remove it
- * pass NULL for both parameters. While a callback is registered, the renderer
- * will call it 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);
-DECL(void, setPostCallback, (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.
- */
-DECL(int, 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.
- */
-DECL(int, destroyOpenGLSubwindow, (void));
-
-/* setOpenGLDisplayRotation -
- * set the framebuffer display image rotation in units
- * of degrees around the z axis
- */
-DECL(void, setOpenGLDisplayRotation, (float zRot));
-
-/* repaintOpenGLDisplay -
- * causes the OpenGL subwindow to get repainted with the
- * latest framebuffer content.
- */
-DECL(void, repaintOpenGLDisplay, (void));
-
-/* stopOpenGLRenderer - stops the OpenGL renderer process.
- * This functions is *NOT* thread safe and should be called
- * only if previous initOpenGLRenderer has returned true.
- */
-DECL(int, stopOpenGLRenderer, (void));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/distrib/android-emugl/host/include/libOpenglRender/render_api_platform_types.h b/distrib/android-emugl/host/include/libOpenglRender/render_api_platform_types.h
deleted file mode 100644
index 38324e1c2..000000000
--- a/distrib/android-emugl/host/include/libOpenglRender/render_api_platform_types.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef _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
diff --git a/distrib/android-emugl/host/include/libOpenglRender/render_api_types.h b/distrib/android-emugl/host/include/libOpenglRender/render_api_types.h
deleted file mode 100644
index 6e50c0c60..000000000
--- a/distrib/android-emugl/host/include/libOpenglRender/render_api_types.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#pragma once
-
-typedef void (*emugl_crash_reporter_t)(const char* format, ...);
-
-typedef void (*emugl_logger_t)(const char* fmt, ...);
-typedef struct {
- emugl_logger_t coarse;
- emugl_logger_t fine;
-} emugl_logger_struct;
-
diff --git a/distrib/android-emugl/host/libs/GLESv1_dec/Android.mk b/distrib/android-emugl/host/libs/GLESv1_dec/Android.mk
deleted file mode 100644
index c0ba2b08a..000000000
--- a/distrib/android-emugl/host/libs/GLESv1_dec/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-### host library #########################################
-$(call emugl-begin-static-library,libGLESv1_dec)
-
-$(call emugl-import, libOpenglCodecCommon)
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-
-$(call emugl-gen-decoder,$(LOCAL_PATH),gles1)
-
-LOCAL_SRC_FILES := GLESv1Decoder.cpp
-
-$(call emugl-export,CFLAGS,$(EMUGL_USER_CFLAGS))
-$(call emugl-export,LDLIBS,$(CXX_STD_LIB))
-
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.cpp b/distrib/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.cpp
deleted file mode 100644
index c31fac16e..000000000
--- a/distrib/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.cpp
+++ /dev/null
@@ -1,245 +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 "GLESv1Decoder.h"
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-static inline void* SafePointerFromUInt(GLuint value) {
- return (void*)(uintptr_t)value;
-}
-
-GLESv1Decoder::GLESv1Decoder()
-{
- m_contextData = NULL;
- m_glesDso = NULL;
-}
-
-GLESv1Decoder::~GLESv1Decoder()
-{
- if (m_glesDso != NULL) {
- delete m_glesDso;
- }
-}
-
-
-int GLESv1Decoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
-{
- if (getProcFunc == NULL) {
- const char *libname = GLES_LIBNAME;
- if (getenv(GLES_LIBNAME_VAR) != NULL) {
- libname = getenv(GLES_LIBNAME_VAR);
- }
-
- char error[256];
- m_glesDso = emugl::SharedLibrary::open(libname, error, sizeof(error));
- if (m_glesDso == NULL) {
- fprintf(stderr, "Couldn't load %s [%s]\n", GLES_LIBNAME, error);
- return -1;
- }
-
- this->initDispatchByName(s_getProc, this);
- } else {
- this->initDispatchByName(getProcFunc, getProcFuncData);
- }
-
- glGetCompressedTextureFormats = s_glGetCompressedTextureFormats;
- glVertexPointerOffset = s_glVertexPointerOffset;
- glColorPointerOffset = s_glColorPointerOffset;
- glNormalPointerOffset = s_glNormalPointerOffset;
- glTexCoordPointerOffset = s_glTexCoordPointerOffset;
- glPointSizePointerOffset = s_glPointSizePointerOffset;
- glWeightPointerOffset = s_glWeightPointerOffset;
- glMatrixIndexPointerOffset = s_glMatrixIndexPointerOffset;
-
- glVertexPointerData = s_glVertexPointerData;
- glColorPointerData = s_glColorPointerData;
- glNormalPointerData = s_glNormalPointerData;
- glTexCoordPointerData = s_glTexCoordPointerData;
- glPointSizePointerData = s_glPointSizePointerData;
- glWeightPointerData = s_glWeightPointerData;
- glMatrixIndexPointerData = s_glMatrixIndexPointerData;
-
- glDrawElementsOffset = s_glDrawElementsOffset;
- glDrawElementsData = s_glDrawElementsData;
- glFinishRoundTrip = s_glFinishRoundTrip;
-
- return 0;
-}
-
-int GLESv1Decoder::s_glFinishRoundTrip(void *self)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glFinish();
- return 0;
-}
-
-void GLESv1Decoder::s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glVertexPointer(size, type, stride, SafePointerFromUInt(offset));
-}
-
-void GLESv1Decoder::s_glColorPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glColorPointer(size, type, stride, SafePointerFromUInt(offset));
-}
-
-void GLESv1Decoder::s_glTexCoordPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glTexCoordPointer(size, type, stride, SafePointerFromUInt(offset));
-}
-
-void GLESv1Decoder::s_glNormalPointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glNormalPointer(type, stride, SafePointerFromUInt(offset));
-}
-
-void GLESv1Decoder::s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glPointSizePointerOES(type, stride, SafePointerFromUInt(offset));
-}
-
-void GLESv1Decoder::s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glWeightPointerOES(size, type, stride, SafePointerFromUInt(offset));
-}
-
-void GLESv1Decoder::s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glMatrixIndexPointerOES(size, type, stride, SafePointerFromUInt(offset));
-}
-
-
-
-#define STORE_POINTER_DATA_OR_ABORT(location) \
- if (ctx->m_contextData != NULL) { \
- ctx->m_contextData->storePointerData((location), data, datalen); \
- } else { \
- return; \
- }
-
-void GLESv1Decoder::s_glVertexPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
-
- STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::VERTEX_LOCATION);
-
- ctx->glVertexPointer(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::VERTEX_LOCATION));
-}
-
-void GLESv1Decoder::s_glColorPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
-
- STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::COLOR_LOCATION);
-
- ctx->glColorPointer(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::COLOR_LOCATION));
-}
-
-void GLESv1Decoder::s_glTexCoordPointerData(void *self, GLint unit, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- STORE_POINTER_DATA_OR_ABORT((GLDecoderContextData::PointerDataLocation)
- (GLDecoderContextData::TEXCOORD0_LOCATION + unit));
-
- ctx->glTexCoordPointer(size, type, 0,
- ctx->m_contextData->pointerData((GLDecoderContextData::PointerDataLocation)
- (GLDecoderContextData::TEXCOORD0_LOCATION + unit)));
-}
-
-void GLESv1Decoder::s_glNormalPointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
-
- STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::NORMAL_LOCATION);
-
- ctx->glNormalPointer(type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::NORMAL_LOCATION));
-}
-
-void GLESv1Decoder::s_glPointSizePointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
-
- STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::POINTSIZE_LOCATION);
-
- ctx->glPointSizePointerOES(type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::POINTSIZE_LOCATION));
-}
-
-void GLESv1Decoder::s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
-
- STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::WEIGHT_LOCATION);
-
- ctx->glWeightPointerOES(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::WEIGHT_LOCATION));
-}
-
-void GLESv1Decoder::s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
-
- STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::MATRIXINDEX_LOCATION);
-
- ctx->glMatrixIndexPointerOES(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::MATRIXINDEX_LOCATION));
-}
-
-void GLESv1Decoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glDrawElements(mode, count, type, SafePointerFromUInt(offset));
-}
-
-void GLESv1Decoder::s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)self;
- ctx->glDrawElements(mode, count, type, data);
-}
-
-void GLESv1Decoder::s_glGetCompressedTextureFormats(void *self, GLint count, GLint *data)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *) self;
- ctx->glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, data);
-}
-
-void *GLESv1Decoder::s_getProc(const char *name, void *userData)
-{
- GLESv1Decoder *ctx = (GLESv1Decoder *)userData;
-
- if (ctx == NULL || ctx->m_glesDso == NULL) {
- return NULL;
- }
-
- void *func = NULL;
-#ifdef USE_EGL_GETPROCADDRESS
- func = (void *) eglGetProcAddress(name);
-#endif
- if (func == NULL) {
- func = (void *)(ctx->m_glesDso->findSymbol(name));
- }
- return func;
-}
diff --git a/distrib/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.h b/distrib/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.h
deleted file mode 100644
index 2a7f082ad..000000000
--- a/distrib/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.h
+++ /dev/null
@@ -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 _GL_DECODER_H_
-#define _GL_DECODER_H_
-
-#include "gles1_dec.h"
-
-#include "FixedBuffer.h"
-#include "GLDecoderContextData.h"
-#include "emugl/common/shared_library.h"
-
-#define GLES_LIBNAME_VAR "ANDROID_GLESv1_LIB"
-#define GLES_LIBNAME "libGLES_CM.so"
-
-class GLESv1Decoder : public gles1_decoder_context_t
-{
-public:
- typedef void *(*get_proc_func_t)(const char *name, void *userData);
-
- GLESv1Decoder();
- ~GLESv1Decoder();
- int initGL(get_proc_func_t getProcFunc = NULL, void *getProcFuncData = NULL);
- void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
-
-private:
- static void gles1_APIENTRY s_glGetCompressedTextureFormats(void * self, GLint cont, GLint *data);
- static void gles1_APIENTRY s_glVertexPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
- static void gles1_APIENTRY s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
-
- static void gles1_APIENTRY s_glColorPointerData(void *self, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
- static void gles1_APIENTRY s_glColorPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
-
- static void gles1_APIENTRY s_glTexCoordPointerData(void *self, GLint unit, GLint size, GLenum type, GLsizei stride, void *data, GLuint datalen);
- static void gles1_APIENTRY s_glTexCoordPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset);
-
- static void gles1_APIENTRY s_glNormalPointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen);
- static void gles1_APIENTRY s_glNormalPointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset);
-
- static void gles1_APIENTRY s_glPointSizePointerData(void *self, GLenum type, GLsizei stride, void *data, GLuint datalen);
- static void gles1_APIENTRY s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset);
-
- static void gles1_APIENTRY s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset);
- static void gles1_APIENTRY s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen);
-
- static void gles1_APIENTRY s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
- static void gles1_APIENTRY s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
-
- static void gles1_APIENTRY s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
- static void gles1_APIENTRY s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
-
- static int gles1_APIENTRY s_glFinishRoundTrip(void *self);
-
- static void * s_getProc(const char *name, void *userData);
-
- GLDecoderContextData *m_contextData;
- emugl::SharedLibrary* m_glesDso;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/GLESv2_dec/Android.mk b/distrib/android-emugl/host/libs/GLESv2_dec/Android.mk
deleted file mode 100644
index b7c63a8e3..000000000
--- a/distrib/android-emugl/host/libs/GLESv2_dec/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-### host library ##########################################
-$(call emugl-begin-static-library,libGLESv2_dec)
-$(call emugl-import, libOpenglCodecCommon)
-$(call emugl-gen-decoder,$(LOCAL_PATH),gles2)
-
-# For gl2_types.h !
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-
-$(call emugl-export,CFLAGS,$(EMUGL_USER_CFLAGS))
-
-LOCAL_SRC_FILES := GLESv2Decoder.cpp
-
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.cpp b/distrib/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.cpp
deleted file mode 100644
index d298a8e7b..000000000
--- a/distrib/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "GLESv2Decoder.h"
-
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-static inline void* SafePointerFromUInt(GLuint value) {
- return (void*)(uintptr_t)value;
-}
-
-GLESv2Decoder::GLESv2Decoder()
-{
- m_contextData = NULL;
- m_GL2library = NULL;
-}
-
-GLESv2Decoder::~GLESv2Decoder()
-{
- delete m_GL2library;
-}
-
-void *GLESv2Decoder::s_getProc(const char *name, void *userData)
-{
- GLESv2Decoder *ctx = (GLESv2Decoder *) userData;
-
- if (ctx == NULL || ctx->m_GL2library == NULL) {
- return NULL;
- }
-
- void *func = NULL;
-#ifdef USE_EGL_GETPROCADDRESS
- func = (void *) eglGetProcAddress(name);
-#endif
- if (func == NULL) {
- func = (void *) ctx->m_GL2library->findSymbol(name);
- }
- return func;
-}
-
-int GLESv2Decoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
-{
- if (getProcFunc == NULL) {
- const char *libname = GLES2_LIBNAME;
- if (getenv(GLES2_LIBNAME_VAR) != NULL) {
- libname = getenv(GLES2_LIBNAME_VAR);
- }
-
- char error[256];
- m_GL2library = emugl::SharedLibrary::open(
- libname, error, sizeof(error));
- if (m_GL2library == NULL) {
- fprintf(stderr, "%s: Couldn't load %s [%s]\n", __FUNCTION__,
- libname, error);
- return -1;
- }
- this->initDispatchByName(s_getProc, this);
- } else {
- this->initDispatchByName(getProcFunc, getProcFuncData);
- }
-
- glGetCompressedTextureFormats = s_glGetCompressedTextureFormats;
- glVertexAttribPointerData = s_glVertexAttribPointerData;
- glVertexAttribPointerOffset = s_glVertexAttribPointerOffset;
-
- glDrawElementsOffset = s_glDrawElementsOffset;
- glDrawElementsData = s_glDrawElementsData;
- glShaderString = s_glShaderString;
- glFinishRoundTrip = s_glFinishRoundTrip;
- return 0;
-
-}
-
-int GLESv2Decoder::s_glFinishRoundTrip(void *self)
-{
- GLESv2Decoder *ctx = (GLESv2Decoder *)self;
- ctx->glFinish();
- return 0;
-}
-
-void GLESv2Decoder::s_glGetCompressedTextureFormats(void *self, int count, GLint *formats)
-{
- GLESv2Decoder *ctx = (GLESv2Decoder *) self;
-
- int nFormats;
- ctx->glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &nFormats);
- if (nFormats > count) {
- fprintf(stderr, "%s: GetCompressedTextureFormats: The requested number of formats does not match the number that is reported by OpenGL\n", __FUNCTION__);
- } else {
- ctx->glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
- }
-}
-
-void GLESv2Decoder::s_glVertexAttribPointerData(void *self, GLuint indx, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride, void * data, GLuint datalen)
-{
- GLESv2Decoder *ctx = (GLESv2Decoder *) self;
- if (ctx->m_contextData != NULL) {
- ctx->m_contextData->storePointerData(indx, data, datalen);
- // note - the stride of the data is always zero when it comes out of the codec.
- // See gl2.attrib for the packing function call.
- ctx->glVertexAttribPointer(indx, size, type, normalized, 0, ctx->m_contextData->pointerData(indx));
- }
-}
-
-void GLESv2Decoder::s_glVertexAttribPointerOffset(void *self, GLuint indx, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride, GLuint data)
-{
- GLESv2Decoder *ctx = (GLESv2Decoder *) self;
- ctx->glVertexAttribPointer(indx, size, type, normalized, stride, SafePointerFromUInt(data));
-}
-
-
-void GLESv2Decoder::s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen)
-{
- GLESv2Decoder *ctx = (GLESv2Decoder *)self;
- ctx->glDrawElements(mode, count, type, data);
-}
-
-
-void GLESv2Decoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset)
-{
- GLESv2Decoder *ctx = (GLESv2Decoder *)self;
- ctx->glDrawElements(mode, count, type, SafePointerFromUInt(offset));
-}
-
-void GLESv2Decoder::s_glShaderString(void *self, GLuint shader, const GLchar* string, GLsizei len)
-{
- GLESv2Decoder *ctx = (GLESv2Decoder *)self;
- ctx->glShaderSource(shader, 1, &string, NULL);
-}
diff --git a/distrib/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.h b/distrib/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.h
deleted file mode 100644
index 2b9e70b03..000000000
--- a/distrib/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef _GL2_DECODER_H_
-#define _GL2_DECODER_H_
-
-#define GLES2_LIBNAME_VAR "ANDROID_GLESv2_LIB"
-#define GLES2_LIBNAME "libGLESv2.so"
-
-#include "gles2_dec.h"
-#include "GLDecoderContextData.h"
-#include "emugl/common/shared_library.h"
-
-class GLESv2Decoder : public gles2_decoder_context_t
-{
-public:
- typedef void *(*get_proc_func_t)(const char *name, void *userData);
- GLESv2Decoder();
- ~GLESv2Decoder();
- int initGL(get_proc_func_t getProcFunc = NULL, void *getProcFuncData = NULL);
- void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
-private:
- GLDecoderContextData *m_contextData;
- emugl::SharedLibrary* m_GL2library;
-
- static void *s_getProc(const char *name, void *userData);
- static void gles2_APIENTRY s_glGetCompressedTextureFormats(void *self, int count, GLint *formats);
- static void gles2_APIENTRY s_glVertexAttribPointerData(void *self, GLuint indx, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride, void * data, GLuint datalen);
- static void gles2_APIENTRY s_glVertexAttribPointerOffset(void *self, GLuint indx, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride, GLuint offset);
-
- static void gles2_APIENTRY s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset);
- static void gles2_APIENTRY s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen);
- static void gles2_APIENTRY s_glShaderString(void *self, GLuint shader, const GLchar* string, GLsizei len);
- static int gles2_APIENTRY s_glFinishRoundTrip(void *self);
-};
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/Android.mk b/distrib/android-emugl/host/libs/Translator/EGL/Android.mk
deleted file mode 100644
index 8156fe50b..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-host_OS_SRCS :=
-host_common_LDLIBS :=
-
-ifeq ($(BUILD_TARGET_OS),linux)
- host_OS_SRCS = EglOsApi_glx.cpp
- host_common_LDLIBS += -lGL -lX11 -ldl -lpthread
-endif
-
-ifeq ($(BUILD_TARGET_OS),darwin)
- host_OS_SRCS = EglOsApi_darwin.cpp \
- MacNative.m \
- MacPixelFormatsAttribs.m
-
- host_common_LDLIBS += -Wl,-framework,AppKit
-endif
-
-ifeq ($(BUILD_TARGET_OS),windows)
- host_OS_SRCS = EglOsApi_wgl.cpp
- host_common_LDLIBS += -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 \
- EglThreadInfo.cpp \
- EglDisplay.cpp \
- ClientAPIExts.cpp
-
-### EGL host implementation ########################
-$(call emugl-begin-shared-library,lib$(BUILD_TARGET_SUFFIX)EGL_translator)
-$(call emugl-import,libGLcommon)
-
-LOCAL_LDLIBS += $(host_common_LDLIBS)
-LOCAL_SRC_FILES := $(host_common_SRC_FILES)
-
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.cpp b/distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.cpp
deleted file mode 100644
index 3deacb91b..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.cpp
+++ /dev/null
@@ -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.get()) { \
- 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.get()) { \
- 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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.h b/distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.h
deleted file mode 100644
index 130b44aed..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.in b/distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.in
deleted file mode 100644
index c3162ebc6..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/ClientAPIExts.in
+++ /dev/null
@@ -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))
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglConfig.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglConfig.cpp
deleted file mode 100644
index 66a691c5e..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglConfig.cpp
+++ /dev/null
@@ -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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglConfig.h b/distrib/android-emugl/host/libs/Translator/EGL/EglConfig.h
deleted file mode 100644
index 3d733f976..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglConfig.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglContext.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglContext.cpp
deleted file mode 100644
index 998fa38ab..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglContext.cpp
+++ /dev/null
@@ -1,94 +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.get() == m_read.get() || surface.get() == m_draw.get();
-}
-
-EglContext::EglContext(EglDisplay *dpy,
- EglOS::Context* 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_version(ver),
- m_mngr(mngr) {
- m_shareGroup = shared_context.get()?
- mngr->attachShareGroup(context,shared_context->nativeType()):
- mngr->createShareGroup(context);
- m_hndl = ++s_nextContextHndl;
-}
-
-EglContext::~EglContext()
-{
- //
- // remove the context in the underlying OS layer
- //
- m_dpy->nativeType()->destroyContext(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);
-}
-
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglContext.h b/distrib/android-emugl/host/libs/Translator/EGL/EglContext.h
deleted file mode 100644
index 3601ae235..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglContext.h
+++ /dev/null
@@ -1,76 +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 "EglConfig.h"
-#include "EglOsApi.h"
-#include "EglSurface.h"
-
-#include <GLcommon/GLutils.h>
-#include <GLcommon/TranslatorIfaces.h>
-#include <GLcommon/objectNameManager.h>
-
-#include "emugl/common/smart_ptr.h"
-
-#include <EGL/egl.h>
-
-class EglContext;
-typedef emugl::SmartPtr<EglContext> ContextPtr;
-
-class EglDisplay;
-
-class EglContext {
-public:
- EglContext(EglDisplay* dpy,
- EglOS::Context* context,
- ContextPtr shared_context,
- EglConfig* config,
- GLEScontext* glesCtx,
- GLESVersion ver,
- ObjectNameManager* mngr);
- bool usingSurface(SurfacePtr surface);
- EglOS::Context* nativeType() const { return m_native; }
- bool getAttrib(EGLint attrib, EGLint* value);
- const SurfacePtr& read() const { return m_read; };
- const SurfacePtr& draw() const { return m_draw; };
- const ShareGroupPtr& getShareGroup() const { 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 = nullptr;
- EglOS::Context* m_native = nullptr;
- EglConfig* m_config = nullptr;
- GLEScontext* m_glesContext = nullptr;
- ShareGroupPtr m_shareGroup;
- SurfacePtr m_read;
- SurfacePtr m_draw;
- GLESVersion m_version;
- ObjectNameManager* m_mngr = nullptr;
- unsigned int m_hndl = 0;
- ImagesHndlMap m_attachedImages;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglDisplay.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglDisplay.cpp
deleted file mode 100644
index e74c41479..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglDisplay.cpp
+++ /dev/null
@@ -1,412 +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 "EglConfig.h"
-#include "EglOsApi.h"
-#include <GLcommon/GLutils.h>
-
-#include <algorithm>
-
-EglDisplay::EglDisplay(EGLNativeDisplayType dpy,
- EglOS::Display* idpy) :
- m_dpy(dpy),
- m_idpy(idpy)
-{
- m_manager[GLES_1_1] = new ObjectNameManager(&m_globalNameSpace);
- m_manager[GLES_2_0] = new ObjectNameManager(&m_globalNameSpace);
-};
-
-EglDisplay::~EglDisplay() {
- emugl::Mutex::AutoLock mutex(m_lock);
-
- //
- // Destroy the global context if one was created.
- // (should be true for windows platform only)
- //
- if (m_globalSharedContext != NULL) {
- m_idpy->destroyContext(m_globalSharedContext);
- }
-
- m_configs.clear();
-
- delete m_manager[GLES_1_1];
- delete m_manager[GLES_2_0];
-
- delete m_idpy;
-}
-
-void EglDisplay::initialize(int renderableType) {
- emugl::Mutex::AutoLock mutex(m_lock);
- m_initialized = true;
- initConfigurations(renderableType);
- m_configInitialized = true;
-}
-
-bool EglDisplay::isInitialize() { return m_initialized;}
-
-void EglDisplay::terminate(){
- emugl::Mutex::AutoLock mutex(m_lock);
- m_contexts.clear();
- m_surfaces.clear();
- m_initialized = false;
-}
-
-namespace {
-struct CompareEglConfigsPtrs {
- bool operator()(const std::unique_ptr<EglConfig>& first,
- const std::unique_ptr<EglConfig>& second) const {
- return *first < *second;
- }
-};
-}
-
-void EglDisplay::addSimplePixelFormat(int red_size,
- int green_size,
- int blue_size,
- int alpha_size) {
- std::sort(m_configs.begin(), m_configs.end(), CompareEglConfigsPtrs());
-
- EGLConfig match;
-
- EglConfig dummy(red_size,
- green_size,
- blue_size,
- alpha_size, // 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,
- NULL);
-
- 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,
- red_size, green_size, blue_size,
- alpha_size);
-
- m_configs.emplace_back(newConfig);
-}
-
-void EglDisplay::addMissingConfigs() {
- addSimplePixelFormat(5, 6, 5, 0); // RGB_565
- addSimplePixelFormat(8, 8, 8, 0); // RGB_888
- // (Host GPUs that are newer may not list RGB_888
- // out of the box.)
-}
-
-void EglDisplay::initConfigurations(int renderableType) {
- if (m_configInitialized) {
- return;
- }
- m_idpy->queryConfigs(renderableType, addConfig, this);
-
- addMissingConfigs();
- std::sort(m_configs.begin(), m_configs.end(), CompareEglConfigsPtrs());
-
-#if EMUGL_DEBUG
- for (ConfigsList::const_iterator it = m_configs.begin();
- it != m_configs.end();
- ++it) {
- EglConfig* config = it->get();
- EGLint red, green, blue, alpha, depth, stencil, renderable, surface;
- config->getConfAttrib(EGL_RED_SIZE, &red);
- config->getConfAttrib(EGL_GREEN_SIZE, &green);
- config->getConfAttrib(EGL_BLUE_SIZE, &blue);
- config->getConfAttrib(EGL_ALPHA_SIZE, &alpha);
- config->getConfAttrib(EGL_DEPTH_SIZE, &depth);
- config->getConfAttrib(EGL_STENCIL_SIZE, &stencil);
- config->getConfAttrib(EGL_RENDERABLE_TYPE, &renderable);
- config->getConfAttrib(EGL_SURFACE_TYPE, &surface);
- }
-#endif // EMUGL_DEBUG
-}
-
-EglConfig* EglDisplay::getConfig(EGLConfig conf) const {
- emugl::Mutex::AutoLock mutex(m_lock);
-
- for(ConfigsList::const_iterator it = m_configs.begin();
- it != m_configs.end();
- ++it) {
- if(static_cast<EGLConfig>(it->get()) == conf) {
- return it->get();
- }
- }
- return NULL;
-}
-
-SurfacePtr EglDisplay::getSurface(EGLSurface surface) const {
- emugl::Mutex::AutoLock mutex(m_lock);
- /* surface is "key" in map<unsigned int, SurfacePtr>. */
- unsigned int hndl = SafeUIntFromPointer(surface);
- SurfacesHndlMap::const_iterator it = m_surfaces.find(hndl);
- return it != m_surfaces.end() ?
- (*it).second :
- SurfacePtr();
-}
-
-ContextPtr EglDisplay::getContext(EGLContext ctx) const {
- emugl::Mutex::AutoLock mutex(m_lock);
- /* ctx is "key" in map<unsigned int, ContextPtr>. */
- unsigned int hndl = SafeUIntFromPointer(ctx);
- ContextsHndlMap::const_iterator it = m_contexts.find(hndl);
- return it != m_contexts.end() ?
- (*it).second :
- ContextPtr();
-}
-
-bool EglDisplay::removeSurface(EGLSurface s) {
- emugl::Mutex::AutoLock mutex(m_lock);
- /* s is "key" in map<unsigned int, SurfacePtr>. */
- unsigned int hndl = SafeUIntFromPointer(s);
- SurfacesHndlMap::iterator it = m_surfaces.find(hndl);
- if(it != m_surfaces.end()) {
- m_surfaces.erase(it);
- return true;
- }
- return false;
-}
-
-bool EglDisplay::removeContext(EGLContext ctx) {
- emugl::Mutex::AutoLock mutex(m_lock);
- /* ctx is "key" in map<unsigned int, ContextPtr>. */
- unsigned int hndl = SafeUIntFromPointer(ctx);
- 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) {
- emugl::Mutex::AutoLock mutex(m_lock);
-
- ContextsHndlMap::iterator it;
- for(it = m_contexts.begin(); it != m_contexts.end();++it) {
- if((*it).second.get() == ctx.get()){
- break;
- }
- }
- if(it != m_contexts.end()) {
- m_contexts.erase(it);
- return true;
- }
- return false;
-}
-
-EglConfig* EglDisplay::getConfig(EGLint id) const {
- emugl::Mutex::AutoLock mutex(m_lock);
-
- for(ConfigsList::const_iterator it = m_configs.begin();
- it != m_configs.end();
- ++it) {
- if((*it)->id() == id) {
- return it->get();
- }
- }
- return NULL;
-}
-
-int EglDisplay::getConfigs(EGLConfig* configs,int config_size) const {
- emugl::Mutex::AutoLock mutex(m_lock);
- int i = 0;
- for(ConfigsList::const_iterator it = m_configs.begin();
- it != m_configs.end() && i < config_size;
- i++, ++it) {
- configs[i] = static_cast<EGLConfig>(it->get());
- }
- return i;
-}
-
-int EglDisplay::chooseConfigs(const EglConfig& dummy,
- EGLConfig* configs,
- int config_size) const {
- emugl::Mutex::AutoLock mutex(m_lock);
- return doChooseConfigs(dummy, configs, config_size);
-}
-
-int EglDisplay::doChooseConfigs(const EglConfig& dummy,
- EGLConfig* configs,
- int config_size) const {
- int added = 0;
- for(ConfigsList::const_iterator it = m_configs.begin();
- it != m_configs.end() && (added < config_size || !configs);
- ++it) {
- if( (*it)->chosen(dummy)){
- if(configs) {
- configs[added] = static_cast<EGLConfig>(it->get());
- }
- added++;
- }
- }
- //no need to sort since the configurations are saved already in sorted maner
- return added;
-}
-
-EGLSurface EglDisplay::addSurface(SurfacePtr s ) {
- emugl::Mutex::AutoLock mutex(m_lock);
- unsigned int hndl = s.get()->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 ) {
- emugl::Mutex::AutoLock mutex(m_lock);
-
- unsigned int hndl = ctx.get()->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) {
- emugl::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) const {
- emugl::Mutex::AutoLock mutex(m_lock);
- /* img is "key" in map<unsigned int, ImagePtr>. */
- unsigned int hndl = SafeUIntFromPointer(img);
- ImagesHndlMap::const_iterator i( m_eglImages.find(hndl) );
- return (i != m_eglImages.end()) ? (*i).second :ImagePtr();
-}
-
-bool EglDisplay:: destroyImageKHR(EGLImageKHR img) {
- emugl::Mutex::AutoLock mutex(m_lock);
- /* img is "key" in map<unsigned int, ImagePtr>. */
- unsigned int hndl = SafeUIntFromPointer(img);
- ImagesHndlMap::iterator i( m_eglImages.find(hndl) );
- if (i != m_eglImages.end())
- {
- m_eglImages.erase(i);
- return true;
- }
- return false;
-}
-
-EglOS::Context* EglDisplay::getGlobalSharedContext() const {
- emugl::Mutex::AutoLock mutex(m_lock);
-#ifndef _WIN32
- // find an existing OpenGL context to share with, if exist
- EglOS::Context* ret =
- (EglOS::Context*)m_manager[GLES_1_1]->getGlobalContext();
- if (!ret)
- ret = (EglOS::Context*)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.empty()) {
- // Should not happen! config list should be initialized at this point
- return NULL;
- }
- EglConfig *cfg = m_configs.front().get();
- m_globalSharedContext = m_idpy->createContext(
- cfg->nativeFormat(), NULL);
- }
-
- return m_globalSharedContext;
-#endif
-}
-
-// static
-void EglDisplay::addConfig(void* opaque, const EglOS::ConfigInfo* info) {
- EglDisplay* display = static_cast<EglDisplay*>(opaque);
- EglConfig* config = new EglConfig(
- info->red_size,
- info->green_size,
- info->blue_size,
- info->alpha_size,
- info->caveat,
- info->config_id,
- info->depth_size,
- info->frame_buffer_level,
- info->max_pbuffer_width,
- info->max_pbuffer_height,
- info->max_pbuffer_size,
- info->native_renderable,
- info->renderable_type,
- info->native_visual_id,
- info->native_visual_type,
- info->samples_per_pixel,
- info->stencil_size,
- info->surface_type,
- info->transparent_type,
- info->trans_red_val,
- info->trans_green_val,
- info->trans_blue_val,
- info->frmt);
-
- display->m_configs.emplace_back(config);
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglDisplay.h b/distrib/android-emugl/host/libs/Translator/EGL/EglDisplay.h
deleted file mode 100644
index 7759d1cd3..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglDisplay.h
+++ /dev/null
@@ -1,115 +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 <EGL/egl.h>
-#include <EGL/eglext.h>
-#include "emugl/common/mutex.h"
-#include "emugl/common/smart_ptr.h"
-
-#include "EglConfig.h"
-#include "EglContext.h"
-#include "EglOsApi.h"
-#include "EglSurface.h"
-#include "EglWindowSurface.h"
-
-#include <memory>
-#include <unordered_map>
-#include <vector>
-
-typedef std::vector<std::unique_ptr<EglConfig>> ConfigsList;
-typedef std::unordered_map<unsigned int, ContextPtr> ContextsHndlMap;
-typedef std::unordered_map<unsigned int, SurfacePtr> SurfacesHndlMap;
-
-class EglDisplay {
-public:
- // Create new EglDisplay instance from a given native display |dpy|,
- // with matching internal display |idpy|. If |isDefault| is true,
- // this will be considered the default diplay.
- EglDisplay(EGLNativeDisplayType dpy, EglOS::Display* idpy);
-
- // Return the native display handle for this EglDisplay.
- EGLNativeDisplayType getNativeDisplay() const { return m_dpy; }
-
- // Return the native internal display handle for this EglDisplay.
- EglOS::Display* nativeType() const { return m_idpy; }
-
- // Return the number of known configurations for this EglDisplay.
- int nConfigs() const { return m_configs.size(); }
-
- // Write up to |config_size| EGLConfig values into the |configs| array.
- // Return the number if values written.
- int getConfigs(EGLConfig* configs,int config_size) const;
-
- // Select all display configurations that match at least the values
- // in |dummy|. If |configs| is NULL, this returns the number of all
- // matching configs. Otherwise, this writes into |configs| up to
- // |config_size| matching EGLConfig values, and returns their number.
- int chooseConfigs(const EglConfig& dummy,
- EGLConfig* configs,
- int config_size) const;
-
- // Return the EglConfig value that matches a given EGLConfig |conf|.
- EglConfig* getConfig(EGLConfig conf) const;
-
- // Return the EglConfig value that matches a given EGLConfig with
- // EGL_CONFIG_ID value |id|.
- EglConfig* getConfig(EGLint id) const;
-
- EGLSurface addSurface(SurfacePtr s );
- SurfacePtr getSurface(EGLSurface surface) const;
- bool removeSurface(EGLSurface s);
- EGLContext addContext(ContextPtr ctx );
- ContextPtr getContext(EGLContext ctx) const;
- bool removeContext(EGLContext ctx);
- bool removeContext(ContextPtr ctx);
- ObjectNameManager* getManager(GLESVersion ver) const { return m_manager[ver];}
-
- ~EglDisplay();
- void initialize(int renderableType);
- void terminate();
- bool isInitialize();
-
- ImagePtr getImage(EGLImageKHR img) const;
- EGLImageKHR addImageKHR(ImagePtr);
- bool destroyImageKHR(EGLImageKHR img);
- EglOS::Context* getGlobalSharedContext() const;
-
-private:
- static void addConfig(void* opaque, const EglOS::ConfigInfo* configInfo);
-
- int doChooseConfigs(const EglConfig& dummy,EGLConfig* configs,int config_size) const;
- void addSimplePixelFormat(int red_size, int green_size, int blue_size, int alpha_size);
- void addMissingConfigs(void);
- void initConfigurations(int renderableType);
-
- EGLNativeDisplayType m_dpy = {};
- EglOS::Display* m_idpy = nullptr;
- bool m_initialized = false;
- bool m_configInitialized = false;
- ConfigsList m_configs;
- ContextsHndlMap m_contexts;
- SurfacesHndlMap m_surfaces;
- GlobalNameSpace m_globalNameSpace;
- ObjectNameManager* m_manager[MAX_GLES_VERSION];
- mutable emugl::Mutex m_lock;
- ImagesHndlMap m_eglImages;
- unsigned int m_nextEglImageId = 0;
- mutable EglOS::Context* m_globalSharedContext = nullptr;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglGlobalInfo.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglGlobalInfo.cpp
deleted file mode 100644
index 1b8aa7bd6..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglGlobalInfo.cpp
+++ /dev/null
@@ -1,106 +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 "ClientAPIExts.h"
-#include "EglDisplay.h"
-#include "EglOsApi.h"
-
-#include "emugl/common/lazy_instance.h"
-
-#include <string.h>
-
-namespace {
-
-// Use a LazyInstance to ensure thread-safe initialization.
-emugl::LazyInstance<EglGlobalInfo> sSingleton = LAZY_INSTANCE_INIT;
-
-} // namespace
-
-// static
-EglGlobalInfo* EglGlobalInfo::getInstance() {
- return sSingleton.ptr();
-}
-
-EglGlobalInfo::EglGlobalInfo() {
- // TODO(digit): Choose alternate engine based on env. variable?
- m_engine = EglOS::Engine::getHostInstance();
- m_display = m_engine->getDefaultDisplay();
-}
-
-EglGlobalInfo::~EglGlobalInfo() {
- for (size_t n = 0; n < m_displays.size(); ++n) {
- delete m_displays[n];
- }
-}
-
-EglDisplay* EglGlobalInfo::addDisplay(EGLNativeDisplayType dpy,
- EglOS::Display* idpy) {
- //search if it already exists.
- emugl::Mutex::AutoLock mutex(m_lock);
- for (size_t n = 0; n < m_displays.size(); ++n) {
- if (m_displays[n]->getNativeDisplay() == dpy) {
- return m_displays[n];
- }
- }
-
- if (!idpy) {
- return NULL;
- }
- EglDisplay* result = new EglDisplay(dpy, idpy);
- m_displays.push_back(result);
- return result;
-}
-
-bool EglGlobalInfo::removeDisplay(EGLDisplay dpy) {
- emugl::Mutex::AutoLock mutex(m_lock);
- for (size_t n = 0; n < m_displays.size(); ++n) {
- if (m_displays[n] == static_cast<EglDisplay*>(dpy)) {
- delete m_displays[n];
- m_displays.erase(m_displays.begin() + n);
- return true;
- }
- }
- return false;
-}
-
-EglDisplay* EglGlobalInfo::getDisplay(EGLNativeDisplayType dpy) const {
- emugl::Mutex::AutoLock mutex(m_lock);
- for (size_t n = 0; n < m_displays.size(); ++n) {
- if (m_displays[n]->getNativeDisplay() == dpy) {
- return m_displays[n];
- }
- }
- return NULL;
-}
-
-EglDisplay* EglGlobalInfo::getDisplay(EGLDisplay dpy) const {
- emugl::Mutex::AutoLock mutex(m_lock);
- for (size_t n = 0; n < m_displays.size(); ++n) {
- if (m_displays[n] == static_cast<EglDisplay*>(dpy)) {
- return m_displays[n];
- }
- }
- return NULL;
-}
-
-void EglGlobalInfo::initClientExtFuncTable(GLESVersion ver) {
- emugl::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;
- }
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglGlobalInfo.h b/distrib/android-emugl/host/libs/Translator/EGL/EglGlobalInfo.h
deleted file mode 100644
index 5ddc8a849..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglGlobalInfo.h
+++ /dev/null
@@ -1,111 +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 "EglDisplay.h"
-#include "EglConfig.h"
-#include "EglContext.h"
-#include "EglOsApi.h"
-
-#include "emugl/common/lazy_instance.h"
-#include "emugl/common/mutex.h"
-
-#include <GLcommon/TranslatorIfaces.h>
-
-#include <EGL/egl.h>
-
-#include <vector>
-
-class EglDisplay;
-
-// Holds all global information shared by the EGL implementation in a given
-// process. This really amounts to:
-//
-// - A list of EglDisplay instances, each identified by an
-// EGLNativeDisplayType and EglOS::Display*.
-//
-// - GLES interface function pointers for all supported GLES versions.
-
-class EglGlobalInfo {
-
-public:
- // Returns a pointer to the process' single instance, which will be
- // created on demand. This can be called multiple times, each call will
- // increment an internal reference-count.
- static EglGlobalInfo* getInstance();
-
- // Create a new EglDisplay instance from an existing native |dpy| value.
- // |idpy| is the corresponding native internal display type. See
- // generateInternalDisplay() below to understand how they differ.
- EglDisplay* addDisplay(EGLNativeDisplayType dpy,
- EglOS::Display* idpy);
-
- // Return the EglDisplay instance corresponding to a given native |dpy|
- // value.
- EglDisplay* getDisplay(EGLNativeDisplayType dpy) const;
-
- // Return the EglDisplay instance corresponding to a given EGLDisplay |dpy|
- // value. NULL if none matches.
- EglDisplay* getDisplay(EGLDisplay dpy) const;
-
- // Remove a given EGLDisplay identified by |dpy|.
- bool removeDisplay(EGLDisplay dpy);
-
- // Return the default native internal display handle.
- EglOS::Display* getDefaultNativeDisplay() const {
- return m_display;
- };
-
- // Return the default engine handle.
- EglOS::Engine* getOsEngine() const {
- return m_engine;
- }
-
- // Set the GLES interface pointer corresponding to a given GLES version.
- // |iface| is a pointer to a structure containing function pointers
- // related to a specific GLES version.
- // |ver| is a version identifier, e.g. GLES_1_1 or GLES_2_0.
- void setIface(const GLESiface* iface, GLESVersion ver) {
- m_gles_ifaces[ver] = iface;
- };
-
- // Return the current GLES interface pointer for a given GLES version.
- // |ver| is a version identifier, e.g. GLES_1_1 or GLES_2_0.
- const GLESiface* getIface(GLESVersion ver) const {
- return m_gles_ifaces[ver];
- }
-
- // Initialize the table of extension functions for a given GLES version
- // |ver|. This must be called after setIface() for the corresponding
- // version.
- void initClientExtFuncTable(GLESVersion ver);
-
-private:
- EglGlobalInfo();
- ~EglGlobalInfo();
-
- friend emugl::LazyInstance<EglGlobalInfo>;
-
- std::vector<EglDisplay*> m_displays;
- EglOS::Engine* m_engine = nullptr;
- EglOS::Display* m_display = nullptr;
- const GLESiface* m_gles_ifaces[MAX_GLES_VERSION] = {};
- bool m_gles_extFuncs_inited[MAX_GLES_VERSION] = {};
- mutable emugl::Mutex m_lock;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglImp.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglImp.cpp
deleted file mode 100644
index 69b51fa93..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglImp.cpp
+++ /dev/null
@@ -1,1030 +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.
-*/
-#ifdef _WIN32
-#undef EGLAPI
-#define EGLAPI __declspec(dllexport)
-#endif
-
-#include "ThreadInfo.h"
-#include <GLcommon/TranslatorIfaces.h>
-#include "emugl/common/shared_library.h"
-#include <OpenglCodecCommon/ErrorLog.h>
-
-#include "EglWindowSurface.h"
-#include "EglPbufferSurface.h"
-#include "EglGlobalInfo.h"
-#include "EglThreadInfo.h"
-#include "EglValidate.h"
-#include "EglDisplay.h"
-#include "EglContext.h"
-#include "EglConfig.h"
-#include "EglOsApi.h"
-#include "ClientAPIExts.h"
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#define MAJOR 1
-#define MINOR 4
-
-//declarations
-
-EglImage *attachEGLImage(unsigned int imageId);
-void detachEGLImage(unsigned int imageId);
-GLEScontext* getGLESContext();
-GlLibrary* getGlLibrary();
-
-#define tls_thread EglThreadInfo::get()
-
-EglGlobalInfo* g_eglInfo = NULL;
-emugl::Mutex s_eglLock;
-
-void initGlobalInfo()
-{
- emugl::Mutex::AutoLock mutex(s_eglLock);
- if (!g_eglInfo) {
- g_eglInfo = EglGlobalInfo::getInstance();
- }
-}
-
-static const EGLiface s_eglIface = {
- .getGLESContext = getGLESContext,
- .eglAttachEGLImage = attachEGLImage,
- .eglDetachEGLImage = detachEGLImage,
- .eglGetGlLibrary = getGlLibrary,
-};
-
-static void initGLESx(GLESVersion version) {
- const GLESiface* iface = g_eglInfo->getIface(version);
- if (!iface) {
- DBG("EGL failed to initialize GLESv%d; incompatible interface\n", version);
- return;
- }
- iface->initGLESx();
-}
-
-/***************************************** supported extentions ***********************************************************************/
-
-//extentions
-#define EGL_EXTENTIONS 5
-
-//decleration
-extern "C" {
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay display, EGLContext context, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay display, EGLImageKHR image);
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay display, EGLenum type, const EGLint* attribs);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay display, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay display, EGLSyncKHR sync);
-} // extern "C"
-
-// extentions descriptors
-static const ExtentionDescriptor s_eglExtentions[] = {
- {"eglCreateImageKHR" ,
- (__eglMustCastToProperFunctionPointerType)eglCreateImageKHR },
- {"eglDestroyImageKHR",
- (__eglMustCastToProperFunctionPointerType)eglDestroyImageKHR },
- {"eglCreateSyncKHR" ,
- (__eglMustCastToProperFunctionPointerType)eglCreateSyncKHR },
- {"eglClientWaitSyncKHR",
- (__eglMustCastToProperFunctionPointerType)eglClientWaitSyncKHR },
- {"eglDestroySyncKHR",
- (__eglMustCastToProperFunctionPointerType)eglDestroySyncKHR },
-};
-
-static const int s_eglExtentionsSize =
- sizeof(s_eglExtentions) / sizeof(ExtentionDescriptor);
-
-/****************************************************************************************************************************************/
-//macros for accessing global egl info & tls objects
-
-#define CURRENT_THREAD() do {} while (0);
-
-#define RETURN_ERROR(ret,err) \
- CURRENT_THREAD() \
- if(tls_thread->getError() == EGL_SUCCESS) { \
- tls_thread->setError(err); \
- } \
- return ret;
-
-#define VALIDATE_DISPLAY_RETURN(EGLDisplay,ret) \
- EglDisplay* dpy = g_eglInfo->getDisplay(EGLDisplay); \
- if(!dpy){ \
- RETURN_ERROR(ret,EGL_BAD_DISPLAY); \
- } \
- if(!dpy->isInitialize()) { \
- RETURN_ERROR(ret,EGL_NOT_INITIALIZED); \
- }
-
-#define VALIDATE_CONFIG_RETURN(EGLConfig,ret) \
- EglConfig* cfg = dpy->getConfig(EGLConfig); \
- if(!cfg) { \
- RETURN_ERROR(ret,EGL_BAD_CONFIG); \
- }
-
-#define VALIDATE_SURFACE_RETURN(EGLSurface,ret,varName) \
- SurfacePtr varName = dpy->getSurface(EGLSurface); \
- if(!varName.get()) { \
- RETURN_ERROR(ret,EGL_BAD_SURFACE); \
- }
-
-#define VALIDATE_CONTEXT_RETURN(EGLContext,ret) \
- ContextPtr ctx = dpy->getContext(EGLContext); \
- if(!ctx.get()) { \
- RETURN_ERROR(ret,EGL_BAD_CONTEXT); \
- }
-
-
-#define VALIDATE_DISPLAY(EGLDisplay) \
- VALIDATE_DISPLAY_RETURN(EGLDisplay,EGL_FALSE)
-
-#define VALIDATE_CONFIG(EGLConfig) \
- VALIDATE_CONFIG_RETURN(EGLConfig,EGL_FALSE)
-
-#define VALIDATE_SURFACE(EGLSurface,varName) \
- VALIDATE_SURFACE_RETURN(EGLSurface,EGL_FALSE,varName)
-
-#define VALIDATE_CONTEXT(EGLContext) \
- VALIDATE_CONTEXT_RETURN(EGLContext,EGL_FALSE)
-
-
-GLEScontext* getGLESContext()
-{
- ThreadInfo* thread = getThreadInfo();
- return thread->glesContext;
-}
-
-GlLibrary* getGlLibrary() {
- return EglGlobalInfo::getInstance()->getOsEngine()->getGlLibrary();
-}
-
-EGLAPI EGLint EGLAPIENTRY eglGetError(void) {
- CURRENT_THREAD();
- EGLint err = tls_thread->getError();
- tls_thread->setError(EGL_SUCCESS);
- return err;
-}
-
-EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) {
- EglDisplay* dpy = NULL;
- EglOS::Display* internalDisplay = NULL;
-
- initGlobalInfo();
-
- if ((dpy = g_eglInfo->getDisplay(display_id))) {
- return dpy;
- }
- if (display_id != EGL_DEFAULT_DISPLAY) {
- return EGL_NO_DISPLAY;
- }
- internalDisplay = g_eglInfo->getDefaultNativeDisplay();
- dpy = g_eglInfo->addDisplay(display_id,internalDisplay);
- if(!dpy) {
- return EGL_NO_DISPLAY;
- }
- return dpy;
-}
-
-
-#define TRANSLATOR_GETIFACE_NAME "__translator_getIfaces"
-
-static __translator_getGLESIfaceFunc loadIfaces(const char* libName,
- char* error,
- size_t errorSize) {
- emugl::SharedLibrary* libGLES = emugl::SharedLibrary::open(
- libName, error, errorSize);
- if (!libGLES) {
- return NULL;
- }
- __translator_getGLESIfaceFunc func = (__translator_getGLESIfaceFunc)
- libGLES->findSymbol(TRANSLATOR_GETIFACE_NAME);
- if (!func) {
- snprintf(error, errorSize, "Missing symbol %s",
- TRANSLATOR_GETIFACE_NAME);
- return NULL;
- }
- return func;
-}
-
-#define LIB_GLES_CM_NAME EMUGL_LIBNAME("GLES_CM_translator")
-#define LIB_GLES_V2_NAME EMUGL_LIBNAME("GLES_V2_translator")
-
-EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay display, EGLint *major, EGLint *minor) {
-
- initGlobalInfo();
-
- EglDisplay* dpy = g_eglInfo->getDisplay(display);
- if(!dpy) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_DISPLAY);
- }
-
- if(major) *major = MAJOR;
- if(minor) *minor = MINOR;
-
- __translator_getGLESIfaceFunc func = NULL;
- int renderableType = EGL_OPENGL_ES_BIT;
-
- char error[256];
- if(!g_eglInfo->getIface(GLES_1_1)) {
- func = loadIfaces(LIB_GLES_CM_NAME, error, sizeof(error));
- if (func) {
- g_eglInfo->setIface(func(&s_eglIface),GLES_1_1);
- } else {
- fprintf(stderr, "%s: Could not find ifaces for GLES CM 1.1 [%s]\n",
- __FUNCTION__, error);
- return EGL_FALSE;
- }
- initGLESx(GLES_1_1);
- }
- if(!g_eglInfo->getIface(GLES_2_0)) {
- func = loadIfaces(LIB_GLES_V2_NAME, error, sizeof(error));
- if (func) {
- renderableType |= EGL_OPENGL_ES2_BIT;
- g_eglInfo->setIface(func(&s_eglIface),GLES_2_0);
- } else {
- fprintf(stderr, "%s: Could not find ifaces for GLES 2.0 [%s]\n",
- __FUNCTION__, error);
- }
- initGLESx(GLES_2_0);
- }
- dpy->initialize(renderableType);
- return EGL_TRUE;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay display) {
- VALIDATE_DISPLAY(display);
- dpy->terminate();
- return EGL_TRUE;
-}
-
-EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay display, EGLint name) {
- VALIDATE_DISPLAY(display);
- static const char* vendor = "Google";
- static const char* version = "1.4";
- static const char* extensions = "EGL_KHR_image_base EGL_KHR_gl_texture_2D_image";
- if(!EglValidate::stringName(name)) {
- RETURN_ERROR(NULL,EGL_BAD_PARAMETER);
- }
- switch(name) {
- case EGL_VENDOR:
- return vendor;
- case EGL_VERSION:
- return version;
- case EGL_EXTENSIONS:
- return extensions;
- }
- return NULL;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay display, EGLConfig *configs,
- EGLint config_size, EGLint *num_config) {
- VALIDATE_DISPLAY(display);
- if(!num_config) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_PARAMETER);
- }
-
- if(configs == NULL) {
- *num_config = dpy->nConfigs();
- } else {
- *num_config = dpy->getConfigs(configs,config_size);
- }
-
- return EGL_TRUE;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay display, const EGLint *attrib_list,
- EGLConfig *configs, EGLint config_size,
- EGLint *num_config) {
- VALIDATE_DISPLAY(display);
- if(!num_config) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_PARAMETER);
- }
-
- //selection defaults
- // NOTE: Some variables below are commented out to reduce compiler warnings.
- // TODO(digit): Look if these variables are really needed or not, and if so
- // fix the code to do it properly.
- EGLint surface_type = EGL_WINDOW_BIT;
- EGLint renderable_type = EGL_OPENGL_ES_BIT;
- //EGLBoolean bind_to_tex_rgb = EGL_DONT_CARE;
- //EGLBoolean bind_to_tex_rgba = EGL_DONT_CARE;
- EGLenum caveat = EGL_DONT_CARE;
- EGLint config_id = EGL_DONT_CARE;
- EGLBoolean native_renderable = EGL_DONT_CARE;
- EGLint native_visual_type = EGL_DONT_CARE;
- //EGLint max_swap_interval = EGL_DONT_CARE;
- //EGLint min_swap_interval = EGL_DONT_CARE;
- EGLint trans_red_val = EGL_DONT_CARE;
- EGLint trans_green_val = EGL_DONT_CARE;
- EGLint trans_blue_val = EGL_DONT_CARE;
- EGLenum transparent_type = EGL_NONE;
- //EGLint buffer_size = 0;
- EGLint red_size = 0;
- EGLint green_size = 0;
- EGLint blue_size = 0;
- EGLint alpha_size = 0;
- EGLint depth_size = 0;
- EGLint frame_buffer_level = 0;
- //EGLint sample_buffers_num = 0;
- EGLint samples_per_pixel = 0;
- EGLint stencil_size = 0;
-
- if(!EglValidate::noAttribs(attrib_list)) { //there are attribs
- int i = 0 ;
- bool hasConfigId = false;
- while(attrib_list[i] != EGL_NONE && !hasConfigId) {
- switch(attrib_list[i]) {
- case EGL_MAX_PBUFFER_WIDTH:
- case EGL_MAX_PBUFFER_HEIGHT:
- case EGL_MAX_PBUFFER_PIXELS:
- case EGL_NATIVE_VISUAL_ID:
- break; //we dont care from those selection crateria
- case EGL_LEVEL:
- if(attrib_list[i+1] == EGL_DONT_CARE) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- frame_buffer_level = attrib_list[i+1];
- break;
- case EGL_BUFFER_SIZE:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- //buffer_size = attrib_list[i+1];
- break;
- case EGL_RED_SIZE:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- red_size = attrib_list[i+1];
- break;
- case EGL_GREEN_SIZE:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- green_size = attrib_list[i+1];
- break;
- case EGL_BLUE_SIZE:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- blue_size = attrib_list[i+1];
- break;
- case EGL_ALPHA_SIZE:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- alpha_size = attrib_list[i+1];
- break;
- case EGL_BIND_TO_TEXTURE_RGB:
- //bind_to_tex_rgb = attrib_list[i+1];
- break;
- case EGL_BIND_TO_TEXTURE_RGBA:
- //bind_to_tex_rgba = attrib_list[i+1];
- break;
- case EGL_CONFIG_CAVEAT:
- if(attrib_list[i+1] != EGL_NONE && attrib_list[i+1] != EGL_SLOW_CONFIG && attrib_list[i+1] != EGL_NON_CONFORMANT_CONFIG) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- caveat = attrib_list[i+1];
- break;
- case EGL_CONFIG_ID:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- config_id = attrib_list[i+1];
- hasConfigId = true;
- break;
- case EGL_DEPTH_SIZE:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- depth_size = attrib_list[i+1];
- break;
- case EGL_MAX_SWAP_INTERVAL:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- //max_swap_interval = attrib_list[i+1];
- break;
- case EGL_MIN_SWAP_INTERVAL:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- //min_swap_interval = attrib_list[i+1];
- break;
- case EGL_NATIVE_RENDERABLE:
- native_renderable = attrib_list[i+1];
- break;
- case EGL_RENDERABLE_TYPE:
- renderable_type = attrib_list[i+1];
- break;
- case EGL_NATIVE_VISUAL_TYPE:
- native_visual_type = attrib_list[i+1];
- break;
- if(attrib_list[i+1] < 0 || attrib_list[i+1] > 1 ) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- case EGL_SAMPLE_BUFFERS:
- //sample_buffers_num = attrib_list[i+1];
- break;
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- case EGL_SAMPLES:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- samples_per_pixel = attrib_list[i+1];
- break;
- case EGL_STENCIL_SIZE:
- if(attrib_list[i+1] < 0) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- stencil_size = attrib_list[i+1];
- break;
- case EGL_SURFACE_TYPE:
- surface_type = attrib_list[i+1];
- break;
- case EGL_TRANSPARENT_TYPE:
- if(attrib_list[i+1] != EGL_NONE && attrib_list[i+1] != EGL_TRANSPARENT_RGB ) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- transparent_type = attrib_list[i+1];
- break;
- case EGL_TRANSPARENT_RED_VALUE:
- trans_red_val = attrib_list[i+1];
- break;
- case EGL_TRANSPARENT_GREEN_VALUE:
- trans_green_val = attrib_list[i+1];
- break;
- case EGL_TRANSPARENT_BLUE_VALUE:
- trans_blue_val = attrib_list[i+1];
- break;
- default:
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- i+=2;
- }
- if(hasConfigId) {
- EglConfig* pConfig = dpy->getConfig(config_id);
- if(pConfig) {
- if(configs) {
- configs[0] = static_cast<EGLConfig>(pConfig);
- }
- *num_config = 1;
- return EGL_TRUE;
- } else {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- }
- }
- EglConfig dummy(red_size,green_size,blue_size,alpha_size,caveat,config_id,depth_size,
- frame_buffer_level,0,0,0,native_renderable,renderable_type,0,native_visual_type,
- samples_per_pixel,stencil_size,surface_type,transparent_type,
- trans_red_val,trans_green_val,trans_blue_val,NULL);
-
- *num_config = dpy->chooseConfigs(dummy,configs,config_size);
-
-
- return EGL_TRUE;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay display, EGLConfig config,
- EGLint attribute, EGLint *value) {
- VALIDATE_DISPLAY(display);
- VALIDATE_CONFIG(config);
- if(!EglValidate::confAttrib(attribute)){
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- return cfg->getConfAttrib(attribute,value)? EGL_TRUE:EGL_FALSE;
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay display, EGLConfig config,
- EGLNativeWindowType win,
- const EGLint *attrib_list) {
- VALIDATE_DISPLAY_RETURN(display,EGL_NO_SURFACE);
- VALIDATE_CONFIG_RETURN(config,EGL_NO_SURFACE);
-
- if(!(cfg->surfaceType() & EGL_WINDOW_BIT)) {
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_MATCH);
- }
- if(!dpy->nativeType()->isValidNativeWin(win)) {
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_NATIVE_WINDOW);
- }
- if(!EglValidate::noAttribs(attrib_list)) {
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_ATTRIBUTE);
- }
- if(EglWindowSurface::alreadyAssociatedWithConfig(win)) {
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_ALLOC);
- }
-
- unsigned int width,height;
- if(!dpy->nativeType()->checkWindowPixelFormatMatch(
- win, cfg->nativeFormat(), &width, &height)) {
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_ALLOC);
- }
- SurfacePtr wSurface(new EglWindowSurface(dpy, win,cfg,width,height));
- if(!wSurface.get()) {
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_ALLOC);
- }
- return dpy->addSurface(wSurface);
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(
- EGLDisplay display,
- EGLConfig config,
- const EGLint *attrib_list) {
- VALIDATE_DISPLAY_RETURN(display,EGL_NO_SURFACE);
- VALIDATE_CONFIG_RETURN(config,EGL_NO_SURFACE);
- if(!(cfg->surfaceType() & EGL_PBUFFER_BIT)) {
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_MATCH);
- }
-
- SurfacePtr pbSurface(new EglPbufferSurface(dpy,cfg));
- if(!pbSurface.get()) {
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_ALLOC);
- }
-
- if(!EglValidate::noAttribs(attrib_list)) { // There are attribs.
- int i = 0 ;
- while(attrib_list[i] != EGL_NONE) {
- if(!pbSurface->setAttrib(attrib_list[i],attrib_list[i+1])) {
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_ATTRIBUTE);
- }
- i+=2;
- }
- }
-
- EGLint width, height, largest, texTarget, texFormat;
- EglPbufferSurface* tmpPbSurfacePtr =
- static_cast<EglPbufferSurface*>(pbSurface.get());
-
- tmpPbSurfacePtr->getDim(&width, &height, &largest);
- tmpPbSurfacePtr->getTexInfo(&texTarget, &texFormat);
-
- if(!EglValidate::pbufferAttribs(width,
- height,
- texFormat == EGL_NO_TEXTURE,
- texTarget == EGL_NO_TEXTURE)) {
- //TODO: RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_VALUE); dont have bad_value
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_ATTRIBUTE);
- }
-
- EglOS::PbufferInfo pbinfo;
-
- pbinfo.width = width;
- pbinfo.height = height;
- pbinfo.largest = largest;
- pbinfo.target = texTarget;
- pbinfo.format = texFormat;
-
- tmpPbSurfacePtr->getAttrib(EGL_MIPMAP_TEXTURE, &pbinfo.hasMipmap);
-
- EglOS::Surface* pb = dpy->nativeType()->createPbufferSurface(
- cfg->nativeFormat(), &pbinfo);
- if(!pb) {
- //TODO: RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_VALUE); dont have bad value
- RETURN_ERROR(EGL_NO_SURFACE,EGL_BAD_ATTRIBUTE);
- }
-
- tmpPbSurfacePtr->setNativePbuffer(pb);
- return dpy->addSurface(pbSurface);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay display, EGLSurface surface) {
- VALIDATE_DISPLAY(display);
- SurfacePtr srfc = dpy->getSurface(surface);
- if(!srfc.get()) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_SURFACE);
- }
-
- dpy->removeSurface(surface);
- return EGL_TRUE;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay display, EGLSurface surface,
- EGLint attribute, EGLint *value) {
- VALIDATE_DISPLAY(display);
- VALIDATE_SURFACE(surface,srfc);
-
- if(!srfc->getAttrib(attribute,value)) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- return EGL_TRUE;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay display, EGLSurface surface,
- EGLint attribute, EGLint value) {
- VALIDATE_DISPLAY(display);
- VALIDATE_SURFACE(surface,srfc);
- if(!srfc->setAttrib(attribute,value)) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- return EGL_TRUE;
-}
-
-EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay display, EGLConfig config,
- EGLContext share_context,
- const EGLint *attrib_list) {
- VALIDATE_DISPLAY_RETURN(display,EGL_NO_CONTEXT);
- VALIDATE_CONFIG_RETURN(config,EGL_NO_CONTEXT);
-
- GLESVersion version = GLES_1_1;
- if(!EglValidate::noAttribs(attrib_list)) {
- int i = 0;
- while(attrib_list[i] != EGL_NONE) {
- switch(attrib_list[i]) {
- case EGL_CONTEXT_CLIENT_VERSION:
- if(attrib_list[i+1] == 2) {
- version = GLES_2_0;
- } else {
- version = GLES_1_1;
- }
- break;
- default:
- RETURN_ERROR(EGL_NO_CONTEXT,EGL_BAD_ATTRIBUTE);
- }
- i+=2;
- }
- }
- const GLESiface* iface = g_eglInfo->getIface(version);
- GLEScontext* glesCtx = NULL;
- if(iface) {
- glesCtx = iface->createGLESContext();
- } else { // there is no interface for this gles version
- RETURN_ERROR(EGL_NO_CONTEXT,EGL_BAD_ATTRIBUTE);
- }
-
- ContextPtr sharedCtxPtr;
- if(share_context != EGL_NO_CONTEXT) {
- sharedCtxPtr = dpy->getContext(share_context);
- if(!sharedCtxPtr.get()) {
- RETURN_ERROR(EGL_NO_CONTEXT,EGL_BAD_CONTEXT);
- }
- }
-
- EglOS::Context* globalSharedContext = dpy->getGlobalSharedContext();
- EglOS::Context* nativeContext = dpy->nativeType()->createContext(
- cfg->nativeFormat(), globalSharedContext);
-
- if(nativeContext) {
- ContextPtr ctx(new EglContext(dpy, nativeContext,sharedCtxPtr,cfg,glesCtx,version,dpy->getManager(version)));
- return dpy->addContext(ctx);
- } else {
- iface->deleteGLESContext(glesCtx);
- }
-
-return EGL_NO_CONTEXT;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay display, EGLContext context) {
- VALIDATE_DISPLAY(display);
- VALIDATE_CONTEXT(context);
-
- dpy->removeContext(context);
- return EGL_TRUE;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay display,
- EGLSurface draw,
- EGLSurface read,
- EGLContext context) {
- VALIDATE_DISPLAY(display);
-
- bool releaseContext = EglValidate::releaseContext(context, read, draw);
- if(!releaseContext && EglValidate::badContextMatch(context, read, draw)) {
- RETURN_ERROR(EGL_FALSE, EGL_BAD_MATCH);
- }
-
- ThreadInfo* thread = getThreadInfo();
- ContextPtr prevCtx = thread->eglContext;
-
- if(releaseContext) { //releasing current context
- if(prevCtx.get()) {
- g_eglInfo->getIface(prevCtx->version())->flush();
- if(!dpy->nativeType()->makeCurrent(NULL,NULL,NULL)) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ACCESS);
- }
- thread->updateInfo(ContextPtr(),dpy,NULL,ShareGroupPtr(),dpy->getManager(prevCtx->version()));
- }
- } else { //assining new context
- VALIDATE_CONTEXT(context);
- VALIDATE_SURFACE(draw,newDrawSrfc);
- VALIDATE_SURFACE(read,newReadSrfc);
-
- EglSurface* newDrawPtr = newDrawSrfc.get();
- EglSurface* newReadPtr = newReadSrfc.get();
- ContextPtr newCtx = ctx;
-
- if (newCtx.get() && prevCtx.get()) {
- if (newCtx.get() == prevCtx.get()) {
- if (newDrawPtr == prevCtx->draw().get() &&
- newReadPtr == prevCtx->read().get()) {
- // nothing to do
- return EGL_TRUE;
- }
- }
- else {
- // Make sure previous context is detached from surfaces
- releaseContext = true;
- }
- }
-
- //surfaces compatibility check
- if(!((*ctx->getConfig()).compatibleWith((*newDrawPtr->getConfig()))) ||
- !((*ctx->getConfig()).compatibleWith((*newReadPtr->getConfig())))) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_MATCH);
- }
-
- EglOS::Display* nativeDisplay = dpy->nativeType();
- EglOS::Surface* nativeRead = newReadPtr->native();
- EglOS::Surface* nativeDraw = newDrawPtr->native();
- //checking native window validity
- if(newReadPtr->type() == EglSurface::WINDOW &&
- !nativeDisplay->isValidNativeWin(nativeRead)) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_NATIVE_WINDOW);
- }
- if(newDrawPtr->type() == EglSurface::WINDOW &&
- !nativeDisplay->isValidNativeWin(nativeDraw)) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_NATIVE_WINDOW);
- }
-
- if(prevCtx.get()) {
- g_eglInfo->getIface(prevCtx->version())->flush();
- }
- if (!dpy->nativeType()->makeCurrent(
- newReadPtr->native(),
- newDrawPtr->native(),
- newCtx->nativeType())) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ACCESS);
- }
- //TODO: handle the following errors
- // EGL_BAD_CURRENT_SURFACE , EGL_CONTEXT_LOST , EGL_BAD_ACCESS
-
- thread->updateInfo(newCtx,dpy,newCtx->getGlesContext(),newCtx->getShareGroup(),dpy->getManager(newCtx->version()));
- newCtx->setSurfaces(newReadSrfc,newDrawSrfc);
- g_eglInfo->getIface(newCtx->version())->initContext(newCtx->getGlesContext(),newCtx->getShareGroup());
-
- // Initialize the GLES extension function table used in
- // eglGetProcAddress for the context's GLES version if not
- // yet initialized. We initialize it here to make sure we call the
- // GLES getProcAddress after when a context is bound.
- g_eglInfo->initClientExtFuncTable(newCtx->version());
- }
-
- // release previous context surface binding
- if(prevCtx.get() && releaseContext) {
- prevCtx->setSurfaces(SurfacePtr(),SurfacePtr());
- }
-
- return EGL_TRUE;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay display, EGLContext context,
- EGLint attribute, EGLint *value) {
- VALIDATE_DISPLAY(display);
- VALIDATE_CONTEXT(context);
-
- if(!ctx->getAttrib(attribute,value)){
- RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE);
- }
- return EGL_TRUE;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay display, EGLSurface surface) {
- VALIDATE_DISPLAY(display);
- VALIDATE_SURFACE(surface,Srfc);
- ThreadInfo* thread = getThreadInfo();
- ContextPtr currentCtx = thread->eglContext;
-
-
- //if surface not window return
- if(Srfc->type() != EglSurface::WINDOW){
- RETURN_ERROR(EGL_TRUE,EGL_SUCCESS);
- }
-
- if(!currentCtx.get() || !currentCtx->usingSurface(Srfc) ||
- !dpy->nativeType()->isValidNativeWin(Srfc.get()->native())) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_SURFACE);
- }
-
- dpy->nativeType()->swapBuffers(Srfc->native());
- return EGL_TRUE;
-}
-
-EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void) {
- ThreadInfo* thread = getThreadInfo();
- EglDisplay* dpy = static_cast<EglDisplay*>(thread->eglDisplay);
- ContextPtr ctx = thread->eglContext;
- if(dpy && ctx.get()){
- // This double check is required because a context might still be current after it is destroyed - in which case
- // its handle should be invalid, that is EGL_NO_CONTEXT should be returned even though the context is current
- EGLContext c = (EGLContext)SafePointerFromUInt(ctx->getHndl());
- if(dpy->getContext(c).get())
- {
- return c;
- }
- }
- return EGL_NO_CONTEXT;
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) {
- if (!EglValidate::surfaceTarget(readdraw)) {
- return EGL_NO_SURFACE;
- }
-
- ThreadInfo* thread = getThreadInfo();
- EglDisplay* dpy = static_cast<EglDisplay*>(thread->eglDisplay);
- ContextPtr ctx = thread->eglContext;
-
- if(dpy && ctx.get()) {
- SurfacePtr surface = readdraw == EGL_READ ? ctx->read() : ctx->draw();
- if(surface.get())
- {
- // This double check is required because a surface might still be
- // current after it is destroyed - in which case its handle should
- // be invalid, that is EGL_NO_SURFACE should be returned even
- // though the surface is current.
- EGLSurface s = (EGLSurface)SafePointerFromUInt(surface->getHndl());
- surface = dpy->getSurface(s);
- if(surface.get())
- {
- return s;
- }
- }
- }
- return EGL_NO_SURFACE;
-}
-
-EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void) {
- ThreadInfo* thread = getThreadInfo();
- return (thread->eglContext.get()) ? thread->eglDisplay : EGL_NO_DISPLAY;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api) {
- if(!EglValidate::supportedApi(api)) {
- RETURN_ERROR(EGL_FALSE,EGL_BAD_PARAMETER);
- }
- CURRENT_THREAD();
- tls_thread->setApi(api);
- return EGL_TRUE;
-}
-
-EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void) {
- CURRENT_THREAD();
- return tls_thread->getApi();
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void) {
- ThreadInfo* thread = getThreadInfo();
- EglDisplay* dpy = static_cast<EglDisplay*>(thread->eglDisplay);
- return eglMakeCurrent(dpy,EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT);
-}
-
-EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
- eglGetProcAddress(const char *procname){
- __eglMustCastToProperFunctionPointerType retVal = NULL;
-
- initGlobalInfo();
-
- if(!strncmp(procname,"egl",3)) { //EGL proc
- for(int i=0;i < s_eglExtentionsSize;i++){
- if(strcmp(procname,s_eglExtentions[i].name) == 0){
- retVal = s_eglExtentions[i].address;
- break;
- }
- }
- }
- else {
- // Look at the clientAPI (GLES) supported extension
- // function table.
- retVal = ClientAPIExts::getProcAddress(procname);
- }
- return retVal;
-}
-
-/************************** KHR IMAGE *************************************************************/
-EglImage *attachEGLImage(unsigned int imageId)
-{
- ThreadInfo* thread = getThreadInfo();
- EglDisplay* dpy = static_cast<EglDisplay*>(thread->eglDisplay);
- ContextPtr ctx = thread->eglContext;
- if (ctx.get()) {
- ImagePtr img = dpy->getImage(reinterpret_cast<EGLImageKHR>(imageId));
- if(img.get()) {
- ctx->attachImage(imageId,img);
- return img.get();
- }
- }
- return NULL;
-}
-
-void detachEGLImage(unsigned int imageId)
-{
- ThreadInfo* thread = getThreadInfo();
- ContextPtr ctx = thread->eglContext;
- if (ctx.get()) {
- ctx->detachImage(imageId);
- }
-}
-
-
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay display, EGLContext context, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
-{
- VALIDATE_DISPLAY(display);
- VALIDATE_CONTEXT(context);
-
- // We only support EGL_GL_TEXTURE_2D images
- if (target != EGL_GL_TEXTURE_2D_KHR) {
- RETURN_ERROR(EGL_NO_IMAGE_KHR,EGL_BAD_PARAMETER);
- }
-
- ThreadInfo* thread = getThreadInfo();
- ShareGroupPtr sg = thread->shareGroup;
- if (sg.get() != NULL) {
- unsigned int globalTexName = sg->getGlobalName(TEXTURE, SafeUIntFromPointer(buffer));
- if (!globalTexName) return EGL_NO_IMAGE_KHR;
-
- ImagePtr img( new EglImage() );
- if (img.get() != NULL) {
-
- ObjectDataPtr objData = sg->getObjectData(TEXTURE, SafeUIntFromPointer(buffer));
- if (!objData.get()) return EGL_NO_IMAGE_KHR;
-
- TextureData *texData = (TextureData *)objData.get();
- if(!texData->width || !texData->height) return EGL_NO_IMAGE_KHR;
- img->width = texData->width;
- img->height = texData->height;
- img->border = texData->border;
- img->internalFormat = texData->internalFormat;
- img->globalTexName = globalTexName;
- return dpy->addImageKHR(img);
- }
- }
-
- return EGL_NO_IMAGE_KHR;
-}
-
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay display, EGLImageKHR image)
-{
- VALIDATE_DISPLAY(display);
- return dpy->destroyImageKHR(image) ? EGL_TRUE:EGL_FALSE;
-}
-
-
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint* attrib_list) {
-
- const GLESiface* iface = g_eglInfo->getIface(GLES_2_0);
- GLsync res = iface->fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
- return (EGLSyncKHR)res;
-}
-
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) {
-
- const GLESiface* iface = g_eglInfo->getIface(GLES_2_0);
- GLenum gl_wait_result =
- iface->clientWaitSync((GLsync)sync, GL_SYNC_FLUSH_COMMANDS_BIT, timeout);
- EGLint egl_wait_result;
-
- switch (gl_wait_result) {
- case GL_ALREADY_SIGNALED:
- case GL_CONDITION_SATISFIED:
- egl_wait_result = EGL_CONDITION_SATISFIED_KHR;
- break;
- case GL_TIMEOUT_EXPIRED:
- egl_wait_result = EGL_TIMEOUT_EXPIRED_KHR;
- break;
- case GL_WAIT_FAILED:
- egl_wait_result = EGL_FALSE;
- break;
- default:
- egl_wait_result = EGL_CONDITION_SATISFIED_KHR;
- }
- return egl_wait_result;
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) {
-
- const GLESiface* iface = g_eglInfo->getIface(GLES_2_0);
- iface->deleteSync((GLsync)sync);
- return EGL_TRUE;
-}
-
-/*********************************************************************************/
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglMacApi.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglMacApi.cpp
deleted file mode 100644
index eeaa25c3e..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglMacApi.cpp
+++ /dev/null
@@ -1,244 +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);
- /* All configs can end up having an alpha channel even if none was requested.
- * The default config chooser in GLSurfaceView will therefore not find any
- * matching config. Thus, make sure alpha is zero (or at least signalled as
- * zero to the calling EGL layer) for the configs where it was intended to
- * be zero. */
- if (getPixelFormatDefinitionAlpha(index) == 0)
- alpha = 0;
- else
- 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 validNativeDisplay(EGLNativeInternalDisplayType dpy) {
- return true;
-}
-
-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;
- GLenum glTexFormat = GL_RGBA, glTexTarget = GL_TEXTURE_2D;
- srfc->getDim(&width,&height,&tmp);
- srfc->getTexInfo(&format,&target);
- switch (format) {
- case EGL_TEXTURE_RGB:
- glTexFormat = GL_RGB;
- break;
- case EGL_TEXTURE_RGBA:
- glTexFormat = GL_RGBA;
- break;
- }
- srfc->getAttrib(EGL_MIPMAP_TEXTURE,&hasMipmap);
- EGLint maxMipmap = hasMipmap ? MAX_PBUFFER_MIPMAP_LEVEL:0;
- return (EGLNativeSurfaceType)nsCreatePBuffer(glTexTarget,glTexFormat,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){
-}
-
-};
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglOsApi.h b/distrib/android-emugl/host/libs/Translator/EGL/EglOsApi.h
deleted file mode 100644
index 942c705d4..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglOsApi.h
+++ /dev/null
@@ -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_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 validNativeDisplay(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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglPbufferSurface.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglPbufferSurface.cpp
deleted file mode 100644
index 8bcb31a71..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglPbufferSurface.cpp
+++ /dev/null
@@ -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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglPbufferSurface.h b/distrib/android-emugl/host/libs/Translator/EGL/EglPbufferSurface.h
deleted file mode 100644
index 9740170a5..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglPbufferSurface.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglPixmapSurface.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglPixmapSurface.cpp
deleted file mode 100644
index 208759424..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglPixmapSurface.cpp
+++ /dev/null
@@ -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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglPixmapSurface.h b/distrib/android-emugl/host/libs/Translator/EGL/EglPixmapSurface.h
deleted file mode 100644
index f027eabf4..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglPixmapSurface.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglSurface.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglSurface.cpp
deleted file mode 100644
index 7f658b6cb..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglSurface.cpp
+++ /dev/null
@@ -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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglSurface.h b/distrib/android-emugl/host/libs/Translator/EGL/EglSurface.h
deleted file mode 100644
index 51a6c61e8..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglSurface.h
+++ /dev/null
@@ -1,86 +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 "EglConfig.h"
-#include "EglOsApi.h"
-
-#include "emugl/common/smart_ptr.h"
-
-#include <EGL/egl.h>
-
-class EglSurface;
-typedef emugl::SmartPtr<EglSurface> SurfacePtr;
-
-class EglDisplay;
-
-class EglSurface {
-public:
- typedef enum {
- WINDOW = 0,
- PBUFFER = 1,
- PIXMAP = 3
- } ESurfaceType;
-
- ESurfaceType type() const { return m_type; }
-
- EglOS::Surface* native() const { 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() const { return m_config; }
-
- unsigned int getHndl() const { return m_hndl; }
-
- virtual ~EglSurface();
-
-private:
- static unsigned int s_nextSurfaceHndl;
-
- ESurfaceType m_type = WINDOW;
- unsigned int m_hndl = 0;
-
-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_dpy(dpy)
- {
- m_hndl = ++s_nextSurfaceHndl;
- }
-
-protected:
- EglConfig* m_config = nullptr;
- EGLint m_width = 0;
- EGLint m_height = 0;
- EglOS::Surface* m_native = nullptr;
- EglDisplay* m_dpy = nullptr;
-};
-
-#endif // EGL_SURFACE_H
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglThreadInfo.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglThreadInfo.cpp
deleted file mode 100644
index 6481774ac..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglThreadInfo.cpp
+++ /dev/null
@@ -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.
-*/
-#include "EglThreadInfo.h"
-#include "EglOsApi.h"
-
-#include "emugl/common/lazy_instance.h"
-#include "emugl/common/thread_store.h"
-
-namespace {
-
-class EglThreadInfoStore : public emugl::ThreadStore {
-public:
- EglThreadInfoStore() : emugl::ThreadStore(&destructor) {}
-private:
- static void destructor(void* value) {
- delete static_cast<EglThreadInfo*>(value);
- }
-};
-
-} // namespace
-
-EglThreadInfo::EglThreadInfo() :
- m_err(EGL_SUCCESS), m_api(EGL_OPENGL_ES_API) {}
-
-static emugl::LazyInstance<EglThreadInfoStore> s_tls = LAZY_INSTANCE_INIT;
-
-EglThreadInfo* EglThreadInfo::get(void)
-{
- EglThreadInfo *ti = static_cast<EglThreadInfo*>(s_tls->get());
- if (!ti) {
- ti = new EglThreadInfo();
- s_tls->set(ti);
- }
- return ti;
-}
-
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglThreadInfo.h b/distrib/android-emugl/host/libs/Translator/EGL/EglThreadInfo.h
deleted file mode 100644
index 9d2df102a..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglThreadInfo.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglValidate.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglValidate.cpp
deleted file mode 100644
index d87f9b9b0..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglValidate.cpp
+++ /dev/null
@@ -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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglValidate.h b/distrib/android-emugl/host/libs/Translator/EGL/EglValidate.h
deleted file mode 100644
index 532584f08..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglValidate.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglWindowSurface.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglWindowSurface.cpp
deleted file mode 100644
index 7bff8961a..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglWindowSurface.cpp
+++ /dev/null
@@ -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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglWindowSurface.h b/distrib/android-emugl/host/libs/Translator/EGL/EglWindowSurface.h
deleted file mode 100644
index 460a29355..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglWindowSurface.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglWindowsApi.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglWindowsApi.cpp
deleted file mode 100644
index 5b48fcbdf..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglWindowsApi.cpp
+++ /dev/null
@@ -1,594 +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 NULL;
-
-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:
- 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
-
- 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 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 maxFormat = DescribePixelFormat(dpy, iPixelFormat,sizeof(PIXELFORMATDESCRIPTOR), &pfd);
-
- //inserting rest of formats
- for(;iPixelFormat <= maxFormat; iPixelFormat++) {
- DescribePixelFormat(dpy, iPixelFormat,sizeof(PIXELFORMATDESCRIPTOR), &pfd);
- EglConfig* pConfig = pixelFormatToConfig(display,renderableType,&pfd,iPixelFormat);
- if(pConfig) listOut.push_back(pConfig);
- }
-}
-
-bool validNativeDisplay(EGLNativeInternalDisplayType dpy) {
- return dpy != NULL;
-}
-
-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) {
- 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())){
- 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)) {
- 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())) {
- 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;
-}
-
-
-};
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/EglX11Api.cpp b/distrib/android-emugl/host/libs/Translator/EGL/EglX11Api.cpp
deleted file mode 100644
index 41cf8c4ac..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/EglX11Api.cpp
+++ /dev/null
@@ -1,314 +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 "emugl/common/mutex.h"
-
-#include <string.h>
-#include <X11/Xlib.h>
-#include <GL/glx.h>
-
-
-class ErrorHandler{
-public:
-ErrorHandler(EGLNativeDisplayType dpy);
-~ErrorHandler();
-int getLastError(){ return s_lastErrorCode;};
-
-private:
-static int s_lastErrorCode;
-int (*m_oldErrorHandler) (Display *, XErrorEvent *);
-static emugl::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;
-emugl::Mutex ErrorHandler::s_lock;
-
-ErrorHandler::ErrorHandler(EGLNativeDisplayType dpy){
- emugl::Mutex::AutoLock mutex(s_lock);
- XSync(dpy,False);
- s_lastErrorCode = 0;
- m_oldErrorHandler = XSetErrorHandler(errorHandlerProc);
-}
-
-ErrorHandler::~ErrorHandler(){
- emugl::Mutex::AutoLock mutex(s_lock);
- XSetErrorHandler(m_oldErrorHandler);
- s_lastErrorCode = 0;
-}
-
-int ErrorHandler::errorHandlerProc(EGLNativeDisplayType dpy,XErrorEvent* event){
- s_lastErrorCode = event->error_code;
- return 0;
-}
-
-#define IS_SUCCESS(a) \
- if(a != Success) return 0;
-
-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 validNativeDisplay(EGLNativeInternalDisplayType dpy) {
- return dpy != NULL;
-}
-
-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() : 0,&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, 0, 0, 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){
-}
-
-};
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/MacNative.h b/distrib/android-emugl/host/libs/Translator/EGL/MacNative.h
deleted file mode 100644
index c8a1df2bc..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/MacNative.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef MAC_NATIVE_H
-#define MAC_NATIVE_H
-
-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);
-int getPixelFormatDefinitionAlpha(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
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/MacNative.m b/distrib/android-emugl/host/libs/Translator/EGL/MacNative.m
deleted file mode 100644
index a2cea93cb..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/MacNative.m
+++ /dev/null
@@ -1,207 +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]];
-}
-
-int getPixelFormatDefinitionAlpha(int i) {
- int size;
- NSOpenGLPixelFormatAttribute** attrib_lists = getPixelFormatsAttributes(&size);
- NSOpenGLPixelFormatAttribute* attribs = attrib_lists[i];
- while (*attribs) {
- switch (*attribs) {
- // These are the ones that take a value, according to the current
- // NSOpenGLPixelFormat docs
- case NSOpenGLPFAAuxBuffers:
- case NSOpenGLPFAColorSize:
- case NSOpenGLPFADepthSize:
- case NSOpenGLPFAStencilSize:
- case NSOpenGLPFAAccumSize:
- case NSOpenGLPFARendererID:
- case NSOpenGLPFAScreenMask:
- attribs += 2;
- break;
- case NSOpenGLPFAAlphaSize:
- return attribs[1];
- break;
- // All other attributes are boolean attributes that don't take a value
- default:
- attribs++;
- }
- }
- return 0;
-}
-
-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;
-
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/MacPixelFormatsAttribs.h b/distrib/android-emugl/host/libs/Translator/EGL/MacPixelFormatsAttribs.h
deleted file mode 100644
index 692ac22a7..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/MacPixelFormatsAttribs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef MAC_PIXELS_FORMATS_ATTRIBS_H
-#define MAC_PIXELS_FORMATS_ATTRIBS_H
-
-#include <Cocoa/Cocoa.h>
-NSOpenGLPixelFormatAttribute** getPixelFormatsAttributes(int* size);
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/MacPixelFormatsAttribs.m b/distrib/android-emugl/host/libs/Translator/EGL/MacPixelFormatsAttribs.m
deleted file mode 100644
index f5bc49cb6..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/MacPixelFormatsAttribs.m
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "MacPixelFormatsAttribs.h"
-
-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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/ThreadInfo.cpp b/distrib/android-emugl/host/libs/Translator/EGL/ThreadInfo.cpp
deleted file mode 100644
index 1571b3af9..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/ThreadInfo.cpp
+++ /dev/null
@@ -1,83 +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"
-
-#include "emugl/common/lazy_instance.h"
-#include "emugl/common/thread_store.h"
-
-#include <stdio.h>
-
-// Set TRACE_THREADINFO to 1 to debug creation/destruction of ThreadInfo
-// instances.
-#define TRACE_THREADINFO 0
-
-#if TRACE_THREADINFO
-#define LOG_THREADINFO(x...) fprintf(stderr, x)
-#else
-#define LOG_THREADINFO(x...)
-#endif
-
-namespace {
-
-class ThreadInfoStore : public ::emugl::ThreadStore {
-public:
- ThreadInfoStore() : ::emugl::ThreadStore(&destructor) {}
-
- size_t getInstanceCount() const { return mNumInstances; }
-
-private:
- static void destructor(void* value) {
- LOG_THREADINFO("%s: EFL %p (%d instances)\n", __FUNCTION__,
- value, mNumInstances);
- delete static_cast<ThreadInfo*>(value);
- mNumInstances--;
- }
-
- static size_t mNumInstances;
-};
-
-size_t ThreadInfoStore::mNumInstances = 0;
-
-} // namespace
-
-
-void ThreadInfo::updateInfo(ContextPtr eglCtx,
- EglDisplay* dpy,
- GLEScontext* glesCtx,
- ShareGroupPtr share,
- ObjectNameManager* manager) {
-
- eglContext = eglCtx;
- eglDisplay = dpy;
- glesContext = glesCtx;
- shareGroup = share;
- objManager = manager;
-}
-
-static ::emugl::LazyInstance<ThreadInfoStore> s_tls = LAZY_INSTANCE_INIT;
-
-ThreadInfo *getThreadInfo()
-{
- ThreadInfo *ti = static_cast<ThreadInfo*>(s_tls->get());
- if (!ti) {
- ti = new ThreadInfo();
- s_tls->set(ti);
- LOG_THREADINFO("%s: EGL %p (%d instances)\n", __FUNCTION__,
- ti, (int)ThreadInfoStore::getInstanceCount());
- }
- return ti;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/EGL/ThreadInfo.h b/distrib/android-emugl/host/libs/Translator/EGL/ThreadInfo.h
deleted file mode 100644
index de7c00eb9..000000000
--- a/distrib/android-emugl/host/libs/Translator/EGL/ThreadInfo.h
+++ /dev/null
@@ -1,40 +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 {
- void updateInfo(ContextPtr eglctx,
- EglDisplay* dpy,
- GLEScontext* glesCtx,
- ShareGroupPtr share,
- ObjectNameManager* manager);
-
- ContextPtr eglContext;
- EglDisplay* eglDisplay = nullptr;
- GLEScontext* glesContext = nullptr;
- ShareGroupPtr shareGroup;
- ObjectNameManager* objManager = nullptr;
-};
-
-ThreadInfo* getThreadInfo();
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/Android.mk b/distrib/android-emugl/host/libs/Translator/GLES_CM/Android.mk
deleted file mode 100644
index e96a0e045..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/Android.mk
+++ /dev/null
@@ -1,14 +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-shared-library,lib$(BUILD_TARGET_SUFFIX)GLES_CM_translator)
-$(call emugl-import,libGLcommon)
-LOCAL_SRC_FILES := $(host_common_SRC_FILES)
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLDispatch.cpp b/distrib/android-emugl/host/libs/Translator/GLES_CM/GLDispatch.cpp
deleted file mode 100644
index 66adefb5e..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLDispatch.cpp
+++ /dev/null
@@ -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() {
- emugl::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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLDispatch.h b/distrib/android-emugl/host/libs/Translator/GLES_CM/GLDispatch.h
deleted file mode 100644
index ae8c9f89e..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLDispatch.h
+++ /dev/null
@@ -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 "emugl/common/mutex.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;
- emugl::Mutex m_lock;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmContext.cpp b/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmContext.cpp
deleted file mode 100644
index b1f42e545..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmContext.cpp
+++ /dev/null
@@ -1,416 +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() {
- emugl::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];
-
- buildStrings((const char*)dispatcher().glGetString(GL_VENDOR),
- (const char*)dispatcher().glGetString(GL_RENDERER),
- (const char*)dispatcher().glGetString(GL_VERSION),
- "OpenGL ES-CM 1.1");
- }
- m_initialized = true;
-}
-
-GLEScmContext::GLEScmContext() {
- 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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmContext.h b/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmContext.h
deleted file mode 100644
index 0684b47af..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmContext.h
+++ /dev/null
@@ -1,66 +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>
-
-
-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 = nullptr;
- int m_pointsIndex = -1;
- unsigned int m_clientActiveTexture = 0;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmImp.cpp b/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmImp.cpp
deleted file mode 100644
index dfe8e692b..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmImp.cpp
+++ /dev/null
@@ -1,2449 +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.
-*/
-
-#ifdef _WIN32
-#undef GL_API
-#define GL_API __declspec(dllexport)
-#define GL_APICALL __declspec(dllexport)
-#endif
-#define GL_GLEXT_PROTOTYPES
-#include "GLEScmContext.h"
-#include "GLEScmValidate.h"
-#include "GLEScmUtils.h"
-#include <GLcommon/TextureUtils.h>
-#include <OpenglCodecCommon/ErrorLog.h>
-
-#include <GLcommon/GLDispatch.h>
-#include <GLcommon/GLconversion_macros.h>
-#include <GLcommon/TranslatorIfaces.h>
-#include <GLcommon/FramebufferData.h>
-
-#include <cmath>
-#include <unordered_map>
-
-#include <stdio.h>
-
-extern "C" {
-
-//decleration
-static void initGLESx();
-static void initContext(GLEScontext* ctx,ShareGroupPtr grp);
-static void deleteGLESContext(GLEScontext* ctx);
-static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp);
-static GLEScontext* createGLESContext();
-static __translatorMustCastToProperFunctionPointerType getProcAddress(const char* procName);
-
-}
-
-/************************************** GLES EXTENSIONS *********************************************************/
-//extentions descriptor
-typedef std::unordered_map<std::string, __translatorMustCastToProperFunctionPointerType> ProcTableMap;
-ProcTableMap *s_glesExtensions = NULL;
-/****************************************************************************************************************/
-
-static EGLiface* s_eglIface = NULL;
-static GLESiface s_glesIface = {
- .initGLESx = initGLESx,
- .createGLESContext = createGLESContext,
- .initContext = initContext,
- .deleteGLESContext = deleteGLESContext,
- .flush = (FUNCPTR_NO_ARGS_RET_VOID)glFlush,
- .finish = (FUNCPTR_NO_ARGS_RET_VOID)glFinish,
- .setShareGroup = setShareGroup,
- .getProcAddress = getProcAddress,
- .fenceSync = NULL,
- .clientWaitSync = NULL,
- .deleteSync = NULL,
-};
-
-#include <GLcommon/GLESmacros.h>
-
-extern "C" {
-
-static void initGLESx() {
- DBG("No special initialization necessary for GLES_CM\n");
- return;
-}
-
-static void initContext(GLEScontext* ctx,ShareGroupPtr grp) {
- if (!ctx->isInitialized()) {
- ctx->setShareGroup(grp);
- ctx->init(s_eglIface->eglGetGlLibrary());
- glBindTexture(GL_TEXTURE_2D,0);
- glBindTexture(GL_TEXTURE_CUBE_MAP_OES,0);
- }
-}
-
-static GLEScontext* createGLESContext() {
- return new GLEScmContext();
-}
-
-static void deleteGLESContext(GLEScontext* ctx) {
- if(ctx) delete ctx;
-}
-
-static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp) {
- if(ctx) {
- ctx->setShareGroup(grp);
- }
-}
-static __translatorMustCastToProperFunctionPointerType getProcAddress(const char* procName) {
- GET_CTX_RET(NULL)
- ctx->getGlobalLock();
- static bool proc_table_initialized = false;
- if (!proc_table_initialized) {
- proc_table_initialized = true;
- if (!s_glesExtensions)
- s_glesExtensions = new ProcTableMap();
- else
- s_glesExtensions->clear();
- (*s_glesExtensions)["glEGLImageTargetTexture2DOES"] = (__translatorMustCastToProperFunctionPointerType)glEGLImageTargetTexture2DOES;
- (*s_glesExtensions)["glEGLImageTargetRenderbufferStorageOES"]=(__translatorMustCastToProperFunctionPointerType)glEGLImageTargetRenderbufferStorageOES;
- (*s_glesExtensions)["glBlendEquationSeparateOES"] = (__translatorMustCastToProperFunctionPointerType)glBlendEquationSeparateOES;
- (*s_glesExtensions)["glBlendFuncSeparateOES"] = (__translatorMustCastToProperFunctionPointerType)glBlendFuncSeparateOES;
- (*s_glesExtensions)["glBlendEquationOES"] = (__translatorMustCastToProperFunctionPointerType)glBlendEquationOES;
-
- if (ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND) {
- (*s_glesExtensions)["glCurrentPaletteMatrixOES"] = (__translatorMustCastToProperFunctionPointerType)glCurrentPaletteMatrixOES;
- (*s_glesExtensions)["glLoadPaletteFromModelViewMatrixOES"]=(__translatorMustCastToProperFunctionPointerType)glLoadPaletteFromModelViewMatrixOES;
- (*s_glesExtensions)["glMatrixIndexPointerOES"] = (__translatorMustCastToProperFunctionPointerType)glMatrixIndexPointerOES;
- (*s_glesExtensions)["glWeightPointerOES"] = (__translatorMustCastToProperFunctionPointerType)glWeightPointerOES;
- }
- (*s_glesExtensions)["glDepthRangefOES"] = (__translatorMustCastToProperFunctionPointerType)glDepthRangef;
- (*s_glesExtensions)["glFrustumfOES"] = (__translatorMustCastToProperFunctionPointerType)glFrustumf;
- (*s_glesExtensions)["glOrthofOES"] = (__translatorMustCastToProperFunctionPointerType)glOrthof;
- (*s_glesExtensions)["glClipPlanefOES"] = (__translatorMustCastToProperFunctionPointerType)glClipPlanef;
- (*s_glesExtensions)["glGetClipPlanefOES"] = (__translatorMustCastToProperFunctionPointerType)glGetClipPlanef;
- (*s_glesExtensions)["glClearDepthfOES"] = (__translatorMustCastToProperFunctionPointerType)glClearDepthf;
- (*s_glesExtensions)["glPointSizePointerOES"] = (__translatorMustCastToProperFunctionPointerType)glPointSizePointerOES;
- (*s_glesExtensions)["glTexGenfOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenfOES;
- (*s_glesExtensions)["glTexGenfvOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenfvOES;
- (*s_glesExtensions)["glTexGeniOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGeniOES;
- (*s_glesExtensions)["glTexGenivOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenivOES;
- (*s_glesExtensions)["glTexGenxOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenxOES;
- (*s_glesExtensions)["glTexGenxvOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenxvOES;
- (*s_glesExtensions)["glGetTexGenfvOES"] = (__translatorMustCastToProperFunctionPointerType)glGetTexGenfvOES;
- (*s_glesExtensions)["glGetTexGenivOES"] = (__translatorMustCastToProperFunctionPointerType)glGetTexGenivOES;
- (*s_glesExtensions)["glGetTexGenxvOES"] = (__translatorMustCastToProperFunctionPointerType)glGetTexGenxvOES;
- if (ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT) {
- (*s_glesExtensions)["glIsRenderbufferOES"] = (__translatorMustCastToProperFunctionPointerType)glIsRenderbufferOES;
- (*s_glesExtensions)["glBindRenderbufferOES"] = (__translatorMustCastToProperFunctionPointerType)glBindRenderbufferOES;
- (*s_glesExtensions)["glDeleteRenderbuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glDeleteRenderbuffersOES;
- (*s_glesExtensions)["glGenRenderbuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glGenRenderbuffersOES;
- (*s_glesExtensions)["glRenderbufferStorageOES"] = (__translatorMustCastToProperFunctionPointerType)glRenderbufferStorageOES;
- (*s_glesExtensions)["glGetRenderbufferParameterivOES"] = (__translatorMustCastToProperFunctionPointerType)glGetRenderbufferParameterivOES;
- (*s_glesExtensions)["glIsFramebufferOES"] = (__translatorMustCastToProperFunctionPointerType)glIsFramebufferOES;
- (*s_glesExtensions)["glBindFramebufferOES"] = (__translatorMustCastToProperFunctionPointerType)glBindFramebufferOES;
- (*s_glesExtensions)["glDeleteFramebuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glDeleteFramebuffersOES;
- (*s_glesExtensions)["glGenFramebuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glGenFramebuffersOES;
- (*s_glesExtensions)["glCheckFramebufferStatusOES"] = (__translatorMustCastToProperFunctionPointerType)glCheckFramebufferStatusOES;
- (*s_glesExtensions)["glFramebufferTexture2DOES"] = (__translatorMustCastToProperFunctionPointerType)glFramebufferTexture2DOES;
- (*s_glesExtensions)["glFramebufferRenderbufferOES"] = (__translatorMustCastToProperFunctionPointerType)glFramebufferRenderbufferOES;
- (*s_glesExtensions)["glGetFramebufferAttachmentParameterivOES"] = (__translatorMustCastToProperFunctionPointerType)glGetFramebufferAttachmentParameterivOES;
- (*s_glesExtensions)["glGenerateMipmapOES"] = (__translatorMustCastToProperFunctionPointerType)glGenerateMipmapOES;
- }
- (*s_glesExtensions)["glDrawTexsOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexsOES;
- (*s_glesExtensions)["glDrawTexiOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexiOES;
- (*s_glesExtensions)["glDrawTexfOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexfOES;
- (*s_glesExtensions)["glDrawTexxOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexxOES;
- (*s_glesExtensions)["glDrawTexsvOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexsvOES;
- (*s_glesExtensions)["glDrawTexivOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexivOES;
- (*s_glesExtensions)["glDrawTexfvOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexfvOES;
- (*s_glesExtensions)["glDrawTexxvOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexxvOES;
- }
- __translatorMustCastToProperFunctionPointerType ret=NULL;
- ProcTableMap::iterator val = s_glesExtensions->find(procName);
- if (val!=s_glesExtensions->end())
- ret = val->second;
- ctx->releaseGlobalLock();
-
- return ret;
-}
-
-GL_APICALL GLESiface* GL_APIENTRY __translator_getIfaces(EGLiface* eglIface);
-
-GLESiface* __translator_getIfaces(EGLiface* eglIface) {
- s_eglIface = eglIface;
- return &s_glesIface;
-}
-
-}
-
-static ObjectLocalName TextureLocalName(GLenum target, unsigned int tex) {
- GET_CTX_RET(0);
- return (tex!=0? tex : ctx->getDefaultTextureName(target));
-}
-
-static TextureData* getTextureData(ObjectLocalName tex){
- GET_CTX_RET(NULL);
-
- if (!ctx->shareGroup()->isObject(NamedObjectType::TEXTURE, tex)) {
- return NULL;
- }
-
- TextureData *texData = NULL;
- ObjectDataPtr objData =
- ctx->shareGroup()->getObjectData(NamedObjectType::TEXTURE, tex);
- if(!objData.get()){
- texData = new TextureData();
- ctx->shareGroup()->setObjectData(NamedObjectType::TEXTURE, tex,
- ObjectDataPtr(texData));
- } else {
- texData = (TextureData*)objData.get();
- }
- return texData;
-}
-
-static TextureData* getTextureTargetData(GLenum target){
- GET_CTX_RET(NULL);
- unsigned int tex = ctx->getBindedTexture(target);
- return getTextureData(TextureLocalName(target,tex));
-}
-
-GL_API GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) {
- GET_CTX_RET(GL_FALSE)
-
- if(buffer && ctx->shareGroup().get()) {
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(
- NamedObjectType::VERTEXBUFFER, buffer);
- return objData.get() ? ((GLESbuffer*)objData.get())->wasBinded()
- : GL_FALSE;
- }
- return GL_FALSE;
-}
-
-GL_API GLboolean GL_APIENTRY glIsEnabled( GLenum cap) {
- GET_CTX_CM_RET(GL_FALSE)
- RET_AND_SET_ERROR_IF(!GLEScmValidate::capability(cap,ctx->getMaxLights(),ctx->getMaxClipPlanes()),GL_INVALID_ENUM,GL_FALSE);
-
- if (cap == GL_POINT_SIZE_ARRAY_OES)
- return ctx->isArrEnabled(cap);
- else if (cap==GL_TEXTURE_GEN_STR_OES)
- return (ctx->dispatcher().glIsEnabled(GL_TEXTURE_GEN_S) &&
- ctx->dispatcher().glIsEnabled(GL_TEXTURE_GEN_T) &&
- ctx->dispatcher().glIsEnabled(GL_TEXTURE_GEN_R));
- else
- return ctx->dispatcher().glIsEnabled(cap);
-}
-
-GL_API GLboolean GL_APIENTRY glIsTexture( GLuint texture) {
- GET_CTX_RET(GL_FALSE)
-
- if(texture == 0) // Special case
- return GL_FALSE;
-
- TextureData* tex = getTextureData(texture);
- return tex ? tex->wasBound : GL_FALSE;
-}
-
-GL_API GLenum GL_APIENTRY glGetError(void) {
- GET_CTX_RET(GL_NO_ERROR)
- GLenum err = ctx->getGLerror();
- if(err != GL_NO_ERROR) {
- ctx->setGLerror(GL_NO_ERROR);
- return err;
- }
-
- return ctx->dispatcher().glGetError();
-}
-
-GL_API const GLubyte * GL_APIENTRY glGetString( GLenum name) {
-
- GET_CTX_RET(NULL)
- switch(name) {
- case GL_VENDOR:
- return (const GLubyte*)ctx->getVendorString();
- case GL_RENDERER:
- return (const GLubyte*)ctx->getRendererString();
- case GL_VERSION:
- return (const GLubyte*)ctx->getVersionString();
- case GL_EXTENSIONS:
- return (const GLubyte*)ctx->getExtensionString();
- default:
- RET_AND_SET_ERROR_IF(true,GL_INVALID_ENUM,NULL);
- }
-}
-
-GL_API void GL_APIENTRY glActiveTexture( GLenum texture) {
- GET_CTX_CM()
- SET_ERROR_IF(!GLEScmValidate::textureEnum(texture,ctx->getMaxTexUnits()),GL_INVALID_ENUM);
- ctx->setActiveTexture(texture);
- ctx->dispatcher().glActiveTexture(texture);
-}
-
-GL_API void GL_APIENTRY glAlphaFunc( GLenum func, GLclampf ref) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::alphaFunc(func),GL_INVALID_ENUM);
- ctx->dispatcher().glAlphaFunc(func,ref);
-}
-
-
-GL_API void GL_APIENTRY glAlphaFuncx( GLenum func, GLclampx ref) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::alphaFunc(func),GL_INVALID_ENUM);
- ctx->dispatcher().glAlphaFunc(func,X2F(ref));
-}
-
-
-GL_API void GL_APIENTRY glBindBuffer( GLenum target, GLuint buffer) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::bufferTarget(target),GL_INVALID_ENUM);
-
- //if buffer wasn't generated before,generate one
- if (buffer && ctx->shareGroup().get() &&
- !ctx->shareGroup()->isObject(NamedObjectType::VERTEXBUFFER, buffer)) {
- ctx->shareGroup()->genName(NamedObjectType::VERTEXBUFFER, buffer);
- ctx->shareGroup()->setObjectData(NamedObjectType::VERTEXBUFFER, buffer,
- ObjectDataPtr(new GLESbuffer()));
- }
- ctx->bindBuffer(target,buffer);
- if (buffer) {
- GLESbuffer* vbo =
- (GLESbuffer*)ctx->shareGroup()
- ->getObjectData(NamedObjectType::VERTEXBUFFER, buffer)
- .get();
- vbo->setBinded();
- }
-}
-
-
-GL_API void GL_APIENTRY glBindTexture( GLenum target, GLuint texture) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::textureTarget(target),GL_INVALID_ENUM)
-
- //for handling default texture (0)
- ObjectLocalName localTexName = TextureLocalName(target,texture);
-
- GLuint globalTextureName = localTexName;
- if(ctx->shareGroup().get()){
- globalTextureName = ctx->shareGroup()->getGlobalName(
- NamedObjectType::TEXTURE, localTexName);
- //if texture wasn't generated before,generate one
- if(!globalTextureName){
- ctx->shareGroup()->genName(NamedObjectType::TEXTURE, localTexName);
- globalTextureName = ctx->shareGroup()->getGlobalName(
- NamedObjectType::TEXTURE, localTexName);
- }
-
- TextureData* texData = getTextureData(localTexName);
- if (texData->target==0)
- texData->target = target;
- //if texture was already bound to another target
- SET_ERROR_IF(ctx->GLTextureTargetToLocal(texData->target) != ctx->GLTextureTargetToLocal(target), GL_INVALID_OPERATION);
- texData->wasBound = true;
- }
-
- ctx->setBindedTexture(target,texture);
- ctx->dispatcher().glBindTexture(target,globalTextureName);
-}
-
-GL_API void GL_APIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::blendSrc(sfactor) || !GLEScmValidate::blendDst(dfactor),GL_INVALID_ENUM)
- ctx->dispatcher().glBlendFunc(sfactor,dfactor);
-}
-
-GL_API void GL_APIENTRY glBufferData( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::bufferTarget(target),GL_INVALID_ENUM);
- SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION);
- ctx->setBufferData(target,size,data,usage);
-}
-
-GL_API void GL_APIENTRY glBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) {
- GET_CTX()
- SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLEScmValidate::bufferTarget(target),GL_INVALID_ENUM);
- SET_ERROR_IF(!ctx->setBufferSubData(target,offset,size,data),GL_INVALID_VALUE);
-}
-
-GL_API void GL_APIENTRY glClear( GLbitfield mask) {
- GET_CTX()
- ctx->drawValidate();
-
- ctx->dispatcher().glClear(mask);
-}
-
-GL_API void GL_APIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- GET_CTX()
- ctx->dispatcher().glClearColor(red,green,blue,alpha);
-}
-
-GL_API void GL_APIENTRY glClearColorx( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
- GET_CTX()
- ctx->dispatcher().glClearColor(X2F(red),X2F(green),X2F(blue),X2F(alpha));
-}
-
-
-GL_API void GL_APIENTRY glClearDepthf( GLclampf depth) {
- GET_CTX()
- ctx->dispatcher().glClearDepth(depth);
-}
-
-GL_API void GL_APIENTRY glClearDepthx( GLclampx depth) {
- GET_CTX()
- ctx->dispatcher().glClearDepth(X2F(depth));
-}
-
-GL_API void GL_APIENTRY glClearStencil( GLint s) {
- GET_CTX()
- ctx->dispatcher().glClearStencil(s);
-}
-
-GL_API void GL_APIENTRY glClientActiveTexture( GLenum texture) {
- GET_CTX_CM()
- SET_ERROR_IF(!GLEScmValidate::textureEnum(texture,ctx->getMaxTexUnits()),GL_INVALID_ENUM);
- ctx->setClientActiveTexture(texture);
- ctx->dispatcher().glClientActiveTexture(texture);
-
-}
-
-GL_API void GL_APIENTRY glClipPlanef( GLenum plane, const GLfloat *equation) {
- GET_CTX()
- GLdouble tmpEquation[4];
-
- for(int i = 0; i < 4; i++) {
- tmpEquation[i] = static_cast<GLdouble>(equation[i]);
- }
- ctx->dispatcher().glClipPlane(plane,tmpEquation);
-}
-
-GL_API void GL_APIENTRY glClipPlanex( GLenum plane, const GLfixed *equation) {
- GET_CTX()
- GLdouble tmpEquation[4];
- for(int i = 0; i < 4; i++) {
- tmpEquation[i] = X2D(equation[i]);
- }
- ctx->dispatcher().glClipPlane(plane,tmpEquation);
-}
-
-GL_API void GL_APIENTRY glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
- GET_CTX()
- ctx->dispatcher().glColor4f(red,green,blue,alpha);
-}
-
-GL_API void GL_APIENTRY glColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {
- GET_CTX()
- ctx->dispatcher().glColor4ub(red,green,blue,alpha);
-}
-
-GL_API void GL_APIENTRY glColor4x( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
- GET_CTX()
- ctx->dispatcher().glColor4f(X2F(red),X2F(green),X2F(blue),X2F(alpha));
-}
-
-GL_API void GL_APIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
- GET_CTX()
- ctx->dispatcher().glColorMask(red,green,blue,alpha);
-}
-
-GL_API void GL_APIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::colorPointerParams(size,stride),GL_INVALID_VALUE);
- SET_ERROR_IF(!GLEScmValidate::colorPointerType(type),GL_INVALID_ENUM);
- ctx->setPointer(GL_COLOR_ARRAY,size,type,stride,pointer);
-}
-
-GL_API void GL_APIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) {
- GET_CTX_CM()
- SET_ERROR_IF(!GLEScmValidate::textureTargetEx(target),GL_INVALID_ENUM);
- SET_ERROR_IF(!data,GL_INVALID_OPERATION);
-
- doCompressedTexImage2D(ctx, target, level, internalformat,
- width, height, border,
- imageSize, data, (void*)glTexImage2D);
-}
-
-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) {
- GET_CTX_CM()
- SET_ERROR_IF(!(GLEScmValidate::texCompImgFrmt(format) && GLEScmValidate::textureTargetEx(target)),GL_INVALID_ENUM);
- SET_ERROR_IF(level < 0 || level > log2(ctx->getMaxTexSize()),GL_INVALID_VALUE)
- SET_ERROR_IF(!data,GL_INVALID_OPERATION);
-
- GLenum uncompressedFrmt;
- unsigned char* uncompressed = uncompressTexture(format,uncompressedFrmt,width,height,imageSize,data,level);
- ctx->dispatcher().glTexSubImage2D(target,level,xoffset,yoffset,width,height,uncompressedFrmt,GL_UNSIGNED_BYTE,uncompressed);
- delete uncompressed;
-}
-
-GL_API void GL_APIENTRY glCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
- GET_CTX()
- SET_ERROR_IF(!(GLEScmValidate::pixelFrmt(ctx,internalformat) && GLEScmValidate::textureTargetEx(target)),GL_INVALID_ENUM);
- SET_ERROR_IF(border != 0,GL_INVALID_VALUE);
- ctx->dispatcher().glCopyTexImage2D(target,level,internalformat,x,y,width,height,border);
-}
-
-GL_API void GL_APIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::textureTargetEx(target),GL_INVALID_ENUM);
- ctx->dispatcher().glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height);
-}
-
-GL_API void GL_APIENTRY glCullFace( GLenum mode) {
- GET_CTX()
- ctx->dispatcher().glCullFace(mode);
-}
-
-GL_API void GL_APIENTRY glDeleteBuffers( GLsizei n, const GLuint *buffers) {
- GET_CTX()
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i < n; i++){
- ctx->shareGroup()->deleteName(NamedObjectType::VERTEXBUFFER,
- buffers[i]);
- ctx->unbindBuffer(buffers[i]);
- }
- }
-}
-
-GL_API void GL_APIENTRY glDeleteTextures( GLsizei n, const GLuint *textures) {
- GET_CTX()
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i < n; i++){
- if(textures[i] != 0)
- {
- TextureData* tData = getTextureData(textures[i]);
- // delete the underlying OpenGL texture but only if this
- // texture is not a target of EGLImage.
- if (!tData || tData->sourceEGLImage == 0) {
- const GLuint globalTextureName =
- ctx->shareGroup()->getGlobalName(
- NamedObjectType::TEXTURE, textures[i]);
- ctx->shareGroup()->decTexRefCounterAndReleaseIf0(globalTextureName);
- }
- ctx->shareGroup()->deleteName(NamedObjectType::TEXTURE,
- textures[i]);
-
- if(ctx->getBindedTexture(GL_TEXTURE_2D) == textures[i])
- ctx->setBindedTexture(GL_TEXTURE_2D,0);
- if (ctx->getBindedTexture(GL_TEXTURE_CUBE_MAP) == textures[i])
- ctx->setBindedTexture(GL_TEXTURE_CUBE_MAP,0);
- }
- }
- }
-}
-
-GL_API void GL_APIENTRY glDepthFunc( GLenum func) {
- GET_CTX()
- ctx->dispatcher().glDepthFunc(func);
-}
-
-GL_API void GL_APIENTRY glDepthMask( GLboolean flag) {
- GET_CTX()
- ctx->dispatcher().glDepthMask(flag);
-}
-
-GL_API void GL_APIENTRY glDepthRangef( GLclampf zNear, GLclampf zFar) {
- GET_CTX()
- ctx->dispatcher().glDepthRange(zNear,zFar);
-}
-
-GL_API void GL_APIENTRY glDepthRangex( GLclampx zNear, GLclampx zFar) {
- GET_CTX()
- ctx->dispatcher().glDepthRange(X2F(zNear),X2F(zFar));
-}
-
-GL_API void GL_APIENTRY glDisable( GLenum cap) {
- GET_CTX()
- if (cap==GL_TEXTURE_GEN_STR_OES) {
- ctx->dispatcher().glDisable(GL_TEXTURE_GEN_S);
- ctx->dispatcher().glDisable(GL_TEXTURE_GEN_T);
- ctx->dispatcher().glDisable(GL_TEXTURE_GEN_R);
- }
- else ctx->dispatcher().glDisable(cap);
- if (cap==GL_TEXTURE_2D || cap==GL_TEXTURE_CUBE_MAP_OES)
- ctx->setTextureEnabled(cap,false);
-}
-
-GL_API void GL_APIENTRY glDisableClientState( GLenum array) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::supportedArrays(array),GL_INVALID_ENUM)
-
- ctx->enableArr(array,false);
- if(array != GL_POINT_SIZE_ARRAY_OES) ctx->dispatcher().glDisableClientState(array);
-}
-
-
-GL_API void GL_APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count) {
- GET_CTX_CM()
- SET_ERROR_IF(count < 0,GL_INVALID_VALUE)
- SET_ERROR_IF(!GLEScmValidate::drawMode(mode),GL_INVALID_ENUM)
-
- ctx->drawValidate();
-
- if(!ctx->isArrEnabled(GL_VERTEX_ARRAY)) return;
-
- GLESConversionArrays tmpArrs;
- ctx->setupArraysPointers(tmpArrs,first,count,0,NULL,true);
- if(mode == GL_POINTS && ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){
- ctx->drawPointsArrs(tmpArrs,first,count);
- }
- else
- {
- ctx->dispatcher().glDrawArrays(mode,first,count);
- }
-}
-
-GL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *elementsIndices) {
- GET_CTX_CM()
- SET_ERROR_IF(count < 0,GL_INVALID_VALUE)
- SET_ERROR_IF((!GLEScmValidate::drawMode(mode) || !GLEScmValidate::drawType(type)),GL_INVALID_ENUM)
- if(!ctx->isArrEnabled(GL_VERTEX_ARRAY)) return;
-
- ctx->drawValidate();
-
- const GLvoid* indices = elementsIndices;
- GLESConversionArrays tmpArrs;
- if(ctx->isBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)) { // if vbo is binded take the indices from the vbo
- const unsigned char* buf = static_cast<unsigned char *>(ctx->getBindedBuffer(GL_ELEMENT_ARRAY_BUFFER));
- indices = buf + SafeUIntFromPointer(elementsIndices);
- }
-
- ctx->setupArraysPointers(tmpArrs,0,count,type,indices,false);
- if(mode == GL_POINTS && ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){
- ctx->drawPointsElems(tmpArrs,count,type,indices);
- }
- else{
- ctx->dispatcher().glDrawElements(mode,count,type,indices);
- }
-}
-
-GL_API void GL_APIENTRY glEnable( GLenum cap) {
- GET_CTX()
- if (cap==GL_TEXTURE_GEN_STR_OES) {
- ctx->dispatcher().glEnable(GL_TEXTURE_GEN_S);
- ctx->dispatcher().glEnable(GL_TEXTURE_GEN_T);
- ctx->dispatcher().glEnable(GL_TEXTURE_GEN_R);
- }
- else
- ctx->dispatcher().glEnable(cap);
- if (cap==GL_TEXTURE_2D || cap==GL_TEXTURE_CUBE_MAP_OES)
- ctx->setTextureEnabled(cap,true);
-}
-
-GL_API void GL_APIENTRY glEnableClientState( GLenum array) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::supportedArrays(array),GL_INVALID_ENUM)
-
- ctx->enableArr(array,true);
- if(array != GL_POINT_SIZE_ARRAY_OES) ctx->dispatcher().glEnableClientState(array);
-}
-
-GL_API void GL_APIENTRY glFinish( void) {
- GET_CTX()
- ctx->dispatcher().glFinish();
-}
-
-GL_API void GL_APIENTRY glFlush( void) {
- GET_CTX()
- ctx->dispatcher().glFlush();
-}
-
-GL_API void GL_APIENTRY glFogf( GLenum pname, GLfloat param) {
- GET_CTX()
- ctx->dispatcher().glFogf(pname,param);
-}
-
-GL_API void GL_APIENTRY glFogfv( GLenum pname, const GLfloat *params) {
- GET_CTX()
- ctx->dispatcher().glFogfv(pname,params);
-}
-
-GL_API void GL_APIENTRY glFogx( GLenum pname, GLfixed param) {
- GET_CTX()
- ctx->dispatcher().glFogf(pname,(pname == GL_FOG_MODE)? static_cast<GLfloat>(param):X2F(param));
-}
-
-GL_API void GL_APIENTRY glFogxv( GLenum pname, const GLfixed *params) {
- GET_CTX()
- if(pname == GL_FOG_MODE) {
- GLfloat tmpParam = static_cast<GLfloat>(params[0]);
- ctx->dispatcher().glFogfv(pname,&tmpParam);
- } else {
- GLfloat tmpParams[4];
- for(int i=0; i< 4; i++) {
- tmpParams[i] = X2F(params[i]);
- }
- ctx->dispatcher().glFogfv(pname,tmpParams);
- }
-
-}
-
-GL_API void GL_APIENTRY glFrontFace( GLenum mode) {
- GET_CTX()
- ctx->dispatcher().glFrontFace(mode);
-}
-
-GL_API void GL_APIENTRY glFrustumf( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- GET_CTX()
- ctx->dispatcher().glFrustum(left,right,bottom,top,zNear,zFar);
-}
-
-GL_API void GL_APIENTRY glFrustumx( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- GET_CTX()
- ctx->dispatcher().glFrustum(X2F(left),X2F(right),X2F(bottom),X2F(top),X2F(zNear),X2F(zFar));
-}
-
-GL_API void GL_APIENTRY glGenBuffers( GLsizei n, GLuint *buffers) {
- GET_CTX()
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i<n ;i++) {
- buffers[i] = ctx->shareGroup()->genName(
- NamedObjectType::VERTEXBUFFER, 0, true);
- //generating vbo object related to this buffer name
- ctx->shareGroup()->setObjectData(NamedObjectType::VERTEXBUFFER,
- buffers[i],
- ObjectDataPtr(new GLESbuffer()));
- }
- }
-}
-
-GL_API void GL_APIENTRY glGenTextures( GLsizei n, GLuint *textures) {
- GET_CTX();
- if(ctx->shareGroup().get()) {
- for(int i=0; i<n ;i++) {
- textures[i] = ctx->shareGroup()->genName(NamedObjectType::TEXTURE,
- 0, true);
- }
- }
-}
-
-GL_API void GL_APIENTRY glGetBooleanv( GLenum pname, GLboolean *params) {
- GET_CTX()
-
- if(ctx->glGetBooleanv(pname, params))
- {
- return;
- }
-
- switch(pname)
- {
- case GL_FRAMEBUFFER_BINDING_OES:
- case GL_RENDERBUFFER_BINDING_OES:
- {
- GLint name;
- glGetIntegerv(pname,&name);
- *params = name!=0 ? GL_TRUE: GL_FALSE;
- }
- break;
- case GL_TEXTURE_GEN_STR_OES:
- {
- GLboolean state_s = GL_FALSE;
- GLboolean state_t = GL_FALSE;
- GLboolean state_r = GL_FALSE;
- ctx->dispatcher().glGetBooleanv(GL_TEXTURE_GEN_S,&state_s);
- ctx->dispatcher().glGetBooleanv(GL_TEXTURE_GEN_T,&state_t);
- ctx->dispatcher().glGetBooleanv(GL_TEXTURE_GEN_R,&state_r);
- *params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE;
- }
- break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- *params = (GLboolean)getCompressedFormats(NULL);
- break;
- case GL_COMPRESSED_TEXTURE_FORMATS:
- {
- int nparams = getCompressedFormats(NULL);
- if (nparams>0) {
- int * iparams = new int[nparams];
- getCompressedFormats(iparams);
- for (int i=0; i<nparams; i++) params[i] = (GLboolean)iparams[i];
- delete [] iparams;
- }
- }
- break;
- default:
- ctx->dispatcher().glGetBooleanv(pname,params);
- }
-}
-
-GL_API void GL_APIENTRY glGetBufferParameteriv( GLenum target, GLenum pname, GLint *params) {
- GET_CTX()
- SET_ERROR_IF(!(GLEScmValidate::bufferTarget(target) && GLEScmValidate::bufferParam(pname)),GL_INVALID_ENUM);
- SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION);
- switch(pname) {
- case GL_BUFFER_SIZE:
- ctx->getBufferSize(target,params);
- break;
- case GL_BUFFER_USAGE:
- ctx->getBufferUsage(target,params);
- break;
- }
-
-}
-
-GL_API void GL_APIENTRY glGetClipPlanef( GLenum pname, GLfloat eqn[4]) {
- GET_CTX()
- GLdouble tmpEqn[4];
-
- ctx->dispatcher().glGetClipPlane(pname,tmpEqn);
- for(int i =0 ;i < 4; i++){
- eqn[i] = static_cast<GLfloat>(tmpEqn[i]);
- }
-}
-
-GL_API void GL_APIENTRY glGetClipPlanex( GLenum pname, GLfixed eqn[4]) {
- GET_CTX()
- GLdouble tmpEqn[4];
-
- ctx->dispatcher().glGetClipPlane(pname,tmpEqn);
- for(int i =0 ;i < 4; i++){
- eqn[i] = F2X(tmpEqn[i]);
- }
-}
-
-GL_API void GL_APIENTRY glGetFixedv( GLenum pname, GLfixed *params) {
- GET_CTX()
-
- if(ctx->glGetFixedv(pname, params))
- {
- return;
- }
-
- size_t nParams = glParamSize(pname);
- GLfloat fParams[16];
-
- switch(pname)
- {
- case GL_FRAMEBUFFER_BINDING_OES:
- case GL_RENDERBUFFER_BINDING_OES:
- case GL_TEXTURE_GEN_STR_OES:
- glGetFloatv(pname,&fParams[0]);
- break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- *params = I2X(getCompressedFormats(NULL));
- return;
- break;
- case GL_COMPRESSED_TEXTURE_FORMATS:
- {
- int nparams = getCompressedFormats(NULL);
- if (nparams>0) {
- int * iparams = new int[nparams];
- getCompressedFormats(iparams);
- for (int i=0; i<nparams; i++) params[i] = I2X(iparams[i]);
- delete [] iparams;
- }
- return;
- }
- break;
- default:
- ctx->dispatcher().glGetFloatv(pname,fParams);
- }
-
- if (nParams)
- {
- for(size_t i =0 ; i < nParams;i++) {
- params[i] = F2X(fParams[i]);
- }
- }
-}
-
-GL_API void GL_APIENTRY glGetFloatv( GLenum pname, GLfloat *params) {
- GET_CTX()
-
- if(ctx->glGetFloatv(pname, params))
- {
- return;
- }
-
- GLint i;
-
- switch (pname) {
- case GL_FRAMEBUFFER_BINDING_OES:
- case GL_RENDERBUFFER_BINDING_OES:
- case GL_TEXTURE_GEN_STR_OES:
- glGetIntegerv(pname,&i);
- *params = (GLfloat)i;
- break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- *params = (GLfloat)getCompressedFormats(NULL);
- break;
- case GL_COMPRESSED_TEXTURE_FORMATS:
- {
- int nparams = getCompressedFormats(NULL);
- if (nparams>0) {
- int * iparams = new int[nparams];
- getCompressedFormats(iparams);
- for (int i=0; i<nparams; i++) params[i] = (GLfloat)iparams[i];
- delete [] iparams;
- }
- }
- break;
- default:
- ctx->dispatcher().glGetFloatv(pname,params);
- }
-}
-
-GL_API void GL_APIENTRY glGetIntegerv( GLenum pname, GLint *params) {
- GET_CTX()
-
- if(ctx->glGetIntegerv(pname, params))
- {
- return;
- }
-
- GLint i;
- GLfloat f;
-
- switch(pname)
- {
- case GL_TEXTURE_GEN_STR_OES:
- ctx->dispatcher().glGetIntegerv(GL_TEXTURE_GEN_S,&params[0]);
- break;
- case GL_FRAMEBUFFER_BINDING_OES:
- if (ctx->shareGroup().get()) {
- ctx->dispatcher().glGetIntegerv(pname,&i);
- *params = ctx->shareGroup()->getLocalName(
- NamedObjectType::FRAMEBUFFER, i);
- }
- break;
- case GL_RENDERBUFFER_BINDING_OES:
- if (ctx->shareGroup().get()) {
- ctx->dispatcher().glGetIntegerv(pname,&i);
- *params = ctx->shareGroup()->getLocalName(
- NamedObjectType::RENDERBUFFER, i);
- }
- break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- *params = getCompressedFormats(NULL);
- break;
- case GL_COMPRESSED_TEXTURE_FORMATS:
- getCompressedFormats(params);
- break;
- case GL_MAX_CLIP_PLANES:
- ctx->dispatcher().glGetIntegerv(pname,params);
- if(*params > 6)
- {
- // GLES spec requires only 6, and the ATI driver erronously
- // returns 8 (although it supports only 6). This WAR is simple,
- // compliant and good enough for developers.
- *params = 6;
- }
- break;
- case GL_ALPHA_TEST_REF:
- // Both the ATI and nVidia OpenGL drivers return the wrong answer
- // here. So return the right one.
- ctx->dispatcher().glGetFloatv(pname,&f);
- *params = (int)(f * (float)0x7fffffff);
- break;
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- ctx->dispatcher().glGetIntegerv(pname,params);
- if(*params > 16)
- {
- // GLES spec requires only 2, and the ATI driver erronously
- // returns 32 (although it supports only 16). This WAR is simple,
- // compliant and good enough for developers.
- *params = 16;
- }
- break;
-
- default:
- ctx->dispatcher().glGetIntegerv(pname,params);
- }
-}
-
-GL_API void GL_APIENTRY glGetLightfv( GLenum light, GLenum pname, GLfloat *params) {
- GET_CTX()
- ctx->dispatcher().glGetLightfv(light,pname,params);
-}
-
-GL_API void GL_APIENTRY glGetLightxv( GLenum light, GLenum pname, GLfixed *params) {
- GET_CTX()
- GLfloat tmpParams[4];
-
- ctx->dispatcher().glGetLightfv(light,pname,tmpParams);
- switch (pname){
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- case GL_POSITION:
- params[3] = F2X(tmpParams[3]);
- case GL_SPOT_DIRECTION:
- params[2] = F2X(tmpParams[2]);
- case GL_SPOT_EXPONENT:
- case GL_SPOT_CUTOFF:
- case GL_CONSTANT_ATTENUATION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION:
- params[1] = F2X(tmpParams[1]);
- break;
- default:{
- ctx->setGLerror(GL_INVALID_ENUM);
- return;
- }
-
- }
- params[0] = F2X(tmpParams[0]);
-}
-
-GL_API void GL_APIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params) {
- GET_CTX()
- ctx->dispatcher().glGetMaterialfv(face,pname,params);
-}
-
-GL_API void GL_APIENTRY glGetMaterialxv( GLenum face, GLenum pname, GLfixed *params) {
- GET_CTX()
- GLfloat tmpParams[4];
- ctx->dispatcher().glGetMaterialfv(face,pname,tmpParams);
- switch(pname){
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- case GL_EMISSION:
- case GL_AMBIENT_AND_DIFFUSE:
- params[3] = tmpParams[3];
- params[2] = tmpParams[2];
- params[1] = tmpParams[1];
- case GL_SHININESS:
- params[0] = tmpParams[0];
- break;
- default:{
- ctx->setGLerror(GL_INVALID_ENUM);
- return;
- }
- }
-}
-
-GL_API void GL_APIENTRY glGetPointerv( GLenum pname, void **params) {
- GET_CTX()
- const GLESpointer* p = ctx->getPointer(pname);
- if(p) {
- if(p->isVBO())
- {
- *params = SafePointerFromUInt(p->getBufferOffset());
- }else{
- *params = const_cast<void *>(p->getArrayData());
- }
- } else {
- ctx->setGLerror(GL_INVALID_ENUM);
- }
-
-}
-
-GL_API void GL_APIENTRY glGetTexEnvfv( GLenum env, GLenum pname, GLfloat *params) {
- GET_CTX()
- ctx->dispatcher().glGetTexEnvfv(env,pname,params);
-}
-
-GL_API void GL_APIENTRY glGetTexEnviv( GLenum env, GLenum pname, GLint *params) {
- GET_CTX()
- ctx->dispatcher().glGetTexEnviv(env,pname,params);
-}
-
-GL_API void GL_APIENTRY glGetTexEnvxv( GLenum env, GLenum pname, GLfixed *params) {
- GET_CTX()
- GLfloat tmpParams[4];
-
- ctx->dispatcher().glGetTexEnvfv(env,pname,tmpParams);
- if(pname == GL_TEXTURE_ENV_MODE) {
- params[0] = static_cast<GLfixed>(tmpParams[0]);
- } else {
- for(int i=0 ; i < 4 ; i++)
- params[i] = F2X(tmpParams[i]);
- }
-}
-
-GL_API void GL_APIENTRY glGetTexParameterfv( GLenum target, GLenum pname, GLfloat *params) {
- GET_CTX()
- if (pname==GL_TEXTURE_CROP_RECT_OES) {
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- for (int i=0;i<4;++i)
- params[i] = texData->crop_rect[i];
- }
- else {
- ctx->dispatcher().glGetTexParameterfv(target,pname,params);
- }
-}
-
-GL_API void GL_APIENTRY glGetTexParameteriv( GLenum target, GLenum pname, GLint *params) {
- GET_CTX()
- if (pname==GL_TEXTURE_CROP_RECT_OES) {
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- for (int i=0;i<4;++i)
- params[i] = texData->crop_rect[i];
- }
- else {
- ctx->dispatcher().glGetTexParameteriv(target,pname,params);
- }
-}
-
-GL_API void GL_APIENTRY glGetTexParameterxv( GLenum target, GLenum pname, GLfixed *params) {
- GET_CTX()
- if (pname==GL_TEXTURE_CROP_RECT_OES) {
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- for (int i=0;i<4;++i)
- params[i] = F2X(texData->crop_rect[i]);
- }
- else {
- GLfloat tmpParam;
- ctx->dispatcher().glGetTexParameterfv(target,pname,&tmpParam);
- params[0] = static_cast<GLfixed>(tmpParam);
- }
-}
-
-GL_API void GL_APIENTRY glHint( GLenum target, GLenum mode) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::hintTargetMode(target,mode),GL_INVALID_ENUM);
- ctx->dispatcher().glHint(target,mode);
-}
-
-GL_API void GL_APIENTRY glLightModelf( GLenum pname, GLfloat param) {
- GET_CTX()
- ctx->dispatcher().glLightModelf(pname,param);
-}
-
-GL_API void GL_APIENTRY glLightModelfv( GLenum pname, const GLfloat *params) {
- GET_CTX()
- ctx->dispatcher().glLightModelfv(pname,params);
-}
-
-GL_API void GL_APIENTRY glLightModelx( GLenum pname, GLfixed param) {
- GET_CTX()
- GLfloat tmpParam = static_cast<GLfloat>(param);
- ctx->dispatcher().glLightModelf(pname,tmpParam);
-}
-
-GL_API void GL_APIENTRY glLightModelxv( GLenum pname, const GLfixed *params) {
- GET_CTX()
- GLfloat tmpParams[4];
- if(pname == GL_LIGHT_MODEL_TWO_SIDE) {
- tmpParams[0] = X2F(params[0]);
- } else if (pname == GL_LIGHT_MODEL_AMBIENT) {
- for(int i=0;i<4;i++) {
- tmpParams[i] = X2F(params[i]);
- }
- }
-
- ctx->dispatcher().glLightModelfv(pname,tmpParams);
-}
-
-GL_API void GL_APIENTRY glLightf( GLenum light, GLenum pname, GLfloat param) {
- GET_CTX()
- ctx->dispatcher().glLightf(light,pname,param);
-}
-
-GL_API void GL_APIENTRY glLightfv( GLenum light, GLenum pname, const GLfloat *params) {
- GET_CTX()
- ctx->dispatcher().glLightfv(light,pname,params);
-}
-
-GL_API void GL_APIENTRY glLightx( GLenum light, GLenum pname, GLfixed param) {
- GET_CTX()
- ctx->dispatcher().glLightf(light,pname,X2F(param));
-}
-
-GL_API void GL_APIENTRY glLightxv( GLenum light, GLenum pname, const GLfixed *params) {
- GET_CTX()
- GLfloat tmpParams[4];
-
- switch (pname) {
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- case GL_EMISSION:
- case GL_POSITION:
- tmpParams[3] = X2F(params[3]);
- case GL_SPOT_DIRECTION:
- tmpParams[2] = X2F(params[2]);
- tmpParams[1] = X2F(params[1]);
- case GL_SPOT_EXPONENT:
- case GL_SPOT_CUTOFF:
- case GL_CONSTANT_ATTENUATION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION:
- tmpParams[0] = X2F(params[0]);
- break;
- default: {
- ctx->setGLerror(GL_INVALID_ENUM);
- return;
- }
- }
- ctx->dispatcher().glLightfv(light,pname,tmpParams);
-}
-
-GL_API void GL_APIENTRY glLineWidth( GLfloat width) {
- GET_CTX()
- ctx->dispatcher().glLineWidth(width);
-}
-
-GL_API void GL_APIENTRY glLineWidthx( GLfixed width) {
- GET_CTX()
- ctx->dispatcher().glLineWidth(X2F(width));
-}
-
-GL_API void GL_APIENTRY glLoadIdentity( void) {
- GET_CTX()
- ctx->dispatcher().glLoadIdentity();
-}
-
-GL_API void GL_APIENTRY glLoadMatrixf( const GLfloat *m) {
- GET_CTX()
- ctx->dispatcher().glLoadMatrixf(m);
-}
-
-GL_API void GL_APIENTRY glLoadMatrixx( const GLfixed *m) {
- GET_CTX()
- GLfloat mat[16];
- for(int i=0; i< 16 ; i++) {
- mat[i] = X2F(m[i]);
- }
- ctx->dispatcher().glLoadMatrixf(mat);
-}
-
-GL_API void GL_APIENTRY glLogicOp( GLenum opcode) {
- GET_CTX()
- ctx->dispatcher().glLogicOp(opcode);
-}
-
-GL_API void GL_APIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param) {
- GET_CTX()
- ctx->dispatcher().glMaterialf(face,pname,param);
-}
-
-GL_API void GL_APIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params) {
- GET_CTX()
- ctx->dispatcher().glMaterialfv(face,pname,params);
-}
-
-GL_API void GL_APIENTRY glMaterialx( GLenum face, GLenum pname, GLfixed param) {
- GET_CTX()
- ctx->dispatcher().glMaterialf(face,pname,X2F(param));
-}
-
-GL_API void GL_APIENTRY glMaterialxv( GLenum face, GLenum pname, const GLfixed *params) {
- GET_CTX()
- GLfloat tmpParams[4];
-
- for(int i=0; i< 4; i++) {
- tmpParams[i] = X2F(params[i]);
- }
- ctx->dispatcher().glMaterialfv(face,pname,tmpParams);
-}
-
-GL_API void GL_APIENTRY glMatrixMode( GLenum mode) {
- GET_CTX()
- ctx->dispatcher().glMatrixMode(mode);
-}
-
-GL_API void GL_APIENTRY glMultMatrixf( const GLfloat *m) {
- GET_CTX()
- ctx->dispatcher().glMultMatrixf(m);
-}
-
-GL_API void GL_APIENTRY glMultMatrixx( const GLfixed *m) {
- GET_CTX()
- GLfloat mat[16];
- for(int i=0; i< 16 ; i++) {
- mat[i] = X2F(m[i]);
- }
- ctx->dispatcher().glMultMatrixf(mat);
-}
-
-GL_API void GL_APIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
- GET_CTX_CM()
- SET_ERROR_IF(!GLEScmValidate::textureEnum(target,ctx->getMaxTexUnits()),GL_INVALID_ENUM);
- ctx->dispatcher().glMultiTexCoord4f(target,s,t,r,q);
-}
-
-GL_API void GL_APIENTRY glMultiTexCoord4x( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
- GET_CTX_CM()
- SET_ERROR_IF(!GLEScmValidate::textureEnum(target,ctx->getMaxTexUnits()),GL_INVALID_ENUM);
- ctx->dispatcher().glMultiTexCoord4f(target,X2F(s),X2F(t),X2F(r),X2F(q));
-}
-
-GL_API void GL_APIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz) {
- GET_CTX()
- ctx->dispatcher().glNormal3f(nx,ny,nz);
-}
-
-GL_API void GL_APIENTRY glNormal3x( GLfixed nx, GLfixed ny, GLfixed nz) {
- GET_CTX()
- ctx->dispatcher().glNormal3f(X2F(nx),X2F(ny),X2F(nz));
-}
-
-GL_API void GL_APIENTRY glNormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer) {
- GET_CTX()
- SET_ERROR_IF(stride < 0,GL_INVALID_VALUE);
- SET_ERROR_IF(!GLEScmValidate::normalPointerType(type),GL_INVALID_ENUM);
- ctx->setPointer(GL_NORMAL_ARRAY,3,type,stride,pointer);//3 normal verctor
-}
-
-GL_API void GL_APIENTRY glOrthof( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
- GET_CTX()
- ctx->dispatcher().glOrtho(left,right,bottom,top,zNear,zFar);
-}
-
-GL_API void GL_APIENTRY glOrthox( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
- GET_CTX()
- ctx->dispatcher().glOrtho(X2F(left),X2F(right),X2F(bottom),X2F(top),X2F(zNear),X2F(zFar));
-}
-
-GL_API void GL_APIENTRY glPixelStorei( GLenum pname, GLint param) {
- GET_CTX()
- SET_ERROR_IF(!(pname == GL_PACK_ALIGNMENT || pname == GL_UNPACK_ALIGNMENT),GL_INVALID_ENUM);
- SET_ERROR_IF(!((param==1)||(param==2)||(param==4)||(param==8)), GL_INVALID_VALUE);
- ctx->setUnpackAlignment(param);
- ctx->dispatcher().glPixelStorei(pname,param);
-}
-
-GL_API void GL_APIENTRY glPointParameterf( GLenum pname, GLfloat param) {
- GET_CTX()
- ctx->dispatcher().glPointParameterf(pname,param);
-}
-
-GL_API void GL_APIENTRY glPointParameterfv( GLenum pname, const GLfloat *params) {
- GET_CTX()
- ctx->dispatcher().glPointParameterfv(pname,params);
-}
-
-GL_API void GL_APIENTRY glPointParameterx( GLenum pname, GLfixed param)
-{
- GET_CTX()
- ctx->dispatcher().glPointParameterf(pname,X2F(param));
-}
-
-GL_API void GL_APIENTRY glPointParameterxv( GLenum pname, const GLfixed *params) {
- GET_CTX()
-
- GLfloat tmpParam = X2F(*params) ;
- ctx->dispatcher().glPointParameterfv(pname,&tmpParam);
-}
-
-GL_API void GL_APIENTRY glPointSize( GLfloat size) {
- GET_CTX()
- ctx->dispatcher().glPointSize(size);
-}
-
-GL_API void GL_APIENTRY glPointSizePointerOES( GLenum type, GLsizei stride, const GLvoid *pointer) {
- GET_CTX()
- SET_ERROR_IF(stride < 0,GL_INVALID_VALUE);
- SET_ERROR_IF(!GLEScmValidate::pointPointerType(type),GL_INVALID_ENUM);
- ctx->setPointer(GL_POINT_SIZE_ARRAY_OES,1,type,stride,pointer);
-}
-
-GL_API void GL_APIENTRY glPointSizex( GLfixed size) {
- GET_CTX()
- ctx->dispatcher().glPointSize(X2F(size));
-}
-
-GL_API void GL_APIENTRY glPolygonOffset( GLfloat factor, GLfloat units) {
- GET_CTX()
- ctx->dispatcher().glPolygonOffset(factor,units);
-}
-
-GL_API void GL_APIENTRY glPolygonOffsetx( GLfixed factor, GLfixed units) {
- GET_CTX()
- ctx->dispatcher().glPolygonOffset(X2F(factor),X2F(units));
-}
-
-GL_API void GL_APIENTRY glPopMatrix(void) {
- GET_CTX()
- ctx->dispatcher().glPopMatrix();
-}
-
-GL_API void GL_APIENTRY glPushMatrix(void) {
- GET_CTX()
- ctx->dispatcher().glPushMatrix();
-}
-
-GL_API void GL_APIENTRY glReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) {
- GET_CTX()
- SET_ERROR_IF(!(GLEScmValidate::pixelFrmt(ctx,format) && GLEScmValidate::pixelType(ctx,type)),GL_INVALID_ENUM);
- SET_ERROR_IF(!(GLEScmValidate::pixelOp(format,type)),GL_INVALID_OPERATION);
-
- ctx->dispatcher().glReadPixels(x,y,width,height,format,type,pixels);
-}
-
-GL_API void GL_APIENTRY glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
- GET_CTX()
- ctx->dispatcher().glRotatef(angle,x,y,z);
-}
-
-GL_API void GL_APIENTRY glRotatex( GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
- GET_CTX()
- ctx->dispatcher().glRotatef(angle,X2F(x),X2F(y),X2F(z));
-}
-
-GL_API void GL_APIENTRY glSampleCoverage( GLclampf value, GLboolean invert) {
- GET_CTX()
- ctx->dispatcher().glSampleCoverage(value,invert);
-}
-
-GL_API void GL_APIENTRY glSampleCoveragex( GLclampx value, GLboolean invert) {
- GET_CTX()
- ctx->dispatcher().glSampleCoverage(X2F(value),invert);
-}
-
-GL_API void GL_APIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z) {
- GET_CTX()
- ctx->dispatcher().glScalef(x,y,z);
-}
-
-GL_API void GL_APIENTRY glScalex( GLfixed x, GLfixed y, GLfixed z) {
- GET_CTX()
- ctx->dispatcher().glScalef(X2F(x),X2F(y),X2F(z));
-}
-
-GL_API void GL_APIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height) {
- GET_CTX()
- ctx->dispatcher().glScissor(x,y,width,height);
-}
-
-GL_API void GL_APIENTRY glShadeModel( GLenum mode) {
- GET_CTX()
- ctx->dispatcher().glShadeModel(mode);
-}
-
-GL_API void GL_APIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask) {
- GET_CTX()
- ctx->dispatcher().glStencilFunc(func,ref,mask);
-}
-
-GL_API void GL_APIENTRY glStencilMask( GLuint mask) {
- GET_CTX()
- ctx->dispatcher().glStencilMask(mask);
-}
-
-GL_API void GL_APIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass) {
- GET_CTX()
- SET_ERROR_IF(!(GLEScmValidate::stencilOp(fail) && GLEScmValidate::stencilOp(zfail) && GLEScmValidate::stencilOp(zpass)),GL_INVALID_ENUM);
- ctx->dispatcher().glStencilOp(fail,zfail,zpass);
-}
-
-GL_API void GL_APIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texCoordPointerParams(size,stride),GL_INVALID_VALUE);
- SET_ERROR_IF(!GLEScmValidate::texCoordPointerType(type),GL_INVALID_ENUM);
- ctx->setPointer(GL_TEXTURE_COORD_ARRAY,size,type,stride,pointer);
-}
-
-GL_API void GL_APIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM);
- ctx->dispatcher().glTexEnvf(target,pname,param);
-}
-
-GL_API void GL_APIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM);
- ctx->dispatcher().glTexEnvfv(target,pname,params);
-}
-
-GL_API void GL_APIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM);
- ctx->dispatcher().glTexEnvi(target,pname,param);
-}
-
-GL_API void GL_APIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM);
- ctx->dispatcher().glTexEnviv(target,pname,params);
-}
-
-GL_API void GL_APIENTRY glTexEnvx( GLenum target, GLenum pname, GLfixed param) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM);
- GLfloat tmpParam = static_cast<GLfloat>(param);
- ctx->dispatcher().glTexEnvf(target,pname,tmpParam);
-}
-
-GL_API void GL_APIENTRY glTexEnvxv( GLenum target, GLenum pname, const GLfixed *params) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM);
-
- GLfloat tmpParams[4];
- if(pname == GL_TEXTURE_ENV_COLOR) {
- for(int i =0;i<4;i++) {
- tmpParams[i] = X2F(params[i]);
- }
- } else {
- tmpParams[0] = static_cast<GLfloat>(params[0]);
- }
- ctx->dispatcher().glTexEnvfv(target,pname,tmpParams);
-}
-
-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) {
- GET_CTX()
-
- SET_ERROR_IF(!(GLEScmValidate::textureTargetEx(target) &&
- GLEScmValidate::pixelFrmt(ctx,internalformat) &&
- GLEScmValidate::pixelFrmt(ctx,format) &&
- GLEScmValidate::pixelType(ctx,type)),GL_INVALID_ENUM);
-
- SET_ERROR_IF(!(GLEScmValidate::pixelOp(format,type) && internalformat == ((GLint)format)),GL_INVALID_OPERATION);
-
- bool needAutoMipmap = false;
-
- if (ctx->shareGroup().get() && level == 0){
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- if(texData) {
- texData->width = width;
- texData->height = height;
- texData->border = border;
- texData->internalFormat = internalformat;
- texData->target = target;
-
- if (texData->sourceEGLImage != 0) {
- //
- // This texture was a target of EGLImage,
- // but now it is re-defined so we need to detach
- // from the EGLImage and re-generate global texture name
- // for it.
- //
- if (texData->eglImageDetach) {
- (*texData->eglImageDetach)(texData->sourceEGLImage);
- }
- unsigned int tex = ctx->getBindedTexture(target);
- ctx->shareGroup()->genName(NamedObjectType::TEXTURE, tex,
- false);
- unsigned int globalTextureName =
- ctx->shareGroup()->getGlobalName(
- NamedObjectType::TEXTURE, tex);
- ctx->dispatcher().glBindTexture(GL_TEXTURE_2D,
- globalTextureName);
- texData->sourceEGLImage = 0;
- }
-
- needAutoMipmap = texData->requiresAutoMipmap;
- }
- }
-
- ctx->dispatcher().glTexImage2D(target,level,
- internalformat,width,height,
- border,format,type,pixels);
-
- if(needAutoMipmap)
- {
- ctx->dispatcher().glGenerateMipmapEXT(target);
- }
-}
-
-static bool handleMipmapGeneration(GLenum target, GLenum pname, bool param)
-{
- GET_CTX_RET(false)
-
- if(pname == GL_GENERATE_MIPMAP && !ctx->isAutoMipmapSupported())
- {
- TextureData *texData = getTextureTargetData(target);
- if(texData)
- {
- texData->requiresAutoMipmap = param;
- }
- return true;
- }
-
- return false;
-}
-
-GL_API void GL_APIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM);
-
- if(handleMipmapGeneration(target, pname, (bool)param))
- return;
-
- ctx->dispatcher().glTexParameterf(target,pname,param);
-}
-
-GL_API void GL_APIENTRY glTexParameterfv( GLenum target, GLenum pname, const GLfloat *params) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM);
-
- if(handleMipmapGeneration(target, pname, (bool)(*params)))
- return;
-
- if (pname==GL_TEXTURE_CROP_RECT_OES) {
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- for (int i=0;i<4;++i)
- texData->crop_rect[i] = params[i];
- }
- else {
- ctx->dispatcher().glTexParameterfv(target,pname,params);
- }
-}
-
-GL_API void GL_APIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM);
-
- if(handleMipmapGeneration(target, pname, (bool)param))
- return;
-
- ctx->dispatcher().glTexParameteri(target,pname,param);
-}
-
-GL_API void GL_APIENTRY glTexParameteriv( GLenum target, GLenum pname, const GLint *params) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM);
-
- if(handleMipmapGeneration(target, pname, (bool)(*params)))
- return;
-
- if (pname==GL_TEXTURE_CROP_RECT_OES) {
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- for (int i=0;i<4;++i)
- texData->crop_rect[i] = params[i];
- }
- else {
- ctx->dispatcher().glTexParameteriv(target,pname,params);
- }
-}
-
-GL_API void GL_APIENTRY glTexParameterx( GLenum target, GLenum pname, GLfixed param) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM);
-
- if(handleMipmapGeneration(target, pname, (bool)param))
- return;
-
- ctx->dispatcher().glTexParameterf(target,pname,static_cast<GLfloat>(param));
-}
-
-GL_API void GL_APIENTRY glTexParameterxv( GLenum target, GLenum pname, const GLfixed *params) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM);
-
- if(handleMipmapGeneration(target, pname, (bool)(*params)))
- return;
-
- if (pname==GL_TEXTURE_CROP_RECT_OES) {
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- for (int i=0;i<4;++i)
- texData->crop_rect[i] = X2F(params[i]);
- }
- else {
- GLfloat param = static_cast<GLfloat>(params[0]);
- ctx->dispatcher().glTexParameterfv(target,pname,&param);
- }
-}
-
-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) {
- GET_CTX()
- SET_ERROR_IF(!(GLEScmValidate::textureTargetEx(target) &&
- GLEScmValidate::pixelFrmt(ctx,format)&&
- GLEScmValidate::pixelType(ctx,type)),GL_INVALID_ENUM);
- SET_ERROR_IF(!GLEScmValidate::pixelOp(format,type),GL_INVALID_OPERATION);
- // set an error if level < 0 or level > log 2 max
- SET_ERROR_IF(level < 0 || 1<<level > ctx->getMaxTexSize(), GL_INVALID_VALUE);
- SET_ERROR_IF(xoffset < 0 || yoffset < 0 || width < 0 || height < 0, GL_INVALID_VALUE);
- if (ctx->shareGroup().get()) {
- TextureData *texData = getTextureTargetData(target);
- if (texData) {
- SET_ERROR_IF(xoffset + width > (GLint)texData->width ||
- yoffset + height > (GLint)texData->height,
- GL_INVALID_VALUE);
- }
- }
- SET_ERROR_IF(!pixels,GL_INVALID_OPERATION);
-
- ctx->dispatcher().glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels);
-
- if (ctx->shareGroup().get()){
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- if(texData && texData->requiresAutoMipmap)
- {
- ctx->dispatcher().glGenerateMipmapEXT(target);
- }
- }
-}
-
-GL_API void GL_APIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z) {
- GET_CTX()
- ctx->dispatcher().glTranslatef(x,y,z);
-}
-
-GL_API void GL_APIENTRY glTranslatex( GLfixed x, GLfixed y, GLfixed z) {
- GET_CTX()
- ctx->dispatcher().glTranslatef(X2F(x),X2F(y),X2F(z));
-}
-
-GL_API void GL_APIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::vertexPointerParams(size,stride),GL_INVALID_VALUE);
- SET_ERROR_IF(!GLEScmValidate::vertexPointerType(type),GL_INVALID_ENUM);
- ctx->setPointer(GL_VERTEX_ARRAY,size,type,stride,pointer);
-}
-
-GL_API void GL_APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height) {
- GET_CTX()
- ctx->dispatcher().glViewport(x,y,width,height);
-}
-
-GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- GET_CTX();
- SET_ERROR_IF(!GLEScmValidate::textureTargetLimited(target),GL_INVALID_ENUM);
- unsigned int imagehndl = SafeUIntFromPointer(image);
- EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl);
- if (img) {
- // Create the texture object in the underlying EGL implementation,
- // flag to the OpenGL layer to skip the image creation and map the
- // current binded texture object to the existing global object.
- if (ctx->shareGroup().get()) {
- ObjectLocalName tex = TextureLocalName(target,ctx->getBindedTexture(target));
- unsigned int oldGlobal = ctx->shareGroup()->getGlobalName(
- NamedObjectType::TEXTURE, tex);
- // Delete old texture object but only if it is not a target of a EGLImage
- if (oldGlobal) {
- TextureData* oldTexData = getTextureData(tex);
- if (!oldTexData || oldTexData->sourceEGLImage == 0) {
- ctx->shareGroup()->decTexRefCounterAndReleaseIf0(oldGlobal);
- }
- }
- // replace mapping and bind the new global object
- ctx->shareGroup()->replaceGlobalName(NamedObjectType::TEXTURE, tex,
- img->globalTexName);
- ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, img->globalTexName);
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- texData->width = img->width;
- texData->height = img->height;
- texData->border = img->border;
- texData->internalFormat = img->internalFormat;
- texData->sourceEGLImage = imagehndl;
- texData->eglImageDetach = s_eglIface->eglDetachEGLImage;
- }
- }
-}
-
-GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
- GET_CTX();
- SET_ERROR_IF(target != GL_RENDERBUFFER_OES,GL_INVALID_ENUM);
- unsigned int imagehndl = SafeUIntFromPointer(image);
- EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl);
- SET_ERROR_IF(!img,GL_INVALID_VALUE);
- SET_ERROR_IF(!ctx->shareGroup().get(),GL_INVALID_OPERATION);
-
- // Get current bounded renderbuffer
- // raise INVALID_OPERATIOn if no renderbuffer is bounded
- GLuint rb = ctx->getRenderbufferBinding();
- SET_ERROR_IF(rb == 0,GL_INVALID_OPERATION);
- ObjectDataPtr objData =
- ctx->shareGroup()->getObjectData(NamedObjectType::RENDERBUFFER, rb);
- RenderbufferData *rbData = (RenderbufferData *)objData.get();
- SET_ERROR_IF(!rbData,GL_INVALID_OPERATION);
-
- //
- // flag in the renderbufferData that it is an eglImage target
- //
- rbData->sourceEGLImage = imagehndl;
- rbData->eglImageDetach = s_eglIface->eglDetachEGLImage;
- rbData->eglImageGlobalTexName = img->globalTexName;
-
- //
- // if the renderbuffer is attached to a framebuffer
- // change the framebuffer attachment in the undelying OpenGL
- // to point to the eglImage texture object.
- //
- if (rbData->attachedFB) {
- // update the framebuffer attachment point to the
- // underlying texture of the img
- GLuint prevFB = ctx->getFramebufferBinding();
- if (prevFB != rbData->attachedFB) {
- ctx->dispatcher().glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,
- rbData->attachedFB);
- }
- ctx->dispatcher().glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
- rbData->attachedPoint,
- GL_TEXTURE_2D,
- img->globalTexName,0);
- if (prevFB != rbData->attachedFB) {
- ctx->dispatcher().glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,
- prevFB);
- }
- }
-}
-
-/* GL_OES_blend_subtract*/
-GL_API void GL_APIENTRY glBlendEquationOES(GLenum mode) {
- GET_CTX()
- SET_ERROR_IF(!(GLEScmValidate::blendEquationMode(mode)), GL_INVALID_ENUM);
- ctx->dispatcher().glBlendEquation(mode);
-}
-
-/* GL_OES_blend_equation_separate */
-GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha) {
- GET_CTX()
- SET_ERROR_IF(!(GLEScmValidate::blendEquationMode(modeRGB) && GLEScmValidate::blendEquationMode(modeAlpha)), GL_INVALID_ENUM);
- ctx->dispatcher().glBlendEquationSeparate(modeRGB,modeAlpha);
-}
-
-/* GL_OES_blend_func_separate */
-GL_API void GL_APIENTRY glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::blendSrc(srcRGB) || !GLEScmValidate::blendDst(dstRGB) ||
- !GLEScmValidate::blendSrc(srcAlpha) || ! GLEScmValidate::blendDst(dstAlpha) ,GL_INVALID_ENUM);
- ctx->dispatcher().glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha);
-}
-
-/* GL_OES_framebuffer_object */
-GL_API GLboolean GL_APIENTRY glIsRenderbufferOES(GLuint renderbuffer) {
- GET_CTX_RET(GL_FALSE)
- RET_AND_SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION,GL_FALSE);
- if(renderbuffer && ctx->shareGroup().get()){
- return ctx->shareGroup()->isObject(NamedObjectType::RENDERBUFFER,
- renderbuffer)
- ? GL_TRUE
- : GL_FALSE;
- }
- return ctx->dispatcher().glIsRenderbufferEXT(renderbuffer);
-}
-
-GL_API void GLAPIENTRY glBindRenderbufferOES(GLenum target, GLuint renderbuffer) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLEScmValidate::renderbufferTarget(target),GL_INVALID_ENUM);
-
- //if buffer wasn't generated before,generate one
- if (renderbuffer && ctx->shareGroup().get() &&
- !ctx->shareGroup()->isObject(NamedObjectType::RENDERBUFFER,
- renderbuffer)) {
- ctx->shareGroup()->genName(NamedObjectType::RENDERBUFFER, renderbuffer);
- ctx->shareGroup()->setObjectData(NamedObjectType::RENDERBUFFER,
- renderbuffer,
- ObjectDataPtr(new RenderbufferData()));
- }
-
- int globalBufferName =
- (renderbuffer != 0)
- ? ctx->shareGroup()->getGlobalName(
- NamedObjectType::RENDERBUFFER, renderbuffer)
- : 0;
- ctx->dispatcher().glBindRenderbufferEXT(target,globalBufferName);
-
- // update renderbuffer binding state
- ctx->setRenderbufferBinding(renderbuffer);
-}
-
-GL_API void GLAPIENTRY glDeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- for (int i=0;i<n;++i) {
- ctx->shareGroup()->deleteName(NamedObjectType::RENDERBUFFER,
- renderbuffers[i]);
- }
-}
-
-GL_API void GLAPIENTRY glGenRenderbuffersOES(GLsizei n, GLuint *renderbuffers) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i<n ;i++) {
- renderbuffers[i] = ctx->shareGroup()->genName(
- NamedObjectType::RENDERBUFFER, 0, true);
- ctx->shareGroup()->setObjectData(
- NamedObjectType::RENDERBUFFER, renderbuffers[i],
- ObjectDataPtr(new RenderbufferData()));
- }
- }
-}
-
-GL_API void GLAPIENTRY glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height){
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLEScmValidate::renderbufferTarget(target) || !GLEScmValidate::renderbufferInternalFrmt(ctx,internalformat) ,GL_INVALID_ENUM);
- if (internalformat==GL_RGB565_OES) //RGB565 not supported by GL
- internalformat = GL_RGB8_OES;
-
- // Get current bounded renderbuffer
- // raise INVALID_OPERATIOn if no renderbuffer is bounded
- GLuint rb = ctx->getRenderbufferBinding();
- SET_ERROR_IF(rb == 0,GL_INVALID_OPERATION);
- ObjectDataPtr objData =
- ctx->shareGroup()->getObjectData(NamedObjectType::RENDERBUFFER, rb);
- RenderbufferData *rbData = (RenderbufferData *)objData.get();
- SET_ERROR_IF(!rbData,GL_INVALID_OPERATION);
-
- //
- // if the renderbuffer was an eglImage target, detach from
- // the eglImage.
- //
- if (rbData->sourceEGLImage != 0) {
- if (rbData->eglImageDetach) {
- (*rbData->eglImageDetach)(rbData->sourceEGLImage);
- }
- rbData->sourceEGLImage = 0;
- rbData->eglImageGlobalTexName = 0;
- }
-
- ctx->dispatcher().glRenderbufferStorageEXT(target,internalformat,width,height);
-}
-
-GL_API void GLAPIENTRY glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLEScmValidate::renderbufferTarget(target) || !GLEScmValidate::renderbufferParams(pname) ,GL_INVALID_ENUM);
-
- //
- // If this is a renderbuffer which is eglimage's target, we
- // should query the underlying eglimage's texture object instead.
- //
- GLuint rb = ctx->getRenderbufferBinding();
- if (rb) {
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(
- NamedObjectType::RENDERBUFFER, rb);
- RenderbufferData *rbData = (RenderbufferData *)objData.get();
- if (rbData && rbData->sourceEGLImage != 0) {
- GLenum texPname;
- switch(pname) {
- case GL_RENDERBUFFER_WIDTH_OES:
- texPname = GL_TEXTURE_WIDTH;
- break;
- case GL_RENDERBUFFER_HEIGHT_OES:
- texPname = GL_TEXTURE_HEIGHT;
- break;
- case GL_RENDERBUFFER_INTERNAL_FORMAT_OES:
- texPname = GL_TEXTURE_INTERNAL_FORMAT;
- break;
- case GL_RENDERBUFFER_RED_SIZE_OES:
- texPname = GL_TEXTURE_RED_SIZE;
- break;
- case GL_RENDERBUFFER_GREEN_SIZE_OES:
- texPname = GL_TEXTURE_GREEN_SIZE;
- break;
- case GL_RENDERBUFFER_BLUE_SIZE_OES:
- texPname = GL_TEXTURE_BLUE_SIZE;
- break;
- case GL_RENDERBUFFER_ALPHA_SIZE_OES:
- texPname = GL_TEXTURE_ALPHA_SIZE;
- break;
- case GL_RENDERBUFFER_DEPTH_SIZE_OES:
- texPname = GL_TEXTURE_DEPTH_SIZE;
- break;
- case GL_RENDERBUFFER_STENCIL_SIZE_OES:
- default:
- *params = 0; //XXX
- return;
- break;
- }
-
- GLint prevTex;
- ctx->dispatcher().glGetIntegerv(GL_TEXTURE_BINDING_2D, &prevTex);
- ctx->dispatcher().glBindTexture(GL_TEXTURE_2D,
- rbData->eglImageGlobalTexName);
- ctx->dispatcher().glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
- texPname,
- params);
- ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, prevTex);
- return;
- }
- }
-
- ctx->dispatcher().glGetRenderbufferParameterivEXT(target,pname,params);
-}
-
-GL_API GLboolean GLAPIENTRY glIsFramebufferOES(GLuint framebuffer) {
- GET_CTX_RET(GL_FALSE)
- RET_AND_SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION,GL_FALSE);
- if (framebuffer && ctx->shareGroup().get()) {
- return ctx->shareGroup()->isObject(NamedObjectType::FRAMEBUFFER,
- framebuffer)
- ? GL_TRUE
- : GL_FALSE;
- }
- return ctx->dispatcher().glIsFramebufferEXT(framebuffer);
-}
-
-GL_API void GLAPIENTRY glBindFramebufferOES(GLenum target, GLuint framebuffer) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) ,GL_INVALID_ENUM);
- if (framebuffer && ctx->shareGroup().get() &&
- !ctx->shareGroup()->isObject(NamedObjectType::FRAMEBUFFER,
- framebuffer)) {
- ctx->shareGroup()->genName(NamedObjectType::FRAMEBUFFER, framebuffer);
- ctx->shareGroup()->setObjectData(
- NamedObjectType::FRAMEBUFFER, framebuffer,
- ObjectDataPtr(new FramebufferData(framebuffer)));
- }
- int globalBufferName =
- (framebuffer != 0)
- ? ctx->shareGroup()->getGlobalName(
- NamedObjectType::FRAMEBUFFER, framebuffer)
- : 0;
- ctx->dispatcher().glBindFramebufferEXT(target,globalBufferName);
-
- // update framebuffer binding state
- ctx->setFramebufferBinding(framebuffer);
-}
-
-GL_API void GLAPIENTRY glDeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- for (int i=0;i<n;++i) {
- ctx->shareGroup()->deleteName(NamedObjectType::FRAMEBUFFER,
- framebuffers[i]);
- }
-}
-
-GL_API void GLAPIENTRY glGenFramebuffersOES(GLsizei n, GLuint *framebuffers) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if (ctx->shareGroup().get()) {
- for (int i=0;i<n;i++) {
- framebuffers[i] = ctx->shareGroup()->genName(
- NamedObjectType::FRAMEBUFFER, 0, true);
- ctx->shareGroup()->setObjectData(
- NamedObjectType::FRAMEBUFFER, framebuffers[i],
- ObjectDataPtr(new FramebufferData(framebuffers[i])));
- }
- }
-}
-
-GL_API GLenum GLAPIENTRY glCheckFramebufferStatusOES(GLenum target) {
- GET_CTX_RET(0)
- RET_AND_SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION,0);
- RET_AND_SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) ,GL_INVALID_ENUM,0);
- return ctx->dispatcher().glCheckFramebufferStatusEXT(target);
-}
-
-GL_API void GLAPIENTRY glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) || !GLEScmValidate::framebufferAttachment(attachment) ||
- !GLEScmValidate::textureTargetEx(textarget),GL_INVALID_ENUM);
- SET_ERROR_IF(!ctx->shareGroup().get(), GL_INVALID_OPERATION);
-
- GLuint globalTexName = 0;
- if(texture) {
- if (!ctx->shareGroup()->isObject(NamedObjectType::TEXTURE, texture)) {
- ctx->shareGroup()->genName(NamedObjectType::TEXTURE, texture);
- }
- ObjectLocalName texname = TextureLocalName(textarget,texture);
- globalTexName = ctx->shareGroup()->getGlobalName(
- NamedObjectType::TEXTURE, texname);
- }
-
- ctx->dispatcher().glFramebufferTexture2DEXT(target,attachment,textarget,globalTexName,level);
-
- // Update the the current framebuffer object attachment state
- GLuint fbName = ctx->getFramebufferBinding();
- ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(
- NamedObjectType::FRAMEBUFFER, fbName);
- if (fbObj.get() != NULL) {
- FramebufferData *fbData = (FramebufferData *)fbObj.get();
- fbData->setAttachment(attachment, textarget,
- texture, ObjectDataPtr());
- }
-}
-
-GL_API void GLAPIENTRY glFramebufferRenderbufferOES(GLenum target, GLenum attachment,GLenum renderbuffertarget, GLuint renderbuffer) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) ||
- !GLEScmValidate::framebufferAttachment(attachment) ||
- !GLEScmValidate::renderbufferTarget(renderbuffertarget), GL_INVALID_ENUM);
-
- SET_ERROR_IF(!ctx->shareGroup().get(), GL_INVALID_OPERATION);
-
- GLuint globalBufferName = 0;
- ObjectDataPtr obj;
-
- // generate the renderbuffer object if not yet exist
- if (renderbuffer) {
- if (!ctx->shareGroup()->isObject(NamedObjectType::RENDERBUFFER,
- renderbuffer)) {
- ctx->shareGroup()->genName(NamedObjectType::RENDERBUFFER,
- renderbuffer);
- obj = ObjectDataPtr(new RenderbufferData());
- ctx->shareGroup()->setObjectData(
- NamedObjectType::RENDERBUFFER, renderbuffer,
- ObjectDataPtr(new RenderbufferData()));
- }
- else {
- obj = ctx->shareGroup()->getObjectData(
- NamedObjectType::RENDERBUFFER, renderbuffer);
- }
- globalBufferName = ctx->shareGroup()->getGlobalName(
- NamedObjectType::RENDERBUFFER, renderbuffer);
- }
-
- // Update the the current framebuffer object attachment state
- GLuint fbName = ctx->getFramebufferBinding();
- ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(
- NamedObjectType::FRAMEBUFFER, fbName);
- if (fbObj.get() != NULL) {
- FramebufferData *fbData = (FramebufferData *)fbObj.get();
- fbData->setAttachment(attachment, renderbuffertarget, renderbuffer, obj);
- }
-
- if (renderbuffer && obj.get() != NULL) {
- RenderbufferData *rbData = (RenderbufferData *)obj.get();
- if (rbData->sourceEGLImage != 0) {
- //
- // This renderbuffer object is an eglImage target
- // attach the eglimage's texture instead the renderbuffer.
- //
- ctx->dispatcher().glFramebufferTexture2DEXT(target,
- attachment,
- GL_TEXTURE_2D,
- rbData->eglImageGlobalTexName,0);
- return;
- }
- }
-
- ctx->dispatcher().glFramebufferRenderbufferEXT(target,attachment,renderbuffertarget,globalBufferName);
-}
-
-GL_API void GLAPIENTRY glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint *params) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) || !GLEScmValidate::framebufferAttachment(attachment) ||
- !GLEScmValidate::framebufferAttachmentParams(pname), GL_INVALID_ENUM);
-
- //
- // Take the attachment attribute from our state - if available
- //
- GLuint fbName = ctx->getFramebufferBinding();
- if (fbName) {
- ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(
- NamedObjectType::FRAMEBUFFER, fbName);
- if (fbObj.get() != NULL) {
- FramebufferData *fbData = (FramebufferData *)fbObj.get();
- GLenum target;
- GLuint name = fbData->getAttachment(attachment, &target, NULL);
- if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES) {
- *params = target;
- return;
- }
- else if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES) {
- *params = name;
- return;
- }
- }
- }
-
- ctx->dispatcher().glGetFramebufferAttachmentParameterivEXT(target,attachment,pname,params);
-}
-
-GL_API void GL_APIENTRY glGenerateMipmapOES(GLenum target) {
- GET_CTX()
- SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLEScmValidate::textureTargetLimited(target),GL_INVALID_ENUM);
- if (ctx->shareGroup().get()) {
- TextureData *texData = getTextureTargetData(target);
- if (texData) {
- unsigned int width = texData->width;
- unsigned int height = texData->height;
- // set error code if either the width or height is not a power of two.
- SET_ERROR_IF(width == 0 || height == 0 ||
- (width & (width - 1)) != 0 || (height & (height - 1)) != 0,
- GL_INVALID_OPERATION);
- }
- }
- ctx->dispatcher().glGenerateMipmapEXT(target);
-}
-
-GL_API void GL_APIENTRY glCurrentPaletteMatrixOES(GLuint index) {
- GET_CTX()
- SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION);
- ctx->dispatcher().glCurrentPaletteMatrixARB(index);
-}
-
-GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES() {
- GET_CTX()
- SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION);
- GLint matrix[16];
- ctx->dispatcher().glGetIntegerv(GL_MODELVIEW_MATRIX,matrix);
- ctx->dispatcher().glMatrixIndexuivARB(1,(GLuint*)matrix);
-
-}
-
-GL_API void GL_APIENTRY glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GET_CTX()
- SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION);
- ctx->dispatcher().glMatrixIndexPointerARB(size,type,stride,pointer);
-}
-
-GL_API void GL_APIENTRY glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
- GET_CTX()
- SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION);
- ctx->dispatcher().glWeightPointerARB(size,type,stride,pointer);
-
-}
-
-GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
- if (coord == GL_TEXTURE_GEN_STR_OES) {
- ctx->dispatcher().glTexGenf(GL_S,pname,param);
- ctx->dispatcher().glTexGenf(GL_T,pname,param);
- ctx->dispatcher().glTexGenf(GL_R,pname,param);
- }
- else
- ctx->dispatcher().glTexGenf(coord,pname,param);
-}
-
-GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
- if (coord == GL_TEXTURE_GEN_STR_OES) {
- ctx->dispatcher().glTexGenfv(GL_S,pname,params);
- ctx->dispatcher().glTexGenfv(GL_T,pname,params);
- ctx->dispatcher().glTexGenfv(GL_R,pname,params);
- }
- else
- ctx->dispatcher().glTexGenfv(coord,pname,params);
-}
-GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
- if (coord == GL_TEXTURE_GEN_STR_OES) {
- ctx->dispatcher().glTexGeni(GL_S,pname,param);
- ctx->dispatcher().glTexGeni(GL_T,pname,param);
- ctx->dispatcher().glTexGeni(GL_R,pname,param);
- }
- else
- ctx->dispatcher().glTexGeni(coord,pname,param);
-}
-GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
- if (coord == GL_TEXTURE_GEN_STR_OES) {
- ctx->dispatcher().glTexGeniv(GL_S,pname,params);
- ctx->dispatcher().glTexGeniv(GL_T,pname,params);
- ctx->dispatcher().glTexGeniv(GL_R,pname,params);
- }
- else
- ctx->dispatcher().glTexGeniv(coord,pname,params);
-}
-GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param) {
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
- if (coord == GL_TEXTURE_GEN_STR_OES) {
- ctx->dispatcher().glTexGenf(GL_S,pname,X2F(param));
- ctx->dispatcher().glTexGenf(GL_T,pname,X2F(param));
- ctx->dispatcher().glTexGenf(GL_R,pname,X2F(param));
- }
- else
- ctx->dispatcher().glTexGenf(coord,pname,X2F(param));
-}
-GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params) {
- GLfloat tmpParams[1];
- GET_CTX()
- SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
- tmpParams[0] = X2F(params[0]);
- if (coord == GL_TEXTURE_GEN_STR_OES) {
- ctx->dispatcher().glTexGenfv(GL_S,pname,tmpParams);
- ctx->dispatcher().glTexGenfv(GL_T,pname,tmpParams);
- ctx->dispatcher().glTexGenfv(GL_R,pname,tmpParams);
- }
- else
- ctx->dispatcher().glTexGenfv(coord,pname,tmpParams);
-}
-
-GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params) {
- GET_CTX()
- if (coord == GL_TEXTURE_GEN_STR_OES)
- {
- GLfloat state_s = GL_FALSE;
- GLfloat state_t = GL_FALSE;
- GLfloat state_r = GL_FALSE;
- ctx->dispatcher().glGetTexGenfv(GL_S,pname,&state_s);
- ctx->dispatcher().glGetTexGenfv(GL_T,pname,&state_t);
- ctx->dispatcher().glGetTexGenfv(GL_R,pname,&state_r);
- *params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE;
- }
- else
- ctx->dispatcher().glGetTexGenfv(coord,pname,params);
-
-}
-GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params) {
- GET_CTX()
- if (coord == GL_TEXTURE_GEN_STR_OES)
- {
- GLint state_s = GL_FALSE;
- GLint state_t = GL_FALSE;
- GLint state_r = GL_FALSE;
- ctx->dispatcher().glGetTexGeniv(GL_S,pname,&state_s);
- ctx->dispatcher().glGetTexGeniv(GL_T,pname,&state_t);
- ctx->dispatcher().glGetTexGeniv(GL_R,pname,&state_r);
- *params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE;
- }
- else
- ctx->dispatcher().glGetTexGeniv(coord,pname,params);
-}
-
-GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params) {
- GET_CTX()
- GLfloat tmpParams[1];
-
- if (coord == GL_TEXTURE_GEN_STR_OES)
- {
- GLfloat state_s = GL_FALSE;
- GLfloat state_t = GL_FALSE;
- GLfloat state_r = GL_FALSE;
- ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_S,pname,&state_s);
- ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_T,pname,&state_t);
- ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_R,pname,&state_r);
- tmpParams[0] = state_s && state_t && state_r ? GL_TRUE: GL_FALSE;
- }
- else
- ctx->dispatcher().glGetTexGenfv(coord,pname,tmpParams);
-
- params[0] = F2X(tmpParams[1]);
-}
-
-template <class T, GLenum TypeName>
-void glDrawTexOES (T x, T y, T z, T width, T height) {
- GET_CTX()
-
- SET_ERROR_IF((width<=0 || height<=0),GL_INVALID_VALUE);
-
- ctx->drawValidate();
-
- int numClipPlanes;
-
- GLint viewport[4] = {};
- z = (z>1 ? 1 : (z<0 ? 0 : z));
-
- T vertices[4*3] = {
- x , y, z,
- x , static_cast<T>(y+height), z,
- static_cast<T>(x+width), static_cast<T>(y+height), z,
- static_cast<T>(x+width), y, z
- };
- GLfloat texels[ctx->getMaxTexUnits()][4*2];
- memset((void*)texels, 0, ctx->getMaxTexUnits()*4*2*sizeof(GLfloat));
-
- ctx->dispatcher().glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
- ctx->dispatcher().glPushAttrib(GL_TRANSFORM_BIT);
-
- //setup projection matrix to draw in viewport aligned coordinates
- ctx->dispatcher().glMatrixMode(GL_PROJECTION);
- ctx->dispatcher().glPushMatrix();
- ctx->dispatcher().glLoadIdentity();
- ctx->dispatcher().glGetIntegerv(GL_VIEWPORT,viewport);
- ctx->dispatcher().glOrtho(viewport[0],viewport[0] + viewport[2],viewport[1],viewport[1]+viewport[3],0,-1);
- //setup texture matrix
- ctx->dispatcher().glMatrixMode(GL_TEXTURE);
- ctx->dispatcher().glPushMatrix();
- ctx->dispatcher().glLoadIdentity();
- //setup modelview matrix
- ctx->dispatcher().glMatrixMode(GL_MODELVIEW);
- ctx->dispatcher().glPushMatrix();
- ctx->dispatcher().glLoadIdentity();
- //backup vbo's
- int array_buffer,element_array_buffer;
- glGetIntegerv(GL_ARRAY_BUFFER_BINDING,&array_buffer);
- glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING,&element_array_buffer);
- ctx->dispatcher().glBindBuffer(GL_ARRAY_BUFFER,0);
- ctx->dispatcher().glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
-
- //disable clip planes
- ctx->dispatcher().glGetIntegerv(GL_MAX_CLIP_PLANES,&numClipPlanes);
- for (int i=0;i<numClipPlanes;++i)
- ctx->dispatcher().glDisable(GL_CLIP_PLANE0+i);
-
- int nTexPtrs = 0;
- for (int i=0;i<ctx->getMaxTexUnits();++i) {
- if (ctx->isTextureUnitEnabled(GL_TEXTURE0+i)) {
- TextureData * texData = NULL;
- unsigned int texname = ctx->getBindedTexture(GL_TEXTURE0+i,GL_TEXTURE_2D);
- ObjectLocalName tex = TextureLocalName(GL_TEXTURE_2D,texname);
- ctx->dispatcher().glClientActiveTexture(GL_TEXTURE0+i);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(
- NamedObjectType::TEXTURE, tex);
- if (objData.get()) {
- texData = (TextureData*)objData.get();
- //calculate texels
- texels[i][0] = (float)(texData->crop_rect[0])/(float)(texData->width);
- texels[i][1] = (float)(texData->crop_rect[1])/(float)(texData->height);
-
- texels[i][2] = (float)(texData->crop_rect[0])/(float)(texData->width);
- texels[i][3] = (float)(texData->crop_rect[3]+texData->crop_rect[1])/(float)(texData->height);
-
- texels[i][4] = (float)(texData->crop_rect[2]+texData->crop_rect[0])/(float)(texData->width);
- texels[i][5] = (float)(texData->crop_rect[3]+texData->crop_rect[1])/(float)(texData->height);
-
- texels[i][6] = (float)(texData->crop_rect[2]+texData->crop_rect[0])/(float)(texData->width);
- texels[i][7] = (float)(texData->crop_rect[1])/(float)(texData->height);
-
- ctx->dispatcher().glTexCoordPointer(2,GL_FLOAT,0,texels[i]);
- nTexPtrs++;
- }
- }
- }
-
- if (nTexPtrs>0) {
- //draw rectangle - only if we have some textures enabled & ready
- ctx->dispatcher().glEnableClientState(GL_VERTEX_ARRAY);
- ctx->dispatcher().glVertexPointer(3,TypeName,0,vertices);
- ctx->dispatcher().glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- ctx->dispatcher().glDrawArrays(GL_TRIANGLE_FAN,0,4);
- }
-
- //restore vbo's
- ctx->dispatcher().glBindBuffer(GL_ARRAY_BUFFER,array_buffer);
- ctx->dispatcher().glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,element_array_buffer);
-
- //restore matrix state
-
- ctx->dispatcher().glMatrixMode(GL_MODELVIEW);
- ctx->dispatcher().glPopMatrix();
- ctx->dispatcher().glMatrixMode(GL_TEXTURE);
- ctx->dispatcher().glPopMatrix();
- ctx->dispatcher().glMatrixMode(GL_PROJECTION);
- ctx->dispatcher().glPopMatrix();
-
- ctx->dispatcher().glPopAttrib();
- ctx->dispatcher().glPopClientAttrib();
-}
-
-GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) {
- glDrawTexOES<GLshort,GL_SHORT>(x,y,z,width,height);
-}
-
-GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height) {
- glDrawTexOES<GLint,GL_INT>(x,y,z,width,height);
-}
-
-GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) {
- glDrawTexOES<GLfloat,GL_FLOAT>(x,y,z,width,height);
-}
-
-GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) {
- glDrawTexOES<GLfloat,GL_FLOAT>(X2F(x),X2F(y),X2F(z),X2F(width),X2F(height));
-}
-
-GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort * coords) {
- glDrawTexOES<GLshort,GL_SHORT>(coords[0],coords[1],coords[2],coords[3],coords[4]);
-}
-
-GL_API void GL_APIENTRY glDrawTexivOES (const GLint * coords) {
- glDrawTexOES<GLint,GL_INT>(coords[0],coords[1],coords[2],coords[3],coords[4]);
-}
-
-GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat * coords) {
- glDrawTexOES<GLfloat,GL_FLOAT>(coords[0],coords[1],coords[2],coords[3],coords[4]);
-}
-
-GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed * coords) {
- glDrawTexOES<GLfloat,GL_FLOAT>(X2F(coords[0]),X2F(coords[1]),X2F(coords[2]),X2F(coords[3]),X2F(coords[4]));
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmUtils.cpp b/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmUtils.cpp
deleted file mode 100644
index 891b4e366..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmUtils.cpp
+++ /dev/null
@@ -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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmUtils.h b/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmUtils.h
deleted file mode 100644
index 38ad6bc65..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmUtils.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmValidate.cpp b/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmValidate.cpp
deleted file mode 100644
index 1970232c7..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmValidate.cpp
+++ /dev/null
@@ -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;
-}
-
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmValidate.h b/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmValidate.h
deleted file mode 100644
index 9bc33938e..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_CM/GLEScmValidate.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/Android.mk b/distrib/android-emugl/host/libs/Translator/GLES_V2/Android.mk
deleted file mode 100644
index 937b7a5df..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-host_common_SRC_FILES := \
- GLESv2Imp.cpp \
- GLESv2Context.cpp \
- GLESv2Validate.cpp \
- ShaderParser.cpp \
- ShaderValidator.cpp \
- ProgramData.cpp
-
-
-### GLES_V2 host implementation (On top of OpenGL) ########################
-$(call emugl-begin-shared-library,lib$(BUILD_TARGET_SUFFIX)GLES_V2_translator)
-$(call emugl-import, libGLcommon)
-
-LOCAL_SRC_FILES := $(host_common_SRC_FILES)
-
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Context.cpp b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Context.cpp
deleted file mode 100644
index f2829d193..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Context.cpp
+++ /dev/null
@@ -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.
-*/
-
-#include "GLESv2Context.h"
-#include <string.h>
-
-void GLESv2Context::init() {
- emugl::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);
-
- buildStrings((const char*)dispatcher().glGetString(GL_VENDOR),
- (const char*)dispatcher().glGetString(GL_RENDERER),
- (const char*)dispatcher().glGetString(GL_VERSION),
- "OpenGL ES 2.0");
- }
- m_initialized = true;
-}
-
-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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Context.h b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Context.h
deleted file mode 100644
index bca25f7af..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Context.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef GLES_V2_CONTEXT_H
-#define GLES_V2_CONTEXT_H
-
-#include <GLcommon/GLDispatch.h>
-#include <GLcommon/GLEScontext.h>
-#include <GLcommon/objectNameManager.h>
-
-class GLESv2Context : public GLEScontext{
-public:
- virtual void init(GlLibrary* glLib);
- virtual ~GLESv2Context();
- void setupArraysPointers(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct);
- int getMaxCombinedTexUnits();
- 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 = nullptr;
- unsigned int m_att0ArrayLength = 0;
- bool m_att0NeedsDisable = false;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
deleted file mode 100644
index 41d57686e..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
+++ /dev/null
@@ -1,2307 +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.
-*/
-
-#ifdef _WIN32
-#undef GL_APICALL
-#define GL_API __declspec(dllexport)
-#define GL_APICALL __declspec(dllexport)
-#endif
-
-#define GL_GLEXT_PROTOTYPES
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <GLES3/gl3.h>
-
-#include <OpenglCodecCommon/ErrorLog.h>
-#include <GLcommon/TranslatorIfaces.h>
-#include "GLESv2Context.h"
-#include "GLESv2Validate.h"
-#include "ShaderParser.h"
-#include "ProgramData.h"
-#include <GLcommon/TextureUtils.h>
-#include <GLcommon/FramebufferData.h>
-
-#include <stdio.h>
-
-extern "C" {
-
-//decleration
-static void initGLESx();
-static void initContext(GLEScontext* ctx,ShareGroupPtr grp);
-static void deleteGLESContext(GLEScontext* ctx);
-static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp);
-static GLEScontext* createGLESContext();
-static __translatorMustCastToProperFunctionPointerType getProcAddress(const char* procName);
-
-}
-
-/************************************** GLES EXTENSIONS *********************************************************/
-//extentions descriptor
-typedef std::map<std::string, __translatorMustCastToProperFunctionPointerType> ProcTableMap;
-ProcTableMap *s_glesExtensions = NULL;
-/****************************************************************************************************************/
-
-static EGLiface* s_eglIface = NULL;
-static GLESiface s_glesIface = {
- .initGLESx = initGLESx,
- .createGLESContext = createGLESContext,
- .initContext = initContext,
- .deleteGLESContext = deleteGLESContext,
- .flush = (FUNCPTR_NO_ARGS_RET_VOID)glFlush,
- .finish = (FUNCPTR_NO_ARGS_RET_VOID)glFinish,
- .setShareGroup = setShareGroup,
- .getProcAddress = getProcAddress,
- .fenceSync = (FUNCPTR_FENCE_SYNC)glFenceSync,
- .clientWaitSync = (FUNCPTR_CLIENT_WAIT_SYNC)glClientWaitSync,
- .deleteSync = (FUNCPTR_DELETE_SYNC)glDeleteSync,
-};
-
-#include <GLcommon/GLESmacros.h>
-
-extern "C" {
-
-static void initGLESx() {
- DBG("No special initialization necessary for GLES_V2\n");
- return;
-}
-
-static void initContext(GLEScontext* ctx,ShareGroupPtr grp) {
- if (!ctx->isInitialized()) {
- ctx->setShareGroup(grp);
- ctx->init(s_eglIface->eglGetGlLibrary());
- glBindTexture(GL_TEXTURE_2D,0);
- glBindTexture(GL_TEXTURE_CUBE_MAP,0);
- }
-}
-static GLEScontext* createGLESContext() {
- return new GLESv2Context();
-}
-
-static void deleteGLESContext(GLEScontext* ctx) {
- delete ctx;
-}
-
-static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp) {
- if(ctx) {
- ctx->setShareGroup(grp);
- }
-}
-
-static __translatorMustCastToProperFunctionPointerType getProcAddress(const char* procName) {
- GET_CTX_RET(NULL)
- ctx->getGlobalLock();
- static bool proc_table_initialized = false;
- if (!proc_table_initialized) {
- proc_table_initialized = true;
- if (!s_glesExtensions)
- s_glesExtensions = new ProcTableMap();
- else
- s_glesExtensions->clear();
- (*s_glesExtensions)["glEGLImageTargetTexture2DOES"] = (__translatorMustCastToProperFunctionPointerType)glEGLImageTargetTexture2DOES;
- (*s_glesExtensions)["glEGLImageTargetRenderbufferStorageOES"]=(__translatorMustCastToProperFunctionPointerType)glEGLImageTargetRenderbufferStorageOES;
- }
- __translatorMustCastToProperFunctionPointerType ret=NULL;
- ProcTableMap::iterator val = s_glesExtensions->find(procName);
- if (val!=s_glesExtensions->end())
- ret = val->second;
- ctx->releaseGlobalLock();
-
- return ret;
-}
-
-GL_APICALL GLESiface* GL_APIENTRY __translator_getIfaces(EGLiface* eglIface);
-
-GLESiface* __translator_getIfaces(EGLiface* eglIface) {
- s_eglIface = eglIface;
- return & s_glesIface;
-}
-
-} // extern "C"
-
-static void s_attachShader(GLEScontext* ctx, GLuint program, GLuint shader) {
- if (ctx && program && shader && ctx->shareGroup().get()) {
- ObjectDataPtr shaderData = ctx->shareGroup()->getObjectData(SHADER,shader);
- if (!shaderData.get()) return;
- ShaderParser* shaderParser = (ShaderParser*)shaderData.get();
- shaderParser->setAttachedProgram(program);
- }
-}
-
-static void s_detachShader(GLEScontext* ctx, GLuint shader) {
- if (ctx && shader && ctx->shareGroup().get()) {
- ObjectDataPtr shaderData = ctx->shareGroup()->getObjectData(SHADER,shader);
- if (!shaderData.get()) return;
- ShaderParser* shaderParser = (ShaderParser*)shaderData.get();
- shaderParser->setAttachedProgram(0);
- if (shaderParser->getDeleteStatus()) {
- ctx->shareGroup()->deleteName(SHADER, shader);
- }
- }
-}
-
-static ObjectLocalName TextureLocalName(GLenum target,unsigned int tex) {
- GET_CTX_RET(0);
- return (tex!=0? tex : ctx->getDefaultTextureName(target));
-}
-
-static TextureData* getTextureData(ObjectLocalName tex) {
- GET_CTX_RET(NULL);
- TextureData *texData = NULL;
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(TEXTURE,tex);
- if(!objData.get()){
- texData = new TextureData();
- ctx->shareGroup()->setObjectData(TEXTURE, tex, ObjectDataPtr(texData));
- } else {
- texData = (TextureData*)objData.get();
- }
- return texData;
-}
-
-static TextureData* getTextureTargetData(GLenum target){
- GET_CTX_RET(NULL);
- unsigned int tex = ctx->getBindedTexture(target);
- return getTextureData(TextureLocalName(target,tex));
-}
-
-GL_APICALL void GL_APIENTRY glActiveTexture(GLenum texture){
- GET_CTX_V2();
- SET_ERROR_IF (!GLESv2Validate::textureEnum(texture,ctx->getMaxCombinedTexUnits()),GL_INVALID_ENUM);
- ctx->setActiveTexture(texture);
- ctx->dispatcher().glActiveTexture(texture);
-}
-
-GL_APICALL void GL_APIENTRY glAttachShader(GLuint program, GLuint shader){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shader);
- SET_ERROR_IF(globalShaderName==0, GL_INVALID_VALUE);
-
- ObjectDataPtr programData = ctx->shareGroup()->getObjectData(SHADER,program);
- ObjectDataPtr shaderData = ctx->shareGroup()->getObjectData(SHADER,shader);
- SET_ERROR_IF(!shaderData.get() || !programData.get() ,GL_INVALID_OPERATION);
- SET_ERROR_IF(!(shaderData.get()->getDataType() ==SHADER_DATA) ||
- !(programData.get()->getDataType()==PROGRAM_DATA) ,GL_INVALID_OPERATION);
-
- GLenum shaderType = ((ShaderParser*)shaderData.get())->getType();
- ProgramData* pData = (ProgramData*)programData.get();
- SET_ERROR_IF((pData->getAttachedShader(shaderType)!=0), GL_INVALID_OPERATION);
- pData->attachShader(shader,shaderType);
- s_attachShader(ctx, program, shader);
- ctx->dispatcher().glAttachShader(globalProgramName,globalShaderName);
- }
-}
-
-GL_APICALL void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar* name){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::attribName(name),GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLESv2Validate::attribIndex(index),GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
-
- ctx->dispatcher().glBindAttribLocation(globalProgramName,index,name);
- }
-}
-
-GL_APICALL void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::bufferTarget(target),GL_INVALID_ENUM);
- //if buffer wasn't generated before,generate one
- if(buffer && ctx->shareGroup().get() && !ctx->shareGroup()->isObject(VERTEXBUFFER,buffer)){
- ctx->shareGroup()->genName(VERTEXBUFFER,buffer);
- ctx->shareGroup()->setObjectData(VERTEXBUFFER,buffer,ObjectDataPtr(new GLESbuffer()));
- }
- ctx->bindBuffer(target,buffer);
- if (buffer) {
- GLESbuffer* vbo = (GLESbuffer*)ctx->shareGroup()->getObjectData(VERTEXBUFFER,buffer).get();
- vbo->setBinded();
- }
-}
-
-GL_APICALL void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::framebufferTarget(target),GL_INVALID_ENUM);
-
- GLuint globalFrameBufferName = framebuffer;
- if(framebuffer && ctx->shareGroup().get()){
- globalFrameBufferName = ctx->shareGroup()->getGlobalName(FRAMEBUFFER,framebuffer);
- //if framebuffer wasn't generated before,generate one
- if(!globalFrameBufferName){
- ctx->shareGroup()->genName(FRAMEBUFFER,framebuffer);
- ctx->shareGroup()->setObjectData(FRAMEBUFFER, framebuffer,
- ObjectDataPtr(new FramebufferData(framebuffer)));
- globalFrameBufferName = ctx->shareGroup()->getGlobalName(FRAMEBUFFER,framebuffer);
- }
- }
- ctx->dispatcher().glBindFramebufferEXT(target,globalFrameBufferName);
-
- // update framebuffer binding state
- ctx->setFramebufferBinding(framebuffer);
-}
-
-GL_APICALL void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::renderbufferTarget(target),GL_INVALID_ENUM);
-
- GLuint globalRenderBufferName = renderbuffer;
- if(renderbuffer && ctx->shareGroup().get()){
- globalRenderBufferName = ctx->shareGroup()->getGlobalName(RENDERBUFFER,renderbuffer);
- //if renderbuffer wasn't generated before,generate one
- if(!globalRenderBufferName){
- ctx->shareGroup()->genName(RENDERBUFFER,renderbuffer);
- ctx->shareGroup()->setObjectData(RENDERBUFFER,
- renderbuffer,
- ObjectDataPtr(new RenderbufferData()));
- globalRenderBufferName = ctx->shareGroup()->getGlobalName(RENDERBUFFER,renderbuffer);
- }
- }
- ctx->dispatcher().glBindRenderbufferEXT(target,globalRenderBufferName);
-
- // update renderbuffer binding state
- ctx->setRenderbufferBinding(renderbuffer);
-}
-
-GL_APICALL void GL_APIENTRY glBindTexture(GLenum target, GLuint texture){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::textureTarget(target),GL_INVALID_ENUM)
-
- //for handling default texture (0)
- ObjectLocalName localTexName = TextureLocalName(target,texture);
-
- GLuint globalTextureName = localTexName;
- if(ctx->shareGroup().get()){
- globalTextureName = ctx->shareGroup()->getGlobalName(TEXTURE,localTexName);
- //if texture wasn't generated before,generate one
- if(!globalTextureName){
- ctx->shareGroup()->genName(TEXTURE,localTexName);
- globalTextureName = ctx->shareGroup()->getGlobalName(TEXTURE,localTexName);
- }
-
- TextureData* texData = getTextureData(localTexName);
- if (texData->target==0)
- texData->target = target;
- //if texture was already bound to another target
- SET_ERROR_IF(ctx->GLTextureTargetToLocal(texData->target) != ctx->GLTextureTargetToLocal(target), GL_INVALID_OPERATION);
- texData->wasBound = true;
- }
-
- ctx->setBindedTexture(target,texture);
- ctx->dispatcher().glBindTexture(target,globalTextureName);
-}
-
-GL_APICALL void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha){
- GET_CTX();
- ctx->dispatcher().glBlendColor(red,green,blue,alpha);
-}
-
-GL_APICALL void GL_APIENTRY glBlendEquation( GLenum mode ){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::blendEquationMode(mode),GL_INVALID_ENUM)
- ctx->dispatcher().glBlendEquation(mode);
-}
-
-GL_APICALL void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::blendEquationMode(modeRGB) && GLESv2Validate::blendEquationMode(modeAlpha)),GL_INVALID_ENUM);
- ctx->dispatcher().glBlendEquationSeparate(modeRGB,modeAlpha);
-}
-
-GL_APICALL void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::blendSrc(sfactor) || !GLESv2Validate::blendDst(dfactor),GL_INVALID_ENUM)
- ctx->dispatcher().glBlendFunc(sfactor,dfactor);
-}
-
-GL_APICALL void GL_APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha){
- GET_CTX();
- SET_ERROR_IF(
-!(GLESv2Validate::blendSrc(srcRGB) && GLESv2Validate::blendDst(dstRGB) && GLESv2Validate::blendSrc(srcAlpha) && GLESv2Validate::blendDst(dstAlpha)),GL_INVALID_ENUM);
- ctx->dispatcher().glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha);
-}
-
-GL_APICALL void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::bufferTarget(target),GL_INVALID_ENUM);
- SET_ERROR_IF(!GLESv2Validate::bufferUsage(usage),GL_INVALID_ENUM);
- SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION);
- ctx->setBufferData(target,size,data,usage);
-}
-
-GL_APICALL void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data){
- GET_CTX();
- SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION);
- SET_ERROR_IF(!GLESv2Validate::bufferTarget(target),GL_INVALID_ENUM);
- SET_ERROR_IF(!ctx->setBufferSubData(target,offset,size,data),GL_INVALID_VALUE);
-}
-
-
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target){
- GET_CTX_RET(GL_FRAMEBUFFER_COMPLETE);
- RET_AND_SET_ERROR_IF(!GLESv2Validate::framebufferTarget(target),GL_INVALID_ENUM,GL_FRAMEBUFFER_COMPLETE);
- ctx->drawValidate();
- return ctx->dispatcher().glCheckFramebufferStatusEXT(target);
-}
-
-GL_APICALL void GL_APIENTRY glClear(GLbitfield mask){
- GET_CTX();
- GLbitfield allowed_bits = GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
- GLbitfield has_disallowed_bits = (mask & ~allowed_bits);
- SET_ERROR_IF(has_disallowed_bits, GL_INVALID_VALUE);
- ctx->drawValidate();
-
- ctx->dispatcher().glClear(mask);
-}
-GL_APICALL void GL_APIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha){
- GET_CTX();
- ctx->dispatcher().glClearColor(red,green,blue,alpha);
-}
-GL_APICALL void GL_APIENTRY glClearDepthf(GLclampf depth){
- GET_CTX();
- ctx->dispatcher().glClearDepth(depth);
-}
-GL_APICALL void GL_APIENTRY glClearStencil(GLint s){
- GET_CTX();
- ctx->dispatcher().glClearStencil(s);
-}
-GL_APICALL void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha){
- GET_CTX();
- ctx->dispatcher().glColorMask(red,green,blue,alpha);
-}
-
-GL_APICALL void GL_APIENTRY glCompileShader(GLuint shader){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shader);
- SET_ERROR_IF(globalShaderName==0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,shader);
- SET_ERROR_IF(objData.get()->getDataType()!= SHADER_DATA,GL_INVALID_OPERATION);
- ShaderParser* sp = (ShaderParser*)objData.get();
- if (sp->validShader()) {
- ctx->dispatcher().glCompileShader(globalShaderName);
-
- GLsizei infoLogLength=0;
- GLchar* infoLog;
- ctx->dispatcher().glGetShaderiv(globalShaderName,GL_INFO_LOG_LENGTH,&infoLogLength);
- infoLog = new GLchar[infoLogLength+1];
- ctx->dispatcher().glGetShaderInfoLog(globalShaderName,infoLogLength,NULL,infoLog);
- sp->setInfoLog(infoLog);
- } else {
- sp->setInvalidInfoLog();
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
-{
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::textureTargetEx(target),GL_INVALID_ENUM);
- SET_ERROR_IF(level < 0 || imageSize < 0, GL_INVALID_VALUE);
- SET_ERROR_IF(!data,GL_INVALID_OPERATION);
-
- doCompressedTexImage2D(ctx, target, level, internalformat,
- width, height, border,
- imageSize, data, (void*)glTexImage2D);
-}
-
-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){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::textureTargetEx(target),GL_INVALID_ENUM);
- SET_ERROR_IF(!data,GL_INVALID_OPERATION);
- ctx->dispatcher().glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imageSize,data);
-}
-
-GL_APICALL void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::pixelFrmt(ctx,internalformat) && GLESv2Validate::textureTargetEx(target)),GL_INVALID_ENUM);
- SET_ERROR_IF((GLESv2Validate::textureIsCubeMap(target) && width != height), GL_INVALID_VALUE);
- SET_ERROR_IF(border != 0,GL_INVALID_VALUE);
- ctx->dispatcher().glCopyTexImage2D(target,level,internalformat,x,y,width,height,border);
-}
-
-GL_APICALL void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::textureTargetEx(target),GL_INVALID_ENUM);
- ctx->dispatcher().glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height);
-}
-
-GL_APICALL GLuint GL_APIENTRY glCreateProgram(void){
- GET_CTX_RET(0);
- const GLuint globalProgramName = ctx->dispatcher().glCreateProgram();
- if(ctx->shareGroup().get() && globalProgramName) {
- ProgramData* programInfo = new ProgramData();
- const GLuint localProgramName = ctx->shareGroup()->genName(SHADER, 0, true);
- ctx->shareGroup()->replaceGlobalName(SHADER,localProgramName,globalProgramName);
- ctx->shareGroup()->setObjectData(SHADER,localProgramName,ObjectDataPtr(programInfo));
- return localProgramName;
- }
- if(globalProgramName){
- ctx->dispatcher().glDeleteProgram(globalProgramName);
- }
- return 0;
-}
-
-GL_APICALL GLuint GL_APIENTRY glCreateShader(GLenum type){
- GET_CTX_V2_RET(0);
- RET_AND_SET_ERROR_IF(!GLESv2Validate::shaderType(type),GL_INVALID_ENUM,0);
- const GLuint globalShaderName = ctx->dispatcher().glCreateShader(type);
- if(ctx->shareGroup().get() && globalShaderName) {
- const GLuint localShaderName = ctx->shareGroup()->genName(SHADER, 0, true);
- ShaderParser* sp = new ShaderParser(type);
- ctx->shareGroup()->replaceGlobalName(SHADER,localShaderName,globalShaderName);
- ctx->shareGroup()->setObjectData(SHADER,localShaderName,ObjectDataPtr(sp));
- return localShaderName;
- }
- if(globalShaderName){
- ctx->dispatcher().glDeleteShader(globalShaderName);
- }
- return 0;
-}
-
-GL_APICALL void GL_APIENTRY glCullFace(GLenum mode){
- GET_CTX();
- ctx->dispatcher().glCullFace(mode);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers){
- GET_CTX();
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i < n; i++){
- ctx->shareGroup()->deleteName(VERTEXBUFFER,buffers[i]);
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers){
- GET_CTX();
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i < n; i++){
- const GLuint globalFrameBufferName = ctx->shareGroup()->getGlobalName(FRAMEBUFFER,framebuffers[i]);
- ctx->shareGroup()->deleteName(FRAMEBUFFER,framebuffers[i]);
- ctx->dispatcher().glDeleteFramebuffersEXT(1,&globalFrameBufferName);
- }
- }
-}
-
-static void s_detachFromFramebuffer(GLuint bufferType, GLuint texture) {
- GET_CTX();
- GLuint fbName = ctx->getFramebufferBinding();
- if (!fbName) return;
- ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(FRAMEBUFFER,fbName);
- if (fbObj.get() == NULL) return;
- FramebufferData *fbData = (FramebufferData *)fbObj.get();
- GLenum target;
- const GLenum kAttachments[] = {GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
- const size_t sizen = sizeof(kAttachments)/sizeof(GLenum);
- for (size_t i = 0; i < sizen; ++i ) {
- GLuint name = fbData->getAttachment(kAttachments[i], &target, NULL);
- if (name != texture) continue;
- if (TEXTURE == bufferType && GLESv2Validate::textureTargetEx(target)) {
- glFramebufferTexture2D(GL_FRAMEBUFFER, kAttachments[i], target, 0, 0);
- } else if (RENDERBUFFER == bufferType && GLESv2Validate::renderbufferTarget(target)) {
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, kAttachments[i], target, 0);
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers){
- GET_CTX();
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i < n; i++){
- const GLuint globalRenderBufferName = ctx->shareGroup()->getGlobalName(RENDERBUFFER,renderbuffers[i]);
- ctx->shareGroup()->deleteName(RENDERBUFFER,renderbuffers[i]);
- ctx->dispatcher().glDeleteRenderbuffersEXT(1,&globalRenderBufferName);
- s_detachFromFramebuffer(RENDERBUFFER, renderbuffers[i]);
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures){
- GET_CTX();
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i < n; i++){
- if (textures[i]!=0) {
- TextureData* tData = getTextureData(textures[i]);
- // delete the underlying OpenGL texture but only if this
- // texture is not a target of EGLImage.
- if (!tData || tData->sourceEGLImage == 0) {
- const GLuint globalTextureName = ctx->shareGroup()->getGlobalName(TEXTURE,textures[i]);
- ctx->dispatcher().glDeleteTextures(1,&globalTextureName);
- }
- ctx->shareGroup()->deleteName(TEXTURE,textures[i]);
-
- if (ctx->getBindedTexture(GL_TEXTURE_2D) == textures[i])
- ctx->setBindedTexture(GL_TEXTURE_2D,0);
- if (ctx->getBindedTexture(GL_TEXTURE_CUBE_MAP) == textures[i])
- ctx->setBindedTexture(GL_TEXTURE_CUBE_MAP,0);
- s_detachFromFramebuffer(TEXTURE, textures[i]);
- }
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glDeleteProgram(GLuint program){
- GET_CTX();
- if(program && ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(!globalProgramName, GL_INVALID_VALUE);
-
- ObjectDataPtr programData = ctx->shareGroup()->getObjectData(SHADER,program);
- ProgramData* pData = (ProgramData*)programData.get();
- if (pData && pData->isInUse()) {
- pData->setDeleteStatus(true);
- return;
- }
- s_detachShader(ctx, pData->getAttachedVertexShader());
- s_detachShader(ctx, pData->getAttachedFragmentShader());
-
- ctx->shareGroup()->deleteName(SHADER,program);
- ctx->dispatcher().glDeleteProgram(globalProgramName);
- }
-}
-
-GL_APICALL void GL_APIENTRY glDeleteShader(GLuint shader){
- GET_CTX();
- if(shader && ctx->shareGroup().get()) {
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shader);
- SET_ERROR_IF(!globalShaderName, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,shader);
- SET_ERROR_IF(!objData.get() ,GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=SHADER_DATA,GL_INVALID_OPERATION);
- ShaderParser* sp = (ShaderParser*)objData.get();
- if (sp->getAttachedProgram()) {
- sp->setDeleteStatus(true);
- } else {
- ctx->shareGroup()->deleteName(SHADER,shader);
- }
- ctx->dispatcher().glDeleteShader(globalShaderName);
- }
-
-}
-
-GL_APICALL void GL_APIENTRY glDepthFunc(GLenum func){
- GET_CTX();
- ctx->dispatcher().glDepthFunc(func);
-}
-GL_APICALL void GL_APIENTRY glDepthMask(GLboolean flag){
- GET_CTX();
- ctx->dispatcher().glDepthMask(flag);
-}
-GL_APICALL void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar){
- GET_CTX();
- ctx->dispatcher().glDepthRange(zNear,zFar);
-}
-
-GL_APICALL void GL_APIENTRY glDetachShader(GLuint program, GLuint shader){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shader);
- SET_ERROR_IF(globalShaderName==0, GL_INVALID_VALUE);
-
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(!objData.get(),GL_INVALID_OPERATION);
- SET_ERROR_IF(!(objData.get()->getDataType()==PROGRAM_DATA) ,GL_INVALID_OPERATION);
-
- ProgramData* programData = (ProgramData*)objData.get();
- SET_ERROR_IF(!programData->isAttached(shader),GL_INVALID_OPERATION);
- programData->detachShader(shader);
-
- s_detachShader(ctx, shader);
-
- ctx->dispatcher().glDetachShader(globalProgramName,globalShaderName);
- }
-}
-
-GL_APICALL void GL_APIENTRY glDisable(GLenum cap){
- GET_CTX();
- ctx->dispatcher().glDisable(cap);
-}
-
-GL_APICALL void GL_APIENTRY glDisableVertexAttribArray(GLuint index){
- GET_CTX();
- SET_ERROR_IF((!GLESv2Validate::arrayIndex(ctx,index)),GL_INVALID_VALUE);
- ctx->enableArr(index,false);
- ctx->dispatcher().glDisableVertexAttribArray(index);
-}
-
-GL_APICALL void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count){
- GET_CTX_V2();
- SET_ERROR_IF(count < 0,GL_INVALID_VALUE)
- SET_ERROR_IF(!GLESv2Validate::drawMode(mode),GL_INVALID_ENUM);
-
- ctx->drawValidate();
-
- GLESConversionArrays tmpArrs;
- ctx->setupArraysPointers(tmpArrs,first,count,0,NULL,true);
-
- ctx->validateAtt0PreDraw(count);
-
- //Enable texture generation for GL_POINTS and gl_PointSize shader variable
- //GLES2 assumes this is enabled by default, we need to set this state for GL
- if (mode==GL_POINTS) {
- ctx->dispatcher().glEnable(GL_POINT_SPRITE);
- ctx->dispatcher().glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
- }
-
- ctx->dispatcher().glDrawArrays(mode,first,count);
-
- if (mode==GL_POINTS) {
- ctx->dispatcher().glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
- ctx->dispatcher().glDisable(GL_POINT_SPRITE);
- }
-
- ctx->validateAtt0PostDraw();
-}
-
-GL_APICALL void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* elementsIndices){
- GET_CTX_V2();
- SET_ERROR_IF(count < 0,GL_INVALID_VALUE)
- SET_ERROR_IF(!(GLESv2Validate::drawMode(mode) && GLESv2Validate::drawType(type)),GL_INVALID_ENUM);
-
- ctx->drawValidate();
-
- const GLvoid* indices = elementsIndices;
- if(ctx->isBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)) { // if vbo is binded take the indices from the vbo
- const unsigned char* buf = static_cast<unsigned char *>(ctx->getBindedBuffer(GL_ELEMENT_ARRAY_BUFFER));
- indices = buf + SafeUIntFromPointer(elementsIndices);
- }
-
- GLESConversionArrays tmpArrs;
- ctx->setupArraysPointers(tmpArrs,0,count,type,indices,false);
-
- unsigned int maxIndex = ctx->findMaxIndex(count, type, indices);
- ctx->validateAtt0PreDraw(maxIndex);
-
- //See glDrawArrays
- if (mode==GL_POINTS) {
- ctx->dispatcher().glEnable(GL_POINT_SPRITE);
- ctx->dispatcher().glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
- }
-
- ctx->dispatcher().glDrawElements(mode,count,type,indices);
-
- if (mode==GL_POINTS) {
- ctx->dispatcher().glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
- ctx->dispatcher().glDisable(GL_POINT_SPRITE);
- }
-
- ctx->validateAtt0PostDraw();
-}
-
-GL_APICALL void GL_APIENTRY glEnable(GLenum cap){
- GET_CTX();
- ctx->dispatcher().glEnable(cap);
-}
-
-GL_APICALL void GL_APIENTRY glEnableVertexAttribArray(GLuint index){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::arrayIndex(ctx,index)),GL_INVALID_VALUE);
- ctx->enableArr(index,true);
- ctx->dispatcher().glEnableVertexAttribArray(index);
-}
-
-GL_APICALL void GL_APIENTRY glFinish(void){
- GET_CTX();
- ctx->dispatcher().glFinish();
-}
-GL_APICALL void GL_APIENTRY glFlush(void){
- GET_CTX();
- ctx->dispatcher().glFlush();
-}
-
-
-GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::framebufferTarget(target) &&
- GLESv2Validate::renderbufferTarget(renderbuffertarget) &&
- GLESv2Validate::framebufferAttachment(attachment)),GL_INVALID_ENUM);
- SET_ERROR_IF(!ctx->shareGroup().get(), GL_INVALID_OPERATION);
-
- GLuint globalRenderbufferName = 0;
- ObjectDataPtr obj;
-
- // generate the renderbuffer object if not yet exist
- if(renderbuffer) {
- if (!ctx->shareGroup()->isObject(RENDERBUFFER,renderbuffer)) {
- ctx->shareGroup()->genName(RENDERBUFFER,renderbuffer);
- obj = ObjectDataPtr(new RenderbufferData());
- ctx->shareGroup()->setObjectData(RENDERBUFFER,
- renderbuffer, obj);
- }
- else {
- obj = ctx->shareGroup()->getObjectData(RENDERBUFFER, renderbuffer);
- }
-
- globalRenderbufferName = ctx->shareGroup()->getGlobalName(RENDERBUFFER,renderbuffer);
- }
-
- // Update the the current framebuffer object attachment state
- GLuint fbName = ctx->getFramebufferBinding();
- ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(FRAMEBUFFER,fbName);
- if (fbObj.get() != NULL) {
- FramebufferData *fbData = (FramebufferData *)fbObj.get();
- fbData->setAttachment(attachment, renderbuffertarget, renderbuffer, obj);
- }
-
- if (renderbuffer && obj.get() != NULL) {
- RenderbufferData *rbData = (RenderbufferData *)obj.get();
- if (rbData->sourceEGLImage != 0) {
- //
- // This renderbuffer object is an eglImage target
- // attach the eglimage's texture instead the renderbuffer.
- //
- ctx->dispatcher().glFramebufferTexture2DEXT(target,
- attachment,
- GL_TEXTURE_2D,
- rbData->eglImageGlobalTexName,0);
- return;
- }
- }
-
- ctx->dispatcher().glFramebufferRenderbufferEXT(target,attachment,renderbuffertarget,globalRenderbufferName);
-}
-
-GL_APICALL void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::framebufferTarget(target) &&
- GLESv2Validate::textureTargetEx(textarget) &&
- GLESv2Validate::framebufferAttachment(attachment)),GL_INVALID_ENUM);
- SET_ERROR_IF(level != 0, GL_INVALID_VALUE);
- SET_ERROR_IF(!ctx->shareGroup().get(), GL_INVALID_OPERATION);
-
- GLuint globalTextureName = 0;
-
- if(texture) {
- if (!ctx->shareGroup()->isObject(TEXTURE,texture)) {
- ctx->shareGroup()->genName(TEXTURE,texture);
- }
- ObjectLocalName texname = TextureLocalName(textarget,texture);
- globalTextureName = ctx->shareGroup()->getGlobalName(TEXTURE,texname);
- }
-
- ctx->dispatcher().glFramebufferTexture2DEXT(target,attachment,textarget,globalTextureName,level);
-
- // Update the the current framebuffer object attachment state
- GLuint fbName = ctx->getFramebufferBinding();
- ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(FRAMEBUFFER,fbName);
- if (fbObj.get() != NULL) {
- FramebufferData *fbData = (FramebufferData *)fbObj.get();
- fbData->setAttachment(attachment, textarget,
- texture, ObjectDataPtr());
- }
-}
-
-
-GL_APICALL void GL_APIENTRY glFrontFace(GLenum mode){
- GET_CTX();
- ctx->dispatcher().glFrontFace(mode);
-}
-
-GL_APICALL void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers){
- GET_CTX();
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i<n ;i++) {
- buffers[i] = ctx->shareGroup()->genName(VERTEXBUFFER, 0, true);
- //generating vbo object related to this buffer name
- ctx->shareGroup()->setObjectData(VERTEXBUFFER,buffers[i],ObjectDataPtr(new GLESbuffer()));
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glGenerateMipmap(GLenum target){
- GET_CTX();
- SET_ERROR_IF(!GLESvalidate::textureTarget(target), GL_INVALID_ENUM);
- ctx->dispatcher().glGenerateMipmapEXT(target);
-}
-
-GL_APICALL void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers){
- GET_CTX();
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i<n ;i++) {
- framebuffers[i] = ctx->shareGroup()->genName(FRAMEBUFFER, 0 ,true);
- ctx->shareGroup()->setObjectData(FRAMEBUFFER, framebuffers[i],
- ObjectDataPtr(new FramebufferData(framebuffers[i])));
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers){
- GET_CTX();
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i<n ;i++) {
- renderbuffers[i] = ctx->shareGroup()->genName(RENDERBUFFER, 0, true);
- ctx->shareGroup()->setObjectData(RENDERBUFFER,
- renderbuffers[i],
- ObjectDataPtr(new RenderbufferData()));
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures){
- GET_CTX();
- SET_ERROR_IF(n<0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()) {
- for(int i=0; i<n ;i++) {
- textures[i] = ctx->shareGroup()->genName(TEXTURE, 0, true);
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ctx->dispatcher().glGetActiveAttrib(globalProgramName,index,bufsize,length,size,type,name);
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ctx->dispatcher().glGetActiveUniform(globalProgramName,index,bufsize,length,size,type,name);
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- ctx->dispatcher().glGetAttachedShaders(globalProgramName,maxcount,count,shaders);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- GLint numShaders=0;
- ctx->dispatcher().glGetProgramiv(globalProgramName,GL_ATTACHED_SHADERS,&numShaders);
- for(int i=0 ; i < maxcount && i<numShaders ;i++){
- shaders[i] = ctx->shareGroup()->getLocalName(SHADER,shaders[i]);
- }
- }
-}
-
-GL_APICALL int GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar* name){
- GET_CTX_RET(-1);
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- RET_AND_SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE,-1);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- RET_AND_SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION,-1);
- ProgramData* pData = (ProgramData *)objData.get();
- RET_AND_SET_ERROR_IF(pData->getLinkStatus() != GL_TRUE,GL_INVALID_OPERATION,-1);
- return ctx->dispatcher().glGetAttribLocation(globalProgramName,name);
- }
- return -1;
-}
-
-GL_APICALL void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params){
- GET_CTX();
-
- if (ctx->glGetBooleanv(pname,params))
- {
- return;
- }
-
- switch(pname)
- {
- case GL_SHADER_COMPILER:
- case GL_SHADER_BINARY_FORMATS:
- case GL_NUM_SHADER_BINARY_FORMATS:
- case GL_MAX_VERTEX_UNIFORM_VECTORS:
- case GL_MAX_VARYING_VECTORS:
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
- if(ctx->getCaps()->GL_ARB_ES2_COMPATIBILITY)
- ctx->dispatcher().glGetBooleanv(pname,params);
- else
- {
- GLint iparam;
- glGetIntegerv(pname,&iparam);
- *params = (iparam != 0);
- }
- break;
-
- default:
- ctx->dispatcher().glGetBooleanv(pname,params);
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::bufferTarget(target) && GLESv2Validate::bufferParam(pname)),GL_INVALID_ENUM);
- SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION);
- switch(pname) {
- case GL_BUFFER_SIZE:
- ctx->getBufferSize(target,params);
- break;
- case GL_BUFFER_USAGE:
- ctx->getBufferUsage(target,params);
- break;
- }
-}
-
-
-GL_APICALL GLenum GL_APIENTRY glGetError(void){
- GET_CTX_RET(GL_NO_ERROR)
- GLenum err = ctx->getGLerror();
- if(err != GL_NO_ERROR) {
- ctx->setGLerror(GL_NO_ERROR);
- return err;
- }
- return ctx->dispatcher().glGetError();
-}
-
-GL_APICALL void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params){
- GET_CTX();
-
- if (ctx->glGetFloatv(pname,params)) {
- return;
- }
-
- GLint i;
-
- switch (pname) {
- case GL_CURRENT_PROGRAM:
- case GL_FRAMEBUFFER_BINDING:
- case GL_RENDERBUFFER_BINDING:
- glGetIntegerv(pname,&i);
- *params = (GLfloat)i;
- break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- *params = (GLfloat)getCompressedFormats(NULL);
- break;
- case GL_COMPRESSED_TEXTURE_FORMATS:
- {
- int nparams = getCompressedFormats(NULL);
- if (nparams>0) {
- int * iparams = new int[nparams];
- getCompressedFormats(iparams);
- for (int i=0; i<nparams; i++) params[i] = (GLfloat)iparams[i];
- delete [] iparams;
- }
- }
- break;
-
- case GL_SHADER_COMPILER:
- case GL_SHADER_BINARY_FORMATS:
- case GL_NUM_SHADER_BINARY_FORMATS:
- case GL_MAX_VERTEX_UNIFORM_VECTORS:
- case GL_MAX_VARYING_VECTORS:
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
- if(ctx->getCaps()->GL_ARB_ES2_COMPATIBILITY)
- ctx->dispatcher().glGetFloatv(pname,params);
- else
- {
- glGetIntegerv(pname,&i);
- *params = (GLfloat)i;
- }
- break;
-
- case GL_STENCIL_BACK_VALUE_MASK:
- case GL_STENCIL_BACK_WRITEMASK:
- case GL_STENCIL_VALUE_MASK:
- case GL_STENCIL_WRITEMASK:
- {
- GLint myint = 0;
- glGetIntegerv(pname, &myint);
- // Two casts are used: since mask is unsigned integer,
- // the first cast converts to unsigned integer;
- // the second cast converts to float.
- *params = (GLfloat)((GLuint)(myint));
- }
- break;
-
- default:
- ctx->dispatcher().glGetFloatv(pname,params);
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params){
- int destroyCtx = 0;
- GET_CTX();
-
- if (!ctx) {
- ctx = createGLESContext();
- if (ctx)
- destroyCtx = 1;
- }
- if (ctx->glGetIntegerv(pname,params))
- {
- if (destroyCtx)
- deleteGLESContext(ctx);
- return;
- }
-
- bool es2 = ctx->getCaps()->GL_ARB_ES2_COMPATIBILITY;
- GLint i;
-
- switch (pname) {
- case GL_CURRENT_PROGRAM:
- if (ctx->shareGroup().get()) {
- ctx->dispatcher().glGetIntegerv(pname,&i);
- *params = ctx->shareGroup()->getLocalName(SHADER,i);
- }
- break;
- case GL_FRAMEBUFFER_BINDING:
- if (ctx->shareGroup().get()) {
- ctx->dispatcher().glGetIntegerv(pname,&i);
- *params = ctx->shareGroup()->getLocalName(FRAMEBUFFER,i);
- }
- break;
- case GL_RENDERBUFFER_BINDING:
- if (ctx->shareGroup().get()) {
- ctx->dispatcher().glGetIntegerv(pname,&i);
- *params = ctx->shareGroup()->getLocalName(RENDERBUFFER,i);
- }
- break;
-
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- *params = getCompressedFormats(NULL);
- break;
- case GL_COMPRESSED_TEXTURE_FORMATS:
- getCompressedFormats(params);
- break;
-
- case GL_SHADER_COMPILER:
- if(es2)
- ctx->dispatcher().glGetIntegerv(pname,params);
- else
- *params = 1;
- break;
-
- case GL_SHADER_BINARY_FORMATS:
- if(es2)
- ctx->dispatcher().glGetIntegerv(pname,params);
- break;
-
- case GL_NUM_SHADER_BINARY_FORMATS:
- if(es2)
- ctx->dispatcher().glGetIntegerv(pname,params);
- else
- *params = 0;
- break;
-
- case GL_MAX_VERTEX_UNIFORM_VECTORS:
- if(es2)
- ctx->dispatcher().glGetIntegerv(pname,params);
- else
- *params = 128;
- break;
-
- case GL_MAX_VARYING_VECTORS:
- if(es2)
- ctx->dispatcher().glGetIntegerv(pname,params);
- else
- *params = 8;
- break;
-
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
- if(es2)
- ctx->dispatcher().glGetIntegerv(pname,params);
- else
- *params = 16;
- break;
-
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- ctx->dispatcher().glGetIntegerv(pname,params);
- if(*params > 16)
- {
- // GLES spec requires only 2, and the ATI driver erronously
- // returns 32 (although it supports only 16). This WAR is simple,
- // compliant and good enough for developers.
- *params = 16;
- }
- break;
- default:
- ctx->dispatcher().glGetIntegerv(pname,params);
- }
- if (destroyCtx)
- deleteGLESContext(ctx);
-}
-
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::framebufferTarget(target) &&
- GLESv2Validate::framebufferAttachment(attachment) &&
- GLESv2Validate::framebufferAttachmentParams(pname)),GL_INVALID_ENUM);
-
- //
- // Take the attachment attribute from our state - if available
- //
- GLuint fbName = ctx->getFramebufferBinding();
- SET_ERROR_IF (!fbName, GL_INVALID_OPERATION);
- if (fbName) {
- ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(FRAMEBUFFER,fbName);
- if (fbObj.get() != NULL) {
- FramebufferData *fbData = (FramebufferData *)fbObj.get();
- GLenum target;
- GLuint name = fbData->getAttachment(attachment, &target, NULL);
- if (!name) {
- SET_ERROR_IF(pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE &&
- pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, GL_INVALID_ENUM);
- }
- if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) {
- if (target == GL_TEXTURE_2D) {
- *params = GL_TEXTURE;
- return;
- }
- else if (target == GL_RENDERBUFFER) {
- *params = GL_RENDERBUFFER;
- return;
- } else {
- *params = GL_NONE;
- }
- }
- else if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) {
- *params = name;
- return;
- }
- }
- }
-
- ctx->dispatcher().glGetFramebufferAttachmentParameterivEXT(target,attachment,pname,params);
-}
-
-GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::renderbufferTarget(target) && GLESv2Validate::renderbufferParams(pname)),GL_INVALID_ENUM);
-
- //
- // If this is a renderbuffer which is eglimage's target, we
- // should query the underlying eglimage's texture object instead.
- //
- GLuint rb = ctx->getRenderbufferBinding();
- if (rb) {
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(RENDERBUFFER,rb);
- RenderbufferData *rbData = (RenderbufferData *)objData.get();
- if (rbData && rbData->sourceEGLImage != 0) {
- GLenum texPname;
- switch(pname) {
- case GL_RENDERBUFFER_WIDTH:
- texPname = GL_TEXTURE_WIDTH;
- break;
- case GL_RENDERBUFFER_HEIGHT:
- texPname = GL_TEXTURE_HEIGHT;
- break;
- case GL_RENDERBUFFER_INTERNAL_FORMAT:
- texPname = GL_TEXTURE_INTERNAL_FORMAT;
- break;
- case GL_RENDERBUFFER_RED_SIZE:
- texPname = GL_TEXTURE_RED_SIZE;
- break;
- case GL_RENDERBUFFER_GREEN_SIZE:
- texPname = GL_TEXTURE_GREEN_SIZE;
- break;
- case GL_RENDERBUFFER_BLUE_SIZE:
- texPname = GL_TEXTURE_BLUE_SIZE;
- break;
- case GL_RENDERBUFFER_ALPHA_SIZE:
- texPname = GL_TEXTURE_ALPHA_SIZE;
- break;
- case GL_RENDERBUFFER_DEPTH_SIZE:
- texPname = GL_TEXTURE_DEPTH_SIZE;
- break;
- case GL_RENDERBUFFER_STENCIL_SIZE:
- default:
- *params = 0; //XXX
- return;
- break;
- }
-
- GLint prevTex;
- ctx->dispatcher().glGetIntegerv(GL_TEXTURE_BINDING_2D, &prevTex);
- ctx->dispatcher().glBindTexture(GL_TEXTURE_2D,
- rbData->eglImageGlobalTexName);
- ctx->dispatcher().glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
- texPname,
- params);
- ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, prevTex);
- return;
- }
- }
-
- ctx->dispatcher().glGetRenderbufferParameterivEXT(target,pname,params);
-}
-
-
-GL_APICALL void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::programParam(pname),GL_INVALID_ENUM);
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- switch(pname) {
- case GL_DELETE_STATUS:
- {
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(!objData.get() ,GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ProgramData* programData = (ProgramData*)objData.get();
- params[0] = programData->getDeleteStatus() ? GL_TRUE : GL_FALSE;
- }
- break;
- case GL_LINK_STATUS:
- {
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(!objData.get() ,GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ProgramData* programData = (ProgramData*)objData.get();
- params[0] = programData->getLinkStatus();
- }
- break;
- //validate status should not return GL_TRUE if link failed
- case GL_VALIDATE_STATUS:
- {
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(!objData.get() ,GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ProgramData* programData = (ProgramData*)objData.get();
- if (programData->getLinkStatus()==GL_TRUE)
- ctx->dispatcher().glGetProgramiv(globalProgramName,pname,params);
- else
- params[0] = GL_FALSE;
- }
- break;
- case GL_INFO_LOG_LENGTH:
- {
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(!objData.get() ,GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ProgramData* programData = (ProgramData*)objData.get();
- GLint logLength = strlen(programData->getInfoLog());
- params[0] = (logLength>0) ? logLength+1 : 0;
- }
- break;
- default:
- ctx->dispatcher().glGetProgramiv(globalProgramName,pname,params);
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(!objData.get() ,GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ProgramData* programData = (ProgramData*)objData.get();
-
- if (bufsize==0) {
- if (length) {
- *length = 0;
- }
- return;
- }
-
- GLsizei logLength;
- logLength = strlen(programData->getInfoLog());
-
- GLsizei returnLength=0;
- if (infolog) {
- returnLength = bufsize-1 < logLength ? bufsize-1 : logLength;
- strncpy(infolog,programData->getInfoLog(),returnLength+1);
- infolog[returnLength] = '\0';
- }
- if (length) {
- *length = returnLength;
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shader);
- if (pname == GL_DELETE_STATUS) {
- SET_ERROR_IF(globalShaderName == 0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,shader);
- SET_ERROR_IF(!objData.get() ,GL_INVALID_VALUE);
- SET_ERROR_IF(objData.get()->getDataType()!=SHADER_DATA,GL_INVALID_VALUE);
- ShaderParser* sp = (ShaderParser*)objData.get();
- params[0] = (sp->getDeleteStatus()) ? GL_TRUE : GL_FALSE;
- return;
- }
- SET_ERROR_IF(globalShaderName==0, GL_INVALID_VALUE);
- switch(pname) {
- case GL_INFO_LOG_LENGTH:
- {
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,shader);
- SET_ERROR_IF(!objData.get() ,GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=SHADER_DATA,GL_INVALID_OPERATION);
- ShaderParser* sp = (ShaderParser*)objData.get();
- GLint logLength = strlen(sp->getInfoLog());
- params[0] = (logLength>0) ? logLength+1 : 0;
- }
- break;
- default:
- ctx->dispatcher().glGetShaderiv(globalShaderName,pname,params);
- }
- }
-}
-
-
-GL_APICALL void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shader);
- SET_ERROR_IF(globalShaderName==0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,shader);
- SET_ERROR_IF(!objData.get() ,GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=SHADER_DATA,GL_INVALID_OPERATION);
- ShaderParser* sp = (ShaderParser*)objData.get();
-
- if (bufsize==0) {
- if (length) {
- *length = 0;
- }
- return;
- }
-
- GLsizei logLength;
- logLength = strlen(sp->getInfoLog());
-
- GLsizei returnLength=0;
- if (infolog) {
- returnLength = bufsize-1 <logLength ? bufsize-1 : logLength;
- strncpy(infolog,sp->getInfoLog(),returnLength+1);
- infolog[returnLength] = '\0';
- }
- if (length) {
- *length = returnLength;
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision){
- GET_CTX_V2();
- SET_ERROR_IF(!(GLESv2Validate::shaderType(shadertype) && GLESv2Validate::precisionType(precisiontype)),GL_INVALID_ENUM);
-
- switch (precisiontype) {
- case GL_LOW_INT:
- case GL_MEDIUM_INT:
- case GL_HIGH_INT:
- range[0] = range[1] = 16;
- *precision = 0;
- break;
-
- case GL_LOW_FLOAT:
- case GL_MEDIUM_FLOAT:
- case GL_HIGH_FLOAT:
- if(ctx->dispatcher().glGetShaderPrecisionFormat != NULL) {
- ctx->dispatcher().glGetShaderPrecisionFormat(shadertype,precisiontype,range,precision);
- } else {
- range[0] = range[1] = 127;
- *precision = 24;
- }
- break;
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shader);
- SET_ERROR_IF(globalShaderName == 0,GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,shader);
- SET_ERROR_IF(!objData.get(),GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=SHADER_DATA,GL_INVALID_OPERATION);
- const std::string& src = ((ShaderParser*)objData.get())->getOriginalSrc();
- int srcLength = static_cast<int>(src.size());
-
- int returnLength = bufsize<srcLength ? bufsize-1 : srcLength;
- if (returnLength) {
- strncpy(source, src.c_str(), returnLength);
- source[returnLength] = '\0';
- }
-
- if (length)
- *length = returnLength;
- }
-}
-
-
-GL_APICALL const GLubyte* GL_APIENTRY glGetString(GLenum name){
- GET_CTX_RET(NULL)
- static const GLubyte SHADING[] = "OpenGL ES GLSL ES 1.0.17";
- switch(name) {
- case GL_VENDOR:
- return (const GLubyte*)ctx->getVendorString();
- case GL_RENDERER:
- return (const GLubyte*)ctx->getRendererString();
- case GL_VERSION:
- return (const GLubyte*)ctx->getVersionString();
- case GL_SHADING_LANGUAGE_VERSION:
- return SHADING;
- case GL_EXTENSIONS:
- return (const GLubyte*)ctx->getExtensionString();
- default:
- RET_AND_SET_ERROR_IF(true,GL_INVALID_ENUM,NULL);
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::textureTarget(target) && GLESv2Validate::textureParams(pname)),GL_INVALID_ENUM);
- ctx->dispatcher().glGetTexParameterfv(target,pname,params);
-
-}
-GL_APICALL void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::textureTarget(target) && GLESv2Validate::textureParams(pname)),GL_INVALID_ENUM);
- ctx->dispatcher().glGetTexParameteriv(target,pname,params);
-}
-
-GL_APICALL void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params){
- GET_CTX();
- SET_ERROR_IF(location < 0,GL_INVALID_OPERATION);
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ProgramData* pData = (ProgramData *)objData.get();
- SET_ERROR_IF(pData->getLinkStatus() != GL_TRUE,GL_INVALID_OPERATION);
- ctx->dispatcher().glGetUniformfv(globalProgramName,location,params);
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params){
- GET_CTX();
- SET_ERROR_IF(location < 0,GL_INVALID_OPERATION);
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ProgramData* pData = (ProgramData *)objData.get();
- SET_ERROR_IF(pData->getLinkStatus() != GL_TRUE,GL_INVALID_OPERATION);
- ctx->dispatcher().glGetUniformiv(globalProgramName,location,params);
- }
-}
-
-GL_APICALL int GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name){
- GET_CTX_RET(-1);
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- RET_AND_SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE,-1);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- RET_AND_SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION,-1);
- ProgramData* pData = (ProgramData *)objData.get();
- RET_AND_SET_ERROR_IF(pData->getLinkStatus() != GL_TRUE,GL_INVALID_OPERATION,-1);
- return ctx->dispatcher().glGetUniformLocation(globalProgramName,name);
- }
- return -1;
-}
-
-static bool s_invalidVertexAttribIndex(GLuint index) {
- GLint param=0;
- glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &param);
- return (param < 0 || index >= (GLuint)param);
-}
-
-GL_APICALL void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params){
- GET_CTX_V2();
- SET_ERROR_IF(s_invalidVertexAttribIndex(index), GL_INVALID_VALUE);
- const GLESpointer* p = ctx->getPointer(index);
- if(p) {
- switch(pname){
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = 0;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = p->isEnable();
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = p->getSize();
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = p->getStride();
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = p->getType();
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = p->isNormalize();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- if(index == 0)
- {
- const float* att0 = ctx->getAtt0();
- for(int i=0; i<4; i++)
- params[i] = att0[i];
- }
- else
- ctx->dispatcher().glGetVertexAttribfv(index,pname,params);
- break;
- default:
- ctx->setGLerror(GL_INVALID_ENUM);
- }
- } else {
- ctx->setGLerror(GL_INVALID_VALUE);
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params){
- GET_CTX_V2();
- SET_ERROR_IF(s_invalidVertexAttribIndex(index), GL_INVALID_VALUE);
- const GLESpointer* p = ctx->getPointer(index);
- if(p) {
- switch(pname){
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = 0;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = p->isEnable();
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = p->getSize();
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = p->getStride();
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = p->getType();
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = p->isNormalize();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- if(index == 0)
- {
- const float* att0 = ctx->getAtt0();
- for(int i=0; i<4; i++)
- params[i] = (GLint)att0[i];
- }
- else
- ctx->dispatcher().glGetVertexAttribiv(index,pname,params);
- break;
- default:
- ctx->setGLerror(GL_INVALID_ENUM);
- }
- } else {
- ctx->setGLerror(GL_INVALID_VALUE);
- }
-}
-
-GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer){
- GET_CTX();
- SET_ERROR_IF(pname != GL_VERTEX_ATTRIB_ARRAY_POINTER,GL_INVALID_ENUM);
- SET_ERROR_IF((!GLESv2Validate::arrayIndex(ctx,index)),GL_INVALID_VALUE);
-
- const GLESpointer* p = ctx->getPointer(index);
- if(p) {
- *pointer = const_cast<void *>( p->getBufferData());
- } else {
- ctx->setGLerror(GL_INVALID_VALUE);
- }
-}
-
-GL_APICALL void GL_APIENTRY glHint(GLenum target, GLenum mode){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::hintTargetMode(target,mode),GL_INVALID_ENUM);
- ctx->dispatcher().glHint(target,mode);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsEnabled(GLenum cap){
- GET_CTX_RET(GL_FALSE);
- RET_AND_SET_ERROR_IF(!GLESv2Validate::capability(cap),GL_INVALID_ENUM,GL_FALSE);
- return ctx->dispatcher().glIsEnabled(cap);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsBuffer(GLuint buffer){
- GET_CTX_RET(GL_FALSE)
- if(buffer && ctx->shareGroup().get()) {
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(VERTEXBUFFER,buffer);
- return objData.get() ? ((GLESbuffer*)objData.get())->wasBinded():GL_FALSE;
- }
- return GL_FALSE;
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer){
- GET_CTX_RET(GL_FALSE)
- if(framebuffer && ctx->shareGroup().get()){
- return (ctx->shareGroup()->isObject(FRAMEBUFFER,framebuffer) &&
- ctx->getFramebufferBinding() == framebuffer) ? GL_TRUE :GL_FALSE;
- }
- return GL_FALSE;
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer){
- GET_CTX_RET(GL_FALSE)
- if(renderbuffer && ctx->shareGroup().get()){
- return (ctx->shareGroup()->isObject(RENDERBUFFER,renderbuffer) &&
- ctx->getRenderbufferBinding() == renderbuffer) ? GL_TRUE :GL_FALSE;
- }
- return GL_FALSE;
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsTexture(GLuint texture){
- GET_CTX_RET(GL_FALSE)
- if (texture==0)
- return GL_FALSE;
- TextureData* tex = getTextureData(texture);
- return tex ? tex->wasBound : GL_FALSE;
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsProgram(GLuint program){
- GET_CTX_RET(GL_FALSE)
- if(program && ctx->shareGroup().get() &&
- ctx->shareGroup()->isObject(SHADER,program)) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- return ctx->dispatcher().glIsProgram(globalProgramName);
- }
- return GL_FALSE;
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsShader(GLuint shader){
- GET_CTX_RET(GL_FALSE)
- if(shader && ctx->shareGroup().get() &&
- ctx->shareGroup()->isObject(SHADER,shader)) {
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shader);
- return ctx->dispatcher().glIsShader(globalShaderName);
- }
- return GL_FALSE;
-}
-
-GL_APICALL void GL_APIENTRY glLineWidth(GLfloat width){
- GET_CTX();
- ctx->dispatcher().glLineWidth(width);
-}
-
-GL_APICALL void GL_APIENTRY glLinkProgram(GLuint program){
- GET_CTX();
- GLint linkStatus = GL_FALSE;
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
-
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(!objData.get(), GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA, GL_INVALID_OPERATION);
- ProgramData* programData = (ProgramData*)objData.get();
- GLint fragmentShader = programData->getAttachedFragmentShader();
- GLint vertexShader = programData->getAttachedVertexShader();
- if (vertexShader != 0 && fragmentShader!=0) {
- /* validating that the fragment & vertex shaders were compiled successfuly*/
- GLint fCompileStatus = GL_FALSE;
- GLint vCompileStatus = GL_FALSE;
- GLuint fragmentShaderGlobal = ctx->shareGroup()->getGlobalName(SHADER,fragmentShader);
- GLuint vertexShaderGlobal = ctx->shareGroup()->getGlobalName(SHADER,vertexShader);
- ctx->dispatcher().glGetShaderiv(fragmentShaderGlobal,GL_COMPILE_STATUS,&fCompileStatus);
- ctx->dispatcher().glGetShaderiv(vertexShaderGlobal,GL_COMPILE_STATUS,&vCompileStatus);
-
- if(fCompileStatus != 0 && vCompileStatus != 0){
- ctx->dispatcher().glLinkProgram(globalProgramName);
- ctx->dispatcher().glGetProgramiv(globalProgramName,GL_LINK_STATUS,&linkStatus);
- }
- }
- programData->setLinkStatus(linkStatus);
-
- GLsizei infoLogLength=0;
- GLchar* infoLog;
- ctx->dispatcher().glGetProgramiv(globalProgramName,GL_INFO_LOG_LENGTH,&infoLogLength);
- infoLog = new GLchar[infoLogLength+1];
- ctx->dispatcher().glGetProgramInfoLog(globalProgramName,infoLogLength,NULL,infoLog);
- programData->setInfoLog(infoLog);
- }
-}
-
-GL_APICALL void GL_APIENTRY glPixelStorei(GLenum pname, GLint param){
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::pixelStoreParam(pname),GL_INVALID_ENUM);
- SET_ERROR_IF(!((param==1)||(param==2)||(param==4)||(param==8)), GL_INVALID_VALUE);
- ctx->setUnpackAlignment(param);
- ctx->dispatcher().glPixelStorei(pname,param);
-}
-
-GL_APICALL void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units){
- GET_CTX();
- ctx->dispatcher().glPolygonOffset(factor,units);
-}
-
-GL_APICALL void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::readPixelFrmt(format) && GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM);
- SET_ERROR_IF((width < 0 || height < 0),GL_INVALID_VALUE);
- SET_ERROR_IF(!(GLESv2Validate::pixelOp(format,type)),GL_INVALID_OPERATION);
- SET_ERROR_IF(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE, GL_INVALID_FRAMEBUFFER_OPERATION);
- ctx->dispatcher().glReadPixels(x,y,width,height,format,type,pixels);
-}
-
-
-GL_APICALL void GL_APIENTRY glReleaseShaderCompiler(void){
-// this function doesn't work on Mac OS with MacOSX10.9sdk
-#ifndef __APPLE__
-
- /* Use this function with mesa will cause potential bug. Specifically,
- * calling this function between glCompileShader() and glLinkProgram() will
- * release resources that would be potentially used by glLinkProgram,
- * resulting in a segmentation fault.
- */
- const char* env = ::getenv("ANDROID_GL_LIB");
- if (env && !strcmp(env, "mesa")) {
- return;
- }
-
- GET_CTX();
-
- if(ctx->dispatcher().glReleaseShaderCompiler != NULL)
- {
- ctx->dispatcher().glReleaseShaderCompiler();
- }
-#endif // !__APPLE__
-}
-
-GL_APICALL void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height){
- GET_CTX();
- GLenum internal = internalformat;
- switch (internalformat) {
- case GL_RGB565:
- internal = GL_RGB;
- break;
- case GL_RGB5_A1:
- internal = GL_RGBA;
- break;
- default:
- internal = internalformat;
- break;
- }
-
- // Get current bounded renderbuffer
- // raise INVALID_OPERATIOn if no renderbuffer is bounded
- GLuint rb = ctx->getRenderbufferBinding();
- SET_ERROR_IF(rb == 0,GL_INVALID_OPERATION);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(RENDERBUFFER,rb);
- RenderbufferData *rbData = (RenderbufferData *)objData.get();
- SET_ERROR_IF(!rbData,GL_INVALID_OPERATION);
-
- //
- // if the renderbuffer was an eglImage target, detach from
- // the eglImage.
- //
- if (rbData->sourceEGLImage != 0) {
- if (rbData->eglImageDetach) {
- (*rbData->eglImageDetach)(rbData->sourceEGLImage);
- }
- rbData->sourceEGLImage = 0;
- rbData->eglImageGlobalTexName = 0;
- }
-
- ctx->dispatcher().glRenderbufferStorageEXT(target,internal,width,height);
-}
-
-GL_APICALL void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert){
- GET_CTX();
- ctx->dispatcher().glSampleCoverage(value,invert);
-}
-
-GL_APICALL void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height){
- GET_CTX();
- ctx->dispatcher().glScissor(x,y,width,height);
-}
-
-GL_APICALL void GL_APIENTRY glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length){
- GET_CTX();
-
- SET_ERROR_IF( (ctx->dispatcher().glShaderBinary == NULL), GL_INVALID_OPERATION);
-
- if(ctx->shareGroup().get()){
- for(int i=0; i < n ; i++){
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shaders[i]);
- SET_ERROR_IF(globalShaderName == 0,GL_INVALID_VALUE);
- ctx->dispatcher().glShaderBinary(1,&globalShaderName,binaryformat,binary,length);
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length){
- GET_CTX_V2();
- SET_ERROR_IF(count < 0,GL_INVALID_VALUE);
- if(ctx->shareGroup().get()){
- const GLuint globalShaderName = ctx->shareGroup()->getGlobalName(SHADER,shader);
- SET_ERROR_IF(globalShaderName == 0,GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,shader);
- SET_ERROR_IF(!objData.get(),GL_INVALID_OPERATION);
- SET_ERROR_IF(objData.get()->getDataType()!=SHADER_DATA,GL_INVALID_OPERATION);
- ShaderParser* sp = (ShaderParser*)objData.get();
- sp->setSrc(ctx->glslVersion(),count,string,length);
- ctx->dispatcher().glShaderSource(globalShaderName,1,sp->parsedLines(),NULL);
- sp->clear();
- }
-}
-
-GL_APICALL void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask){
- GET_CTX();
- ctx->dispatcher().glStencilFunc(func,ref,mask);
-}
-GL_APICALL void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask){
- GET_CTX();
- ctx->dispatcher().glStencilFuncSeparate(face,func,ref,mask);
-}
-GL_APICALL void GL_APIENTRY glStencilMask(GLuint mask){
- GET_CTX();
- ctx->dispatcher().glStencilMask(mask);
-}
-
-GL_APICALL void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask){
- GET_CTX();
- ctx->dispatcher().glStencilMaskSeparate(face,mask);
-}
-
-GL_APICALL void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass){
- GET_CTX();
- ctx->dispatcher().glStencilOp(fail,zfail,zpass);
-}
-
-GL_APICALL void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass){
- GET_CTX();
- switch (face) {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- break;
- default:
- SET_ERROR_IF(1, GL_INVALID_ENUM);
- }
- ctx->dispatcher().glStencilOp(fail,zfail,zpass);
-}
-
-#define GL_RGBA32F 0x8814
-#define GL_RGB32F 0x8815
-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){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::textureTargetEx(target) &&
- GLESv2Validate::pixelFrmt(ctx,format)&&
- GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM);
-
- SET_ERROR_IF(!GLESv2Validate::pixelFrmt(ctx,internalformat), GL_INVALID_VALUE);
- SET_ERROR_IF((GLESv2Validate::textureIsCubeMap(target) && width != height), GL_INVALID_VALUE);
- SET_ERROR_IF((format == GL_DEPTH_COMPONENT || internalformat == GL_DEPTH_COMPONENT) &&
- (type != GL_UNSIGNED_SHORT && type != GL_UNSIGNED_INT), GL_INVALID_OPERATION);
-
- SET_ERROR_IF((type == GL_UNSIGNED_SHORT || type == GL_UNSIGNED_INT) &&
- (format != GL_DEPTH_COMPONENT || internalformat != GL_DEPTH_COMPONENT), GL_INVALID_OPERATION);
-
- SET_ERROR_IF(!(GLESv2Validate::pixelOp(format,type) && internalformat == ((GLint)format)),GL_INVALID_OPERATION);
- SET_ERROR_IF(border != 0,GL_INVALID_VALUE);
-
- if (ctx->shareGroup().get()){
- TextureData *texData = getTextureTargetData(target);
- if(texData) {
- texData->width = width;
- texData->height = height;
- texData->border = border;
- texData->internalFormat = internalformat;
- texData->target = target;
-
- if (texData->sourceEGLImage != 0) {
- //
- // This texture was a target of EGLImage,
- // but now it is re-defined so we need to detach
- // from the EGLImage and re-generate global texture name
- // for it.
- //
- if (texData->eglImageDetach) {
- (*texData->eglImageDetach)(texData->sourceEGLImage);
- }
- unsigned int tex = ctx->getBindedTexture(target);
- ctx->shareGroup()->replaceGlobalName(TEXTURE,
- tex,
- texData->oldGlobal);
- ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, texData->oldGlobal);
- texData->sourceEGLImage = 0;
- texData->oldGlobal = 0;
- }
- }
- }
-
- if (type==GL_HALF_FLOAT_OES)
- type = GL_HALF_FLOAT_NV;
- if (pixels==NULL && type==GL_UNSIGNED_SHORT_5_5_5_1)
- type = GL_UNSIGNED_SHORT;
- if (type == GL_FLOAT)
- internalformat = (format == GL_RGBA) ? GL_RGBA32F : GL_RGB32F;
- ctx->dispatcher().glTexImage2D(target,level,internalformat,width,height,border,format,type,pixels);
-}
-
-
-GL_APICALL void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::textureTarget(target) && GLESv2Validate::textureParams(pname)),GL_INVALID_ENUM);
- ctx->dispatcher().glTexParameterf(target,pname,param);
-}
-GL_APICALL void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::textureTarget(target) && GLESv2Validate::textureParams(pname)),GL_INVALID_ENUM);
- ctx->dispatcher().glTexParameterfv(target,pname,params);
-}
-GL_APICALL void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::textureTarget(target) && GLESv2Validate::textureParams(pname)),GL_INVALID_ENUM);
- ctx->dispatcher().glTexParameteri(target,pname,param);
-}
-GL_APICALL void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::textureTarget(target) && GLESv2Validate::textureParams(pname)),GL_INVALID_ENUM);
- ctx->dispatcher().glTexParameteriv(target,pname,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){
- GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::textureTargetEx(target)), GL_INVALID_ENUM);
- SET_ERROR_IF(width < 0 || height < 0, GL_INVALID_VALUE);
- SET_ERROR_IF(!(GLESv2Validate::pixelFrmt(ctx,format)&&
- GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM);
- SET_ERROR_IF(!GLESv2Validate::pixelOp(format,type),GL_INVALID_OPERATION);
- SET_ERROR_IF(!pixels,GL_INVALID_OPERATION);
- if (type==GL_HALF_FLOAT_OES)
- type = GL_HALF_FLOAT_NV;
-
- ctx->dispatcher().glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels);
-
-}
-
-GL_APICALL void GL_APIENTRY glUniform1f(GLint location, GLfloat x){
- GET_CTX();
- ctx->dispatcher().glUniform1f(location,x);
-}
-GL_APICALL void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v){
- GET_CTX();
- ctx->dispatcher().glUniform1fv(location,count,v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform1i(GLint location, GLint x){
- GET_CTX();
- ctx->dispatcher().glUniform1i(location,x);
-}
-GL_APICALL void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v){
- GET_CTX();
- ctx->dispatcher().glUniform1iv(location,count,v);
-}
-GL_APICALL void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y){
- GET_CTX();
- ctx->dispatcher().glUniform2f(location,x,y);
-}
-GL_APICALL void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v){
- GET_CTX();
- ctx->dispatcher().glUniform2fv(location,count,v);
-}
-GL_APICALL void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y){
- GET_CTX();
- ctx->dispatcher().glUniform2i(location,x,y);
-}
-GL_APICALL void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v){
- GET_CTX();
- ctx->dispatcher().glUniform2iv(location,count,v);
-}
-GL_APICALL void GL_APIENTRY glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z){
- GET_CTX();
- ctx->dispatcher().glUniform3f(location,x,y,z);
-}
-GL_APICALL void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v){
- GET_CTX();
- ctx->dispatcher().glUniform3fv(location,count,v);
-}
-GL_APICALL void GL_APIENTRY glUniform3i(GLint location, GLint x, GLint y, GLint z){
- GET_CTX();
- ctx->dispatcher().glUniform3i(location,x,y,z);
-}
-
-GL_APICALL void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v){
- GET_CTX();
- ctx->dispatcher().glUniform3iv(location,count,v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w){
- GET_CTX();
- ctx->dispatcher().glUniform4f(location,x,y,z,w);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v){
- GET_CTX();
- ctx->dispatcher().glUniform4fv(location,count,v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w){
- GET_CTX();
- ctx->dispatcher().glUniform4i(location,x,y,z,w);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v){
- GET_CTX();
- ctx->dispatcher().glUniform4iv(location,count,v);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value){
- GET_CTX();
- SET_ERROR_IF(transpose != GL_FALSE,GL_INVALID_VALUE);
- ctx->dispatcher().glUniformMatrix2fv(location,count,transpose,value);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value){
- GET_CTX();
- SET_ERROR_IF(transpose != GL_FALSE,GL_INVALID_VALUE);
- ctx->dispatcher().glUniformMatrix3fv(location,count,transpose,value);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value){
- GET_CTX();
- SET_ERROR_IF(transpose != GL_FALSE,GL_INVALID_VALUE);
- ctx->dispatcher().glUniformMatrix4fv(location,count,transpose,value);
-}
-
-static void s_unUseCurrentProgram() {
- GET_CTX();
- GLint localCurrentProgram = 0;
- glGetIntegerv(GL_CURRENT_PROGRAM, &localCurrentProgram);
- if (!localCurrentProgram) return;
-
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,localCurrentProgram);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ProgramData* programData = (ProgramData*)objData.get();
- programData->setInUse(false);
- if (programData->getDeleteStatus()) { glDeleteProgram(localCurrentProgram); }
-}
-
-GL_APICALL void GL_APIENTRY glUseProgram(GLuint program){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(program!=0 && globalProgramName==0,GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(objData.get() && (objData.get()->getDataType()!=PROGRAM_DATA),GL_INVALID_OPERATION);
-
- s_unUseCurrentProgram();
-
- ProgramData* programData = (ProgramData*)objData.get();
- if (programData) programData->setInUse(true);
-
- ctx->dispatcher().glUseProgram(globalProgramName);
- }
-}
-
-GL_APICALL void GL_APIENTRY glValidateProgram(GLuint program){
- GET_CTX();
- if(ctx->shareGroup().get()) {
- const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(SHADER,program);
- SET_ERROR_IF(globalProgramName==0, GL_INVALID_VALUE);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(SHADER,program);
- SET_ERROR_IF(objData.get()->getDataType()!=PROGRAM_DATA,GL_INVALID_OPERATION);
- ProgramData* programData = (ProgramData*)objData.get();
- ctx->dispatcher().glValidateProgram(globalProgramName);
-
- GLsizei infoLogLength=0;
- GLchar* infoLog;
- ctx->dispatcher().glGetProgramiv(globalProgramName,GL_INFO_LOG_LENGTH,&infoLogLength);
- infoLog = new GLchar[infoLogLength+1];
- ctx->dispatcher().glGetProgramInfoLog(globalProgramName,infoLogLength,NULL,infoLog);
- programData->setInfoLog(infoLog);
- }
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib1f(GLuint indx, GLfloat x){
- GET_CTX_V2();
- ctx->dispatcher().glVertexAttrib1f(indx,x);
- if(indx == 0)
- ctx->setAttribute0value(x, 0.0, 0.0, 1.0);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib1fv(GLuint indx, const GLfloat* values){
- GET_CTX_V2();
- ctx->dispatcher().glVertexAttrib1fv(indx,values);
- if(indx == 0)
- ctx->setAttribute0value(values[0], 0.0, 0.0, 1.0);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y){
- GET_CTX_V2();
- ctx->dispatcher().glVertexAttrib2f(indx,x,y);
- if(indx == 0)
- ctx->setAttribute0value(x, y, 0.0, 1.0);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib2fv(GLuint indx, const GLfloat* values){
- GET_CTX_V2();
- ctx->dispatcher().glVertexAttrib2fv(indx,values);
- if(indx == 0)
- ctx->setAttribute0value(values[0], values[1], 0.0, 1.0);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z){
- GET_CTX_V2();
- ctx->dispatcher().glVertexAttrib3f(indx,x,y,z);
- if(indx == 0)
- ctx->setAttribute0value(x, y, z, 1.0);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib3fv(GLuint indx, const GLfloat* values){
- GET_CTX_V2();
- ctx->dispatcher().glVertexAttrib3fv(indx,values);
- if(indx == 0)
- ctx->setAttribute0value(values[0], values[1], values[2], 1.0);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w){
- GET_CTX_V2();
- ctx->dispatcher().glVertexAttrib4f(indx,x,y,z,w);
- if(indx == 0)
- ctx->setAttribute0value(x, y, z, w);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib4fv(GLuint indx, const GLfloat* values){
- GET_CTX_V2();
- ctx->dispatcher().glVertexAttrib4fv(indx,values);
- if(indx == 0)
- ctx->setAttribute0value(values[0], values[1], values[2], values[3]);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr){
- GET_CTX();
- SET_ERROR_IF((!GLESv2Validate::arrayIndex(ctx,indx)),GL_INVALID_VALUE);
- if (type == GL_HALF_FLOAT_OES) type = GL_HALF_FLOAT;
- ctx->setPointer(indx,size,type,stride,ptr,normalized);
-}
-
-GL_APICALL void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height){
- GET_CTX();
- ctx->dispatcher().glViewport(x,y,width,height);
-}
-
-GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- GET_CTX();
- SET_ERROR_IF(!GLESv2Validate::textureTargetLimited(target),GL_INVALID_ENUM);
- unsigned int imagehndl = SafeUIntFromPointer(image);
- EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl);
- if (img) {
- // Create the texture object in the underlying EGL implementation,
- // flag to the OpenGL layer to skip the image creation and map the
- // current binded texture object to the existing global object.
- if (ctx->shareGroup().get()) {
- ObjectLocalName tex = TextureLocalName(target,ctx->getBindedTexture(target));
- unsigned int oldGlobal = ctx->shareGroup()->getGlobalName(TEXTURE, tex);
- // Delete old texture object but only if it is not a target of a EGLImage
- if (oldGlobal) {
- TextureData* oldTexData = getTextureData(tex);
- if (!oldTexData || oldTexData->sourceEGLImage == 0) {
- ctx->dispatcher().glDeleteTextures(1, &oldGlobal);
- }
- }
- // replace mapping and bind the new global object
- ctx->shareGroup()->replaceGlobalName(TEXTURE, tex,img->globalTexName);
- ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, img->globalTexName);
- TextureData *texData = getTextureTargetData(target);
- SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
- texData->width = img->width;
- texData->height = img->height;
- texData->border = img->border;
- texData->internalFormat = img->internalFormat;
- texData->sourceEGLImage = imagehndl;
- texData->eglImageDetach = s_eglIface->eglDetachEGLImage;
- texData->oldGlobal = oldGlobal;
- }
- }
-}
-
-GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
- GET_CTX();
- SET_ERROR_IF(target != GL_RENDERBUFFER_OES,GL_INVALID_ENUM);
- unsigned int imagehndl = SafeUIntFromPointer(image);
- EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl);
- SET_ERROR_IF(!img,GL_INVALID_VALUE);
- SET_ERROR_IF(!ctx->shareGroup().get(),GL_INVALID_OPERATION);
-
- // Get current bounded renderbuffer
- // raise INVALID_OPERATIOn if no renderbuffer is bounded
- GLuint rb = ctx->getRenderbufferBinding();
- SET_ERROR_IF(rb == 0,GL_INVALID_OPERATION);
- ObjectDataPtr objData = ctx->shareGroup()->getObjectData(RENDERBUFFER,rb);
- RenderbufferData *rbData = (RenderbufferData *)objData.get();
- SET_ERROR_IF(!rbData,GL_INVALID_OPERATION);
-
- //
- // flag in the renderbufferData that it is an eglImage target
- //
- rbData->sourceEGLImage = imagehndl;
- rbData->eglImageDetach = s_eglIface->eglDetachEGLImage;
- rbData->eglImageGlobalTexName = img->globalTexName;
-
- //
- // if the renderbuffer is attached to a framebuffer
- // change the framebuffer attachment in the undelying OpenGL
- // to point to the eglImage texture object.
- //
- if (rbData->attachedFB) {
- // update the framebuffer attachment point to the
- // underlying texture of the img
- GLuint prevFB = ctx->getFramebufferBinding();
- if (prevFB != rbData->attachedFB) {
- ctx->dispatcher().glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,
- rbData->attachedFB);
- }
- ctx->dispatcher().glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
- rbData->attachedPoint,
- GL_TEXTURE_2D,
- img->globalTexName,0);
- if (prevFB != rbData->attachedFB) {
- ctx->dispatcher().glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,
- prevFB);
- }
- }
-}
-
-GL_APICALL GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags)
-{
- GET_CTX_V2_RET(NULL);
- return ctx->dispatcher().glFenceSync(condition, flags);
-}
-
-GL_APICALL GLenum GL_APIENTRY glClientWaitSync(GLsync wait_on, GLbitfield flags, GLuint64 timeout)
-{
- GET_CTX_V2_RET(GL_WAIT_FAILED);
- return ctx->dispatcher().glClientWaitSync(wait_on, flags, timeout);
-}
-
-GL_APICALL void GL_APIENTRY glWaitSync(GLsync wait_on, GLbitfield flags, GLuint64 timeout)
-{
- GET_CTX_V2();
- ctx->dispatcher().glWaitSync(wait_on, flags, timeout);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteSync(GLsync to_delete)
-{
- GET_CTX_V2();
- ctx->dispatcher().glDeleteSync(to_delete);
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp
deleted file mode 100644
index b71131750..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp
+++ /dev/null
@@ -1,184 +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"
-#include <string.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_LUMINANCE_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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.h b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.h
deleted file mode 100644
index b7cd07de6..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef GLES_V2_VALIDATE_H
-#define GLES_V2_VALIDATE_H
-
-#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
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/ProgramData.cpp b/distrib/android-emugl/host/libs/Translator/GLES_V2/ProgramData.cpp
deleted file mode 100644
index b008e919e..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/ProgramData.cpp
+++ /dev/null
@@ -1,98 +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),
- IsInUse(false),
- DeleteStatus(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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/ProgramData.h b/distrib/android-emugl/host/libs/Translator/GLES_V2/ProgramData.h
deleted file mode 100644
index 7ce580159..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/ProgramData.h
+++ /dev/null
@@ -1,51 +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();
-
- bool isInUse() const { return IsInUse; }
- void setInUse(bool inUse) { IsInUse = inUse; }
-
- bool getDeleteStatus() const { return DeleteStatus; }
- void setDeleteStatus(bool status) { DeleteStatus = status; }
-private:
- GLuint AttachedVertexShader;
- GLuint AttachedFragmentShader;
- GLint LinkStatus;
- GLchar* infoLog;
- bool IsInUse;
- bool DeleteStatus;
-};
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/ShaderParser.cpp b/distrib/android-emugl/host/libs/Translator/GLES_V2/ShaderParser.cpp
deleted file mode 100644
index 374c8b7b0..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/ShaderParser.cpp
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "ShaderParser.h"
-#include "ShaderValidator.h"
-#include <stdlib.h>
-#include <string.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-ShaderParser::ShaderParser(GLenum type):ObjectData(SHADER_DATA), m_type(type) {}
-
-void ShaderParser::validateGLESKeywords(const char* src) {
- m_valid = validate_glsles_keywords(src);
-}
-
-void ShaderParser::setSrc(const Version& ver,GLsizei count,const GLchar* const* strings,const GLint* length){
- m_src.clear();
- for(int i = 0;i<count;i++){
- const size_t strLen =
- (length && length[i] >= 0) ? length[i] : strlen(strings[i]);
- m_src.append(strings[i], strings[i] + strLen);
- }
- // Store original source as some 'parsing' functions actually modify m_src.
- // Note: assign() call is a workaround for the reference-counting
- // std::string in GCC's STL - we need a deep copy here.
- m_originalSrc.assign(m_src.c_str(), m_src.size());
-
- validateGLESKeywords(m_originalSrc.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);
-};
-
-void ShaderParser::clear() {
- m_parsedLines = nullptr;
- std::string().swap(m_parsedSrc);
- std::string().swap(m_src);
-}
-
-const std::string& ShaderParser::getOriginalSrc() const {
- 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;
-
- #define IS_VALID_VERSION(v) ( (v) == 100 || (v) == 300 || (v) == 310 )
-
- 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 (!IS_VALID_VERSION(ver) || 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;
-
- 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) {
- assert(infoLog);
- std::unique_ptr<GLchar[]> infoLogDeleter(infoLog);
- m_infoLog.assign(infoLog);
-}
-
-bool ShaderParser::validShader() const {
- return m_valid;
-}
-
-static const GLchar glsles_invalid[] =
- { "ERROR: Valid GLSL but not GLSL ES" };
-
-void ShaderParser::setInvalidInfoLog() {
- m_infoLog = glsles_invalid;
-}
-
-const GLchar* ShaderParser::getInfoLog() const {
- return m_infoLog.c_str();
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/ShaderParser.h b/distrib/android-emugl/host/libs/Translator/GLES_V2/ShaderParser.h
deleted file mode 100644
index 107c278d1..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/ShaderParser.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef 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(GLenum type = 0);
- void setSrc(const Version& ver,GLsizei count,const GLchar* const* strings,const GLint* length);
- const std::string& getOriginalSrc() const;
- const GLchar** parsedLines();
- void clear();
- GLenum getType();
-
- void setInfoLog(GLchar * infoLog);
- // Query whether the shader parsed is valid.
- // Don't trust the value if we did not call setSrc
- bool validShader() const;
- // If validation fails, add proper error messages
- // to the parser's info log, which is treated
- // as the actual info log from guest POV.
- void setInvalidInfoLog();
-
- const GLchar* getInfoLog() const;
-
- void setDeleteStatus(bool val) { m_deleteStatus = val; }
- bool getDeleteStatus() const { return m_deleteStatus; }
-
- void setAttachedProgram(GLuint program) { m_program = program; }
- GLuint getAttachedProgram() const { return m_program; }
-private:
- // For shader validation purposes, analyze keywords like lowp/highp
- // appearing in variable declarations or function parameters.
- void validateGLESKeywords(const char* src);
-
- void parseOriginalSrc();
- void parseGLSLversion();
- void parseBuiltinConstants();
- void parseOmitPrecision();
- void parseExtendDefaultPrecision();
- void parseLineNumbers();
- void clearParsedSrc();
-
- GLenum m_type = 0;
- std::string m_originalSrc;
- std::string m_src;
- std::string m_parsedSrc;
- GLchar* m_parsedLines = nullptr;
- std::basic_string<GLchar> m_infoLog;
- bool m_deleteStatus = false;
- GLuint m_program = 0;
- bool m_valid = true;
-};
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/Android.mk b/distrib/android-emugl/host/libs/Translator/GLcommon/Android.mk
deleted file mode 100644
index d58d44dca..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-host_common_SRC_FILES := \
- GLDispatch.cpp \
- GLutils.cpp \
- GLEScontext.cpp \
- GLESvalidate.cpp \
- GLESpointer.cpp \
- GLESbuffer.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-static-library,libGLcommon)
-
-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, libemugl_common)
-
-$(call emugl-end-module)
-
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/FramebufferData.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/FramebufferData.cpp
deleted file mode 100644
index 50b068a3b..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/FramebufferData.cpp
+++ /dev/null
@@ -1,196 +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() {
- if (sourceEGLImage && eglImageDetach) (*eglImageDetach)(sourceEGLImage);
-}
-
-FramebufferData::FramebufferData(GLuint name) : m_fbName(name) {}
-
-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 (!name) {
- detachObject(idx);
- return;
- }
- if (m_attachPoints[idx].target != target ||
- m_attachPoints[idx].name != name ||
- m_attachPoints[idx].obj.get() != obj.get() ||
- 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.get() != NULL) {
- RenderbufferData *rbData = (RenderbufferData *)obj.get();
- 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.get() != NULL) {
- RenderbufferData *rbData = (RenderbufferData *)m_attachPoints[idx].obj.get();
- 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] = {};
-}
-
-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(), 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;
- }
-}
-
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/GLDispatch.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/GLDispatch.cpp
deleted file mode 100644
index 4eca59a50..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/GLDispatch.cpp
+++ /dev/null
@@ -1,117 +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 "GLcommon/GLLibrary.h"
-
-#include "emugl/common/lazy_instance.h"
-#include "emugl/common/shared_library.h"
-
-#include "OpenglCodecCommon/ErrorLog.h"
-
-#ifdef __linux__
-#include <GL/glx.h>
-#elif defined(WIN32)
-#include <windows.h>
-#endif
-
-#include <stdio.h>
-
-typedef GlLibrary::GlFunctionPointer GL_FUNC_PTR;
-
-static GL_FUNC_PTR getGLFuncAddress(const char *funcName) {
- return GlLibrary::getHostInstance()->findSymbol(funcName);
-}
-
-#define LOAD_GL_FUNC(return_type, func_name, signature) do { \
- if (!func_name) { \
- void* address = (void *)getGLFuncAddress(#func_name); \
- if (address) { \
- func_name = (__typeof__(func_name))(address); \
- } else { \
- fprintf(stderr, "Could not load func %s\n", #func_name); \
- func_name = (__typeof__(func_name))(dummy_##func_name); \
- } \
- } \
- } while (0);
-
-#define LOAD_GLEXT_FUNC(return_type, func_name, signature) do { \
- if (!func_name) { \
- void* address = (void *)getGLFuncAddress(#func_name); \
- if (address) { \
- func_name = (__typeof__(func_name))(address); \
- } \
- } \
- } while (0);
-
-
-// Define dummy functions, only for non-extensions.
-
-#define RETURN_void return
-#define RETURN_GLboolean return GL_FALSE
-#define RETURN_GLint return 0
-#define RETURN_GLuint return 0U
-#define RETURN_GLenum return 0
-#define RETURN_int return 0
-#define RETURN_GLconstubyteptr return NULL
-
-#define RETURN_(x) RETURN_ ## x
-
-#define DEFINE_DUMMY_FUNCTION(return_type, func_name, signature) \
-static return_type dummy_##func_name signature { \
- RETURN_(return_type); \
-}
-
-#define DEFINE_DUMMY_EXTENSION_FUNCTION(return_type, func_name, signature) \
- // nothing here
-
-LIST_GLES_FUNCTIONS(DEFINE_DUMMY_FUNCTION, DEFINE_DUMMY_EXTENSION_FUNCTION)
-
-// Initializing static GLDispatch members*/
-
-emugl::Mutex GLDispatch::s_lock;
-
-#define GL_DISPATCH_DEFINE_POINTER(return_type, function_name, signature) \
- GL_APICALL return_type (GL_APIENTRY *GLDispatch::function_name) signature = NULL;
-
-LIST_GLES_FUNCTIONS(GL_DISPATCH_DEFINE_POINTER, GL_DISPATCH_DEFINE_POINTER)
-
-// Constructor.
-GLDispatch::GLDispatch() : m_isLoaded(false) {}
-
-void GLDispatch::dispatchFuncs(GLESVersion version) {
- emugl::Mutex::AutoLock mutex(s_lock);
- if(m_isLoaded)
- return;
-
- /* Loading OpenGL functions which are needed for implementing BOTH GLES 1.1 & GLES 2.0*/
- LIST_GLES_COMMON_FUNCTIONS(LOAD_GL_FUNC)
- LIST_GLES_EXTENSIONS_FUNCTIONS(LOAD_GLEXT_FUNC)
-
- /* Loading OpenGL functions which are needed ONLY for implementing GLES 1.1*/
- if(version == GLES_1_1){
- LIST_GLES1_ONLY_FUNCTIONS(LOAD_GL_FUNC)
- LIST_GLES1_EXTENSIONS_FUNCTIONS(LOAD_GLEXT_FUNC)
- } else if (version == GLES_2_0){
- LIST_GLES2_ONLY_FUNCTIONS(LOAD_GL_FUNC)
- LIST_GLES2_EXTENSIONS_FUNCTIONS(LOAD_GLEXT_FUNC)
- }
-
- /* Load glGetStringi() if it is available, so use LOAD_GLEXT_FUNC */
- LIST_GLES3_ONLY_FUNCTIONS(LOAD_GLEXT_FUNC)
-
- m_isLoaded = true;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/GLESbuffer.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/GLESbuffer.cpp
deleted file mode 100644
index 5dcdd6564..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/GLESbuffer.cpp
+++ /dev/null
@@ -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;
- }
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/GLEScontext.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/GLEScontext.cpp
deleted file mode 100644
index bbd077efb..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/GLEScontext.cpp
+++ /dev/null
@@ -1,826 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <GLcommon/GLEScontext.h>
-#include <GLcommon/GLconversion_macros.h>
-#include <GLcommon/GLESmacros.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <OpenglCodecCommon/ErrorLog.h>
-#include <GLcommon/GLESvalidate.h>
-#include <GLcommon/TextureUtils.h>
-#include <GLcommon/FramebufferData.h>
-#include <strings.h>
-#include <string.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;
-emugl::Mutex GLEScontext::s_lock;
-std::string* GLEScontext::s_glExtensions= NULL;
-std::string GLEScontext::s_glVendor;
-std::string GLEScontext::s_glRenderer;
-std::string GLEScontext::s_glVersion;
-GLSupport GLEScontext::s_glSupport;
-
-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;
-}
-
-static std::string getHostExtensionsString(GLDispatch* dispatch) {
- // glGetString(GL_EXTENSIONS) is deprecated in GL 3.0, one has to use
- // glGetStringi(GL_EXTENSIONS, index) instead to get individual extension
- // names. Recent desktop drivers implement glGetStringi() but have a
- // version of glGetString() that returns NULL, so deal with this by
- // doing the following:
- //
- // - If glGetStringi() is available, use it to build the extensions
- // string, using simple spaces to separate the names.
- //
- // - Otherwise, fallback to getGetString(). If it returns NULL, return
- // an empty string.
- //
- std::string result;
- if (dispatch->glGetStringi != nullptr) {
- int count = 0;
- dispatch->glGetIntegerv(GL_NUM_EXTENSIONS, &count);
- for (int n = 0; n < count; n++) {
- const char* ext = reinterpret_cast<const char*>(
- dispatch->glGetStringi(GL_EXTENSIONS, n));
- if (ext != NULL) {
- if (!result.empty()) {
- result += " ";
- }
- result += ext;
- }
- }
- } else {
- const char* extensions = reinterpret_cast<const char*>(
- dispatch->glGetString(GL_EXTENSIONS));
- if (extensions) {
- result = extensions;
- }
- }
- // For the sake of initCapsLocked() add a starting and trailing space.
- if (!result.empty()) {
- if (result[0] != ' ') {
- result.insert(0, 1, ' ');
- }
- if (result[result.size() - 1U] != ' ') {
- result += ' ';
- }
- }
- return result;
-}
-
-void GLEScontext::init(GlLibrary* glLib) {
-
- if (!s_glExtensions) {
- initCapsLocked(reinterpret_cast<const GLubyte*>(
- getHostExtensionsString(&s_glDispatch).c_str()));
- // NOTE: the string below corresponds to the extensions reported
- // by this context, which is initialized in each GLESv1 or GLESv2
- // context implementation, based on the parsing of the host
- // extensions string performed by initCapsLocked(). I.e. it will
- // be populated after calling this ::init() method.
- 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;
- }
- }
- }
-}
-
-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) {
- unsigned int offset = SafeUIntFromPointer(data);
- GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).get());
- 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;
- int attribSize = p->getSize();
- int stride = p->getStride()?p->getStride():sizeof(GLfixed)*attribSize;
- 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;
- 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).get());
- return vbo->getData();
-}
-
-void GLEScontext::getBufferSize(GLenum target,GLint* param) {
- GLuint bufferName = getBuffer(target);
- GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).get());
- *param = vbo->getSize();
-}
-
-void GLEScontext::getBufferUsage(GLenum target,GLint* param) {
- GLuint bufferName = getBuffer(target);
- GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).get());
- *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).get());
- 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).get());
- 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::getVendorString() const {
- return s_glVendor.c_str();
-}
-
-const char * GLEScontext::getRendererString() const {
- return s_glRenderer.c_str();
-}
-
-const char * GLEScontext::getVersionString() const {
- return s_glVersion.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);
- s_glDispatch.glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &s_glSupport.maxCombinedTexImageUnits);
- const GLubyte* glslVersion = s_glDispatch.glGetString(GL_SHADING_LANGUAGE_VERSION);
- s_glSupport.glslVersion = Version((const char*)(glslVersion));
- const GLubyte* glVersion = s_glDispatch.glGetString(GL_VERSION);
-
- 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;
-
- if (strstr(cstring,"GL_ARB_texture_non_power_of_two")!=NULL)
- s_glSupport.GL_OES_TEXTURE_NPOT = true;
-
- if (!(Version((const char*)glVersion) < Version("3.0")) || strstr(cstring,"GL_OES_rgb8_rgba8")!=NULL)
- s_glSupport.GL_OES_RGB8_RGBA8 = true;
-
- // Check for anisotropic filtering support.
- // We should be able to count on this being in most desktop OpenGL implementations,
- // but display a message if it is in fact not supported (e.g., Mesa)
- if (strstr(cstring,"GL_EXT_texture_filter_anisotropic") == NULL) {
- ERR("OpenGL warning: Anisotropic filtering not supported in underlying system OpenGL\n");
- }
-}
-
-void GLEScontext::buildStrings(const char* baseVendor,
- const char* baseRenderer, const char* baseVersion, const char* version)
-{
- static const char VENDOR[] = {"Google ("};
- static const char RENDERER[] = {"Android Emulator OpenGL ES Translator ("};
- const size_t VENDOR_LEN = sizeof(VENDOR) - 1;
- const size_t RENDERER_LEN = sizeof(RENDERER) - 1;
-
- // Sanitize the strings as some OpenGL implementations return NULL
- // when asked the basic questions (this happened at least once on a client
- // machine)
- if (!baseVendor) {
- baseVendor = "N/A";
- }
- if (!baseRenderer) {
- baseRenderer = "N/A";
- }
- if (!baseVersion) {
- baseVersion = "N/A";
- }
- if (!version) {
- version = "N/A";
- }
-
- size_t baseVendorLen = strlen(baseVendor);
- s_glVendor.clear();
- s_glVendor.reserve(baseVendorLen + VENDOR_LEN + 1);
- s_glVendor.append(VENDOR, VENDOR_LEN);
- s_glVendor.append(baseVendor, baseVendorLen);
- s_glVendor.append(")", 1);
-
- size_t baseRendererLen = strlen(baseRenderer);
- s_glRenderer.clear();
- s_glRenderer.reserve(baseRendererLen + RENDERER_LEN + 1);
- s_glRenderer.append(RENDERER, RENDERER_LEN);
- s_glRenderer.append(baseRenderer, baseRendererLen);
- s_glRenderer.append(")", 1);
-
- size_t baseVersionLen = strlen(baseVersion);
- size_t versionLen = strlen(version);
- s_glVersion.clear();
- s_glVersion.reserve(baseVersionLen + versionLen + 3);
- s_glVersion.append(version, versionLen);
- s_glVersion.append(" (", 2);
- s_glVersion.append(baseVersion, baseVersionLen);
- s_glVersion.append(")", 1);
-}
-
-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;
-
- case GL_MAX_TEXTURE_SIZE:
- *params = getMaxTexSize();
- 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.get() == NULL)
- return;
-
- FramebufferData *fbData = (FramebufferData *)fbObj.get();
-
- fbData->validate(this);
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/GLESpointer.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/GLESpointer.cpp
deleted file mode 100644
index e861a9b5f..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/GLESpointer.cpp
+++ /dev/null
@@ -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(),
- m_buffer(),
- 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);
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/GLESvalidate.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/GLESvalidate.cpp
deleted file mode 100644
index 8e35978a6..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/GLESvalidate.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <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::bufferUsage(GLenum usage) {
- switch(usage) {
- case GL_STREAM_DRAW:
- case GL_STATIC_DRAW:
- case GL_DYNAMIC_DRAW:
- return true;
- }
- return false;
-}
-
-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);
-}
-
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/GLutils.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/GLutils.cpp
deleted file mode 100644
index 46e292c23..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/GLutils.cpp
+++ /dev/null
@@ -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;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/PaletteTexture.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/PaletteTexture.cpp
deleted file mode 100644
index c99ed072d..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/PaletteTexture.cpp
+++ /dev/null
@@ -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;
-}
-
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/RangeManip.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/RangeManip.cpp
deleted file mode 100644
index 2d6f11932..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/RangeManip.cpp
+++ /dev/null
@@ -1,127 +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 true;
- }
- return false;
-}
-
-void RangeList::addRange(const Range& r) {
- if(r.getSize())
- 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);
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/TextureUtils.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/TextureUtils.cpp
deleted file mode 100644
index 81152f6a3..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/TextureUtils.cpp
+++ /dev/null
@@ -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;
- }
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/etc1.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/etc1.cpp
deleted file mode 100644
index 97d10851d..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/etc1.cpp
+++ /dev/null
@@ -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(c * 15);
-}
-
-static
-inline int convert8To5(int b) {
- int c = b & 0xff;
- return divideBy255(c * 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);
-}
diff --git a/distrib/android-emugl/host/libs/Translator/GLcommon/objectNameManager.cpp b/distrib/android-emugl/host/libs/Translator/GLcommon/objectNameManager.cpp
deleted file mode 100644
index 0f67a420a..000000000
--- a/distrib/android-emugl/host/libs/Translator/GLcommon/objectNameManager.cpp
+++ /dev/null
@@ -1,379 +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/objectNameManager.h>
-#include <GLcommon/GLEScontext.h>
-
-#include <utility>
-
-namespace {
-// A struct serving as a key in a hash table, represents an object name with
-// object type together.
-struct TypedObjectName {
- ObjectLocalName name;
- NamedObjectType type;
-
- TypedObjectName(NamedObjectType type, ObjectLocalName name)
- : name(name), type(type) {}
-
- bool operator==(const TypedObjectName& other) const noexcept {
- return name == other.name && type == other.type;
- }
-};
-} // namespace
-
-namespace std {
-template <>
-struct hash<TypedObjectName> {
- size_t operator()(const TypedObjectName& tn) const noexcept {
- return hash<int>()(tn.name) ^
- hash<ObjectLocalName>()(tn.type);
- }
-};
-} // namespace std
-
-using ObjectDataMap = std::unordered_map<TypedObjectName, ObjectDataPtr>;
-
-NameSpace::NameSpace(NamedObjectType p_type,
- GlobalNameSpace *globalNameSpace) :
- 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;
- m_globalToLocalMap[globalName] = localName;
- }
-
- 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)
-{
- const auto it = m_globalToLocalMap.find(p_globalName);
- if (it != m_globalToLocalMap.end()) {
- return it->second;
- }
-
- 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_globalToLocalMap.erase(n->second);
- m_localToGlobalMap.erase(n);
- }
-}
-
-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);
- m_globalToLocalMap.erase(n->second);
- (*n).second = p_globalName;
- m_globalToLocalMap.emplace(p_globalName, p_localName);
- }
-}
-
-unsigned int
-GlobalNameSpace::genName(NamedObjectType p_type)
-{
- if ( p_type >= NUM_OBJECT_TYPES ) return 0;
- unsigned int name = 0;
-
- emugl::Mutex::AutoLock _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;
- }
- return name;
-}
-
-void
-GlobalNameSpace::deleteName(NamedObjectType p_type, unsigned int p_name)
-{
-}
-
-ShareGroup::ShareGroup(GlobalNameSpace *globalNameSpace) {
- for (int i=0; i < NUM_OBJECT_TYPES; i++) {
- m_nameSpace[i] = new NameSpace((NamedObjectType)i, globalNameSpace);
- }
-}
-
-ShareGroup::~ShareGroup()
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- for (int t = 0; t < NUM_OBJECT_TYPES; t++) {
- delete m_nameSpace[t];
- }
-
- delete (ObjectDataMap *)m_objectsData;
-}
-
-ObjectLocalName
-ShareGroup::genName(NamedObjectType p_type,
- ObjectLocalName p_localName,
- bool genLocal)
-{
- if (p_type >= NUM_OBJECT_TYPES) return 0;
-
- emugl::Mutex::AutoLock _lock(m_lock);
- ObjectLocalName localName =
- m_nameSpace[p_type]->genName(p_localName, true, genLocal);
- return localName;
-}
-
-unsigned int
-ShareGroup::genGlobalName(NamedObjectType p_type)
-{
- if (p_type >= NUM_OBJECT_TYPES) return 0;
-
- emugl::Mutex::AutoLock _lock(m_lock);
- return m_nameSpace[p_type]->genGlobalName();
-}
-
-unsigned int
-ShareGroup::getGlobalName(NamedObjectType p_type,
- ObjectLocalName p_localName)
-{
- if (p_type >= NUM_OBJECT_TYPES) return 0;
-
- emugl::Mutex::AutoLock _lock(m_lock);
- return m_nameSpace[p_type]->getGlobalName(p_localName);
-}
-
-ObjectLocalName
-ShareGroup::getLocalName(NamedObjectType p_type,
- unsigned int p_globalName)
-{
- if (p_type >= NUM_OBJECT_TYPES) return 0;
-
- emugl::Mutex::AutoLock _lock(m_lock);
- return m_nameSpace[p_type]->getLocalName(p_globalName);
-}
-
-void
-ShareGroup::deleteName(NamedObjectType p_type, ObjectLocalName p_localName)
-{
- if (p_type >= NUM_OBJECT_TYPES) return;
-
- emugl::Mutex::AutoLock _lock(m_lock);
- m_nameSpace[p_type]->deleteName(p_localName);
- ObjectDataMap *map = (ObjectDataMap *)m_objectsData;
- if (map) {
- map->erase(TypedObjectName(p_type, p_localName));
- }
-}
-
-bool
-ShareGroup::isObject(NamedObjectType p_type, ObjectLocalName p_localName)
-{
- if (p_type >= NUM_OBJECT_TYPES) return 0;
-
- emugl::Mutex::AutoLock _lock(m_lock);
- return m_nameSpace[p_type]->isObject(p_localName);
-}
-
-void
-ShareGroup::replaceGlobalName(NamedObjectType p_type,
- ObjectLocalName p_localName,
- unsigned int p_globalName)
-{
- if (p_type >= NUM_OBJECT_TYPES) return;
-
- emugl::Mutex::AutoLock _lock(m_lock);
- m_nameSpace[p_type]->replaceGlobalName(p_localName, p_globalName);
-}
-
-void
-ShareGroup::setObjectData(NamedObjectType p_type,
- ObjectLocalName p_localName,
- ObjectDataPtr data)
-{
- if (p_type >= NUM_OBJECT_TYPES) return;
-
- emugl::Mutex::AutoLock _lock(m_lock);
-
- ObjectDataMap *map = (ObjectDataMap *)m_objectsData;
- if (!map) {
- map = new ObjectDataMap();
- m_objectsData = map;
- }
-
- TypedObjectName id(p_type, p_localName);
- map->emplace(id, std::move(data));
-}
-
-ObjectDataPtr
-ShareGroup::getObjectData(NamedObjectType p_type,
- ObjectLocalName p_localName)
-{
- ObjectDataPtr ret;
-
- if (p_type >= NUM_OBJECT_TYPES) return ret;
-
- emugl::Mutex::AutoLock _lock(m_lock);
-
- ObjectDataMap *map = (ObjectDataMap *)m_objectsData;
- if (map) {
- ObjectDataMap::iterator i =
- map->find(TypedObjectName(p_type, p_localName));
- if (i != map->end()) ret = (*i).second;
- }
- return ret;
-}
-
-ObjectNameManager::ObjectNameManager(GlobalNameSpace *globalNameSpace) :
- m_globalNameSpace(globalNameSpace) {}
-
-ShareGroupPtr
-ObjectNameManager::createShareGroup(void *p_groupName)
-{
- emugl::Mutex::AutoLock _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.emplace(p_groupName, shareGroupReturn);
- }
-
- return shareGroupReturn;
-}
-
-ShareGroupPtr
-ObjectNameManager::getShareGroup(void *p_groupName)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
-
- ShareGroupPtr shareGroupReturn;
-
- ShareGroupsMap::iterator s( m_groups.find(p_groupName) );
- if (s != m_groups.end()) {
- shareGroupReturn = (*s).second;
- }
-
- return shareGroupReturn;
-}
-
-ShareGroupPtr
-ObjectNameManager::attachShareGroup(void *p_groupName,
- void *p_existingGroupName)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
-
- ShareGroupsMap::iterator s( m_groups.find(p_existingGroupName) );
- if (s == m_groups.end()) {
- // ShareGroup is not found !!!
- return ShareGroupPtr();
- }
-
- ShareGroupPtr shareGroupReturn((*s).second);
- if (m_groups.find(p_groupName) == m_groups.end()) {
- m_groups.emplace(p_groupName, shareGroupReturn);
- }
- return shareGroupReturn;
-}
-
-void
-ObjectNameManager::deleteShareGroup(void *p_groupName)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
-
- ShareGroupsMap::iterator s( m_groups.find(p_groupName) );
- if (s != m_groups.end()) {
- m_groups.erase(s);
- }
-}
-
-void *ObjectNameManager::getGlobalContext()
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- return m_groups.empty() ? nullptr : m_groups.begin()->first;
-}
diff --git a/distrib/android-emugl/host/libs/Translator/include/EGL/egl.h b/distrib/android-emugl/host/libs/Translator/include/EGL/egl.h
deleted file mode 100644
index 99ea342a4..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/EGL/egl.h
+++ /dev/null
@@ -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_ */
diff --git a/distrib/android-emugl/host/libs/Translator/include/EGL/eglext.h b/distrib/android-emugl/host/libs/Translator/include/EGL/eglext.h
deleted file mode 100644
index 1ffcd563f..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/EGL/eglext.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/include/EGL/eglinternalplatform.h b/distrib/android-emugl/host/libs/Translator/include/EGL/eglinternalplatform.h
deleted file mode 100644
index 953284ac2..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/EGL/eglinternalplatform.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef EGL_INTERNAL_PLATFORM_H
-#define EGL_INTERNAL_PLATFORM_H
-
-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
diff --git a/distrib/android-emugl/host/libs/Translator/include/EGL/eglplatform.h b/distrib/android-emugl/host/libs/Translator/include/EGL/eglplatform.h
deleted file mode 100644
index b159cd7f7..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/EGL/eglplatform.h
+++ /dev/null
@@ -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 */
diff --git a/distrib/android-emugl/host/libs/Translator/include/ETC1/etc1.h b/distrib/android-emugl/host/libs/Translator/include/ETC1/etc1.h
deleted file mode 100644
index 0d389052b..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/ETC1/etc1.h
+++ /dev/null
@@ -1,106 +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.
-
-#ifndef __etc1_h__
-#define __etc1_h__
-
-#define ETC1_ENCODED_BLOCK_SIZE 8
-#define ETC1_DECODED_BLOCK_SIZE 48
-
-#ifndef ETC1_RGB8_OES
-#define ETC1_RGB8_OES 0x8D64
-#endif
-
-typedef unsigned char etc1_byte;
-typedef int etc1_bool;
-typedef unsigned int etc1_uint32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Encode a block of pixels.
-//
-// pIn is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
-// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
-// value of pixel (x, y).
-//
-// validPixelMask is a 16-bit mask where bit (1 << (x + y * 4)) indicates whether
-// the corresponding (x,y) pixel is valid. Invalid pixel color values are ignored when compressing.
-//
-// pOut is an ETC1 compressed version of the data.
-
-void etc1_encode_block(const etc1_byte* pIn, etc1_uint32 validPixelMask, etc1_byte* pOut);
-
-// Decode a block of pixels.
-//
-// pIn is an ETC1 compressed version of the data.
-//
-// pOut is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
-// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
-// value of pixel (x, y).
-
-void etc1_decode_block(const etc1_byte* pIn, etc1_byte* pOut);
-
-// Return the size of the encoded image data (does not include size of PKM header).
-
-etc1_uint32 etc1_get_encoded_data_size(etc1_uint32 width, etc1_uint32 height);
-
-// Encode an entire image.
-// pIn - pointer to the image data. Formatted such that
-// pixel (x,y) is at pIn + pixelSize * x + stride * y;
-// pOut - pointer to encoded data. Must be large enough to store entire encoded image.
-// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
-// returns non-zero if there is an error.
-
-int etc1_encode_image(const etc1_byte* pIn, etc1_uint32 width, etc1_uint32 height,
- etc1_uint32 pixelSize, etc1_uint32 stride, etc1_byte* pOut);
-
-// Decode an entire image.
-// pIn - pointer to encoded data.
-// pOut - pointer to the image data. Will be written such that
-// pixel (x,y) is at pIn + pixelSize * x + stride * y. Must be
-// large enough to store entire image.
-// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
-// returns non-zero if there is an error.
-
-int etc1_decode_image(const etc1_byte* pIn, etc1_byte* pOut,
- etc1_uint32 width, etc1_uint32 height,
- etc1_uint32 pixelSize, etc1_uint32 stride);
-
-// Size of a PKM header, in bytes.
-
-#define ETC_PKM_HEADER_SIZE 16
-
-// Format a PKM header
-
-void etc1_pkm_format_header(etc1_byte* pHeader, etc1_uint32 width, etc1_uint32 height);
-
-// Check if a PKM header is correctly formatted.
-
-etc1_bool etc1_pkm_is_valid(const etc1_byte* pHeader);
-
-// Read the image width from a PKM header
-
-etc1_uint32 etc1_pkm_get_width(const etc1_byte* pHeader);
-
-// Read the image height from a PKM header
-
-etc1_uint32 etc1_pkm_get_height(const etc1_byte* pHeader);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GL/wglext.h b/distrib/android-emugl/host/libs/Translator/include/GL/wglext.h
deleted file mode 100644
index 8e06d935e..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GL/wglext.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLES/gl.h b/distrib/android-emugl/host/libs/Translator/include/GLES/gl.h
deleted file mode 100644
index 5b8d85a92..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLES/gl.h
+++ /dev/null
@@ -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_ */
-
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLES/glext.h b/distrib/android-emugl/host/libs/Translator/include/GLES/glext.h
deleted file mode 100644
index 130e4b063..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLES/glext.h
+++ /dev/null
@@ -1,1073 +0,0 @@
-#ifndef __glext_h_
-#define __glext_h_
-
-/* $Revision: 13240 $ on $Date:: 2010-12-17 15:16:00 -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_blend_equation_separate */
-#ifndef GL_OES_blend_equation_separate
-/* BLEND_EQUATION_RGB_OES same as BLEND_EQUATION_OES */
-#define GL_BLEND_EQUATION_RGB_OES 0x8009
-#define GL_BLEND_EQUATION_ALPHA_OES 0x883D
-#endif
-
-/* GL_OES_blend_func_separate */
-#ifndef GL_OES_blend_func_separate
-#define GL_BLEND_DST_RGB_OES 0x80C8
-#define GL_BLEND_SRC_RGB_OES 0x80C9
-#define GL_BLEND_DST_ALPHA_OES 0x80CA
-#define GL_BLEND_SRC_ALPHA_OES 0x80CB
-#endif
-
-/* GL_OES_blend_subtract */
-#ifndef GL_OES_blend_subtract
-#define GL_BLEND_EQUATION_OES 0x8009
-#define GL_FUNC_ADD_OES 0x8006
-#define GL_FUNC_SUBTRACT_OES 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B
-#endif
-
-/* GL_OES_compressed_ETC1_RGB8_texture */
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_ETC1_RGB8_OES 0x8D64
-#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_draw_texture */
-#ifndef GL_OES_draw_texture
-#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
-#endif
-
-/* 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_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_fixed_point */
-#ifndef GL_OES_fixed_point
-#define GL_FIXED_OES 0x140C
-#endif
-
-/* GL_OES_framebuffer_object */
-#ifndef GL_OES_framebuffer_object
-#define GL_NONE_OES 0
-#define GL_FRAMEBUFFER_OES 0x8D40
-#define GL_RENDERBUFFER_OES 0x8D41
-#define GL_RGBA4_OES 0x8056
-#define GL_RGB5_A1_OES 0x8057
-#define GL_RGB565_OES 0x8D62
-#define GL_DEPTH_COMPONENT16_OES 0x81A5
-#define GL_RENDERBUFFER_WIDTH_OES 0x8D42
-#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44
-#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3
-#define GL_COLOR_ATTACHMENT0_OES 0x8CE0
-#define GL_DEPTH_ATTACHMENT_OES 0x8D00
-#define GL_STENCIL_ATTACHMENT_OES 0x8D20
-#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9
-#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA
-#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD
-#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6
-#define GL_RENDERBUFFER_BINDING_OES 0x8CA7
-#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8
-#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506
-#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_matrix_get */
-#ifndef GL_OES_matrix_get
-#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D
-#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E
-#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F
-#endif
-
-/* GL_OES_matrix_palette */
-#ifndef GL_OES_matrix_palette
-#define GL_MAX_VERTEX_UNITS_OES 0x86A4
-#define GL_MAX_PALETTE_MATRICES_OES 0x8842
-#define GL_MATRIX_PALETTE_OES 0x8840
-#define GL_MATRIX_INDEX_ARRAY_OES 0x8844
-#define GL_WEIGHT_ARRAY_OES 0x86AD
-#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843
-#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846
-#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847
-#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848
-#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849
-#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E
-#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB
-#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9
-#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA
-#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E
-#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_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_stencil8 */
-#ifndef GL_OES_stencil8
-#define GL_STENCIL_INDEX8_OES 0x8D48
-#endif
-
-/* GL_OES_stencil_wrap */
-#ifndef GL_OES_stencil_wrap
-#define GL_INCR_WRAP_OES 0x8507
-#define GL_DECR_WRAP_OES 0x8508
-#endif
-
-/* GL_OES_texture_cube_map */
-#ifndef GL_OES_texture_cube_map
-#define GL_NORMAL_MAP_OES 0x8511
-#define GL_REFLECTION_MAP_OES 0x8512
-#define GL_TEXTURE_CUBE_MAP_OES 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C
-#define GL_TEXTURE_GEN_MODE_OES 0x2500
-#define GL_TEXTURE_GEN_STR_OES 0x8D60
-#endif
-
-/* GL_OES_texture_mirrored_repeat */
-#ifndef GL_OES_texture_mirrored_repeat
-#define GL_MIRRORED_REPEAT_OES 0x8370
-#endif
-
-/* GL_OES_vertex_array_object */
-#ifndef GL_OES_vertex_array_object
-#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
-#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
-
-/*------------------------------------------------------------------------*
- * APPLE extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_APPLE_texture_2D_limited_npot */
-/* No new tokens introduced by this extension. */
-
-/* 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_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_lod_bias */
-#ifndef GL_EXT_texture_lod_bias
-#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
-#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
-#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
-#endif
-
-/*------------------------------------------------------------------------*
- * IMG extension tokens
- *------------------------------------------------------------------------*/
-
-/* 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_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_texture_env_enhanced_fixed_function */
-#ifndef GL_IMG_texture_env_enhanced_fixed_function
-#define GL_MODULATE_COLOR_IMG 0x8C04
-#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05
-#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06
-#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07
-#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08
-#define GL_ADD_BLEND_IMG 0x8C09
-#define GL_DOT3_RGBA_IMG 0x86AF
-#endif
-
-/* GL_IMG_user_clip_plane */
-#ifndef GL_IMG_user_clip_plane
-#define GL_CLIP_PLANE0_IMG 0x3000
-#define GL_CLIP_PLANE1_IMG 0x3001
-#define GL_CLIP_PLANE2_IMG 0x3002
-#define GL_CLIP_PLANE3_IMG 0x3003
-#define GL_CLIP_PLANE4_IMG 0x3004
-#define GL_CLIP_PLANE5_IMG 0x3005
-#define GL_MAX_CLIP_PLANES_IMG 0x0D32
-#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
-
-/*------------------------------------------------------------------------*
- * 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
-
-/*------------------------------------------------------------------------*
- * End of extension tokens, start of corresponding extension functions
- *------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------*
- * OES extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_OES_blend_equation_separate */
-#ifndef GL_OES_blend_equation_separate
-#define GL_OES_blend_equation_separate 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha);
-#endif
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha);
-#endif
-
-/* GL_OES_blend_func_separate */
-#ifndef GL_OES_blend_func_separate
-#define GL_OES_blend_func_separate 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#endif
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#endif
-
-/* GL_OES_blend_subtract */
-#ifndef GL_OES_blend_subtract
-#define GL_OES_blend_subtract 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode);
-#endif
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode);
-#endif
-
-/* GL_OES_byte_coordinates */
-#ifndef GL_OES_byte_coordinates
-#define GL_OES_byte_coordinates 1
-#endif
-
-/* GL_OES_compressed_ETC1_RGB8_texture */
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_OES_compressed_ETC1_RGB8_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_draw_texture */
-#ifndef GL_OES_draw_texture
-#define GL_OES_draw_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
-GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords);
-GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords);
-GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords);
-GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
-#endif
-typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords);
-#endif
-
-/* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
-#define GL_OES_EGL_image 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
-GL_API 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_extended_matrix_palette */
-#ifndef GL_OES_extended_matrix_palette
-#define GL_OES_extended_matrix_palette 1
-#endif
-
-/* GL_OES_fbo_render_mipmap */
-#ifndef GL_OES_fbo_render_mipmap
-#define GL_OES_fbo_render_mipmap 1
-#endif
-
-/* GL_OES_fixed_point */
-#ifndef GL_OES_fixed_point
-#define GL_OES_fixed_point 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLclampx ref);
-GL_API void GL_APIENTRY glClearColorxOES (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-GL_API void GL_APIENTRY glClearDepthxOES (GLclampx depth);
-GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);
-GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GL_API void GL_APIENTRY glDepthRangexOES (GLclampx zNear, GLclampx zFar);
-GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glFrustumxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum pname, GLfixed eqn[4]);
-GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum env, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width);
-GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m);
-GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m);
-GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);
-GL_API void GL_APIENTRY glOrthoxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glPointSizexOES (GLfixed size);
-GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);
-GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert);
-GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);
-#endif
-typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLclampx ref);
-typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLclampx depth);
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);
-typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLclampx zNear, GLclampx zFar);
-typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum pname, GLfixed eqn[4]);
-typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum env, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);
-typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);
-typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);
-typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
-typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);
-typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);
-typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert);
-typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-#endif
-
-/* GL_OES_framebuffer_object */
-#ifndef GL_OES_framebuffer_object
-#define GL_OES_framebuffer_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer);
-GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer);
-GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint* renderbuffers);
-GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint* renderbuffers);
-GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint* params);
-GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer);
-GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer);
-GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint* framebuffers);
-GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint* framebuffers);
-GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target);
-GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint* params);
-GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target);
-#endif
-typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers);
-typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers);
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params);
-typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
-typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
-typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers);
-typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers);
-typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
-typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
-#endif
-
-/* GL_OES_mapbuffer */
-#ifndef GL_OES_mapbuffer
-#define GL_OES_mapbuffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
-GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
-GL_API 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_matrix_get */
-#ifndef GL_OES_matrix_get
-#define GL_OES_matrix_get 1
-#endif
-
-/* GL_OES_matrix_palette */
-#ifndef GL_OES_matrix_palette
-#define GL_OES_matrix_palette 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex);
-GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void);
-GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex);
-typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void);
-typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-
-/* GL_OES_packed_depth_stencil */
-#ifndef GL_OES_packed_depth_stencil
-#define GL_OES_packed_depth_stencil 1
-#endif
-
-/* GL_OES_query_matrix */
-#ifndef GL_OES_query_matrix
-#define GL_OES_query_matrix 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed mantissa[16], GLint exponent[16]);
-#endif
-typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed mantissa[16], GLint exponent[16]);
-#endif
-
-/* GL_OES_rgb8_rgba8 */
-#ifndef GL_OES_rgb8_rgba8
-#define GL_OES_rgb8_rgba8 1
-#endif
-
-/* GL_OES_single_precision */
-#ifndef GL_OES_single_precision
-#define GL_OES_single_precision 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar);
-GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
-GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]);
-GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth);
-#endif
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf zNear, GLclampf zFar);
-typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);
-typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum pname, GLfloat eqn[4]);
-typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
-#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_stencil8 */
-#ifndef GL_OES_stencil8
-#define GL_OES_stencil8 1
-#endif
-
-/* GL_OES_stencil_wrap */
-#ifndef GL_OES_stencil_wrap
-#define GL_OES_stencil_wrap 1
-#endif
-
-/* GL_OES_texture_cube_map */
-#ifndef GL_OES_texture_cube_map
-#define GL_OES_texture_cube_map 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params);
-GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);
-#endif
-typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
-typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
-typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
-#endif
-
-/* GL_OES_texture_env_crossbar */
-#ifndef GL_OES_texture_env_crossbar
-#define GL_OES_texture_env_crossbar 1
-#endif
-
-/* GL_OES_texture_mirrored_repeat */
-#ifndef GL_OES_texture_mirrored_repeat
-#define GL_OES_texture_mirrored_repeat 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_API void GL_APIENTRY glBindVertexArrayOES (GLuint array);
-GL_API void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
-GL_API void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
-GL_API 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
-
-/*------------------------------------------------------------------------*
- * 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
-
-/*------------------------------------------------------------------------*
- * APPLE extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_APPLE_texture_2D_limited_npot */
-#ifndef GL_APPLE_texture_2D_limited_npot
-#define GL_APPLE_texture_2D_limited_npot 1
-#endif
-
-/* GL_APPLE_framebuffer_multisample */
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_APPLE_framebuffer_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-GL_API 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_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_API 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
-
-/* GL_EXT_multi_draw_arrays */
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
-GL_API 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_lod_bias */
-#ifndef GL_EXT_texture_lod_bias
-#define GL_EXT_texture_lod_bias 1
-#endif
-
-/*------------------------------------------------------------------------*
- * IMG extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_IMG_read_format */
-#ifndef GL_IMG_read_format
-#define GL_IMG_read_format 1
-#endif
-
-/* GL_IMG_texture_compression_pvrtc */
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_IMG_texture_compression_pvrtc 1
-#endif
-
-/* GL_IMG_texture_env_enhanced_fixed_function */
-#ifndef GL_IMG_texture_env_enhanced_fixed_function
-#define GL_IMG_texture_env_enhanced_fixed_function 1
-#endif
-
-/* GL_IMG_user_clip_plane */
-#ifndef GL_IMG_user_clip_plane
-#define GL_IMG_user_clip_plane 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glClipPlanefIMG (GLenum, const GLfloat *);
-GL_API void GL_APIENTRY glClipPlanexIMG (GLenum, const GLfixed *);
-#endif
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn);
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn);
-#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_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-GL_API 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
- *------------------------------------------------------------------------*/
-
-/* NV_fence */
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *);
-GL_API void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *);
-GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint);
-GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint);
-GL_API void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *);
-GL_API void GL_APIENTRY glFinishFenceNV (GLuint);
-GL_API 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
-
-/*------------------------------------------------------------------------*
- * QCOM extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_QCOM_driver_control */
-#ifndef GL_QCOM_driver_control
-#define GL_QCOM_driver_control 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
-GL_API void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-GL_API void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
-GL_API 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_API void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
-GL_API void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-GL_API void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-GL_API void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-GL_API void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
-GL_API 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_API 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_API void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-GL_API void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-GL_API GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
-GL_API 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_API void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-GL_API 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
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __glext_h_ */
-
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLES/glplatform.h b/distrib/android-emugl/host/libs/Translator/include/GLES/glplatform.h
deleted file mode 100644
index 2db6ee2ca..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLES/glplatform.h
+++ /dev/null
@@ -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_ */
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLES2/gl2.h b/distrib/android-emugl/host/libs/Translator/include/GLES2/gl2.h
deleted file mode 100644
index 8a4d43a9c..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLES2/gl2.h
+++ /dev/null
@@ -1,525 +0,0 @@
-#ifndef __gl2_h_
-#define __gl2_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2014 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.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision: 26696 $ on $Date: 2014-05-17 14:48:55 -0700 (Sat, 17 May 2014) $
-*/
-
-#include <GLES2/gl2platform.h>
-
-/* Generated on date 20140517 */
-
-/* Generated C header for:
- * API: gles2
- * Profile: common
- * Versions considered: 2\.[0-9]
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_ES_VERSION_2_0
-#define GL_ES_VERSION_2_0 1
-#include <KHR/khrplatform.h>
-typedef khronos_int8_t GLbyte;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef short GLshort;
-typedef unsigned short GLushort;
-typedef void GLvoid;
-typedef struct __GLsync *GLsync;
-typedef khronos_int64_t GLint64;
-typedef khronos_uint64_t GLuint64;
-typedef unsigned int GLenum;
-typedef unsigned int GLuint;
-typedef char GLchar;
-typedef khronos_float_t GLfloat;
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-typedef unsigned int GLbitfield;
-typedef int GLint;
-typedef unsigned char GLboolean;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_FALSE 0
-#define GL_TRUE 1
-#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
-#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
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_FUNC_ADD 0x8006
-#define GL_BLEND_EQUATION 0x8009
-#define GL_BLEND_EQUATION_RGB 0x8009
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#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
-#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
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-#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
-#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
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#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
-#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
-#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
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-#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
-#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
-#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
-#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
-#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
-#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
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#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_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
-#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_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_MIRRORED_REPEAT 0x8370
-#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
-#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
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_SHADER_COMPILER 0x8DFA
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-#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
-#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_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_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 (GLfloat red, GLfloat green, GLfloat blue, GLfloat 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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
-GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
-GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
-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 void *data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *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 (GLfloat n, GLfloat f);
-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 void *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 GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
-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 *data);
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
-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 GLint 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, void **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, void *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 (GLfloat value, GLboolean invert);
-GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*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 sfail, GLenum dpfail, GLenum dppass);
-GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *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 void *pixels);
-GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
-GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
-GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
-GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
-GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
-GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
-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 index, GLfloat x);
-GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-#endif /* GL_ES_VERSION_2_0 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLES2/gl2ext.h b/distrib/android-emugl/host/libs/Translator/include/GLES2/gl2ext.h
deleted file mode 100644
index 9749f9fdb..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLES2/gl2ext.h
+++ /dev/null
@@ -1,1932 +0,0 @@
-#ifndef __gl2ext_h_
-#define __gl2ext_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2014 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.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.opengl.org/registry/
-**
-** Khronos $Revision$ on $Date$
-*/
-
-#ifndef GL_APIENTRYP
-#define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-/* Generated on date 20140519 */
-
-/* Generated C header for:
- * API: gles2
- * Profile: common
- * Versions considered: 2\.[0-9]
- * Versions emitted: _nomatch_^
- * Default extensions included: gles2
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_KHR_blend_equation_advanced
-#define GL_KHR_blend_equation_advanced 1
-#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
-#define GL_MULTIPLY_KHR 0x9294
-#define GL_SCREEN_KHR 0x9295
-#define GL_OVERLAY_KHR 0x9296
-#define GL_DARKEN_KHR 0x9297
-#define GL_LIGHTEN_KHR 0x9298
-#define GL_COLORDODGE_KHR 0x9299
-#define GL_COLORBURN_KHR 0x929A
-#define GL_HARDLIGHT_KHR 0x929B
-#define GL_SOFTLIGHT_KHR 0x929C
-#define GL_DIFFERENCE_KHR 0x929E
-#define GL_EXCLUSION_KHR 0x92A0
-#define GL_HSL_HUE_KHR 0x92AD
-#define GL_HSL_SATURATION_KHR 0x92AE
-#define GL_HSL_COLOR_KHR 0x92AF
-#define GL_HSL_LUMINOSITY_KHR 0x92B0
-typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void);
-#endif
-#endif /* GL_KHR_blend_equation_advanced */
-
-#ifndef GL_KHR_debug
-#define GL_KHR_debug 1
-typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-#define GL_SAMPLER 0x82E6
-#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242
-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243
-#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244
-#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245
-#define GL_DEBUG_SOURCE_API_KHR 0x8246
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247
-#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248
-#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249
-#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A
-#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B
-#define GL_DEBUG_TYPE_ERROR_KHR 0x824C
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E
-#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F
-#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250
-#define GL_DEBUG_TYPE_OTHER_KHR 0x8251
-#define GL_DEBUG_TYPE_MARKER_KHR 0x8268
-#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269
-#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A
-#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B
-#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C
-#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D
-#define GL_BUFFER_KHR 0x82E0
-#define GL_SHADER_KHR 0x82E1
-#define GL_PROGRAM_KHR 0x82E2
-#define GL_VERTEX_ARRAY_KHR 0x8074
-#define GL_QUERY_KHR 0x82E3
-#define GL_SAMPLER_KHR 0x82E6
-#define GL_MAX_LABEL_LENGTH_KHR 0x82E8
-#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145
-#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147
-#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148
-#define GL_DEBUG_OUTPUT_KHR 0x92E0
-#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002
-#define GL_STACK_OVERFLOW_KHR 0x0503
-#define GL_STACK_UNDERFLOW_KHR 0x0504
-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam);
-typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void);
-typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam);
-GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void);
-GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params);
-#endif
-#endif /* GL_KHR_debug */
-
-#ifndef GL_KHR_texture_compression_astc_hdr
-#define GL_KHR_texture_compression_astc_hdr 1
-#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
-#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
-#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
-#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
-#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
-#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
-#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
-#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
-#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
-#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
-#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
-#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
-#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
-#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
-#endif /* GL_KHR_texture_compression_astc_hdr */
-
-#ifndef GL_KHR_texture_compression_astc_ldr
-#define GL_KHR_texture_compression_astc_ldr 1
-#endif /* GL_KHR_texture_compression_astc_ldr */
-
-#ifndef GL_OES_EGL_image
-#define GL_OES_EGL_image 1
-typedef void *GLeglImageOES;
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
-#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
-#endif /* GL_OES_EGL_image */
-
-#ifndef GL_OES_EGL_image_external
-#define GL_OES_EGL_image_external 1
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
-#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
-#define GL_SAMPLER_EXTERNAL_OES 0x8D66
-#endif /* GL_OES_EGL_image_external */
-
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_OES_compressed_ETC1_RGB8_texture 1
-#define GL_ETC1_RGB8_OES 0x8D64
-#endif /* GL_OES_compressed_ETC1_RGB8_texture */
-
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_OES_compressed_paletted_texture 1
-#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_compressed_paletted_texture */
-
-#ifndef GL_OES_depth24
-#define GL_OES_depth24 1
-#define GL_DEPTH_COMPONENT24_OES 0x81A6
-#endif /* GL_OES_depth24 */
-
-#ifndef GL_OES_depth32
-#define GL_OES_depth32 1
-#define GL_DEPTH_COMPONENT32_OES 0x81A7
-#endif /* GL_OES_depth32 */
-
-#ifndef GL_OES_depth_texture
-#define GL_OES_depth_texture 1
-#endif /* GL_OES_depth_texture */
-
-#ifndef GL_OES_element_index_uint
-#define GL_OES_element_index_uint 1
-#endif /* GL_OES_element_index_uint */
-
-#ifndef GL_OES_fbo_render_mipmap
-#define GL_OES_fbo_render_mipmap 1
-#endif /* GL_OES_fbo_render_mipmap */
-
-#ifndef GL_OES_fragment_precision_high
-#define GL_OES_fragment_precision_high 1
-#endif /* GL_OES_fragment_precision_high */
-
-#ifndef GL_OES_get_program_binary
-#define GL_OES_get_program_binary 1
-#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
-#endif
-#endif /* GL_OES_get_program_binary */
-
-#ifndef GL_OES_mapbuffer
-#define GL_OES_mapbuffer 1
-#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
-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, void **params);
-#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, void **params);
-#endif
-#endif /* GL_OES_mapbuffer */
-
-#ifndef GL_OES_packed_depth_stencil
-#define GL_OES_packed_depth_stencil 1
-#define GL_DEPTH_STENCIL_OES 0x84F9
-#define GL_UNSIGNED_INT_24_8_OES 0x84FA
-#define GL_DEPTH24_STENCIL8_OES 0x88F0
-#endif /* GL_OES_packed_depth_stencil */
-
-#ifndef GL_OES_required_internalformat
-#define GL_OES_required_internalformat 1
-#define GL_ALPHA8_OES 0x803C
-#define GL_DEPTH_COMPONENT16_OES 0x81A5
-#define GL_LUMINANCE4_ALPHA4_OES 0x8043
-#define GL_LUMINANCE8_ALPHA8_OES 0x8045
-#define GL_LUMINANCE8_OES 0x8040
-#define GL_RGBA4_OES 0x8056
-#define GL_RGB5_A1_OES 0x8057
-#define GL_RGB565_OES 0x8D62
-#define GL_RGB8_OES 0x8051
-#define GL_RGBA8_OES 0x8058
-#define GL_RGB10_EXT 0x8052
-#define GL_RGB10_A2_EXT 0x8059
-#endif /* GL_OES_required_internalformat */
-
-#ifndef GL_OES_rgb8_rgba8
-#define GL_OES_rgb8_rgba8 1
-#endif /* GL_OES_rgb8_rgba8 */
-
-#ifndef GL_OES_sample_shading
-#define GL_OES_sample_shading 1
-#define GL_SAMPLE_SHADING_OES 0x8C36
-#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37
-typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value);
-#endif
-#endif /* GL_OES_sample_shading */
-
-#ifndef GL_OES_sample_variables
-#define GL_OES_sample_variables 1
-#endif /* GL_OES_sample_variables */
-
-#ifndef GL_OES_shader_image_atomic
-#define GL_OES_shader_image_atomic 1
-#endif /* GL_OES_shader_image_atomic */
-
-#ifndef GL_OES_shader_multisample_interpolation
-#define GL_OES_shader_multisample_interpolation 1
-#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B
-#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C
-#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D
-#endif /* GL_OES_shader_multisample_interpolation */
-
-#ifndef GL_OES_standard_derivatives
-#define GL_OES_standard_derivatives 1
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
-#endif /* GL_OES_standard_derivatives */
-
-#ifndef GL_OES_stencil1
-#define GL_OES_stencil1 1
-#define GL_STENCIL_INDEX1_OES 0x8D46
-#endif /* GL_OES_stencil1 */
-
-#ifndef GL_OES_stencil4
-#define GL_OES_stencil4 1
-#define GL_STENCIL_INDEX4_OES 0x8D47
-#endif /* GL_OES_stencil4 */
-
-#ifndef GL_OES_surfaceless_context
-#define GL_OES_surfaceless_context 1
-#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
-#endif /* GL_OES_surfaceless_context */
-
-#ifndef GL_OES_texture_3D
-#define GL_OES_texture_3D 1
-#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
-typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *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 void *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 void *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 void *data);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-#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 void *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 void *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 void *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 void *data);
-GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-#endif
-#endif /* GL_OES_texture_3D */
-
-#ifndef GL_OES_texture_compression_astc
-#define GL_OES_texture_compression_astc 1
-#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0
-#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1
-#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2
-#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3
-#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4
-#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5
-#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6
-#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7
-#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8
-#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9
-#endif /* GL_OES_texture_compression_astc */
-
-#ifndef GL_OES_texture_float
-#define GL_OES_texture_float 1
-#endif /* GL_OES_texture_float */
-
-#ifndef GL_OES_texture_float_linear
-#define GL_OES_texture_float_linear 1
-#endif /* GL_OES_texture_float_linear */
-
-#ifndef GL_OES_texture_half_float
-#define GL_OES_texture_half_float 1
-#define GL_HALF_FLOAT_OES 0x8D61
-#endif /* GL_OES_texture_half_float */
-
-#ifndef GL_OES_texture_half_float_linear
-#define GL_OES_texture_half_float_linear 1
-#endif /* GL_OES_texture_half_float_linear */
-
-#ifndef GL_OES_texture_npot
-#define GL_OES_texture_npot 1
-#endif /* GL_OES_texture_npot */
-
-#ifndef GL_OES_texture_stencil8
-#define GL_OES_texture_stencil8 1
-#define GL_STENCIL_INDEX_OES 0x1901
-#define GL_STENCIL_INDEX8_OES 0x8D48
-#endif /* GL_OES_texture_stencil8 */
-
-#ifndef GL_OES_texture_storage_multisample_2d_array
-#define GL_OES_texture_storage_multisample_2d_array 1
-#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102
-#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105
-#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B
-#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C
-#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-#endif
-#endif /* GL_OES_texture_storage_multisample_2d_array */
-
-#ifndef GL_OES_vertex_array_object
-#define GL_OES_vertex_array_object 1
-#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
-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);
-#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
-#endif /* GL_OES_vertex_array_object */
-
-#ifndef GL_OES_vertex_half_float
-#define GL_OES_vertex_half_float 1
-#endif /* GL_OES_vertex_half_float */
-
-#ifndef GL_OES_vertex_type_10_10_10_2
-#define GL_OES_vertex_type_10_10_10_2 1
-#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
-#define GL_INT_10_10_10_2_OES 0x8DF7
-#endif /* GL_OES_vertex_type_10_10_10_2 */
-
-#ifndef GL_AMD_compressed_3DC_texture
-#define GL_AMD_compressed_3DC_texture 1
-#define GL_3DC_X_AMD 0x87F9
-#define GL_3DC_XY_AMD 0x87FA
-#endif /* GL_AMD_compressed_3DC_texture */
-
-#ifndef GL_AMD_compressed_ATC_texture
-#define GL_AMD_compressed_ATC_texture 1
-#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_compressed_ATC_texture */
-
-#ifndef GL_AMD_performance_monitor
-#define GL_AMD_performance_monitor 1
-#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
-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, void *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 *counterList);
-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);
-#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, void *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 *counterList);
-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
-#endif /* GL_AMD_performance_monitor */
-
-#ifndef GL_AMD_program_binary_Z400
-#define GL_AMD_program_binary_Z400 1
-#define GL_Z400_BINARY_AMD 0x8740
-#endif /* GL_AMD_program_binary_Z400 */
-
-#ifndef GL_ANGLE_depth_texture
-#define GL_ANGLE_depth_texture 1
-#endif /* GL_ANGLE_depth_texture */
-
-#ifndef GL_ANGLE_framebuffer_blit
-#define GL_ANGLE_framebuffer_blit 1
-#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
-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);
-#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
-#endif /* GL_ANGLE_framebuffer_blit */
-
-#ifndef GL_ANGLE_framebuffer_multisample
-#define GL_ANGLE_framebuffer_multisample 1
-#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
-#define GL_MAX_SAMPLES_ANGLE 0x8D57
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_ANGLE_framebuffer_multisample */
-
-#ifndef GL_ANGLE_instanced_arrays
-#define GL_ANGLE_instanced_arrays 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
-#endif
-#endif /* GL_ANGLE_instanced_arrays */
-
-#ifndef GL_ANGLE_pack_reverse_row_order
-#define GL_ANGLE_pack_reverse_row_order 1
-#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
-#endif /* GL_ANGLE_pack_reverse_row_order */
-
-#ifndef GL_ANGLE_program_binary
-#define GL_ANGLE_program_binary 1
-#define GL_PROGRAM_BINARY_ANGLE 0x93A6
-#endif /* GL_ANGLE_program_binary */
-
-#ifndef GL_ANGLE_texture_compression_dxt3
-#define GL_ANGLE_texture_compression_dxt3 1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
-#endif /* GL_ANGLE_texture_compression_dxt3 */
-
-#ifndef GL_ANGLE_texture_compression_dxt5
-#define GL_ANGLE_texture_compression_dxt5 1
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
-#endif /* GL_ANGLE_texture_compression_dxt5 */
-
-#ifndef GL_ANGLE_texture_usage
-#define GL_ANGLE_texture_usage 1
-#define GL_TEXTURE_USAGE_ANGLE 0x93A2
-#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
-#endif /* GL_ANGLE_texture_usage */
-
-#ifndef GL_ANGLE_translated_shader_source
-#define GL_ANGLE_translated_shader_source 1
-#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
-typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
-#endif
-#endif /* GL_ANGLE_translated_shader_source */
-
-#ifndef GL_APPLE_copy_texture_levels
-#define GL_APPLE_copy_texture_levels 1
-typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
-#endif
-#endif /* GL_APPLE_copy_texture_levels */
-
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_APPLE_framebuffer_multisample 1
-#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
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
-#endif
-#endif /* GL_APPLE_framebuffer_multisample */
-
-#ifndef GL_APPLE_rgb_422
-#define GL_APPLE_rgb_422 1
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#define GL_RGB_RAW_422_APPLE 0x8A51
-#endif /* GL_APPLE_rgb_422 */
-
-#ifndef GL_APPLE_sync
-#define GL_APPLE_sync 1
-#define GL_SYNC_OBJECT_APPLE 0x8A53
-#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
-#define GL_OBJECT_TYPE_APPLE 0x9112
-#define GL_SYNC_CONDITION_APPLE 0x9113
-#define GL_SYNC_STATUS_APPLE 0x9114
-#define GL_SYNC_FLAGS_APPLE 0x9115
-#define GL_SYNC_FENCE_APPLE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
-#define GL_UNSIGNALED_APPLE 0x9118
-#define GL_SIGNALED_APPLE 0x9119
-#define GL_ALREADY_SIGNALED_APPLE 0x911A
-#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
-#define GL_CONDITION_SATISFIED_APPLE 0x911C
-#define GL_WAIT_FAILED_APPLE 0x911D
-#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
-#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
-typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
-typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
-typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
-typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
-typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
-GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
-GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
-GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
-GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-#endif
-#endif /* GL_APPLE_sync */
-
-#ifndef GL_APPLE_texture_format_BGRA8888
-#define GL_APPLE_texture_format_BGRA8888 1
-#define GL_BGRA_EXT 0x80E1
-#define GL_BGRA8_EXT 0x93A1
-#endif /* GL_APPLE_texture_format_BGRA8888 */
-
-#ifndef GL_APPLE_texture_max_level
-#define GL_APPLE_texture_max_level 1
-#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
-#endif /* GL_APPLE_texture_max_level */
-
-#ifndef GL_ARM_mali_program_binary
-#define GL_ARM_mali_program_binary 1
-#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61
-#endif /* GL_ARM_mali_program_binary */
-
-#ifndef GL_ARM_mali_shader_binary
-#define GL_ARM_mali_shader_binary 1
-#define GL_MALI_SHADER_BINARY_ARM 0x8F60
-#endif /* GL_ARM_mali_shader_binary */
-
-#ifndef GL_ARM_rgba8
-#define GL_ARM_rgba8 1
-#endif /* GL_ARM_rgba8 */
-
-#ifndef GL_ARM_shader_framebuffer_fetch
-#define GL_ARM_shader_framebuffer_fetch 1
-#define GL_FETCH_PER_SAMPLE_ARM 0x8F65
-#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66
-#endif /* GL_ARM_shader_framebuffer_fetch */
-
-#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil
-#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1
-#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */
-
-#ifndef GL_DMP_shader_binary
-#define GL_DMP_shader_binary 1
-#define GL_SHADER_BINARY_DMP 0x9250
-#endif /* GL_DMP_shader_binary */
-
-#ifndef GL_EXT_blend_minmax
-#define GL_EXT_blend_minmax 1
-#define GL_MIN_EXT 0x8007
-#define GL_MAX_EXT 0x8008
-#endif /* GL_EXT_blend_minmax */
-
-#ifndef GL_EXT_color_buffer_half_float
-#define GL_EXT_color_buffer_half_float 1
-#define GL_RGBA16F_EXT 0x881A
-#define GL_RGB16F_EXT 0x881B
-#define GL_RG16F_EXT 0x822F
-#define GL_R16F_EXT 0x822D
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
-#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
-#endif /* GL_EXT_color_buffer_half_float */
-
-#ifndef GL_EXT_copy_image
-#define GL_EXT_copy_image 1
-typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-#endif
-#endif /* GL_EXT_copy_image */
-
-#ifndef GL_EXT_debug_label
-#define GL_EXT_debug_label 1
-#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
-#define GL_PROGRAM_OBJECT_EXT 0x8B40
-#define GL_SHADER_OBJECT_EXT 0x8B48
-#define GL_BUFFER_OBJECT_EXT 0x9151
-#define GL_QUERY_OBJECT_EXT 0x9153
-#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
-#define GL_TRANSFORM_FEEDBACK 0x8E22
-typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-#endif /* GL_EXT_debug_label */
-
-#ifndef GL_EXT_debug_marker
-#define GL_EXT_debug_marker 1
-typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
-GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
-GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
-#endif
-#endif /* GL_EXT_debug_marker */
-
-#ifndef GL_EXT_discard_framebuffer
-#define GL_EXT_discard_framebuffer 1
-#define GL_COLOR_EXT 0x1800
-#define GL_DEPTH_EXT 0x1801
-#define GL_STENCIL_EXT 0x1802
-typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#endif
-#endif /* GL_EXT_discard_framebuffer */
-
-#ifndef GL_EXT_disjoint_timer_query
-#define GL_EXT_disjoint_timer_query 1
-#define GL_QUERY_COUNTER_BITS_EXT 0x8864
-#define GL_CURRENT_QUERY_EXT 0x8865
-#define GL_QUERY_RESULT_EXT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
-#define GL_TIME_ELAPSED_EXT 0x88BF
-#define GL_TIMESTAMP_EXT 0x8E28
-#define GL_GPU_DISJOINT_EXT 0x8FBB
-typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
-typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
-typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
-typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
-GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
-GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
-GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target);
-GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
-#endif
-#endif /* GL_EXT_disjoint_timer_query */
-
-#ifndef GL_EXT_draw_buffers
-#define GL_EXT_draw_buffers 1
-#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
-#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
-#define GL_DRAW_BUFFER0_EXT 0x8825
-#define GL_DRAW_BUFFER1_EXT 0x8826
-#define GL_DRAW_BUFFER2_EXT 0x8827
-#define GL_DRAW_BUFFER3_EXT 0x8828
-#define GL_DRAW_BUFFER4_EXT 0x8829
-#define GL_DRAW_BUFFER5_EXT 0x882A
-#define GL_DRAW_BUFFER6_EXT 0x882B
-#define GL_DRAW_BUFFER7_EXT 0x882C
-#define GL_DRAW_BUFFER8_EXT 0x882D
-#define GL_DRAW_BUFFER9_EXT 0x882E
-#define GL_DRAW_BUFFER10_EXT 0x882F
-#define GL_DRAW_BUFFER11_EXT 0x8830
-#define GL_DRAW_BUFFER12_EXT 0x8831
-#define GL_DRAW_BUFFER13_EXT 0x8832
-#define GL_DRAW_BUFFER14_EXT 0x8833
-#define GL_DRAW_BUFFER15_EXT 0x8834
-#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
-#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
-#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
-#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
-#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
-#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
-#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
-#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
-#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
-#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
-#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
-#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
-#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
-#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
-#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
-#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
-#endif
-#endif /* GL_EXT_draw_buffers */
-
-#ifndef GL_EXT_draw_buffers_indexed
-#define GL_EXT_draw_buffers_indexed 1
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index);
-typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index);
-GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index);
-GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode);
-GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst);
-GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index);
-#endif
-#endif /* GL_EXT_draw_buffers_indexed */
-
-#ifndef GL_EXT_draw_instanced
-#define GL_EXT_draw_instanced 1
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#endif
-#endif /* GL_EXT_draw_instanced */
-
-#ifndef GL_EXT_geometry_shader
-#define GL_EXT_geometry_shader 1
-#define GL_GEOMETRY_SHADER_EXT 0x8DD9
-#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004
-#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916
-#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917
-#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918
-#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F
-#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E
-#define GL_LINES_ADJACENCY_EXT 0x000A
-#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
-#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
-#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
-#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C
-#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32
-#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123
-#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
-#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5
-#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD
-#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7
-#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
-#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
-#define GL_UNDEFINED_VERTEX_EXT 0x8260
-#define GL_PRIMITIVES_GENERATED_EXT 0x8C87
-#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312
-#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
-#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
-#endif
-#endif /* GL_EXT_geometry_shader */
-
-#ifndef GL_EXT_gpu_shader5
-#define GL_EXT_gpu_shader5 1
-#endif /* GL_EXT_gpu_shader5 */
-
-#ifndef GL_EXT_instanced_arrays
-#define GL_EXT_instanced_arrays 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor);
-#endif
-#endif /* GL_EXT_instanced_arrays */
-
-#ifndef GL_EXT_map_buffer_range
-#define GL_EXT_map_buffer_range 1
-#define GL_MAP_READ_BIT_EXT 0x0001
-#define GL_MAP_WRITE_BIT_EXT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
-typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
-#endif
-#endif /* GL_EXT_map_buffer_range */
-
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
-#endif
-#endif /* GL_EXT_multi_draw_arrays */
-
-#ifndef GL_EXT_multisampled_render_to_texture
-#define GL_EXT_multisampled_render_to_texture 1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
-#define GL_MAX_SAMPLES_EXT 0x8D57
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-#endif /* GL_EXT_multisampled_render_to_texture */
-
-#ifndef GL_EXT_multiview_draw_buffers
-#define GL_EXT_multiview_draw_buffers 1
-#define GL_COLOR_ATTACHMENT_EXT 0x90F0
-#define GL_MULTIVIEW_EXT 0x90F1
-#define GL_DRAW_BUFFER_EXT 0x0C01
-#define GL_READ_BUFFER_EXT 0x0C02
-#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2
-typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
-typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
-GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
-GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
-#endif
-#endif /* GL_EXT_multiview_draw_buffers */
-
-#ifndef GL_EXT_occlusion_query_boolean
-#define GL_EXT_occlusion_query_boolean 1
-#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
-#endif /* GL_EXT_occlusion_query_boolean */
-
-#ifndef GL_EXT_primitive_bounding_box
-#define GL_EXT_primitive_bounding_box 1
-#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE
-typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#endif
-#endif /* GL_EXT_primitive_bounding_box */
-
-#ifndef GL_EXT_pvrtc_sRGB
-#define GL_EXT_pvrtc_sRGB 1
-#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
-#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55
-#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56
-#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57
-#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0
-#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1
-#endif /* GL_EXT_pvrtc_sRGB */
-
-#ifndef GL_EXT_read_format_bgra
-#define GL_EXT_read_format_bgra 1
-#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_read_format_bgra */
-
-#ifndef GL_EXT_robustness
-#define GL_EXT_robustness 1
-#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
-#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
-#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
-#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
-#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
-typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
-typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
-GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif
-#endif /* GL_EXT_robustness */
-
-#ifndef GL_EXT_sRGB
-#define GL_EXT_sRGB 1
-#define GL_SRGB_EXT 0x8C40
-#define GL_SRGB_ALPHA_EXT 0x8C42
-#define GL_SRGB8_ALPHA8_EXT 0x8C43
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
-#endif /* GL_EXT_sRGB */
-
-#ifndef GL_EXT_sRGB_write_control
-#define GL_EXT_sRGB_write_control 1
-#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
-#endif /* GL_EXT_sRGB_write_control */
-
-#ifndef GL_EXT_separate_shader_objects
-#define GL_EXT_separate_shader_objects 1
-#define GL_ACTIVE_PROGRAM_EXT 0x8259
-#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
-#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002
-#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF
-#define GL_PROGRAM_SEPARABLE_EXT 0x8258
-#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
-typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
-typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
-typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
-typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
-typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
-typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
-GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
-GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
-GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
-GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
-GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
-GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
-GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
-GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
-GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
-GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
-GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#endif
-#endif /* GL_EXT_separate_shader_objects */
-
-#ifndef GL_EXT_shader_framebuffer_fetch
-#define GL_EXT_shader_framebuffer_fetch 1
-#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
-#endif /* GL_EXT_shader_framebuffer_fetch */
-
-#ifndef GL_EXT_shader_implicit_conversions
-#define GL_EXT_shader_implicit_conversions 1
-#endif /* GL_EXT_shader_implicit_conversions */
-
-#ifndef GL_EXT_shader_integer_mix
-#define GL_EXT_shader_integer_mix 1
-#endif /* GL_EXT_shader_integer_mix */
-
-#ifndef GL_EXT_shader_io_blocks
-#define GL_EXT_shader_io_blocks 1
-#endif /* GL_EXT_shader_io_blocks */
-
-#ifndef GL_EXT_shader_pixel_local_storage
-#define GL_EXT_shader_pixel_local_storage 1
-#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63
-#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67
-#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
-#endif /* GL_EXT_shader_pixel_local_storage */
-
-#ifndef GL_EXT_shader_texture_lod
-#define GL_EXT_shader_texture_lod 1
-#endif /* GL_EXT_shader_texture_lod */
-
-#ifndef GL_EXT_shadow_samplers
-#define GL_EXT_shadow_samplers 1
-#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
-#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
-#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
-#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
-#endif /* GL_EXT_shadow_samplers */
-
-#ifndef GL_EXT_tessellation_shader
-#define GL_EXT_tessellation_shader 1
-#define GL_PATCHES_EXT 0x000E
-#define GL_PATCH_VERTICES_EXT 0x8E72
-#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75
-#define GL_TESS_GEN_MODE_EXT 0x8E76
-#define GL_TESS_GEN_SPACING_EXT 0x8E77
-#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78
-#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79
-#define GL_ISOLINES_EXT 0x8E7A
-#define GL_QUADS_EXT 0x0007
-#define GL_FRACTIONAL_ODD_EXT 0x8E7B
-#define GL_FRACTIONAL_EVEN_EXT 0x8E7C
-#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D
-#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E
-#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F
-#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80
-#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81
-#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82
-#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83
-#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84
-#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85
-#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86
-#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89
-#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A
-#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C
-#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D
-#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E
-#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4
-#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB
-#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC
-#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8
-#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9
-#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
-#define GL_IS_PER_PATCH_EXT 0x92E7
-#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307
-#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308
-#define GL_TESS_CONTROL_SHADER_EXT 0x8E88
-#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87
-#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008
-#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010
-typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value);
-#endif
-#endif /* GL_EXT_tessellation_shader */
-
-#ifndef GL_EXT_texture_border_clamp
-#define GL_EXT_texture_border_clamp 1
-#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004
-#define GL_CLAMP_TO_BORDER_EXT 0x812D
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param);
-typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
-GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
-GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
-GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param);
-GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param);
-GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params);
-#endif
-#endif /* GL_EXT_texture_border_clamp */
-
-#ifndef GL_EXT_texture_buffer
-#define GL_EXT_texture_buffer 1
-#define GL_TEXTURE_BUFFER_EXT 0x8C2A
-#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
-#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F
-#define GL_SAMPLER_BUFFER_EXT 0x8DC2
-#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
-#define GL_IMAGE_BUFFER_EXT 0x9051
-#define GL_INT_IMAGE_BUFFER_EXT 0x905C
-#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067
-#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D
-#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E
-typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
-GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-#endif
-#endif /* GL_EXT_texture_buffer */
-
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_EXT_texture_compression_dxt1 1
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#endif /* GL_EXT_texture_compression_dxt1 */
-
-#ifndef GL_EXT_texture_compression_s3tc
-#define GL_EXT_texture_compression_s3tc 1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
-#endif /* GL_EXT_texture_compression_s3tc */
-
-#ifndef GL_EXT_texture_cube_map_array
-#define GL_EXT_texture_cube_map_array 1
-#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A
-#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C
-#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D
-#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F
-#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054
-#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F
-#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
-#endif /* GL_EXT_texture_cube_map_array */
-
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_EXT_texture_filter_anisotropic 1
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-#endif /* GL_EXT_texture_filter_anisotropic */
-
-#ifndef GL_EXT_texture_format_BGRA8888
-#define GL_EXT_texture_format_BGRA8888 1
-#endif /* GL_EXT_texture_format_BGRA8888 */
-
-#ifndef GL_EXT_texture_rg
-#define GL_EXT_texture_rg 1
-#define GL_RED_EXT 0x1903
-#define GL_RG_EXT 0x8227
-#define GL_R8_EXT 0x8229
-#define GL_RG8_EXT 0x822B
-#endif /* GL_EXT_texture_rg */
-
-#ifndef GL_EXT_texture_sRGB_decode
-#define GL_EXT_texture_sRGB_decode 1
-#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
-#define GL_DECODE_EXT 0x8A49
-#define GL_SKIP_DECODE_EXT 0x8A4A
-#endif /* GL_EXT_texture_sRGB_decode */
-
-#ifndef GL_EXT_texture_storage
-#define GL_EXT_texture_storage 1
-#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
-#define GL_ALPHA8_EXT 0x803C
-#define GL_LUMINANCE8_EXT 0x8040
-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
-#define GL_RGBA32F_EXT 0x8814
-#define GL_RGB32F_EXT 0x8815
-#define GL_ALPHA32F_EXT 0x8816
-#define GL_LUMINANCE32F_EXT 0x8818
-#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
-#define GL_ALPHA16F_EXT 0x881C
-#define GL_LUMINANCE16F_EXT 0x881E
-#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
-#define GL_R32F_EXT 0x822E
-#define GL_RG32F_EXT 0x8230
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-#endif /* GL_EXT_texture_storage */
-
-#ifndef GL_EXT_texture_type_2_10_10_10_REV
-#define GL_EXT_texture_type_2_10_10_10_REV 1
-#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
-#endif /* GL_EXT_texture_type_2_10_10_10_REV */
-
-#ifndef GL_EXT_texture_view
-#define GL_EXT_texture_view 1
-#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB
-#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC
-#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD
-#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE
-#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
-typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-#endif
-#endif /* GL_EXT_texture_view */
-
-#ifndef GL_EXT_unpack_subimage
-#define GL_EXT_unpack_subimage 1
-#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
-#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
-#endif /* GL_EXT_unpack_subimage */
-
-#ifndef GL_FJ_shader_binary_GCCSO
-#define GL_FJ_shader_binary_GCCSO 1
-#define GL_GCCSO_SHADER_BINARY_FJ 0x9260
-#endif /* GL_FJ_shader_binary_GCCSO */
-
-#ifndef GL_IMG_multisampled_render_to_texture
-#define GL_IMG_multisampled_render_to_texture 1
-#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
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-#endif /* GL_IMG_multisampled_render_to_texture */
-
-#ifndef GL_IMG_program_binary
-#define GL_IMG_program_binary 1
-#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
-#endif /* GL_IMG_program_binary */
-
-#ifndef GL_IMG_read_format
-#define GL_IMG_read_format 1
-#define GL_BGRA_IMG 0x80E1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
-#endif /* GL_IMG_read_format */
-
-#ifndef GL_IMG_shader_binary
-#define GL_IMG_shader_binary 1
-#define GL_SGX_BINARY_IMG 0x8C0A
-#endif /* GL_IMG_shader_binary */
-
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_IMG_texture_compression_pvrtc 1
-#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_texture_compression_pvrtc */
-
-#ifndef GL_IMG_texture_compression_pvrtc2
-#define GL_IMG_texture_compression_pvrtc2 1
-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
-#endif /* GL_IMG_texture_compression_pvrtc2 */
-
-#ifndef GL_INTEL_performance_query
-#define GL_INTEL_performance_query 1
-#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
-#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
-#define GL_PERFQUERY_WAIT_INTEL 0x83FB
-#define GL_PERFQUERY_FLUSH_INTEL 0x83FA
-#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9
-#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0
-#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
-#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
-#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
-#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4
-#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
-#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
-#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
-#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
-#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
-#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
-#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
-#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
-#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
-#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
-typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
-typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
-typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
-typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
-typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
-typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
-typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
-GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
-GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
-GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
-GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
-GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
-GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
-GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
-GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
-GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
-#endif
-#endif /* GL_INTEL_performance_query */
-
-#ifndef GL_NV_blend_equation_advanced
-#define GL_NV_blend_equation_advanced 1
-#define GL_BLEND_OVERLAP_NV 0x9281
-#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280
-#define GL_BLUE_NV 0x1905
-#define GL_COLORBURN_NV 0x929A
-#define GL_COLORDODGE_NV 0x9299
-#define GL_CONJOINT_NV 0x9284
-#define GL_CONTRAST_NV 0x92A1
-#define GL_DARKEN_NV 0x9297
-#define GL_DIFFERENCE_NV 0x929E
-#define GL_DISJOINT_NV 0x9283
-#define GL_DST_ATOP_NV 0x928F
-#define GL_DST_IN_NV 0x928B
-#define GL_DST_NV 0x9287
-#define GL_DST_OUT_NV 0x928D
-#define GL_DST_OVER_NV 0x9289
-#define GL_EXCLUSION_NV 0x92A0
-#define GL_GREEN_NV 0x1904
-#define GL_HARDLIGHT_NV 0x929B
-#define GL_HARDMIX_NV 0x92A9
-#define GL_HSL_COLOR_NV 0x92AF
-#define GL_HSL_HUE_NV 0x92AD
-#define GL_HSL_LUMINOSITY_NV 0x92B0
-#define GL_HSL_SATURATION_NV 0x92AE
-#define GL_INVERT_OVG_NV 0x92B4
-#define GL_INVERT_RGB_NV 0x92A3
-#define GL_LIGHTEN_NV 0x9298
-#define GL_LINEARBURN_NV 0x92A5
-#define GL_LINEARDODGE_NV 0x92A4
-#define GL_LINEARLIGHT_NV 0x92A7
-#define GL_MINUS_CLAMPED_NV 0x92B3
-#define GL_MINUS_NV 0x929F
-#define GL_MULTIPLY_NV 0x9294
-#define GL_OVERLAY_NV 0x9296
-#define GL_PINLIGHT_NV 0x92A8
-#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2
-#define GL_PLUS_CLAMPED_NV 0x92B1
-#define GL_PLUS_DARKER_NV 0x9292
-#define GL_PLUS_NV 0x9291
-#define GL_RED_NV 0x1903
-#define GL_SCREEN_NV 0x9295
-#define GL_SOFTLIGHT_NV 0x929C
-#define GL_SRC_ATOP_NV 0x928E
-#define GL_SRC_IN_NV 0x928A
-#define GL_SRC_NV 0x9286
-#define GL_SRC_OUT_NV 0x928C
-#define GL_SRC_OVER_NV 0x9288
-#define GL_UNCORRELATED_NV 0x9282
-#define GL_VIVIDLIGHT_NV 0x92A6
-#define GL_XOR_NV 0x1506
-typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
-typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glBlendBarrierNV (void);
-#endif
-#endif /* GL_NV_blend_equation_advanced */
-
-#ifndef GL_NV_blend_equation_advanced_coherent
-#define GL_NV_blend_equation_advanced_coherent 1
-#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285
-#endif /* GL_NV_blend_equation_advanced_coherent */
-
-#ifndef GL_NV_copy_buffer
-#define GL_NV_copy_buffer 1
-#define GL_COPY_READ_BUFFER_NV 0x8F36
-#define GL_COPY_WRITE_BUFFER_NV 0x8F37
-typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-#endif
-#endif /* GL_NV_copy_buffer */
-
-#ifndef GL_NV_coverage_sample
-#define GL_NV_coverage_sample 1
-#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 0x00008000
-typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
-typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
-GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
-#endif
-#endif /* GL_NV_coverage_sample */
-
-#ifndef GL_NV_depth_nonlinear
-#define GL_NV_depth_nonlinear 1
-#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
-#endif /* GL_NV_depth_nonlinear */
-
-#ifndef GL_NV_draw_buffers
-#define GL_NV_draw_buffers 1
-#define GL_MAX_DRAW_BUFFERS_NV 0x8824
-#define GL_DRAW_BUFFER0_NV 0x8825
-#define GL_DRAW_BUFFER1_NV 0x8826
-#define GL_DRAW_BUFFER2_NV 0x8827
-#define GL_DRAW_BUFFER3_NV 0x8828
-#define GL_DRAW_BUFFER4_NV 0x8829
-#define GL_DRAW_BUFFER5_NV 0x882A
-#define GL_DRAW_BUFFER6_NV 0x882B
-#define GL_DRAW_BUFFER7_NV 0x882C
-#define GL_DRAW_BUFFER8_NV 0x882D
-#define GL_DRAW_BUFFER9_NV 0x882E
-#define GL_DRAW_BUFFER10_NV 0x882F
-#define GL_DRAW_BUFFER11_NV 0x8830
-#define GL_DRAW_BUFFER12_NV 0x8831
-#define GL_DRAW_BUFFER13_NV 0x8832
-#define GL_DRAW_BUFFER14_NV 0x8833
-#define GL_DRAW_BUFFER15_NV 0x8834
-#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
-#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
-#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
-#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
-#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
-#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
-#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
-#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
-#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
-#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
-#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
-#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
-#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
-#define GL_COLOR_ATTACHMENT13_NV 0x8CED
-#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
-#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
-#endif
-#endif /* GL_NV_draw_buffers */
-
-#ifndef GL_NV_draw_instanced
-#define GL_NV_draw_instanced 1
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#endif
-#endif /* GL_NV_draw_instanced */
-
-#ifndef GL_NV_explicit_attrib_location
-#define GL_NV_explicit_attrib_location 1
-#endif /* GL_NV_explicit_attrib_location */
-
-#ifndef GL_NV_fbo_color_attachments
-#define GL_NV_fbo_color_attachments 1
-#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
-#endif /* GL_NV_fbo_color_attachments */
-
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-#define GL_ALL_COMPLETED_NV 0x84F2
-#define GL_FENCE_STATUS_NV 0x84F3
-#define GL_FENCE_CONDITION_NV 0x84F4
-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);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
-GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
-GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
-GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
-GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence);
-GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
-#endif
-#endif /* GL_NV_fence */
-
-#ifndef GL_NV_framebuffer_blit
-#define GL_NV_framebuffer_blit 1
-#define GL_READ_FRAMEBUFFER_NV 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA
-typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-#endif /* GL_NV_framebuffer_blit */
-
-#ifndef GL_NV_framebuffer_multisample
-#define GL_NV_framebuffer_multisample 1
-#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
-#define GL_MAX_SAMPLES_NV 0x8D57
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_NV_framebuffer_multisample */
-
-#ifndef GL_NV_generate_mipmap_sRGB
-#define GL_NV_generate_mipmap_sRGB 1
-#endif /* GL_NV_generate_mipmap_sRGB */
-
-#ifndef GL_NV_instanced_arrays
-#define GL_NV_instanced_arrays 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
-#endif
-#endif /* GL_NV_instanced_arrays */
-
-#ifndef GL_NV_non_square_matrices
-#define GL_NV_non_square_matrices 1
-#define GL_FLOAT_MAT2x3_NV 0x8B65
-#define GL_FLOAT_MAT2x4_NV 0x8B66
-#define GL_FLOAT_MAT3x2_NV 0x8B67
-#define GL_FLOAT_MAT3x4_NV 0x8B68
-#define GL_FLOAT_MAT4x2_NV 0x8B69
-#define GL_FLOAT_MAT4x3_NV 0x8B6A
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#endif
-#endif /* GL_NV_non_square_matrices */
-
-#ifndef GL_NV_read_buffer
-#define GL_NV_read_buffer 1
-#define GL_READ_BUFFER_NV 0x0C02
-typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
-#endif
-#endif /* GL_NV_read_buffer */
-
-#ifndef GL_NV_read_buffer_front
-#define GL_NV_read_buffer_front 1
-#endif /* GL_NV_read_buffer_front */
-
-#ifndef GL_NV_read_depth
-#define GL_NV_read_depth 1
-#endif /* GL_NV_read_depth */
-
-#ifndef GL_NV_read_depth_stencil
-#define GL_NV_read_depth_stencil 1
-#endif /* GL_NV_read_depth_stencil */
-
-#ifndef GL_NV_read_stencil
-#define GL_NV_read_stencil 1
-#endif /* GL_NV_read_stencil */
-
-#ifndef GL_NV_sRGB_formats
-#define GL_NV_sRGB_formats 1
-#define GL_SLUMINANCE_NV 0x8C46
-#define GL_SLUMINANCE_ALPHA_NV 0x8C44
-#define GL_SRGB8_NV 0x8C41
-#define GL_SLUMINANCE8_NV 0x8C47
-#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45
-#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
-#define GL_ETC1_SRGB8_NV 0x88EE
-#endif /* GL_NV_sRGB_formats */
-
-#ifndef GL_NV_shadow_samplers_array
-#define GL_NV_shadow_samplers_array 1
-#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4
-#endif /* GL_NV_shadow_samplers_array */
-
-#ifndef GL_NV_shadow_samplers_cube
-#define GL_NV_shadow_samplers_cube 1
-#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5
-#endif /* GL_NV_shadow_samplers_cube */
-
-#ifndef GL_NV_texture_border_clamp
-#define GL_NV_texture_border_clamp 1
-#define GL_TEXTURE_BORDER_COLOR_NV 0x1004
-#define GL_CLAMP_TO_BORDER_NV 0x812D
-#endif /* GL_NV_texture_border_clamp */
-
-#ifndef GL_NV_texture_compression_s3tc_update
-#define GL_NV_texture_compression_s3tc_update 1
-#endif /* GL_NV_texture_compression_s3tc_update */
-
-#ifndef GL_NV_texture_npot_2D_mipmap
-#define GL_NV_texture_npot_2D_mipmap 1
-#endif /* GL_NV_texture_npot_2D_mipmap */
-
-#ifndef GL_QCOM_alpha_test
-#define GL_QCOM_alpha_test 1
-#define GL_ALPHA_TEST_QCOM 0x0BC0
-#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
-#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
-typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
-#endif
-#endif /* GL_QCOM_alpha_test */
-
-#ifndef GL_QCOM_binning_control
-#define GL_QCOM_binning_control 1
-#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0
-#define GL_CPU_OPTIMIZED_QCOM 0x8FB1
-#define GL_GPU_OPTIMIZED_QCOM 0x8FB2
-#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
-#endif /* GL_QCOM_binning_control */
-
-#ifndef GL_QCOM_driver_control
-#define GL_QCOM_driver_control 1
-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);
-#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
-#endif /* GL_QCOM_driver_control */
-
-#ifndef GL_QCOM_extended_get
-#define GL_QCOM_extended_get 1
-#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
-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, void *texels);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params);
-#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, void *texels);
-GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params);
-#endif
-#endif /* GL_QCOM_extended_get */
-
-#ifndef GL_QCOM_extended_get2
-#define GL_QCOM_extended_get2 1
-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);
-#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
-#endif /* GL_QCOM_extended_get2 */
-
-#ifndef GL_QCOM_perfmon_global_mode
-#define GL_QCOM_perfmon_global_mode 1
-#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
-#endif /* GL_QCOM_perfmon_global_mode */
-
-#ifndef GL_QCOM_tiled_rendering
-#define GL_QCOM_tiled_rendering 1
-#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
-typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
-#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
-#endif /* GL_QCOM_tiled_rendering */
-
-#ifndef GL_QCOM_writeonly_rendering
-#define GL_QCOM_writeonly_rendering 1
-#define GL_WRITEONLY_RENDERING_QCOM 0x8823
-#endif /* GL_QCOM_writeonly_rendering */
-
-#ifndef GL_VIV_shader_binary
-#define GL_VIV_shader_binary 1
-#define GL_SHADER_BINARY_VIV 0x8FC4
-#endif /* GL_VIV_shader_binary */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLES2/gl2platform.h b/distrib/android-emugl/host/libs/Translator/include/GLES2/gl2platform.h
deleted file mode 100644
index 89d4d44dc..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLES2/gl2platform.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __gl2platform_h_
-#define __gl2platform_h_
-
-/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
-
-/*
- * 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_ */
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/FramebufferData.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/FramebufferData.h
deleted file mode 100644
index ee136cd1c..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/FramebufferData.h
+++ /dev/null
@@ -1,70 +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();
-
- unsigned int sourceEGLImage = 0;
- void (*eglImageDetach)(unsigned int imageId) = nullptr;
- GLuint attachedFB = 0;
- GLenum attachedPoint = 0;
- GLuint eglImageGlobalTexName = 0;
-};
-
-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 = 0;
- 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 = false;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLDispatch.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLDispatch.h
deleted file mode 100644
index d30cc58e2..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLDispatch.h
+++ /dev/null
@@ -1,52 +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_DISPATCHH
-#define GL_DISPATCHH
-
-#include <GLES/gl.h>
-#include <GLES2/gl2.h>
-#include <GLES3/gl3.h>
-
-#include "OpenGLESDispatch/gldefs.h"
-#include "OpenGLESDispatch/gles_functions.h"
-#include "GLutils.h"
-
-#include "emugl/common/mutex.h"
-
-#define GLAPIENTRY GL_APIENTRY
-typedef void (*FUNCPTR_NO_ARGS_RET_VOID)();
-typedef GLsync (*FUNCPTR_FENCE_SYNC)(GLenum, GLbitfield);
-typedef GLenum (*FUNCPTR_CLIENT_WAIT_SYNC)(GLsync, GLbitfield, GLuint64);
-typedef void (*FUNCPTR_DELETE_SYNC)(GLsync);
-
-#define GLES_DECLARE_METHOD(return_type, function_name, signature) \
- static GL_APICALL return_type (GL_APIENTRY *function_name) signature;
-
-class GLDispatch {
-public:
- // Constructor.
- GLDispatch();
-
- void dispatchFuncs(GLESVersion version);
-
- LIST_GLES_FUNCTIONS(GLES_DECLARE_METHOD, GLES_DECLARE_METHOD)
-
-private:
- bool m_isLoaded;
- static emugl::Mutex s_lock;
-};
-
-#endif // GL_DISPATCH_H
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESbuffer.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESbuffer.h
deleted file mode 100644
index 034051446..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESbuffer.h
+++ /dev/null
@@ -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) {}
- 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 = 0;
- GLuint m_usage = GL_STATIC_DRAW;
- unsigned char* m_data = nullptr;
- RangeList m_conversionManager;
- bool m_wasBound = false;
-};
-
-typedef emugl::SmartPtr<GLESbuffer> GLESbufferPtr;
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLEScontext.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLEScontext.h
deleted file mode 100644
index ad713ac14..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLEScontext.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef GLES_CONTEXT_H
-#define GLES_CONTEXT_H
-
-#include "GLDispatch.h"
-#include "GLESpointer.h"
-#include "objectNameManager.h"
-#include "emugl/common/mutex.h"
-#include <string>
-#include <unordered_map>
-
-typedef std::unordered_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:
- explicit Version(int major = 0,int minor = 0,int release = 0);
- 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 {
- int maxLights = 0;
- int maxVertexAttribs = 0;
- int maxClipPlane = 0;
- int maxTexUnits = 0;
- int maxTexImageUnits = 0;
- int maxTexSize = 0;
- int maxCombinedTexImageUnits = 0;
- Version glslVersion;
- bool GL_EXT_TEXTURE_FORMAT_BGRA8888 = false;
- bool GL_EXT_FRAMEBUFFER_OBJECT = false;
- bool GL_ARB_VERTEX_BLEND = false;
- bool GL_ARB_MATRIX_PALETTE = false;
- bool GL_EXT_PACKED_DEPTH_STENCIL = false;
- bool GL_OES_READ_FORMAT = false;
- bool GL_ARB_HALF_FLOAT_PIXEL = false;
- bool GL_NV_HALF_FLOAT = false;
- bool GL_ARB_HALF_FLOAT_VERTEX = false;
- bool GL_SGIS_GENERATE_MIPMAP = false;
- bool GL_ARB_ES2_COMPATIBILITY = false;
- bool GL_OES_STANDARD_DERIVATIVES = false;
- bool GL_OES_TEXTURE_NPOT = false;
- bool GL_OES_RGB8_RGBA8 = false;
-};
-
-struct ArrayData{
- void* data = nullptr;
- GLenum type = 0;
- unsigned int stride = 0;
- bool allocated = false;
-};
-
-class GLESConversionArrays
-{
-public:
- 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::unordered_map<GLenum,ArrayData> m_arrays;
- unsigned int m_current = 0;
-};
-
-class GLEScontext{
-public:
- virtual void init(GlLibrary* glLib);
- GLenum getGLerror();
- void setGLerror(GLenum err);
- void setShareGroup(ShareGroupPtr grp){m_shareGroup = grp;};
- const 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 * getVendorString() const;
- const char * getRendererString() const;
- const char * getVersionString() 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 unsigned 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:
- static void buildStrings(const char* baseVendor, const char* baseRenderer, const char* baseVersion, const char* version);
- 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 emugl::Mutex s_lock;
- static GLDispatch s_glDispatch;
- bool m_initialized = false;
- unsigned int m_activeTexture = 0;
- GLint m_unpackAlignment = 4;
- ArraysMap m_map;
- static std::string* s_glExtensions;
- 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 = GL_NO_ERROR;
- textureUnitState* m_texState = nullptr;
- unsigned int m_arrayBuffer = 0;
- unsigned int m_elementBuffer = 0;
- GLuint m_renderbuffer = 0;
- GLuint m_framebuffer = 0;
-
- static std::string s_glVendor;
- static std::string s_glRenderer;
- static std::string s_glVersion;
-};
-
-#endif
-
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESmacros.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESmacros.h
deleted file mode 100644
index 95ffadb8d..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESmacros.h
+++ /dev/null
@@ -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
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESpointer.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESpointer.h
deleted file mode 100644
index 851fe451a..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESpointer.h
+++ /dev/null
@@ -1,58 +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_POINTER_H
-#define GLES_POINTER_H
-
-#include <GLES/gl.h>
-#include "GLESbuffer.h"
-
-class GLESpointer
-{
-
-public:
- GLESpointer();
- GLenum getType() const;
- GLint getSize() const;
- GLsizei getStride() const;
- const GLvoid* getArrayData() const;
- GLvoid* getBufferData() const;
- GLuint getBufferName() const;
- GLboolean getNormalized() const { return m_normalize ? GL_TRUE : GL_FALSE; }
- const GLvoid* getData() const;
- unsigned int getBufferOffset() const;
- void redirectPointerData();
- void getBufferConversions(const RangeList& rl,RangeList& rlOut);
- bool bufferNeedConversion(){ return !m_buffer->fullyConverted();}
- void setArray (GLint size,GLenum type,GLsizei stride,const GLvoid* data,bool normalize = false);
- void setBuffer(GLint size,GLenum type,GLsizei stride,GLESbuffer* buf,GLuint bufferName,int offset,bool normalize = false);
- bool isEnable() const;
- bool isNormalize() const;
- bool isVBO() const;
- void enable(bool b);
-
-private:
- GLint m_size;
- GLenum m_type;
- GLsizei m_stride;
- bool m_enabled;
- bool m_normalize;
- const GLvoid* m_data;
- GLESbuffer* m_buffer;
- GLuint m_bufferName;
- unsigned int m_buffOffset;
- bool m_isVBO;
-};
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESvalidate.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESvalidate.h
deleted file mode 100644
index 92c1f3311..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLESvalidate.h
+++ /dev/null
@@ -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 GLES_VALIDATE_H
-#define GLES_VALIDATE_H
-
-#include <GLES/gl.h>
-#include "GLEScontext.h"
-struct GLESvalidate
-{
-static bool textureEnum(GLenum e,unsigned int maxTex);
-static bool pixelType(GLEScontext * ctx,GLenum type);
-static bool pixelOp(GLenum format,GLenum type);
-static bool pixelFrmt(GLEScontext* ctx , GLenum format);
-static bool bufferTarget(GLenum target);
-static bool bufferUsage(GLenum usage);
-static bool bufferParam(GLenum param);
-static bool drawMode(GLenum mode);
-static bool drawType(GLenum mode);
-static bool textureTarget(GLenum target);
-static bool textureTargetLimited(GLenum target);
-static bool textureTargetEx(GLenum target);
-static bool texImgDim(GLsizei width,GLsizei height,int maxTexSize);
-static bool blendEquationMode(GLenum mode);
-static bool framebufferTarget(GLenum target);
-static bool framebufferAttachment(GLenum attachment);
-static bool framebufferAttachmentParams(GLenum pname);
-static bool renderbufferTarget(GLenum target);
-static bool renderbufferParams(GLenum pname);
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLconversion_macros.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLconversion_macros.h
deleted file mode 100644
index 83e99b46c..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLconversion_macros.h
+++ /dev/null
@@ -1,31 +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_FIXED_OPS_H
-#define _GL_FIXED_OPS_H
-
-#define X2F(x) (((float)(x))/65536.0f)
-#define X2D(x) (((double)(x))/65536.0)
-#define X2I(x) ((x) /65536)
-#define B2S(x) ((short)x)
-
-
-#define F2X(d) ((d) > 32767.65535 ? 32767 * 65536 + 65535 : \
- (d) < -32768.65535 ? -32768 * 65536 + 65535 : \
- ((GLfixed) ((d) * 65536)))
-
-#define I2X(d) ((d)*65536)
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLutils.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLutils.h
deleted file mode 100644
index 974b9be52..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/GLutils.h
+++ /dev/null
@@ -1,52 +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_UTILS_H
-#define GL_UTILS_H
-
-#include <assert.h>
-#include <inttypes.h>
-
-typedef enum {
- GLES_1_1 = 1,
- GLES_2_0 = 2,
- MAX_GLES_VERSION //Must be last
-} GLESVersion;
-
-template <class T>
-void swap(T& x,T& y) {
- T temp;
- temp = x;
- x = y;
- y = temp;
-}
-
-bool isPowerOf2(int num);
-
-// <EGL/egl.h> defines many types as 'void*' while they're really
-// implemented as unsigned integers. These convenience template functions
-// help casting between them safely without generating compiler warnings.
-inline void* SafePointerFromUInt(unsigned int handle) {
- return (void*)(uintptr_t)(handle);
-}
-
-inline unsigned int SafeUIntFromPointer(const void* ptr) {
- // Assertion error if the pointer contains a value that does not fit
- // in an unsigned integer!
- assert((uintptr_t)(ptr) == (unsigned int)(uintptr_t)(ptr));
- return (unsigned int)(uintptr_t)(ptr);
-}
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/PaletteTexture.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/PaletteTexture.h
deleted file mode 100644
index 90b206d0c..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/PaletteTexture.h
+++ /dev/null
@@ -1,25 +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 __PALETTE_TEXTURE_H__
-#define __PALETTE_TEXTURE_H__
-
-#include <GLES/gl.h>
-
-#define MAX_SUPPORTED_PALETTE 10
-
-unsigned char* uncompressTexture(GLenum internalformat,GLenum& formatOut,GLsizei width,GLsizei height,GLsizei imageSize, const GLvoid* data,GLint level);
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/RangeManip.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/RangeManip.h
deleted file mode 100644
index e3162b8d6..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/RangeManip.h
+++ /dev/null
@@ -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 RANGE_H
-#define RANGE_H
-
-#include <vector>
-
-class Range {
-
-public:
- Range():m_start(0),m_end(0),m_size(0){};
- Range(int start,int size):m_start(start),m_end(start+size),m_size(size){};
- Range(const Range& r):m_start(r.m_start),m_end(r.m_end),m_size(r.m_size){};
- void setRange(int start,int size){m_start = start; m_end = start+size; m_size = size;};
- inline int getStart() const{return m_start;};
- inline int getEnd() const{return m_end;};
- inline int getSize() const{return m_size;};
- Range& operator=(const Range& r) {
- m_start = r.m_start;
- m_end = r.m_end;
- m_size = r.m_size;
- return *this;
- }
- bool operator ==(const Range& r) const {
- return m_start == r.m_start && m_size == r.m_size && m_end == r.m_end;
- }
- bool operator !=(const Range& r) const {return !((*this) == r);};
- bool rangeIntersection(const Range& r,Range& rOut) const ;
- bool rangeUnion(const Range& r,Range& rOut) const ;
-
-private:
- int m_start;
- int m_end;
- int m_size;
-};
-
-class RangeList {
-public:
- void addRange(const Range& r);
- void addRanges(const RangeList& rl);
- void delRange(const Range& r,RangeList& deleted);
- void delRanges(const RangeList& rl,RangeList& deleted);
- bool empty() const;
- void merge();
- int size() const;
- void clear();
- Range& operator[](unsigned int i){return list[i];};
-private:
- void erase(unsigned int i);
- std::vector<Range> list;
-};
-
-
-
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/TextureUtils.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/TextureUtils.h
deleted file mode 100644
index 9b0c4eacf..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/TextureUtils.h
+++ /dev/null
@@ -1,31 +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 _TEXTURE_UTILS_H
-#define _TEXTURE_UTILS_H
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include "GLEScontext.h"
-#include "PaletteTexture.h"
-#include "etc1.h"
-
-int getCompressedFormats(int* formats);
-void doCompressedTexImage2D(GLEScontext * ctx, GLenum target, GLint level,
- GLenum internalformat, GLsizei width,
- GLsizei height, GLint border,
- GLsizei imageSize, const GLvoid* data, void * funcPtr);
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/TranslatorIfaces.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/TranslatorIfaces.h
deleted file mode 100644
index 1e1ebb62c..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/TranslatorIfaces.h
+++ /dev/null
@@ -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 TRANSLATOR_IFACES_H
-#define TRANSLATOR_IFACES_H
-#include <GLES/gl.h>
-#include <GLES2/gl2.h>
-#include <GLES3/gl3.h>
-#include <string.h>
-#include "objectNameManager.h"
-
-extern "C" {
-
-/* 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 (*__translatorMustCastToProperFunctionPointerType)(void);
-
-typedef struct {
- const char* name;
- __translatorMustCastToProperFunctionPointerType address;
-}ExtentionDescriptor;
-
-class TextureData : public ObjectData
-{
-public:
- ~TextureData() {
- if (sourceEGLImage && eglImageDetach) (*eglImageDetach)(sourceEGLImage);
- }
- TextureData(): ObjectData(TEXTURE_DATA),
- width(0),
- height(0),
- border(0),
- internalFormat(GL_RGBA),
- sourceEGLImage(0),
- wasBound(false),
- requiresAutoMipmap(false),
- target(0),
- oldGlobal(0) {
- memset(crop_rect,0,4*sizeof(int));
- };
-
- unsigned int width;
- unsigned int height;
- unsigned int border;
- unsigned int internalFormat;
- unsigned int sourceEGLImage;
- bool wasBound;
- bool requiresAutoMipmap;
- int crop_rect[4];
- void (*eglImageDetach)(unsigned int imageId);
- GLenum target;
- GLuint oldGlobal;
-};
-
-struct EglImage
-{
- ~EglImage(){};
- unsigned int imageId;
- unsigned int globalTexName;
- unsigned int width;
- unsigned int height;
- unsigned int internalFormat;
- unsigned int border;
-};
-
-typedef emugl::SmartPtr<EglImage> ImagePtr;
-typedef std::map< unsigned int, ImagePtr> ImagesHndlMap;
-
-class GLEScontext;
-
-typedef struct {
- GLEScontext* (*createGLESContext)();
- void (*initContext)(GLEScontext*,ShareGroupPtr);
- void (*deleteGLESContext)(GLEScontext*);
- void (*flush)();
- void (*finish)();
- void (*setShareGroup)(GLEScontext*,ShareGroupPtr);
- __translatorMustCastToProperFunctionPointerType (*getProcAddress)(const char*);
- GLsync (*fenceSync)(GLenum, GLbitfield);
- GLenum (*clientWaitSync)(GLsync, GLbitfield, GLuint64);
- void (*deleteSync)(GLsync);
-}GLESiface;
-
-
-typedef struct {
- GLEScontext* (*getGLESContext)();
- EglImage* (*eglAttachEGLImage)(unsigned int imageId);
- void (*eglDetachEGLImage)(unsigned int imageId);
-}EGLiface;
-
-typedef GLESiface* (*__translator_getGLESIfaceFunc)(EGLiface*);
-
-}
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/etc1.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/etc1.h
deleted file mode 100644
index 15ee9ac40..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/etc1.h
+++ /dev/null
@@ -1,108 +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.
-
-#ifndef __etc1_h__
-#define __etc1_h__
-
-#define MAX_ETC_SUPPORTED 1
-
-#define ETC1_ENCODED_BLOCK_SIZE 8
-#define ETC1_DECODED_BLOCK_SIZE 48
-
-#ifndef ETC1_RGB8_OES
-#define ETC1_RGB8_OES 0x8D64
-#endif
-
-typedef unsigned char etc1_byte;
-typedef int etc1_bool;
-typedef unsigned int etc1_uint32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Encode a block of pixels.
-//
-// pIn is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
-// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
-// value of pixel (x, y).
-//
-// validPixelMask is a 16-bit mask where bit (1 << (x + y * 4)) indicates whether
-// the corresponding (x,y) pixel is valid. Invalid pixel color values are ignored when compressing.
-//
-// pOut is an ETC1 compressed version of the data.
-
-void etc1_encode_block(const etc1_byte* pIn, etc1_uint32 validPixelMask, etc1_byte* pOut);
-
-// Decode a block of pixels.
-//
-// pIn is an ETC1 compressed version of the data.
-//
-// pOut is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
-// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
-// value of pixel (x, y).
-
-void etc1_decode_block(const etc1_byte* pIn, etc1_byte* pOut);
-
-// Return the size of the encoded image data (does not include size of PKM header).
-
-etc1_uint32 etc1_get_encoded_data_size(etc1_uint32 width, etc1_uint32 height);
-
-// Encode an entire image.
-// pIn - pointer to the image data. Formatted such that
-// pixel (x,y) is at pIn + pixelSize * x + stride * y;
-// pOut - pointer to encoded data. Must be large enough to store entire encoded image.
-// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
-// returns non-zero if there is an error.
-
-int etc1_encode_image(const etc1_byte* pIn, etc1_uint32 width, etc1_uint32 height,
- etc1_uint32 pixelSize, etc1_uint32 stride, etc1_byte* pOut);
-
-// Decode an entire image.
-// pIn - pointer to encoded data.
-// pOut - pointer to the image data. Will be written such that
-// pixel (x,y) is at pIn + pixelSize * x + stride * y. Must be
-// large enough to store entire image.
-// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
-// returns non-zero if there is an error.
-
-int etc1_decode_image(const etc1_byte* pIn, etc1_byte* pOut,
- etc1_uint32 width, etc1_uint32 height,
- etc1_uint32 pixelSize, etc1_uint32 stride);
-
-// Size of a PKM header, in bytes.
-
-#define ETC_PKM_HEADER_SIZE 16
-
-// Format a PKM header
-
-void etc1_pkm_format_header(etc1_byte* pHeader, etc1_uint32 width, etc1_uint32 height);
-
-// Check if a PKM header is correctly formatted.
-
-etc1_bool etc1_pkm_is_valid(const etc1_byte* pHeader);
-
-// Read the image width from a PKM header
-
-etc1_uint32 etc1_pkm_get_width(const etc1_byte* pHeader);
-
-// Read the image height from a PKM header
-
-etc1_uint32 etc1_pkm_get_height(const etc1_byte* pHeader);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/GLcommon/objectNameManager.h b/distrib/android-emugl/host/libs/Translator/include/GLcommon/objectNameManager.h
deleted file mode 100644
index 61170bb65..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/GLcommon/objectNameManager.h
+++ /dev/null
@@ -1,263 +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 _OBJECT_NAME_MANAGER_H
-#define _OBJECT_NAME_MANAGER_H
-
-#include <map>
-#include "emugl/common/mutex.h"
-#include "emugl/common/smart_ptr.h"
-
-enum NamedObjectType {
- VERTEXBUFFER = 0,
- TEXTURE = 1,
- RENDERBUFFER = 2,
- FRAMEBUFFER = 3,
- SHADER = 4,
- NUM_OBJECT_TYPES = 5 // Must be last
-};
-
-enum ObjectDataType {
- SHADER_DATA,
- PROGRAM_DATA,
- TEXTURE_DATA,
- BUFFER_DATA,
- UNDEFINED_DATA
-};
-
-class ObjectData
-{
-public:
- ObjectData(ObjectDataType type = UNDEFINED_DATA): m_dataType(type) {}
- ObjectDataType getDataType() { return m_dataType; };
- virtual ~ObjectData() = default;
-private:
- ObjectDataType m_dataType;
-};
-typedef emugl::SmartPtr<ObjectData> ObjectDataPtr;
-typedef unsigned long long ObjectLocalName;
-typedef std::map<ObjectLocalName, unsigned int> NamesMap;
-
-//
-// Class NameSpace - this class manages allocations and deletions of objects
-// from a single "local" namespace (private to context group).
-// For each allocated object name, a "global" name is
-// generated as well to be used in the space where all
-// contexts are shared.
-//
-// NOTE: this class does not used by the EGL/GLES layer directly,
-// the EGL/GLES layer creates objects using the ShareGroup class
-// interface (see below).
-class GlobalNameSpace;
-class NameSpace
-{
- friend class ShareGroup;
- friend class GlobalNameSpace;
-
-private:
- NameSpace(NamedObjectType p_type, GlobalNameSpace *globalNameSpace);
- ~NameSpace();
-
- //
- // genName - creates new object in the namespace and returns its name.
- // if genLocal is false then the specified p_localName will be used.
- // This function also generate a global name for the object,
- // the value of the global name can be retrieved using the
- // getGlobalName function.
- //
- ObjectLocalName genName(ObjectLocalName p_localName, bool genGlobal, bool genLocal);
-
- // genGlobalName() - This function creates a global name
- // with no associated local name, for the
- // translator internal use.
- unsigned int genGlobalName(void);
-
- //
- // getGlobalName - returns the global name of an object or 0 if the object
- // does not exist.
- //
- unsigned int getGlobalName(ObjectLocalName p_localName);
-
- //
- // getLocaalName - returns the local name of an object or 0 if the object
- // does not exist.
- //
- ObjectLocalName getLocalName(unsigned int p_globalName);
-
- //
- // deleteName - deletes and object from the namespace as well as its
- // global name from the global name space.
- //
- void deleteName(ObjectLocalName p_localName);
-
- //
- // isObject - returns true if the named object exist.
- //
- bool isObject(ObjectLocalName p_localName);
-
- //
- // replaces an object to map to an existing global object
- //
- void replaceGlobalName(ObjectLocalName p_localName, unsigned int p_globalName);
-
-private:
- ObjectLocalName m_nextName = 0;
- NamesMap m_localToGlobalMap;
- const NamedObjectType m_type;
- GlobalNameSpace *m_globalNameSpace = nullptr;
-};
-
-class GlobalNameSpace
-{
-public:
- unsigned int genName(NamedObjectType p_type);
- void deleteName(NamedObjectType p_type, unsigned int p_name);
-
-private:
- emugl::Mutex m_lock;
-};
-
-//
-// class ShareGroup -
-// That class manages objects of one "local" context share group, typically
-// there will be one inctance of ShareGroup for each user OpenGL context
-// unless the user context share with another user context. In that case they
-// both will share the same ShareGroup instance.
-// calls into that class gets serialized through a lock so it is thread safe.
-//
-class ShareGroup
-{
- friend class ObjectNameManager;
-public:
- ~ShareGroup();
-
- //
- // genName - generates new object name and returns its name value.
- // if genLocal is false, p_localName will be used as the name.
- // This function also generates a "global" name for the object
- // which can be queried using the getGlobalName function.
- //
- ObjectLocalName genName(NamedObjectType p_type, ObjectLocalName p_localName = 0, bool genLocal= false);
-
- // genGlobalName() - This function creates a global name
- // with no associated local name, for the
- // translator internal use.
- unsigned int genGlobalName(NamedObjectType p_type);
-
- //
- // getGlobalName - retrieves the "global" name of an object or 0 if the
- // object does not exist.
- //
- unsigned int getGlobalName(NamedObjectType p_type, ObjectLocalName p_localName);
-
- //
- // getLocalName - retrieves the "local" name of an object or 0 if the
- // object does not exist.
- //
- ObjectLocalName getLocalName(NamedObjectType p_type, unsigned int p_globalName);
-
- //
- // deleteName - deletes and object from the namespace as well as its
- // global name from the global name space.
- //
- void deleteName(NamedObjectType p_type, ObjectLocalName p_localName);
-
- //
- // replaceGlobalName - replaces an object to map to an existing global
- // named object. (used when creating EGLImage siblings)
- //
- void replaceGlobalName(NamedObjectType p_type, ObjectLocalName p_localName, unsigned int p_globalName);
-
- //
- // isObject - returns true if the named object exist.
- //
- bool isObject(NamedObjectType p_type, ObjectLocalName p_localName);
-
- //
- // Assign object global data to a names object
- //
- void setObjectData(NamedObjectType p_type, ObjectLocalName p_localName, ObjectDataPtr data);
-
- //
- // Retrieve object global data
- //
- ObjectDataPtr getObjectData(NamedObjectType p_type, ObjectLocalName p_localName);
-
-private:
- explicit ShareGroup(GlobalNameSpace *globalNameSpace);
-
-private:
- emugl::Mutex m_lock;
- NameSpace *m_nameSpace[NUM_OBJECT_TYPES];
- void *m_objectsData = nullptr;
-};
-
-typedef emugl::SmartPtr<ShareGroup> ShareGroupPtr;
-typedef std::multimap<void *, ShareGroupPtr> ShareGroupsMap;
-
-//
-// ObjectNameManager -
-// This class manages the set of all ShareGroups instances,
-// each ShareGroup instance can be accessed through one or more 'groupName'
-// values. the type of 'groupName' is void *, the intent is that the EGL
-// layer will use the user context handle as the name for its ShareGroup
-// object. Multiple names can be attached to a ShareGroup object to support
-// user context sharing.
-//
-class ObjectNameManager
-{
-public:
- explicit ObjectNameManager(GlobalNameSpace *globalNameSpace);
-
- //
- // createShareGroup - create a new ShareGroup object and attach it with
- // the "name" specified by p_groupName.
- //
- ShareGroupPtr createShareGroup(void *p_groupName);
-
- //
- // attachShareGroup - find the ShareGroup object attached to the name
- // specified in p_existingGroupName and attach p_groupName to the same
- // ShareGroup instance.
- //
- ShareGroupPtr attachShareGroup(void *p_groupName, void *p_existingGroupName);
-
- //
- // getShareGroup - retreive a ShareGroup object based on its "name"
- //
- ShareGroupPtr getShareGroup(void *p_groupName);
-
- //
- // deleteShareGroup - deletes the attachment of the p_groupName to its
- // attached ShareGroup. When the last name of ShareGroup is
- // deleted the ShareGroup object is destroyed.
- //
- void deleteShareGroup(void *p_groupName);
-
- //
- // getGlobalContext() - this function returns a name of an existing
- // ShareGroup. The intent is that the EGL layer will
- // use that function to get the GL context which each
- // new context needs to share with.
- //
- void *getGlobalContext();
-
-private:
- ShareGroupsMap m_groups;
- emugl::Mutex m_lock;
- GlobalNameSpace *m_globalNameSpace = nullptr;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/Translator/include/KHR/khrplatform.h b/distrib/android-emugl/host/libs/Translator/include/KHR/khrplatform.h
deleted file mode 100644
index c9e6f17d3..000000000
--- a/distrib/android-emugl/host/libs/Translator/include/KHR/khrplatform.h
+++ /dev/null
@@ -1,282 +0,0 @@
-#ifndef __khrplatform_h_
-#define __khrplatform_h_
-
-/*
-** Copyright (c) 2008-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.
-*/
-
-/* Khronos platform-specific types and definitions.
- *
- * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
- *
- * Adopters may modify this file to suit their platform. Adopters are
- * encouraged to submit platform specific 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
- * "Khronos (general)" component "Registry".
- *
- * A predefined template which fills in some of the bug fields can be
- * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
- * must create a Bugzilla login first.
- *
- *
- * See the Implementer's Guidelines for information about where this file
- * should be located on your system and for more details of its use:
- * http://www.khronos.org/registry/implementers_guide.pdf
- *
- * This file should be included as
- * #include <KHR/khrplatform.h>
- * by Khronos client API header files that use its types and defines.
- *
- * The types in khrplatform.h should only be used to define API-specific types.
- *
- * Types defined in khrplatform.h:
- * khronos_int8_t signed 8 bit
- * khronos_uint8_t unsigned 8 bit
- * khronos_int16_t signed 16 bit
- * khronos_uint16_t unsigned 16 bit
- * khronos_int32_t signed 32 bit
- * khronos_uint32_t unsigned 32 bit
- * khronos_int64_t signed 64 bit
- * khronos_uint64_t unsigned 64 bit
- * khronos_intptr_t signed same number of bits as a pointer
- * khronos_uintptr_t unsigned same number of bits as a pointer
- * khronos_ssize_t signed size
- * khronos_usize_t unsigned size
- * khronos_float_t signed 32 bit floating point
- * khronos_time_ns_t unsigned 64 bit time in nanoseconds
- * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
- * nanoseconds
- * khronos_stime_nanoseconds_t signed time interval in nanoseconds
- * khronos_boolean_enum_t enumerated boolean type. This should
- * only be used as a base type when a client API's boolean type is
- * an enum. Client APIs which use an integer or other type for
- * booleans cannot use this as the base type for their boolean.
- *
- * Tokens defined in khrplatform.h:
- *
- * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
- *
- * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
- * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
- *
- * Calling convention macros defined in this file:
- * KHRONOS_APICALL
- * KHRONOS_APIENTRY
- * KHRONOS_APIATTRIBUTES
- *
- * These may be used in function prototypes as:
- *
- * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
- * int arg1,
- * int arg2) KHRONOS_APIATTRIBUTES;
- */
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APICALL
- *-------------------------------------------------------------------------
- * This precedes the return type of the function in the function prototype.
- */
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
-# define KHRONOS_APICALL __declspec(dllimport)
-#elif defined (__SYMBIAN32__)
-# define KHRONOS_APICALL IMPORT_C
-#else
-# define KHRONOS_APICALL
-#endif
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APIENTRY
- *-------------------------------------------------------------------------
- * This follows the return type of the function and precedes the function
- * name in the function prototype.
- */
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
- /* Win32 but not WinCE */
-# define KHRONOS_APIENTRY __stdcall
-#else
-# define KHRONOS_APIENTRY
-#endif
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APIATTRIBUTES
- *-------------------------------------------------------------------------
- * This follows the closing parenthesis of the function prototype arguments.
- */
-#if defined (__ARMCC_2__)
-#define KHRONOS_APIATTRIBUTES __softfp
-#else
-#define KHRONOS_APIATTRIBUTES
-#endif
-
-/*-------------------------------------------------------------------------
- * basic type definitions
- *-----------------------------------------------------------------------*/
-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
-
-
-/*
- * Using <stdint.h>
- */
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__VMS ) || defined(__sgi)
-
-/*
- * Using <inttypes.h>
- */
-#include <inttypes.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
-
-/*
- * Win32
- */
-typedef __int32 khronos_int32_t;
-typedef unsigned __int32 khronos_uint32_t;
-typedef __int64 khronos_int64_t;
-typedef unsigned __int64 khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__sun__) || defined(__digital__)
-
-/*
- * Sun or Digital
- */
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#if defined(__arch64__) || defined(_LP64)
-typedef long int khronos_int64_t;
-typedef unsigned long int khronos_uint64_t;
-#else
-typedef long long int khronos_int64_t;
-typedef unsigned long long int khronos_uint64_t;
-#endif /* __arch64__ */
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif 0
-
-/*
- * Hypothetical platform with no float or int64 support
- */
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#define KHRONOS_SUPPORT_INT64 0
-#define KHRONOS_SUPPORT_FLOAT 0
-
-#else
-
-/*
- * Generic fallback
- */
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#endif
-
-
-/*
- * Types that are (so far) the same on all platforms
- */
-typedef signed char khronos_int8_t;
-typedef unsigned char khronos_uint8_t;
-typedef signed short int khronos_int16_t;
-typedef unsigned short int khronos_uint16_t;
-
-/*
- * Types that differ between LLP64 and LP64 architectures - in LLP64,
- * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
- * to be the only LLP64 architecture in current use.
- */
-#ifdef _WIN64
-typedef signed long long int khronos_intptr_t;
-typedef unsigned long long int khronos_uintptr_t;
-typedef signed long long int khronos_ssize_t;
-typedef unsigned long long int khronos_usize_t;
-#else
-typedef signed long int khronos_intptr_t;
-typedef unsigned long int khronos_uintptr_t;
-typedef signed long int khronos_ssize_t;
-typedef unsigned long int khronos_usize_t;
-#endif
-
-#if KHRONOS_SUPPORT_FLOAT
-/*
- * Float type
- */
-typedef float khronos_float_t;
-#endif
-
-#if KHRONOS_SUPPORT_INT64
-/* Time types
- *
- * These types can be used to represent a time interval in nanoseconds or
- * an absolute Unadjusted System Time. Unadjusted System Time is the number
- * of nanoseconds since some arbitrary system event (e.g. since the last
- * time the system booted). The Unadjusted System Time is an unsigned
- * 64 bit value that wraps back to 0 every 584 years. Time intervals
- * may be either signed or unsigned.
- */
-typedef khronos_uint64_t khronos_utime_nanoseconds_t;
-typedef khronos_int64_t khronos_stime_nanoseconds_t;
-#endif
-
-/*
- * Dummy value used to pad enum types to 32 bits.
- */
-#ifndef KHRONOS_MAX_ENUM
-#define KHRONOS_MAX_ENUM 0x7FFFFFFF
-#endif
-
-/*
- * Enumerated boolean type
- *
- * Values other than zero should be considered to be true. Therefore
- * comparisons should not be made against KHRONOS_TRUE.
- */
-typedef enum {
- KHRONOS_FALSE = 0,
- KHRONOS_TRUE = 1,
- KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
-} khronos_boolean_enum_t;
-
-#endif /* __khrplatform_h_ */
diff --git a/distrib/android-emugl/host/libs/libGLES12Translator/gles/gles12_internal_dispatch.h b/distrib/android-emugl/host/libs/libGLES12Translator/gles/gles12_internal_dispatch.h
deleted file mode 100644
index 8cee0a641..000000000
--- a/distrib/android-emugl/host/libs/libGLES12Translator/gles/gles12_internal_dispatch.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* Copyright (C) 2016 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#pragma once
-
-#include "OpenGLESDispatch/gldefs.h"
-#include "OpenGLESDispatch/gles_functions.h"
-#include "OpenGLESDispatch/GLESv1Dispatch.h"
-
-// gles12tr_internal.h is to make it easier to do broad strokes
-// with the functions defined in the GLESv1->2 translator,
-// which is a different set of functions from the standard set of
-// GLESv1 functions in libOpenGLESDispatch.
-#include "OpenGLESDispatch/gles12tr_internal.h"
-
-#include "KHR/khrplatform.h"
-
-// Define function pointer types.
-#define GLES1_DISPATCH_DEFINE_TYPE(return_type,func_name,signature,callargs) \
- typedef return_type (KHRONOS_APIENTRY * func_name ## _t) signature;
-
-LIST_GLES12TR_INTERNAL_FUNCTIONS(GLES1_DISPATCH_DEFINE_TYPE)
-
-struct GLES12TranslatorFuncs {
-#define GLES1_DISPATCH_DECLARE_POINTER(return_type,func_name,signature,callargs) \
- func_name ## _t internal##func_name;
- LIST_GLES12TR_INTERNAL_FUNCTIONS(GLES1_DISPATCH_DECLARE_POINTER)
-};
-
-#undef GLES1_DISPATCH_DECLARE_POINTER
-#undef GLES1_DISPATCH_DEFINE_TYPE
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/Android.mk b/distrib/android-emugl/host/libs/libOpenGLESDispatch/Android.mk
deleted file mode 100644
index fc88a5203..000000000
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-### host library ##########################################
-$(call emugl-begin-static-library,libOpenGLESDispatch)
-$(call emugl-import,libGLESv2_dec libGLESv1_dec)
-
-# use Translator's egl headers
-LOCAL_C_INCLUDES += $(EMUGL_PATH)/host/libs/Translator/include
-LOCAL_C_INCLUDES += $(EMUGL_PATH)/shared
-
-LOCAL_SRC_FILES := EGLDispatch.cpp \
- GLESv2Dispatch.cpp \
- GLESv1Dispatch.cpp
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles12tr_internal.entries b/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles12tr_internal.entries
deleted file mode 100644
index c3cb07988..000000000
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles12tr_internal.entries
+++ /dev/null
@@ -1,327 +0,0 @@
-!gles12tr_internal
-
-# OpenGL functions that are used only internally by the the GLES1->2 translator
-
-%typedef GLvoid* GLvoidptr;
-%typedef const GLubyte* constGLubyte;
-
-void glActiveTexture( GLenum texture);
-void glAlphaFunc( GLenum func, GLclampf ref);
-void glAlphaFuncx( GLenum func, GLclampx ref);
-void glAlphaFuncxOES( GLenum func, GLclampx ref);
-void glAttachShader( GLuint program, GLuint shader);
-void glBindAttribLocation( GLuint program, GLuint index, const GLchar* name);
-void glBindBuffer( GLenum target, GLuint buffer);
-void glBindFramebuffer( GLenum target, GLuint framebuffer);
-void glBindFramebufferOES( GLenum target, GLuint framebuffer);
-void glBindRenderbuffer( GLenum target, GLuint renderbuffer);
-void glBindRenderbufferOES( GLenum target, GLuint renderbuffer);
-void glBindTexture( GLenum target, GLuint texture);
-void glBlendColor( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-void glBlendEquation( GLenum mode);
-void glBlendEquationOES( GLenum mode);
-void glBlendEquationSeparate( GLenum modeRGB, GLenum modeAlpha);
-void glBlendEquationSeparateOES( GLenum modeRGB, GLenum modeAlpha);
-void glBlendFunc( GLenum sfactor, GLenum dfactor);
-void glBlendFuncSeparate( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-void glBlendFuncSeparateOES( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-void glBufferData( GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
-void glBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
-GLenum glCheckFramebufferStatus( GLenum target);
-GLenum glCheckFramebufferStatusOES( GLenum target);
-void glClear( GLbitfield mask);
-void glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-void glClearColorx( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-void glClearColorxOES( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-void glClearDepthf( GLfloat depth);
-void glClearDepthfOES( GLclampf depth);
-void glClearDepthx( GLclampx depth);
-void glClearDepthxOES( GLclampx depth);
-void glClearStencil( GLint s);
-void glClientActiveTexture( GLenum texture);
-void glClipPlanef( GLenum pname, const GLfloat* equation);
-void glClipPlanefOES( GLenum pname, const GLfloat* equation);
-void glClipPlanex( GLenum pname, const GLfixed* equation);
-void glClipPlanexOES( GLenum pname, const GLfixed* equation);
-void glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-void glColor4fv( const GLfloat* components);
-void glColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-void glColor4ubv( const GLubyte* components);
-void glColor4x( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-void glColor4xOES( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-void glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-void glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
-void glColorPointerBounds( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count);
-void glCompileShader( GLuint shader);
-void glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei image_size, const GLvoid* data);
-void glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei image_size, const GLvoid* data);
-void glCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLuint glCreateProgram(void);
-GLuint glCreateShader( GLenum type);
-void glCullFace( GLenum mode);
-void glCurrentPaletteMatrixOES( GLuint index);
-void glDeleteBuffers( GLsizei n, const GLuint* buffers);
-void glDeleteFramebuffers( GLsizei n, const GLuint* framebuffers);
-void glDeleteFramebuffersOES( GLsizei n, const GLuint* framebuffers);
-void glDeleteProgram( GLuint program);
-void glDeleteRenderbuffers( GLsizei n, const GLuint* renderbuffers);
-void glDeleteRenderbuffersOES( GLsizei n, const GLuint* renderbuffers);
-void glDeleteShader( GLuint shader);
-void glDeleteTextures( GLsizei n, const GLuint* textures);
-void glDepthFunc( GLenum func);
-void glDepthMask( GLboolean flag);
-void glDepthRangef( GLfloat zNear, GLfloat zFar);
-void glDepthRangefOES( GLclampf zNear, GLclampf zFar);
-void glDepthRangex( GLclampx zNear, GLclampx zFar);
-void glDepthRangexOES( GLclampx zNear, GLclampx zFar);
-void glDetachShader( GLuint program, GLuint shader);
-void glDisable( GLenum cap);
-void glDisableClientState( GLenum cap);
-void glDisableVertexAttribArray( GLuint index);
-void glDrawArrays( GLenum mode, GLint first, GLsizei count);
-void glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
-void glDrawTexfOES( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-void glDrawTexfvOES( const GLfloat* coords);
-void glDrawTexiOES( GLint x, GLint y, GLint z, GLint width, GLint height);
-void glDrawTexivOES( const GLint* coords);
-void glDrawTexsOES( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-void glDrawTexsvOES( const GLshort* coords);
-void glDrawTexxOES( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-void glDrawTexxvOES( const GLfixed* coords);
-void glEGLImageTargetRenderbufferStorageOES( GLenum target, GLeglImageOES buffer);
-void glEGLImageTargetTexture2DOES( GLenum target, GLeglImageOES buffer);
-void glEnable( GLenum cap);
-void glEnableClientState( GLenum cap);
-void glEnableVertexAttribArray( GLuint index);
-void glFinish(void);
-void glFlush(void);
-void glFogf( GLenum name, GLfloat param);
-void glFogfv( GLenum name, const GLfloat* params);
-void glFogx( GLenum pname, GLfixed param);
-void glFogxOES( GLenum pname, GLfixed param);
-void glFogxv( GLenum pname, const GLfixed* params);
-void glFogxvOES( GLenum pname, const GLfixed* params);
-void glFramebufferRenderbuffer( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-void glFramebufferRenderbufferOES( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-void glFramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-void glFramebufferTexture2DOES( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-void glFrontFace( GLenum mode);
-void glFrustumf( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-void glFrustumfOES( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-void glFrustumx( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void glFrustumxOES( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void glGenBuffers( GLsizei n, GLuint* buffers);
-void glGenFramebuffers( GLsizei n, GLuint* framebuffers);
-void glGenFramebuffersOES( GLsizei n, GLuint* framebuffers);
-void glGenRenderbuffers( GLsizei n, GLuint* renderbuffers);
-void glGenRenderbuffersOES( GLsizei n, GLuint* renderbuffers);
-void glGenTextures( GLsizei n, GLuint* textures);
-void glGenerateMipmap( GLenum target);
-void glGenerateMipmapOES( GLenum target);
-void glGetActiveAttrib( GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-void glGetActiveUniform( GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-void glGetAttachedShaders( GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-GLint glGetAttribLocation( GLuint program, const GLchar* name);
-void glGetBooleanv( GLenum pname, GLboolean* params);
-void glGetBufferParameteriv( GLenum target, GLenum pname, GLint* params);
-void glGetClipPlanef( GLenum pname, GLfloat* eqn);
-void glGetClipPlanefOES( GLenum pname, GLfloat* eqn);
-void glGetClipPlanex( GLenum pname, GLfixed* eqn);
-void glGetClipPlanexOES( GLenum pname, GLfixed* eqn);
-GLenum glGetError(void);
-void glGetFixedv( GLenum pname, GLfixed* params);
-void glGetFixedvOES( GLenum pname, GLfixed* params);
-void glGetFloatv( GLenum pname, GLfloat* params);
-void glGetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint* params);
-void glGetFramebufferAttachmentParameterivOES( GLenum target, GLenum attachment, GLenum pname, GLint* params);
-void glGetIntegerv( GLenum pname, GLint* params);
-void glGetLightfv( GLenum lightid, GLenum name, GLfloat* params);
-void glGetLightxv( GLenum light, GLenum pname, GLfixed* params);
-void glGetLightxvOES( GLenum light, GLenum pname, GLfixed* params);
-void glGetMaterialfv( GLenum face, GLenum name, GLfloat* params);
-void glGetMaterialxv( GLenum face, GLenum pname, GLfixed* params);
-void glGetMaterialxvOES( GLenum face, GLenum pname, GLfixed* params);
-void glGetPointerv( GLenum pname, void** params);
-void glGetProgramInfoLog( GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
-void glGetProgramiv( GLuint program, GLenum pname, GLint* params);
-void glGetRenderbufferParameteriv( GLenum target, GLenum pname, GLint* params);
-void glGetRenderbufferParameterivOES( GLenum target, GLenum pname, GLint* params);
-void glGetShaderInfoLog( GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
-void glGetShaderPrecisionFormat( GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
-void glGetShaderSource( GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
-void glGetShaderiv( GLuint shader, GLenum pname, GLint* params);
-constGLubyte glGetString( GLenum name);
-void glGetTexEnvfv( GLenum env, GLenum pname, GLfloat* params);
-void glGetTexEnviv( GLenum env, GLenum pname, GLint* params);
-void glGetTexEnvxv( GLenum env, GLenum pname, GLfixed* params);
-void glGetTexEnvxvOES( GLenum env, GLenum pname, GLfixed* params);
-void glGetTexParameterfv( GLenum target, GLenum pname, GLfloat* params);
-void glGetTexParameteriv( GLenum target, GLenum pname, GLint* params);
-void glGetTexParameterxv( GLenum target, GLenum pname, GLfixed* params);
-void glGetTexParameterxvOES( GLenum target, GLenum pname, GLfixed* params);
-void glGetUniformfv( GLuint program, GLint location, GLfloat* params);
-void glGetUniformiv( GLuint program, GLint location, GLint* params);
-GLint glGetUniformLocation( GLuint program, const GLchar* name);
-void glGetVertexAttribPointerv( GLuint index, GLenum pname, GLvoid** pointer);
-void glGetVertexAttribfv( GLuint index, GLenum pname, GLfloat* params);
-void glGetVertexAttribiv( GLuint index, GLenum pname, GLint* params);
-void glHint( GLenum target, GLenum mode);
-GLboolean glIsBuffer( GLuint buffer);
-GLboolean glIsEnabled( GLenum cap);
-GLboolean glIsFramebuffer( GLuint framebuffer);
-GLboolean glIsFramebufferOES( GLuint framebuffer);
-GLboolean glIsProgram( GLuint program);
-GLboolean glIsRenderbuffer( GLuint renderbuffer);
-GLboolean glIsRenderbufferOES( GLuint renderbuffer);
-GLboolean glIsShader( GLuint shader);
-GLboolean glIsTexture( GLuint texture);
-void glLightModelf( GLenum name, GLfloat param);
-void glLightModelfv( GLenum name, const GLfloat* params);
-void glLightModelx( GLenum pname, GLfixed param);
-void glLightModelxOES( GLenum pname, GLfixed param);
-void glLightModelxv( GLenum pname, const GLfixed* params);
-void glLightModelxvOES( GLenum pname, const GLfixed* params);
-void glLightf( GLenum lightid, GLenum name, GLfloat param);
-void glLightfv( GLenum lightid, GLenum name, const GLfloat* params);
-void glLightx( GLenum light, GLenum pname, GLfixed param);
-void glLightxOES( GLenum light, GLenum pname, GLfixed param);
-void glLightxv( GLenum light, GLenum pname, const GLfixed* params);
-void glLightxvOES( GLenum light, GLenum pname, const GLfixed* params);
-void glLineWidth( GLfloat width);
-void glLineWidthx( GLfixed width);
-void glLineWidthxOES( GLfixed width);
-void glLinkProgram( GLuint program);
-void glLoadIdentity(void);
-void glLoadMatrixf( const GLfloat* m);
-void glLoadMatrixx( const GLfixed* m);
-void glLoadMatrixxOES( const GLfixed* m);
-void glLoadPaletteFromModelViewMatrixOES(void);
-GLvoidptr glMapTexSubImage2DCHROMIUM( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access);
-void glMaterialf( GLenum face, GLenum name, GLfloat param);
-void glMaterialfv( GLenum face, GLenum name, const GLfloat* params);
-void glMaterialx( GLenum face, GLenum pname, GLfixed param);
-void glMaterialxOES( GLenum face, GLenum pname, GLfixed param);
-void glMaterialxv( GLenum face, GLenum pname, const GLfixed* params);
-void glMaterialxvOES( GLenum face, GLenum pname, const GLfixed* params);
-void glMatrixMode( GLenum mode);
-void glMatrixIndexPointerOES( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
-void glMatrixIndexPointerOESBounds( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count);
-void glMultMatrixf( const GLfloat* m);
-void glMultMatrixx( const GLfixed* m);
-void glMultMatrixxOES( const GLfixed* m);
-void glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz);
-void glNormal3fv( const GLfloat* coords);
-void glNormal3sv( const GLshort* coords);
-void glNormal3x( GLfixed nx, GLfixed ny, GLfixed nz);
-void glNormal3xOES( GLfixed nx, GLfixed ny, GLfixed nz);
-void glNormalPointer( GLenum type, GLsizei stride, const GLvoid* pointer);
-void glNormalPointerBounds( GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count);
-void glOrthof( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat z_near, GLfloat z_far);
-void glOrthofOES( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-void glOrthox( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void glOrthoxOES( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-void glPixelStorei( GLenum pname, GLint param);
-void glPointParameterf( GLenum pname, GLfloat param);
-void glPointParameterfv( GLenum pname, const GLfloat* params);
-void glPointParameterx( GLenum pname, GLfixed param);
-void glPointParameterxOES( GLenum pname, GLfixed param);
-void glPointParameterxv( GLenum pname, const GLfixed* params);
-void glPointParameterxvOES( GLenum pname, const GLfixed* params);
-void glPointSize( GLfloat size);
-void glPointSizex( GLfixed size);
-void glPointSizexOES( GLfixed size);
-void glPointSizePointerOES( GLenum type, GLsizei stride, const GLvoid* pointer);
-void glPointSizePointer( GLenum type, GLsizei stride, const GLvoid* pointer);
-void glPointSizePointerOESBounds( GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count);
-void glPolygonOffset( GLfloat factor, GLfloat units);
-void glPolygonOffsetx( GLfixed factor, GLfixed units);
-void glPolygonOffsetxOES( GLfixed factor, GLfixed units);
-void glPopMatrix(void);
-void glPushMatrix(void);
-void glReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
-void glReleaseShaderCompiler(void);
-void glRenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-void glRenderbufferStorageOES( GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-void glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-void glRotatex( GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-void glRotatexOES( GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-void glSampleCoverage( GLclampf value, GLboolean invert);
-void glSampleCoveragex( GLclampx value, GLboolean invert);
-void glSampleCoveragexOES( GLclampx value, GLboolean invert);
-void glScalef( GLfloat x, GLfloat y, GLfloat z);
-void glScalex( GLfixed x, GLfixed y, GLfixed z);
-void glScalexOES( GLfixed x, GLfixed y, GLfixed z);
-void glScissor( GLint x, GLint y, GLsizei width, GLsizei height);
-void glShadeModel( GLenum mode);
-void glShaderSource( GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
-void glStencilFunc( GLenum func, GLint ref, GLuint mask);
-void glStencilFuncSeparate( GLenum face, GLenum func, GLint ref, GLuint mask);
-void glStencilMask( GLuint mask);
-void glStencilMaskSeparate( GLenum face, GLuint mask);
-void glStencilOp( GLenum sfail, GLenum zfail, GLenum zpass);
-void glStencilOpSeparate( GLenum face, GLenum sfail, GLenum zfail, GLenum zpass);
-void glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
-void glTexCoordPointerBounds( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count);
-void glTexEnvf( GLenum target, GLenum pname, GLfloat param);
-void glTexEnvfv( GLenum target, GLenum pname, const GLfloat* params);
-void glTexEnvi( GLenum target, GLenum pname, GLint param);
-void glTexEnviv( GLenum target, GLenum pname, const GLint* params);
-void glTexEnvx( GLenum target, GLenum pname, GLfixed param);
-void glTexEnvxOES( GLenum target, GLenum pname, GLfixed param);
-void glTexEnvxv( GLenum target, GLenum pname, const GLfixed* params);
-void glTexEnvxvOES( GLenum target, GLenum pname, const GLfixed* params);
-void glTexGeniOES( GLenum coord, GLenum pname, GLint param);
-void glTexGenivOES( GLenum coord, GLenum pname, const GLint* params);
-void glTexGenxOES( GLenum coord, GLenum pname, GLfixed param);
-void glTexGenxvOES( GLenum coord, GLenum pname, const GLfixed* params);
-void glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
-void glTexParameterf( GLenum target, GLenum pname, GLfloat param);
-void glTexParameterfv( GLenum target, GLenum pname, const GLfloat* params);
-void glTexParameteri( GLenum target, GLenum pname, GLint param);
-void glTexParameteriv( GLenum target, GLenum pname, const GLint* params);
-void glTexParameterx( GLenum target, GLenum pname, GLfixed param);
-void glTexParameterxOES( GLenum target, GLenum pname, GLfixed param);
-void glTexParameterxv( GLenum target, GLenum pname, const GLfixed* params);
-void glTexParameterxvOES( GLenum target, GLenum pname, const GLfixed* params);
-void glTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
-void glTranslatef( GLfloat x, GLfloat y, GLfloat z);
-void glTranslatex( GLfixed x, GLfixed y, GLfixed z);
-void glTranslatexOES( GLfixed x, GLfixed y, GLfixed z);
-void glUniform1f( GLint location, GLfloat x);
-void glUniform1fv( GLint location, GLsizei count, const GLfloat* v);
-void glUniform1i( GLint location, GLint x);
-void glUniform1iv( GLint location, GLsizei count, const GLint* v);
-void glUniform2f( GLint location, GLfloat x, GLfloat y);
-void glUniform2fv( GLint location, GLsizei count, const GLfloat* v);
-void glUniform2i( GLint location, GLint x, GLint y);
-void glUniform2iv( GLint location, GLsizei count, const GLint* v);
-void glUniform3f( GLint location, GLfloat x, GLfloat y, GLfloat z);
-void glUniform3fv( GLint location, GLsizei count, const GLfloat* v);
-void glUniform3i( GLint location, GLint x, GLint y, GLint z);
-void glUniform3iv( GLint location, GLsizei count, const GLint* v);
-void glUniform4f( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-void glUniform4fv( GLint location, GLsizei count, const GLfloat* v);
-void glUniform4i( GLint location, GLint x, GLint y, GLint z, GLint w);
-void glUniform4iv( GLint location, GLsizei count, const GLint* v);
-void glUniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-void glUniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-void glUniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-void glUnmapTexSubImage2DCHROMIUM( const GLvoid* mem);
-void glUseProgram( GLuint program);
-void glValidateProgram( GLuint program);
-void glVertexAttrib1f( GLuint indx, GLfloat x);
-void glVertexAttrib1fv( GLuint indx, const GLfloat* values);
-void glVertexAttrib2f( GLuint indx, GLfloat x, GLfloat y);
-void glVertexAttrib2fv( GLuint indx, const GLfloat* values);
-void glVertexAttrib3f( GLuint indx, GLfloat x, GLfloat y, GLfloat z);
-void glVertexAttrib3fv( GLuint indx, const GLfloat* values);
-void glVertexAttrib4f( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-void glVertexAttrib4fv( GLuint indx, const GLfloat* values);
-void glVertexAttribPointer( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
-void glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
-void glVertexPointerBounds( GLint size, GLenum type, GLsizei stride, GLvoid* pointer, GLsizei count);
-void glViewport( GLint x, GLint y, GLsizei width, GLsizei height);
-void glWeightPointerOES( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
-void glWeightPointerOESBounds( GLint size, GLenum type, GLsizei stride, const GLvoid* pointer, GLsizei count);
-
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_only.entries b/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_only.entries
deleted file mode 100644
index 650b6a861..000000000
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_only.entries
+++ /dev/null
@@ -1,65 +0,0 @@
-!gles1_only
-
-# OpenGL functions which are needed ONLY for implementing GLES 1.1
-
-void glAlphaFunc(GLenum func, GLclampf ref);
-void glBegin( GLenum mode );
-void glClientActiveTexture( GLenum texture );
-void glClipPlane(GLenum plane, const GLdouble *equation);
-void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
-void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-void glColor4fv( const GLfloat *v );
-void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-void glColor4ubv( const GLubyte *v );
-void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-void glDisableClientState(GLenum array);
-void glEnableClientState(GLenum array);
-void glEnd(void);
-void glFogf(GLenum pname, GLfloat param);
-void glFogfv(GLenum pname, const GLfloat *params);
-void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-void glGetClipPlane(GLenum plane, GLdouble *equation);
-void glGetDoublev( GLenum pname, GLdouble *params );
-void glGetLightfv(GLenum light, GLenum pname, GLfloat *params);
-void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
-void glGetPointerv(GLenum pname, GLvoid* *params);
-void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
-void glGetTexEnviv(GLenum target, GLenum pname, GLint *params);
-void glLightf(GLenum light, GLenum pname, GLfloat param);
-void glLightfv(GLenum light, GLenum pname, const GLfloat *params);
-void glLightModelf(GLenum pname, GLfloat param);
-void glLightModelfv(GLenum pname, const GLfloat *params);
-void glLoadIdentity(void);
-void glLoadMatrixf(const GLfloat *m);
-void glLogicOp(GLenum opcode);
-void glMaterialf(GLenum face, GLenum pname, GLfloat param);
-void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);
-void glMultiTexCoord2fv( GLenum target, const GLfloat *v );
-void glMultiTexCoord2sv( GLenum target, const GLshort *v );
-void glMultiTexCoord3fv( GLenum target, const GLfloat *v );
-void glMultiTexCoord3sv( GLenum target, const GLshort *v );
-void glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
-void glMultiTexCoord4fv( GLenum target, const GLfloat *v );
-void glMultiTexCoord4sv( GLenum target, const GLshort *v );
-void glMultMatrixf(const GLfloat *m);
-void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
-void glNormal3fv( const GLfloat *v );
-void glNormal3sv( const GLshort *v );
-void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-void glPointParameterf(GLenum param, GLfloat value);
-void glPointParameterfv(GLenum param, const GLfloat *values);
-void glPointSize(GLfloat size);
-void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-void glScalef(GLfloat x, GLfloat y, GLfloat z);
-void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
-void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
-void glMatrixMode(GLenum mode);
-void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
-void glPopMatrix(void);
-void glPushMatrix(void);
-void glShadeModel(GLenum mode);
-void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-void glTexEnvi(GLenum target, GLenum pname, GLint param);
-void glTexEnviv(GLenum target, GLenum pname, const GLint *params);
-void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
-void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_common.entries b/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_common.entries
deleted file mode 100644
index bf3b9ce46..000000000
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_common.entries
+++ /dev/null
@@ -1,74 +0,0 @@
-!gles_common
-
-# Functions common to both GLES 1.x and 2.0
-
-%#include <GLES/gl.h>
-%// Return types must be single words, see GLDispatch.cpp
-%typedef const GLubyte* GLconstubyteptr;
-
-void glActiveTexture( GLenum texture );
-void glBindBuffer(GLenum target, GLuint buffer);
-void glBindTexture(GLenum target, GLuint texture);
-void glBlendFunc(GLenum sfactor, GLenum dfactor);
-void glBlendEquation( GLenum mode );
-void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
-void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
-void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
-void glClear(GLbitfield mask);
-void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-void glClearDepth(GLclampd depth);
-void glClearStencil(GLint s);
-void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-void glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
-void glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
-void glCopyTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-void glCullFace(GLenum mode);
-void glDeleteBuffers(GLsizei n, const GLuint *buffers);
-void glDeleteTextures(GLsizei n, const GLuint *textures);
-void glDepthFunc(GLenum func);
-void glDepthMask(GLboolean flag);
-void glDepthRange(GLclampd zNear, GLclampd zFar);
-void glDisable(GLenum cap);
-void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
-void glEnable(GLenum cap);
-void glFinish(void);
-void glFlush(void);
-void glFrontFace(GLenum mode);
-void glGenBuffers(GLsizei n, GLuint *buffers);
-void glGenTextures(GLsizei n, GLuint *textures);
-void glGetBooleanv(GLenum pname, GLboolean *params);
-void glGetBufferParameteriv(GLenum buffer, GLenum parameter, GLint *value);
-GLenum glGetError(void);
-void glGetFloatv(GLenum pname, GLfloat *params);
-void glGetIntegerv(GLenum pname, GLint *params);
-GLconstubyteptr glGetString(GLenum name);
-void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
-void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
-void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
-void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
-void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
-void glHint(GLenum target, GLenum mode);
-GLboolean glIsBuffer(GLuint buffer);
-GLboolean glIsEnabled(GLenum cap);
-GLboolean glIsTexture(GLuint texture);
-void glLineWidth(GLfloat width);
-void glPolygonOffset(GLfloat factor, GLfloat units);
-void glPixelStorei(GLenum pname, GLint param);
-void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
-void glSampleCoverage( GLclampf value, GLboolean invert );
-void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
-void glStencilFunc(GLenum func, GLint ref, GLuint mask);
-void glStencilMask(GLuint mask);
-void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
-void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-void glTexParameteri(GLenum target, GLenum pname, GLint param);
-void glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
-void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
-void glPushAttrib( GLbitfield mask );
-void glPushClientAttrib( GLbitfield mask );
-void glPopAttrib( void );
-void glPopClientAttrib( void );
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_extensions.entries b/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_extensions.entries
deleted file mode 100644
index 817e8ad41..000000000
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles_extensions.entries
+++ /dev/null
@@ -1,24 +0,0 @@
-!gles_extensions
-
-# Common GLES 1.x / 2.0 extension functions
-GLboolean glIsRenderbufferEXT(GLuint renderbuffer);
-void glBindRenderbufferEXT(GLenum target, GLuint renderbuffer);
-void glDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers);
-void glGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers);
-void glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-void glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params);
-GLboolean glIsFramebufferEXT(GLuint framebuffer);
-void glBindFramebufferEXT(GLenum target, GLuint framebuffer);
-void glDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers);
-void glGenFramebuffersEXT(GLsizei n, GLuint *framebuffers);
-GLenum glCheckFramebufferStatusEXT(GLenum target);
-void glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-void glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-void glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-void glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-void glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params);
-void glGenerateMipmapEXT(GLenum target);
-
-# The following extensions are used by GLESv1Dispatch and GLESv2Dispatch, but not by GLDispatch
-void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
-void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/Android.mk b/distrib/android-emugl/host/libs/libOpenglRender/Android.mk
deleted file mode 100644
index a118bb12b..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/Android.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-host_OS_SRCS :=
-host_common_LDLIBS :=
-
-ifeq ($(BUILD_TARGET_OS),linux)
- host_OS_SRCS = NativeSubWindow_x11.cpp
- host_common_LDLIBS += -lX11 -lrt
-endif
-
-ifeq ($(BUILD_TARGET_OS),darwin)
- host_OS_SRCS = NativeSubWindow_cocoa.m
- host_common_LDLIBS += -Wl,-framework,AppKit
-endif
-
-ifeq ($(BUILD_TARGET_OS),windows)
- host_OS_SRCS = NativeSubWindow_win32.cpp
- host_common_LDLIBS += -lgdi32
-endif
-
-host_common_SRC_FILES := \
- $(host_OS_SRCS) \
- ChannelStream.cpp \
- ColorBuffer.cpp \
- FbConfig.cpp \
- FenceSync.cpp \
- FrameBuffer.cpp \
- ReadBuffer.cpp \
- RenderChannelImpl.cpp \
- RenderContext.cpp \
- RenderControl.cpp \
- RendererImpl.cpp \
- RenderLibImpl.cpp \
- RenderThread.cpp \
- RenderThreadInfo.cpp \
- render_api.cpp \
- RenderWindow.cpp \
- SyncThread.cpp \
- TextureDraw.cpp \
- TextureResize.cpp \
- TimeUtils.cpp \
- WindowSurface.cpp \
-
-### host libOpenglRender #################################################
-$(call emugl-begin-shared-library,lib$(BUILD_TARGET_SUFFIX)OpenglRender)
-
-$(call emugl-import,libGLESv1_dec libGLESv2_dec lib_renderControl_dec libOpenglCodecCommon)
-
-LOCAL_LDLIBS += $(host_common_LDLIBS)
-
-LOCAL_SRC_FILES := $(host_common_SRC_FILES)
-$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/host/include)
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-
-# use Translator's egl/gles headers
-LOCAL_C_INCLUDES += $(EMUGL_PATH)/host/libs/Translator/include
-LOCAL_C_INCLUDES += $(EMUGL_PATH)/host/libs/libOpenGLESDispatch
-
-LOCAL_STATIC_LIBRARIES += libemugl_common
-LOCAL_STATIC_LIBRARIES += libOpenGLESDispatch
-
-LOCAL_SYMBOL_FILE := render_api.entries
-
-$(call emugl-export,CFLAGS,$(EMUGL_USER_CFLAGS))
-
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/ChannelStream.cpp b/distrib/android-emugl/host/libs/libOpenglRender/ChannelStream.cpp
deleted file mode 100644
index 0f402b91e..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/ChannelStream.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#include "ChannelStream.h"
-
-#include "OpenglRender/RenderChannel.h"
-
-#define EMUGL_DEBUG_LEVEL 0
-#include "emugl/common/debug.h"
-
-#include <assert.h>
-#include <memory.h>
-
-namespace emugl {
-
-using IoResult = RenderChannel::IoResult;
-
-ChannelStream::ChannelStream(std::shared_ptr<RenderChannelImpl> channel,
- size_t bufSize)
- : IOStream(bufSize), mChannel(channel) {
- mWriteBuffer.resize_noinit(bufSize);
-}
-
-void* ChannelStream::allocBuffer(size_t minSize) {
- if (mWriteBuffer.size() < minSize) {
- mWriteBuffer.resize_noinit(minSize);
- }
- return mWriteBuffer.data();
-}
-
-int ChannelStream::commitBuffer(size_t size) {
- assert(size <= mWriteBuffer.size());
- if (mWriteBuffer.isAllocated()) {
- mWriteBuffer.resize(size);
- mChannel->writeToGuest(std::move(mWriteBuffer));
- } else {
- mChannel->writeToGuest(
- RenderChannel::Buffer(mWriteBuffer.data(), mWriteBuffer.data() + size));
- }
- return size;
-}
-
-const unsigned char* ChannelStream::readRaw(void* buf, size_t* inout_len) {
- size_t wanted = *inout_len;
- size_t count = 0U;
- auto dst = static_cast<uint8_t*>(buf);
- D("wanted %d bytes", (int)wanted);
- while (count < wanted) {
- if (mReadBufferLeft > 0) {
- size_t avail = std::min<size_t>(wanted - count, mReadBufferLeft);
- memcpy(dst + count,
- mReadBuffer.data() + (mReadBuffer.size() - mReadBufferLeft),
- avail);
- count += avail;
- mReadBufferLeft -= avail;
- continue;
- }
- bool blocking = (count == 0);
- auto result = mChannel->readFromGuest(&mReadBuffer, blocking);
- D("readFromGuest() returned %d, size %d", (int)result, (int)mReadBuffer.size());
- if (result == IoResult::Ok) {
- mReadBufferLeft = mReadBuffer.size();
- continue;
- }
- if (count > 0) { // There is some data to return.
- break;
- }
- // Result can only be IoResult::Error if |count == 0| since |blocking|
- // was true, it cannot be IoResult::TryAgain.
- assert(result == IoResult::Error);
- D("error while trying to read");
- return nullptr;
- }
- *inout_len = count;
- D("read %d bytes", (int)count);
- return (const unsigned char*)buf;
-}
-
-void ChannelStream::forceStop() {
- mChannel->stopFromHost();
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/ChannelStream.h b/distrib/android-emugl/host/libs/libOpenglRender/ChannelStream.h
deleted file mode 100644
index 02b2fe781..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/ChannelStream.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#pragma once
-
-#include "OpenglRender/IOStream.h"
-#include "RenderChannelImpl.h"
-
-#include <memory>
-
-namespace emugl {
-
-// An IOStream instance that can be used by the host RenderThread to
-// wrap a RenderChannelImpl channel.
-class ChannelStream final : public IOStream {
-public:
- ChannelStream(std::shared_ptr<RenderChannelImpl> channel, size_t bufSize);
-
- void forceStop();
-
-protected:
- virtual void* allocBuffer(size_t minSize) override final;
- virtual int commitBuffer(size_t size) override final;
- virtual const unsigned char* readRaw(void* buf, size_t* inout_len)
- override final;
-
-private:
- std::shared_ptr<RenderChannelImpl> mChannel;
- RenderChannel::Buffer mWriteBuffer;
- RenderChannel::Buffer mReadBuffer;
- size_t mReadBufferLeft = 0;
-};
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/ColorBuffer.cpp b/distrib/android-emugl/host/libs/libOpenglRender/ColorBuffer.cpp
deleted file mode 100644
index 01401d3c5..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/ColorBuffer.cpp
+++ /dev/null
@@ -1,366 +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 "ColorBuffer.h"
-
-#include "DispatchTables.h"
-#include "GLcommon/GLutils.h"
-#include "RenderThreadInfo.h"
-#include "TextureDraw.h"
-#include "TextureResize.h"
-
-#include "OpenGLESDispatch/EGLDispatch.h"
-
-#include <stdio.h>
-
-namespace {
-
-// Lazily create and bind a framebuffer object to the current host context.
-// |fbo| is the address of the framebuffer object name.
-// |tex| is the name of a texture that is attached to the framebuffer object
-// on creation only. I.e. all rendering operations will target it.
-// returns true in case of success, false on failure.
-bool bindFbo(GLuint* fbo, GLuint tex) {
- if (*fbo) {
- // fbo already exist - just bind
- s_gles2.glBindFramebuffer(GL_FRAMEBUFFER, *fbo);
- return true;
- }
-
- s_gles2.glGenFramebuffers(1, fbo);
- s_gles2.glBindFramebuffer(GL_FRAMEBUFFER, *fbo);
- s_gles2.glFramebufferTexture2D(GL_FRAMEBUFFER,
- GL_COLOR_ATTACHMENT0_OES,
- GL_TEXTURE_2D, tex, 0);
- GLenum status = s_gles2.glCheckFramebufferStatus(GL_FRAMEBUFFER);
- if (status != GL_FRAMEBUFFER_COMPLETE_OES) {
- ERR("ColorBuffer::bindFbo: FBO not complete: %#x\n", status);
- s_gles2.glBindFramebuffer(GL_FRAMEBUFFER, 0);
- s_gles2.glDeleteFramebuffers(1, fbo);
- *fbo = 0;
- return false;
- }
- return true;
-}
-
-void unbindFbo() {
- s_gles2.glBindFramebuffer(GL_FRAMEBUFFER, 0);
-}
-
-// Helper class to use a ColorBuffer::Helper context.
-// Usage is pretty simple:
-//
-// {
-// ScopedHelperContext context(m_helper);
-// if (!context.isOk()) {
-// return false; // something bad happened.
-// }
-// .... do something ....
-// } // automatically calls m_helper->teardownContext();
-//
-class ScopedHelperContext {
-public:
- ScopedHelperContext(ColorBuffer::Helper* helper) : mHelper(helper) {
- if (!helper->setupContext()) {
- mHelper = NULL;
- }
- }
-
- bool isOk() const { return mHelper != NULL; }
-
- ~ScopedHelperContext() {
- release();
- }
-
- void release() {
- if (mHelper) {
- mHelper->teardownContext();
- mHelper = NULL;
- }
- }
-private:
- ColorBuffer::Helper* mHelper;
-};
-
-} // namespace
-
-// static
-ColorBuffer* ColorBuffer::create(EGLDisplay p_display,
- int p_width,
- int p_height,
- GLenum p_internalFormat,
- bool has_eglimage_texture_2d,
- Helper* helper) {
- GLenum texInternalFormat = 0;
-
- switch (p_internalFormat) {
- case GL_RGB:
- case GL_RGB565_OES:
- texInternalFormat = GL_RGB;
- break;
-
- case GL_RGBA:
- case GL_RGB5_A1_OES:
- case GL_RGBA4_OES:
- texInternalFormat = GL_RGBA;
- break;
-
- default:
- return NULL;
- break;
- }
-
- ScopedHelperContext context(helper);
- if (!context.isOk()) {
- return NULL;
- }
-
- ColorBuffer *cb = new ColorBuffer(p_display, helper);
-
- s_gles2.glGenTextures(1, &cb->m_tex);
- s_gles2.glBindTexture(GL_TEXTURE_2D, cb->m_tex);
-
- int nComp = (texInternalFormat == GL_RGB ? 3 : 4);
-
- char* zBuff = static_cast<char*>(::calloc(nComp * p_width * p_height, 1));
- s_gles2.glTexImage2D(GL_TEXTURE_2D,
- 0,
- texInternalFormat,
- p_width,
- p_height,
- 0,
- texInternalFormat,
- GL_UNSIGNED_BYTE,
- zBuff);
- ::free(zBuff);
-
- s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
- //
- // create another texture for that colorbuffer for blit
- //
- s_gles2.glGenTextures(1, &cb->m_blitTex);
- s_gles2.glBindTexture(GL_TEXTURE_2D, cb->m_blitTex);
- s_gles2.glTexImage2D(GL_TEXTURE_2D,
- 0,
- texInternalFormat,
- p_width,
- p_height,
- 0,
- texInternalFormat,
- GL_UNSIGNED_BYTE,
- NULL);
-
- s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- s_gles2.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
- cb->m_width = p_width;
- cb->m_height = p_height;
- cb->m_internalFormat = texInternalFormat;
-
- if (has_eglimage_texture_2d) {
- cb->m_eglImage = s_egl.eglCreateImageKHR(
- p_display,
- s_egl.eglGetCurrentContext(),
- EGL_GL_TEXTURE_2D_KHR,
- (EGLClientBuffer)SafePointerFromUInt(cb->m_tex),
- NULL);
-
- cb->m_blitEGLImage = s_egl.eglCreateImageKHR(
- p_display,
- s_egl.eglGetCurrentContext(),
- EGL_GL_TEXTURE_2D_KHR,
- (EGLClientBuffer)SafePointerFromUInt(cb->m_blitTex),
- NULL);
- }
-
- cb->m_resizer = new TextureResize(p_width, p_height);
-
- return cb;
-}
-
-ColorBuffer::ColorBuffer(EGLDisplay display, Helper* helper) :
- m_display(display),
- m_helper(helper) {}
-
-ColorBuffer::~ColorBuffer() {
- ScopedHelperContext context(m_helper);
-
- if (m_blitEGLImage) {
- s_egl.eglDestroyImageKHR(m_display, m_blitEGLImage);
- }
- if (m_eglImage) {
- s_egl.eglDestroyImageKHR(m_display, m_eglImage);
- }
-
- if (m_fbo) {
- s_gles2.glDeleteFramebuffers(1, &m_fbo);
- }
-
- GLuint tex[2] = {m_tex, m_blitTex};
- s_gles2.glDeleteTextures(2, tex);
-
- delete m_resizer;
-}
-
-void ColorBuffer::readPixels(int x,
- int y,
- int width,
- int height,
- GLenum p_format,
- GLenum p_type,
- void* pixels) {
- ScopedHelperContext context(m_helper);
- if (!context.isOk()) {
- return;
- }
-
- if (bindFbo(&m_fbo, m_tex)) {
- s_gles2.glReadPixels(x, y, width, height, p_format, p_type, pixels);
- unbindFbo();
- }
-}
-
-void ColorBuffer::subUpdate(int x,
- int y,
- int width,
- int height,
- GLenum p_format,
- GLenum p_type,
- void* pixels) {
- ScopedHelperContext context(m_helper);
- if (!context.isOk()) {
- return;
- }
-
- s_gles2.glBindTexture(GL_TEXTURE_2D, m_tex);
- s_gles2.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- s_gles2.glTexSubImage2D(
- GL_TEXTURE_2D, 0, x, y, width, height, p_format, p_type, pixels);
-}
-
-bool ColorBuffer::blitFromCurrentReadBuffer()
-{
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
- if (!tInfo->currContext.get()) {
- // no Current context
- return false;
- }
-
- // Copy the content of the current read surface into m_blitEGLImage.
- // This is done by creating a temporary texture, bind it to the EGLImage
- // then call glCopyTexSubImage2D().
- GLuint tmpTex;
- GLint currTexBind;
- if (tInfo->currContext->isGL2()) {
- s_gles2.glGetIntegerv(GL_TEXTURE_BINDING_2D, &currTexBind);
- s_gles2.glGenTextures(1,&tmpTex);
- s_gles2.glBindTexture(GL_TEXTURE_2D, tmpTex);
- s_gles2.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_blitEGLImage);
- s_gles2.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0,
- m_width, m_height);
- s_gles2.glDeleteTextures(1, &tmpTex);
- s_gles2.glBindTexture(GL_TEXTURE_2D, currTexBind);
- }
- else {
- s_gles1.glGetIntegerv(GL_TEXTURE_BINDING_2D, &currTexBind);
- s_gles1.glGenTextures(1,&tmpTex);
- s_gles1.glBindTexture(GL_TEXTURE_2D, tmpTex);
- s_gles1.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_blitEGLImage);
- s_gles1.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0,
- m_width, m_height);
- s_gles1.glDeleteTextures(1, &tmpTex);
- s_gles1.glBindTexture(GL_TEXTURE_2D, currTexBind);
- }
-
- ScopedHelperContext context(m_helper);
- if (!context.isOk()) {
- return false;
- }
-
- if (!bindFbo(&m_fbo, m_tex)) {
- return false;
- }
-
- // Save current viewport and match it to the current colorbuffer size.
- GLint vport[4] = { 0, };
- s_gles2.glGetIntegerv(GL_VIEWPORT, vport);
- s_gles2.glViewport(0, 0, m_width, m_height);
-
- // render m_blitTex
- m_helper->getTextureDraw()->draw(m_blitTex, 0., 0, 0);
-
- // Restore previous viewport.
- s_gles2.glViewport(vport[0], vport[1], vport[2], vport[3]);
- unbindFbo();
-
- return true;
-}
-
-bool ColorBuffer::bindToTexture() {
- if (!m_eglImage) {
- return false;
- }
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
- if (!tInfo->currContext.get()) {
- return false;
- }
- if (tInfo->currContext->isGL2()) {
- s_gles2.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_eglImage);
- }
- else {
- s_gles1.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_eglImage);
- }
- return true;
-}
-
-bool ColorBuffer::bindToRenderbuffer() {
- if (!m_eglImage) {
- return false;
- }
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
- if (!tInfo->currContext.get()) {
- return false;
- }
- if (tInfo->currContext->isGL2()) {
- s_gles2.glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER_OES, m_eglImage);
- }
- else {
- s_gles1.glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER_OES, m_eglImage);
- }
- return true;
-}
-
-bool ColorBuffer::post(float rotation, float dx, float dy) {
- // NOTE: Do not call m_helper->setupContext() here!
- return m_helper->getTextureDraw()->draw(m_resizer->update(m_tex), rotation, dx, dy);
-}
-
-void ColorBuffer::readback(unsigned char* img) {
- ScopedHelperContext context(m_helper);
- if (!context.isOk()) {
- return;
- }
- if (bindFbo(&m_fbo, m_tex)) {
- s_gles2.glReadPixels(
- 0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, img);
- unbindFbo();
- }
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/ColorBuffer.h b/distrib/android-emugl/host/libs/libOpenglRender/ColorBuffer.h
deleted file mode 100644
index 37e4f15cb..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/ColorBuffer.h
+++ /dev/null
@@ -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.
-*/
-#ifndef _LIBRENDER_COLORBUFFER_H
-#define _LIBRENDER_COLORBUFFER_H
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include "emugl/common/smart_ptr.h"
-
-#include <memory>
-
-
-class TextureDraw;
-class TextureResize;
-
-// A class used to model a guest color buffer, and used to implement several
-// related things:
-//
-// - Every gralloc native buffer with HW read or write requirements will
-// allocate a host ColorBuffer instance. When gralloc_lock() is called,
-// the guest will use ColorBuffer::readPixels() to read the current content
-// of the buffer. When gralloc_unlock() is later called, it will call
-// ColorBuffer::subUpdate() to send the updated pixels.
-//
-// - Every guest window EGLSurface is implemented by a host PBuffer
-// (see WindowSurface.h) that can have a ColorBuffer instance attached to
-// it (through WindowSurface::attachColorBuffer()). When such an attachment
-// exists, WindowSurface::flushColorBuffer() will copy the PBuffer's
-// pixel data into the ColorBuffer. The latter can then be displayed
-// in the client's UI sub-window with ColorBuffer::post().
-//
-// - Guest EGLImages are implemented as native gralloc buffers too.
-// The guest glEGLImageTargetTexture2DOES() implementations will end up
-// calling ColorBuffer::bindToTexture() to bind the current context's
-// GL_TEXTURE_2D to the buffer. Similarly, the guest versions of
-// glEGLImageTargetRenderbufferStorageOES() will end up calling
-// ColorBuffer::bindToRenderbuffer().
-//
-// This forces the implementation to use a host EGLImage to implement each
-// ColorBuffer.
-//
-// As an additional twist.
-
-class ColorBuffer {
-public:
- // Helper interface class used during ColorBuffer operations. This is
- // introduced to remove coupling from the FrameBuffer class implementation.
- class Helper {
- public:
- Helper() {}
- virtual ~Helper() {}
- virtual bool setupContext() = 0;
- virtual void teardownContext() = 0;
- virtual TextureDraw* getTextureDraw() const = 0;
- };
-
- // Create a new ColorBuffer instance.
- // |p_display| is the host EGLDisplay handle.
- // |p_width| and |p_height| are the buffer's dimensions in pixels.
- // |p_internalFormat| is the internal pixel format to use, valid values
- // are: GL_RGB, GL_RGB565, GL_RGBA, GL_RGB5_A1_OES and GL_RGBA4_OES.
- // Implementation is free to use something else though.
- // |has_eglimage_texture_2d| should be true iff the display supports
- // the EGL_KHR_gl_texture_2D_image extension.
- // Returns NULL on failure.
- static ColorBuffer* create(EGLDisplay p_display,
- int p_width,
- int p_height,
- GLenum p_internalFormat,
- bool has_eglimage_texture_2d,
- Helper* helper);
-
- // Destructor.
- ~ColorBuffer();
-
- // Return ColorBuffer width and height in pixels
- GLuint getWidth() const { return m_width; }
- GLuint getHeight() const { return m_height; }
-
- // Read the ColorBuffer instance's pixel values into host memory.
- void readPixels(int x,
- int y,
- int width,
- int height,
- GLenum p_format,
- GLenum p_type,
- void *pixels);
-
- // Update the ColorBuffer instance's pixel values from host memory.
- void subUpdate(int x,
- int y,
- int width,
- int height,
- GLenum p_format,
- GLenum p_type,
- void *pixels);
-
- // Draw a ColorBuffer instance, i.e. blit it to the current guest
- // framebuffer object / window surface. This doesn't display anything.
- bool draw();
-
- // Post this ColorBuffer to the host native sub-window.
- // |rotation| is the rotation angle in degrees, clockwise in the GL
- // coordinate space.
- bool post(float rotation, float dx, float dy);
-
- // Bind the current context's EGL_TEXTURE_2D texture to this ColorBuffer's
- // EGLImage. This is intended to implement glEGLImageTargetTexture2DOES()
- // for all GLES versions.
- bool bindToTexture();
-
- // Bind the current context's EGL_RENDERBUFFER_OES render buffer to this
- // ColorBuffer's EGLImage. This is intended to implement
- // glEGLImageTargetRenderbufferStorageOES() for all GLES versions.
- bool bindToRenderbuffer();
-
- // Copy the content of the current context's read surface to this
- // ColorBuffer. This is used from WindowSurface::flushColorBuffer().
- // Return true on success, false on failure (e.g. no current context).
- bool blitFromCurrentReadBuffer();
-
- // Read the content of the whole ColorBuffer as 32-bit RGBA pixels.
- // |img| must be a buffer large enough (i.e. width * height * 4).
- void readback(unsigned char* img);
-
-private:
- ColorBuffer(EGLDisplay display, Helper* helper);
-
-private:
- GLuint m_tex = 0;
- GLuint m_blitTex = 0;
- EGLImageKHR m_eglImage = nullptr;
- EGLImageKHR m_blitEGLImage = nullptr;
- GLuint m_width = 0;
- GLuint m_height = 0;
- GLuint m_fbo = 0;
- GLenum m_internalFormat = 0;
- EGLDisplay m_display = nullptr;
- Helper* m_helper = nullptr;
- TextureResize* m_resizer = nullptr;
-};
-
-typedef emugl::SmartPtr<ColorBuffer> ColorBufferPtr;
-
-#endif
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/DispatchTables.h b/distrib/android-emugl/host/libs/libOpenglRender/DispatchTables.h
deleted file mode 100644
index 8094285dd..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/DispatchTables.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-* Copyright (C) 2011-2015 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#pragma once
-
-#include "OpenGLESDispatch/GLESv1Dispatch.h"
-#include "OpenGLESDispatch/GLESv2Dispatch.h"
-
-extern GLESv2Dispatch s_gles2;
-extern GLESv1Dispatch s_gles1;
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/FBConfig.cpp b/distrib/android-emugl/host/libs/libOpenglRender/FBConfig.cpp
deleted file mode 100644
index 08c71e8ba..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/FBConfig.cpp
+++ /dev/null
@@ -1,259 +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 "FBConfig.h"
-#include "FrameBuffer.h"
-#include "EGLDispatch.h"
-#include <stdio.h>
-
-FBConfig **FBConfig::s_fbConfigs = NULL;
-int FBConfig::s_numConfigs = 0;
-
-const GLuint FBConfig::s_configAttribs[] = {
- EGL_DEPTH_SIZE, // must be first - see getDepthSize()
- EGL_STENCIL_SIZE, // must be second - see getStencilSize()
- EGL_RENDERABLE_TYPE,// must be third - see getRenderableType()
- EGL_SURFACE_TYPE, // must be fourth - see getSurfaceType()
- EGL_CONFIG_ID, // must be fifth - see chooseConfig()
- EGL_BUFFER_SIZE,
- EGL_ALPHA_SIZE,
- EGL_BLUE_SIZE,
- EGL_GREEN_SIZE,
- EGL_RED_SIZE,
- EGL_CONFIG_CAVEAT,
- EGL_LEVEL,
- EGL_MAX_PBUFFER_HEIGHT,
- EGL_MAX_PBUFFER_PIXELS,
- EGL_MAX_PBUFFER_WIDTH,
- EGL_NATIVE_RENDERABLE,
- EGL_NATIVE_VISUAL_ID,
- EGL_NATIVE_VISUAL_TYPE,
- EGL_SAMPLES,
- EGL_SAMPLE_BUFFERS,
- EGL_TRANSPARENT_TYPE,
- EGL_TRANSPARENT_BLUE_VALUE,
- EGL_TRANSPARENT_GREEN_VALUE,
- EGL_TRANSPARENT_RED_VALUE,
- EGL_BIND_TO_TEXTURE_RGB,
- EGL_BIND_TO_TEXTURE_RGBA,
- EGL_MIN_SWAP_INTERVAL,
- EGL_MAX_SWAP_INTERVAL,
- EGL_LUMINANCE_SIZE,
- EGL_ALPHA_MASK_SIZE,
- EGL_COLOR_BUFFER_TYPE,
- //EGL_MATCH_NATIVE_PIXMAP,
- EGL_CONFORMANT
-};
-
-const int FBConfig::s_numConfigAttribs = sizeof(FBConfig::s_configAttribs) / sizeof(GLuint);
-
-InitConfigStatus FBConfig::initConfigList(FrameBuffer *fb)
-{
- InitConfigStatus ret = INIT_CONFIG_FAILED;
-
- if (!fb) {
- return ret;
- }
-
- EGLDisplay dpy = fb->getDisplay();
-
- if (dpy == EGL_NO_DISPLAY) {
- fprintf(stderr,"Could not get EGL Display\n");
- return ret;
- }
-
- //
- // Query the set of configs in the EGL backend
- //
- EGLint nConfigs;
- if (!s_egl.eglGetConfigs(dpy, NULL, 0, &nConfigs)) {
- fprintf(stderr, "Could not get number of available configs\n");
- return ret;
- }
- EGLConfig *configs = new EGLConfig[nConfigs];
- s_egl.eglGetConfigs(dpy, configs, nConfigs, &nConfigs);
-
- //
- // copy the config attributes, filter out
- // configs we do not want to support.
- //
- int j = 0;
- s_fbConfigs = new FBConfig*[nConfigs];
- for (int i=0; i<nConfigs; i++) {
-
- //
- // filter out configs which does not support pbuffers.
- // we only support pbuffer configs since we use a pbuffer
- // handle to bind a guest created window object.
- //
- EGLint surfaceType;
- s_egl.eglGetConfigAttrib(dpy, configs[i],
- EGL_SURFACE_TYPE, &surfaceType);
- if (!(surfaceType & EGL_PBUFFER_BIT)) continue;
-
- //
- // Filter out not RGB configs
- //
- EGLint redSize, greenSize, blueSize;
- s_egl.eglGetConfigAttrib(dpy, configs[i], EGL_RED_SIZE, &redSize);
- s_egl.eglGetConfigAttrib(dpy, configs[i], EGL_BLUE_SIZE, &blueSize);
- s_egl.eglGetConfigAttrib(dpy, configs[i], EGL_GREEN_SIZE, &greenSize);
- if (redSize==0 || greenSize==0 || blueSize==0) continue;
-
- s_fbConfigs[j++] = new FBConfig(dpy, configs[i]);
- }
- s_numConfigs = j;
-
- delete[] configs;
-
- return s_numConfigs > 0 ? INIT_CONFIG_PASSED : INIT_CONFIG_FAILED;
-}
-
-const FBConfig *FBConfig::get(int p_config)
-{
- if (p_config >= 0 && p_config < s_numConfigs) {
- return s_fbConfigs[p_config];
- }
- return NULL;
-}
-
-int FBConfig::getNumConfigs()
-{
- return s_numConfigs;
-}
-
-void FBConfig::packConfigsInfo(GLuint *buffer)
-{
- memcpy(buffer, s_configAttribs, s_numConfigAttribs * sizeof(GLuint));
- for (int i=0; i<s_numConfigs; i++) {
- memcpy(buffer+(i+1)*s_numConfigAttribs,
- s_fbConfigs[i]->m_attribValues,
- s_numConfigAttribs * sizeof(GLuint));
- }
-}
-
-int FBConfig::chooseConfig(FrameBuffer *fb, EGLint * attribs, uint32_t * configs, uint32_t configs_size)
-{
- EGLDisplay dpy = fb->getDisplay();
- int ret = 0;
-
- if (dpy == EGL_NO_DISPLAY) {
- fprintf(stderr,"Could not get EGL Display\n");
- return ret;
- }
- //
- // Query the num of configs in the EGL backend
- //
- EGLint nConfigs;
- if (!s_egl.eglGetConfigs(dpy, NULL, 0, &nConfigs)) {
- fprintf(stderr, "Could not get number of available configs\n");
- return ret;
- }
- //
- // Query the max matching configs in the backend
- //
- EGLConfig *matchedConfigs = new EGLConfig[nConfigs];
-
- //
- //Until we have EGLImage implementation, we force pbuf configs
- //
- bool needToAddPbufAttr = true;
- int attribCnt = 0;
- EGLint * attrib_p = attribs;
- if (attribs) {
- while (attrib_p[0] != EGL_NONE) {
- if (attrib_p[0] == EGL_SURFACE_TYPE) {
- attrib_p[1] = EGL_PBUFFER_BIT; //replace whatever was there before
- needToAddPbufAttr = false;
- }
- attrib_p += 2;
- attribCnt += 2;
- }
- }
- EGLint * newAttribs = new EGLint[attribCnt + 1 + ((needToAddPbufAttr) ? 2 : 0)];
- attrib_p = newAttribs;
- if (needToAddPbufAttr) {
- *(attrib_p++) = EGL_SURFACE_TYPE;
- *(attrib_p++) = EGL_PBUFFER_BIT;
- }
- memcpy(attrib_p, attribs, attribCnt*sizeof(EGLint));
- attrib_p += attribCnt;
- *attrib_p = EGL_NONE;
-
-#if 0
- if (newAttribs) {
- EGLint * attrib_p = newAttribs;
- while (attrib_p[0] != EGL_NONE) {
- DBG("attr: 0x%x %d, ", attrib_p[0], attrib_p[1]);
- attrib_p += 2;
- }
- }
-#endif
-
- if (!s_egl.eglChooseConfig(dpy, newAttribs, matchedConfigs, nConfigs, &nConfigs)) {
- nConfigs = 0;
- }
-
- delete[] newAttribs;
-
- //
- // From all matchedConfigs we need only config_size FBConfigs, so we intersect both lists compating the CONFIG_ID attribute
- //
- uint32_t nVerifiedCfgs = 0;
- for (int matchedIdx=0; matchedIdx<nConfigs; matchedIdx++) {
- if ((configs != NULL) && (configs_size > 0) && (nVerifiedCfgs >= configs_size)) break; //We have enouhgt configs
- int sCfgId;
- s_egl.eglGetConfigAttrib(dpy, matchedConfigs[matchedIdx], EGL_CONFIG_ID, &sCfgId);
- for (int fbIdx=0; fbIdx<s_numConfigs; fbIdx++) {
- int dCfgId = s_fbConfigs[fbIdx]->m_attribValues[4]; //CONFIG_ID
- if (sCfgId == dCfgId) {
- //This config matches the requested attributes and filtered into fbConfigs, so we're happy with it
- if (configs && nVerifiedCfgs < configs_size) {
- configs[nVerifiedCfgs] = fbIdx;
- }
- nVerifiedCfgs++;
- break;
- }
- }
- }
-
- delete[] matchedConfigs;
-
- return nVerifiedCfgs;
-}
-
-FBConfig::FBConfig(EGLDisplay p_eglDpy, EGLConfig p_eglCfg)
-{
- m_eglConfig = p_eglCfg;
- m_attribValues = new GLint[s_numConfigAttribs];
- for (int i=0; i<s_numConfigAttribs; i++) {
- m_attribValues[i] = 0;
- s_egl.eglGetConfigAttrib(p_eglDpy, p_eglCfg, s_configAttribs[i], &m_attribValues[i]);
-
- //
- // All exported configs supports android native window rendering
- //
- if (s_configAttribs[i] == EGL_SURFACE_TYPE) {
- m_attribValues[i] |= EGL_WINDOW_BIT;
- }
- }
-}
-
-FBConfig::~FBConfig()
-{
- if (m_attribValues) {
- delete[] m_attribValues;
- }
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/FBConfig.h b/distrib/android-emugl/host/libs/libOpenglRender/FBConfig.h
deleted file mode 100644
index 638854958..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/FBConfig.h
+++ /dev/null
@@ -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.
-*/
-#ifndef _LIBRENDER_FBCONFIG_H
-#define _LIBRENDER_FBCONFIG_H
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-
-class FrameBuffer;
-
-enum InitConfigStatus {
- INIT_CONFIG_FAILED = 0,
- INIT_CONFIG_PASSED = 1
-};
-
-class FBConfig
-{
-public:
- static InitConfigStatus initConfigList(FrameBuffer *fb);
- static const FBConfig *get(int p_config);
- static int getNumConfigs();
- static int getNumAttribs() { return s_numConfigAttribs; }
- static void packConfigsInfo(GLuint *buffer);
- static int chooseConfig(FrameBuffer *fb, EGLint * attribs, uint32_t * configs, uint32_t configs_size);
- ~FBConfig();
-
- EGLConfig getEGLConfig() const { return m_eglConfig; }
- GLuint getDepthSize() const { return (m_attribValues ? m_attribValues[0] : 0); }
- GLuint getStencilSize() const { return (m_attribValues ? m_attribValues[1] : 0); }
- GLuint getRenderableType() const { return (m_attribValues ? m_attribValues[2] : 0); }
- GLuint getSurfaceType() const { return (m_attribValues ? m_attribValues[3] : 0); }
-
-private:
- FBConfig(EGLDisplay p_eglDpy, EGLConfig p_eglCfg);
-
-private:
- static FBConfig **s_fbConfigs;
- static int s_numConfigs;
- static const int s_numConfigAttribs;
- static const GLuint s_configAttribs[];
-
-private:
- EGLConfig m_eglConfig;
- GLint *m_attribValues;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/FenceSync.cpp b/distrib/android-emugl/host/libs/libOpenglRender/FenceSync.cpp
deleted file mode 100644
index 733af8ee5..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/FenceSync.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-* Copyright (C) 2016 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "FenceSync.h"
-
-#include "DispatchTables.h"
-#include "FrameBuffer.h"
-#include "OpenGLESDispatch/EGLDispatch.h"
-#include "RenderThreadInfo.h"
-
-#include "android/base/containers/Lookup.h"
-
-FenceSync::FenceSync(bool hasNativeFence,
- bool destroyWhenSignaled) :
- mDestroyWhenSignaled(destroyWhenSignaled) {
-
- assert(mCount == 1);
- if (hasNativeFence) incRef();
-
- // assumes that there is a valid + current OpenGL context
- assert(RenderThreadInfo::get());
- assert(RenderThreadInfo::get()->currContext.get());
-
- mDisplay = FrameBuffer::getFB()->getDisplay();
- mSync = s_egl.eglCreateSyncKHR(mDisplay,
- EGL_SYNC_FENCE_KHR,
- NULL);
-}
-
-EGLint FenceSync::wait(uint64_t timeout) {
- incRef();
- EGLint wait_res =
- s_egl.eglClientWaitSyncKHR(mDisplay, mSync,
- EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,
- timeout);
- decRef();
- return wait_res;
-}
-
-void FenceSync::signaledNativeFd() {
- if (!decRef() && mDestroyWhenSignaled) {
- decRef();
- }
- // NOTE: Do not use anything like this construction:
- // decRef();
- // if (mDestroyWhenSignaled) ...
- // If the object was originally constructed with
- // mDestroyWhenSignaled == false,
- // the first decRef() will have destroyed this object,
- // which would make subsequent access to
- // |mDestroyWhenSignaled| corrupt memory immediately.
- // Please keep this in mind.
-}
-
-void FenceSync::destroy() {
- s_egl.eglDestroySyncKHR(mDisplay, mSync);
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/FenceSync.h b/distrib/android-emugl/host/libs/libOpenglRender/FenceSync.h
deleted file mode 100644
index 4b277098f..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/FenceSync.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-* Copyright (C) 2016 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#pragma once
-
-#include "android/base/memory/LazyInstance.h"
-#include "android/base/synchronization/Lock.h"
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include <atomic>
-
-// The FenceSync class wraps actual EGLSyncKHR objects
-// and issues calls to eglCreateSyncKHR, eglClientWaitSyncKHR,
-// and eglDestroySyncKHR.
-//
-// The purpose of this class:
-// - We need to track EGL sync objects created by the guest and
-// realized in the host OpenGL driver. They are passed between
-// guest and host all the time.
-// - In particular, we also need to destroy EGL sync objects at
-// the proper time. There are at least 3 issues (referenced below
-// in spec comments):
-// 1 According to spec, we would need to allow concurrent
-// eglClientWaitSyncKHR and eglDestroySyncKHR to all finish
-// properly.
-// 2 If the EGL sync object is of EGL_SYNC_NATIVE_FENCE_ANDROID
-// nature, we cannot mirror the guest's call to eglDestroySyncKHR
-// by calling the same function on the host, because Goldfish
-// sync device can only know when native fence FD's are signaled
-// when a host-side EGL sync object is signaled. Thus, we would
-// need to delete such sync objects after both the guest and
-// the Goldfish sync device are done with them.
-// 3 We sometimes create sync objects that are only seen by
-// the Goldfish OpenGL driver in the guest, such as for
-// implementing eglSwapBuffers() in a way that avoids
-// out of order frames. It is cumbersome to eglDestroySyncKHR
-// those on the guest, as that would require starting up another guest
-// thread and OpenGL context (complete with host connection)
-// to destroy it.
-class FenceSync {
-public:
- // The constructor wraps eglCreateSyncKHR on the host OpenGL driver.
- // |hasNativeFence| specifies whether this sync object
- // is of EGL_SYNC_NATIVE_FENCE_ANDROID nature (2), and
- // |destroyWhenSignaled| specifies whether or not to destroy
- // the sync object when the native fence FD becomes signaled (3).
- FenceSync(bool hasNativeFence,
- bool destroyWhenSignaled);
-
- // wait() wraps eglClientWaitSyncKHR. During such a wait, we need
- // to increment the reference count while the wait is active,
- // in case there is a concurrent call to eglDestroySyncKHR (1).
- EGLint wait(uint64_t timeout);
-
- // signaledNativeFd(): upon when the native fence fd
- // is signaled due to the sync object being signaled,
- // this method does the following:
- // - adjusts the reference count down by 1. There is a corresponding
- // +1 to the count added at the beginning in the constructor,
- // if this fence object is of type EGL_SYNC_NATIVE_FENCE_ANDROID (2).
- // - if |mDestroyWhenSignaled| is true, this method decrements the
- // reference count again to destroy it (3).
- void signaledNativeFd();
-
- // incRef() / decRef() increment/decrement refence counts in order
- // to deal with sync object destruction. This is a simple reference
- // counting implementation that is almost literally the kref() in
- // the Linux kernel.
- //
- // We do not use shared_ptr or anything like that here because
- // we need to explicitly manipulate the reference count in order to
- // satisfy (1,2,3) above.
- void incRef() { assert(mCount > 0); ++mCount; }
- bool decRef() {
- assert(mCount > 0);
- if (mCount == 1 || --mCount == 0) {
- // destroy() here would delay calls to eglDestroySyncKHR
- // in the host driver until all waits have completed,
- // which is a bit different from simply allowing concurrent calls.
- // But, from the guest's perspective, the contract of allowing
- // everything to finish is still fulfilled, and there is
- // no reason to think (theoretically or practically) that
- // is undesirable to destroy the underlying EGL sync object
- // a tiny bit later. We could have put in extra logic to allow
- // concurrent destruction, but this would have made the code
- // undesirably less simple.
- destroy();
- // This delete-then-return seems OK.
- delete this;
- return true;
- }
- return false;
- }
-private:
- bool mDestroyWhenSignaled;
- std::atomic<int> mCount = {1};
-
- // EGL state needed for calling OpenGL sync operations.
- EGLDisplay mDisplay;
- EGLSyncKHR mSync;
-
- // destroy() wraps eglDestroySyncKHR. This is private, because we need
- // careful control of when eglDestroySyncKHR is actually called.
- void destroy();
-};
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/FrameBuffer.cpp b/distrib/android-emugl/host/libs/libOpenglRender/FrameBuffer.cpp
deleted file mode 100644
index f4815d3a9..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/FrameBuffer.cpp
+++ /dev/null
@@ -1,1264 +0,0 @@
-/*
-* Copyright (C) 2011-2015 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "FrameBuffer.h"
-
-#include "DispatchTables.h"
-#include "NativeSubWindow.h"
-#include "RenderThreadInfo.h"
-#include "TimeUtils.h"
-#include "gles2_dec.h"
-
-#include "OpenGLESDispatch/EGLDispatch.h"
-
-#include "emugl/common/logging.h"
-
-#include <stdio.h>
-#include <string.h>
-
-namespace {
-
-// Helper class to call the bind_locked() / unbind_locked() properly.
-class ScopedBind {
-public:
- // Constructor will call bind_locked() on |fb|.
- // Use isValid() to check for errors.
- ScopedBind(FrameBuffer* fb) : mFb(fb) {
- if (!mFb->bind_locked()) {
- mFb = NULL;
- }
- }
-
- // Returns true if contruction bound the framebuffer context properly.
- bool isValid() const { return mFb != NULL; }
-
- // Unbound the framebuffer explictly. This is also called by the
- // destructor.
- void release() {
- if (mFb) {
- mFb->unbind_locked();
- mFb = NULL;
- }
- }
-
- // Destructor will call release().
- ~ScopedBind() {
- release();
- }
-
-private:
- FrameBuffer* mFb;
-};
-
-// Implementation of a ColorBuffer::Helper instance that redirects calls
-// to a FrameBuffer instance.
-class ColorBufferHelper : public ColorBuffer::Helper {
-public:
- ColorBufferHelper(FrameBuffer* fb) : mFb(fb) {}
-
- virtual bool setupContext() {
- return mFb->bind_locked();
- }
-
- virtual void teardownContext() {
- mFb->unbind_locked();
- }
-
- virtual TextureDraw* getTextureDraw() const {
- return mFb->getTextureDraw();
- }
-private:
- FrameBuffer* mFb;
-};
-
-} // namespace
-
-FrameBuffer *FrameBuffer::s_theFrameBuffer = NULL;
-HandleType FrameBuffer::s_nextHandle = 0;
-
-static char* getGLES2ExtensionString(EGLDisplay p_dpy)
-{
- EGLConfig config;
- EGLSurface surface;
-
- static const GLint configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE
- };
-
- int n;
- if (!s_egl.eglChooseConfig(p_dpy, configAttribs,
- &config, 1, &n) || n == 0) {
- ERR("%s: Could not find GLES 2.x config!\n", __FUNCTION__);
- return NULL;
- }
-
- DBG("%s: Found config %p\n", __FUNCTION__, (void*)config);
-
- static const EGLint pbufAttribs[] = {
- EGL_WIDTH, 1,
- EGL_HEIGHT, 1,
- EGL_NONE
- };
-
- surface = s_egl.eglCreatePbufferSurface(p_dpy, config, pbufAttribs);
- if (surface == EGL_NO_SURFACE) {
- ERR("%s: Could not create GLES 2.x Pbuffer!\n", __FUNCTION__);
- return NULL;
- }
-
- static const GLint gles2ContextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
-
- EGLContext ctx = s_egl.eglCreateContext(p_dpy, config,
- EGL_NO_CONTEXT,
- gles2ContextAttribs);
- if (ctx == EGL_NO_CONTEXT) {
- ERR("%s: Could not create GLES 2.x Context!\n", __FUNCTION__);
- s_egl.eglDestroySurface(p_dpy, surface);
- return NULL;
- }
-
- if (!s_egl.eglMakeCurrent(p_dpy, surface, surface, ctx)) {
- ERR("%s: Could not make GLES 2.x context current!\n", __FUNCTION__);
- s_egl.eglDestroySurface(p_dpy, surface);
- s_egl.eglDestroyContext(p_dpy, ctx);
- return NULL;
- }
-
- // the string pointer may become invalid when the context is destroyed
- const char* s = (const char*)s_gles2.glGetString(GL_EXTENSIONS);
- char* extString = strdup(s ? s : "");
-
- // It is rare but some drivers actually fail this...
- if (!s_egl.eglMakeCurrent(p_dpy, NULL, NULL, NULL)) {
- ERR("%s: Could not unbind context. Please try updating graphics card driver!\n", __FUNCTION__);
- free(extString);
- return NULL;
- }
- s_egl.eglDestroyContext(p_dpy, ctx);
- s_egl.eglDestroySurface(p_dpy, surface);
-
- return extString;
-}
-
-void FrameBuffer::finalize(){
- m_colorbuffers.clear();
- if (m_useSubWindow) {
- removeSubWindow();
- }
- m_windows.clear();
- m_contexts.clear();
- s_egl.eglMakeCurrent(m_eglDisplay, NULL, NULL, NULL);
- s_egl.eglDestroyContext(m_eglDisplay, m_eglContext);
- s_egl.eglDestroyContext(m_eglDisplay, m_pbufContext);
- s_egl.eglDestroySurface(m_eglDisplay, m_pbufSurface);
-}
-
-bool FrameBuffer::initialize(int width, int height, bool useSubWindow)
-{
- GL_LOG("FrameBuffer::initialize");
- if (s_theFrameBuffer != NULL) {
- return true;
- }
-
- //
- // allocate space for the FrameBuffer object
- //
- FrameBuffer *fb = new FrameBuffer(width, height, useSubWindow);
- if (!fb) {
- ERR("Failed to create fb\n");
- return false;
- }
-
- //
- // Initialize backend EGL display
- //
- fb->m_eglDisplay = s_egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (fb->m_eglDisplay == EGL_NO_DISPLAY) {
- ERR("Failed to Initialize backend EGL display\n");
- delete fb;
- return false;
- }
-
- GL_LOG("call eglInitialize");
- if (!s_egl.eglInitialize(fb->m_eglDisplay,
- &fb->m_caps.eglMajor,
- &fb->m_caps.eglMinor)) {
- ERR("Failed to eglInitialize\n");
- GL_LOG("Failed to eglInitialize");
- delete fb;
- return false;
- }
-
- DBG("egl: %d %d\n", fb->m_caps.eglMajor, fb->m_caps.eglMinor);
- GL_LOG("egl: %d %d", fb->m_caps.eglMajor, fb->m_caps.eglMinor);
- s_egl.eglBindAPI(EGL_OPENGL_ES_API);
-
- //
- // if GLES2 plugin has loaded - try to make GLES2 context and
- // get GLES2 extension string
- //
- char* gles2Extensions = NULL;
- gles2Extensions = getGLES2ExtensionString(fb->m_eglDisplay);
- if (!gles2Extensions) {
- // Could not create GLES2 context - drop GL2 capability
- ERR("Failed to obtain GLES 2.x extensions string!\n");
- delete fb;
- return false;
- }
-
- //
- // Create EGL context for framebuffer post rendering.
- //
- GLint surfaceType = (useSubWindow ? EGL_WINDOW_BIT : 0) | EGL_PBUFFER_BIT;
- const GLint configAttribs[] = {
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- EGL_SURFACE_TYPE, surfaceType,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE
- };
-
- int n;
- if (!s_egl.eglChooseConfig(fb->m_eglDisplay, configAttribs,
- &fb->m_eglConfig, 1, &n)) {
- ERR("Failed on eglChooseConfig\n");
- free(gles2Extensions);
- delete fb;
- return false;
- }
-
- static const GLint glContextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
-
- GL_LOG("attempting to create egl context");
- fb->m_eglContext = s_egl.eglCreateContext(fb->m_eglDisplay,
- fb->m_eglConfig,
- EGL_NO_CONTEXT,
- glContextAttribs);
- if (fb->m_eglContext == EGL_NO_CONTEXT) {
- ERR("Failed to create context 0x%x\n", s_egl.eglGetError());
- free(gles2Extensions);
- delete fb;
- return false;
- }
-
- GL_LOG("attempting to create egl pbuffer context");
- //
- // Create another context which shares with the eglContext to be used
- // when we bind the pbuffer. That prevent switching drawable binding
- // back and forth on framebuffer context.
- // The main purpose of it is to solve a "blanking" behaviour we see on
- // on Mac platform when switching binded drawable for a context however
- // it is more efficient on other platforms as well.
- //
- fb->m_pbufContext = s_egl.eglCreateContext(fb->m_eglDisplay,
- fb->m_eglConfig,
- fb->m_eglContext,
- glContextAttribs);
- if (fb->m_pbufContext == EGL_NO_CONTEXT) {
- ERR("Failed to create Pbuffer Context 0x%x\n", s_egl.eglGetError());
- free(gles2Extensions);
- delete fb;
- return false;
- }
-
- GL_LOG("context creation successful");
- //
- // create a 1x1 pbuffer surface which will be used for binding
- // the FB context.
- // The FB output will go to a subwindow, if one exist.
- //
- static const EGLint pbufAttribs[] = {
- EGL_WIDTH, 1,
- EGL_HEIGHT, 1,
- EGL_NONE
- };
-
- fb->m_pbufSurface = s_egl.eglCreatePbufferSurface(fb->m_eglDisplay,
- fb->m_eglConfig,
- pbufAttribs);
- if (fb->m_pbufSurface == EGL_NO_SURFACE) {
- ERR("Failed to create pbuf surface for FB 0x%x\n", s_egl.eglGetError());
- free(gles2Extensions);
- delete fb;
- return false;
- }
-
- GL_LOG("attempting to make context current");
- // Make the context current
- ScopedBind bind(fb);
- if (!bind.isValid()) {
- ERR("Failed to make current\n");
- free(gles2Extensions);
- delete fb;
- return false;
- }
- GL_LOG("context-current successful");
-
- //
- // Initilize framebuffer capabilities
- //
- //const char* gles2Extensions = (const char *)s_gles2.glGetString(GL_EXTENSIONS);
- bool has_gl_oes_image = false;
-
-// printf("GLES2 [%s]\n", gles2Extensions);
-
- has_gl_oes_image = true;
-
- if (has_gl_oes_image) {
- has_gl_oes_image &= strstr(gles2Extensions, "GL_OES_EGL_image") != NULL;
- }
- free((void*)gles2Extensions);
- gles2Extensions = NULL;
-
- const char *eglExtensions = s_egl.eglQueryString(fb->m_eglDisplay,
- EGL_EXTENSIONS);
-
- if (eglExtensions && has_gl_oes_image) {
- fb->m_caps.has_eglimage_texture_2d =
- strstr(eglExtensions, "EGL_KHR_gl_texture_2D_image") != NULL;
- fb->m_caps.has_eglimage_renderbuffer =
- strstr(eglExtensions, "EGL_KHR_gl_renderbuffer_image") != NULL;
- }
- else {
- fb->m_caps.has_eglimage_texture_2d = false;
- fb->m_caps.has_eglimage_renderbuffer = false;
- }
-
- //
- // Fail initialization if not all of the following extensions
- // exist:
- // EGL_KHR_gl_texture_2d_image
- // GL_OES_EGL_IMAGE (by both GLES implementations [1 and 2])
- //
- if (!fb->m_caps.has_eglimage_texture_2d) {
- ERR("Failed: Missing egl_image related extension(s)\n");
- bind.release();
- delete fb;
- return false;
- }
-
- GL_LOG("host system has enough extensions");
- //
- // Initialize set of configs
- //
- fb->m_configs = new FbConfigList(fb->m_eglDisplay);
- if (fb->m_configs->empty()) {
- ERR("Failed: Initialize set of configs\n");
- bind.release();
- delete fb;
- return false;
- }
-
- //
- // Check that we have config for each GLES and GLES2
- //
- size_t nConfigs = fb->m_configs->size();
- int nGLConfigs = 0;
- int nGL2Configs = 0;
- for (size_t i = 0; i < nConfigs; ++i) {
- GLint rtype = fb->m_configs->get(i)->getRenderableType();
- if (0 != (rtype & EGL_OPENGL_ES_BIT)) {
- nGLConfigs++;
- }
- if (0 != (rtype & EGL_OPENGL_ES2_BIT)) {
- nGL2Configs++;
- }
- }
-
- //
- // Don't fail initialization if no GLES configs exist
- //
-
- //
- // If no configs at all, exit
- //
- if (nGLConfigs + nGL2Configs == 0) {
- ERR("Failed: No GLES 2.x configs found!\n");
- bind.release();
- delete fb;
- return false;
- }
-
- GL_LOG("There are sufficient EGLconfigs available");
-
- //
- // Cache the GL strings so we don't have to think about threading or
- // current-context when asked for them.
- //
- fb->m_glVendor = (const char*)s_gles2.glGetString(GL_VENDOR);
- fb->m_glRenderer = (const char*)s_gles2.glGetString(GL_RENDERER);
- fb->m_glVersion = (const char*)s_gles2.glGetString(GL_VERSION);
-
- fb->m_textureDraw = new TextureDraw();
- if (!fb->m_textureDraw) {
- ERR("Failed: creation of TextureDraw instance\n");
- bind.release();
- delete fb;
- return false;
- }
-
- // release the FB context
- bind.release();
-
- //
- // Keep the singleton framebuffer pointer
- //
- s_theFrameBuffer = fb;
- GL_LOG("basic EGL initialization successful");
- return true;
-}
-
-FrameBuffer::FrameBuffer(int p_width, int p_height, bool useSubWindow) :
- m_framebufferWidth(p_width),
- m_framebufferHeight(p_height),
- m_windowWidth(p_width),
- m_windowHeight(p_height),
- m_useSubWindow(useSubWindow),
- m_fpsStats(getenv("SHOW_FPS_STATS") != nullptr),
- m_colorBufferHelper(new ColorBufferHelper(this)) {}
-
-FrameBuffer::~FrameBuffer() {
- delete m_textureDraw;
- delete m_configs;
- delete m_colorBufferHelper;
- free(m_fbImage);
-}
-
-void FrameBuffer::setPostCallback(emugl::Renderer::OnPostCallback onPost, void* onPostContext)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
- m_onPost = onPost;
- m_onPostContext = onPostContext;
- if (m_onPost && !m_fbImage) {
- m_fbImage = (unsigned char*)malloc(4 * m_framebufferWidth * m_framebufferHeight);
- if (!m_fbImage) {
- ERR("out of memory, cancelling OnPost callback");
- m_onPost = NULL;
- m_onPostContext = NULL;
- return;
- }
- }
-}
-
-static void subWindowRepaint(void* param) {
- auto fb = static_cast<FrameBuffer*>(param);
- fb->repost();
-}
-
-bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window,
- int wx,
- int wy,
- int ww,
- int wh,
- int fbw,
- int fbh,
- float dpr,
- float zRot) {
- bool success = false;
-
- if (!m_useSubWindow) {
- ERR("%s: Cannot create native sub-window in this configuration\n",
- __FUNCTION__);
- return false;
- }
-
- m_lock.lock();
-
- // If the subwindow doesn't exist, create it with the appropriate dimensions
- if (!m_subWin) {
-
- // Create native subwindow for FB display output
- m_x = wx;
- m_y = wy;
- m_windowWidth = ww;
- m_windowHeight = wh;
-
- m_subWin = createSubWindow(p_window, m_x, m_y,
- m_windowWidth, m_windowHeight, subWindowRepaint, this);
- if (m_subWin) {
- m_nativeWindow = p_window;
-
- // create EGLSurface from the generated subwindow
- m_eglSurface = s_egl.eglCreateWindowSurface(m_eglDisplay,
- m_eglConfig,
- m_subWin,
- NULL);
-
- if (m_eglSurface == EGL_NO_SURFACE) {
- // NOTE: This can typically happen with software-only renderers like OSMesa.
- destroySubWindow(m_subWin);
- m_subWin = (EGLNativeWindowType)0;
- } else {
- m_px = 0;
- m_py = 0;
-
- success = true;
- }
- }
- }
-
- // At this point, if the subwindow doesn't exist, it is because it either couldn't be created
- // in the first place or the EGLSurface couldn't be created.
- if (m_subWin && bindSubwin_locked()) {
-
- // Only attempt to update window geometry if anything has actually changed.
- bool updateSubWindow = !(m_x == wx && m_y == wy &&
- m_windowWidth == ww && m_windowHeight == wh);
-
- // On Mac, since window coordinates are Y-up and not Y-down, the
- // subwindow may not change dimensions, but because the main window
- // did, the subwindow technically needs to be re-positioned. This
- // can happen on rotation, so a change in Z-rotation can be checked
- // for this case. However, this *should not* be done on Windows/Linux,
- // because the functions used to resize a native window on those hosts
- // will block if the shape doesn't actually change, freezing the
- // emulator.
-#if defined(__APPLE__)
- updateSubWindow |= (m_zRot != zRot);
-#endif
- if (updateSubWindow) {
-
- m_x = wx;
- m_y = wy;
- m_windowWidth = ww;
- m_windowHeight = wh;
-
- success = ::moveSubWindow(m_nativeWindow, m_subWin,
- m_x, m_y, m_windowWidth, m_windowHeight);
-
- // Otherwise, ensure that at least viewport parameters are properly updated.
- } else {
- success = true;
- }
-
- if (success) {
- // Subwin creation or movement was successful,
- // update viewport and z rotation and draw
- // the last posted color buffer.
- s_gles2.glViewport(0, 0, fbw * dpr, fbh * dpr);
- m_dpr = dpr;
- m_zRot = zRot;
- if (m_lastPostedColorBuffer) {
- post(m_lastPostedColorBuffer, false);
- } else {
- s_gles2.glClear(GL_COLOR_BUFFER_BIT |
- GL_DEPTH_BUFFER_BIT |
- GL_STENCIL_BUFFER_BIT);
- s_egl.eglSwapBuffers(m_eglDisplay, m_eglSurface);
- }
- }
- unbind_locked();
- }
-
- m_lock.unlock();
- return success;
-}
-
-bool FrameBuffer::removeSubWindow() {
- if (!m_useSubWindow) {
- ERR("%s: Cannot remove native sub-window in this configuration\n",
- __FUNCTION__);
- return false;
- }
- bool removed = false;
- m_lock.lock();
- if (m_subWin) {
- s_egl.eglMakeCurrent(m_eglDisplay, NULL, NULL, NULL);
- s_egl.eglDestroySurface(m_eglDisplay, m_eglSurface);
- destroySubWindow(m_subWin);
-
- m_eglSurface = EGL_NO_SURFACE;
- m_subWin = (EGLNativeWindowType)0;
- removed = true;
- }
- m_lock.unlock();
- return removed;
-}
-
-HandleType FrameBuffer::genHandle()
-{
- HandleType id;
- do {
- id = ++s_nextHandle;
- } while( id == 0 ||
- m_contexts.find(id) != m_contexts.end() ||
- m_windows.find(id) != m_windows.end() );
-
- return id;
-}
-
-HandleType FrameBuffer::createColorBuffer(int p_width, int p_height,
- GLenum p_internalFormat)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
- HandleType ret = 0;
-
- ColorBufferPtr cb(ColorBuffer::create(
- getDisplay(),
- p_width,
- p_height,
- p_internalFormat,
- getCaps().has_eglimage_texture_2d,
- m_colorBufferHelper));
- if (cb.get() != NULL) {
- ret = genHandle();
- m_colorbuffers[ret].cb = cb;
- m_colorbuffers[ret].refcount = 1;
-
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
- uint64_t puid = tInfo->m_puid;
- if (puid) {
- m_procOwnedColorBuffers[puid].insert(ret);
- }
- }
- return ret;
-}
-
-HandleType FrameBuffer::createRenderContext(int p_config, HandleType p_share,
- bool p_isGL2)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
- HandleType ret = 0;
-
- const FbConfig* config = getConfigs()->get(p_config);
- if (!config) {
- return ret;
- }
-
- RenderContextPtr share;
- if (p_share != 0) {
- RenderContextMap::iterator s(m_contexts.find(p_share));
- if (s == m_contexts.end()) {
- return ret;
- }
- share = (*s).second;
- }
- EGLContext sharedContext =
- share.get() ? share->getEGLContext() : EGL_NO_CONTEXT;
-
- RenderContextPtr rctx(RenderContext::create(
- m_eglDisplay, config->getEglConfig(), sharedContext, p_isGL2));
- if (rctx.get() != NULL) {
- ret = genHandle();
- m_contexts[ret] = rctx;
- RenderThreadInfo *tinfo = RenderThreadInfo::get();
- tinfo->m_contextSet.insert(ret);
- }
- return ret;
-}
-
-HandleType FrameBuffer::createWindowSurface(int p_config, int p_width, int p_height)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
-
- HandleType ret = 0;
-
- const FbConfig* config = getConfigs()->get(p_config);
- if (!config) {
- return ret;
- }
-
- WindowSurfacePtr win(WindowSurface::create(
- getDisplay(), config->getEglConfig(), p_width, p_height));
- if (win.get() != NULL) {
- ret = genHandle();
- m_windows[ret] = std::pair<WindowSurfacePtr, HandleType>(win,0);
- RenderThreadInfo *tinfo = RenderThreadInfo::get();
- tinfo->m_windowSet.insert(ret);
- }
-
- return ret;
-}
-
-void FrameBuffer::drainRenderContext()
-{
- emugl::Mutex::AutoLock mutex(m_lock);
- RenderThreadInfo *tinfo = RenderThreadInfo::get();
- if (tinfo->m_contextSet.empty()) return;
- for (std::set<HandleType>::iterator it = tinfo->m_contextSet.begin();
- it != tinfo->m_contextSet.end(); ++it) {
- HandleType contextHandle = *it;
- m_contexts.erase(contextHandle);
- }
- tinfo->m_contextSet.clear();
-}
-
-void FrameBuffer::drainWindowSurface()
-{
- emugl::Mutex::AutoLock mutex(m_lock);
- RenderThreadInfo *tinfo = RenderThreadInfo::get();
- if (tinfo->m_windowSet.empty()) return;
- for (std::set<HandleType>::iterator it = tinfo->m_windowSet.begin();
- it != tinfo->m_windowSet.end(); ++it) {
- HandleType windowHandle = *it;
- if (m_windows.find(windowHandle) != m_windows.end()) {
- HandleType oldColorBufferHandle = m_windows[windowHandle].second;
- if (oldColorBufferHandle) {
- ColorBufferMap::iterator cit(m_colorbuffers.find(oldColorBufferHandle));
- if (cit != m_colorbuffers.end()) {
- if (--(*cit).second.refcount == 0) { m_colorbuffers.erase(cit); }
- }
- }
- m_windows.erase(windowHandle);
- }
- }
- tinfo->m_windowSet.clear();
-}
-
-void FrameBuffer::DestroyRenderContext(HandleType p_context)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
- m_contexts.erase(p_context);
- RenderThreadInfo *tinfo = RenderThreadInfo::get();
- if (tinfo->m_contextSet.empty()) return;
- tinfo->m_contextSet.erase(p_context);
-}
-
-void FrameBuffer::DestroyWindowSurface(HandleType p_surface)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
- if (m_windows.erase(p_surface) != 0) {
- RenderThreadInfo *tinfo = RenderThreadInfo::get();
- tinfo->m_windowSet.erase(p_surface);
- }
-}
-
-int FrameBuffer::openColorBuffer(HandleType p_colorbuffer) {
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
-
- emugl::Mutex::AutoLock mutex(m_lock);
-
- ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer));
- if (c == m_colorbuffers.end()) {
- // bad colorbuffer handle
- ERR("FB: openColorBuffer cb handle %#x not found\n", p_colorbuffer);
- return -1;
- }
- (*c).second.refcount++;
-
- uint64_t puid = tInfo->m_puid;
- if (puid) {
- m_procOwnedColorBuffers[puid].insert(p_colorbuffer);
- }
- return 0;
-}
-
-void FrameBuffer::closeColorBuffer(HandleType p_colorbuffer) {
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
-
- emugl::Mutex::AutoLock mutex(m_lock);
- closeColorBufferLocked(p_colorbuffer);
- uint64_t puid = tInfo->m_puid;
- if (puid) {
- auto ite = m_procOwnedColorBuffers.find(puid);
- if (ite != m_procOwnedColorBuffers.end()) {
- ite->second.erase(p_colorbuffer);
- }
- }
-}
-
-void FrameBuffer::closeColorBufferLocked(HandleType p_colorbuffer) {
- ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer));
- if (c == m_colorbuffers.end()) {
- // This is harmless: it is normal for guest system to issue
- // closeColorBuffer command when the color buffer is already
- // garbage collected on the host. (we dont have a mechanism
- // to give guest a notice yet)
- return;
- }
- if (--(*c).second.refcount == 0) {
- m_colorbuffers.erase(c);
- }
-}
-
-void FrameBuffer::cleanupProcGLObjects(uint64_t puid) {
- emugl::Mutex::AutoLock mutex(m_lock);
- // Clean up color buffers.
- // A color buffer needs to be closed as many times as it is opened by
- // the guest process, to give the correct reference count.
- // (Note that a color buffer can be shared across guest processes.)
- {
- auto procIte = m_procOwnedColorBuffers.find(puid);
- if (procIte != m_procOwnedColorBuffers.end()) {
- for (auto cb: procIte->second) {
- closeColorBufferLocked(cb);
- }
- m_procOwnedColorBuffers.erase(procIte);
- }
- }
-
- // Clean up EGLImage handles
- {
- // Bind context before potentially triggering any gl calls
- ScopedBind bind(this);
- auto procIte = m_procOwnedEGLImages.find(puid);
- if (procIte != m_procOwnedEGLImages.end()) {
- for (auto eglImg : procIte->second) {
- s_egl.eglDestroyImageKHR(m_eglDisplay,
- reinterpret_cast<EGLImageKHR>((HandleType)eglImg));
- }
- m_procOwnedEGLImages.erase(procIte);
- }
- }
-}
-
-bool FrameBuffer::flushWindowSurfaceColorBuffer(HandleType p_surface)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
-
- WindowSurfaceMap::iterator w( m_windows.find(p_surface) );
- if (w == m_windows.end()) {
- ERR("FB::flushWindowSurfaceColorBuffer: window handle %#x not found\n", p_surface);
- // bad surface handle
- return false;
- }
-
- WindowSurface* surface = (*w).second.first.get();
- surface->flushColorBuffer();
-
- return true;
-}
-
-bool FrameBuffer::setWindowSurfaceColorBuffer(HandleType p_surface,
- HandleType p_colorbuffer)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
-
- WindowSurfaceMap::iterator w( m_windows.find(p_surface) );
- if (w == m_windows.end()) {
- // bad surface handle
- ERR("%s: bad window surface handle %#x\n", __FUNCTION__, p_surface);
- return false;
- }
-
- ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) );
- if (c == m_colorbuffers.end()) {
- DBG("%s: bad color buffer handle %#x\n", __FUNCTION__, p_colorbuffer);
- // bad colorbuffer handle
- return false;
- }
-
- (*w).second.first->setColorBuffer((*c).second.cb);
- (*w).second.second = p_colorbuffer;
- return true;
-}
-
-void FrameBuffer::readColorBuffer(HandleType p_colorbuffer,
- int x, int y, int width, int height,
- GLenum format, GLenum type, void *pixels)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
-
- ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) );
- if (c == m_colorbuffers.end()) {
- // bad colorbuffer handle
- return;
- }
-
- (*c).second.cb->readPixels(x, y, width, height, format, type, pixels);
-}
-
-bool FrameBuffer::updateColorBuffer(HandleType p_colorbuffer,
- int x, int y, int width, int height,
- GLenum format, GLenum type, void *pixels)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
-
- ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) );
- if (c == m_colorbuffers.end()) {
- // bad colorbuffer handle
- return false;
- }
-
- (*c).second.cb->subUpdate(x, y, width, height, format, type, pixels);
-
- return true;
-}
-
-bool FrameBuffer::bindColorBufferToTexture(HandleType p_colorbuffer)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
-
- ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) );
- if (c == m_colorbuffers.end()) {
- // bad colorbuffer handle
- return false;
- }
-
- return (*c).second.cb->bindToTexture();
-}
-
-bool FrameBuffer::bindColorBufferToRenderbuffer(HandleType p_colorbuffer)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
-
- ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) );
- if (c == m_colorbuffers.end()) {
- // bad colorbuffer handle
- return false;
- }
-
- return (*c).second.cb->bindToRenderbuffer();
-}
-
-bool FrameBuffer::bindContext(HandleType p_context,
- HandleType p_drawSurface,
- HandleType p_readSurface)
-{
- emugl::Mutex::AutoLock mutex(m_lock);
-
- WindowSurfacePtr draw, read;
- RenderContextPtr ctx;
-
- //
- // if this is not an unbind operation - make sure all handles are good
- //
- if (p_context || p_drawSurface || p_readSurface) {
- RenderContextMap::iterator r( m_contexts.find(p_context) );
- if (r == m_contexts.end()) {
- // bad context handle
- return false;
- }
-
- ctx = (*r).second;
- WindowSurfaceMap::iterator w( m_windows.find(p_drawSurface) );
- if (w == m_windows.end()) {
- // bad surface handle
- return false;
- }
- draw = (*w).second.first;
-
- if (p_readSurface != p_drawSurface) {
- WindowSurfaceMap::iterator w( m_windows.find(p_readSurface) );
- if (w == m_windows.end()) {
- // bad surface handle
- return false;
- }
- read = (*w).second.first;
- }
- else {
- read = draw;
- }
- }
-
- if (!s_egl.eglMakeCurrent(m_eglDisplay,
- draw ? draw->getEGLSurface() : EGL_NO_SURFACE,
- read ? read->getEGLSurface() : EGL_NO_SURFACE,
- ctx ? ctx->getEGLContext() : EGL_NO_CONTEXT)) {
- ERR("eglMakeCurrent failed\n");
- return false;
- }
-
- if (ctx) {
- if (ctx.get()->getEmulatedGLES1Context()) {
- DBG("%s: found emulated gles1 context @ %p\n", __FUNCTION__, ctx.get()->getEmulatedGLES1Context());
- s_gles1.set_current_gles_context(ctx.get()->getEmulatedGLES1Context());
- DBG("%s: set emulated gles1 context current in thread info\n", __FUNCTION__);
-
- if (draw.get() == NULL) {
- DBG("%s: setup make current (null draw surface)\n", __FUNCTION__);
- s_gles1.make_current_setup(0, 0);
- } else {
- DBG("%s: setup make current (draw surface %ux%u)\n", __FUNCTION__, draw->getWidth(), draw->getHeight());
- s_gles1.make_current_setup(draw->getWidth(), draw->getHeight());
- }
- DBG("%s: set up the emulated gles1 context's info\n", __FUNCTION__);
- }
- }
-
- //
- // Bind the surface(s) to the context
- //
- RenderThreadInfo *tinfo = RenderThreadInfo::get();
- WindowSurfacePtr bindDraw, bindRead;
- if (draw.get() == NULL && read.get() == NULL) {
- // Unbind the current read and draw surfaces from the context
- bindDraw = tinfo->currDrawSurf;
- bindRead = tinfo->currReadSurf;
- } else {
- bindDraw = draw;
- bindRead = read;
- }
-
- if (bindDraw.get() != NULL && bindRead.get() != NULL) {
- if (bindDraw.get() != bindRead.get()) {
- bindDraw->bind(ctx, WindowSurface::BIND_DRAW);
- bindRead->bind(ctx, WindowSurface::BIND_READ);
- }
- else {
- bindDraw->bind(ctx, WindowSurface::BIND_READDRAW);
- }
- }
-
- //
- // update thread info with current bound context
- //
- tinfo->currContext = ctx;
- tinfo->currDrawSurf = draw;
- tinfo->currReadSurf = read;
- if (ctx) {
- if (ctx->isGL2()) tinfo->m_gl2Dec.setContextData(&ctx->decoderContextData());
- else tinfo->m_glDec.setContextData(&ctx->decoderContextData());
- }
- else {
- tinfo->m_glDec.setContextData(NULL);
- tinfo->m_gl2Dec.setContextData(NULL);
- }
- return true;
-}
-
-HandleType FrameBuffer::createClientImage(HandleType context, EGLenum target, GLuint buffer)
-{
- RenderContextPtr ctx;
-
- if (context) {
- RenderContextMap::iterator r( m_contexts.find(context) );
- if (r == m_contexts.end()) {
- // bad context handle
- return false;
- }
-
- ctx = (*r).second;
- }
-
- EGLContext eglContext = ctx ? ctx->getEGLContext() : EGL_NO_CONTEXT;
- EGLImageKHR image = s_egl.eglCreateImageKHR(
- m_eglDisplay, eglContext, target,
- reinterpret_cast<EGLClientBuffer>(buffer), NULL);
- HandleType imgHnd = (HandleType)reinterpret_cast<uintptr_t>(image);
-
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
- uint64_t puid = tInfo->m_puid;
- if (puid) {
- emugl::Mutex::AutoLock mutex(m_lock);
- m_procOwnedEGLImages[puid].insert(imgHnd);
- }
- return imgHnd;
-}
-
-EGLBoolean FrameBuffer::destroyClientImage(HandleType image) {
- // eglDestroyImageKHR has its own lock already.
- EGLBoolean ret = s_egl.eglDestroyImageKHR(m_eglDisplay,
- reinterpret_cast<EGLImageKHR>(image));
- if (!ret) return false;
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
- uint64_t puid = tInfo->m_puid;
- if (puid) {
- emugl::Mutex::AutoLock mutex(m_lock);
- m_procOwnedEGLImages[puid].erase(image);
- // We don't explicitly call m_procOwnedEGLImages.erase(puid) when the size
- // reaches 0, since it could go between zero and one many times in the
- // lifetime of a process.
- // It will be cleaned up by cleanupProcGLObjects(puid) when the process is
- // dead.
- }
- return true;
-}
-
-//
-// The framebuffer lock should be held when calling this function !
-//
-bool FrameBuffer::bind_locked()
-{
- EGLContext prevContext = s_egl.eglGetCurrentContext();
- EGLSurface prevReadSurf = s_egl.eglGetCurrentSurface(EGL_READ);
- EGLSurface prevDrawSurf = s_egl.eglGetCurrentSurface(EGL_DRAW);
-
- if (prevContext != m_pbufContext || prevReadSurf != m_pbufSurface
- || prevDrawSurf != m_pbufSurface) {
- if (!s_egl.eglMakeCurrent(m_eglDisplay, m_pbufSurface,
- m_pbufSurface, m_pbufContext)) {
- ERR("eglMakeCurrent failed\n");
- return false;
- }
- } else {
- ERR("Nested %s call detected, should never happen", __func__);
- }
-
- m_prevContext = prevContext;
- m_prevReadSurf = prevReadSurf;
- m_prevDrawSurf = prevDrawSurf;
- return true;
-}
-
-bool FrameBuffer::bindSubwin_locked()
-{
- EGLContext prevContext = s_egl.eglGetCurrentContext();
- EGLSurface prevReadSurf = s_egl.eglGetCurrentSurface(EGL_READ);
- EGLSurface prevDrawSurf = s_egl.eglGetCurrentSurface(EGL_DRAW);
-
- if (prevContext != m_eglContext || prevReadSurf != m_eglSurface
- || prevDrawSurf != m_eglSurface) {
- if (!s_egl.eglMakeCurrent(m_eglDisplay, m_eglSurface,
- m_eglSurface, m_eglContext)) {
- ERR("eglMakeCurrent failed\n");
- return false;
- }
- } else {
- ERR("Nested %s call detected, should never happen", __func__);
- }
-
- //
- // initialize GL state in eglContext if not yet initilaized
- //
- if (!m_eglContextInitialized) {
- m_eglContextInitialized = true;
- }
-
- m_prevContext = prevContext;
- m_prevReadSurf = prevReadSurf;
- m_prevDrawSurf = prevDrawSurf;
- return true;
-}
-
-bool FrameBuffer::unbind_locked()
-{
- EGLContext curContext = s_egl.eglGetCurrentContext();
- EGLSurface curReadSurf = s_egl.eglGetCurrentSurface(EGL_READ);
- EGLSurface curDrawSurf = s_egl.eglGetCurrentSurface(EGL_DRAW);
-
- if (m_prevContext != curContext || m_prevReadSurf != curReadSurf ||
- m_prevDrawSurf != curDrawSurf) {
- if (!s_egl.eglMakeCurrent(m_eglDisplay, m_prevDrawSurf,
- m_prevReadSurf, m_prevContext)) {
- return false;
- }
- }
-
- m_prevContext = EGL_NO_CONTEXT;
- m_prevReadSurf = EGL_NO_SURFACE;
- m_prevDrawSurf = EGL_NO_SURFACE;
- return true;
-}
-
-void FrameBuffer::createTrivialContext(HandleType shared,
- HandleType* contextOut,
- HandleType* surfOut) {
- assert(contextOut);
- assert(surfOut);
-
- *contextOut = createRenderContext(0, shared, true);
- *surfOut = createWindowSurface(0, 1, 1);
-}
-
-bool FrameBuffer::post(HandleType p_colorbuffer, bool needLock)
-{
- if (needLock) {
- m_lock.lock();
- }
- bool ret = false;
-
- ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) );
- if (c == m_colorbuffers.end()) {
- goto EXIT;
- }
-
- m_lastPostedColorBuffer = p_colorbuffer;
-
- if (m_subWin) {
- // bind the subwindow eglSurface
- if (!bindSubwin_locked()) {
- ERR("FrameBuffer::post(): eglMakeCurrent failed\n");
- goto EXIT;
- }
-
- // get the viewport
- GLint vp[4];
- s_gles2.glGetIntegerv(GL_VIEWPORT, vp);
-
- // divide by device pixel ratio because windowing coordinates ignore DPR,
- // but the framebuffer includes DPR
- vp[2] = vp[2] / m_dpr;
- vp[3] = vp[3] / m_dpr;
-
- // find the x and y values at the origin when "fully scrolled"
- // multiply by 2 because the texture goes from -1 to 1, not 0 to 1
- float fx = 2.f * (vp[2] - m_windowWidth) / (float) vp[2];
- float fy = 2.f * (vp[3] - m_windowHeight) / (float) vp[3];
-
- // finally, compute translation values
- float dx = m_px * fx;
- float dy = m_py * fy;
-
- //
- // render the color buffer to the window
- //
- if (m_zRot != 0.0f) {
- s_gles2.glClear(GL_COLOR_BUFFER_BIT);
- }
- ret = (*c).second.cb->post(m_zRot, dx, dy);
- if (ret) {
- s_egl.eglSwapBuffers(m_eglDisplay, m_eglSurface);
- }
-
- // restore previous binding
- unbind_locked();
- } else {
- // If there is no sub-window, don't display anything, the client will
- // rely on m_onPost to get the pixels instead.
- ret = true;
- }
-
- //
- // output FPS statistics
- //
- if (m_fpsStats) {
- long long currTime = GetCurrentTimeMS();
- m_statsNumFrames++;
- if (currTime - m_statsStartTime >= 1000) {
- float dt = (float)(currTime - m_statsStartTime) / 1000.0f;
- printf("FPS: %5.3f\n", (float)m_statsNumFrames / dt);
- m_statsStartTime = currTime;
- m_statsNumFrames = 0;
- }
- }
-
- //
- // Send framebuffer (without FPS overlay) to callback
- //
- if (m_onPost) {
- (*c).second.cb->readback(m_fbImage);
- m_onPost(m_onPostContext,
- m_framebufferWidth,
- m_framebufferHeight,
- -1,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
- m_fbImage);
- }
-
-EXIT:
- if (needLock) {
- m_lock.unlock();
- }
- return ret;
-}
-
-bool FrameBuffer::repost() {
- if (m_lastPostedColorBuffer) {
- return post(m_lastPostedColorBuffer);
- }
- return false;
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/FrameBuffer.h b/distrib/android-emugl/host/libs/libOpenglRender/FrameBuffer.h
deleted file mode 100644
index 3ae38ddae..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/FrameBuffer.h
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
-* Copyright (C) 2011-2015 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#ifndef _LIBRENDER_FRAMEBUFFER_H
-#define _LIBRENDER_FRAMEBUFFER_H
-
-#include "ColorBuffer.h"
-#include "emugl/common/mutex.h"
-#include "FbConfig.h"
-#include "RenderContext.h"
-#include "TextureDraw.h"
-#include "WindowSurface.h"
-
-#include "OpenglRender/render_api.h"
-#include "OpenglRender/Renderer.h"
-
-#include <EGL/egl.h>
-
-#include <unordered_map>
-#include <unordered_set>
-
-#include <stdint.h>
-
-// Type of handles, a.k.a. "object names" in the GL specification.
-// These are integers used to uniquely identify a resource of a given type.
-typedef uint32_t HandleType;
-
-struct ColorBufferRef {
- ColorBufferPtr cb;
- uint32_t refcount; // number of client-side references
-};
-typedef std::unordered_map<HandleType, RenderContextPtr> RenderContextMap;
-typedef std::unordered_map<HandleType, std::pair<WindowSurfacePtr, HandleType> > WindowSurfaceMap;
-
-typedef std::unordered_map<HandleType, ColorBufferRef> ColorBufferMap;
-typedef std::unordered_multiset<HandleType> ColorBufferSet;
-typedef std::unordered_map<uint64_t, ColorBufferSet> ProcOwnedColorBuffers;
-
-typedef std::unordered_set<HandleType> EGLImageSet;
-typedef std::unordered_map<uint64_t, EGLImageSet> ProcOwnedEGLImages;
-
-// A structure used to list the capabilities of the underlying EGL
-// implementation that the FrameBuffer instance depends on.
-// |has_eglimage_texture_2d| is true iff the EGL_KHR_gl_texture_2D_image
-// extension is supported.
-// |has_eglimage_renderbuffer| is true iff the EGL_KHR_gl_renderbuffer_image
-// extension is supported.
-// |eglMajor| and |eglMinor| are the major and minor version numbers of
-// the underlying EGL implementation.
-struct FrameBufferCaps {
- bool has_eglimage_texture_2d;
- bool has_eglimage_renderbuffer;
- EGLint eglMajor;
- EGLint eglMinor;
-};
-
-// The FrameBuffer class holds the global state of the emulation library on
-// top of the underlying EGL/GLES implementation. It should probably be
-// named "Display" instead of "FrameBuffer".
-//
-// There is only one global instance, that can be retrieved with getFB(),
-// and which must be previously setup by calling initialize().
-//
-class FrameBuffer {
-public:
- // Initialize the global instance.
- // |width| and |height| are the dimensions of the emulator GPU display
- // in pixels. |useSubWindow| is true to indicate that the caller
- // will use setupSubWindow() to let EmuGL display the GPU content in its
- // own sub-windows. If false, this means the caller will use
- // setPostCallback() instead to retrieve the content.
- // Returns true on success, false otherwise.
- static bool initialize(int width, int height, bool useSubWindow);
-
- // Setup a sub-window to display the content of the emulated GPU
- // on-top of an existing UI window. |p_window| is the platform-specific
- // parent window handle. |wx|, |wy|, |ww| and |wh| are the
- // dimensions in pixels of the sub-window, relative to the parent window's
- // coordinate. |fbw| and |fbh| are the dimensions used to initialize
- // the framebuffer, which may be different from the dimensions of the
- // sub-window (in which case scaling will be applied automatically).
- // |dpr| is the device pixel ratio of the monitor, which is needed for
- // proper panning on high-density displays (like retina)
- // |zRot| is a rotation angle in degrees, (clockwise in the Y-upwards GL
- // coordinate space).
- //
- // If a sub-window already exists, this function updates the subwindow
- // and framebuffer properties to match the given values.
- //
- // Return true on success, false otherwise.
- //
- // NOTE: This can return false for software-only EGL engines like OSMesa.
- bool setupSubWindow(FBNativeWindowType p_window,
- int wx, int wy,
- int ww, int wh,
- int fbw, int fbh, float dpr, float zRot);
-
- // Remove the sub-window created by setupSubWindow(), if any.
- // Return true on success, false otherwise.
- bool removeSubWindow();
-
- // Finalize the instance.
- void finalize();
-
- // Return a pointer to the global instance. initialize() must be called
- // previously, or this will return NULL.
- static FrameBuffer *getFB() { return s_theFrameBuffer; }
-
- // Return the capabilities of the underlying display.
- const FrameBufferCaps &getCaps() const { return m_caps; }
-
- // Return the emulated GPU display width in pixels.
- int getWidth() const { return m_framebufferWidth; }
-
- // Return the emulated GPU display height in pixels.
- int getHeight() const { return m_framebufferHeight; }
-
- // Return the list of configs available from this display.
- const FbConfigList* getConfigs() const { return m_configs; }
-
- // Set a callback that will be called each time the emulated GPU content
- // is updated. This can be relatively slow with host-based GPU emulation,
- // so only do this when you need to.
- void setPostCallback(emugl::Renderer::OnPostCallback onPost, void* onPostContext);
-
- // Retrieve the GL strings of the underlying EGL/GLES implementation.
- // On return, |*vendor|, |*renderer| and |*version| will point to strings
- // that are owned by the instance (and must not be freed by the caller).
- void getGLStrings(const char** vendor,
- const char** renderer,
- const char** version) const {
- *vendor = m_glVendor;
- *renderer = m_glRenderer;
- *version = m_glVersion;
- }
-
- // Create a new RenderContext instance for this display instance.
- // |p_config| is the index of one of the configs returned by getConfigs().
- // |p_share| is either EGL_NO_CONTEXT or the handle of a shared context.
- // |p_isGL2| is true to create a GLES 2.x context, or false for a GLES 1.x
- // one.
- // Return a new handle value, which will be 0 in case of error.
- HandleType createRenderContext(
- int p_config, HandleType p_share, bool p_isGL2 = false);
-
- // Create a new WindowSurface instance from this display instance.
- // |p_config| is the index of one of the configs returned by getConfigs().
- // |p_width| and |p_height| are the window dimensions in pixels.
- // Return a new handle value, or 0 in case of error.
- HandleType createWindowSurface(int p_config, int p_width, int p_height);
-
- // Create a new ColorBuffer instance from this display instance.
- // |p_width| and |p_height| are its dimensions in pixels.
- // |p_internalFormat| is the pixel format. See ColorBuffer::create() for
- // list of valid values. Note that ColorBuffer instances are reference-
- // counted. Use openColorBuffer / closeColorBuffer to operate on the
- // internal count.
- HandleType createColorBuffer(
- int p_width, int p_height, GLenum p_internalFormat);
-
- // Call this function when a render thread terminates to destroy all
- // the remaining contexts it created. Necessary to avoid leaking host
- // contexts when a guest application crashes, for example.
- void drainRenderContext();
-
- // Call this function when a render thread terminates to destroy all
- // remaining window surfqce it created. Necessary to avoid leaking
- // host buffers when a guest application crashes, for example.
- void drainWindowSurface();
-
- // Destroy a given RenderContext instance. |p_context| is its handle
- // value as returned by createRenderContext().
- void DestroyRenderContext(HandleType p_context);
-
- // Destroy a given WindowSurface instance. |p_surcace| is its handle
- // value as returned by createWindowSurface().
- void DestroyWindowSurface(HandleType p_surface);
-
- // Increment the reference count associated with a given ColorBuffer
- // instance. |p_colorbuffer| is its handle value as returned by
- // createColorBuffer().
- int openColorBuffer(HandleType p_colorbuffer);
-
- // Decrement the reference count associated with a given ColorBuffer
- // instance. |p_colorbuffer| is its handle value as returned by
- // createColorBuffer(). Note that if the reference count reaches 0,
- // the instance is destroyed automatically.
- void closeColorBuffer(HandleType p_colorbuffer);
- void closeColorBufferLocked(HandleType p_colorbuffer);
-
- void cleanupProcGLObjects(uint64_t puid);
- // Equivalent for eglMakeCurrent() for the current display.
- // |p_context|, |p_drawSurface| and |p_readSurface| are the handle values
- // of the context, the draw surface and the read surface, respectively.
- // Returns true on success, false on failure.
- // Note: if all handle values are 0, this is an unbind operation.
- bool bindContext(HandleType p_context,
- HandleType p_drawSurface,
- HandleType p_readSurface);
-
- // Attach a ColorBuffer to a WindowSurface instance.
- // See the documentation for WindowSurface::setColorBuffer().
- // |p_surface| is the target WindowSurface's handle value.
- // |p_colorbuffer| is the ColorBuffer handle value.
- // Returns true on success, false otherwise.
- bool setWindowSurfaceColorBuffer(
- HandleType p_surface, HandleType p_colorbuffer);
-
- // Copy the content of a WindowSurface's Pbuffer to its attached
- // ColorBuffer. See the documentation for WindowSurface::flushColorBuffer()
- // |p_surface| is the target WindowSurface's handle value.
- // Returns true on success, false on failure.
- bool flushWindowSurfaceColorBuffer(HandleType p_surface);
-
- // Bind the current context's EGL_TEXTURE_2D texture to a ColorBuffer
- // instance's EGLImage. This is intended to implement
- // glEGLImageTargetTexture2DOES() for all GLES versions.
- // |p_colorbuffer| is the ColorBuffer's handle value.
- // Returns true on success, false on failure.
- bool bindColorBufferToTexture(HandleType p_colorbuffer);
-
- // Bind the current context's EGL_RENDERBUFFER_OES render buffer to this
- // ColorBuffer's EGLImage. This is intended to implement
- // glEGLImageTargetRenderbufferStorageOES() for all GLES versions.
- // |p_colorbuffer| is the ColorBuffer's handle value.
- // Returns true on success, false on failure.
- bool bindColorBufferToRenderbuffer(HandleType p_colorbuffer);
-
- // Read the content of a given ColorBuffer into client memory.
- // |p_colorbuffer| is the ColorBuffer's handle value. Similar
- // to glReadPixels(), this can be a slow operation.
- // |x|, |y|, |width| and |height| are the position and dimensions of
- // a rectangle whose pixel values will be transfered to the host.
- // |format| indicates the format of the pixel data, e.g. GL_RGB or GL_RGBA.
- // |type| is the type of pixel data, e.g. GL_UNSIGNED_BYTE.
- // |pixels| is the address of a caller-provided buffer that will be filled
- // with the pixel data.
- void readColorBuffer(HandleType p_colorbuffer,
- int x, int y, int width, int height,
- GLenum format, GLenum type, void *pixels);
-
- // Update the content of a given ColorBuffer from client data.
- // |p_colorbuffer| is the ColorBuffer's handle value. Similar
- // to glReadPixels(), this can be a slow operation.
- // |x|, |y|, |width| and |height| are the position and dimensions of
- // a rectangle whose pixel values will be transfered to the GPU
- // |format| indicates the format of the pixel data, e.g. GL_RGB or GL_RGBA.
- // |type| is the type of pixel data, e.g. GL_UNSIGNED_BYTE.
- // |pixels| is the address of a buffer containing the new pixel data.
- // Returns true on success, false otherwise.
- bool updateColorBuffer(HandleType p_colorbuffer,
- int x, int y, int width, int height,
- GLenum format, GLenum type, void *pixels);
-
- // Display the content of a given ColorBuffer into the framebuffer's
- // sub-window. |p_colorbuffer| is a handle value.
- // |needLock| is used to indicate whether the operation requires
- // acquiring/releasing the FrameBuffer instance's lock. It should be
- // false only when called internally.
- bool post(HandleType p_colorbuffer, bool needLock = true);
-
- // Re-post the last ColorBuffer that was displayed through post().
- // This is useful if you detect that the sub-window content needs to
- // be re-displayed for any reason.
- bool repost();
-
- // Return the host EGLDisplay used by this instance.
- EGLDisplay getDisplay() const { return m_eglDisplay; }
-
- // Change the rotation of the displayed GPU sub-window.
- void setDisplayRotation(float zRot) {
- m_zRot = zRot;
- repost();
- }
-
- // Changes what coordinate of this framebuffer will be displayed at the
- // corner of the GPU sub-window. Specifically, |px| and |py| = 0 means
- // align the bottom-left of the framebuffer with the bottom-left of the
- // sub-window, and |px| and |py| = 1 means align the top right of the
- // framebuffer with the top right of the sub-window. Intermediate values
- // interpolate between these states.
- void setDisplayTranslation(float px, float py) {
-
- // Sanity check the values to ensure they are between 0 and 1
- m_px = px > 1 ? 1 : (px < 0 ? 0 : px);
- m_py = py > 1 ? 1 : (py < 0 ? 0 : py);
- repost();
- }
-
- // Return a TextureDraw instance that can be used with this surfaces
- // and windows created by this instance.
- TextureDraw* getTextureDraw() const { return m_textureDraw; }
-
- // Create an eglImage and return its handle. Reference:
- // https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_image_base.txt
- HandleType createClientImage(HandleType context, EGLenum target, GLuint buffer);
- // Call the implementation of eglDestroyImageKHR, return if succeeds or
- // not. Reference:
- // https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_image_base.txt
- EGLBoolean destroyClientImage(HandleType image);
-
- // Used internally.
- bool bind_locked();
- bool unbind_locked();
-
- // Used by anyone who wants to create or destroy OpenGL contexts.
- // We need to protect all forms of context creation/destruction.
- // At least Linux OpenGL drivers are not thread-safe in this
- // manner.
- void lockFramebuffer() { m_lock.lock(); }
- void unlockFramebuffer() { m_lock.unlock(); }
-
- // For use with sync threads and otherwise, any time we need a GL context
- // not specifically for drawing, but to obtain certain things about
- // GL state.
- // It can be unsafe / leaky to change the structure of contexts
- // outside the facilities the FrameBuffer class provides.
- void createTrivialContext(HandleType shared,
- HandleType* contextOut,
- HandleType* surfOut);
-
-private:
- FrameBuffer(int p_width, int p_height, bool useSubWindow);
- ~FrameBuffer();
- HandleType genHandle();
-
- bool bindSubwin_locked();
-
-private:
- static FrameBuffer *s_theFrameBuffer;
- static HandleType s_nextHandle;
- int m_x = 0;
- int m_y = 0;
- int m_framebufferWidth = 0;
- int m_framebufferHeight = 0;
- int m_windowWidth = 0;
- int m_windowHeight = 0;
- float m_dpr = 0;
-
- bool m_useSubWindow = false;
- bool m_eglContextInitialized = false;
-
- bool m_fpsStats = false;
- int m_statsNumFrames = 0;
- long long m_statsStartTime = 0;
-
- emugl::Mutex m_lock;
- FbConfigList* m_configs = nullptr;
- FBNativeWindowType m_nativeWindow = 0;
- FrameBufferCaps m_caps = {};
- EGLDisplay m_eglDisplay = nullptr;
- RenderContextMap m_contexts;
- WindowSurfaceMap m_windows;
- ColorBufferMap m_colorbuffers;
- ColorBuffer::Helper* m_colorBufferHelper = nullptr;
-
- EGLSurface m_eglSurface = EGL_NO_SURFACE;
- EGLContext m_eglContext = EGL_NO_CONTEXT;
- EGLSurface m_pbufSurface = EGL_NO_SURFACE;
- EGLContext m_pbufContext = EGL_NO_CONTEXT;
-
- EGLContext m_prevContext = EGL_NO_CONTEXT;
- EGLSurface m_prevReadSurf = EGL_NO_SURFACE;
- EGLSurface m_prevDrawSurf = EGL_NO_SURFACE;
- EGLNativeWindowType m_subWin = {};
- TextureDraw* m_textureDraw = nullptr;
- EGLConfig m_eglConfig = nullptr;
- HandleType m_lastPostedColorBuffer = 0;
- float m_zRot = 0;
- float m_px = 0;
- float m_py = 0;
-
- emugl::Renderer::OnPostCallback m_onPost = nullptr;
- void* m_onPostContext = nullptr;
- unsigned char* m_fbImage = nullptr;
-
- const char* m_glVendor = nullptr;
- const char* m_glRenderer = nullptr;
- const char* m_glVersion = nullptr;
-
- // The host associates color buffers with guest processes for memory
- // cleanup. Guest processes are identified with a host generated unique ID.
- ProcOwnedColorBuffers m_procOwnedColorBuffers;
- ProcOwnedEGLImages m_procOwnedEGLImages;
-};
-#endif
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/NativeLinuxSubWindow.cpp b/distrib/android-emugl/host/libs/libOpenglRender/NativeLinuxSubWindow.cpp
deleted file mode 100644
index 5f7184960..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/NativeLinuxSubWindow.cpp
+++ /dev/null
@@ -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.
-*/
-#include "NativeSubWindow.h"
-
-#include <stdio.h>
-
-static Bool WaitForMapNotify(Display *d, XEvent *e, char *arg)
-{
- if (e->type == MapNotify && e->xmap.window == (Window)arg) {
- return 1;
- }
- return 0;
-}
-
-static Display *s_display = NULL;
-
-EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
- EGLNativeDisplayType* display_out,
- int x, int y,int width, int height){
-
- // The call to this function is protected by a lock
- // in FrameBuffer so it is safe to check and initialize s_display here
- if (!s_display) s_display = XOpenDisplay(NULL);
- *display_out = s_display;
-
- XSetWindowAttributes wa;
- wa.event_mask = StructureNotifyMask;
- Window win = XCreateWindow(*display_out,p_window,x,y, width,height,0,CopyFromParent,CopyFromParent,CopyFromParent,CWEventMask,&wa);
- XMapWindow(*display_out,win);
- XEvent e;
- XIfEvent(*display_out, &e, WaitForMapNotify, (char *)win);
- return win;
-}
-
-void destroySubWindow(EGLNativeDisplayType dis,EGLNativeWindowType win){
- XDestroyWindow(dis, win);
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/NativeMacSubWindow.m b/distrib/android-emugl/host/libs/libOpenglRender/NativeMacSubWindow.m
deleted file mode 100644
index f57f661fb..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/NativeMacSubWindow.m
+++ /dev/null
@@ -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.
-*/
-#include "NativeSubWindow.h"
-#include <Cocoa/Cocoa.h>
-
-/*
- * EmuGLView inherit from NSView and override the isOpaque
- * method to return YES. That prevents drawing of underlying window/view
- * when the view needs to be redrawn.
- */
-@interface EmuGLView : NSView {
-} @end
-
-@implementation EmuGLView
-
- - (BOOL)isOpaque {
- return YES;
- }
-
-@end
-
-
-EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
- EGLNativeDisplayType* display_out,
- int x, int y,int width, int height){
- NSWindow *win = (NSWindow *)p_window;
- if (!win) {
- return NULL;
- }
-
- /* (x,y) assume an upper-left origin, but Cocoa uses a lower-left origin */
- NSRect content_rect = [win contentRectForFrameRect:[win frame]];
- int cocoa_y = (int)content_rect.size.height - (y + height);
- NSRect contentRect = NSMakeRect(x, cocoa_y, width, height);
-
- NSView *glView = [[EmuGLView alloc] initWithFrame:contentRect];
- if (glView) {
- [[win contentView] addSubview:glView];
- [win makeKeyAndOrderFront:nil];
- }
-
- return (EGLNativeWindowType)glView;
-}
-
-void destroySubWindow(EGLNativeDisplayType dis,EGLNativeWindowType win){
- if(win){
- NSView *glView = (NSView *)win;
- [glView removeFromSuperview];
- [glView release];
- }
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/NativeSubWindow.h b/distrib/android-emugl/host/libs/libOpenglRender/NativeSubWindow.h
deleted file mode 100644
index 196597844..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/NativeSubWindow.h
+++ /dev/null
@@ -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 NATIVE_SUB_WINDOW_H
-#define NATIVE_SUB_WINDOW_H
-
-#include <EGL/egl.h>
-#include "libOpenglRender/render_api_platform_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
- EGLNativeDisplayType* display_out,
- int x, int y,int width, int height);
-
-
-void destroySubWindow(EGLNativeDisplayType dis,EGLNativeWindowType win);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/NativeWindowsSubWindow.cpp b/distrib/android-emugl/host/libs/libOpenglRender/NativeWindowsSubWindow.cpp
deleted file mode 100644
index e519b688f..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/NativeWindowsSubWindow.cpp
+++ /dev/null
@@ -1,57 +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 "NativeSubWindow.h"
-#include <stdio.h>
-
-LRESULT CALLBACK myWndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
-{
- return DefWindowProc(hwnd, uMsg, wParam, lParam);
-}
-
-EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
- EGLNativeDisplayType* display_out,
- int x, int y,int width, int height){
- WNDCLASS wc;
- wc.style = CS_OWNDC |CS_HREDRAW |CS_VREDRAW; // redraw if size changes
- wc.lpfnWndProc = myWndProc; // points to window procedure
- wc.cbClsExtra = 0; // no extra class memory
- wc.cbWndExtra = sizeof(void*); // save extra window memory, to store VasWindow instance
- wc.hInstance = NULL; // handle to instance
- wc.hIcon = NULL; // predefined app. icon
- wc.hCursor = NULL;
- wc.hbrBackground = NULL; // no background brush
- wc.lpszMenuName = NULL; // name of menu resource
- wc.lpszClassName = "subWin"; // name of window class
-
- RegisterClass(&wc);
- printf("creating window %d %d %d %d\n",x,y,width,height);
- EGLNativeWindowType ret = CreateWindowEx(
- WS_EX_NOPARENTNOTIFY, // do not bother our parent window
- "subWin",
- "sub",
- WS_CHILD|WS_DISABLED,
- x,y,width,height,
- p_window,
- NULL,
- NULL,
- NULL);
- ShowWindow(ret,SW_SHOW);
- return ret;
-}
-
-void destroySubWindow(EGLNativeDisplayType dis,EGLNativeWindowType win){
- PostMessage(win, WM_CLOSE, 0, 0);
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/ReadBuffer.cpp b/distrib/android-emugl/host/libs/libOpenglRender/ReadBuffer.cpp
deleted file mode 100644
index ead1978a7..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/ReadBuffer.cpp
+++ /dev/null
@@ -1,76 +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 "ReadBuffer.h"
-#include <string.h>
-#include <assert.h>
-#include <limits.h>
-#include "ErrorLog.h"
-
-ReadBuffer::ReadBuffer(size_t bufsize)
-{
- m_size = bufsize;
- m_buf = (unsigned char*)malloc(m_size*sizeof(unsigned char));
- m_validData = 0;
- m_readPtr = m_buf;
-}
-
-ReadBuffer::~ReadBuffer()
-{
- free(m_buf);
-}
-
-int ReadBuffer::getData(IOStream *stream)
-{
- if(stream == NULL)
- return -1;
- if ((m_validData > 0) && (m_readPtr > m_buf)) {
- memmove(m_buf, m_readPtr, m_validData);
- }
- // get fresh data into the buffer;
- size_t len = m_size - m_validData;
- if (len==0) {
- //we need to inc our buffer
- size_t new_size = m_size*2;
- unsigned char* new_buf;
- if (new_size < m_size) { // overflow check
- new_size = INT_MAX;
- }
-
- new_buf = (unsigned char*)realloc(m_buf, new_size);
- if (!new_buf) {
- ERR("Failed to alloc %zu bytes for ReadBuffer\n", new_size);
- return -1;
- }
- m_size = new_size;
- m_buf = new_buf;
- len = m_size - m_validData;
- }
- m_readPtr = m_buf;
-
- const size_t readLen = stream->read(m_buf + m_validData, len);
- if (!readLen) {
- return -1;
- }
-
- m_validData += readLen;
- return readLen;
-}
-
-void ReadBuffer::consume(size_t amount) {
- assert(amount <= m_validData);
- m_validData -= amount;
- m_readPtr += amount;
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/ReadBuffer.h b/distrib/android-emugl/host/libs/libOpenglRender/ReadBuffer.h
deleted file mode 100644
index 1b7a29e0c..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/ReadBuffer.h
+++ /dev/null
@@ -1,32 +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.
-*/
-#pragma once
-#include "OpenglRender/IOStream.h"
-
-class ReadBuffer {
-public:
- explicit ReadBuffer(size_t bufSize);
- ~ReadBuffer();
- int getData(IOStream *stream, int minSize); // get fresh data from the stream
- unsigned char *buf() { return m_readPtr; } // return the next read location
- size_t validData() { return m_validData; } // return the amount of valid data in readptr
- void consume(size_t amount); // notify that 'amount' data has been consumed;
-private:
- unsigned char *m_buf;
- unsigned char *m_readPtr;
- size_t m_size;
- size_t m_validData;
-};
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderChannelImpl.cpp b/distrib/android-emugl/host/libs/libOpenglRender/RenderChannelImpl.cpp
deleted file mode 100644
index db27b41e1..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderChannelImpl.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#include "RenderChannelImpl.h"
-
-#include "android/base/synchronization/Lock.h"
-
-#include <algorithm>
-#include <utility>
-
-#include <assert.h>
-#include <string.h>
-
-namespace emugl {
-
-#define EMUGL_DEBUG_LEVEL 0
-#include "emugl/common/debug.h"
-
-using Buffer = RenderChannel::Buffer;
-using IoResult = RenderChannel::IoResult;
-using State = RenderChannel::State;
-using AutoLock = android::base::AutoLock;
-
-// These constants correspond to the capacities of buffer queues
-// used by each RenderChannelImpl instance. Benchmarking shows that
-// it's important to have a large queue for guest -> host transfers,
-// but a much smaller one works for host -> guest ones.
-static constexpr size_t kGuestToHostQueueCapacity = 1024U;
-static constexpr size_t kHostToGuestQueueCapacity = 16U;
-
-RenderChannelImpl::RenderChannelImpl()
- : mLock(),
- mFromGuest(kGuestToHostQueueCapacity, mLock),
- mToGuest(kHostToGuestQueueCapacity, mLock) {
- updateStateLocked();
-}
-
-void RenderChannelImpl::setEventCallback(EventCallback&& callback) {
- mEventCallback = std::move(callback);
-}
-
-void RenderChannelImpl::setWantedEvents(State state) {
- D("state=%d", (int)state);
- AutoLock lock(mLock);
- mWantedEvents |= state;
- notifyStateChangeLocked();
-}
-
-RenderChannel::State RenderChannelImpl::state() const {
- AutoLock lock(mLock);
- return mState;
-}
-
-IoResult RenderChannelImpl::tryWrite(Buffer&& buffer) {
- D("buffer size=%d", (int)buffer.size());
- AutoLock lock(mLock);
- auto result = mFromGuest.tryPushLocked(std::move(buffer));
- updateStateLocked();
- DD("mFromGuest.tryPushLocked() returned %d, state %d", (int)result,
- (int)mState);
- return result;
-}
-
-IoResult RenderChannelImpl::tryRead(Buffer* buffer) {
- D("enter");
- AutoLock lock(mLock);
- auto result = mToGuest.tryPopLocked(buffer);
- updateStateLocked();
- DD("mToGuest.tryPopLocked() returned %d, buffer size %d, state %d",
- (int)result, (int)buffer->size(), (int)mState);
- return result;
-}
-
-void RenderChannelImpl::stop() {
- D("enter");
- AutoLock lock(mLock);
- mFromGuest.closeLocked();
- mToGuest.closeLocked();
-}
-
-bool RenderChannelImpl::writeToGuest(Buffer&& buffer) {
- D("buffer size=%d", (int)buffer.size());
- AutoLock lock(mLock);
- IoResult result = mToGuest.pushLocked(std::move(buffer));
- updateStateLocked();
- DD("mToGuest.pushLocked() returned %d, state %d", (int)result, (int)mState);
- notifyStateChangeLocked();
- return result == IoResult::Ok;
-}
-
-IoResult RenderChannelImpl::readFromGuest(Buffer* buffer, bool blocking) {
- D("enter");
- AutoLock lock(mLock);
- IoResult result;
- if (blocking) {
- result = mFromGuest.popLocked(buffer);
- } else {
- result = mFromGuest.tryPopLocked(buffer);
- }
- updateStateLocked();
- DD("mFromGuest.%s() return %d, buffer size %d, state %d",
- blocking ? "popLocked" : "tryPopLocked", (int)result,
- (int)buffer->size(), (int)mState);
- notifyStateChangeLocked();
- return result;
-}
-
-void RenderChannelImpl::stopFromHost() {
- D("enter");
-
- AutoLock lock(mLock);
- mFromGuest.closeLocked();
- mToGuest.closeLocked();
- mState |= State::Stopped;
- notifyStateChangeLocked();
-}
-
-void RenderChannelImpl::updateStateLocked() {
- State state = RenderChannel::State::Empty;
-
- if (mToGuest.canPopLocked()) {
- state |= State::CanRead;
- }
- if (mFromGuest.canPushLocked()) {
- state |= State::CanWrite;
- }
- if (mToGuest.isClosedLocked()) {
- state |= State::Stopped;
- }
- mState = state;
-}
-
-void RenderChannelImpl::notifyStateChangeLocked() {
- State available = mState & mWantedEvents;
- if (available != 0) {
- D("callback with %d", (int)available);
- mWantedEvents &= ~mState;
- mEventCallback(available);
- }
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderChannelImpl.h b/distrib/android-emugl/host/libs/libOpenglRender/RenderChannelImpl.h
deleted file mode 100644
index 0d306d196..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderChannelImpl.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#pragma once
-
-#include "OpenglRender/RenderChannel.h"
-#include "BufferQueue.h"
-#include "RendererImpl.h"
-
-namespace emugl {
-
-// Implementation of the RenderChannel interface that connects a guest
-// client thread (really an AndroidPipe implementation) to a host
-// RenderThread instance.
-class RenderChannelImpl final : public RenderChannel {
-public:
- // Default constructor.
- RenderChannelImpl();
-
- /////////////////////////////////////////////////////////////////
- // RenderChannel overriden methods. These are called from the guest
- // client thread.
-
- // Set the event |callback| to be notified when the host changes the
- // state of the channel, according to the event mask provided by
- // setWantedEvents(). Call this function right after creating the
- // instance.
- virtual void setEventCallback(EventCallback&& callback) override final;
-
- // Set the mask of events the guest wants to be notified of from the
- // host thread.
- virtual void setWantedEvents(State state) override final;
-
- // Return the current channel state relative to the guest.
- virtual State state() const override final;
-
- // Try to send a buffer from the guest to the host render thread.
- virtual IoResult tryWrite(Buffer&& buffer) override final;
-
- // Try to read a buffer from the host render thread into the guest.
- virtual IoResult tryRead(Buffer* buffer) override final;
-
- // Close the channel from the guest.
- virtual void stop() override final;
-
- /////////////////////////////////////////////////////////////////
- // These functions are called from the host render thread.
-
- // Send a buffer to the guest, this call is blocking. On success,
- // move |buffer| into the channel and return true. On failure, return
- // false (meaning that the channel was closed).
- bool writeToGuest(Buffer&& buffer);
-
- // Read data from the guest. If |blocking| is true, the call will be
- // blocking. On success, move item into |*buffer| and return true. On
- // failure, return IoResult::Error to indicate the channel was closed,
- // or IoResult::TryAgain to indicate it was empty (this can happen only
- // if |blocking| is false).
- IoResult readFromGuest(Buffer* buffer, bool blocking);
-
- // Close the channel from the host.
- void stopFromHost();
-
-private:
- void updateStateLocked();
- void notifyStateChangeLocked();
-
- EventCallback mEventCallback;
-
- // A single lock to protect the state and the two buffer queues at the
- // same time. NOTE: This needs to appear before the BufferQueue instances.
- mutable android::base::Lock mLock;
- State mState = State::Empty;
- State mWantedEvents = State::Empty;
- BufferQueue mFromGuest;
- BufferQueue mToGuest;
-};
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderContext.cpp b/distrib/android-emugl/host/libs/libOpenglRender/RenderContext.cpp
deleted file mode 100644
index 59faa4be0..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderContext.cpp
+++ /dev/null
@@ -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.
-*/
-#include "RenderContext.h"
-
-#include "OpenGLESDispatch/EGLDispatch.h"
-
-RenderContext* RenderContext::create(EGLDisplay display,
- EGLConfig config,
- EGLContext sharedContext,
- bool isGl2) {
- const EGLint contextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, isGl2 ? 2 : 1,
- EGL_NONE
- };
- EGLContext context = s_egl.eglCreateContext(
- display, config, sharedContext, contextAttribs);
- if (context == EGL_NO_CONTEXT) {
- return NULL;
- }
-
- return new RenderContext(display, context, isGl2);
-}
-
-RenderContext::RenderContext(EGLDisplay display,
- EGLContext context,
- bool isGl2) :
- mDisplay(display),
- mContext(context),
- mIsGl2(isGl2),
- mContextData() {}
-
-RenderContext::~RenderContext() {
- if (mContext != EGL_NO_CONTEXT) {
- s_egl.eglDestroyContext(mDisplay, mContext);
- }
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderContext.h b/distrib/android-emugl/host/libs/libOpenglRender/RenderContext.h
deleted file mode 100644
index 80ac43fe1..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderContext.h
+++ /dev/null
@@ -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 _LIBRENDER_RENDERCONTEXT_H
-#define _LIBRENDER_RENDERCONTEXT_H
-
-#include "emugl/common/smart_ptr.h"
-#include <EGL/egl.h>
-#include "GLDecoderContextData.h"
-
-class RenderContext;
-typedef emugl::SmartPtr<RenderContext> RenderContextPtr;
-
-class RenderContext
-{
-public:
- static RenderContext *create(int p_config, RenderContextPtr p_shareContext,
- bool p_isGL2 = false);
- ~RenderContext();
- int getConfig() const { return m_config; }
-
- EGLContext getEGLContext() const { return m_ctx; }
- bool isGL2() const { return m_isGL2; }
-
- GLDecoderContextData & decoderContextData() { return m_contextData; }
-
-private:
- RenderContext();
-
-private:
- EGLContext m_ctx;
- int m_config;
- bool m_isGL2;
- GLDecoderContextData m_contextData;
-};
-
-#endif
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderControl.cpp b/distrib/android-emugl/host/libs/libOpenglRender/RenderControl.cpp
deleted file mode 100644
index cac803edf..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderControl.cpp
+++ /dev/null
@@ -1,715 +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 "RenderControl.h"
-
-#include "DispatchTables.h"
-#include "FbConfig.h"
-#include "FenceSync.h"
-#include "FrameBuffer.h"
-#include "RenderContext.h"
-#include "RenderThreadInfo.h"
-#include "SyncThread.h"
-#include "ChecksumCalculatorThreadInfo.h"
-#include "OpenGLESDispatch/EGLDispatch.h"
-
-#include "android/utils/debug.h"
-#include "android/base/StringView.h"
-#include "emugl/common/feature_control.h"
-#include "emugl/common/lazy_instance.h"
-#include "emugl/common/sync_device.h"
-#include "emugl/common/thread.h"
-
-#include <atomic>
-#include <inttypes.h>
-#include <string.h>
-
-using android::base::AutoLock;
-using android::base::Lock;
-
-#define DEBUG_GRALLOC_SYNC 0
-#define DEBUG_EGL_SYNC 0
-
-#define RENDERCONTROL_DPRINT(...) do { \
- if (!VERBOSE_CHECK(gles)) { VERBOSE_ENABLE(gles); } \
- VERBOSE_TID_FUNCTION_DPRINT(gles, __VA_ARGS__); \
-} while(0)
-
-#if DEBUG_GRALLOC_SYNC
-#define GRSYNC_DPRINT RENDERCONTROL_DPRINT
-#else
-#define GRSYNC_DPRINT(...)
-#endif
-
-#if DEBUG_EGL_SYNC
-#define EGLSYNC_DPRINT RENDERCONTROL_DPRINT
-#else
-#define EGLSYNC_DPRINT(...)
-#endif
-
-// GrallocSync is a class that helps to reflect the behavior of
-// grallock_lock/gralloc_unlock on the guest.
-// If we don't use this, apps that use gralloc buffers (such as webcam)
-// will have out of order frames,
-// as GL calls from different threads in the guest
-// are allowed to arrive at the host in any ordering.
-class GrallocSync {
-public:
- GrallocSync() {
- // Having in-order webcam frames is nice, but not at the cost
- // of potential deadlocks;
- // we need to be careful of what situations in which
- // we actually lock/unlock the gralloc color buffer.
- //
- // To avoid deadlock:
- // we require rcColorBufferCacheFlush to be called
- // whenever gralloc_lock is called on the guest,
- // and we require rcUpdateWindowColorBuffer to be called
- // whenever gralloc_unlock is called on the guest.
- //
- // Some versions of the system image optimize out
- // the call to rcUpdateWindowColorBuffer in the case of zero
- // width/height, but since we're using that as synchronization,
- // that lack of calling can lead to a deadlock on the host
- // in many situations
- // (switching camera sides, exiting benchmark apps, etc)
- // So, we put GrallocSync under the feature control.
- mEnabled = emugl_feature_is_enabled(android::featurecontrol::GrallocSync);
-
- // There are two potential tricky situations to handle:
- // a. Multiple users of gralloc buffers that all want to
- // call gralloc_lock. This is obeserved to happen on older APIs
- // (<= 19).
- // b. The pipe doesn't have to preserve ordering of the
- // gralloc_lock and gralloc_unlock commands themselves.
- //
- // To handle a), notice the situation is one of one type of uses
- // needing multiple locks that needs to exclude concurrent use
- // by another type of user. This maps well to a read/write lock,
- // where gralloc_lock and gralloc_unlock users are readers
- // and rcFlushWindowColorBuffer is the writer.
- // From the perspective of the host preparing and posting
- // buffers, these are indeed read/write operations.
- //
- // To handle b), we give up on locking when the state is observed
- // to be bad. lockState tracks how many color buffer locks there are.
- // If lockState < 0, it means we definitely have an unlock before lock
- // sort of situation, and should give up.
- lockState = 0;
- }
-
- // lockColorBufferPrepare is designed to handle
- // gralloc_lock/unlock requests, and uses the read lock.
- // When rcFlushWindowColorBuffer is called (when frames are posted),
- // we use the write lock (see GrallocSyncPostLock).
- void lockColorBufferPrepare() {
- int newLockState = ++lockState;
- if (mEnabled && newLockState == 1) {
- mGrallocColorBufferLock.lockRead();
- } else if (mEnabled) {
- GRSYNC_DPRINT("warning: recursive/multiple locks from guest!");
- }
- }
- void unlockColorBufferPrepare() {
- int newLockState = --lockState;
- if (mEnabled && newLockState == 0) mGrallocColorBufferLock.unlockRead();
- }
- android::base::ReadWriteLock mGrallocColorBufferLock;
-private:
- bool mEnabled;
- std::atomic<int> lockState;
- DISALLOW_COPY_ASSIGN_AND_MOVE(GrallocSync);
-};
-
-class GrallocSyncPostLock : public android::base::AutoWriteLock {
-public:
- GrallocSyncPostLock(GrallocSync& grallocsync) :
- android::base::AutoWriteLock(grallocsync.mGrallocColorBufferLock) { }
-};
-
-static ::emugl::LazyInstance<GrallocSync> sGrallocSync = LAZY_INSTANCE_INIT;
-
-static const GLint rendererVersion = 1;
-
-// GLAsyncSwap version history:
-// "ANDROID_EMU_NATIVE_SYNC": original version
-// "ANDROIDEMU_native_sync_v2": +cleanup of sync objects
-// (We need all the different strings to not be prefixes of any other
-// due to how they are checked for in the GL extensions on the guest)
-static android::base::StringView kAsyncSwapStr = "ANDROID_EMU_native_sync_v2";
-
-static void rcTriggerWait(uint64_t glsync_ptr,
- uint64_t thread_ptr,
- uint64_t timeline);
-
-static GLint rcGetRendererVersion()
-{
- emugl_sync_register_trigger_wait(rcTriggerWait);
-
- sGrallocSync.ptr();
- return rendererVersion;
-}
-
-static EGLint rcGetEGLVersion(EGLint* major, EGLint* minor)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return EGL_FALSE;
- }
- *major = (EGLint)fb->getCaps().eglMajor;
- *minor = (EGLint)fb->getCaps().eglMinor;
-
- return EGL_TRUE;
-}
-
-static EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return 0;
- }
-
- const char *str = s_egl.eglQueryString(fb->getDisplay(), name);
- if (!str) {
- return 0;
- }
-
- std::string eglStr(str);
-
- int len = eglStr.size() + 1;
- if (!buffer || len > bufferSize) {
- return -len;
- }
-
- strcpy((char *)buffer, eglStr.c_str());
- return len;
-}
-
-static EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize)
-{
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
-
- // whatever we end up returning,
- // it will have a terminating \0,
- // so account for it here.
- std::string glStr;
-
- if (tInfo && tInfo->currContext.get()) {
- const char *str = nullptr;
- if (tInfo->currContext->isGL2()) {
- str = (const char *)s_gles2.glGetString(name);
- }
- else {
- str = (const char *)s_gles1.glGetString(name);
- }
- if (str) {
- glStr += str;
- }
- }
-
- // We add the maximum supported GL protocol number into GL_EXTENSIONS
- bool isChecksumEnabled =
- emugl_feature_is_enabled(android::featurecontrol::GLPipeChecksum);
- bool asyncSwapEnabled =
- emugl_feature_is_enabled(android::featurecontrol::GLAsyncSwap) &&
- emugl_sync_device_exists();
-
- if (isChecksumEnabled && name == GL_EXTENSIONS) {
- glStr += ChecksumCalculatorThreadInfo::getMaxVersionString();
- glStr += " ";
- }
-
- if (asyncSwapEnabled && name == GL_EXTENSIONS) {
- glStr += kAsyncSwapStr;
- glStr += " ";
- }
-
- int nextBufferSize = glStr.size() + 1;
-
- if (!buffer || nextBufferSize > bufferSize) {
- return -nextBufferSize;
- }
-
- snprintf((char *)buffer, nextBufferSize, "%s", glStr.c_str());
- return nextBufferSize;
-}
-
-static EGLint rcGetNumConfigs(uint32_t* p_numAttribs)
-{
- int numConfigs = 0, numAttribs = 0;
-
- FrameBuffer::getFB()->getConfigs()->getPackInfo(&numConfigs, &numAttribs);
- if (p_numAttribs) {
- *p_numAttribs = static_cast<uint32_t>(numAttribs);
- }
- return numConfigs;
-}
-
-static EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer)
-{
- GLuint bufferSize = (GLuint)bufSize;
- return FrameBuffer::getFB()->getConfigs()->packConfigs(bufferSize, buffer);
-}
-
-static EGLint rcChooseConfig(EGLint *attribs,
- uint32_t attribs_size,
- uint32_t *configs,
- uint32_t configs_size)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb || attribs_size==0) {
- return 0;
- }
-
- return fb->getConfigs()->chooseConfig(
- attribs, (EGLint*)configs, (EGLint)configs_size);
-}
-
-static EGLint rcGetFBParam(EGLint param)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return 0;
- }
-
- EGLint ret = 0;
-
- switch(param) {
- case FB_WIDTH:
- ret = fb->getWidth();
- break;
- case FB_HEIGHT:
- ret = fb->getHeight();
- break;
- case FB_XDPI:
- ret = 72; // XXX: should be implemented
- break;
- case FB_YDPI:
- ret = 72; // XXX: should be implemented
- break;
- case FB_FPS:
- ret = 60;
- break;
- case FB_MIN_SWAP_INTERVAL:
- ret = 1; // XXX: should be implemented
- break;
- case FB_MAX_SWAP_INTERVAL:
- ret = 1; // XXX: should be implemented
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static uint32_t rcCreateContext(uint32_t config,
- uint32_t share, uint32_t glVersion)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return 0;
- }
-
- // To make it consistent with the guest, create GLES2 context when GL
- // version==2 or 3
- HandleType ret = fb->createRenderContext(config, share, glVersion == 2 || glVersion == 3);
- return ret;
-}
-
-static void rcDestroyContext(uint32_t context)
-{
- SyncThread::destroySyncThread();
-
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return;
- }
-
- fb->DestroyRenderContext(context);
-}
-
-static uint32_t rcCreateWindowSurface(uint32_t config,
- uint32_t width, uint32_t height)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return 0;
- }
-
- return fb->createWindowSurface(config, width, height);
-}
-
-static void rcDestroyWindowSurface(uint32_t windowSurface)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return;
- }
-
- fb->DestroyWindowSurface( windowSurface );
-}
-
-static uint32_t rcCreateColorBuffer(uint32_t width,
- uint32_t height, GLenum internalFormat)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return 0;
- }
-
- return fb->createColorBuffer(width, height, internalFormat);
-}
-
-static int rcOpenColorBuffer2(uint32_t colorbuffer)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return -1;
- }
- return fb->openColorBuffer( colorbuffer );
-}
-
-static void rcOpenColorBuffer(uint32_t colorbuffer)
-{
- (void) rcOpenColorBuffer2(colorbuffer);
-}
-
-static void rcCloseColorBuffer(uint32_t colorbuffer)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return;
- }
- fb->closeColorBuffer( colorbuffer );
-}
-
-static int rcFlushWindowColorBuffer(uint32_t windowSurface)
-{
- GRSYNC_DPRINT("waiting for gralloc cb lock");
- GrallocSyncPostLock lock(sGrallocSync.get());
- GRSYNC_DPRINT("lock gralloc cb lock {");
-
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- GRSYNC_DPRINT("unlock gralloc cb lock");
- return -1;
- }
- if (!fb->flushWindowSurfaceColorBuffer(windowSurface)) {
- GRSYNC_DPRINT("unlock gralloc cb lock }");
- return -1;
- }
-
- GRSYNC_DPRINT("unlock gralloc cb lock }");
-
- return 0;
-}
-
-// Note that even though this calls rcFlushWindowColorBuffer,
-// the "Async" part is in the return type, which is void
-// versus return type int for rcFlushWindowColorBuffer.
-//
-// The different return type, even while calling the same
-// functions internally, will end up making the encoder
-// and decoder use a different protocol. This is because
-// the encoder generally obeys the following conventions:
-//
-// - The encoder will immediately send and wait for a command
-// result if the return type is not void.
-// - The encoder will cache the command in a buffer and send
-// at a convenient time if the return type is void.
-//
-// It can also be expensive performance-wise to trigger
-// sending traffic back to the guest. Generally, the more we avoid
-// encoding commands that perform two-way traffic, the better.
-//
-// Hence, |rcFlushWindowColorBufferAsync| will avoid extra traffic;
-// with return type void,
-// the guest will not wait until this function returns,
-// nor will it immediately send the command,
-// resulting in more asynchronous behavior.
-static void rcFlushWindowColorBufferAsync(uint32_t windowSurface)
-{
- rcFlushWindowColorBuffer(windowSurface);
-}
-
-static void rcSetWindowColorBuffer(uint32_t windowSurface,
- uint32_t colorBuffer)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return;
- }
- fb->setWindowSurfaceColorBuffer(windowSurface, colorBuffer);
-}
-
-static EGLint rcMakeCurrent(uint32_t context,
- uint32_t drawSurf, uint32_t readSurf)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return EGL_FALSE;
- }
-
- bool ret = fb->bindContext(context, drawSurf, readSurf);
-
- return (ret ? EGL_TRUE : EGL_FALSE);
-}
-
-static void rcFBPost(uint32_t colorBuffer)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return;
- }
-
- fb->post(colorBuffer);
-}
-
-static void rcFBSetSwapInterval(EGLint interval)
-{
- // XXX: TBD - should be implemented
-}
-
-static void rcBindTexture(uint32_t colorBuffer)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return;
- }
-
- fb->bindColorBufferToTexture(colorBuffer);
-}
-
-static void rcBindRenderbuffer(uint32_t colorBuffer)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return;
- }
-
- fb->bindColorBufferToRenderbuffer(colorBuffer);
-}
-
-static EGLint rcColorBufferCacheFlush(uint32_t colorBuffer,
- EGLint postCount, int forRead)
-{
- // gralloc_lock() on the guest calls rcColorBufferCacheFlush
- GRSYNC_DPRINT("waiting for gralloc cb lock");
- sGrallocSync->lockColorBufferPrepare();
- GRSYNC_DPRINT("lock gralloc cb lock {");
- return 0;
-}
-
-static void rcReadColorBuffer(uint32_t colorBuffer,
- GLint x, GLint y,
- GLint width, GLint height,
- GLenum format, GLenum type, void* pixels)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return;
- }
-
- fb->readColorBuffer(colorBuffer, x, y, width, height, format, type, pixels);
-}
-
-static int rcUpdateColorBuffer(uint32_t colorBuffer,
- GLint x, GLint y,
- GLint width, GLint height,
- GLenum format, GLenum type, void* pixels)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- GRSYNC_DPRINT("unlock gralloc cb lock");
- sGrallocSync->unlockColorBufferPrepare();
- return -1;
- }
-
- fb->updateColorBuffer(colorBuffer, x, y, width, height, format, type, pixels);
-
- GRSYNC_DPRINT("unlock gralloc cb lock");
- sGrallocSync->unlockColorBufferPrepare();
- return 0;
-}
-
-static uint32_t rcCreateClientImage(uint32_t context, EGLenum target, GLuint buffer)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return 0;
- }
-
- return fb->createClientImage(context, target, buffer);
-}
-
-static int rcDestroyClientImage(uint32_t image)
-{
- FrameBuffer *fb = FrameBuffer::getFB();
- if (!fb) {
- return 0;
- }
-
- return fb->destroyClientImage(image);
-}
-
-static void rcSelectChecksumHelper(uint32_t protocol, uint32_t reserved) {
- ChecksumCalculatorThreadInfo::setVersion(protocol);
-}
-
-// |rcTriggerWait| is called from the goldfish sync
-// kernel driver whenever a native fence fd is created.
-// We will then need to use the host to find out
-// when to signal that native fence fd. We use
-// SyncThread for that.
-//
-// The purpose of |rcTriggerWait| is to tell which
-// SyncThread which sync object / timeline to signal.
-static void rcTriggerWait(uint64_t eglsync_ptr,
- uint64_t thread_ptr,
- uint64_t timeline) {
- FenceSync* fenceSync = (FenceSync*)(uintptr_t)eglsync_ptr;
- EGLSYNC_DPRINT("eglsync=0x%llx "
- "fenceSync=%p "
- "thread_ptr=0x%llx "
- "timeline=0x%llx",
- eglsync_ptr, fenceSync, thread_ptr, timeline);
- SyncThread* syncThread =
- reinterpret_cast<SyncThread*>(thread_ptr);
- syncThread->triggerWait(fenceSync, timeline);
-}
-
-// |rcCreateSyncKHR| implements the guest's
-// |eglCreateSyncKHR| by calling the host's implementation
-// of |eglCreateSyncKHR|. A SyncThread is also started
-// that corresponds to the current rendering thread, for
-// purposes of signaling any native fence fd's that
-// get created in the guest off the sync object
-// created here.
-static void rcCreateSyncKHR(EGLenum type,
- EGLint* attribs,
- uint32_t num_attribs,
- int destroy_when_signaled,
- uint64_t* eglsync_out,
- uint64_t* syncthread_out) {
- EGLSYNC_DPRINT("type=0x%x num_attribs=%d",
- type, num_attribs);
-
- bool hasNativeFence =
- type == EGL_SYNC_NATIVE_FENCE_ANDROID;
-
- FenceSync* fenceSync = new FenceSync(hasNativeFence,
- destroy_when_signaled);
-
- // This MUST be present, or we get a deadlock effect.
- s_gles2.glFlush();
-
- if (syncthread_out) *syncthread_out =
- reinterpret_cast<uint64_t>(SyncThread::getSyncThread());
-
- if (eglsync_out) {
- uint64_t res = (uint64_t)(uintptr_t)fenceSync;
- *eglsync_out = res;
- EGLSYNC_DPRINT("send out eglsync 0x%llx", res);
- }
-}
-
-// |rcClientWaitSyncKHR| implements |eglClientWaitSyncKHR|
-// on the guest through using the host's existing
-// |eglClientWaitSyncKHR| implementation, which is done
-// through the FenceSync object.
-static EGLint rcClientWaitSyncKHR(uint64_t handle,
- EGLint flags,
- uint64_t timeout) {
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
- FrameBuffer *fb = FrameBuffer::getFB();
-
- EGLSYNC_DPRINT("handle=0x%lx flags=0x%x timeout=%" PRIu64,
- handle, flags, timeout);
-
- FenceSync* fenceSync = (FenceSync*)(uintptr_t)handle;
-
- if (!fenceSync) {
- EGLSYNC_DPRINT("fenceSync null, return condition satisfied");
- return EGL_CONDITION_SATISFIED_KHR;
- }
-
- // Sometimes a gralloc-buffer-only thread is doing stuff with sync.
- // This happens all the time with YouTube videos in the browser.
- // In this case, create a context on the host just for syncing.
- if (!tInfo->currContext) {
- uint32_t gralloc_sync_cxt, gralloc_sync_surf;
- fb->createTrivialContext(0, // There is no context to share.
- &gralloc_sync_cxt,
- &gralloc_sync_surf);
- fb->bindContext(gralloc_sync_cxt,
- gralloc_sync_surf,
- gralloc_sync_surf);
- // This context is then cleaned up when the render thread exits.
- }
-
- return fenceSync->wait(timeout);
-}
-
-static int rcDestroySyncKHR(uint64_t handle) {
- FenceSync* fenceSync = (FenceSync*)(uintptr_t)handle;
- assert(fenceSync);
- fenceSync->decRef();
- return 0;
-}
-
-static void rcSetPuid(uint64_t puid) {
- RenderThreadInfo *tInfo = RenderThreadInfo::get();
- tInfo->m_puid = puid;
-}
-
-void initRenderControlContext(renderControl_decoder_context_t *dec)
-{
- dec->rcGetRendererVersion = rcGetRendererVersion;
- dec->rcGetEGLVersion = rcGetEGLVersion;
- dec->rcQueryEGLString = rcQueryEGLString;
- dec->rcGetGLString = rcGetGLString;
- dec->rcGetNumConfigs = rcGetNumConfigs;
- dec->rcGetConfigs = rcGetConfigs;
- dec->rcChooseConfig = rcChooseConfig;
- dec->rcGetFBParam = rcGetFBParam;
- dec->rcCreateContext = rcCreateContext;
- dec->rcDestroyContext = rcDestroyContext;
- dec->rcCreateWindowSurface = rcCreateWindowSurface;
- dec->rcDestroyWindowSurface = rcDestroyWindowSurface;
- dec->rcCreateColorBuffer = rcCreateColorBuffer;
- dec->rcOpenColorBuffer = rcOpenColorBuffer;
- dec->rcCloseColorBuffer = rcCloseColorBuffer;
- dec->rcSetWindowColorBuffer = rcSetWindowColorBuffer;
- dec->rcFlushWindowColorBuffer = rcFlushWindowColorBuffer;
- dec->rcMakeCurrent = rcMakeCurrent;
- dec->rcFBPost = rcFBPost;
- dec->rcFBSetSwapInterval = rcFBSetSwapInterval;
- dec->rcBindTexture = rcBindTexture;
- dec->rcBindRenderbuffer = rcBindRenderbuffer;
- dec->rcColorBufferCacheFlush = rcColorBufferCacheFlush;
- dec->rcReadColorBuffer = rcReadColorBuffer;
- dec->rcUpdateColorBuffer = rcUpdateColorBuffer;
- dec->rcOpenColorBuffer2 = rcOpenColorBuffer2;
- dec->rcCreateClientImage = rcCreateClientImage;
- dec->rcDestroyClientImage = rcDestroyClientImage;
- dec->rcSelectChecksumHelper = rcSelectChecksumHelper;
- dec->rcCreateSyncKHR = rcCreateSyncKHR;
- dec->rcClientWaitSyncKHR = rcClientWaitSyncKHR;
- dec->rcFlushWindowColorBufferAsync = rcFlushWindowColorBufferAsync;
- dec->rcDestroySyncKHR = rcDestroySyncKHR;
- dec->rcSetPuid = rcSetPuid;
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderControl.h b/distrib/android-emugl/host/libs/libOpenglRender/RenderControl.h
deleted file mode 100644
index 87fe1e0dc..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderControl.h
+++ /dev/null
@@ -1,23 +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 _RENDER_CONTROL_H
-#define _RENDER_CONTROL_H
-
-#include "renderControl_dec.h"
-
-void initRenderControlContext(renderControl_decoder_context_t *dec);
-
-#endif
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderLibImpl.cpp b/distrib/android-emugl/host/libs/libOpenglRender/RenderLibImpl.cpp
deleted file mode 100644
index 5cf8528cf..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderLibImpl.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#include "RenderLibImpl.h"
-
-#include "RendererImpl.h"
-
-#include "emugl/common/crash_reporter.h"
-#include "emugl/common/logging.h"
-
-namespace emugl {
-
-void RenderLibImpl::setLogger(emugl_logger_struct logger) {
- set_emugl_logger(logger.coarse);
- set_emugl_cxt_logger(logger.fine);
-}
-
-void RenderLibImpl::setCrashReporter(emugl_crash_reporter_t reporter) {
- set_emugl_crash_reporter(reporter);
-}
-
-RendererPtr RenderLibImpl::initRenderer(int width, int height,
- bool useSubWindow) {
- if (!mRenderer.expired()) {
- return nullptr;
- }
-
- const auto res = std::make_shared<RendererImpl>();
- if (!res->initialize(width, height, useSubWindow)) {
- return nullptr;
- }
- mRenderer = res;
- return res;
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderLibImpl.h b/distrib/android-emugl/host/libs/libOpenglRender/RenderLibImpl.h
deleted file mode 100644
index ae9df2903..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderLibImpl.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#pragma once
-
-#include "OpenglRender/RenderLib.h"
-
-#include "android/base/Compiler.h"
-
-#include <memory>
-
-namespace emugl {
-
-class RenderLibImpl final : public RenderLib {
-public:
- RenderLibImpl() = default;
-
- virtual void setLogger(emugl_logger_struct logger) override;
- virtual void setCrashReporter(emugl_crash_reporter_t reporter) override;
-
- virtual RendererPtr initRenderer(int width,
- int height,
- bool useSubWindow) override;
-
-private:
- DISALLOW_COPY_ASSIGN_AND_MOVE(RenderLibImpl);
-
-private:
- std::weak_ptr<Renderer> mRenderer;
-};
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderThread.cpp b/distrib/android-emugl/host/libs/libOpenglRender/RenderThread.cpp
deleted file mode 100644
index a34c985fe..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderThread.cpp
+++ /dev/null
@@ -1,227 +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 "RenderThread.h"
-
-#include "ChannelStream.h"
-#include "ErrorLog.h"
-#include "FrameBuffer.h"
-#include "ReadBuffer.h"
-#include "RenderControl.h"
-#include "RendererImpl.h"
-#include "RenderChannelImpl.h"
-#include "RenderThreadInfo.h"
-
-#include "OpenGLESDispatch/EGLDispatch.h"
-#include "OpenGLESDispatch/GLESv2Dispatch.h"
-#include "OpenGLESDispatch/GLESv1Dispatch.h"
-#include "../../../shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h"
-
-#include "android/base/system/System.h"
-
-#define EMUGL_DEBUG_LEVEL 0
-#include "emugl/common/debug.h"
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-namespace emugl {
-
-// Start with a smaller buffer to not waste memory on a low-used render threads.
-static constexpr int kStreamBufferSize = 128 * 1024;
-
-RenderThread::RenderThread(std::weak_ptr<RendererImpl> renderer,
- std::shared_ptr<RenderChannelImpl> channel)
- : mChannel(channel), mRenderer(renderer) {}
-
-RenderThread::~RenderThread() = default;
-
-// static
-std::unique_ptr<RenderThread> RenderThread::create(
- std::weak_ptr<RendererImpl> renderer,
- std::shared_ptr<RenderChannelImpl> channel) {
- return std::unique_ptr<RenderThread>(
- new RenderThread(renderer, channel));
-}
-
-intptr_t RenderThread::main() {
- ChannelStream stream(mChannel, RenderChannel::Buffer::kSmallSize);
-
- uint32_t flags = 0;
- if (stream.read(&flags, sizeof(flags)) != sizeof(flags)) {
- return 0;
- }
-
- // |flags| used to have something, now they're not used.
- (void)flags;
-
- RenderThreadInfo tInfo;
- ChecksumCalculatorThreadInfo tChecksumInfo;
- ChecksumCalculator& checksumCalc = tChecksumInfo.get();
-
- //
- // initialize decoders
- //
- tInfo.m_glDec.initGL(gles1_dispatch_get_proc_func, NULL);
- tInfo.m_gl2Dec.initGL(gles2_dispatch_get_proc_func, NULL);
- initRenderControlContext(&tInfo.m_rcDec);
-
- ReadBuffer readBuf(kStreamBufferSize);
-
- int stats_totalBytes = 0;
- long long stats_t0 = android::base::System::get()->getHighResTimeUs() / 1000;
-
- //
- // open dump file if RENDER_DUMP_DIR is defined
- //
- const char* dump_dir = getenv("RENDERER_DUMP_DIR");
- FILE* dumpFP = NULL;
- if (dump_dir) {
- size_t bsize = strlen(dump_dir) + 32;
- char* fname = new char[bsize];
- snprintf(fname, bsize, "%s/stream_%p", dump_dir, this);
- dumpFP = fopen(fname, "wb");
- if (!dumpFP) {
- fprintf(stderr, "Warning: stream dump failed to open file %s\n",
- fname);
- }
- delete[] fname;
- }
-
- while (1) {
- // Let's make sure we read enough data for at least some processing.
- int packetSize;
- if (readBuf.validData() >= 8) {
- // We know that packet size is the second int32_t from the start.
- packetSize = *(const int32_t*)(readBuf.buf() + 4);
- } else {
- // Read enough data to at least be able to get the packet size next
- // time.
- packetSize = 8;
- }
-
- // We should've processed the packet on the previous iteration if it
- // was already in the buffer.
- assert(packetSize > (int)readBuf.validData());
-
- const int stat = readBuf.getData(&stream, packetSize);
- if (stat <= 0) {
- D("Warning: render thread could not read data from stream");
- break;
- }
- DD("render thread read %d bytes, op %d, packet size %d",
- (int)readBuf.validData(), *(int32_t*)readBuf.buf(),
- *(int32_t*)(readBuf.buf() + 4));
-
- //
- // log received bandwidth statistics
- //
- stats_totalBytes += readBuf.validData();
- long long dt = android::base::System::get()->getHighResTimeUs() / 1000 - stats_t0;
- if (dt > 1000) {
- // float dts = (float)dt / 1000.0f;
- // printf("Used Bandwidth %5.3f MB/s\n", ((float)stats_totalBytes /
- // dts) / (1024.0f*1024.0f));
- stats_totalBytes = 0;
- stats_t0 = android::base::System::get()->getHighResTimeUs() / 1000;
- }
-
- //
- // dump stream to file if needed
- //
- if (dumpFP) {
- int skip = readBuf.validData() - stat;
- fwrite(readBuf.buf() + skip, 1, readBuf.validData() - skip, dumpFP);
- fflush(dumpFP);
- }
-
- bool progress;
- do {
- progress = false;
-
- // try to process some of the command buffer using the GLESv1
- // decoder
- //
- // DRIVER WORKAROUND:
- // On Linux with NVIDIA GPU's at least, we need to avoid performing
- // GLES ops while someone else holds the FrameBuffer write lock.
- //
- // To be more specific, on Linux with NVIDIA Quadro K2200 v361.xx,
- // we get a segfault in the NVIDIA driver when glTexSubImage2D
- // is called at the same time as glXMake(Context)Current.
- //
- // To fix, this driver workaround avoids calling
- // any sort of GLES call when we are creating/destroying EGL
- // contexts.
- FrameBuffer::getFB()->lockContextStructureRead();
- size_t last = tInfo.m_glDec.decode(
- readBuf.buf(), readBuf.validData(), &stream, &checksumCalc);
- if (last > 0) {
- progress = true;
- readBuf.consume(last);
- }
-
- //
- // try to process some of the command buffer using the GLESv2
- // decoder
- //
- last = tInfo.m_gl2Dec.decode(readBuf.buf(), readBuf.validData(),
- &stream, &checksumCalc);
- FrameBuffer::getFB()->unlockContextStructureRead();
-
- if (last > 0) {
- progress = true;
- readBuf.consume(last);
- }
-
- //
- // try to process some of the command buffer using the
- // renderControl decoder
- //
- last = tInfo.m_rcDec.decode(readBuf.buf(), readBuf.validData(),
- &stream, &checksumCalc);
- if (last > 0) {
- readBuf.consume(last);
- progress = true;
- }
- } while (progress);
- }
-
- if (dumpFP) {
- fclose(dumpFP);
- }
-
- // exit sync thread, if any.
- SyncThread::destroySyncThread();
-
- //
- // Release references to the current thread's context/surfaces if any
- //
- FrameBuffer::getFB()->bindContext(0, 0, 0);
- if (tInfo.currContext || tInfo.currDrawSurf || tInfo.currReadSurf) {
- fprintf(stderr,
- "ERROR: RenderThread exiting with current context/surfaces\n");
- }
-
- FrameBuffer::getFB()->drainWindowSurface();
- FrameBuffer::getFB()->drainRenderContext();
-
- DBG("Exited a RenderThread @%p\n", this);
-
- return 0;
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RenderThread.h b/distrib/android-emugl/host/libs/libOpenglRender/RenderThread.h
deleted file mode 100644
index 81475b3fb..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RenderThread.h
+++ /dev/null
@@ -1,56 +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.
-*/
-#pragma once
-
-#include "emugl/common/mutex.h"
-#include "emugl/common/thread.h"
-
-#include <memory>
-
-namespace emugl {
-class RenderChannelImpl;
-class RendererImpl;
-}
-
-// A class used to model a thread of the RenderServer. Each one of them
-// handles a single guest client / protocol byte stream.
-class RenderThread : public emugl::Thread {
-public:
- // Create a new RenderThread instance.
- // TODO(digit): Why is this lock needed here? Shouldn't this be handled
- // by the decoders themselves or at a lower-level?
- static std::unique_ptr<RenderThread> create(
- std::weak_ptr<emugl::RendererImpl> renderer,
- std::shared_ptr<emugl::RenderChannelImpl> channel,
- emugl::Mutex* lock);
-
- virtual ~RenderThread();
-
- // Returns true iff the thread has finished.
- // Note that this also means that the thread's stack has been
- bool isFinished() { return tryWait(NULL); }
-
-private:
- RenderThread(std::weak_ptr<emugl::RendererImpl> renderer,
- std::shared_ptr<emugl::RenderChannelImpl> channel,
- emugl::Mutex* mutex);
-
- virtual intptr_t main();
-
- emugl::Mutex* m_lock;
- std::shared_ptr<emugl::RenderChannelImpl> mChannel;
- std::weak_ptr<emugl::RendererImpl> mRenderer;
-};
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RendererImpl.cpp b/distrib/android-emugl/host/libs/libOpenglRender/RendererImpl.cpp
deleted file mode 100644
index 0aab5be14..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RendererImpl.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#include "RendererImpl.h"
-
-#include "RenderChannelImpl.h"
-
-#include "emugl/common/logging.h"
-#include "ErrorLog.h"
-#include "FrameBuffer.h"
-
-#include <algorithm>
-#include <utility>
-
-#include <assert.h>
-
-namespace emugl {
-
-// kUseSubwindowThread is used to determine whether the RenderWindow should use
-// a separate thread to manage its subwindow GL/GLES context.
-// For now, this feature is disabled entirely for the following
-// reasons:
-//
-// - It must be disabled on Windows at all times, otherwise the main window
-// becomes unresponsive after a few seconds of user interaction (e.g. trying
-// to move it over the desktop). Probably due to the subtle issues around
-// input on this platform (input-queue is global, message-queue is
-// per-thread). Also, this messes considerably the display of the
-// main window when running the executable under Wine.
-//
-// - On Linux/XGL and OSX/Cocoa, this used to be necessary to avoid corruption
-// issues with the GL state of the main window when using the SDL UI.
-// After the switch to Qt, this is no longer necessary and may actually cause
-// undesired interactions between the UI thread and the RenderWindow thread:
-// for example, in a multi-monitor setup the context might be recreated when
-// dragging the window between monitors, triggering a Qt-specific callback
-// in the context of RenderWindow thread, which will become blocked on the UI
-// thread, which may in turn be blocked on something else.
-static const bool kUseSubwindowThread = false;
-
-RendererImpl::~RendererImpl() {
- stop();
- mRenderWindow.reset();
-}
-
-bool RendererImpl::initialize(int width, int height, bool useSubWindow) {
- if (mRenderWindow) {
- return false;
- }
-
- std::unique_ptr<RenderWindow> renderWindow(
- new RenderWindow(width, height, kUseSubwindowThread, useSubWindow));
- if (!renderWindow) {
- ERR("Could not create rendering window class");
- GL_LOG("Could not create rendering window class");
- return false;
- }
- if (!renderWindow->isValid()) {
- ERR("Could not initialize emulated framebuffer");
- return false;
- }
-
- mRenderWindow = std::move(renderWindow);
- GL_LOG("OpenGL renderer initialized successfully");
- return true;
-}
-
-void RendererImpl::stop() {
- android::base::AutoLock lock(mThreadVectorLock);
- auto threads = std::move(mThreads);
- mThreads.clear();
- lock.unlock();
-
- for (const auto& t : mThreads) {
- if (const auto channel = t.second.lock()) {
- channel->stopFromHost();
- }
- }
-}
-
-RenderChannelPtr RendererImpl::createRenderChannel() {
- const auto channel = std::make_shared<RenderChannelImpl>();
-
- std::unique_ptr<RenderThread> rt(RenderThread::create(
- shared_from_this(), channel, &mRenderThreadSharedLock));
- if (!rt) {
- fprintf(stderr, "Failed to create RenderThread\n");
- return nullptr;
- }
-
- if (!rt->start()) {
- fprintf(stderr, "Failed to start RenderThread\n");
- return nullptr;
- }
-
- size_t threadCount = 0;
- {
- android::base::AutoLock lock(mThreadVectorLock);
-
- // clean up the threads that are no longer running
- mThreads.erase(std::remove_if(mThreads.begin(), mThreads.end(),
- [](const ThreadWithChannel& t) {
- return t.second.expired() ||
- t.first->isFinished();
- }),
- mThreads.end());
-
- mThreads.emplace_back(std::move(rt), channel);
-
- threadCount = mThreads.size();
- }
- DBG("Started new RenderThread (total %d)\n", (int)threadCount);
-
- return channel;
-}
-
-RendererImpl::HardwareStrings RendererImpl::getHardwareStrings() {
- assert(mRenderWindow);
-
- const char* vendor = nullptr;
- const char* renderer = nullptr;
- const char* version = nullptr;
- if (!mRenderWindow->getHardwareStrings(&vendor, &renderer, &version)) {
- return {};
- }
- HardwareStrings res;
- res.vendor = vendor ? vendor : "";
- res.renderer = renderer ? renderer : "";
- res.version = version ? version : "";
- return res;
-}
-
-void RendererImpl::setPostCallback(RendererImpl::OnPostCallback onPost,
- void* context) {
- assert(mRenderWindow);
- mRenderWindow->setPostCallback(onPost, context);
-}
-
-bool RendererImpl::showOpenGLSubwindow(FBNativeWindowType window,
- int wx,
- int wy,
- int ww,
- int wh,
- int fbw,
- int fbh,
- float dpr,
- float zRot) {
- assert(mRenderWindow);
- return mRenderWindow->setupSubWindow(window, wx, wy, ww, wh, fbw, fbh, dpr,
- zRot);
-}
-
-bool RendererImpl::destroyOpenGLSubwindow() {
- assert(mRenderWindow);
- return mRenderWindow->removeSubWindow();
-}
-
-void RendererImpl::setOpenGLDisplayRotation(float zRot) {
- assert(mRenderWindow);
- mRenderWindow->setRotation(zRot);
-}
-
-void RendererImpl::setOpenGLDisplayTranslation(float px, float py) {
- assert(mRenderWindow);
- mRenderWindow->setTranslation(px, py);
-}
-
-void RendererImpl::repaintOpenGLDisplay() {
- assert(mRenderWindow);
- mRenderWindow->repaint();
-}
-
-void RendererImpl::cleanupProcGLObjects(uint64_t puid) {
- FrameBuffer::getFB()->cleanupProcGLObjects(puid);
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/RendererImpl.h b/distrib/android-emugl/host/libs/libOpenglRender/RendererImpl.h
deleted file mode 100644
index a31616a0d..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/RendererImpl.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#pragma once
-
-#include "OpenglRender/Renderer.h"
-
-#include "RenderWindow.h"
-
-#include "android/base/Compiler.h"
-#include "android/base/synchronization/Lock.h"
-
-#include "RenderThread.h"
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-namespace emugl {
-
-class RendererImpl final : public Renderer,
- public std::enable_shared_from_this<RendererImpl> {
-public:
- RendererImpl() = default;
- ~RendererImpl();
-
- bool initialize(int width, int height, bool useSubWindow);
-
- void stop();
-
-public:
- RenderChannelPtr createRenderChannel() final;
- HardwareStrings getHardwareStrings() final;
- void setPostCallback(OnPostCallback onPost,
- void* context) final;
- bool showOpenGLSubwindow(FBNativeWindowType window,
- int wx,
- int wy,
- int ww,
- int wh,
- int fbw,
- int fbh,
- float dpr,
- float zRot) final;
- bool destroyOpenGLSubwindow() final;
- void setOpenGLDisplayRotation(float zRot) final;
- void setOpenGLDisplayTranslation(float px, float py) final;
- void repaintOpenGLDisplay() final;
- void cleanupProcGLObjects(uint64_t puid) final;
-private:
- DISALLOW_COPY_ASSIGN_AND_MOVE(RendererImpl);
-
-private:
- std::unique_ptr<RenderWindow> mRenderWindow;
-
- android::base::Lock mRenderThreadSharedLock;
- android::base::Lock mThreadVectorLock;
-
- using ThreadWithChannel = std::pair<std::unique_ptr<RenderThread>,
- std::weak_ptr<RenderChannelImpl>>;
-
- std::vector<ThreadWithChannel> mThreads;
-};
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/ThreadInfo.cpp b/distrib/android-emugl/host/libs/libOpenglRender/ThreadInfo.cpp
deleted file mode 100644
index 5337009f8..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/ThreadInfo.cpp
+++ /dev/null
@@ -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 "ThreadInfo.h"
-#include "emugl/common/lazy_instance.h"
-#include "emugl/common/thread_store.h"
-
-namespace {
-
-class ThreadInfoStore : public ::emugl::ThreadStore {
-public:
- ThreadInfoStore() : ::emugl::ThreadStore(NULL) {}
-};
-
-} // namespace
-
-static ::emugl::LazyInstance<ThreadInfoStore> s_tls = LAZY_INSTANCE_INIT;
-
-RenderThreadInfo::RenderThreadInfo() {
- s_tls->set(this);
-}
-
-RenderThreadInfo::~RenderThreadInfo() {
- s_tls->set(NULL);
-}
-
-RenderThreadInfo* RenderThreadInfo::get() {
- return static_cast<RenderThreadInfo*>(s_tls->get());
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/ThreadInfo.h b/distrib/android-emugl/host/libs/libOpenglRender/ThreadInfo.h
deleted file mode 100644
index e69de29bb..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/ThreadInfo.h
+++ /dev/null
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/WindowSurface.cpp b/distrib/android-emugl/host/libs/libOpenglRender/WindowSurface.cpp
deleted file mode 100644
index ede0dda2e..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/WindowSurface.cpp
+++ /dev/null
@@ -1,185 +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 "WindowSurface.h"
-
-#include "FbConfig.h"
-#include "GLErrorLog.h"
-
-#include "OpenGLESDispatch/EGLDispatch.h"
-
-#include <GLES/glext.h>
-
-#include <stdio.h>
-#include <string.h>
-
-
-WindowSurface::WindowSurface(EGLDisplay display,
- EGLConfig config) :
- mConfig(config),
- mDisplay(display) {}
-
-WindowSurface::~WindowSurface() {
- s_egl.eglDestroySurface(mDisplay, mSurface);
-}
-
-WindowSurface *WindowSurface::create(EGLDisplay display,
- EGLConfig config,
- int p_width,
- int p_height) {
- // allocate space for the WindowSurface object
- WindowSurface *win = new WindowSurface(display, config);
- if (!win) {
- return NULL;
- }
-
- // Create a pbuffer to be used as the egl surface
- // for that window.
- if (!win->resize(p_width, p_height)) {
- delete win;
- return NULL;
- }
-
- return win;
-}
-
-
-void WindowSurface::setColorBuffer(ColorBufferPtr p_colorBuffer) {
- mAttachedColorBuffer = p_colorBuffer;
-
- // resize the window if the attached color buffer is of different
- // size.
- unsigned int cbWidth = mAttachedColorBuffer->getWidth();
- unsigned int cbHeight = mAttachedColorBuffer->getHeight();
-
- if (cbWidth != mWidth || cbHeight != mHeight) {
- resize(cbWidth, cbHeight);
- }
-}
-
-void WindowSurface::bind(RenderContextPtr p_ctx, BindType p_bindType) {
- if (p_bindType == BIND_READ) {
- mReadContext = p_ctx;
- } else if (p_bindType == BIND_DRAW) {
- mDrawContext = p_ctx;
- } else if (p_bindType == BIND_READDRAW) {
- mReadContext = p_ctx;
- mDrawContext = p_ctx;
- }
-}
-
-bool WindowSurface::flushColorBuffer() {
- if (!mAttachedColorBuffer.get()) {
- return true;
- }
- if (!mWidth || !mHeight) {
- return false;
- }
-
- if (mAttachedColorBuffer->getWidth() != mWidth ||
- mAttachedColorBuffer->getHeight() != mHeight) {
- // XXX: should never happen - how this needs to be handled?
- fprintf(stderr, "Dimensions do not match\n");
- return false;
- }
-
- if (!mDrawContext.get()) {
- fprintf(stderr, "Draw context is NULL\n");
- return false;
- }
-
- // Make the surface current
- EGLContext prevContext = s_egl.eglGetCurrentContext();
- EGLSurface prevReadSurf = s_egl.eglGetCurrentSurface(EGL_READ);
- EGLSurface prevDrawSurf = s_egl.eglGetCurrentSurface(EGL_DRAW);
-
- const bool needToSet = prevContext != mDrawContext->getEGLContext() ||
- prevReadSurf != mSurface || prevDrawSurf != mSurface;
- if (needToSet) {
- if (!s_egl.eglMakeCurrent(mDisplay,
- mSurface,
- mSurface,
- mDrawContext->getEGLContext())) {
- fprintf(stderr, "Error making draw context current\n");
- return false;
- }
- }
-
- mAttachedColorBuffer->blitFromCurrentReadBuffer();
-
- if (needToSet) {
- // restore current context/surface
- s_egl.eglMakeCurrent(mDisplay, prevDrawSurf, prevReadSurf, prevContext);
- }
-
- return true;
-}
-
-bool WindowSurface::resize(unsigned int p_width, unsigned int p_height)
-{
- if (mSurface && mWidth == p_width && mHeight == p_height) {
- // no need to resize
- return true;
- }
-
- EGLContext prevContext = s_egl.eglGetCurrentContext();
- EGLSurface prevReadSurf = s_egl.eglGetCurrentSurface(EGL_READ);
- EGLSurface prevDrawSurf = s_egl.eglGetCurrentSurface(EGL_DRAW);
- EGLSurface prevPbuf = mSurface;
- bool needRebindContext = mSurface &&
- (prevReadSurf == mSurface ||
- prevDrawSurf == mSurface);
-
- if (needRebindContext) {
- s_egl.eglMakeCurrent(
- mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- }
-
- //
- // Destroy previous surface
- //
- if (mSurface) {
- s_egl.eglDestroySurface(mDisplay, mSurface);
- mSurface = NULL;
- }
-
- //
- // Create pbuffer surface.
- //
- const EGLint pbufAttribs[5] = {
- EGL_WIDTH, (EGLint) p_width, EGL_HEIGHT, (EGLint) p_height, EGL_NONE,
- };
-
- mSurface = s_egl.eglCreatePbufferSurface(mDisplay,
- mConfig,
- pbufAttribs);
- if (mSurface == EGL_NO_SURFACE) {
- fprintf(stderr, "Renderer error: failed to create/resize pbuffer!!\n");
- return false;
- }
-
- mWidth = p_width;
- mHeight = p_height;
-
- if (needRebindContext) {
- s_egl.eglMakeCurrent(
- mDisplay,
- (prevDrawSurf == prevPbuf) ? mSurface : prevDrawSurf,
- (prevReadSurf == prevPbuf) ? mSurface : prevReadSurf,
- prevContext);
- }
-
- return true;
-}
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/WindowSurface.h b/distrib/android-emugl/host/libs/libOpenglRender/WindowSurface.h
deleted file mode 100644
index 812efcaa3..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/WindowSurface.h
+++ /dev/null
@@ -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 _LIBRENDER_WINDOW_SURFACE_H
-#define _LIBRENDER_WINDOW_SURFACE_H
-
-#include "ColorBuffer.h"
-#include "RenderContext.h"
-
-#include "emugl/common/smart_ptr.h"
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-
-// A class used to model a guest-side window surface. The implementation
-// uses a host Pbuffer to act as the EGL rendering surface instead.
-class WindowSurface {
-public:
- // Create a new WindowSurface instance.
- // |display| is the host EGLDisplay value.
- // |config| is the host EGLConfig value.
- // |width| and |height| are the initial size of the Pbuffer.
- // Return a new WindowSurface instance on success, or NULL on failure.
- static WindowSurface* create(EGLDisplay display,
- EGLConfig config,
- int width,
- int height);
-
- // Destructor.
- ~WindowSurface();
-
- // Retrieve the host EGLSurface of the WindowSurface's Pbuffer.
- EGLSurface getEGLSurface() const { return mSurface; }
-
- // Attach a ColorBuffer to this WindowSurface.
- // Once attached, calling flushColorBuffer() will copy the Pbuffer's
- // pixels to the color buffer.
- //
- // IMPORTANT: This automatically resizes the Pbuffer's to the ColorBuffer's
- // dimensions. Potentially losing pixel values in the process.
- void setColorBuffer(ColorBufferPtr p_colorBuffer);
-
- // Copy the Pbuffer's pixels to the attached color buffer.
- // Returns true on success, or false on error (e.g. if there is no
- // attached color buffer).
- bool flushColorBuffer();
-
- // Used by bind() below.
- enum BindType {
- BIND_READ,
- BIND_DRAW,
- BIND_READDRAW
- };
-
- // TODO(digit): What is this used for exactly? For example, the
- // mReadContext is never used by this class. The mDrawContext is only
- // used temporarily during flushColorBuffer() operation, and could be
- // passed as a parameter to the function instead. Maybe this is only used
- // to increment reference counts on the smart pointers.
- //
- // Bind a context to the WindowSurface (huh? Normally you would bind a
- // surface to the context, not the other way around)
- //
- // |p_ctx| is a RenderContext pointer.
- // |p_bindType| is the type of bind. For BIND_READ, this assigns |p_ctx|
- // to mReadContext, for BIND_DRAW, it assigns it to mDrawContext, and for
- // for BIND_READDRAW, it assigns it to both.
- void bind(RenderContextPtr p_ctx, BindType p_bindType);
-
-private:
- WindowSurface(const WindowSurface& other) = delete;
-
- WindowSurface(EGLDisplay display, EGLConfig config);
-
- bool resize(unsigned int p_width, unsigned int p_height);
-
-private:
- EGLSurface mSurface = EGL_NO_SURFACE;
- ColorBufferPtr mAttachedColorBuffer;
- RenderContextPtr mReadContext;
- RenderContextPtr mDrawContext;
- GLuint mWidth = 0;
- GLuint mHeight = 0;
- EGLConfig mConfig = nullptr;
- EGLDisplay mDisplay = EGL_NO_DISPLAY;
-};
-
-typedef emugl::SmartPtr<WindowSurface> WindowSurfacePtr;
-
-#endif // _LIBRENDER_WINDOW_SURFACE_H
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/gl_proc.h b/distrib/android-emugl/host/libs/libOpenglRender/gl_proc.h
deleted file mode 100644
index 465a10dfe..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/gl_proc.h
+++ /dev/null
@@ -1,296 +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_PROC_H
-#define _GLES_PROC_H
-
-#include <GLES/gl.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GLES/glext.h>
-
-typedef void (GL_APIENTRY *glAlphaFunc_t) (GLenum, GLclampf);
-typedef void (GL_APIENTRY *glClearColor_t) (GLclampf, GLclampf, GLclampf, GLclampf);
-typedef void (GL_APIENTRY *glClearDepthf_t) (GLclampf);
-typedef void (GL_APIENTRY *glClipPlanef_t) (GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glColor4f_t) (GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glDepthRangef_t) (GLclampf, GLclampf);
-typedef void (GL_APIENTRY *glFogf_t) (GLenum, GLfloat);
-typedef void (GL_APIENTRY *glFogfv_t) (GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glFrustumf_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glGetClipPlanef_t) (GLenum, GLfloat);
-typedef void (GL_APIENTRY *glGetFloatv_t) (GLenum, GLfloat*);
-typedef void (GL_APIENTRY *glGetLightfv_t) (GLenum, GLenum, GLfloat*);
-typedef void (GL_APIENTRY *glGetMaterialfv_t) (GLenum, GLenum, GLfloat*);
-typedef void (GL_APIENTRY *glGetTexEnvfv_t) (GLenum, GLenum, GLfloat*);
-typedef void (GL_APIENTRY *glGetTexParameterfv_t) (GLenum, GLenum, GLfloat*);
-typedef void (GL_APIENTRY *glLightModelf_t) (GLenum, GLfloat);
-typedef void (GL_APIENTRY *glLightModelfv_t) (GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glLightf_t) (GLenum, GLenum, GLfloat);
-typedef void (GL_APIENTRY *glLightfv_t) (GLenum, GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glLineWidth_t) (GLfloat);
-typedef void (GL_APIENTRY *glLoadMatrixf_t) (const GLfloat*);
-typedef void (GL_APIENTRY *glMaterialf_t) (GLenum, GLenum, GLfloat);
-typedef void (GL_APIENTRY *glMaterialfv_t) (GLenum, GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glMultMatrixf_t) (const GLfloat*);
-typedef void (GL_APIENTRY *glMultiTexCoord4f_t) (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glNormal3f_t) (GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glOrthof_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glPointParameterf_t) (GLenum, GLfloat);
-typedef void (GL_APIENTRY *glPointParameterfv_t) (GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glPointSize_t) (GLfloat);
-typedef void (GL_APIENTRY *glPolygonOffset_t) (GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glRotatef_t) (GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glScalef_t) (GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glTexEnvf_t) (GLenum, GLenum, GLfloat);
-typedef void (GL_APIENTRY *glTexEnvfv_t) (GLenum, GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glTexParameterf_t) (GLenum, GLenum, GLfloat);
-typedef void (GL_APIENTRY *glTexParameterfv_t) (GLenum, GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glTranslatef_t) (GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glActiveTexture_t) (GLenum);
-typedef void (GL_APIENTRY *glAlphaFuncx_t) (GLenum, GLclampx);
-typedef void (GL_APIENTRY *glBindBuffer_t) (GLenum, GLuint);
-typedef void (GL_APIENTRY *glBindTexture_t) (GLenum, GLuint);
-typedef void (GL_APIENTRY *glBlendFunc_t) (GLenum, GLenum);
-typedef void (GL_APIENTRY *glBufferData_t) (GLenum, GLsizeiptr, const GLvoid*, GLenum);
-typedef void (GL_APIENTRY *glBufferSubData_t) (GLenum, GLintptr, GLsizeiptr, const GLvoid*);
-typedef void (GL_APIENTRY *glClear_t) (GLbitfield);
-typedef void (GL_APIENTRY *glClearColorx_t) (GLclampx, GLclampx, GLclampx, GLclampx);
-typedef void (GL_APIENTRY *glClearDepthx_t) (GLclampx);
-typedef void (GL_APIENTRY *glClearStencil_t) (GLint);
-typedef void (GL_APIENTRY *glClientActiveTexture_t) (GLenum);
-typedef void (GL_APIENTRY *glClipPlanex_t) (GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glColor4ub_t) (GLubyte, GLubyte, GLubyte, GLubyte);
-typedef void (GL_APIENTRY *glColor4x_t) (GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glColorMask_t) (GLboolean, GLboolean, GLboolean, GLboolean);
-typedef void (GL_APIENTRY *glColorPointer_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (GL_APIENTRY *glCompressedTexImage2D_t) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
-typedef void (GL_APIENTRY *glCompressedTexSubImage2D_t) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
-typedef void (GL_APIENTRY *glCopyTexImage2D_t) (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-typedef void (GL_APIENTRY *glCopyTexSubImage2D_t) (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-typedef void (GL_APIENTRY *glCullFace_t) (GLenum);
-typedef void (GL_APIENTRY *glDeleteBuffers_t) (GLsizei, const GLuint*);
-typedef void (GL_APIENTRY *glDeleteTextures_t) (GLsizei, const GLuint*);
-typedef void (GL_APIENTRY *glDepthFunc_t) (GLenum);
-typedef void (GL_APIENTRY *glDepthMask_t) (GLboolean);
-typedef void (GL_APIENTRY *glDepthRangex_t) (GLclampx, GLclampx);
-typedef void (GL_APIENTRY *glDisable_t) (GLenum);
-typedef void (GL_APIENTRY *glDisableClientState_t) (GLenum);
-typedef void (GL_APIENTRY *glDrawArrays_t) (GLenum, GLint, GLsizei);
-typedef void (GL_APIENTRY *glDrawElements_t) (GLenum, GLsizei, GLenum, const GLvoid*);
-typedef void (GL_APIENTRY *glEnable_t) (GLenum);
-typedef void (GL_APIENTRY *glEnableClientState_t) (GLenum);
-typedef void (GL_APIENTRY *glFinish_t) ();
-typedef void (GL_APIENTRY *glFlush_t) ();
-typedef void (GL_APIENTRY *glFogx_t) (GLenum, GLfixed);
-typedef void (GL_APIENTRY *glFogxv_t) (GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glFrontFace_t) (GLenum);
-typedef void (GL_APIENTRY *glFrustumx_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glGetBooleanv_t) (GLenum, GLboolean*);
-typedef void (GL_APIENTRY *glGetBufferParameteriv_t) (GLenum, GLenum, GLint*);
-typedef void (GL_APIENTRY *glGetClipPlanex_t) (GLenum, GLfixed);
-typedef void (GL_APIENTRY *glGenBuffers_t) (GLsizei, GLuint*);
-typedef void (GL_APIENTRY *glGenTextures_t) (GLsizei, GLuint*);
-typedef GLenum (GL_APIENTRY *glGetError_t) ();
-typedef void (GL_APIENTRY *glGetFixedv_t) (GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glGetIntegerv_t) (GLenum, GLint*);
-typedef void (GL_APIENTRY *glGetLightxv_t) (GLenum, GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glGetMaterialxv_t) (GLenum, GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glGetPointerv_t) (GLenum, GLvoid*);
-typedef const GLubyte* (GL_APIENTRY *glGetString_t) (GLenum);
-typedef void (GL_APIENTRY *glGetTexEnviv_t) (GLenum, GLenum, GLint*);
-typedef void (GL_APIENTRY *glGetTexEnvxv_t) (GLenum, GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glGetTexParameteriv_t) (GLenum, GLenum, GLint*);
-typedef void (GL_APIENTRY *glGetTexParameterxv_t) (GLenum, GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glHint_t) (GLenum, GLenum);
-typedef GLboolean (GL_APIENTRY *glIsBuffer_t) (GLuint);
-typedef GLboolean (GL_APIENTRY *glIsEnabled_t) (GLenum);
-typedef GLboolean (GL_APIENTRY *glIsTexture_t) (GLuint);
-typedef void (GL_APIENTRY *glLightModelx_t) (GLenum, GLfixed);
-typedef void (GL_APIENTRY *glLightModelxv_t) (GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glLightx_t) (GLenum, GLenum, GLfixed);
-typedef void (GL_APIENTRY *glLightxv_t) (GLenum, GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glLineWidthx_t) (GLfixed);
-typedef void (GL_APIENTRY *glLoadIdentity_t) ();
-typedef void (GL_APIENTRY *glLoadMatrixx_t) (const GLfixed*);
-typedef void (GL_APIENTRY *glLogicOp_t) (GLenum);
-typedef void (GL_APIENTRY *glMaterialx_t) (GLenum, GLenum, GLfixed);
-typedef void (GL_APIENTRY *glMaterialxv_t) (GLenum, GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glMatrixMode_t) (GLenum);
-typedef void (GL_APIENTRY *glMultMatrixx_t) (const GLfixed*);
-typedef void (GL_APIENTRY *glMultiTexCoord4x_t) (GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glNormal3x_t) (GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glNormalPointer_t) (GLenum, GLsizei, const GLvoid*);
-typedef void (GL_APIENTRY *glOrthox_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glPixelStorei_t) (GLenum, GLint);
-typedef void (GL_APIENTRY *glPointParameterx_t) (GLenum, GLfixed);
-typedef void (GL_APIENTRY *glPointParameterxv_t) (GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glPointSizex_t) (GLfixed);
-typedef void (GL_APIENTRY *glPolygonOffsetx_t) (GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glPopMatrix_t) ();
-typedef void (GL_APIENTRY *glPushMatrix_t) ();
-typedef void (GL_APIENTRY *glReadPixels_t) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
-typedef void (GL_APIENTRY *glRotatex_t) (GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glSampleCoverage_t) (GLclampf, GLboolean);
-typedef void (GL_APIENTRY *glSampleCoveragex_t) (GLclampx, GLboolean);
-typedef void (GL_APIENTRY *glScalex_t) (GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glScissor_t) (GLint, GLint, GLsizei, GLsizei);
-typedef void (GL_APIENTRY *glShadeModel_t) (GLenum);
-typedef void (GL_APIENTRY *glStencilFunc_t) (GLenum, GLint, GLuint);
-typedef void (GL_APIENTRY *glStencilMask_t) (GLuint);
-typedef void (GL_APIENTRY *glStencilOp_t) (GLenum, GLenum, GLenum);
-typedef void (GL_APIENTRY *glTexCoordPointer_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (GL_APIENTRY *glTexEnvi_t) (GLenum, GLenum, GLint);
-typedef void (GL_APIENTRY *glTexEnvx_t) (GLenum, GLenum, GLfixed);
-typedef void (GL_APIENTRY *glTexEnviv_t) (GLenum, GLenum, const GLint*);
-typedef void (GL_APIENTRY *glTexEnvxv_t) (GLenum, GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glTexImage2D_t) (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
-typedef void (GL_APIENTRY *glTexParameteri_t) (GLenum, GLenum, GLint);
-typedef void (GL_APIENTRY *glTexParameterx_t) (GLenum, GLenum, GLfixed);
-typedef void (GL_APIENTRY *glTexParameteriv_t) (GLenum, GLenum, const GLint*);
-typedef void (GL_APIENTRY *glTexParameterxv_t) (GLenum, GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glTexSubImage2D_t) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
-typedef void (GL_APIENTRY *glTranslatex_t) (GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glVertexPointer_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (GL_APIENTRY *glViewport_t) (GLint, GLint, GLsizei, GLsizei);
-typedef void (GL_APIENTRY *glPointSizePointerOES_t) (GLenum, GLsizei, const GLvoid*);
-typedef void (GL_APIENTRY *glBlendEquationSeparateOES_t) (GLenum, GLenum);
-typedef void (GL_APIENTRY *glBlendFuncSeparateOES_t) (GLenum, GLenum, GLenum, GLenum);
-typedef void (GL_APIENTRY *glBlendEquationOES_t) (GLenum);
-typedef void (GL_APIENTRY *glDrawTexsOES_t) (GLshort, GLshort, GLshort, GLshort, GLshort);
-typedef void (GL_APIENTRY *glDrawTexiOES_t) (GLint, GLint, GLint, GLint, GLint);
-typedef void (GL_APIENTRY *glDrawTexxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glDrawTexsvOES_t) (const GLshort*);
-typedef void (GL_APIENTRY *glDrawTexivOES_t) (const GLint*);
-typedef void (GL_APIENTRY *glDrawTexxvOES_t) (const GLfixed*);
-typedef void (GL_APIENTRY *glDrawTexfOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glDrawTexfvOES_t) (const GLfloat*);
-typedef void (GL_APIENTRY *glEGLImageTargetTexture2DOES_t) (GLenum, GLeglImageOES);
-typedef void (GL_APIENTRY *glEGLImageTargetRenderbufferStorageOES_t) (GLenum, GLeglImageOES);
-typedef void (GL_APIENTRY *glAlphaFuncxOES_t) (GLenum, GLclampx);
-typedef void (GL_APIENTRY *glClearColorxOES_t) (GLclampx, GLclampx, GLclampx, GLclampx);
-typedef void (GL_APIENTRY *glClearDepthxOES_t) (GLclampx);
-typedef void (GL_APIENTRY *glClipPlanexOES_t) (GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glColor4xOES_t) (GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glDepthRangexOES_t) (GLclampx, GLclampx);
-typedef void (GL_APIENTRY *glFogxOES_t) (GLenum, GLfixed);
-typedef void (GL_APIENTRY *glFogxvOES_t) (GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glFrustumxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glGetClipPlanexOES_t) (GLenum, GLfixed);
-typedef void (GL_APIENTRY *glGetFixedvOES_t) (GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glGetLightxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glGetMaterialxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glGetTexEnvxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glGetTexParameterxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glLightModelxOES_t) (GLenum, GLfixed);
-typedef void (GL_APIENTRY *glLightModelxvOES_t) (GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glLightxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (GL_APIENTRY *glLightxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glLineWidthxOES_t) (GLfixed);
-typedef void (GL_APIENTRY *glLoadMatrixxOES_t) (const GLfixed*);
-typedef void (GL_APIENTRY *glMaterialxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (GL_APIENTRY *glMaterialxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glMultMatrixxOES_t) (const GLfixed*);
-typedef void (GL_APIENTRY *glMultiTexCoord4xOES_t) (GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glNormal3xOES_t) (GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glOrthoxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glPointParameterxOES_t) (GLenum, GLfixed);
-typedef void (GL_APIENTRY *glPointParameterxvOES_t) (GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glPointSizexOES_t) (GLfixed);
-typedef void (GL_APIENTRY *glPolygonOffsetxOES_t) (GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glRotatexOES_t) (GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glSampleCoveragexOES_t) (GLclampx, GLboolean);
-typedef void (GL_APIENTRY *glScalexOES_t) (GLfixed, GLfixed, GLfixed);
-typedef void (GL_APIENTRY *glTexEnvxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (GL_APIENTRY *glTexEnvxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glTexParameterxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (GL_APIENTRY *glTexParameterxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glTranslatexOES_t) (GLfixed, GLfixed, GLfixed);
-typedef GLboolean (GL_APIENTRY *glIsRenderbufferOES_t) (GLuint);
-typedef void (GL_APIENTRY *glBindRenderbufferOES_t) (GLenum, GLuint);
-typedef void (GL_APIENTRY *glDeleteRenderbuffersOES_t) (GLsizei, const GLuint*);
-typedef void (GL_APIENTRY *glGenRenderbuffersOES_t) (GLsizei, GLuint*);
-typedef void (GL_APIENTRY *glRenderbufferStorageOES_t) (GLenum, GLenum, GLsizei, GLsizei);
-typedef void (GL_APIENTRY *glGetRenderbufferParameterivOES_t) (GLenum, GLenum, GLint*);
-typedef GLboolean (GL_APIENTRY *glIsFramebufferOES_t) (GLuint);
-typedef void (GL_APIENTRY *glBindFramebufferOES_t) (GLenum, GLuint);
-typedef void (GL_APIENTRY *glDeleteFramebuffersOES_t) (GLsizei, const GLuint*);
-typedef void (GL_APIENTRY *glGenFramebuffersOES_t) (GLsizei, GLuint*);
-typedef GLenum (GL_APIENTRY *glCheckFramebufferStatusOES_t) (GLenum);
-typedef void (GL_APIENTRY *glFramebufferRenderbufferOES_t) (GLenum, GLenum, GLenum, GLuint);
-typedef void (GL_APIENTRY *glFramebufferTexture2DOES_t) (GLenum, GLenum, GLenum, GLuint, GLint);
-typedef void (GL_APIENTRY *glGetFramebufferAttachmentParameterivOES_t) (GLenum, GLenum, GLenum, GLint*);
-typedef void (GL_APIENTRY *glGenerateMipmapOES_t) (GLenum);
-typedef void* (GL_APIENTRY *glMapBufferOES_t) (GLenum, GLenum);
-typedef GLboolean (GL_APIENTRY *glUnmapBufferOES_t) (GLenum);
-typedef void (GL_APIENTRY *glGetBufferPointervOES_t) (GLenum, GLenum, GLvoid*);
-typedef void (GL_APIENTRY *glCurrentPaletteMatrixOES_t) (GLuint);
-typedef void (GL_APIENTRY *glLoadPaletteFromModelViewMatrixOES_t) ();
-typedef void (GL_APIENTRY *glMatrixIndexPointerOES_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef void (GL_APIENTRY *glWeightPointerOES_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef GLbitfield (GL_APIENTRY *glQueryMatrixxOES_t) (GLfixed, GLint);
-typedef void (GL_APIENTRY *glDepthRangefOES_t) (GLclampf, GLclampf);
-typedef void (GL_APIENTRY *glFrustumfOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glOrthofOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (GL_APIENTRY *glClipPlanefOES_t) (GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glGetClipPlanefOES_t) (GLenum, GLfloat);
-typedef void (GL_APIENTRY *glClearDepthfOES_t) (GLclampf);
-typedef void (GL_APIENTRY *glTexGenfOES_t) (GLenum, GLenum, GLfloat);
-typedef void (GL_APIENTRY *glTexGenfvOES_t) (GLenum, GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glTexGeniOES_t) (GLenum, GLenum, GLint);
-typedef void (GL_APIENTRY *glTexGenivOES_t) (GLenum, GLenum, const GLint*);
-typedef void (GL_APIENTRY *glTexGenxOES_t) (GLenum, GLenum, GLfixed);
-typedef void (GL_APIENTRY *glTexGenxvOES_t) (GLenum, GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glGetTexGenfvOES_t) (GLenum, GLenum, GLfloat*);
-typedef void (GL_APIENTRY *glGetTexGenivOES_t) (GLenum, GLenum, GLint*);
-typedef void (GL_APIENTRY *glGetTexGenxvOES_t) (GLenum, GLenum, GLfixed*);
-typedef void (GL_APIENTRY *glBindVertexArrayOES_t) (GLuint);
-typedef void (GL_APIENTRY *glDeleteVertexArraysOES_t) (GLsizei, const GLuint*);
-typedef void (GL_APIENTRY *glGenVertexArraysOES_t) (GLsizei, GLuint*);
-typedef GLboolean (GL_APIENTRY *glIsVertexArrayOES_t) (GLuint);
-typedef void (GL_APIENTRY *glDiscardFramebufferEXT_t) (GLenum, GLsizei, const GLenum*);
-typedef void (GL_APIENTRY *glMultiDrawArraysEXT_t) (GLenum, GLint*, GLsizei*, GLsizei);
-typedef void (GL_APIENTRY *glMultiDrawElementsEXT_t) (GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei);
-typedef void (GL_APIENTRY *glClipPlanefIMG_t) (GLenum, const GLfloat*);
-typedef void (GL_APIENTRY *glClipPlanexIMG_t) (GLenum, const GLfixed*);
-typedef void (GL_APIENTRY *glRenderbufferStorageMultisampleIMG_t) (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-typedef void (GL_APIENTRY *glFramebufferTexture2DMultisampleIMG_t) (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
-typedef void (GL_APIENTRY *glDeleteFencesNV_t) (GLsizei, const GLuint*);
-typedef void (GL_APIENTRY *glGenFencesNV_t) (GLsizei, GLuint*);
-typedef GLboolean (GL_APIENTRY *glIsFenceNV_t) (GLuint);
-typedef GLboolean (GL_APIENTRY *glTestFenceNV_t) (GLuint);
-typedef void (GL_APIENTRY *glGetFenceivNV_t) (GLuint, GLenum, GLint*);
-typedef void (GL_APIENTRY *glFinishFenceNV_t) (GLuint);
-typedef void (GL_APIENTRY *glSetFenceNV_t) (GLuint, GLenum);
-typedef void (GL_APIENTRY *glGetDriverControlsQCOM_t) (GLint*, GLsizei, GLuint*);
-typedef void (GL_APIENTRY *glGetDriverControlStringQCOM_t) (GLuint, GLsizei, GLsizei*, GLchar*);
-typedef void (GL_APIENTRY *glEnableDriverControlQCOM_t) (GLuint);
-typedef void (GL_APIENTRY *glDisableDriverControlQCOM_t) (GLuint);
-typedef void (GL_APIENTRY *glExtGetTexturesQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (GL_APIENTRY *glExtGetBuffersQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (GL_APIENTRY *glExtGetRenderbuffersQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (GL_APIENTRY *glExtGetFramebuffersQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (GL_APIENTRY *glExtGetTexLevelParameterivQCOM_t) (GLuint, GLenum, GLint, GLenum, GLint*);
-typedef void (GL_APIENTRY *glExtTexObjectStateOverrideiQCOM_t) (GLenum, GLenum, GLint);
-typedef void (GL_APIENTRY *glExtGetTexSubImageQCOM_t) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
-typedef void (GL_APIENTRY *glExtGetBufferPointervQCOM_t) (GLenum, GLvoid*);
-typedef void (GL_APIENTRY *glExtGetShadersQCOM_t) (GLuint*, GLint, GLint*);
-typedef void (GL_APIENTRY *glExtGetProgramsQCOM_t) (GLuint*, GLint, GLint*);
-typedef GLboolean (GL_APIENTRY *glExtIsProgramBinaryQCOM_t) (GLuint);
-typedef void (GL_APIENTRY *glExtGetProgramBinarySourceQCOM_t) (GLuint, GLenum, GLchar*, GLint*);
-typedef void (GL_APIENTRY *glStartTilingQCOM_t) (GLuint, GLuint, GLuint, GLuint, GLbitfield);
-typedef void (GL_APIENTRY *glEndTilingQCOM_t) (GLbitfield);
-
-
-#endif
diff --git a/distrib/android-emugl/host/libs/libOpenglRender/render_api.cpp b/distrib/android-emugl/host/libs/libOpenglRender/render_api.cpp
deleted file mode 100644
index 086afaafb..000000000
--- a/distrib/android-emugl/host/libs/libOpenglRender/render_api.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* Copyright (C) 2011-2015 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#include "OpenglRender/render_api.h"
-
-#include "ErrorLog.h"
-#include "OpenGLESDispatch/EGLDispatch.h"
-#include "OpenGLESDispatch/GLESv1Dispatch.h"
-#include "OpenGLESDispatch/GLESv2Dispatch.h"
-#include "RenderLibImpl.h"
-
-#include <memory>
-
-GLESv2Dispatch s_gles2;
-GLESv1Dispatch s_gles1;
-
-RENDER_APICALL emugl::RenderLibPtr RENDER_APIENTRY initLibrary()
-{
- //
- // Load EGL Plugin
- //
- if (!init_egl_dispatch()) {
- // Failed to load EGL
- printf("Failed to init_egl_dispatch\n");
- return nullptr;
- }
-
- //
- // Load GLES Plugin
- //
- if (!gles1_dispatch_init(&s_gles1)) {
- // Failed to load GLES
- ERR("Failed to gles1_dispatch_init\n");
- return nullptr;
- }
-
- /* failure to init the GLES2 dispatch table is not fatal */
- if (!gles2_dispatch_init(&s_gles2)) {
- ERR("Failed to gles2_dispatch_init\n");
- return nullptr;
- }
-
- return emugl::RenderLibPtr(new emugl::RenderLibImpl());
-}
diff --git a/distrib/android-emugl/host/libs/renderControl_dec/Android.mk b/distrib/android-emugl/host/libs/renderControl_dec/Android.mk
deleted file mode 100644
index 9013065c4..000000000
--- a/distrib/android-emugl/host/libs/renderControl_dec/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-
-### host library ############################################
-$(call emugl-begin-static-library,lib_renderControl_dec)
-$(call emugl-import,libOpenglCodecCommon)
-$(call emugl-gen-decoder,$(LOCAL_PATH),renderControl)
-# For renderControl_types.h
-$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
-
-$(call emugl-export,CFLAGS,$(EMUGL_USER_CFLAGS))
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/host/libs/renderControl_dec/renderControl_types.h b/distrib/android-emugl/host/libs/renderControl_dec/renderControl_types.h
deleted file mode 100644
index da215bb49..000000000
--- a/distrib/android-emugl/host/libs/renderControl_dec/renderControl_types.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* Copyright 2011 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <stdint.h>
-#include <EGL/egl.h>
-#include "glUtils.h"
-
-// values for 'param' argument of rcGetFBParam
-#define FB_WIDTH 1
-#define FB_HEIGHT 2
-#define FB_XDPI 3
-#define FB_YDPI 4
-#define FB_FPS 5
-#define FB_MIN_SWAP_INTERVAL 6
-#define FB_MAX_SWAP_INTERVAL 7
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/Android.mk b/distrib/android-emugl/shared/OpenglCodecCommon/Android.mk
deleted file mode 100644
index e5cefae10..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# This build script corresponds to a library containing many definitions
-# common to both the guest and the host. They relate to
-#
-LOCAL_PATH := $(call my-dir)
-
-commonSources := \
- glUtils.cpp \
- ChecksumCalculator.cpp \
- ChecksumCalculatorThreadInfo.cpp \
-
-host_commonSources := $(commonSources)
-
-host_commonLdLibs := $(CXX_STD_LIB)
-
-### OpenglCodecCommon host ##############################################
-$(call emugl-begin-static-library,libOpenglCodecCommon)
-
-LOCAL_SRC_FILES := $(host_commonSources)
-$(call emugl-import, libemugl_common)
-$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/host/include/OpenglRender $(LOCAL_PATH))
-$(call emugl-export,LDLIBS,$(host_commonLdLibs))
-$(call emugl-end-module)
-
-
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.cpp b/distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.cpp
deleted file mode 100644
index 081e157cb..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-* Copyright (C) 2016 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "ChecksumCalculatorThreadInfo.h"
-
-#include "emugl/common/crash_reporter.h"
-#include "emugl/common/lazy_instance.h"
-#include "emugl/common/thread_store.h"
-
-#include <atomic>
-#include <string>
-
-#include <assert.h>
-#include <stdio.h>
-
-namespace {
-
-class ChecksumCalculatorThreadStore : public ::emugl::ThreadStore {
-public:
- ChecksumCalculatorThreadStore() : ::emugl::ThreadStore(nullptr) {}
-};
-
-#ifdef TRACE_CHECKSUMHELPER
-std::atomic<size_t> sNumInstances(0);
-#endif // TRACE_CHECKSUMHELPER
-}
-
-static ::emugl::LazyInstance<ChecksumCalculatorThreadStore> s_tls =
- LAZY_INSTANCE_INIT;
-
-static ChecksumCalculatorThreadInfo* getChecksumCalculatorThreadInfo() {
- return static_cast<ChecksumCalculatorThreadInfo*>(s_tls->get());
-}
-
-ChecksumCalculatorThreadInfo::ChecksumCalculatorThreadInfo() {
- LOG_CHECKSUMHELPER("%s: Checksum thread created (%u instances)\n",
- __FUNCTION__, (unsigned int)(++sNumInstances));
- s_tls->set(this);
-}
-
-ChecksumCalculatorThreadInfo::~ChecksumCalculatorThreadInfo() {
- LOG_CHECKSUMHELPER("%s: GLprotocol destroyed (%u instances)\n",
- __FUNCTION__, (unsigned int)(--sNumInstances));
- s_tls->set(nullptr);
-}
-
-ChecksumCalculator& ChecksumCalculatorThreadInfo::get() {
- return getChecksumCalculatorThreadInfo()->m_protocol;
-}
-
-bool ChecksumCalculatorThreadInfo::setVersion(uint32_t version) {
- return getChecksumCalculatorThreadInfo()->m_protocol.setVersion(version);
-}
-
-bool ChecksumCalculatorThreadInfo::writeChecksum(ChecksumCalculator* calc,
- void* buf,
- size_t bufLen,
- void* outputChecksum,
- size_t outputChecksumLen) {
- calc->addBuffer(buf, bufLen);
- return calc->writeChecksum(outputChecksum, outputChecksumLen);
-}
-
-bool ChecksumCalculatorThreadInfo::validate(ChecksumCalculator* calc,
- void* buf,
- size_t bufLen,
- void* checksum,
- size_t checksumLen) {
- calc->addBuffer(buf, bufLen);
- return calc->validate(checksum, checksumLen);
-}
-
-void ChecksumCalculatorThreadInfo::validOrDie(ChecksumCalculator* calc,
- void* buf,
- size_t bufLen,
- void* checksum,
- size_t checksumLen,
- const char* message) {
- if (!validate(calc, buf, bufLen, checksum, checksumLen)) {
- emugl_crash_reporter(message);
- }
-}
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/ErrorLog.h b/distrib/android-emugl/shared/OpenglCodecCommon/ErrorLog.h
deleted file mode 100644
index 4cad61f84..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/ErrorLog.h
+++ /dev/null
@@ -1,27 +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 _ERROR_LOG_H_
-#define _ERROR_LOG_H_
-
-#include <stdio.h>
-#define ERR(...) fprintf(stderr, __VA_ARGS__)
-#ifdef EMUGL_DEBUG
-# define DBG(...) fprintf(stderr, __VA_ARGS__)
-#else
-# define DBG(...) ((void)0)
-#endif
-
-#endif // _ERROR_LOG_H_
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/FixedBuffer.h b/distrib/android-emugl/shared/OpenglCodecCommon/FixedBuffer.h
deleted file mode 100644
index 30b9a80ee..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/FixedBuffer.h
+++ /dev/null
@@ -1,53 +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 _FIXED_BUFFER_H
-#define _FIXED_BUFFER_H
-
-class FixedBuffer {
-public:
- FixedBuffer(size_t initialSize = 0) {
- m_buffer = NULL;
- m_bufferLen = 0;
- alloc(m_bufferLen);
- }
-
- ~FixedBuffer() {
- delete [] m_buffer;
- m_bufferLen = 0;
- }
-
- void * alloc(size_t size) {
- if (m_bufferLen >= size)
- return (void *)(m_buffer);
-
- if (m_buffer != NULL)
- delete[] m_buffer;
-
- m_bufferLen = size;
- m_buffer = new unsigned char[m_bufferLen];
- if (m_buffer == NULL)
- m_bufferLen = 0;
-
- return m_buffer;
- }
- void *ptr() { return m_buffer; }
- size_t len() { return m_bufferLen; }
-private:
- unsigned char *m_buffer;
- size_t m_bufferLen;
-};
-
-#endif
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/GLClientState.cpp b/distrib/android-emugl/shared/OpenglCodecCommon/GLClientState.cpp
deleted file mode 100644
index b02131c41..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/GLClientState.cpp
+++ /dev/null
@@ -1,416 +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 "GLClientState.h"
-#include "ErrorLog.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "glUtils.h"
-
-#ifndef MAX
-#define MAX(a, b) ((a) < (b) ? (b) : (a))
-#endif
-
-GLClientState::GLClientState(int nLocations)
-{
- if (nLocations < LAST_LOCATION) {
- nLocations = LAST_LOCATION;
- }
- m_nLocations = nLocations;
- m_states = new VertexAttribState[m_nLocations];
- for (int i = 0; i < m_nLocations; i++) {
- m_states[i].enabled = 0;
- m_states[i].enableDirty = false;
- }
- m_currentArrayVbo = 0;
- m_currentIndexVbo = 0;
- // init gl constans;
- m_states[VERTEX_LOCATION].glConst = GL_VERTEX_ARRAY;
- m_states[NORMAL_LOCATION].glConst = GL_NORMAL_ARRAY;
- m_states[COLOR_LOCATION].glConst = GL_COLOR_ARRAY;
- m_states[POINTSIZE_LOCATION].glConst = GL_POINT_SIZE_ARRAY_OES;
- m_states[TEXCOORD0_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD1_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD2_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD3_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD4_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD5_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD6_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[TEXCOORD7_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
- m_states[MATRIXINDEX_LOCATION].glConst = GL_MATRIX_INDEX_ARRAY_OES;
- m_states[WEIGHT_LOCATION].glConst = GL_WEIGHT_ARRAY_OES;
- m_activeTexture = 0;
- m_currentProgram = 0;
-
- m_pixelStore.unpack_alignment = 4;
- m_pixelStore.pack_alignment = 4;
-
- memset(m_tex.unit, 0, sizeof(m_tex.unit));
- m_tex.activeUnit = &m_tex.unit[0];
- m_tex.textures = NULL;
- m_tex.numTextures = 0;
- m_tex.allocTextures = 0;
-}
-
-GLClientState::~GLClientState()
-{
- delete m_states;
-}
-
-void GLClientState::enable(int location, int state)
-{
- if (!validLocation(location)) {
- return;
- }
-
- m_states[location].enableDirty |= (state != m_states[location].enabled);
- m_states[location].enabled = state;
-}
-
-void GLClientState::setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, const void *data)
-{
- if (!validLocation(location)) {
- return;
- }
- m_states[location].size = size;
- m_states[location].type = type;
- m_states[location].stride = stride;
- m_states[location].data = (void*)data;
- m_states[location].bufferObject = m_currentArrayVbo;
- m_states[location].elementSize = glSizeof(type) * size;
- m_states[location].normalized = normalized;
-}
-
-void GLClientState::setBufferObject(int location, GLuint id)
-{
- if (!validLocation(location)) {
- return;
- }
-
- m_states[location].bufferObject = id;
-}
-
-const GLClientState::VertexAttribState * GLClientState::getState(int location)
-{
- if (!validLocation(location)) {
- return NULL;
- }
- return & m_states[location];
-}
-
-const GLClientState::VertexAttribState * GLClientState::getStateAndEnableDirty(int location, bool *enableChanged)
-{
- if (!validLocation(location)) {
- return NULL;
- }
-
- if (enableChanged) {
- *enableChanged = m_states[location].enableDirty;
- }
-
- m_states[location].enableDirty = false;
- return & m_states[location];
-}
-
-int GLClientState::getLocation(GLenum loc)
-{
- int retval;
-
- switch(loc) {
- case GL_VERTEX_ARRAY:
- retval = int(VERTEX_LOCATION);
- break;
- case GL_NORMAL_ARRAY:
- retval = int(NORMAL_LOCATION);
- break;
- case GL_COLOR_ARRAY:
- retval = int(COLOR_LOCATION);
- break;
- case GL_POINT_SIZE_ARRAY_OES:
- retval = int(POINTSIZE_LOCATION);
- break;
- case GL_TEXTURE_COORD_ARRAY:
- retval = int (TEXCOORD0_LOCATION + m_activeTexture);
- break;
- case GL_MATRIX_INDEX_ARRAY_OES:
- retval = int (MATRIXINDEX_LOCATION);
- break;
- case GL_WEIGHT_ARRAY_OES:
- retval = int (WEIGHT_LOCATION);
- break;
- default:
- retval = loc;
- }
- return retval;
-}
-
-void GLClientState::getClientStatePointer(GLenum pname, GLvoid** params)
-{
- const GLClientState::VertexAttribState *state = NULL;
- switch (pname) {
- case GL_VERTEX_ARRAY_POINTER: {
- state = getState(GLClientState::VERTEX_LOCATION);
- break;
- }
- case GL_NORMAL_ARRAY_POINTER: {
- state = getState(GLClientState::NORMAL_LOCATION);
- break;
- }
- case GL_COLOR_ARRAY_POINTER: {
- state = getState(GLClientState::COLOR_LOCATION);
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_POINTER: {
- state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
- break;
- }
- case GL_POINT_SIZE_ARRAY_POINTER_OES: {
- state = getState(GLClientState::POINTSIZE_LOCATION);
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_POINTER_OES: {
- state = getState(GLClientState::MATRIXINDEX_LOCATION);
- break;
- }
- case GL_WEIGHT_ARRAY_POINTER_OES: {
- state = getState(GLClientState::WEIGHT_LOCATION);
- break;
- }
- }
- if (state && params)
- *params = state->data;
-}
-
-int GLClientState::setPixelStore(GLenum param, GLint value)
-{
- int retval = 0;
- switch(param) {
- case GL_UNPACK_ALIGNMENT:
- if (value == 1 || value == 2 || value == 4 || value == 8) {
- m_pixelStore.unpack_alignment = value;
- } else {
- retval = GL_INVALID_VALUE;
- }
- break;
- case GL_PACK_ALIGNMENT:
- if (value == 1 || value == 2 || value == 4 || value == 8) {
- m_pixelStore.pack_alignment = value;
- } else {
- retval = GL_INVALID_VALUE;
- }
- break;
- default:
- retval = GL_INVALID_ENUM;
- }
- return retval;
-}
-
-
-
-
-size_t GLClientState::pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) const
-{
- int pixelsize = glUtilsPixelBitSize(format, type) >> 3;
-
- int alignment = pack ? m_pixelStore.pack_alignment : m_pixelStore.unpack_alignment;
-
- if (pixelsize == 0 ) {
- ERR("unknown pixel size: width: %d height: %d format: %d type: %d pack: %d align: %d\n",
- width, height, format, type, pack, alignment);
- }
- size_t linesize = pixelsize * width;
- size_t aligned_linesize = int(linesize / alignment) * alignment;
- if (aligned_linesize < linesize) {
- aligned_linesize += alignment;
- }
- return aligned_linesize * height;
-}
-
-GLenum GLClientState::setActiveTextureUnit(GLenum texture)
-{
- GLuint unit = texture - GL_TEXTURE0;
- if (unit >= MAX_TEXTURE_UNITS) {
- return GL_INVALID_OPERATION;
- }
- m_tex.activeUnit = &m_tex.unit[unit];
- return GL_NO_ERROR;
-}
-
-GLenum GLClientState::getActiveTextureUnit() const
-{
- return GL_TEXTURE0 + (m_tex.activeUnit - &m_tex.unit[0]);
-}
-
-void GLClientState::enableTextureTarget(GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_2D:
- m_tex.activeUnit->enables |= (1u << TEXTURE_2D);
- break;
- case GL_TEXTURE_EXTERNAL_OES:
- m_tex.activeUnit->enables |= (1u << TEXTURE_EXTERNAL);
- break;
- }
-}
-
-void GLClientState::disableTextureTarget(GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_2D:
- m_tex.activeUnit->enables &= ~(1u << TEXTURE_2D);
- break;
- case GL_TEXTURE_EXTERNAL_OES:
- m_tex.activeUnit->enables &= ~(1u << TEXTURE_EXTERNAL);
- break;
- }
-}
-
-GLenum GLClientState::getPriorityEnabledTarget(GLenum allDisabled) const
-{
- unsigned int enables = m_tex.activeUnit->enables;
- if (enables & (1u << TEXTURE_EXTERNAL)) {
- return GL_TEXTURE_EXTERNAL_OES;
- } else if (enables & (1u << TEXTURE_2D)) {
- return GL_TEXTURE_2D;
- } else {
- return allDisabled;
- }
-}
-
-int GLClientState::compareTexId(const void* pid, const void* prec)
-{
- const GLuint* id = (const GLuint*)pid;
- const TextureRec* rec = (const TextureRec*)prec;
- return (GLint)(*id) - (GLint)rec->id;
-}
-
-GLenum GLClientState::bindTexture(GLenum target, GLuint texture,
- GLboolean* firstUse)
-{
- GLboolean first = GL_FALSE;
- TextureRec* texrec = NULL;
- if (texture != 0) {
- if (m_tex.textures) {
- texrec = (TextureRec*)bsearch(&texture, m_tex.textures,
- m_tex.numTextures, sizeof(TextureRec), compareTexId);
- }
- if (!texrec) {
- if (!(texrec = addTextureRec(texture, target))) {
- return GL_OUT_OF_MEMORY;
- }
- first = GL_TRUE;
- }
- if (target != texrec->target) {
- return GL_INVALID_OPERATION;
- }
- }
-
- switch (target) {
- case GL_TEXTURE_2D:
- m_tex.activeUnit->texture[TEXTURE_2D] = texture;
- break;
- case GL_TEXTURE_EXTERNAL_OES:
- m_tex.activeUnit->texture[TEXTURE_EXTERNAL] = texture;
- break;
- }
-
- if (firstUse) {
- *firstUse = first;
- }
-
- return GL_NO_ERROR;
-}
-
-GLClientState::TextureRec* GLClientState::addTextureRec(GLuint id,
- GLenum target)
-{
- if (m_tex.numTextures == m_tex.allocTextures) {
- const GLuint MAX_TEXTURES = 0xFFFFFFFFu;
-
- GLuint newAlloc;
- if (MAX_TEXTURES - m_tex.allocTextures >= m_tex.allocTextures) {
- newAlloc = MAX(4, 2 * m_tex.allocTextures);
- } else {
- if (m_tex.allocTextures == MAX_TEXTURES) {
- return NULL;
- }
- newAlloc = MAX_TEXTURES;
- }
-
- TextureRec* newTextures = (TextureRec*)realloc(m_tex.textures,
- newAlloc * sizeof(TextureRec));
- if (!newTextures) {
- return NULL;
- }
-
- m_tex.textures = newTextures;
- m_tex.allocTextures = newAlloc;
- }
-
- TextureRec* tex = m_tex.textures + m_tex.numTextures;
- TextureRec* prev = tex - 1;
- while (tex != m_tex.textures && id < prev->id) {
- *tex-- = *prev--;
- }
- tex->id = id;
- tex->target = target;
- m_tex.numTextures++;
-
- return tex;
-}
-
-GLuint GLClientState::getBoundTexture(GLenum target) const
-{
- switch (target) {
- case GL_TEXTURE_2D:
- return m_tex.activeUnit->texture[TEXTURE_2D];
- case GL_TEXTURE_EXTERNAL_OES:
- return m_tex.activeUnit->texture[TEXTURE_EXTERNAL];
- default:
- return 0;
- }
-}
-
-void GLClientState::deleteTextures(GLsizei n, const GLuint* textures)
-{
- // Updating the textures array could be made more efficient when deleting
- // several textures:
- // - compacting the array could be done in a single pass once the deleted
- // textures are marked, or
- // - could swap deleted textures to the end and re-sort.
- TextureRec* texrec;
- for (const GLuint* texture = textures; texture != textures + n; texture++) {
- texrec = (TextureRec*)bsearch(texture, m_tex.textures,
- m_tex.numTextures, sizeof(TextureRec), compareTexId);
- if (texrec) {
- const TextureRec* end = m_tex.textures + m_tex.numTextures;
- memmove(texrec, texrec + 1,
- (end - texrec - 1) * sizeof(TextureRec));
- m_tex.numTextures--;
-
- for (TextureUnit* unit = m_tex.unit;
- unit != m_tex.unit + MAX_TEXTURE_UNITS;
- unit++)
- {
- if (unit->texture[TEXTURE_2D] == *texture) {
- unit->texture[TEXTURE_2D] = 0;
- } else if (unit->texture[TEXTURE_EXTERNAL] == *texture) {
- unit->texture[TEXTURE_EXTERNAL] = 0;
- }
- }
- }
- }
-}
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/GLClientState.h b/distrib/android-emugl/shared/OpenglCodecCommon/GLClientState.h
deleted file mode 100644
index c86329b44..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/GLClientState.h
+++ /dev/null
@@ -1,441 +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_CLIENT_STATE_H_
-#define _GL_CLIENT_STATE_H_
-
-#define GL_API
-#ifndef ANDROID
-#define GL_APIENTRY
-#define GL_APIENTRYP
-#endif
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "ErrorLog.h"
-#include "codec_defs.h"
-
-class GLClientState {
-public:
- typedef enum {
- VERTEX_LOCATION = 0,
- NORMAL_LOCATION = 1,
- COLOR_LOCATION = 2,
- POINTSIZE_LOCATION = 3,
- TEXCOORD0_LOCATION = 4,
- TEXCOORD1_LOCATION = 5,
- TEXCOORD2_LOCATION = 6,
- TEXCOORD3_LOCATION = 7,
- TEXCOORD4_LOCATION = 8,
- TEXCOORD5_LOCATION = 9,
- TEXCOORD6_LOCATION = 10,
- TEXCOORD7_LOCATION = 11,
- MATRIXINDEX_LOCATION = 12,
- WEIGHT_LOCATION = 13,
- LAST_LOCATION = 14
- } StateLocation;
-
- typedef struct {
- GLint enabled;
- GLint size;
- GLenum type;
- GLsizei stride;
- void *data;
- GLuint bufferObject;
- GLenum glConst;
- unsigned int elementSize;
- bool enableDirty; // true if any enable state has changed since last draw
- bool normalized;
- } VertexAttribState;
-
- typedef struct {
- int unpack_alignment;
- int pack_alignment;
- } PixelStoreState;
-
- enum {
- MAX_TEXTURE_UNITS = 32,
- };
-
-public:
- GLClientState(int nLocations = CODEC_MAX_VERTEX_ATTRIBUTES);
- ~GLClientState();
- int nLocations() { return m_nLocations; }
- const PixelStoreState *pixelStoreState() { return &m_pixelStore; }
- int setPixelStore(GLenum param, GLint value);
- GLuint currentArrayVbo() { return m_currentArrayVbo; }
- GLuint currentIndexVbo() { return m_currentIndexVbo; }
- void enable(int location, int state);
- void setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, const void *data);
- void setBufferObject(int location, GLuint id);
- const VertexAttribState *getState(int location);
- const VertexAttribState *getStateAndEnableDirty(int location, bool *enableChanged);
- int getLocation(GLenum loc);
- void setActiveTexture(int texUnit) {m_activeTexture = texUnit; };
- int getActiveTexture() const { return m_activeTexture; }
-
- int bindBuffer(GLenum target, GLuint id)
- {
- int err = 0;
- switch(target) {
- case GL_ARRAY_BUFFER:
- m_currentArrayVbo = id;
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- m_currentIndexVbo = id;
- break;
- default:
- err = -1;
- }
- return err;
- }
-
- int getBuffer(GLenum target)
- {
- int ret=0;
- switch (target) {
- case GL_ARRAY_BUFFER:
- ret = m_currentArrayVbo;
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- ret = m_currentIndexVbo;
- break;
- default:
- ret = -1;
- }
- return ret;
- }
- size_t pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) const;
-
- void setCurrentProgram(GLint program) { m_currentProgram = program; }
- GLint currentProgram() const { return m_currentProgram; }
-
- /* OES_EGL_image_external
- *
- * These functions manipulate GL state which interacts with the
- * OES_EGL_image_external extension, to support client-side emulation on
- * top of host implementations that don't have it.
- *
- * Most of these calls should only be used with TEXTURE_2D or
- * TEXTURE_EXTERNAL_OES texture targets; TEXTURE_CUBE_MAP or other extension
- * targets should bypass this. An exception is bindTexture(), which should
- * see all glBindTexture() calls for any target.
- */
-
- // glActiveTexture(GL_TEXTURE0 + i)
- // Sets the active texture unit. Up to MAX_TEXTURE_UNITS are supported.
- GLenum setActiveTextureUnit(GLenum texture);
- GLenum getActiveTextureUnit() const;
-
- // glEnable(GL_TEXTURE_(2D|EXTERNAL_OES))
- void enableTextureTarget(GLenum target);
-
- // glDisable(GL_TEXTURE_(2D|EXTERNAL_OES))
- void disableTextureTarget(GLenum target);
-
- // Implements the target priority logic:
- // * Return GL_TEXTURE_EXTERNAL_OES if enabled, else
- // * Return GL_TEXTURE_2D if enabled, else
- // * Return the allDisabled value.
- // For some cases passing GL_TEXTURE_2D for allDisabled makes callee code
- // simpler; for other cases passing a recognizable enum like GL_ZERO or
- // GL_INVALID_ENUM is appropriate.
- GLenum getPriorityEnabledTarget(GLenum allDisabled) const;
-
- // glBindTexture(GL_TEXTURE_*, ...)
- // Set the target binding of the active texture unit to texture. Returns
- // GL_NO_ERROR on success or GL_INVALID_OPERATION if the texture has
- // previously been bound to a different target. If firstUse is not NULL,
- // it is set to indicate whether this is the first use of the texture.
- // For accurate error detection, bindTexture should be called for *all*
- // targets, not just 2D and EXTERNAL_OES.
- GLenum bindTexture(GLenum target, GLuint texture, GLboolean* firstUse);
-
- // Return the texture currently bound to GL_TEXTURE_(2D|EXTERNAL_OES).
- GLuint getBoundTexture(GLenum target) const;
-
- // glDeleteTextures(...)
- // Remove references to the to-be-deleted textures.
- void deleteTextures(GLsizei n, const GLuint* textures);
-
-private:
- PixelStoreState m_pixelStore;
- VertexAttribState *m_states;
- int m_nLocations;
- GLuint m_currentArrayVbo;
- GLuint m_currentIndexVbo;
- int m_activeTexture;
- GLint m_currentProgram;
-
- bool validLocation(int location) { return (location >= 0 && location < m_nLocations); }
-
- enum TextureTarget {
- TEXTURE_2D = 0,
- TEXTURE_EXTERNAL = 1,
- TEXTURE_TARGET_COUNT
- };
- struct TextureUnit {
- unsigned int enables;
- GLuint texture[TEXTURE_TARGET_COUNT];
- };
- struct TextureRec {
- GLuint id;
- GLenum target;
- };
- struct TextureState {
- TextureUnit unit[MAX_TEXTURE_UNITS];
- TextureUnit* activeUnit;
- TextureRec* textures;
- GLuint numTextures;
- GLuint allocTextures;
- };
- TextureState m_tex;
-
- static int compareTexId(const void* pid, const void* prec);
- TextureRec* addTextureRec(GLuint id, GLenum target);
-
-public:
- void getClientStatePointer(GLenum pname, GLvoid** params);
-
- template <class T>
- int getVertexAttribParameter(GLuint index, GLenum param, T *ptr)
- {
- bool handled = true;
- const VertexAttribState *vertexAttrib = getState(index);
- if (vertexAttrib == NULL) {
- ERR("getVeterxAttriParameter for non existant index %d\n", index);
- // set gl error;
- return handled;
- }
-
- switch(param) {
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *ptr = (T)(vertexAttrib->bufferObject);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *ptr = (T)(vertexAttrib->enabled);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *ptr = (T)(vertexAttrib->size);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *ptr = (T)(vertexAttrib->stride);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *ptr = (T)(vertexAttrib->type);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *ptr = (T)(vertexAttrib->normalized);
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- handled = false;
- break;
- default:
- handled = false;
- ERR("unknown vertex-attrib parameter param %d\n", param);
- }
- return handled;
- }
-
- template <class T>
- bool getClientStateParameter(GLenum param, T* ptr)
- {
- bool isClientStateParam = false;
- switch (param) {
- case GL_CLIENT_ACTIVE_TEXTURE: {
- GLint tex = getActiveTexture() + GL_TEXTURE0;
- *ptr = tex;
- isClientStateParam = true;
- break;
- }
- case GL_VERTEX_ARRAY_SIZE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_VERTEX_ARRAY_TYPE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_VERTEX_ARRAY_STRIDE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_COLOR_ARRAY_SIZE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_COLOR_ARRAY_TYPE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_COLOR_ARRAY_STRIDE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_NORMAL_ARRAY_TYPE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_NORMAL_ARRAY_STRIDE: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_SIZE: {
- const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_TYPE: {
- const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_STRIDE: {
- const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_POINT_SIZE_ARRAY_TYPE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_POINT_SIZE_ARRAY_STRIDE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_SIZE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_TYPE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_WEIGHT_ARRAY_SIZE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
- *ptr = state->size;
- isClientStateParam = true;
- break;
- }
- case GL_WEIGHT_ARRAY_TYPE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
- *ptr = state->type;
- isClientStateParam = true;
- break;
- }
- case GL_WEIGHT_ARRAY_STRIDE_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
- *ptr = state->stride;
- isClientStateParam = true;
- break;
- }
- case GL_VERTEX_ARRAY_BUFFER_BINDING: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_NORMAL_ARRAY_BUFFER_BINDING: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_COLOR_ARRAY_BUFFER_BINDING: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: {
- const GLClientState::VertexAttribState *state = getState(getActiveTexture()+GLClientState::TEXCOORD0_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: {
- const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
- *ptr = state->bufferObject;
- isClientStateParam = true;
- break;
- }
- case GL_ARRAY_BUFFER_BINDING: {
- int buffer = getBuffer(GL_ARRAY_BUFFER);
- *ptr = buffer;
- isClientStateParam = true;
- break;
- }
- case GL_ELEMENT_ARRAY_BUFFER_BINDING: {
- int buffer = getBuffer(GL_ELEMENT_ARRAY_BUFFER);
- *ptr = buffer;
- isClientStateParam = true;
- break;
- }
- }
- return isClientStateParam;
- }
-
-};
-#endif
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/GLDecoderContextData.h b/distrib/android-emugl/shared/OpenglCodecCommon/GLDecoderContextData.h
deleted file mode 100644
index d5b518980..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/GLDecoderContextData.h
+++ /dev/null
@@ -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 _GL_DECODER_CONTEXT_DATA_H_
-#define _GL_DECODER_CONTEXT_DATA_H_
-
-#include <assert.h>
-#include <string.h>
-#include "FixedBuffer.h"
-#include "codec_defs.h"
-
-class GLDecoderContextData {
-public:
- typedef enum {
- VERTEX_LOCATION = 0,
- NORMAL_LOCATION = 1,
- COLOR_LOCATION = 2,
- POINTSIZE_LOCATION = 3,
- TEXCOORD0_LOCATION = 4,
- TEXCOORD1_LOCATION = 5,
- TEXCOORD2_LOCATION = 6,
- TEXCOORD3_LOCATION = 7,
- TEXCOORD4_LOCATION = 8,
- TEXCOORD5_LOCATION = 9,
- TEXCOORD6_LOCATION = 10,
- TEXCOORD7_LOCATION = 11,
- MATRIXINDEX_LOCATION = 12,
- WEIGHT_LOCATION = 13,
- LAST_LOCATION = 14
- } PointerDataLocation;
-
- GLDecoderContextData(int nLocations = CODEC_MAX_VERTEX_ATTRIBUTES) :
- m_nLocations(nLocations)
- {
- m_pointerData = new FixedBuffer[m_nLocations];
- }
-
- ~GLDecoderContextData() {
- delete [] m_pointerData;
- }
-
- void storePointerData(unsigned int loc, void *data, size_t len) {
-
- assert(loc < (unsigned)m_nLocations);
- m_pointerData[loc].alloc(len);
- memcpy(m_pointerData[loc].ptr(), data, len);
- }
- void *pointerData(unsigned int loc) {
- assert(loc < (unsigned)m_nLocations);
- return m_pointerData[loc].ptr();
- }
-private:
- FixedBuffer *m_pointerData;
- int m_nLocations;
-};
-
-#endif
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/GLErrorLog.h b/distrib/android-emugl/shared/OpenglCodecCommon/GLErrorLog.h
deleted file mode 100644
index e69de29bb..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/GLErrorLog.h
+++ /dev/null
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/GLSharedGroup.cpp b/distrib/android-emugl/shared/OpenglCodecCommon/GLSharedGroup.cpp
deleted file mode 100644
index 59f7b97cf..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/GLSharedGroup.cpp
+++ /dev/null
@@ -1,453 +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 "GLSharedGroup.h"
-
-#include <string.h>
-
-/**** BufferData ****/
-
-BufferData::BufferData() : m_size(0) {};
-
-BufferData::BufferData(GLsizeiptr size, void * data) : m_size(size)
-{
- void* buffer = NULL;
-
- if (size > 0) {
- buffer = m_fixedBuffer.alloc(size);
- if (data) {
- memcpy(buffer, data, size);
- }
- }
-}
-
-/**** ProgramData ****/
-ProgramData::ProgramData() : m_numIndexes(0),
- m_initialized(false),
- m_locShiftWAR(false)
-{
- m_Indexes = NULL;
-}
-
-void ProgramData::initProgramData(GLuint numIndexes)
-{
- m_initialized = true;
- m_numIndexes = numIndexes;
- delete[] m_Indexes;
- m_Indexes = new IndexInfo[numIndexes];
- m_locShiftWAR = false;
-}
-
-bool ProgramData::isInitialized()
-{
- return m_initialized;
-}
-
-ProgramData::~ProgramData()
-{
- delete[] m_Indexes;
- m_Indexes = NULL;
-}
-
-void ProgramData::setIndexInfo(GLuint index, GLint base, GLint size, GLenum type)
-{
- if (index>=m_numIndexes)
- return;
- m_Indexes[index].base = base;
- m_Indexes[index].size = size;
- m_Indexes[index].type = type;
- if (index > 0) {
- m_Indexes[index].appBase = m_Indexes[index-1].appBase +
- m_Indexes[index-1].size;
- }
- else {
- m_Indexes[index].appBase = 0;
- }
- m_Indexes[index].hostLocsPerElement = 1;
- m_Indexes[index].flags = 0;
- m_Indexes[index].samplerValue = 0;
-}
-
-void ProgramData::setIndexFlags(GLuint index, GLuint flags)
-{
- if (index >= m_numIndexes)
- return;
- m_Indexes[index].flags |= flags;
-}
-
-GLuint ProgramData::getIndexForLocation(GLint location)
-{
- GLuint index = m_numIndexes;
- GLint minDist = -1;
- for (GLuint i=0;i<m_numIndexes;++i)
- {
- GLint dist = location - m_Indexes[i].base;
- if (dist >= 0 &&
- (minDist < 0 || dist < minDist)) {
- index = i;
- minDist = dist;
- }
- }
- return index;
-}
-
-GLenum ProgramData::getTypeForLocation(GLint location)
-{
- GLuint index = getIndexForLocation(location);
- if (index<m_numIndexes) {
- return m_Indexes[index].type;
- }
- return 0;
-}
-
-void ProgramData::setupLocationShiftWAR()
-{
- m_locShiftWAR = false;
- for (GLuint i=0; i<m_numIndexes; i++) {
- if (0 != (m_Indexes[i].base & 0xffff)) {
- return;
- }
- }
- // if we have one uniform at location 0, we do not need the WAR.
- if (m_numIndexes > 1) {
- m_locShiftWAR = true;
- }
-}
-
-GLint ProgramData::locationWARHostToApp(GLint hostLoc, GLint arrIndex)
-{
- if (!m_locShiftWAR) return hostLoc;
-
- GLuint index = getIndexForLocation(hostLoc);
- if (index<m_numIndexes) {
- if (arrIndex > 0) {
- m_Indexes[index].hostLocsPerElement =
- (hostLoc - m_Indexes[index].base) / arrIndex;
- }
- return m_Indexes[index].appBase + arrIndex;
- }
- return -1;
-}
-
-GLint ProgramData::locationWARAppToHost(GLint appLoc)
-{
- if (!m_locShiftWAR) return appLoc;
-
- for(GLuint i=0; i<m_numIndexes; i++) {
- GLint elemIndex = appLoc - m_Indexes[i].appBase;
- if (elemIndex >= 0 && elemIndex < m_Indexes[i].size) {
- return m_Indexes[i].base +
- elemIndex * m_Indexes[i].hostLocsPerElement;
- }
- }
- return -1;
-}
-
-GLint ProgramData::getNextSamplerUniform(GLint index, GLint* val, GLenum* target)
-{
- for (GLint i = index + 1; i >= 0 && i < (GLint)m_numIndexes; i++) {
- if (m_Indexes[i].type == GL_SAMPLER_2D) {
- if (val) *val = m_Indexes[i].samplerValue;
- if (target) {
- if (m_Indexes[i].flags & INDEX_FLAG_SAMPLER_EXTERNAL) {
- *target = GL_TEXTURE_EXTERNAL_OES;
- } else {
- *target = GL_TEXTURE_2D;
- }
- }
- return i;
- }
- }
- return -1;
-}
-
-bool ProgramData::setSamplerUniform(GLint appLoc, GLint val, GLenum* target)
-{
- for (GLuint i = 0; i < m_numIndexes; i++) {
- GLint elemIndex = appLoc - m_Indexes[i].appBase;
- if (elemIndex >= 0 && elemIndex < m_Indexes[i].size) {
- if (m_Indexes[i].type == GL_TEXTURE_2D) {
- m_Indexes[i].samplerValue = val;
- if (target) {
- if (m_Indexes[i].flags & INDEX_FLAG_SAMPLER_EXTERNAL) {
- *target = GL_TEXTURE_EXTERNAL_OES;
- } else {
- *target = GL_TEXTURE_2D;
- }
- }
- return true;
- }
- }
- }
- return false;
-}
-
-bool ProgramData::attachShader(GLuint shader)
-{
- size_t n = m_shaders.size();
- for (size_t i = 0; i < n; i++) {
- if (m_shaders[i] == shader) {
- return false;
- }
- }
- m_shaders.append(shader);
- return true;
-}
-
-bool ProgramData::detachShader(GLuint shader)
-{
- size_t n = m_shaders.size();
- for (size_t i = 0; i < n; i++) {
- if (m_shaders[i] == shader) {
- m_shaders.remove(i);
- return true;
- }
- }
- return false;
-}
-
-/***** GLSharedGroup ****/
-
-GLSharedGroup::GLSharedGroup() :
- m_buffers(), m_programs(), m_shaders() {}
-
-GLSharedGroup::~GLSharedGroup() {}
-
-BufferData * GLSharedGroup::getBufferData(GLuint bufferId)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- return m_buffers.get(bufferId);
-}
-
-void GLSharedGroup::addBufferData(GLuint bufferId, GLsizeiptr size, void * data)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- m_buffers.set(bufferId, new BufferData(size, data));
-}
-
-void GLSharedGroup::updateBufferData(GLuint bufferId, GLsizeiptr size, void * data)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- m_buffers.set(bufferId, new BufferData(size, data));
-}
-
-GLenum GLSharedGroup::subUpdateBufferData(GLuint bufferId, GLintptr offset, GLsizeiptr size, void * data)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- BufferData * buf = m_buffers.get(bufferId);
- if ((!buf) || (buf->m_size < offset+size) || (offset < 0) || (size<0)) return GL_INVALID_VALUE;
-
- //it's safe to update now
- memcpy((char*)buf->m_fixedBuffer.ptr() + offset, data, size);
- return GL_NO_ERROR;
-}
-
-void GLSharedGroup::deleteBufferData(GLuint bufferId)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- (void) m_buffers.remove(bufferId);
-}
-
-void GLSharedGroup::addProgramData(GLuint program)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- m_programs.set(program, new ProgramData());
-}
-
-void GLSharedGroup::initProgramData(GLuint program, GLuint numIndexes)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData *pData = m_programs.get(program);
- if (pData) {
- pData->initProgramData(numIndexes);
- }
-}
-
-bool GLSharedGroup::isProgramInitialized(GLuint program)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- return pData && pData->isInitialized();
-}
-
-void GLSharedGroup::deleteProgramData(GLuint program)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- m_programs.remove(program);
-}
-
-void GLSharedGroup::attachShader(GLuint program, GLuint shader)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* programData = m_programs.get(program);
- if (programData && programData->attachShader(shader)) {
- refShaderDataLocked(shader);
- }
-}
-
-void GLSharedGroup::detachShader(GLuint program, GLuint shader)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* programData = m_programs.get(program);
- if (programData && programData->detachShader(shader)) {
- unrefShaderDataLocked(shader);
- }
-}
-
-void GLSharedGroup::setProgramIndexInfo(GLuint program,
- GLuint index,
- GLint base,
- GLint size,
- GLenum type,
- const char* name)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- if (!pData) {
- return;
- }
- pData->setIndexInfo(index,base,size,type);
-
- if (type == GL_SAMPLER_2D) {
- size_t n = pData->getNumShaders();
- for (size_t i = 0; i < n; i++) {
- GLuint shaderId = pData->getShader(i);
- ShaderData* shader = m_shaders.get(shaderId);
- if (!shader) continue;
-#if 0 // TODO(digit): Understand why samplerExternalNames is always empty?
- ShaderData::StringList::iterator nameIter =
- shader->samplerExternalNames.begin();
- ShaderData::StringList::iterator nameEnd =
- shader->samplerExternalNames.end();
- while (nameIter != nameEnd) {
- if (*nameIter == name) {
- pData->setIndexFlags(
- index,
- ProgramData::INDEX_FLAG_SAMPLER_EXTERNAL);
- break;
- }
- ++nameIter;
- }
-#endif
- }
- }
-}
-
-
-GLenum GLSharedGroup::getProgramUniformType(GLuint program, GLint location)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- return pData ? pData->getTypeForLocation(location) : 0;
-}
-
-bool GLSharedGroup::isProgram(GLuint program)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- return (pData != NULL);
-}
-
-void GLSharedGroup::setupLocationShiftWAR(GLuint program)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- if (pData) pData->setupLocationShiftWAR();
-}
-
-GLint GLSharedGroup::locationWARHostToApp(GLuint program,
- GLint hostLoc,
- GLint arrIndex)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- return pData ? pData->locationWARHostToApp(hostLoc, arrIndex) : hostLoc;
-}
-
-GLint GLSharedGroup::locationWARAppToHost(GLuint program, GLint appLoc)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- return pData ? pData->locationWARAppToHost(appLoc) : appLoc;
-}
-
-bool GLSharedGroup::needUniformLocationWAR(GLuint program)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- return pData ? pData->needUniformLocationWAR() : false;
-}
-
-GLint GLSharedGroup::getNextSamplerUniform(GLuint program,
- GLint index,
- GLint* val,
- GLenum* target) const
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- return pData ? pData->getNextSamplerUniform(index, val, target) : -1;
-}
-
-bool GLSharedGroup::setSamplerUniform(GLuint program,
- GLint appLoc,
- GLint val,
- GLenum* target)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ProgramData* pData = m_programs.get(program);
- return pData ? pData->setSamplerUniform(appLoc, val, target) : false;
-}
-
-bool GLSharedGroup::addShaderData(GLuint shader)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ShaderData* data = new ShaderData;
- data->refcount = 1;
- m_shaders.set(shader, data);
- return true;
-}
-
-ShaderData* GLSharedGroup::getShaderData(GLuint shader)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- ShaderData* data = m_shaders.get(shader);
- if (data) {
- data->refcount++;
- }
- return data;
-}
-
-void GLSharedGroup::unrefShaderData(GLuint shader)
-{
- emugl::Mutex::AutoLock _lock(m_lock);
- unrefShaderDataLocked(shader);
-}
-
-void GLSharedGroup::refShaderDataLocked(GLuint shader)
-{
- ShaderData* data = m_shaders.get(shader);
- if (data) {
- data->refcount++;
- }
-}
-
-void GLSharedGroup::unrefShaderDataLocked(GLuint shader)
-{
- ShaderData* data = m_shaders.get(shader);
- if (data && --data->refcount == 0) {
- m_shaders.remove(shader);
- }
-}
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/GLSharedGroup.h b/distrib/android-emugl/shared/OpenglCodecCommon/GLSharedGroup.h
deleted file mode 100644
index f111f990d..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/GLSharedGroup.h
+++ /dev/null
@@ -1,145 +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_SHARED_GROUP_H_
-#define _GL_SHARED_GROUP_H_
-
-#include "emugl/common/id_to_object_map.h"
-#include "emugl/common/mutex.h"
-#include "emugl/common/pod_vector.h"
-#include "emugl/common/smart_ptr.h"
-
-#define GL_API
-#ifndef ANDROID
-#define GL_APIENTRY
-#define GL_APIENTRYP
-#endif
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "ErrorLog.h"
-#include "FixedBuffer.h"
-
-struct BufferData {
- BufferData();
- BufferData(GLsizeiptr size, void * data);
- GLsizeiptr m_size;
- FixedBuffer m_fixedBuffer;
-};
-
-class ProgramData {
-private:
- typedef struct _IndexInfo {
- GLint base;
- GLint size;
- GLenum type;
- GLint appBase;
- GLint hostLocsPerElement;
- GLuint flags;
- GLint samplerValue; // only set for sampler uniforms
- } IndexInfo;
-
- GLuint m_numIndexes;
- IndexInfo* m_Indexes;
- bool m_initialized;
- bool m_locShiftWAR;
-
- emugl::PodVector<GLuint> m_shaders;
-
-public:
- enum {
- INDEX_FLAG_SAMPLER_EXTERNAL = 0x00000001,
- };
-
- ProgramData();
- void initProgramData(GLuint numIndexes);
- bool isInitialized();
- virtual ~ProgramData();
- void setIndexInfo(GLuint index, GLint base, GLint size, GLenum type);
- void setIndexFlags(GLuint index, GLuint flags);
- GLuint getIndexForLocation(GLint location);
- GLenum getTypeForLocation(GLint location);
-
- bool needUniformLocationWAR() const { return m_locShiftWAR; }
- void setupLocationShiftWAR();
- GLint locationWARHostToApp(GLint hostLoc, GLint arrIndex);
- GLint locationWARAppToHost(GLint appLoc);
-
- GLint getNextSamplerUniform(GLint index, GLint* val, GLenum* target);
- bool setSamplerUniform(GLint appLoc, GLint val, GLenum* target);
-
- bool attachShader(GLuint shader);
- bool detachShader(GLuint shader);
- size_t getNumShaders() const { return m_shaders.size(); }
- GLuint getShader(size_t i) const { return m_shaders[i]; }
-};
-
-struct ShaderData {
-#if 0 // TODO(digit): Undertand why this is never used?
- typedef android::List<android::String8> StringList;
- StringList samplerExternalNames;
-#endif
- int refcount;
-};
-
-class GLSharedGroup {
-private:
- emugl::IdToObjectMap<BufferData> m_buffers;
- emugl::IdToObjectMap<ProgramData> m_programs;
- emugl::IdToObjectMap<ShaderData> m_shaders;
- mutable emugl::Mutex m_lock;
-
- void refShaderDataLocked(GLuint shader);
- void unrefShaderDataLocked(GLuint shader);
-
-public:
- GLSharedGroup();
- ~GLSharedGroup();
- BufferData * getBufferData(GLuint bufferId);
- void addBufferData(GLuint bufferId, GLsizeiptr size, void * data);
- void updateBufferData(GLuint bufferId, GLsizeiptr size, void * data);
- GLenum subUpdateBufferData(GLuint bufferId, GLintptr offset, GLsizeiptr size, void * data);
- void deleteBufferData(GLuint);
-
- bool isProgram(GLuint program);
- bool isProgramInitialized(GLuint program);
- void addProgramData(GLuint program);
- void initProgramData(GLuint program, GLuint numIndexes);
- void attachShader(GLuint program, GLuint shader);
- void detachShader(GLuint program, GLuint shader);
- void deleteProgramData(GLuint program);
- void setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type, const char* name);
- GLenum getProgramUniformType(GLuint program, GLint location);
- void setupLocationShiftWAR(GLuint program);
- GLint locationWARHostToApp(GLuint program, GLint hostLoc, GLint arrIndex);
- GLint locationWARAppToHost(GLuint program, GLint appLoc);
- bool needUniformLocationWAR(GLuint program);
- GLint getNextSamplerUniform(GLuint program, GLint index, GLint* val, GLenum* target) const;
- bool setSamplerUniform(GLuint program, GLint appLoc, GLint val, GLenum* target);
-
- bool addShaderData(GLuint shader);
- // caller must hold a reference to the shader as long as it holds the pointer
- ShaderData* getShaderData(GLuint shader);
- void unrefShaderData(GLuint shader);
-};
-
-typedef emugl::SmartPtr<GLSharedGroup> GLSharedGroupPtr;
-
-#endif //_GL_SHARED_GROUP_H_
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/Makefile b/distrib/android-emugl/shared/OpenglCodecCommon/Makefile
deleted file mode 100644
index e8bf43162..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-
-ROOT=../..
-
-include $(ROOT)/make/commondefs
-
-CXXFILES = TcpStream.cpp GLClientState.cpp glUtils.cpp
-CXXINCS += -I$(ROOT)/libs/GLESv1 -I$(ROOT)/include
-
-LIBRARY_NAME = libcodecCommon.a
-
-include $(COMMONRULES)
-
-
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/SocketStream.cpp b/distrib/android-emugl/shared/OpenglCodecCommon/SocketStream.cpp
deleted file mode 100644
index 4b4ffb3bf..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/SocketStream.cpp
+++ /dev/null
@@ -1,176 +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 "SocketStream.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#ifndef _WIN32
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/un.h>
-#else
-#include <ws2tcpip.h>
-#endif
-
-SocketStream::SocketStream(size_t bufSize) :
- IOStream(bufSize),
- m_sock(-1),
- m_bufsize(bufSize),
- m_buf(NULL)
-{
-}
-
-SocketStream::SocketStream(int sock, size_t bufSize) :
- IOStream(bufSize),
- m_sock(sock),
- m_bufsize(bufSize),
- m_buf(NULL)
-{
-}
-
-SocketStream::~SocketStream()
-{
- if (m_sock >= 0) {
-#ifdef _WIN32
- closesocket(m_sock);
-#else
- ::close(m_sock);
-#endif
- m_sock = -1;
- }
- if (m_buf != NULL) {
- free(m_buf);
- m_buf = NULL;
- }
-}
-
-
-void *SocketStream::allocBuffer(size_t minSize)
-{
- size_t allocSize = (m_bufsize < minSize ? minSize : m_bufsize);
- if (!m_buf) {
- m_buf = (unsigned char *)malloc(allocSize);
- }
- else if (m_bufsize < allocSize) {
- unsigned char *p = (unsigned char *)realloc(m_buf, allocSize);
- if (p != NULL) {
- m_buf = p;
- m_bufsize = allocSize;
- } else {
- ERR("%s: realloc (%zu) failed\n", __FUNCTION__, allocSize);
- free(m_buf);
- m_buf = NULL;
- m_bufsize = 0;
- }
- }
-
- return m_buf;
-};
-
-int SocketStream::commitBuffer(size_t size)
-{
- return writeFully(m_buf, size);
-}
-
-int SocketStream::writeFully(const void* buffer, size_t size)
-{
- if (!valid()) return -1;
-
- size_t res = size;
- int retval = 0;
-
- while (res > 0) {
- ssize_t stat = ::send(m_sock, (const char *)buffer + (size - res), res, 0);
- if (stat < 0) {
- if (errno != EINTR) {
- retval = stat;
- ERR("%s: failed: %s\n", __FUNCTION__, strerror(errno));
- break;
- }
- } else {
- res -= stat;
- }
- }
- return retval;
-}
-
-const unsigned char *SocketStream::readFully(void *buf, size_t len)
-{
- if (!valid()) return NULL;
- if (!buf) {
- return NULL; // do not allow NULL buf in that implementation
- }
- size_t res = len;
- while (res > 0) {
- ssize_t stat = ::recv(m_sock, (char *)(buf) + len - res, res, 0);
- if (stat > 0) {
- res -= stat;
- continue;
- }
- if (stat == 0 || errno != EINTR) { // client shutdown or error
- return NULL;
- }
- }
- return (const unsigned char *)buf;
-}
-
-const unsigned char *SocketStream::read( void *buf, size_t *inout_len)
-{
- if (!valid()) return NULL;
- if (!buf) {
- return NULL; // do not allow NULL buf in that implementation
- }
-
- int n;
- do {
- n = this->recv(buf, *inout_len);
- } while( n < 0 && errno == EINTR );
-
- if (n > 0) {
- *inout_len = n;
- return (const unsigned char *)buf;
- }
-
- return NULL;
-}
-
-int SocketStream::recv(void *buf, size_t len)
-{
- if (!valid()) return int(ERR_INVALID_SOCKET);
- int res = 0;
- while(true) {
- res = ::recv(m_sock, (char *)buf, len, 0);
- if (res < 0) {
- if (errno == EINTR) {
- continue;
- }
- }
- break;
- }
- return res;
-}
-
-void SocketStream::forceStop() {
- // Shutdown socket to force read/write errors.
-#ifdef _WIN32
- ::shutdown(m_sock, SD_BOTH);
-#else
- ::shutdown(m_sock, SHUT_RDWR);
-#endif
-}
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/SocketStream.h b/distrib/android-emugl/shared/OpenglCodecCommon/SocketStream.h
deleted file mode 100644
index 2a9cf1342..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/SocketStream.h
+++ /dev/null
@@ -1,53 +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 __SOCKET_STREAM_H
-#define __SOCKET_STREAM_H
-
-#include <stdlib.h>
-#include "IOStream.h"
-
-class SocketStream : public IOStream {
-public:
- typedef enum { ERR_INVALID_SOCKET = -1000 } SocketStreamError;
- static const size_t MAX_ADDRSTR_LEN = 256;
-
- explicit SocketStream(size_t bufsize = 10000);
- virtual ~SocketStream();
-
- virtual int listen(char addrstr[MAX_ADDRSTR_LEN]) = 0;
- virtual SocketStream *accept() = 0;
- virtual int connect(const char* addr) = 0;
-
- virtual void *allocBuffer(size_t minSize);
- virtual int commitBuffer(size_t size);
- virtual const unsigned char *readFully(void *buf, size_t len);
- virtual const unsigned char *read(void *buf, size_t *inout_len);
-
- bool valid() { return m_sock >= 0; }
- virtual int recv(void *buf, size_t len);
- virtual int writeFully(const void *buf, size_t len);
-
- virtual void forceStop();
-
-protected:
- int m_sock;
- size_t m_bufsize;
- unsigned char *m_buf;
-
- SocketStream(int sock, size_t bufSize);
-};
-
-#endif /* __SOCKET_STREAM_H */
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/TcpStream.cpp b/distrib/android-emugl/shared/OpenglCodecCommon/TcpStream.cpp
deleted file mode 100644
index ba355abb3..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/TcpStream.cpp
+++ /dev/null
@@ -1,78 +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 "TcpStream.h"
-#include "emugl/common/sockets.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#ifndef _WIN32
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#else
-#include <ws2tcpip.h>
-#endif
-
-#define LISTEN_BACKLOG 4
-
-TcpStream::TcpStream(size_t bufSize) : SocketStream(bufSize) {}
-
-TcpStream::TcpStream(int sock, size_t bufSize) :
- SocketStream(sock, bufSize) {
- // disable Nagle algorithm to improve bandwidth of small
- // packets which are quite common in our implementation.
- emugl::socketTcpDisableNagle(sock);
-}
-
-int TcpStream::listen(char addrstr[MAX_ADDRSTR_LEN]) {
- m_sock = emugl::socketTcpLoopbackServer(0, SOCK_STREAM);
- if (!valid())
- return int(ERR_INVALID_SOCKET);
-
- int port = emugl::socketGetPort(m_sock);
- if (port < 0) {
- ::close(m_sock);
- return int(ERR_INVALID_SOCKET);
- }
-
- snprintf(addrstr, MAX_ADDRSTR_LEN - 1, "%hu", port);
- addrstr[MAX_ADDRSTR_LEN-1] = '\0';
-
- return 0;
-}
-
-SocketStream * TcpStream::accept() {
- int clientSock = emugl::socketAccept(m_sock);
- if (clientSock < 0)
- return NULL;
-
- return new TcpStream(clientSock, m_bufsize);
-}
-
-int TcpStream::connect(const char* addr) {
- int port = atoi(addr);
- m_sock = emugl::socketTcpLoopbackClient(port, SOCK_STREAM);
- return valid() ? 0 : -1;
-}
-
-int TcpStream::connect(const char* hostname, unsigned short port)
-{
- m_sock = emugl::socketTcpClient(hostname, port, SOCK_STREAM);
- return valid() ? 0 : -1;
-}
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/TcpStream.h b/distrib/android-emugl/shared/OpenglCodecCommon/TcpStream.h
deleted file mode 100644
index f5b462b03..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/TcpStream.h
+++ /dev/null
@@ -1,32 +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 __TCP_STREAM_H
-#define __TCP_STREAM_H
-
-#include "SocketStream.h"
-
-class TcpStream : public SocketStream {
-public:
- explicit TcpStream(size_t bufsize = 10000);
- virtual int listen(char addrstr[MAX_ADDRSTR_LEN]);
- virtual SocketStream *accept();
- virtual int connect(const char* addr);
- int connect(const char* hostname, unsigned short port);
-private:
- TcpStream(int sock, size_t bufSize);
-};
-
-#endif
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/TimeUtils.cpp b/distrib/android-emugl/shared/OpenglCodecCommon/TimeUtils.cpp
deleted file mode 100644
index 50aeb030e..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/TimeUtils.cpp
+++ /dev/null
@@ -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.
-*/
-#include "TimeUtils.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#include <time.h>
-#include <stdio.h>
-#elif defined(__linux__)
-#include <stdlib.h>
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#else
-#include <sys/time.h>
-#include <unistd.h>
-#endif
-
-long long GetCurrentTimeMS()
-{
-#ifdef _WIN32
- static LARGE_INTEGER freq;
- static bool bNotInit = true;
- if ( bNotInit ) {
- bNotInit = (QueryPerformanceFrequency( &freq ) == FALSE);
- }
- LARGE_INTEGER currVal;
- QueryPerformanceCounter( &currVal );
-
- return currVal.QuadPart / (freq.QuadPart / 1000);
-
-#elif defined(__linux__)
-
- struct timespec now;
- clock_gettime(CLOCK_MONOTONIC, &now);
- long long iDiff = (now.tv_sec * 1000LL) + now.tv_nsec/1000000LL;
- return iDiff;
-
-#else /* Others, e.g. OS X */
-
- struct timeval now;
- gettimeofday(&now, NULL);
- long long iDiff = (now.tv_sec * 1000LL) + now.tv_usec/1000LL;
- return iDiff;
-
-#endif
-}
-
-void TimeSleepMS(int p_mili)
-{
-#ifdef _WIN32
- Sleep(p_mili);
-#else
- usleep(p_mili * 1000);
-#endif
-}
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/TimeUtils.h b/distrib/android-emugl/shared/OpenglCodecCommon/TimeUtils.h
deleted file mode 100644
index bc4fd1c31..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/TimeUtils.h
+++ /dev/null
@@ -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 _TIME_UTILS_H
-#define _TIME_UTILS_H
-
-long long GetCurrentTimeMS();
-void TimeSleepMS(int p_mili);
-
-#endif
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/UnixStream.cpp b/distrib/android-emugl/shared/OpenglCodecCommon/UnixStream.cpp
deleted file mode 100644
index 7b2f67d7d..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/UnixStream.cpp
+++ /dev/null
@@ -1,132 +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 "UnixStream.h"
-
-#include "emugl/common/sockets.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-
-/* Not all systems define PATH_MAX, those who don't generally don't
- * have a limit on the maximum path size, so use a value that is
- * large enough for our very limited needs.
- */
-#ifndef PATH_MAX
-#define PATH_MAX 128
-#endif
-
-UnixStream::UnixStream(size_t bufSize) :
- SocketStream(bufSize)
-{
-}
-
-UnixStream::UnixStream(int sock, size_t bufSize) :
- SocketStream(sock, bufSize)
-{
-}
-
-/* Initialize a sockaddr_un with the appropriate values corresponding
- * to a given 'virtual port'. Returns 0 on success, -1 on error.
- */
-static int
-make_unix_path(char *path, size_t pathlen, int port_number)
-{
- char tmp[PATH_MAX]; // temp directory
- int ret = 0;
-
- // First, create user-specific temp directory if needed
- const char* user = getenv("USER");
- if (user != NULL) {
- struct stat st;
- snprintf(tmp, sizeof(tmp), "/tmp/android-%s", user);
- do {
- ret = ::lstat(tmp, &st);
- } while (ret < 0 && errno == EINTR);
-
- if (ret < 0 && errno == ENOENT) {
- do {
- ret = ::mkdir(tmp, 0766);
- } while (ret < 0 && errno == EINTR);
- if (ret < 0) {
- ERR("Could not create temp directory: %s", tmp);
- user = NULL; // will fall-back to /tmp
- }
- }
- else if (ret < 0) {
- user = NULL; // will fallback to /tmp
- }
- }
-
- if (user == NULL) { // fallback to /tmp in case of error
- snprintf(tmp, sizeof(tmp), "/tmp");
- }
-
- // Now, initialize it properly
- snprintf(path, pathlen, "%s/qemu-gles-%d", tmp, port_number);
- return 0;
-}
-
-
-int UnixStream::listen(char addrstr[MAX_ADDRSTR_LEN])
-{
- if (make_unix_path(addrstr, MAX_ADDRSTR_LEN, getpid()) < 0) {
- return -1;
- }
-
- m_sock = emugl::socketLocalServer(addrstr, SOCK_STREAM);
- if (!valid()) return int(ERR_INVALID_SOCKET);
-
- return 0;
-}
-
-SocketStream * UnixStream::accept()
-{
- int clientSock = -1;
-
- while (true) {
- struct sockaddr_un addr;
- socklen_t len = sizeof(addr);
- clientSock = ::accept(m_sock, (sockaddr *)&addr, &len);
-
- if (clientSock < 0 && errno == EINTR) {
- continue;
- }
- break;
- }
-
- UnixStream *clientStream = NULL;
-
- if (clientSock >= 0) {
- clientStream = new UnixStream(clientSock, m_bufsize);
- }
- return clientStream;
-}
-
-int UnixStream::connect(const char* addr)
-{
- m_sock = emugl::socketLocalClient(addr, SOCK_STREAM);
- if (!valid()) return -1;
-
- return 0;
-}
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/UnixStream.h b/distrib/android-emugl/shared/OpenglCodecCommon/UnixStream.h
deleted file mode 100644
index 95e7431c6..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/UnixStream.h
+++ /dev/null
@@ -1,31 +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 __UNIX_STREAM_H
-#define __UNIX_STREAM_H
-
-#include "SocketStream.h"
-
-class UnixStream : public SocketStream {
-public:
- explicit UnixStream(size_t bufsize = 10000);
- virtual int listen(char addrstr[MAX_ADDRSTR_LEN]);
- virtual SocketStream *accept();
- virtual int connect(const char* addr);
-private:
- UnixStream(int sock, size_t bufSize);
-};
-
-#endif
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/Win32PipeStream.cpp b/distrib/android-emugl/shared/OpenglCodecCommon/Win32PipeStream.cpp
deleted file mode 100644
index 81ee20256..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/Win32PipeStream.cpp
+++ /dev/null
@@ -1,241 +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 "Win32PipeStream.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <windows.h>
-
-#ifndef _WIN32
-#error ONLY BUILD THIS SOURCE FILE FOR WINDOWS!
-#endif
-
-/* The official documentation states that the name of a given named
- * pipe cannot be more than 256 characters long.
- */
-#define NAMED_PIPE_MAX 256
-
-Win32PipeStream::Win32PipeStream(size_t bufSize) :
- SocketStream(bufSize),
- m_pipe(INVALID_HANDLE_VALUE)
-{
-}
-
-Win32PipeStream::Win32PipeStream(HANDLE pipe, size_t bufSize) :
- SocketStream(-1, bufSize),
- m_pipe(pipe)
-{
-}
-
-Win32PipeStream::~Win32PipeStream()
-{
- if (m_pipe != INVALID_HANDLE_VALUE) {
- CloseHandle(m_pipe);
- m_pipe = INVALID_HANDLE_VALUE;
- }
-}
-
-/* Initialize the pipe name corresponding to a given port
- */
-static void
-make_pipe_name(char *path, size_t pathlen, int port_number)
-{
- snprintf(path, pathlen, "\\\\.\\pipe\\qemu-gles-%d", port_number);
-}
-
-
-/* Technical note: Named pipes work differently from BSD Sockets.
- * One does not create/bind a pipe, and collect a new handle each
- * time a client connects with accept().
- *
- * Instead, the server creates a new pipe instance each time it wants
- * to get a new client connection, then calls ConnectNamedPipe() to
- * wait for a connection.
- *
- * So listen() is a no-op, and accept() really creates the pipe handle.
- *
- * Also, connect() must create a pipe handle with CreateFile() and
- * wait for a server instance with WaitNamedPipe()
- */
-int Win32PipeStream::listen(char addrstr[MAX_ADDRSTR_LEN])
-{
- m_port = GetCurrentProcessId();
- make_pipe_name(addrstr, MAX_ADDRSTR_LEN, m_port);
- return 0;
-}
-
-SocketStream * Win32PipeStream::accept()
-{
- char path[NAMED_PIPE_MAX+1];
- SocketStream* clientStream;
- HANDLE pipe;
-
- make_pipe_name(path, sizeof(path), m_port);
-
- pipe = ::CreateNamedPipe(
- path, // pipe name
- PIPE_ACCESS_DUPLEX, // read-write access
- PIPE_TYPE_BYTE | // byte-oriented writes
- PIPE_READMODE_BYTE | // byte-oriented reads
- PIPE_WAIT, // blocking operations
- PIPE_UNLIMITED_INSTANCES, // no limit on clients
- 4096, // input buffer size
- 4096, // output buffer size
- 0, // client time-out
- NULL); // default security attributes
-
- if (pipe == INVALID_HANDLE_VALUE) {
- ERR("%s: CreateNamedPipe failed %d\n", __FUNCTION__, (int)GetLastError());
- return NULL;
- }
-
- // Stupid Win32 API design: If a client is already connected, then
- // ConnectNamedPipe will return 0, and GetLastError() will return
- // ERROR_PIPE_CONNECTED. This is not an error! It just means that the
- // function didn't have to wait.
- //
- if (::ConnectNamedPipe(pipe, NULL) == 0 && GetLastError() != ERROR_PIPE_CONNECTED) {
- ERR("%s: ConnectNamedPipe failed: %d\n", __FUNCTION__, (int)GetLastError());
- CloseHandle(pipe);
- return NULL;
- }
-
- clientStream = new Win32PipeStream(pipe, m_bufsize);
- return clientStream;
-}
-
-int Win32PipeStream::connect(const char* addr)
-{
- HANDLE pipe;
- int tries = 10;
-
- /* We're going to loop in order to wait for the pipe server to
- * be setup properly.
- */
- for (; tries > 0; tries--) {
- pipe = ::CreateFile(
- addr, // pipe name
- GENERIC_READ | GENERIC_WRITE, // read & write
- 0, // no sharing
- NULL, // default security attrs
- OPEN_EXISTING, // open existing pipe
- 0, // default attributes
- NULL); // no template file
-
- /* If we have a valid pipe handle, break from the loop */
- if (pipe != INVALID_HANDLE_VALUE) {
- break;
- }
-
- /* We can get here if the pipe is busy, i.e. if the server hasn't
- * create a new pipe instance to service our request. In which case
- * GetLastError() will return ERROR_PIPE_BUSY.
- *
- * If so, then use WaitNamedPipe() to wait for a decent time
- * to try again.
- */
- if (GetLastError() != ERROR_PIPE_BUSY) {
- /* Not ERROR_PIPE_BUSY */
- ERR("%s: CreateFile failed: %d\n", __FUNCTION__, (int)GetLastError());
- errno = EINVAL;
- return -1;
- }
-
- /* Wait for 5 seconds */
- if ( !WaitNamedPipe(addr, 5000) ) {
- ERR("%s: WaitNamedPipe failed: %d\n", __FUNCTION__, (int)GetLastError());
- errno = EINVAL;
- return -1;
- }
- }
-
- m_pipe = pipe;
- return 0;
-}
-
-/* Special buffer methods, since we can't use socket functions here */
-
-int Win32PipeStream::commitBuffer(size_t size)
-{
- if (m_pipe == INVALID_HANDLE_VALUE)
- return -1;
-
- size_t res = size;
- int retval = 0;
-
- while (res > 0) {
- DWORD written;
- if (! ::WriteFile(m_pipe, (const char *)m_buf + (size - res), res, &written, NULL)) {
- retval = -1;
- ERR("%s: failed: %d\n", __FUNCTION__, (int)GetLastError());
- break;
- }
- res -= written;
- }
- return retval;
-}
-
-const unsigned char *Win32PipeStream::readFully(void *buf, size_t len)
-{
- if (m_pipe == INVALID_HANDLE_VALUE)
- return NULL;
-
- if (!buf) {
- return NULL; // do not allow NULL buf in that implementation
- }
-
- size_t res = len;
- while (res > 0) {
- DWORD readcount = 0;
- if (! ::ReadFile(m_pipe, (char *)buf + (len - res), res, &readcount, NULL) || readcount == 0) {
- errno = (int)GetLastError();
- return NULL;
- }
- res -= readcount;
- }
- return (const unsigned char *)buf;
-}
-
-const unsigned char *Win32PipeStream::read( void *buf, size_t *inout_len)
-{
- size_t len = *inout_len;
- DWORD readcount;
-
- if (m_pipe == INVALID_HANDLE_VALUE)
- return NULL;
-
- if (!buf) {
- return NULL; // do not allow NULL buf in that implementation
- }
-
- if (!::ReadFile(m_pipe, (char *)buf, len, &readcount, NULL)) {
- errno = (int)GetLastError();
- return NULL;
- }
-
- *inout_len = (size_t)readcount;
- return (const unsigned char *)buf;
-}
-
-void Win32PipeStream::forceStop()
-{
- HANDLE handle = m_pipe;
- m_pipe = INVALID_HANDLE_VALUE;
- CloseHandle(handle);
-}
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/Win32PipeStream.h b/distrib/android-emugl/shared/OpenglCodecCommon/Win32PipeStream.h
deleted file mode 100644
index be44074b5..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/Win32PipeStream.h
+++ /dev/null
@@ -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 __WIN32_PIPE_STREAM_H
-#define __WIN32_PIPE_STREAM_H
-
-#include "SocketStream.h"
-#include <windows.h>
-
-class Win32PipeStream : public SocketStream {
-public:
- explicit Win32PipeStream(size_t bufsize = 10000);
- virtual ~Win32PipeStream();
- virtual int listen(char addrstr[MAX_ADDRSTR_LEN]);
- virtual SocketStream *accept();
- virtual int connect(const char* addr);
-
- virtual int commitBuffer(size_t size);
- virtual const unsigned char *readFully(void *buf, size_t len);
- virtual const unsigned char *read(void *buf, size_t *inout_len);
- virtual void forceStop();
-
-private:
- Win32PipeStream(HANDLE pipe, size_t bufSize);
- HANDLE m_pipe;
- int m_port;
-};
-
-
-#endif
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/codec_defs.h b/distrib/android-emugl/shared/OpenglCodecCommon/codec_defs.h
deleted file mode 100644
index e69de29bb..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/codec_defs.h
+++ /dev/null
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/glUtils.cpp b/distrib/android-emugl/shared/OpenglCodecCommon/glUtils.cpp
deleted file mode 100644
index 4b7fc892c..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/glUtils.cpp
+++ /dev/null
@@ -1,471 +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 "glUtils.h"
-#include <string.h>
-#include "ErrorLog.h"
-#include <IOStream.h>
-
-size_t glSizeof(GLenum type)
-{
- size_t retval = 0;
- switch(type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- retval = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_HALF_FLOAT_OES:
- retval = 2;
- break;
- case GL_INT:
- case GL_FLOAT:
- case GL_FIXED:
- case GL_BOOL:
- retval = 4;
- break;
-#ifdef GL_DOUBLE
- case GL_DOUBLE:
- retval = 8;
- break;
-#endif
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_BOOL_VEC2:
- retval = 8;
- break;
- case GL_INT_VEC3:
- case GL_BOOL_VEC3:
- case GL_FLOAT_VEC3:
- retval = 12;
- break;
- case GL_FLOAT_VEC4:
- case GL_BOOL_VEC4:
- case GL_INT_VEC4:
- case GL_FLOAT_MAT2:
- retval = 16;
- break;
- case GL_FLOAT_MAT3:
- retval = 36;
- break;
- case GL_FLOAT_MAT4:
- retval = 64;
- break;
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- retval = 4;
- break;
- default:
- ERR("**** ERROR unknown type 0x%x (%s,%d)\n", type, __FUNCTION__,__LINE__);
- }
- return retval;
-
-}
-
-size_t glUtilsParamSize(GLenum param)
-{
- size_t s = 0;
-
- switch(param)
- {
- case GL_DEPTH_TEST:
- case GL_DEPTH_FUNC:
- case GL_DEPTH_BITS:
- case GL_MAX_CLIP_PLANES:
- case GL_GREEN_BITS:
- case GL_MAX_MODELVIEW_STACK_DEPTH:
- case GL_MAX_PROJECTION_STACK_DEPTH:
- case GL_MAX_TEXTURE_STACK_DEPTH:
- case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
- case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- case GL_MAX_TEXTURE_SIZE:
- case GL_TEXTURE_GEN_MODE_OES:
- case GL_TEXTURE_ENV_MODE:
- case GL_FOG_MODE:
- case GL_FOG_DENSITY:
- case GL_FOG_START:
- case GL_FOG_END:
- case GL_SPOT_EXPONENT:
- case GL_CONSTANT_ATTENUATION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION:
- case GL_SHININESS:
- case GL_LIGHT_MODEL_TWO_SIDE:
- case GL_POINT_SIZE:
- case GL_POINT_SIZE_MIN:
- case GL_POINT_SIZE_MAX:
- case GL_POINT_FADE_THRESHOLD_SIZE:
- case GL_CULL_FACE_MODE:
- case GL_FRONT_FACE:
- case GL_SHADE_MODEL:
- case GL_DEPTH_WRITEMASK:
- case GL_DEPTH_CLEAR_VALUE:
- case GL_STENCIL_FAIL:
- case GL_STENCIL_PASS_DEPTH_FAIL:
- case GL_STENCIL_PASS_DEPTH_PASS:
- case GL_STENCIL_REF:
- case GL_STENCIL_WRITEMASK:
- case GL_MATRIX_MODE:
- case GL_MODELVIEW_STACK_DEPTH:
- case GL_PROJECTION_STACK_DEPTH:
- case GL_TEXTURE_STACK_DEPTH:
- case GL_ALPHA_TEST_FUNC:
- case GL_ALPHA_TEST_REF:
- case GL_ALPHA_TEST:
- case GL_BLEND_DST:
- case GL_BLEND_SRC:
- case GL_BLEND:
- case GL_LOGIC_OP_MODE:
- case GL_SCISSOR_TEST:
- case GL_MAX_TEXTURE_UNITS:
- case GL_ACTIVE_TEXTURE:
- case GL_ALPHA_BITS:
- case GL_ARRAY_BUFFER_BINDING:
- case GL_BLUE_BITS:
- case GL_CLIENT_ACTIVE_TEXTURE:
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- case GL_COLOR_ARRAY:
- case GL_COLOR_ARRAY_BUFFER_BINDING:
- case GL_COLOR_ARRAY_SIZE:
- case GL_COLOR_ARRAY_STRIDE:
- case GL_COLOR_ARRAY_TYPE:
- case GL_COLOR_LOGIC_OP:
- case GL_COLOR_MATERIAL:
- case GL_PACK_ALIGNMENT:
- case GL_PERSPECTIVE_CORRECTION_HINT:
- case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
- case GL_POINT_SIZE_ARRAY_STRIDE_OES:
- case GL_POINT_SIZE_ARRAY_TYPE_OES:
- case GL_POINT_SMOOTH:
- case GL_POINT_SMOOTH_HINT:
- case GL_POINT_SPRITE_OES:
- case GL_COORD_REPLACE_OES:
- case GL_COMBINE_ALPHA:
- case GL_SRC0_RGB:
- case GL_SRC1_RGB:
- case GL_SRC2_RGB:
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- case GL_SRC0_ALPHA:
- case GL_SRC1_ALPHA:
- case GL_SRC2_ALPHA:
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- case GL_COMBINE_RGB:
- case GL_POLYGON_OFFSET_FACTOR:
- case GL_POLYGON_OFFSET_FILL:
- case GL_POLYGON_OFFSET_UNITS:
- case GL_RED_BITS:
- case GL_RESCALE_NORMAL:
- case GL_SAMPLE_ALPHA_TO_COVERAGE:
- case GL_SAMPLE_ALPHA_TO_ONE:
- case GL_SAMPLE_BUFFERS:
- case GL_SAMPLE_COVERAGE:
- case GL_SAMPLE_COVERAGE_INVERT:
- case GL_SAMPLE_COVERAGE_VALUE:
- case GL_SAMPLES:
- case GL_STENCIL_BITS:
- case GL_STENCIL_CLEAR_VALUE:
- case GL_STENCIL_FUNC:
- case GL_STENCIL_TEST:
- case GL_STENCIL_VALUE_MASK:
- case GL_STENCIL_BACK_FUNC:
- case GL_STENCIL_BACK_VALUE_MASK:
- case GL_STENCIL_BACK_REF:
- case GL_STENCIL_BACK_FAIL:
- case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
- case GL_STENCIL_BACK_PASS_DEPTH_PASS:
- case GL_STENCIL_BACK_WRITEMASK:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_CUBE_MAP:
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- case GL_TEXTURE_COORD_ARRAY:
- case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
- case GL_TEXTURE_COORD_ARRAY_SIZE:
- case GL_TEXTURE_COORD_ARRAY_STRIDE:
- case GL_TEXTURE_COORD_ARRAY_TYPE:
- case GL_UNPACK_ALIGNMENT:
- case GL_VERTEX_ARRAY:
- case GL_VERTEX_ARRAY_BUFFER_BINDING:
- case GL_VERTEX_ARRAY_SIZE:
- case GL_VERTEX_ARRAY_STRIDE:
- case GL_VERTEX_ARRAY_TYPE:
- case GL_SPOT_CUTOFF:
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_GENERATE_MIPMAP:
- case GL_GENERATE_MIPMAP_HINT:
- case GL_RENDERBUFFER_WIDTH_OES:
- case GL_RENDERBUFFER_HEIGHT_OES:
- case GL_RENDERBUFFER_INTERNAL_FORMAT_OES:
- case GL_RENDERBUFFER_RED_SIZE_OES:
- case GL_RENDERBUFFER_GREEN_SIZE_OES:
- case GL_RENDERBUFFER_BLUE_SIZE_OES:
- case GL_RENDERBUFFER_ALPHA_SIZE_OES:
- case GL_RENDERBUFFER_DEPTH_SIZE_OES:
- case GL_RENDERBUFFER_STENCIL_SIZE_OES:
- case GL_RENDERBUFFER_BINDING:
- case GL_FRAMEBUFFER_BINDING:
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES:
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES:
- case GL_FENCE_STATUS_NV:
- case GL_FENCE_CONDITION_NV:
- case GL_TEXTURE_WIDTH_QCOM:
- case GL_TEXTURE_HEIGHT_QCOM:
- case GL_TEXTURE_DEPTH_QCOM:
- case GL_TEXTURE_INTERNAL_FORMAT_QCOM:
- case GL_TEXTURE_FORMAT_QCOM:
- case GL_TEXTURE_TYPE_QCOM:
- case GL_TEXTURE_IMAGE_VALID_QCOM:
- case GL_TEXTURE_NUM_LEVELS_QCOM:
- case GL_TEXTURE_TARGET_QCOM:
- case GL_TEXTURE_OBJECT_VALID_QCOM:
- case GL_BLEND_EQUATION_RGB_OES:
- case GL_BLEND_EQUATION_ALPHA_OES:
- case GL_BLEND_DST_RGB_OES:
- case GL_BLEND_SRC_RGB_OES:
- case GL_BLEND_DST_ALPHA_OES:
- case GL_BLEND_SRC_ALPHA_OES:
- case GL_MAX_LIGHTS:
- case GL_SHADER_TYPE:
- case GL_DELETE_STATUS:
- case GL_COMPILE_STATUS:
- case GL_INFO_LOG_LENGTH:
- case GL_SHADER_SOURCE_LENGTH:
- case GL_CURRENT_PROGRAM:
- case GL_LINK_STATUS:
- case GL_VALIDATE_STATUS:
- case GL_ATTACHED_SHADERS:
- case GL_ACTIVE_UNIFORMS:
- case GL_ACTIVE_ATTRIBUTES:
- case GL_SUBPIXEL_BITS:
- case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
- case GL_NUM_SHADER_BINARY_FORMATS:
- case GL_SHADER_COMPILER:
- case GL_MAX_VERTEX_ATTRIBS:
- case GL_MAX_VERTEX_UNIFORM_VECTORS:
- case GL_MAX_VARYING_VECTORS:
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
- case GL_MAX_RENDERBUFFER_SIZE:
- case GL_MAX_TEXTURE_IMAGE_UNITS:
- case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
- case GL_LINE_WIDTH:
- s = 1;
- break;
- case GL_ALIASED_LINE_WIDTH_RANGE:
- case GL_ALIASED_POINT_SIZE_RANGE:
- case GL_DEPTH_RANGE:
- case GL_MAX_VIEWPORT_DIMS:
- case GL_SMOOTH_POINT_SIZE_RANGE:
- case GL_SMOOTH_LINE_WIDTH_RANGE:
- s= 2;
- break;
- case GL_SPOT_DIRECTION:
- case GL_POINT_DISTANCE_ATTENUATION:
- case GL_CURRENT_NORMAL:
- s = 3;
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- case GL_CURRENT_TEXTURE_COORDS:
- case GL_CURRENT_COLOR:
- case GL_FOG_COLOR:
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- case GL_EMISSION:
- case GL_POSITION:
- case GL_LIGHT_MODEL_AMBIENT:
- case GL_TEXTURE_ENV_COLOR:
- case GL_SCISSOR_BOX:
- case GL_VIEWPORT:
- case GL_TEXTURE_CROP_RECT_OES:
- case GL_COLOR_CLEAR_VALUE:
- case GL_COLOR_WRITEMASK:
- case GL_AMBIENT_AND_DIFFUSE:
- case GL_BLEND_COLOR:
- s = 4;
- break;
- case GL_MODELVIEW_MATRIX:
- case GL_PROJECTION_MATRIX:
- case GL_TEXTURE_MATRIX:
- s = 16;
- break;
- default:
- ERR("glUtilsParamSize: unknow param 0x%08x\n", param);
- s = 1; // assume 1
- }
- return s;
-}
-
-void glUtilsPackPointerData(unsigned char *dst, unsigned char *src,
- int size, GLenum type, unsigned int stride,
- unsigned int datalen)
-{
- unsigned int vsize = size * glSizeof(type);
- if (stride == 0) stride = vsize;
-
- if (stride == vsize) {
- memcpy(dst, src, datalen);
- } else {
- for (unsigned int i = 0; i < datalen; i += vsize) {
- memcpy(dst, src, vsize);
- dst += vsize;
- src += stride;
- }
- }
-}
-
-void glUtilsWritePackPointerData(void* _stream, unsigned char *src,
- int size, GLenum type, unsigned int stride,
- unsigned int datalen)
-{
- IOStream* stream = reinterpret_cast<IOStream*>(_stream);
-
- unsigned int vsize = size * glSizeof(type);
- if (stride == 0) stride = vsize;
-
- if (stride == vsize) {
- stream->writeFully(src, datalen);
- } else {
- for (unsigned int i = 0; i < datalen; i += vsize) {
- stream->writeFully(src, (size_t)vsize);
- src += stride;
- }
- }
-}
-
-int glUtilsPixelBitSize(GLenum format, GLenum type)
-{
- int components = 0;
- int componentsize = 0;
- int pixelsize = 0;
- switch(type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- componentsize = 8;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_RGB565_OES:
- case GL_RGB5_A1_OES:
- case GL_RGBA4_OES:
- pixelsize = 16;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- case GL_FIXED:
- case GL_UNSIGNED_INT_24_8_OES:
- pixelsize = 32;
- break;
- default:
- ERR("glUtilsPixelBitSize: unknown pixel type - assuming pixel data 0\n");
- componentsize = 0;
- }
-
- if (pixelsize == 0) {
- switch(format) {
-#if 0
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
-#endif
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- components = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- components = 2;
- break;
- case GL_RGB:
-#if 0
- case GL_BGR:
-#endif
- components = 3;
- break;
- case GL_RGBA:
- case GL_BGRA_EXT:
- components = 4;
- break;
- default:
- ERR("glUtilsPixelBitSize: unknown pixel format...\n");
- components = 0;
- }
- pixelsize = components * componentsize;
- }
-
- return pixelsize;
-}
-
-// pack a list of strings into one.
-void glUtilsPackStrings(char *ptr, char **strings, GLint *length, GLsizei count)
-{
- char *p = ptr;
- *p = '\0';
- for (int i = 0; i < count; i++) {
- int l=0;
- if (strings[i]!=NULL) {
- if (length == NULL || length[i] < 0) {
- l = strlen(strings[i]);
- strcat(p, strings[i]);
- } else {
- l = length[i];
- strncat(p, strings[i], l);
- }
- }
- p += l;
- }
-}
-
-// claculate the length of a list of strings
-int glUtilsCalcShaderSourceLen( char **strings, GLint *length, GLsizei count)
-{
- int len = 0;
- for (int i = 0; i < count; i++) {
- int l;
- if (length == NULL || length[i] < 0) {
- l = strings[i]!=NULL ? strlen(strings[i]) : 0;
- } else {
- l = length[i];
- }
- len += l;
- }
- return len;
-
-}
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/glUtils.h b/distrib/android-emugl/shared/OpenglCodecCommon/glUtils.h
deleted file mode 100644
index f8857f165..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/glUtils.h
+++ /dev/null
@@ -1,95 +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_UTILS_H__
-#define __GL_UTILS_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef GL_API
- #undef GL_API
-#endif
-#define GL_API
-
-#ifdef GL_APIENTRY
- #undef GL_APIENTRY
-#endif
-
-#ifdef GL_APIENTRYP
- #undef GL_APIENTRYP
-#endif
-#define GL_APIENTRYP
-
-#ifndef ANDROID
-#define GL_APIENTRY
-#endif
-
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- size_t glSizeof(GLenum type);
- size_t glUtilsParamSize(GLenum param);
- void glUtilsPackPointerData(unsigned char *dst, unsigned char *str,
- int size, GLenum type, unsigned int stride,
- unsigned int datalen);
- void glUtilsWritePackPointerData(void* stream, unsigned char *src,
- int size, GLenum type, unsigned int stride,
- unsigned int datalen);
- int glUtilsPixelBitSize(GLenum format, GLenum type);
- void glUtilsPackStrings(char *ptr, char **strings, GLint *length, GLsizei count);
- int glUtilsCalcShaderSourceLen(char **strings, GLint *length, GLsizei count);
-#ifdef __cplusplus
-};
-#endif
-
-namespace GLUtils {
-
- template <class T> void minmax(T *indices, int count, int *min, int *max) {
- *min = -1;
- *max = -1;
- T *ptr = indices;
- for (int i = 0; i < count; i++) {
- if (*min == -1 || *ptr < *min) *min = *ptr;
- if (*max == -1 || *ptr > *max) *max = *ptr;
- ptr++;
- }
- }
-
- template <class T> void shiftIndices(T *indices, int count, int offset) {
- T *ptr = indices;
- for (int i = 0; i < count; i++) {
- *ptr += offset;
- ptr++;
- }
- }
-
-
- template <class T> void shiftIndices(T *src, T *dst, int count, int offset)
- {
- for (int i = 0; i < count; i++) {
- *dst = *src + offset;
- dst++;
- src++;
- }
- }
-}; // namespace GLUtils
-#endif
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/gl_base_types.h b/distrib/android-emugl/shared/OpenglCodecCommon/gl_base_types.h
deleted file mode 100644
index 38c594b5a..000000000
--- a/distrib/android-emugl/shared/OpenglCodecCommon/gl_base_types.h
+++ /dev/null
@@ -1,62 +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_BASE_TYPES__H
-#define __GL_BASE_TYPES__H
-
-#include <KHR/khrplatform.h>
-
-#ifndef gles1_APIENTRY
-#define gles1_APIENTRY KHRONOS_APIENTRY
-#endif
-
-#ifndef gles2_APIENTRY
-#define gles2_APIENTRY KHRONOS_APIENTRY
-#endif
-
-typedef void GLvoid;
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef char GLchar;
-typedef khronos_int8_t GLbyte;
-typedef short GLshort;
-typedef int GLint;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-typedef unsigned short GLushort;
-typedef unsigned int GLuint;
-typedef khronos_float_t GLfloat;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef khronos_int32_t GLclampx;
-typedef khronos_intptr_t GLintptr;
-typedef khronos_ssize_t GLsizeiptr;
-typedef char *GLstr;
-/* JR XXX Treating this as an in handle - is this correct? */
-typedef void * GLeglImageOES;
-
-/* ErrorCode */
-#ifndef GL_INVALID_ENUM
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_OUT_OF_MEMORY 0x0505
-#endif
-
-#endif
diff --git a/distrib/android-emugl/shared/emugl/common/Android.mk b/distrib/android-emugl/shared/emugl/common/Android.mk
deleted file mode 100644
index c4540360f..000000000
--- a/distrib/android-emugl/shared/emugl/common/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-# This build script corresponds to a library containing many definitions
-# common to both the guest and the host. They relate to
-#
-LOCAL_PATH := $(call my-dir)
-
-### emugl_common host library ###########################################
-
-commonSources := \
- crash_reporter.cpp \
- id_to_object_map.cpp \
- logging.cpp \
- shared_library.cpp \
- stringparsing.cpp \
- sockets.cpp \
-
-host_commonSources := $(commonSources)
-
-host_commonLdLibs := $(CXX_STD_LIB)
-
-ifneq (windows,$(BUILD_TARGET_OS))
- host_commonLdLibs += -ldl -lpthread
-endif
-
-$(call emugl-begin-static-library,libemugl_common)
-LOCAL_SRC_FILES := $(host_commonSources)
-$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/shared)
-$(call emugl-export,LDLIBS,$(host_commonLdLibs))
-$(call emugl-end-module)
-
-### emugl_common_unittests ##############################################
-
-host_commonSources := \
- id_to_object_map_unittest.cpp \
- shared_library_unittest.cpp \
- unique_integer_map_unittest.cpp \
- stringparsing_unittest.cpp
-
-$(call emugl-begin-executable,emugl$(BUILD_TARGET_SUFFIX)_common_host_unittests)
-LOCAL_SRC_FILES := $(host_commonSources)
-$(call emugl-import,libemugl_common libemugl_gtest)
-$(call emugl-end-module)
-
-$(call emugl-begin-shared-library,lib$(BUILD_TARGET_SUFFIX)emugl_test_shared_library)
-LOCAL_SRC_FILES := testing/test_shared_library.cpp
-LOCAL_CFLAGS := -fvisibility=default
-$(call emugl-end-module)
diff --git a/distrib/android-emugl/shared/emugl/common/id_to_object_map.cpp b/distrib/android-emugl/shared/emugl/common/id_to_object_map.cpp
deleted file mode 100644
index 597c9eb1c..000000000
--- a/distrib/android-emugl/shared/emugl/common/id_to_object_map.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/id_to_object_map.h"
-
-#include <stdlib.h>
-
-namespace emugl {
-
-namespace {
-
-typedef IdToObjectMapBase::KeyType KeyType;
-
-enum {
- kMinShift = 3,
- kMaxShift = 31,
- kMinCapacity = (1 << kMinShift),
- kLoadScale = 1024,
- kMinLoad = kLoadScale/4, // 25% minimum load.
- kMaxLoad = kLoadScale*3/4, // 75% maximum load.
-
- kInvalidKey = IdToObjectMapBase::kMaxId + 1U,
- kTombstone = IdToObjectMapBase::kMaxId + 2U,
-};
-
-// Return a number that indicates if the current |capacity| is appropriate
-// to hold |size| items in our map.
-// -1 -> the capacity is too small and needs to be increased.
-// 0 -> the capacity is ok.
-// +1 -> the capacity is too large and needs to be decreased.
-int capacityCompare(size_t shift, size_t size) {
- size_t capacity = 1U << shift;
- // Essentially, one can rewrite:
- // load < minLoad
- // as:
- // size / capacity < minLoad
- // capacity * minLoad > size
- if (capacity * kMinLoad > size * kLoadScale)
- return +1;
-
- // Similarly, one can rewrite:
- // load > maxLoad
- // as:
- // size / capacity > maxLoad
- // capacity * maxLoad < size
- if (capacity * kMaxLoad < size * kLoadScale)
- return -1;
-
- return 0;
-}
-
-size_t probeKeys(const KeyType* keys, size_t shift, KeyType key) {
- static const int kPrimes[] = {
- 1, /* For 1 << 0 */
- 2,
- 3,
- 7,
- 13,
- 31,
- 61,
- 127,
- 251,
- 509,
- 1021,
- 2039,
- 4093,
- 8191,
- 16381,
- 32749,
- 65521, /* For 1 << 16 */
- 131071,
- 262139,
- 524287,
- 1048573,
- 2097143,
- 4194301,
- 8388593,
- 16777213,
- 33554393,
- 67108859,
- 134217689,
- 268435399,
- 536870909,
- 1073741789,
- 2147483647 /* For 1 << 31 */
- };
-
- size_t slot = key % kPrimes[shift];
- size_t step = 0;
- for (;;) {
- KeyType k = keys[slot];
- if (k == kInvalidKey || k == kTombstone || k == key)
- return slot;
-
- step += 1;
- slot = (slot + step) & (1U << shift);
- }
-}
-
-} // namespace
-
-IdToObjectMapBase::IdToObjectMapBase() :
- mCount(0), mShift(kMinShift) {
- size_t capacity = 1U << mShift;
- mKeys = static_cast<KeyType*>(::calloc(sizeof(mKeys[0]), capacity));
- mValues = static_cast<void**>(::calloc(sizeof(mValues[0]), capacity));
- for (size_t n = 0; n < capacity; ++n) {
- mKeys[n] = kInvalidKey;
- }
-}
-
-IdToObjectMapBase::~IdToObjectMapBase() {
- mShift = 0;
- mCount = 0;
- ::free(mKeys);
- ::free(mValues);
-}
-
-bool IdToObjectMapBase::contains(KeyType key) const {
- size_t slot = probeKeys(mKeys, mShift, key);
- switch (mKeys[slot]) {
- case kInvalidKey:
- case kTombstone:
- return false;
- default:
- ;
- }
- return true;
-}
-
-bool IdToObjectMapBase::find(KeyType key, void** value) const {
- size_t slot = probeKeys(mKeys, mShift, key);
- if (!isValidKey(mKeys[slot])) {
- *value = NULL;
- return false;
- }
- *value = mValues[slot];
- return true;
-}
-
-void* IdToObjectMapBase::set(KeyType key, void* value) {
- if (!value)
- return remove(key);
-
- size_t slot = probeKeys(mKeys, mShift, key);
- void* result;
- if (isValidKey(mKeys[slot])) {
- result = mValues[slot];
- mValues[slot] = value;
- } else {
- mKeys[slot] = key;
- mValues[slot] = value;
- result = NULL;
- mCount++;
- resize(mCount);
- }
- return result;
-}
-
-void* IdToObjectMapBase::remove(KeyType key) {
- size_t slot = probeKeys(mKeys, mShift, key);
- if (!isValidKey(mKeys[slot]))
- return NULL;
-
- void* result = mValues[slot];
- mValues[slot] = NULL;
- mKeys[slot] = kTombstone;
- mCount--;
- return result;
-}
-
-void IdToObjectMapBase::resize(size_t newSize) {
- int ret = capacityCompare(mShift, newSize);
- if (!ret)
- return;
-
- size_t oldCapacity = 1U << mShift;
- size_t newShift = mShift;
-
- if (ret < 0) {
- // Capacity is too small and must be increased.
- do {
- if (newShift == kMaxShift)
- break;
- ++newShift;
- } while (capacityCompare(newShift, newSize) < 0);
- } else {
- // Capacity is too large and must be decreased.
- do {
- if (newShift == kMinShift)
- break;
- newShift--;
- } while (capacityCompare(newShift, newSize) > 0);
- }
- if (newShift == mShift)
- return;
-
- // Allocate new arrays.
- size_t newCapacity = 1U << newShift;
- KeyType* newKeys = static_cast<KeyType*>(
- ::calloc(sizeof(newKeys[0]), newCapacity));
- void** newValues = static_cast<void**>(
- ::calloc(sizeof(newValues[0]), newCapacity));
- for (size_t n = 0; n < newCapacity; ++n)
- newKeys[n] = kInvalidKey;
-
- // Copy old entries into new arrays.
- for (size_t n = 0; n < oldCapacity; ++n) {
- KeyType key = mKeys[n];
- if (isValidKey(key)) {
- size_t newSlot = probeKeys(newKeys, newShift, key);
- newKeys[newSlot] = key;
- newValues[newSlot] = mValues[n];
- }
- }
-
- // Swap arrays, and get rid of old ones.
- ::free(mKeys);
- ::free(mValues);
- mKeys = newKeys;
- mValues = newValues;
- mShift = newShift;
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/id_to_object_map.h b/distrib/android-emugl/shared/emugl/common/id_to_object_map.h
deleted file mode 100644
index e3d0a815e..000000000
--- a/distrib/android-emugl/shared/emugl/common/id_to_object_map.h
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_ID_TO_OBJECT_MAP_H
-#define EMUGL_COMMON_ID_TO_OBJECT_MAP_H
-
-#include <stddef.h>
-
-namespace emugl {
-
-// Base implementation class for IdToObjectMap template.
-// Used to reduce template-instanciated code generation.
-class IdToObjectMapBase {
-public:
- // The type of keys in this map.
- typedef unsigned KeyType;
-
- // Values higher than kMaxId cannot be used as map keys.
- enum {
- kMaxId = 0xfffffffdU,
- };
-
- static inline bool isValidKey(KeyType key) {
- return key <= kMaxId;
- }
-
-protected:
- IdToObjectMapBase();
-
- ~IdToObjectMapBase();
-
- void clear();
-
- // Return size
- inline size_t size() const { return mCount; }
-
- inline size_t capacity() const { return 1U << mShift; }
-
- // Return true iff the map contains a given key.
- bool contains(KeyType key) const;
-
- // Find a value associated with a given |key| in the map.
- // On success, return true and sets |*value| to the value/pointer,
- // which is _still_ owned by the map.
- // On failure, return false and sets |*value| to NULL.
- bool find(KeyType key, void** value) const;
-
- // Associate a value with a given |key| in the map.
- // Return the old value for the key, if any. Caller is responsible
- // for freeing it.
- void* set(KeyType key, void* value);
-
- // Remove the value associated with a given |key|.
- // Return the old value, if any. Caller is responsible for
- // freeing it.
- void* remove(KeyType key);
-
- size_t mCount;
- size_t mShift;
- KeyType* mKeys;
- void** mValues;
-
-private:
- // Resize the map if needed to ensure it can hold at least |newSize|
- // entries.
- void resize(size_t newSize);
-};
-
-// A templated data container that acts as a dictionary mapping unsigned
-// integer keys to heap-allocated objects of type T. The dictionary
-// owns the objects associated with its keys, and automatically destroys
-// them when it is destroyed, or during replacement or removal.
-template <class T>
-class IdToObjectMap : public IdToObjectMapBase {
-public:
- // Initialize an empty instance.
- IdToObjectMap() : IdToObjectMapBase() {}
-
- // Destroy this instance.
- ~IdToObjectMap() {
- clear();
- }
-
- // Return the number of items in this map.
- inline size_t size() const { return IdToObjectMapBase::size(); }
-
- // Return true iff the map is empty.
- inline bool empty() const { return !IdToObjectMapBase::size(); }
-
- // Remove all items from the map.
- void clear();
-
- // Returns true iff the dictionary contains a value for |key|.
- inline bool contains(KeyType key) const {
- return IdToObjectMapBase::contains(key);
- }
-
- // Find the value corresponding to |key| in this map.
- // On success, return true, and sets |*value| to point to the
- // value (still owned by the instance). On failure, return false.
- inline bool find(KeyType key, T** value) const {
- return IdToObjectMapBase::find(key, reinterpret_cast<void**>(value));
- }
-
- // Return the value associated with a given |key|, or NULL if it is
- // not in the map. Result is still owned by the map.
- inline T* get(KeyType key) const {
- T* result = NULL;
- this->find(key, &result);
- return result;
- }
-
- // Associate |value| with a given |key|. Returns true if a previous
- // value was replaced, and false if this is the first time a value
- // was associated with the given key. IMPORTANT: This transfers
- // ownership of |value| to the map instance. In case of replacement,
- // the old value is automatically destroyed. Using NULL as the value
- // is equivalent to calling remove().
- bool set(KeyType key, T* value);
-
- // Remove any value associated with |key|.
- // Return true iff a value was associated with the key and destroyed
- // by this function, false if there was no value associated with the
- // key (or if it was NULL).
- bool remove(KeyType key);
-};
-
-template <class T>
-void IdToObjectMap<T>::clear() {
- size_t n = capacity();
- while (n > 0) {
- --n;
- if (!isValidKey(mKeys[n]))
- continue;
-
- delete static_cast<T*>(mValues[n]);
- mValues[n] = NULL;
- mKeys[n] = kMaxId + 1U;
- }
- mCount = 0;
-}
-
-template <class T>
-bool IdToObjectMap<T>::set(KeyType key, T* value) {
- T* oldValue = static_cast<T*>(IdToObjectMapBase::set(key, value));
- if (!oldValue) {
- return false;
- }
- delete oldValue;
- return true;
-}
-
-template <class T>
-bool IdToObjectMap<T>::remove(KeyType key) {
- T* oldValue = static_cast<T*>(IdToObjectMapBase::remove(key));
- if (!oldValue)
- return false;
- delete oldValue;
- return true;
-}
-
-} // namespace emugl
-
-
-#endif // EMUGL_COMMON_ID_TO_OBJECT_MAP_H
diff --git a/distrib/android-emugl/shared/emugl/common/id_to_object_map_unittest.cpp b/distrib/android-emugl/shared/emugl/common/id_to_object_map_unittest.cpp
deleted file mode 100644
index 50740beb0..000000000
--- a/distrib/android-emugl/shared/emugl/common/id_to_object_map_unittest.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/id_to_object_map.h"
-
-#include <gtest/gtest.h>
-
-namespace emugl {
-
-namespace {
-
-typedef IdToObjectMapBase::KeyType KeyType;
-
-class Foo {
-public:
- Foo() : mVal(0) {}
- Foo(int val) : mVal(val) {}
- ~Foo() {}
- int val() const { return mVal; }
- void setVal(int val) { mVal = val; }
-private:
- int mVal;
-};
-
-} // namespace
-
-TEST(IdToObjectMap, Empty) {
- IdToObjectMap<Foo> map;
- EXPECT_TRUE(map.empty());
- EXPECT_EQ(0U, map.size());
-}
-
-TEST(IdToObjectMap, SetIntegerRange) {
- IdToObjectMap<Foo> map;
- KeyType kMax = 10000;
-
- // Add all items in the map.
- for (KeyType n = 0; n < kMax; ++n) {
- EXPECT_FALSE(map.set(n, new Foo(n))) << "For key " << n;
- }
-
- // Check final size.
- EXPECT_EQ(static_cast<size_t>(kMax), map.size());
-
- // Find all items in the map.
- for (KeyType n = 0; n < kMax; ++n) {
- EXPECT_TRUE(map.contains(n)) << "For key " << n;
- Foo* foo = NULL;
- EXPECT_TRUE(map.find(n, &foo)) << "For key " << n;
- if (foo) {
- EXPECT_EQ(static_cast<int>(n), foo->val()) << "For key " << n;
- }
- }
-}
-
-TEST(IdToObjectMap, RemoveAll) {
- IdToObjectMap<Foo> map;
- KeyType kMax = 10000;
-
- // Add all items in the map.
- for (KeyType n = 0; n < kMax; ++n) {
- EXPECT_FALSE(map.set(n, new Foo(n))) << "For key " << n;
- }
-
- EXPECT_EQ(static_cast<size_t>(kMax), map.size());
-
- for (KeyType n = 0; n < kMax; ++n) {
- EXPECT_TRUE(map.remove(n)) << "For key " << n;
- }
- EXPECT_EQ(0U, map.size());
-}
-
-TEST(IdToObjectMap, RemoveOdd) {
- IdToObjectMap<Foo> map;
- KeyType kMax = 10000;
-
- // Add all items in the map.
- for (KeyType n = 0; n < kMax; ++n) {
- EXPECT_FALSE(map.set(n, new Foo(n))) << "For key " << n;
- }
-
- EXPECT_EQ(static_cast<size_t>(kMax), map.size());
-
- for (KeyType n = 0; n < kMax; ++n) {
- if (n & 1) {
- EXPECT_TRUE(map.remove(n)) << "For key " << n;
- }
- }
- EXPECT_EQ(static_cast<size_t>(kMax / 2), map.size());
-
- for (KeyType n = 0; n < kMax; ++n) {
- if (n & 1) {
- EXPECT_FALSE(map.contains(n)) << "For key " << n;
- } else {
- EXPECT_TRUE(map.contains(n)) << "For key " << n;
- Foo* foo = NULL;
- EXPECT_TRUE(map.find(n, &foo)) << "For key " << n;
- if (foo) {
- EXPECT_EQ(static_cast<int>(n), foo->val());
- }
- }
- }
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/lazy_instance.cpp b/distrib/android-emugl/shared/emugl/common/lazy_instance.cpp
deleted file mode 100644
index ee715fa00..000000000
--- a/distrib/android-emugl/shared/emugl/common/lazy_instance.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/lazy_instance.h"
-
-#ifdef _WIN32
-# define WIN32_LEAN_AND_MEAN 1
-# include <windows.h>
-#else
-# include <sched.h>
-#endif
-
-namespace emugl {
-namespace internal {
-
-typedef LazyInstanceState::AtomicType AtomicType;
-
-#if defined(__GNUC__)
-static inline void compilerBarrier() {
- __asm__ __volatile__ ("" : : : "memory");
-}
-#else
-#error "Your compiler is not supported"
-#endif
-
-#if defined(__i386__) || defined(__x86_64__)
-# define acquireBarrier() compilerBarrier()
-# define releaseBarrier() compilerBarrier()
-#else
-# error "Your CPU is not supported"
-#endif
-
-static inline AtomicType loadAcquire(AtomicType volatile* ptr) {
- AtomicType ret = *ptr;
- acquireBarrier();
- return ret;
-}
-
-static inline void storeRelease(AtomicType volatile* ptr, AtomicType value) {
- releaseBarrier();
- *ptr = value;
-}
-
-static int atomicCompareAndSwap(AtomicType volatile* ptr,
- int expected,
- int value) {
-#ifdef _WIN32
- return InterlockedCompareExchange(ptr, value, expected);
-#elif defined(__GNUC__)
- return __sync_val_compare_and_swap(ptr, expected, value);
-#else
-#error "Your compiler is not supported"
-#endif
-}
-
-static void yieldThread() {
-#ifdef _WIN32
- ::Sleep(0);
-#else
- sched_yield();
-#endif
-}
-
-bool LazyInstanceState::inInitState() {
- return loadAcquire(&mState) == STATE_INIT;
-}
-
-bool LazyInstanceState::needConstruction() {
- AtomicType state = loadAcquire(&mState);
- if (mState == STATE_DONE)
- return false;
-
- state = atomicCompareAndSwap(&mState, STATE_INIT, STATE_CONSTRUCTING);
- if (state == STATE_INIT)
- return true;
-
- do {
- yieldThread();
- state = loadAcquire(&mState);
- } while (state != STATE_DONE);
-
- return false;
-}
-
-void LazyInstanceState::doneConstructing() {
- storeRelease(&mState, STATE_DONE);
-}
-
-} // namespace internal
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/lazy_instance.h b/distrib/android-emugl/shared/emugl/common/lazy_instance.h
deleted file mode 100644
index 6641c93d3..000000000
--- a/distrib/android-emugl/shared/emugl/common/lazy_instance.h
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_LAZY_INSTANCE_H
-#define EMUGL_COMMON_LAZY_INSTANCE_H
-
-#include <new>
-
-#ifdef _WIN32
-# define WIN32_LEAN_AND_MEAN 1
-# include <windows.h>
-#endif
-
-namespace emugl {
-namespace internal {
-
-// A LazyInstance is a helper template that can be used to perform
-// thread-safe lazy initialization of static C++ objects without forcing
-// the generation of C++ static constructors in the final executable.
-//
-// In a nutshell, you can replace a statement like:
-//
-// static Foo gFoo;
-//
-// With:
-//
-// static LazyInstance<Foo> gFoo = LAZY_INSTANCE_INIT;
-//
-// In the first case, a hidden static C++ constructor is embedded in the
-// final executable, and executed at *load* *time* to call the Foo::Foo
-// constructor on the gFoo object.
-//
-// On the second case, gFoo will only be initialized lazily, i.e. the first
-// time any code actually tries to access the variable.
-//
-// Note that access is slightly different, i.e.:
-//
-// gFoo.get() returns a reference to the lazy-initialized object.
-// gFoo.ptr() returns a pointer to it.
-// gFoo->Something() is equivalent to doing gFoo.ptr()->Something().
-//
-// 'gFoo' is stored in the .bss section and this doesn't use heap allocation.
-// This class can only be used to perform lazy initialization through the
-// class' default constructor. For more specialized cases, you will have
-// to create a derived class, e.g.:
-//
-// class FoorWithDefaultParams : public Foo {
-// public:
-// FooWithDefaultParams() : Foo(<default-parameters>) {}
-// };
-//
-// LazyInstance<FooWithDefaultParams> gFoo = LAZY_INSTANCE_INIT;
-//
-// The implementation of LazyInstance relies on atomic operations and
-// POD-struct class definitions, i.e. one that doesn't have any constructor,
-// destructor, virtual members, or private ones, and that can be
-// zero-initialized at link time.
-//
-// You can also use LazyInstance<> instances as static local variables,
-// e.g.:
-//
-// Foo* getFooSingleton() {
-// static LazyInstance<Foo> sFoo = LAZY_INSTANCE_INIT;
-// return sFoo.ptr();
-// }
-//
-// This is useful on Windows which doesn't support thread-safe lazy
-// initialization of static C++ local variables, or when the code is
-// compiled with -fno-threadsafe-statics.
-//
-// This class is heavily inspired by Chromium's implementation of the
-// same-named class (see $CHROMIUM/src/base/lazy_instance.h).
-
-// Atomic state variable type. Used to ensure to synchronize concurrent
-// initialization and access without incurring the full cost of a mutex
-// lock/unlock.
-struct LazyInstanceState {
- enum {
- STATE_INIT = 0,
- STATE_CONSTRUCTING = 1,
- STATE_DONE = 2,
- };
-
- bool inInitState();
- bool needConstruction();
- void doneConstructing();
-
-#ifdef _WIN32
- typedef LONG volatile AtomicType;
-#else
- typedef int volatile AtomicType;
-#endif
-
- volatile AtomicType mState;
-};
-
-#define LAZY_INSTANCE_STATE_INIT \
- { ::emugl::internal::LazyInstanceState::STATE_INIT }
-
-} // namespace internal
-
-// LazyInstance template definition, see comment above for usage
-// instructions. It is crucial to make this a POD-struct compatible
-// type [1].
-//
-// [1] http://en.wikipedia.org/wiki/Plain_Old_Data_Structures
-//
-template <class T>
-struct LazyInstance {
- bool hasInstance() const { return !mState.inInitState(); }
-
- T& get() const { return *ptr(); }
-
- T* ptr() const;
-
- const T* operator->() const { return ptr(); }
-
- T* operator->() { return ptr(); }
-
- T& operator*() { return get(); }
-
- // Really private, do not use.
- union {
- mutable internal::LazyInstanceState mState;
- double mPadding;
- };
- mutable char mStorage[sizeof(T)];
-};
-
-// Initialization value, must resolve to all-0 to ensure the object
-// instance is actually placed in the .bss
-#define LAZY_INSTANCE_INIT { { LAZY_INSTANCE_STATE_INIT }, { 0 } }
-
-template <class T>
-T* LazyInstance<T>::ptr() const {
- if (mState.needConstruction()) {
- new (mStorage) T();
- mState.doneConstructing();
- }
- return reinterpret_cast<T*>(mStorage);
-}
-
-} // namespace emugl
-
-#endif // EMUGL_COMMON_LAZY_INSTANCE_H
diff --git a/distrib/android-emugl/shared/emugl/common/lazy_instance_unittest.cpp b/distrib/android-emugl/shared/emugl/common/lazy_instance_unittest.cpp
deleted file mode 100644
index f9bf71cd3..000000000
--- a/distrib/android-emugl/shared/emugl/common/lazy_instance_unittest.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/lazy_instance.h"
-
-#include "emugl/common/mutex.h"
-#include "emugl/common/testing/test_thread.h"
-
-#include <gtest/gtest.h>
-
-namespace emugl {
-
-namespace {
-
-class Foo {
-public:
- Foo() : mValue(42) {}
- int get() const { return mValue; }
- void set(int value) { mValue = value; }
- ~Foo() { mValue = 13; }
-private:
- int mValue;
-};
-
-class StaticCounter {
-public:
- StaticCounter() {
- Mutex::AutoLock lock(mMutex);
- mCounter++;
- }
-
- int getValue() const {
- Mutex::AutoLock lock(mMutex);
- return mCounter;
- }
-
-private:
- static Mutex mMutex;
- static int mCounter;
-};
-
-// NOTE: This introduces a static C++ constructor for this object file,
-// but that's ok because a LazyInstance<Mutex> should not be used to
-// test the behaviour of LazyInstance :-)
-Mutex StaticCounter::mMutex;
-int StaticCounter::mCounter = 0;
-
-} // namespace
-
-TEST(LazyInstance, HasInstance) {
- LazyInstance<Foo> foo_instance = LAZY_INSTANCE_INIT;
- EXPECT_FALSE(foo_instance.hasInstance());
- EXPECT_FALSE(foo_instance.hasInstance());
- foo_instance.get();
- EXPECT_TRUE(foo_instance.hasInstance());
-}
-
-TEST(LazyInstance, Simple) {
- LazyInstance<Foo> foo_instance = LAZY_INSTANCE_INIT;
- Foo* foo1 = foo_instance.get();
- EXPECT_TRUE(foo1);
- EXPECT_EQ(42, foo_instance->get());
- foo1->set(10);
- EXPECT_EQ(10, foo_instance->get());
- EXPECT_EQ(foo1, foo_instance.get());
-}
-
-// For the following test, launch 1000 threads that each try to get
-// the instance pointer of a lazy instance. Then verify that they're all
-// the same value.
-//
-// The lazy instance has a special constructor that will increment a
-// global counter. This allows us to ensure that it is only called once.
-//
-
-namespace {
-
-// The following is the shared structure between all threads.
-struct MultiState {
- MultiState(LazyInstance<StaticCounter>* staticCounter) :
- mMutex(), mStaticCounter(staticCounter), mCount(0) {}
-
- enum {
- kMaxThreads = 1000,
- };
-
- Mutex mMutex;
- LazyInstance<StaticCounter>* mStaticCounter;
- size_t mCount;
- void* mValues[kMaxThreads];
- TestThread* mThreads[kMaxThreads];
-};
-
-// The thread function for the test below.
-static void* threadFunc(void* param) {
- MultiState* state = static_cast<MultiState*>(param);
- Mutex::AutoLock lock(state->mMutex);
- if (state->mCount < MultiState::kMaxThreads) {
- state->mValues[state->mCount++] = state->mStaticCounter->ptr();
- }
- return NULL;
-}
-
-} // namespace
-
-TEST(LazyInstance, MultipleThreads) {
- LazyInstance<StaticCounter> counter_instance = LAZY_INSTANCE_INIT;
- MultiState state(&counter_instance);
- const size_t kNumThreads = MultiState::kMaxThreads;
-
- // Create all threads.
- for (size_t n = 0; n < kNumThreads; ++n) {
- state.mThreads[n] = new TestThread(threadFunc, &state);
- }
-
- // Wait for their completion.
- for (size_t n = 0; n < kNumThreads; ++n) {
- state.mThreads[n]->join();
- }
-
- // Now check that the constructor was only called once.
- EXPECT_EQ(1, counter_instance->getValue());
-
- // Now compare all the store values, they should be the same.
- StaticCounter* expectedValue = counter_instance.get();
- for (size_t n = 0; n < kNumThreads; ++n) {
- EXPECT_EQ(expectedValue, state.mValues[n]) << "For thread " << n;
- }
-
- for (size_t n = 0; n < kNumThreads; ++n) {
- delete state.mThreads[n];
- }
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/logging.cpp b/distrib/android-emugl/shared/emugl/common/logging.cpp
deleted file mode 100644
index b3cba4592..000000000
--- a/distrib/android-emugl/shared/emugl/common/logging.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-* Copyright (C) 2016 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "emugl/common/logging.h"
-
-void default_logger(const char* fmt, ...) { }
-
-emugl_logger_t emugl_logger = default_logger;
-emugl_logger_t emugl_cxt_logger = default_logger;
-
-void set_emugl_logger(emugl_logger_t f) {
- if (!f) {
- emugl_logger = default_logger;
- } else {
- emugl_logger = f;
- }
-}
-
-void set_emugl_cxt_logger(emugl_logger_t f) {
- if (!f) {
- emugl_cxt_logger = default_logger;
- } else {
- emugl_cxt_logger = f;
- }
-}
diff --git a/distrib/android-emugl/shared/emugl/common/mutex.h b/distrib/android-emugl/shared/emugl/common/mutex.h
deleted file mode 100644
index c6cdcf2da..000000000
--- a/distrib/android-emugl/shared/emugl/common/mutex.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_MUTEX_H
-#define EMUGL_MUTEX_H
-
-#ifdef _WIN32
-# define WIN32_LEAN_AND_MEAN 1
-# include <windows.h>
-#else
-# include <pthread.h>
-#endif
-
-namespace emugl {
-
-// Simple wrapper class for mutexes.
-class Mutex {
-public:
- // Constructor.
- Mutex() {
-#ifdef _WIN32
- ::InitializeCriticalSection(&mLock);
-#else
- ::pthread_mutex_init(&mLock, NULL);
-#endif
- }
-
- // Destructor.
- ~Mutex() {
-#ifdef _WIN32
- ::DeleteCriticalSection(&mLock);
-#else
- ::pthread_mutex_destroy(&mLock);
-#endif
- }
-
- // Acquire the mutex.
- void lock() {
-#ifdef _WIN32
- ::EnterCriticalSection(&mLock);
-#else
- ::pthread_mutex_lock(&mLock);
-#endif
- }
-
- // Release the mutex.
- void unlock() {
-#ifdef _WIN32
- ::LeaveCriticalSection(&mLock);
-#else
- ::pthread_mutex_unlock(&mLock);
-#endif
- }
-
- // Helper class to lock / unlock a mutex automatically on scope
- // entry and exit.
- class AutoLock {
- public:
- AutoLock(Mutex& mutex) : mMutex(&mutex) {
- mMutex->lock();
- }
-
- ~AutoLock() {
- mMutex->unlock();
- }
- private:
- Mutex* mMutex;
- };
-
-private:
-#ifdef _WIN32
- CRITICAL_SECTION mLock;
-#else
- pthread_mutex_t mLock;
-#endif
-
-};
-
-} // namespace emugl
-
-#endif // EMUGL_MUTEX_H
diff --git a/distrib/android-emugl/shared/emugl/common/mutex_unittest.cpp b/distrib/android-emugl/shared/emugl/common/mutex_unittest.cpp
deleted file mode 100644
index e952d75d4..000000000
--- a/distrib/android-emugl/shared/emugl/common/mutex_unittest.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/mutex.h"
-
-#include "emugl/common/testing/test_thread.h"
-
-#include <gtest/gtest.h>
-
-namespace emugl {
-
-// Check that construction and destruction doesn't crash.
-TEST(Mutex, ConstructionDestruction) {
- Mutex lock;
-}
-
-// Check that a simple lock + unlock works.
-TEST(Mutex, LockUnlock) {
- Mutex lock;
- lock.lock();
- lock.unlock();
-}
-
-// Check that AutoLock compiles and doesn't crash.
-TEST(Mutex, AutoLock) {
- Mutex mutex;
- Mutex::AutoLock lock(mutex);
-}
-
-// Wrapper class for threads. Does not use emugl::Thread intentionally.
-// Common data type used by the following tests below.
-struct ThreadParams {
- ThreadParams() : mutex(), counter(0) {}
-
- Mutex mutex;
- int counter;
-};
-
-// This thread function uses Mutex::lock/unlock to synchronize a counter
-// increment operation.
-static void* threadFunction(void* param) {
- ThreadParams* p = static_cast<ThreadParams*>(param);
-
- p->mutex.lock();
- p->counter++;
- p->mutex.unlock();
- return NULL;
-}
-
-TEST(Mutex, Synchronization) {
- const size_t kNumThreads = 2000;
- TestThread* threads[kNumThreads];
- ThreadParams p;
-
- // Create and launch all threads.
- for (size_t n = 0; n < kNumThreads; ++n) {
- threads[n] = new TestThread(threadFunction, &p);
- }
-
- // Wait until their completion.
- for (size_t n = 0; n < kNumThreads; ++n) {
- threads[n]->join();
- delete threads[n];
- }
-
- EXPECT_EQ(static_cast<int>(kNumThreads), p.counter);
-}
-
-// This thread function uses a Mutex::AutoLock to protect the counter.
-static void* threadAutoLockFunction(void* param) {
- ThreadParams* p = static_cast<ThreadParams*>(param);
-
- Mutex::AutoLock lock(p->mutex);
- p->counter++;
- return NULL;
-}
-
-TEST(Mutex, AutoLockSynchronization) {
- const size_t kNumThreads = 2000;
- TestThread* threads[kNumThreads];
- ThreadParams p;
-
- // Create and launch all threads.
- for (size_t n = 0; n < kNumThreads; ++n) {
- threads[n] = new TestThread(threadAutoLockFunction, &p);
- }
-
- // Wait until their completion.
- for (size_t n = 0; n < kNumThreads; ++n) {
- threads[n]->join();
- delete threads[n];
- }
-
- EXPECT_EQ(static_cast<int>(kNumThreads), p.counter);
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/pod_vector.cpp b/distrib/android-emugl/shared/emugl/common/pod_vector.cpp
deleted file mode 100644
index c8ec3a69b..000000000
--- a/distrib/android-emugl/shared/emugl/common/pod_vector.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/pod_vector.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#define USE_MALLOC_USABLE_SIZE 0
-
-namespace emugl {
-
-static inline void swapPointers(char** p1, char** p2) {
- char* tmp = *p1;
- *p1 = *p2;
- *p2 = tmp;
-}
-
-PodVectorBase::PodVectorBase(const PodVectorBase& other) {
- initFrom(other.begin(), other.byteSize());
-}
-
-PodVectorBase& PodVectorBase::operator=(const PodVectorBase& other) {
- initFrom(other.begin(), other.byteSize());
- return *this;
-}
-
-PodVectorBase::~PodVectorBase() {
- if (mBegin) {
- // Sanity.
- ::memset(mBegin, 0xee, byteSize());
- ::free(mBegin);
- mBegin = NULL;
- mEnd = NULL;
- mLimit = NULL;
- }
-}
-
-void PodVectorBase::initFrom(const void* from, size_t fromLen) {
- if (!fromLen || !from) {
- mBegin = NULL;
- mEnd = NULL;
- mLimit = NULL;
- } else {
- mBegin = static_cast<char*>(::malloc(fromLen));
- mEnd = mLimit = mBegin + fromLen;
- ::memcpy(mBegin, from, fromLen);
- }
-}
-
-void PodVectorBase::assignFrom(const PodVectorBase& other) {
- resize(other.byteSize(), 1U);
- ::memmove(begin(), other.begin(), byteSize());
-}
-
-void PodVectorBase::resize(size_t newSize, size_t itemSize) {
- const size_t kMaxSize = maxItemCapacity(itemSize);
- size_t oldCapacity = itemCapacity(itemSize);
- const size_t kMinCapacity = 256 / itemSize;
-
- if (newSize < oldCapacity) {
- // Only shrink if the new size is really small.
- if (newSize < oldCapacity / 2 && oldCapacity > kMinCapacity) {
- reserve(newSize, itemSize);
- }
- } else if (newSize > oldCapacity) {
- size_t newCapacity = oldCapacity;
- while (newCapacity < newSize) {
- size_t newCapacity2 = newCapacity + (newCapacity >> 2) + 8;
- if (newCapacity2 < newCapacity || newCapacity > kMaxSize) {
- newCapacity = kMaxSize;
- } else {
- newCapacity = newCapacity2;
- }
- }
- reserve(newCapacity, itemSize);
- }
- mEnd = mBegin + newSize * itemSize;
-}
-
-void PodVectorBase::reserve(size_t newSize, size_t itemSize) {
- if (newSize == 0) {
- ::free(mBegin);
- mBegin = NULL;
- mEnd = NULL;
- mLimit = NULL;
- return;
- }
-
- size_t oldByteSize = byteSize();
- size_t newByteCapacity = newSize * itemSize;
- char* newBegin = static_cast<char*>(::realloc(mBegin, newByteCapacity));
- mBegin = newBegin;
- mEnd = newBegin + oldByteSize;
-#if USE_MALLOC_USABLE_SIZE
- size_t usableSize = malloc_usable_size(mBegin);
- if (usableSize > newByteCapacity) {
- newByteCapacity = usableSize - (usableSize % itemSize);
- }
-#endif
- mLimit = newBegin + newByteCapacity;
- // Sanity.
- if (newByteCapacity > oldByteSize) {
- ::memset(mBegin + oldByteSize, 0, newByteCapacity - oldByteSize);
- }
-}
-
-void PodVectorBase::removeAt(size_t itemPos, size_t itemSize) {
- size_t count = itemCount(itemSize);
- if (itemPos < count) {
- size_t pos = itemPos * itemSize;
- ::memmove(mBegin + pos,
- mBegin + pos + itemSize,
- byteSize() - pos - itemSize);
- resize(count - 1U, itemSize);
- }
-}
-
-void* PodVectorBase::insertAt(size_t itemPos, size_t itemSize) {
- size_t count = this->itemCount(itemSize);
- resize(count + 1, itemSize);
- size_t pos = itemPos * itemSize;
- if (itemPos < count) {
- ::memmove(mBegin + pos + itemSize,
- mBegin + pos,
- count * itemSize - pos);
- // Sanity to avoid copying pointers and other bad stuff.
- ::memset(mBegin + pos, 0, itemSize);
- }
- return mBegin + pos;
-}
-
-void PodVectorBase::swapAll(PodVectorBase* other) {
- swapPointers(&mBegin, &other->mBegin);
- swapPointers(&mEnd, &other->mEnd);
- swapPointers(&mLimit, &other->mLimit);
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/pod_vector.h b/distrib/android-emugl/shared/emugl/common/pod_vector.h
deleted file mode 100644
index c4e184bdf..000000000
--- a/distrib/android-emugl/shared/emugl/common/pod_vector.h
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_POD_VECTOR_H
-#define EMUGL_COMMON_POD_VECTOR_H
-
-
-#include <stddef.h>
-
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS 1
-#endif
-#include <stdint.h>
-
-#ifndef SIZE_MAX
-#error "You must define __STDC_LIMIT_MACROS before including <stddint.h>"
-#endif
-
-namespace emugl {
-
-// A PodVector is a templated vector-like type that is used to store
-// POD-struct compatible items only. This allows the implementation to
-// use ::memmove() to move items, and also malloc_usable_size() to
-// determine the best capacity.
-//
-// std::vector<> is capable of doing this in theory, using horrible
-// templating tricks that make error messages very difficult to
-// understand.
-//
-// Note that a PodVector can be used to store items that contain pointers,
-// as long as these do not point to items in the same container.
-//
-// The PodVector provides methods that also follow the std::vector<>
-// conventions, i.e. push_back() is an alias for append().
-//
-
-// NOTE: This is a re-implementation of
-// external/qemu/android/base/containers/PodVector.h for emugl.
-
-// PodVectorBase is a base, non-templated, implementation class that all
-// PodVector instances derive from. This is used to reduce template
-// specialization. Do not use directly, i..e it's an implementation detail.
-class PodVectorBase {
-protected:
- PodVectorBase() : mBegin(NULL), mEnd(NULL), mLimit(NULL) {}
- explicit PodVectorBase(const PodVectorBase& other);
- PodVectorBase& operator=(const PodVectorBase& other);
- ~PodVectorBase();
-
- bool empty() const { return mEnd == mBegin; }
-
- size_t byteSize() const { return mEnd - mBegin; }
-
- size_t byteCapacity() const { return mLimit - mBegin; }
-
- void* begin() { return mBegin; }
- const void* begin() const { return mBegin; }
- void* end() { return mEnd; }
- const void* end() const { return mEnd; }
-
- void* itemAt(size_t pos, size_t itemSize) {
- return mBegin + pos * itemSize;
- }
-
- const void* itemAt(size_t pos, size_t itemSize) const {
- return mBegin + pos * itemSize;
- }
-
- void assignFrom(const PodVectorBase& other);
-
- inline size_t itemCount(size_t itemSize) const {
- return byteSize() / itemSize;
- }
-
- inline size_t itemCapacity(size_t itemSize) const {
- return byteCapacity() / itemSize;
- }
-
- inline size_t maxItemCapacity(size_t itemSize) const {
- return SIZE_MAX / itemSize;
- }
-
- void resize(size_t newSize, size_t itemSize);
- void reserve(size_t newSize, size_t itemSize);
-
- void removeAt(size_t index, size_t itemSize);
- void* insertAt(size_t index, size_t itemSize);
- void swapAll(PodVectorBase* other);
-
- char* mBegin;
- char* mEnd;
- char* mLimit;
-
-private:
- void initFrom(const void* from, size_t fromLen);
-};
-
-
-// A PodVector<T> holds a vector (dynamically resizable array) or items
-// that must be POD-struct compatible (i.e. they cannot have constructors,
-// destructors, or virtual members). This allows the implementation to be
-// small, fast and efficient, memory-wise.
-//
-// If you want to implement a vector of C++ objects, consider using
-// std::vector<> instead, but keep in mind that this implies a non-trivial
-// cost when appending, inserting, removing items in the collection.
-//
-template <typename T>
-class PodVector : public PodVectorBase {
-public:
- // Default constructor for an empty PodVector<T>
- PodVector() : PodVectorBase() {}
-
- // Copy constructor. This copies all items from |other| into
- // the new instance with ::memmove().
- PodVector(const PodVector& other) : PodVectorBase(other) {}
-
- // Assignment operator.
- PodVector& operator=(const PodVector& other) {
- this->assignFrom(other);
- return *this;
- }
-
- // Destructor, this simply releases the internal storage block that
- // holds all the items, but doesn't touch them otherwise.
- ~PodVector() {}
-
- // Return true iff the PodVector<T> instance is empty, i.e. does not
- // have any items.
- bool empty() const { return PodVectorBase::empty(); }
-
- // Return the number of items in the current PodVector<T> instance.
- size_t size() const { return PodVectorBase::itemCount(sizeof(T)); }
-
- // Return the current capacity in the current PodVector<T> instance.
- // Do not use directly, except if you know what you're doing. Try to
- // use resize() or reserve() instead.
- size_t capacity() const {
- return PodVectorBase::itemCapacity(sizeof(T));
- }
-
- // Return the maximum capacity of any PodVector<T> instance.
- static inline size_t maxCapacity() { return SIZE_MAX / sizeof(T); }
-
- // Resize the vector to ensure it can hold |newSize|
- // items. This may or may not call reserve() under the hood.
- // It's a fatal error to try to resize above maxCapacity().
- void resize(size_t newSize) {
- PodVectorBase::resize(newSize, sizeof(T));
- }
-
- // Resize the vector's storage array to ensure that it can hold at
- // least |newSize| items. It's a fatal error to try to resize above
- // maxCapacity().
- void reserve(size_t newSize) {
- PodVectorBase::reserve(newSize, sizeof(T));
- }
-
- // Return a pointer to the first item in the vector. This is only
- // valid until the next call to any function that changes the size
- // or capacity of the vector. Can be NULL if the vector is empty.
- T* begin() {
- return reinterpret_cast<T*>(PodVectorBase::begin());
- }
-
- // Return a constant pointer to the first item in the vector. This is
- // only valid until the next call to any function that changes the
- // size of capacity of the vector.
- const T* begin() const {
- return reinterpret_cast<T*>(PodVectorBase::begin());
- }
-
- // Return a pointer past the last item in the vector. I.e. if the
- // result is not NULL, then |result - 1| points to the last item.
- // Can be NULL if the vector is empty.
- T* end() {
- return reinterpret_cast<T*>(PodVectorBase::end());
- }
-
- // Return a constant pointer past the last item in the vector. I.e. if
- // the result is not NULL, then |result - 1| points to the last item.
- // Can be NULL if the vector is empty.
- const T* end() const {
- return reinterpret_cast<T*>(PodVectorBase::end());
- }
-
- // Returns a reference to the item a position |index| in the vector.
- // It may be a fatal error to access an out-of-bounds position.
- T& operator[](size_t index) {
- return *reinterpret_cast<T*>(
- PodVectorBase::itemAt(index, sizeof(T)));
- }
-
- const T& operator[](size_t index) const {
- return *reinterpret_cast<const T*>(
- PodVectorBase::itemAt(index, sizeof(T)));
- }
-
- // Increase the vector's size by 1, then move all items past a given
- // position to the right. Return the position of the insertion point
- // to let the caller copy the content it desires there. It's preferrable
- // to use insert() directly, which will do the item copy for you.
- T* emplace(size_t index) {
- return reinterpret_cast<T*>(
- PodVectorBase::insertAt(index, sizeof(T)));
- }
-
- // Insert an item at a given position. |index| is the insertion position
- // which must be between 0 and size() included, or a fatal error may
- // occur. |item| is a reference to an item to copy into the array,
- // byte-by-byte.
- void insert(size_t index, const T& item) {
- *(this->emplace(index)) = item;
- }
-
- // Prepend an item at the start of a vector. This moves all vector items
- // to the right, and is thus costly. |item| is a reference to an item
- // to copy to the start of the vector.
- void prepend(const T& item) {
- *(this->emplace(0U)) = item;
- }
-
- // Append an item at the end of a vector. Specialized version of insert()
- // which always uses size() as the insertion position.
- void append(const T& item) {
- *(this->emplace(this->size())) = item;
- }
-
- // Remove the item at a given position. |index| is the position of the
- // item to delete. It must be between 0 and size(), included, or
- // a fatal error may occur. Deleting the item at position size()
- // doesn't do anything.
- void remove(size_t index) {
- PodVectorBase::removeAt(index, sizeof(T));
- }
-
- void swap(PodVector* other) {
- PodVectorBase::swapAll(other);
- }
-
- // Compatibility methods for std::vector<>
- void push_back(const T& item) { append(item); }
- void pop() { remove(0U); }
-
- typedef T* iterator;
- typedef const T* const_iterator;
-};
-
-} // namespace emugl
-
-#endif // EMUGL_COMMON_POD_VECTOR_H
diff --git a/distrib/android-emugl/shared/emugl/common/pod_vector_unittest.cpp b/distrib/android-emugl/shared/emugl/common/pod_vector_unittest.cpp
deleted file mode 100644
index 9ce509ad6..000000000
--- a/distrib/android-emugl/shared/emugl/common/pod_vector_unittest.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/pod_vector.h"
-
-#include <gtest/gtest.h>
-
-namespace emugl {
-
-static int hashIndex(size_t n) {
- return static_cast<int>(((n >> 14) * 13773) + (n * 51));
-}
-
-TEST(PodVector, Empty) {
- PodVector<int> v;
- EXPECT_TRUE(v.empty());
- EXPECT_EQ(0U, v.size());
-}
-
-TEST(PodVector, AppendOneItem) {
- PodVector<int> v;
- v.append(10234);
- EXPECT_FALSE(v.empty());
- EXPECT_EQ(1U, v.size());
- EXPECT_EQ(10234, v[0]);
-}
-
-TEST(PodVector, AppendLotsOfItems) {
- PodVector<int> v;
- const size_t kMaxCount = 10000;
- for (size_t n = 0; n < kMaxCount; ++n) {
- v.append(hashIndex(n));
- }
- EXPECT_EQ(kMaxCount, v.size());
- for (size_t n = 0; n < kMaxCount; ++n) {
- EXPECT_EQ(hashIndex(n), v[n]) << "At index " << n;
- }
-}
-
-TEST(PodVector, RemoveFrontItems) {
- PodVector<int> v;
- const size_t kMaxCount = 100;
- for (size_t n = 0; n < kMaxCount; ++n) {
- v.append(hashIndex(n));
- }
- EXPECT_EQ(kMaxCount, v.size());
- for (size_t n = 0; n < kMaxCount; ++n) {
- EXPECT_EQ(hashIndex(n), v[0]) << "At index " << n;
- v.remove(0U);
- EXPECT_EQ(kMaxCount - n - 1U, v.size()) << "At index " << n;
- }
-}
-
-TEST(PodVector, PrependItems) {
- PodVector<int> v;
- const size_t kMaxCount = 100;
- for (size_t n = 0; n < kMaxCount; ++n) {
- v.prepend(hashIndex(n));
- }
- EXPECT_EQ(kMaxCount, v.size());
- for (size_t n = 0; n < kMaxCount; ++n) {
- EXPECT_EQ(hashIndex(kMaxCount - n - 1), v[n]) << "At index " << n;
- }
-}
-
-TEST(PodVector, ResizeExpands) {
- PodVector<int> v;
- const size_t kMaxCount = 100;
- const size_t kMaxCount2 = 10000;
- for (size_t n = 0; n < kMaxCount; ++n) {
- v.append(hashIndex(n));
- }
- EXPECT_EQ(kMaxCount, v.size());
- v.resize(kMaxCount2);
- EXPECT_EQ(kMaxCount2, v.size());
- for (size_t n = 0; n < kMaxCount; ++n) {
- EXPECT_EQ(hashIndex(n), v[n]) << "At index " << n;
- }
-}
-
-TEST(PodVector, ResizeTruncates) {
- PodVector<int> v;
- const size_t kMaxCount = 10000;
- const size_t kMaxCount2 = 10;
- for (size_t n = 0; n < kMaxCount; ++n) {
- v.append(hashIndex(n));
- }
- EXPECT_EQ(kMaxCount, v.size());
- v.resize(kMaxCount2);
- EXPECT_EQ(kMaxCount2, v.size());
- for (size_t n = 0; n < kMaxCount2; ++n) {
- EXPECT_EQ(hashIndex(n), v[n]) << "At index " << n;
- }
-}
-
-
-TEST(PodVector, AssignmentOperator) {
- PodVector<int> v1;
- const size_t kMaxCount = 10000;
- for (size_t n = 0; n < kMaxCount; ++n) {
- v1.append(hashIndex(n));
- }
- EXPECT_EQ(kMaxCount, v1.size());
-
- PodVector<int> v2;
- v2 = v1;
-
- v1.reserve(0);
-
- EXPECT_EQ(kMaxCount, v2.size());
- for (size_t n = 0; n < kMaxCount; ++n) {
- EXPECT_EQ(hashIndex(n), v2[n]) << "At index " << n;
- }
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/scoped_pointer_vector.h b/distrib/android-emugl/shared/emugl/common/scoped_pointer_vector.h
deleted file mode 100644
index 3d263e9a6..000000000
--- a/distrib/android-emugl/shared/emugl/common/scoped_pointer_vector.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_SCOPED_POINTER_VECTOR_H
-#define EMUGL_COMMON_SCOPED_POINTER_VECTOR_H
-
-namespace emugl {
-
-template <class T>
-class ScopedPointerVector {
- ScopedPointerVector
-};
-
-} // namespace emugl
-
-#endif // EMUGL_COMMON_SCOPED_POINTER_VECTOR_H
diff --git a/distrib/android-emugl/shared/emugl/common/shared_library.cpp b/distrib/android-emugl/shared/emugl/common/shared_library.cpp
deleted file mode 100644
index e78e36b5b..000000000
--- a/distrib/android-emugl/shared/emugl/common/shared_library.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/shared_library.h"
-
-#include <stddef.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifndef _WIN32
-#include <dlfcn.h>
-#include <stdlib.h>
-#endif
-
-namespace emugl {
-
-#ifdef _WIN32
-
-// static
-SharedLibrary* SharedLibrary::open(const char* libraryName) {
- HMODULE lib = LoadLibrary(libraryName);
- return lib ? new SharedLibrary(lib) : NULL;
-}
-
-SharedLibrary::SharedLibrary(HandleType lib) : mLib(lib) {}
-
-SharedLibrary::~SharedLibrary() {
- if (mLib) {
- FreeLibrary(mLib);
- }
-}
-
-SharedLibrary::FunctionPtr SharedLibrary::findSymbol(
- const char* symbolName) {
- if (!mLib || !symbolName) {
- return NULL;
- }
- return reinterpret_cast<FunctionPtr>(
- GetProcAddress(mLib, symbolName));
-}
-
-#else // !_WIN32
-
-// static
-SharedLibrary* SharedLibrary::open(const char* libraryName) {
- const char* libPath = libraryName;
- char* path = NULL;
-
- const char* libBaseName = strrchr(libraryName, '/');
- if (!libBaseName) {
- libBaseName = libraryName;
- }
-
- if (!strchr(libBaseName, '.')) {
- // There is no extension in this library name, so append one.
-#ifdef __APPLE__
- static const char kDllExtension[] = ".dylib";
-#else
- static const char kDllExtension[] = ".so";
-#endif
- size_t pathLen = strlen(libraryName) + sizeof(kDllExtension);
- path = static_cast<char*>(malloc(pathLen));
- snprintf(path, pathLen, "%s%s", libraryName, kDllExtension);
- libPath = path;
- }
-
-#ifdef __APPLE__
- // On OSX, some libraries don't include an extension (notably OpenGL)
- // On OSX we try to open |libraryName| first. If that doesn't exist,
- // we try |libraryName|.dylib
- void* lib = dlopen(libraryName, RTLD_NOW);
- if (lib == NULL) {
- lib = dlopen(libPath, RTLD_NOW);
- }
-#else
- void* lib = dlopen(libPath, RTLD_NOW);
-#endif
-
- if (path) {
- free(path);
- }
-
- return lib ? new SharedLibrary(lib) : NULL;
-}
-
-SharedLibrary::SharedLibrary(HandleType lib) : mLib(lib) {}
-
-SharedLibrary::~SharedLibrary() {
- if (mLib) {
- dlclose(mLib);
- }
-}
-
-SharedLibrary::FunctionPtr SharedLibrary::findSymbol(
- const char* symbolName) {
- if (!mLib || !symbolName) {
- return NULL;
- }
- return reinterpret_cast<FunctionPtr>(dlsym(mLib, symbolName));
-}
-
-#endif // !_WIN32
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/shared_library.h b/distrib/android-emugl/shared/emugl/common/shared_library.h
deleted file mode 100644
index f1d82fcee..000000000
--- a/distrib/android-emugl/shared/emugl/common/shared_library.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_SHARED_LIBRARY_H
-#define EMUGL_COMMON_SHARED_LIBRARY_H
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-namespace emugl {
-
-// A class used to open a platform-specific shared library, and probe
-// it for symbols. Usage is the following:
-//
-// // Open the library.
-// SharedLibrary* library = SharedLibrary::open("libFoo");
-// if (!library) {
-// ... could not find / open library!
-// }
-//
-// //Probe for function symbol.
-// FunctionPtr my_func = library->findSymbol("my_func");
-//
-// // Closes library/
-// delete library;
-//
-class SharedLibrary {
-public:
- // Open a given library. If |libraryName| has no extension, a
- // platform-appropriate extension is added and that path is opened.
- // If the |libraryName| has an extension, that form is opened.
- //
- // On OSX, some libraries don't include an extension (notably OpenGL)
- // On OSX we try to open |libraryName| first. If that doesn't exist,
- // we try |libraryName|.dylib
- //
- // On success, returns a new SharedLibrary instance that must be
- // deleted by the caller.
- static SharedLibrary* open(const char* libraryName);
-
- // Closes an existing SharedLibrary instance.
- ~SharedLibrary();
-
- // Generic function pointer type, for values returned by the
- // findSymbol() method.
- typedef void (*FunctionPtr)(void);
-
- // Probe a given SharedLibrary instance to find a symbol named
- // |symbolName| in it. Return its address as a FunctionPtr, or
- // NULL if the symbol is not found.
- FunctionPtr findSymbol(const char* symbolName);
-
-private:
-#ifdef _WIN32
- typedef HMODULE HandleType;
-#else
- typedef void* HandleType;
-#endif
-
- // Constructor intentionally hidden.
- SharedLibrary(HandleType);
-
- HandleType mLib;
-};
-
-// Macro to compose emugl shared library name under various OS and bitness
-// eg.
-// on x86_64, EMUGL_LIBNAME("foo") --> "lib64foo"
-
-#if defined(__x86_64__)
-# define EMUGL_LIBNAME(name) "lib64" name
-#elif defined(__i386__)
-# define EMUGL_LIBNAME(name) "lib" name
-#else
-/* This header is included by target w/o using EMUGL_LIBNAME(). Don't #error, leave it undefined */
-#endif
-
-} // namespace emugl
-
-#endif // EMUGL_COMMON_SHARED_LIBRARY_H
diff --git a/distrib/android-emugl/shared/emugl/common/shared_library_unittest.cpp b/distrib/android-emugl/shared/emugl/common/shared_library_unittest.cpp
deleted file mode 100644
index cb74efaa3..000000000
--- a/distrib/android-emugl/shared/emugl/common/shared_library_unittest.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/shared_library.h"
-
-#include <gtest/gtest.h>
-
-#include <string>
-
-#include <limits.h>
-#include <string.h>
-
-// Hack to get the current executable's full path.
-namespace testing {
-namespace internal {
-
-extern std::string g_executable_path;
-
-} // namespace internal
-} // namespace testing
-
-namespace emugl {
-
-namespace {
-
-// Return the name/path of the test shared library to load.
-// Note that this doesn't include a platform-specific extension.
-// This assumes that the test shared library is under the lib/ sub-directory
-// of the current executable's path!
-std::string GetTestLibraryName() {
- static const char kSubDir[] = "lib/";
-#ifdef __x86_64__
- static const char kLibraryPrefix[] = "lib64";
-#else
- static const char kLibraryPrefix[] = "lib";
-#endif
- static const char kTestLibrarySuffix[] = "emugl_test_shared_library";
-
- const char* exec_path = testing::internal::g_executable_path.c_str();
-
-#ifdef _WIN32
- const char* p = strrchr(exec_path, '/');
- const char* p2 = strrchr(exec_path, '\\');
- if (p2) {
- if (!p || p2 > p) {
- p = p2;
- }
- }
-#else
- const char* p = strrchr(exec_path, '/');
-#endif
-
- std::string path;
-
- if (!p) {
- path = "./";
- } else {
- path = std::string(exec_path, p - exec_path + 1U);
- }
- path += kSubDir;
- path += kLibraryPrefix;
- path += kTestLibrarySuffix;
- printf("Library path: %s\n", path.c_str());
- return path;
-}
-
-class SharedLibraryTest : public testing::Test {
-public:
- SharedLibraryTest() {
- // Locate the shared library
- mLibraryPath = GetTestLibraryName();
- }
-
- ~SharedLibraryTest() {}
-
- const char* library_path() const { return mLibraryPath.c_str(); }
-
-private:
- std::string mLibraryPath;
-};
-
-class ScopedSharedLibrary {
-public:
- explicit ScopedSharedLibrary(SharedLibrary* lib) : mLib(lib) {}
- ~ScopedSharedLibrary() {
- delete mLib;
- }
- SharedLibrary* get() const { return mLib; }
-
- SharedLibrary* operator->() { return mLib; }
-
- void release() {
- delete mLib;
- mLib = NULL;
- }
-
-private:
- SharedLibrary* mLib;
-};
-
-} // namespace
-
-TEST_F(SharedLibraryTest, Open) {
- ScopedSharedLibrary lib(SharedLibrary::open(library_path()));
- EXPECT_TRUE(lib.get());
-}
-
-TEST_F(SharedLibraryTest, OpenLibraryWithExtension) {
- std::string path = library_path();
-
- // test extension append
- ScopedSharedLibrary libNoExtension(SharedLibrary::open(path.c_str()));
- EXPECT_TRUE(libNoExtension.get());
- libNoExtension.release();
-
-#ifdef _WIN32
- path += ".dll";
-#elif defined(__APPLE__)
- // try to open the library without an extension
-
- path += ".dylib";
-#else
- path += ".so";
-#endif
-
- // test open with prepended extension
- ScopedSharedLibrary lib(SharedLibrary::open(path.c_str()));
- EXPECT_TRUE(lib.get());
-}
-
-#ifdef __APPLE__
-TEST_F(SharedLibraryTest, OpenLibraryWithoutExtension) {
- const char* library = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
- ScopedSharedLibrary lib(SharedLibrary::open(library));
- EXPECT_TRUE(lib.get());
-}
-#endif
-
-TEST_F(SharedLibraryTest, FindSymbol) {
- ScopedSharedLibrary lib(SharedLibrary::open(library_path()));
- EXPECT_TRUE(lib.get());
-
- if (lib.get()) {
- typedef int (*FooFunction)(void);
-
- FooFunction foo_func = reinterpret_cast<FooFunction>(
- lib->findSymbol("foo_function"));
- EXPECT_TRUE(foo_func);
- EXPECT_EQ(42, (*foo_func)());
- }
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/smart_ptr.cpp b/distrib/android-emugl/shared/emugl/common/smart_ptr.cpp
deleted file mode 100644
index 703487d87..000000000
--- a/distrib/android-emugl/shared/emugl/common/smart_ptr.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/smart_ptr.h"
-
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#endif
-
-namespace emugl {
-
-// Thread-safe atomic reference-counting type.
-class RefCount {
-public:
- RefCount() : mCount(1) {}
- ~RefCount() {}
-
- // Technically not thread-safe, use only for testing.
- int count() const { return (int)mCount; }
-
- void increment() {
-#ifdef _WIN32
- InterlockedIncrement(&mCount);
-#else
- __sync_fetch_and_add(&mCount, 1);
-#endif
- }
-
- bool decrement() {
-#ifdef _WIN32
- return InterlockedDecrement(&mCount) == 0;
-#else
- return __sync_add_and_fetch(&mCount, -1) == 0;
-#endif
- }
-
-private:
-#ifdef _WIN32
- LONG mCount;
-#else
- int mCount;
-#endif
-};
-
-
-// SmartPtrBase implementation.
-
-SmartPtrBase::SmartPtrBase(void* ptr) : mPtr(ptr), mRefCount(NULL) {
- if (mPtr)
- mRefCount = new RefCount();
-}
-
-
-SmartPtrBase::SmartPtrBase(const SmartPtrBase& other)
- : mPtr(other.mPtr), mRefCount(other.mRefCount) {
- if (mRefCount)
- mRefCount->increment();
-}
-
-
-int SmartPtrBase::getRefCount() const {
- return mRefCount ? mRefCount->count() : 0;
-}
-
-
-void SmartPtrBase::addRef() {
- if (mRefCount)
- mRefCount->increment();
-}
-
-
-void* SmartPtrBase::copyFrom(const SmartPtrBase& other) {
- void* old_ptr = release();
-
- mPtr = other.mPtr;
- mRefCount = other.mRefCount;
- if (mRefCount)
- mRefCount->increment();
-
- return old_ptr;
-}
-
-
-void* SmartPtrBase::release() {
- void* old_ptr = mPtr;
- RefCount* old_refcount = mRefCount;
-
- if (old_refcount) {
- mPtr = NULL;
- mRefCount = NULL;
-
- if (old_refcount->decrement()) {
- delete old_refcount;
- return old_ptr;
- }
- }
-
- return NULL;
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/smart_ptr.h b/distrib/android-emugl/shared/emugl/common/smart_ptr.h
deleted file mode 100644
index 5de90a738..000000000
--- a/distrib/android-emugl/shared/emugl/common/smart_ptr.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#pragma once
-
-#include <memory>
-
-namespace emugl {
-
-template <class T>
-using SmartPtr = std::shared_ptr<T>;
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/smart_ptr_unittest.cpp b/distrib/android-emugl/shared/emugl/common/smart_ptr_unittest.cpp
deleted file mode 100644
index 715e4718c..000000000
--- a/distrib/android-emugl/shared/emugl/common/smart_ptr_unittest.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/smart_ptr.h"
-
-#include <gtest/gtest.h>
-
-namespace emugl {
-
-// This Test sub-class is used to track allocations and deallocations of
-// the MyTestClass instances that are created through newInstance().
-// See below for typical usage.
-class SmartPtrTest : public testing::Test {
-public:
- SmartPtrTest() : mNewCount(0), mDeleteCount(0), mDoCount(0) {}
-
- ~SmartPtrTest() {
- mNewCount = 0;
- mDoCount = 0;
- mDeleteCount = 0;
- }
-
- class MyClass;
-
- MyClass* newInstance() {
- return new MyClass(this);
- }
-
- class MyClass {
- public:
- MyClass(SmartPtrTest* test) : mTest(test) {
- mTest->mNewCount++;
- }
-
- void doStuff() {
- mTest->mDoCount++;
- }
-
- ~MyClass() {
- mTest->mDeleteCount++;
- }
- private:
- SmartPtrTest* mTest;
- };
-
- int mNewCount;
- int mDeleteCount;
- int mDoCount;
-};
-
-
-TEST_F(SmartPtrTest, Empty) {
- SmartPtr<MyClass> ptr;
- EXPECT_FALSE(ptr.get());
-
- EXPECT_EQ(0, mNewCount);
- EXPECT_EQ(0, mDeleteCount);
- EXPECT_EQ(0, mDoCount);
-}
-
-
-TEST_F(SmartPtrTest, SingleRef) {
- MyClass* obj = newInstance();
- EXPECT_EQ(1, mNewCount);
-
- {
- SmartPtr<MyClass> ptr(obj);
- EXPECT_EQ(obj, ptr.get());
-
- EXPECT_EQ(1, mNewCount);
- EXPECT_EQ(0, mDeleteCount);
- EXPECT_EQ(0, mDoCount);
- }
- // Check that the object was deleted.
- EXPECT_EQ(1, mDeleteCount);
-}
-
-
-TEST_F(SmartPtrTest, CopyConstructor) {
- MyClass* obj = newInstance();
- EXPECT_EQ(1, mNewCount);
-
- {
- SmartPtr<MyClass> ptr1(obj);
- {
- SmartPtr<MyClass> ptr2(ptr1);
- EXPECT_EQ(2, ptr1.use_count());
- EXPECT_EQ(2, ptr2.use_count());
- EXPECT_EQ(1, mNewCount);
- EXPECT_EQ(0, mDeleteCount);
- EXPECT_EQ(0, mDoCount);
- }
- EXPECT_EQ(1, mNewCount);
- EXPECT_EQ(0, mDeleteCount);
- EXPECT_EQ(0, mDoCount);
- }
- EXPECT_EQ(1, mNewCount);
- EXPECT_EQ(1, mDeleteCount);
- EXPECT_EQ(0, mDoCount);
-}
-
-
-TEST_F(SmartPtrTest, AssignmentOperator) {
- SmartPtr<MyClass> ptr1(newInstance());
- SmartPtr<MyClass> ptr2(newInstance());
- EXPECT_EQ(2, mNewCount);
- EXPECT_EQ(0, mDeleteCount);
- EXPECT_EQ(0, mDoCount);
-
- ptr2 = ptr1;
- EXPECT_EQ(2, mNewCount);
- EXPECT_EQ(1, mDeleteCount);
-
- EXPECT_EQ(ptr1.get(), ptr2.get());
- EXPECT_EQ(2, ptr1.use_count());
- EXPECT_EQ(2, ptr2.use_count());
-}
-
-
-TEST_F(SmartPtrTest, ArrowOperator) {
- SmartPtr<MyClass> ptr(newInstance());
- ptr->doStuff();
- EXPECT_EQ(1, mDoCount);
-
- (*ptr).doStuff();
- EXPECT_EQ(2, mDoCount);
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/sockets.cpp b/distrib/android-emugl/shared/emugl/common/sockets.cpp
deleted file mode 100644
index 2a13d7293..000000000
--- a/distrib/android-emugl/shared/emugl/common/sockets.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/sockets.h"
-
-#include <errno.h>
-
-#ifdef _WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#else
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-#endif
-
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-
-namespace emugl {
-
-namespace {
-
-static void socketSetReuseAddress(int s) {
-#ifdef _WIN32
- // The default behaviour on Windows is equivalent to SO_REUSEADDR
- // so we don't need to set this option. Moreover, one should never
- // set this option with WinSock because it's badly implemented and
- // generates a huge security issue. See:
- // http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621(v=vs.85).aspx
-#else
- int val = 1;
- setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
-#endif
-}
-
-// Helper union to store a socket address.
-struct SockAddr {
- socklen_t len;
- union {
- sockaddr generic;
- sockaddr_in inet;
-#ifndef _WIN32
- sockaddr_un local;
-#endif
- };
-
- int getFamily() const { return generic.sa_family; }
-
- void initEmpty() {
- ::memset(this, 0, sizeof(*this));
- this->len = static_cast<socklen_t>(sizeof(*this));
- }
-
- int initFromInet(uint32_t ip_address, int port) {
- if (port < 0 || port >= 65536)
- return -EINVAL;
-
- ::memset(this, 0, sizeof(*this));
- this->inet.sin_family = AF_INET;
- this->inet.sin_port = htons(port);
- this->inet.sin_addr.s_addr = htonl(ip_address);
- this->len = sizeof(this->inet);
- return 0;
- }
-
- int initFromLocalhost(int port) {
- return initFromInet(0x7f000001, port);
- }
-
-#ifndef _WIN32
- // Initialize the SockAddr from a Unix path. Returns 0 on success,
- // or -errno code on failure.
- int initFromUnixPath(const char* path) {
- if (!path || !path[0])
- return -EINVAL;
-
- size_t pathLen = ::strlen(path);
- if (pathLen >= sizeof(local.sun_path))
- return -E2BIG;
-
- ::memset(this, 0, sizeof(*this));
- this->local.sun_family = AF_LOCAL;
- ::memcpy(this->local.sun_path, path, pathLen + 1U);
- this->len = pathLen + offsetof(sockaddr_un, sun_path);
- return 0;
- }
-#endif
-};
-
-int socketBindInternal(const SockAddr* addr, int socketType) {
- int s = ::socket(addr->getFamily(), socketType, 0);
- if (s < 0)
- return -errno;
-
- // Bind to the socket.
- if (::bind(s, &addr->generic, addr->len) < 0 ||
- ::listen(s, 5) < 0) {
- int ret = -errno;
- ::close(s);
- return ret;
- }
-
- socketSetReuseAddress(s);
- return s;
-}
-
-int socketConnectInternal(const SockAddr* addr, int socketType) {
- int s = ::socket(addr->getFamily(), socketType, 0);
- if (s < 0)
- return -errno;
-
- int ret;
- do {
- ret = ::connect(s, &addr->generic, addr->len);
- } while (ret < 0 && errno == EINTR);
-
- if (ret < 0) {
- ret = -errno;
- ::close(s);
- return ret;
- }
-
- return s;
-}
-
-} // namespace
-
-void socketTcpDisableNagle(int s) {
- // disable Nagle algorithm to improve bandwidth of small
- // packets which are quite common in our implementation.
-#ifdef _WIN32
- DWORD flag;
-#else
- int flag;
-#endif
- flag = 1;
- setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
- (const char*)&flag, sizeof(flag));
-}
-
-int socketGetPort(int s) {
- SockAddr addr;
- addr.initEmpty();
- if (getsockname(s, &addr.generic, &addr.len) < 0) {
- return -errno;
- }
- switch (addr.generic.sa_family) {
- case AF_INET:
- return ntohs(addr.inet.sin_port);
- default:
- ;
- }
- return -EINVAL;
-}
-
-#ifndef _WIN32
-int socketLocalServer(const char* path, int socketType) {
- SockAddr addr;
- int ret = addr.initFromUnixPath(path);
- if (ret < 0) {
- return ret;
- }
- return socketBindInternal(&addr, socketType);
-}
-
-int socketLocalClient(const char* path, int socketType) {
- SockAddr addr;
- int ret = addr.initFromUnixPath(path);
- if (ret < 0) {
- return ret;
- }
- return socketConnectInternal(&addr, socketType);
-}
-#endif // !_WIN32
-
-int socketTcpLoopbackServer(int port, int socketType) {
- SockAddr addr;
- int ret = addr.initFromLocalhost(port);
- if (ret < 0) {
- return ret;
- }
- return socketBindInternal(&addr, socketType);
-}
-
-int socketTcpLoopbackClient(int port, int socketType) {
- SockAddr addr;
- int ret = addr.initFromLocalhost(port);
- if (ret < 0) {
- return ret;
- }
- return socketConnectInternal(&addr, socketType);
-}
-
-int socketTcpClient(const char* hostname, int port, int socketType) {
- // TODO(digit): Implement this.
- return -ENOSYS;
-}
-
-int socketAccept(int serverSocket) {
- int ret;
- do {
- ret = ::accept(serverSocket, NULL, NULL);
- } while (ret < 0 && errno == EINTR);
- return ret;
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/sockets.h b/distrib/android-emugl/shared/emugl/common/sockets.h
deleted file mode 100644
index 11e7ac7dd..000000000
--- a/distrib/android-emugl/shared/emugl/common/sockets.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_SOCKETS_H
-#define EMUGL_COMMON_SOCKETS_H
-
-// A set of helper functions used to deal with sockets in a portable way.
-
-namespace emugl {
-
-// Disable Nagle's algorithm for socket descriptor |s|. This assumes
-// that |s| is a TCP socket descriptor.
-void socketTcpDisableNagle(int s);
-
-// Return the port associated with a given IP or IPv6 socket,
-// or -errno code on failure.
-int socketGetPort(int s);
-
-// Bind to a local/Unix path, and return its socket descriptor on success,
-// or -errno code on failure.
-int socketLocalServer(const char* path, int socketType);
-
-// Connect to a Unix local path, and return a new socket descriptor
-// on success, or -errno code on failure.
-int socketLocalClient(const char* path, int socketType);
-
-// Bind to a localhost TCP socket, and return its socket descriptor on
-// success, or -errno code on failure.
-int socketTcpLoopbackServer(int port, int socketType);
-
-// Connect to a localhost TCP port, and return a new socket descriptor on
-// success, or -errno code on failure.
-int socketTcpLoopbackClient(int port, int socketType);
-
-// Connect to a TCP host, and return a new socket descriptor on
-// success, or -errno code on failure.
-int socketTcpClient(const char* hostname, int port, int socketType);
-
-// Accept a new connection. |serverSocket| must be a bound server socket
-// descriptor. Returns new socket descriptor on success, or -errno code
-// on failure.
-int socketAccept(int serverSocket);
-
-} // namespace emugl
-
-#endif // EMUGL_COMMON_SOCKETS_H
diff --git a/distrib/android-emugl/shared/emugl/common/testing/test_shared_library.cpp b/distrib/android-emugl/shared/emugl/common/testing/test_shared_library.cpp
deleted file mode 100644
index 598a963a8..000000000
--- a/distrib/android-emugl/shared/emugl/common/testing/test_shared_library.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2014 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.
-
-// This source file must be compiled into a simple shared library which
-// will be used by shared_library_unittest.cpp to verify that the
-// emugl::SharedLibrary class works properly.
-
-
-extern "C" int foo_function(void) {
- return 42;
-}
diff --git a/distrib/android-emugl/shared/emugl/common/testing/test_thread.h b/distrib/android-emugl/shared/emugl/common/testing/test_thread.h
deleted file mode 100644
index 2d758b3f4..000000000
--- a/distrib/android-emugl/shared/emugl/common/testing/test_thread.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_TESTING_TEST_THREAD_H
-#define EMUGL_COMMON_TESTING_TEST_THREAD_H
-
-#ifdef _WIN32
-# define WIN32_LEAN_AND_MEAN 1
-# include <windows.h>
-#else
-# include <pthread.h>
-#endif
-
-namespace emugl {
-
-// Very basic platform thread wrapper that only uses a tiny stack.
-// This shall only be used during unit testing, and allows test code
-// to not depend on the implementation of emugl::Thread.
-class TestThread {
-public:
- // Main thread function type.
- typedef void* (ThreadFunction)(void* param);
-
- // Constructor actually launches a new platform thread.
- TestThread(ThreadFunction* func, void* funcParam) {
-#ifdef _WIN32
- mThread = CreateThread(NULL,
- 16384,
- (DWORD WINAPI (*)(void*))func,
- funcParam,
- NULL,
- NULL);
-#else
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setstacksize(&attr, 16384);
- pthread_create(&mThread, &attr, func, funcParam);
- pthread_attr_destroy(&attr);
-#endif
- }
-
- ~TestThread() {
-#ifdef _WIN32
- CloseHandle(mThread);
-#endif
- }
-
- void join() {
-#ifdef _WIN32
- WaitForSingleObject(mThread, INFINITE);
-#else
- void* ret = NULL;
- pthread_join(mThread, &ret);
-#endif
- }
-
-private:
-#ifdef _WIN32
- HANDLE mThread;
-#else
- pthread_t mThread;
-#endif
-};
-
-} // namespace emugl
-
-#endif // EMUGL_COMMON_TESTING_TEST_THREAD_H
diff --git a/distrib/android-emugl/shared/emugl/common/thread.h b/distrib/android-emugl/shared/emugl/common/thread.h
deleted file mode 100644
index d0f7d206d..000000000
--- a/distrib/android-emugl/shared/emugl/common/thread.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_THREAD_H
-#define EMUGL_COMMON_THREAD_H
-
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <pthread.h>
-#endif
-
-#include <stdint.h>
-
-namespace emugl {
-
-// Wrapper class for platform-specific threads.
-// To create your own thread, define a sub-class of emugl::Thread
-// and override its main() method.
-//
-// For example:
-//
-// class MyThread : public emugl::Thread {
-// public:
-// MyThread() : Thread() {}
-//
-// virtual intptr_t main() {
-// ... main thread loop implementation
-// return 0;
-// }
-// };
-//
-// ...
-//
-// // Create new instance, but does not start it.
-// MyThread* thread = new MyThread();
-//
-// // Start the thread.
-// thread->start();
-//
-// // Wait for thread completion, and gets result into |exitStatus|.
-// int exitStatus;
-// thread->wait(&exitStatus);
-//
-class Thread {
-public:
- // Public constructor.
- Thread();
-
- // Virtual destructor.
- virtual ~Thread();
-
- // Override this method in your own thread sub-classes. This will
- // be called when start() is invoked on the Thread instance.
- virtual intptr_t main() = 0;
-
- // Start a thread instance. Return true on success, false otherwise
- // (e.g. if the thread was already started or terminated).
- bool start();
-
- // Wait for thread termination and retrieve exist status into
- // |*exitStatus|. Return true on success, false otherwise.
- // NOTE: |exitStatus| can be NULL.
- bool wait(intptr_t *exitStatus);
-
- // Check whether a thread has terminated. On success, return true
- // and sets |*exitStatus|. On failure, return false.
- // NOTE: |exitStatus| can be NULL.
- bool tryWait(intptr_t *exitStatus);
-
-private:
-#ifdef _WIN32
- static DWORD WINAPI thread_main(void* arg);
-
- HANDLE mThread;
- DWORD mThreadId;
- CRITICAL_SECTION mLock;
-#else // !WIN32
- static void* thread_main(void* arg);
-
- pthread_t mThread;
- pthread_mutex_t mLock;
-#endif
- intptr_t mExitStatus;
- bool mIsRunning;
-};
-
-} // namespace emugl
-
-#endif // EMUGL_COMMON_THREAD_H
-
diff --git a/distrib/android-emugl/shared/emugl/common/thread_pthread.cpp b/distrib/android-emugl/shared/emugl/common/thread_pthread.cpp
deleted file mode 100644
index 5dbc3abb8..000000000
--- a/distrib/android-emugl/shared/emugl/common/thread_pthread.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/thread.h"
-
-#include "emugl/common/thread_store.h"
-
-#include <stdio.h>
-
-namespace emugl {
-
-namespace {
-
-class ScopedLocker {
-public:
- ScopedLocker(pthread_mutex_t* mutex) : mMutex(mutex) {
- pthread_mutex_lock(mMutex);
- }
-
- ~ScopedLocker() {
- pthread_mutex_unlock(mMutex);
- }
-private:
- pthread_mutex_t* mMutex;
-};
-
-} // namespace
-
-Thread::Thread() :
- mThread((pthread_t)NULL),
- mExitStatus(0),
- mIsRunning(false) {
- pthread_mutex_init(&mLock, NULL);
-}
-
-Thread::~Thread() {
- pthread_mutex_destroy(&mLock);
-}
-
-bool Thread::start() {
- bool ret = true;
- pthread_mutex_lock(&mLock);
- mIsRunning = true;
- if (pthread_create(&mThread, NULL, thread_main, this)) {
- ret = false;
- mIsRunning = false;
- }
- pthread_mutex_unlock(&mLock);
- return ret;
-}
-
-bool Thread::wait(intptr_t *exitStatus) {
- {
- ScopedLocker locker(&mLock);
- if (!mIsRunning) {
- // Thread already stopped.
- if (exitStatus) {
- *exitStatus = mExitStatus;
- }
- return true;
- }
- }
-
- // NOTE: Do not hold the lock when waiting for the thread to ensure
- // it can update mIsRunning and mExitStatus properly in thread_main
- // without blocking.
- void *retval;
- if (pthread_join(mThread, &retval)) {
- return false;
- }
- if (exitStatus) {
- *exitStatus = (intptr_t)retval;
- }
- return true;
-}
-
-bool Thread::tryWait(intptr_t *exitStatus) {
- ScopedLocker locker(&mLock);
- if (!mIsRunning) {
- return false;
- }
- if (exitStatus) {
- *exitStatus = mExitStatus;
- }
- return true;
-}
-
-// static
-void* Thread::thread_main(void *arg) {
- Thread* self = reinterpret_cast<Thread*>(arg);
- intptr_t ret = self->main();
-
- pthread_mutex_lock(&self->mLock);
- self->mIsRunning = false;
- self->mExitStatus = ret;
- pthread_mutex_unlock(&self->mLock);
-
- ::emugl::ThreadStore::OnThreadExit();
-
- return (void*)ret;
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/thread_store.cpp b/distrib/android-emugl/shared/emugl/common/thread_store.cpp
deleted file mode 100644
index ecb4d0c07..000000000
--- a/distrib/android-emugl/shared/emugl/common/thread_store.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/thread_store.h"
-
-#ifdef _WIN32
-#include "emugl/common/lazy_instance.h"
-#endif
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-// Set to 1 to print debug messages.
-#define DEBUG_THREAD_STORE 0
-
-#if DEBUG_THREAD_STORE
-# define D(...) do { printf("%s:%d: ", __FUNCTION__, __LINE__); printf(__VA_ARGS__); fflush(stdout); } while (0)
-#else
-# define D(...) ((void)0)
-#endif
-
-namespace emugl {
-
-#ifdef _WIN32
-
-namespace {
-
-// The ThreadStore implementation on Windows is very tricky, because
-// TlsAlloc() doesn't allow one to provide a destructor function. As
-// such threads are expected to destroy all TLS values explicitely.
-//
-// To solve this issue, this source file provides a static method called
-// ThreadStore::OnThreadExit() that must be called when a thread exits,
-// which will cleanup all values for the current thread.
-//
-// But this forces us to track thread-specific values ourselves.
-
-// Maximum amount of thread-specific slots supported by this implementation.
-enum {
- kMaxTlsSlots = 64
-};
-
-// TlsSlotArray is a thread-specific array of values. Instances will
-// be stored in a Win32 TLS value controlled by a single master TLS
-// key.
-//
-typedef void* TlsSlotArray[kMaxTlsSlots];
-
-// Global state shared by all threads
-class GlobalState {
-public:
- GlobalState() {
- D("Entering\n");
- mMasterTls = TlsAlloc();
- D("Master TLS = %d\n", (int)mMasterTls);
- InitializeCriticalSection(&mSection);
- mLastIndex = 0;
- ::memset(mDestructors, 0, sizeof(mDestructors));
- D("Exiting\n");
- }
-
- // Register a new TLS key, or return -1 on error (too many keys).
- // |destroy| is the destructor function for the key.
- int registerKey(ThreadStore::Destructor* destroy) {
- D("Entering destroy=%p\n", destroy);
- int ret = -1;
- EnterCriticalSection(&mSection);
- if (mLastIndex < kMaxTlsSlots) {
- ret = mLastIndex++;
- mDestructors[ret] = destroy;
- }
- LeaveCriticalSection(&mSection);
- D("Exiting newKey=%d\n", ret);
- return ret;
- }
-
- void unregisterKey(int key) {
- D("key=%d\n", key);
- if (key < 0 || key >= kMaxTlsSlots) {
- D("Invalid key\n");
- return;
- }
-
- // Note: keys are not reusable, but remove the destructor to avoid
- // crashes in leaveCurrentThread() when it points to a function that
- // is going to be unloaded from the process' address space.
- EnterCriticalSection(&mSection);
- mDestructors[key] = NULL;
- LeaveCriticalSection(&mSection);
- D("Exiting\n");
- }
-
- // Get the current thread-local value for a given |key|.
- void* getValue(int key) const {
- D("Entering key=%d\n", key);
- if (key < 0 || key >= kMaxTlsSlots) {
- D("Invalid key, result=NULL\n");
- return NULL;
- }
-
- TlsSlotArray* array = getArray();
- void* ret = (*array)[key];
- D("Exiting keyValue=%p\n", ret);
- return ret;
- }
-
- // Set the current thread-local |value| for a given |key|.
- void setValue(int key, void* value) {
- D("Entering key=%d\n",key);
- if (key < 0 || key >= kMaxTlsSlots) {
- D("Invalid key, returning\n");
- return;
- }
-
- TlsSlotArray* array = getArray();
- (*array)[key] = value;
- D("Exiting\n");
- }
-
- // Call this when a thread exits to destroy all its thread-local values.
- void leaveCurrentThread() {
- D("Entering\n");
- TlsSlotArray* array =
- reinterpret_cast<TlsSlotArray*>(TlsGetValue(mMasterTls));
- if (!array) {
- D("Exiting, no thread-local data in this thread\n");
- return;
- }
-
- for (size_t n = 0; n < kMaxTlsSlots; ++n) {
- void* value = array[n];
- if (value) {
- (*array)[n] = NULL;
- // NOTE: In theory, a destructor could reset the slot to
- // a new value, and we would have to loop in this function
- // in interesting ways. In practice, ignore the issue.
- EnterCriticalSection(&mSection);
- ThreadStore::Destructor* destroy = mDestructors[n];
- LeaveCriticalSection(&mSection);
- if (destroy) {
- D("Calling destructor %p for key=%d, with value=%p\n",
- destroy, (int)n, value);
- (*destroy)(value);
- }
- }
- }
- TlsSetValue(mMasterTls, NULL);
- ::free(array);
- D("Exiting\n");
- }
-
-private:
- // Return the thread-local array of TLS slots for the current thread.
- // Cannot return NULL.
- TlsSlotArray* getArray() const {
- D("Entering\n");
- TlsSlotArray* array =
- reinterpret_cast<TlsSlotArray*>(TlsGetValue(mMasterTls));
- if (!array) {
- array = reinterpret_cast<TlsSlotArray*>(
- ::calloc(sizeof(*array), 1));
- TlsSetValue(mMasterTls, array);
- D("Allocated new array at %p\n", array);
- } else {
- D("Retrieved array at %p\n", array);
- }
- return array;
- }
-
- DWORD mMasterTls;
- CRITICAL_SECTION mSection;
- int mLastIndex;
- ThreadStore::Destructor* mDestructors[kMaxTlsSlots];
-};
-
-LazyInstance<GlobalState> gGlobalState = LAZY_INSTANCE_INIT;
-
-} // namespace
-
-ThreadStore::ThreadStore(Destructor* destroy) {
- D("Entering this=%p destroy=%p\n", this, destroy);
- mKey = gGlobalState->registerKey(destroy);
- D("Exiting this=%p key=%d\n", this, mKey);
-}
-
-ThreadStore::~ThreadStore() {
- D("Entering this=%p\n", this);
- GlobalState* state = gGlobalState.get();
- state->unregisterKey(mKey);
- D("Exiting this=%p\n", this);
-}
-
-void* ThreadStore::get() const {
- D("Entering this=%p\n", this);
- void* ret = gGlobalState->getValue(mKey);
- D("Exiting this=%p value=%p\n", this, ret);
- return ret;
-}
-
-void ThreadStore::set(void* value) {
- D("Entering this=%p value=%p\n", this, value);
- gGlobalState->setValue(mKey, value);
- D("Exiting this=%p\n", this);
-}
-
-// static
-void ThreadStore::OnThreadExit() {
- gGlobalState->leaveCurrentThread();
-}
-
-#else // !_WIN32
-
-ThreadStore::ThreadStore(Destructor* destroy) {
- int ret = pthread_key_create(&mKey, destroy);
- if (ret != 0) {
- fprintf(stderr,
- "Could not create thread store key: %s\n",
- strerror(ret));
- exit(1);
- }
-}
-
-ThreadStore::~ThreadStore() {
- pthread_key_delete(mKey);
-}
-
-#endif // !_WIN32
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/thread_store.h b/distrib/android-emugl/shared/emugl/common/thread_store.h
deleted file mode 100644
index 5fd08bdeb..000000000
--- a/distrib/android-emugl/shared/emugl/common/thread_store.h
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_THREAD_STORE_H
-#define EMUGL_COMMON_THREAD_STORE_H
-
-#ifdef _WIN32
-# define WIN32_LEAN_AND_MEAN 1
-# include <windows.h>
-#else
-# include <pthread.h>
-#endif
-
-namespace emugl {
-
-// A class to model storage of thread-specific values, that can be
-// destroyed on thread exit.
-//
-// Note that on Windows, a thread must call OnThreadExit() explicitly
-// here to ensure that the values are probably discarded. This is an
-// unfortunate requirement of the Win32 API, which doesn't support
-// destructors at all.
-//
-// There are various hacks on the web to try to achieve this automatically
-// (e.g. [1]) but they rely on using the Microsoft build tools,
-// which doesn't work for us.
-//
-// Note another important issue with ThreadStore instances: if you create
-// one instance in a shared library, you need to make sure that it is
-// always destroyed before the library is unloaded. Otherwise, future
-// thread exit will likely crash, due to calling a destructor function
-// that is no longer in the process' address space.
-//
-// Finally, destroying an instance does _not_ free the corresponding values,
-// because doing so properly requires coordinating all participating threads,
-// which is impossible to achieve in the most general case. Thus, consider
-// that thread-local values are always leaked on library unload, or on
-// program exit.
-//
-// [1] http://stackoverflow.com/questions/14538159/about-tls-callback-in-windows
-
-class ThreadStore {
-public:
- // Type of a function used to destroy a thread-specific value that
- // was previously assigned by calling set().
- typedef void (Destructor)(void* value);
-
- // Initialize instance so that is hold keys that must be destroyed
- // on thread exit by calling |destroy|.
- explicit ThreadStore(Destructor* destroy);
-
- // NOTE: Destructor don't free the thread-local values, but are required
- // to avoid crashes (see note above).
- ~ThreadStore();
-
- // Retrieve current thread-specific value from store.
-#ifdef _WIN32
- void* get() const;
-#else
- inline void* get() const {
- return pthread_getspecific(mKey);
- }
-#endif
-
- // Set the new thread-specific value.
-#ifdef _WIN32
- void set(void* value);
-#else
- inline void set(void* value) {
- pthread_setspecific(mKey, value);
- }
-#endif
-
-#ifdef _WIN32
- // Each thread should call this function on exit to ensure that
- // all corresponding TLS values are properly freed.
- static void OnThreadExit();
-#else
- // Nothing to do on Posix.
- static inline void OnThreadExit() {}
-#endif
-
-private:
- // Ensure you can't create an empty ThreadStore instance, or simply
- // copy it in any way.
- ThreadStore();
- ThreadStore(const ThreadStore&);
- ThreadStore& operator=(const ThreadStore&);
-
-#ifdef _WIN32
- int mKey;
-#else
- pthread_key_t mKey;
-#endif
-};
-
-} // namespace emugl
-
-#endif // EMUGL_COMMON_THREAD_STORE_H
diff --git a/distrib/android-emugl/shared/emugl/common/thread_store_unittest.cpp b/distrib/android-emugl/shared/emugl/common/thread_store_unittest.cpp
deleted file mode 100644
index 6b5dddb96..000000000
--- a/distrib/android-emugl/shared/emugl/common/thread_store_unittest.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/thread_store.h"
-
-#include "emugl/common/mutex.h"
-#include "emugl/common/testing/test_thread.h"
-
-#include <gtest/gtest.h>
-
-namespace emugl {
-
-namespace {
-
-// Helper class used to count instance creation and destruction.
-class StaticCounter {
-public:
- enum {
- kMaxInstances = 1000,
- };
-
- StaticCounter() {
- Mutex::AutoLock lock(mMutex);
- if (mCreationCount < kMaxInstances)
- mInstances[mCreationCount] = this;
- mCreationCount++;
- }
-
- ~StaticCounter() {
- Mutex::AutoLock lock(mMutex);
- mDestructionCount++;
- }
-
- static void reset() {
- Mutex::AutoLock lock(mMutex);
- mCreationCount = 0;
- mDestructionCount = 0;
- }
-
- static size_t getCreationCount() {
- Mutex::AutoLock lock(mMutex);
- return mCreationCount;
- }
-
- static size_t getDestructionCount() {
- Mutex::AutoLock lock(mMutex);
- return mDestructionCount;
- }
-
- static void freeAll() {
- for (size_t n = 0; n < kMaxInstances; ++n)
- delete mInstances[n];
- }
-
-private:
- static Mutex mMutex;
- static size_t mCreationCount;
- static size_t mDestructionCount;
- static StaticCounter* mInstances[kMaxInstances];
-};
-
-Mutex StaticCounter::mMutex;
-size_t StaticCounter::mCreationCount = 0;
-size_t StaticCounter::mDestructionCount = 0;
-StaticCounter* StaticCounter::mInstances[kMaxInstances];
-
-} // namespace
-
-// Just check that we can create a new ThreadStore with an empty
-// destructor, and use it in the current thread.
-TEST(ThreadStore, MainThreadWithoutDestructor) {
- ThreadStore store(NULL);
- static int x = 42;
- store.set(&x);
- EXPECT_EQ(&x, store.get());
-}
-
-// The following test checks that exiting a thread correctly deletes
-// any thread-local value stored in it.
-static void simplyDestroy(void* value) {
- delete (StaticCounter*) value;
-}
-
-static void* simpleThreadFunc(void* param) {
- ThreadStore* store = static_cast<ThreadStore*>(param);
- store->set(new StaticCounter());
- ThreadStore::OnThreadExit();
- return NULL;
-}
-
-TEST(ThreadStore, ThreadsWithDestructor) {
- ThreadStore store(simplyDestroy);
- const size_t kNumThreads = 1000;
- TestThread* threads[kNumThreads];
- StaticCounter::reset();
-
- for (size_t n = 0; n < kNumThreads; ++n) {
- threads[n] = new TestThread(&simpleThreadFunc, &store);
- }
- for (size_t n = 0; n < kNumThreads; ++n) {
- threads[n]->join();
- }
-
- EXPECT_EQ(kNumThreads, StaticCounter::getCreationCount());
- EXPECT_EQ(kNumThreads, StaticCounter::getDestructionCount());
-
- for (size_t n = 0; n < kNumThreads; ++n) {
- delete threads[n];
- }
-}
-
-TEST(ThreadStore, ThreadsWithoutDestructor) {
- ThreadStore store(NULL);
- const size_t kNumThreads = 1000;
- TestThread* threads[kNumThreads];
- StaticCounter::reset();
-
- for (size_t n = 0; n < kNumThreads; ++n) {
- threads[n] = new TestThread(&simpleThreadFunc, &store);
- }
- for (size_t n = 0; n < kNumThreads; ++n) {
- threads[n]->join();
- }
-
- EXPECT_EQ(kNumThreads, StaticCounter::getCreationCount());
- EXPECT_EQ(0U, StaticCounter::getDestructionCount());
-
- StaticCounter::freeAll();
-
- for (size_t n = 0; n < kNumThreads; ++n) {
- delete threads[n];
- }
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/thread_unittest.cpp b/distrib/android-emugl/shared/emugl/common/thread_unittest.cpp
deleted file mode 100644
index db1931fe3..000000000
--- a/distrib/android-emugl/shared/emugl/common/thread_unittest.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/thread.h"
-
-#include "emugl/common/mutex.h"
-
-#include <gtest/gtest.h>
-
-namespace emugl {
-
-namespace {
-
-// A simple thread instance that does nothing at all and exits immediately.
-class EmptyThread : public ::emugl::Thread {
-public:
- intptr_t main() { return 42; }
-};
-
-class CountingThread : public ::emugl::Thread {
-public:
- class State {
- public:
- State() : mLock(), mCount(0) {}
- ~State() {}
-
- void increment() {
- mLock.lock();
- mCount++;
- mLock.unlock();
- }
-
- int count() const {
- int ret;
- mLock.lock();
- ret = mCount;
- mLock.unlock();
- return ret;
- }
-
- private:
- mutable Mutex mLock;
- int mCount;
- };
-
- CountingThread(State* state) : mState(state) {}
-
- intptr_t main() {
- mState->increment();
- return 0;
- }
-
-private:
- State* mState;
-};
-
-} // namespace
-
-TEST(ThreadTest, SimpleThread) {
- Thread* thread = new EmptyThread();
- EXPECT_TRUE(thread);
- EXPECT_TRUE(thread->start());
- intptr_t status;
- EXPECT_TRUE(thread->wait(&status));
- EXPECT_EQ(42, status);
-}
-
-TEST(ThreadTest, MultipleThreads) {
- CountingThread::State state;
- const size_t kMaxThreads = 100;
- Thread* threads[kMaxThreads];
-
- // Create all threads.
- for (size_t n = 0; n < kMaxThreads; ++n) {
- threads[n] = new CountingThread(&state);
- EXPECT_TRUE(threads[n]) << "thread " << n;
- }
-
- // Start them all.
- for (size_t n = 0; n < kMaxThreads; ++n) {
- EXPECT_TRUE(threads[n]->start()) << "thread " << n;
- }
-
- // Wait for them all.
- for (size_t n = 0; n < kMaxThreads; ++n) {
- EXPECT_TRUE(threads[n]->wait(NULL)) << "thread " << n;
- }
-
- // Check state.
- EXPECT_EQ((int)kMaxThreads, state.count());
-
- // Delete them all.
- for (size_t n = 0; n < kMaxThreads; ++n) {
- delete threads[n];
- }
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/thread_win32.cpp b/distrib/android-emugl/shared/emugl/common/thread_win32.cpp
deleted file mode 100644
index f348ca8ec..000000000
--- a/distrib/android-emugl/shared/emugl/common/thread_win32.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/thread.h"
-
-#include "emugl/common/thread_store.h"
-
-namespace emugl {
-
-namespace {
-
-class ScopedLocker {
-public:
- ScopedLocker(CRITICAL_SECTION* section) : mSection(section) {
- EnterCriticalSection(mSection);
- }
-
- ~ScopedLocker() {
- LeaveCriticalSection(mSection);
- }
-private:
- CRITICAL_SECTION* mSection;
-};
-
-} // namespace
-
-Thread::Thread() :
- mThread(INVALID_HANDLE_VALUE),
- mThreadId(0),
- mExitStatus(0),
- mIsRunning(false) {
- InitializeCriticalSection(&mLock);
-}
-
-Thread::~Thread() {
- if(mThread != INVALID_HANDLE_VALUE) {
- CloseHandle(mThread);
- }
- DeleteCriticalSection(&mLock);
-}
-
-bool Thread::start() {
- ScopedLocker locker(&mLock);
-
- bool ret = true;
- mIsRunning = true;
- mThread = CreateThread(NULL, 0, &Thread::thread_main, this, 0, &mThreadId);
- if (!mThread) {
- ret = false;
- mIsRunning = false;
- }
- return ret;
-}
-
-bool Thread::wait(intptr_t* exitStatus) {
- {
- ScopedLocker locker(&mLock);
- if (!mIsRunning) {
- // Thread already stopped.
- if (exitStatus) {
- *exitStatus = mExitStatus;
- }
- return true;
- }
- }
-
- // NOTE: Do not hold lock during wait to aloow thread_main to
- // properly update mIsRunning and mExitStatus on thread exit.
- if (WaitForSingleObject(mThread, INFINITE) == WAIT_FAILED) {
- return false;
- }
-
- if (exitStatus) {
- ScopedLocker locker(&mLock);
- *exitStatus = mExitStatus;
- }
- return true;
-}
-
-bool Thread::tryWait(intptr_t* exitStatus) {
- ScopedLocker locker(&mLock);
-
- if (!mIsRunning ||
- WaitForSingleObject(mThread, 0) != WAIT_OBJECT_0) {
- return false;
- }
-
- if (exitStatus) {
- *exitStatus = mExitStatus;
- }
- return true;
-}
-
-// static
-DWORD WINAPI Thread::thread_main(void *arg)
-{
- Thread* self = reinterpret_cast<Thread*>(arg);
- intptr_t ret = self->main();
-
- EnterCriticalSection(&self->mLock);
- self->mIsRunning = false;
- self->mExitStatus = ret;
- LeaveCriticalSection(&self->mLock);
-
- // Ensure all thread-local values are released for this thread.
- ::emugl::ThreadStore::OnThreadExit();
-
- return static_cast<DWORD>(ret);
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/shared/emugl/common/unique_integer_map.h b/distrib/android-emugl/shared/emugl/common/unique_integer_map.h
deleted file mode 100644
index 720aceb0c..000000000
--- a/distrib/android-emugl/shared/emugl/common/unique_integer_map.h
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright (C) 2014 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 EMUGL_COMMON_UNIQUE_INTEGER_MAP_H
-#define EMUGL_COMMON_UNIQUE_INTEGER_MAP_H
-
-#include "emugl/common/pod_vector.h"
-
-#include <stdint.h>
-
-namespace emugl {
-
-// Helper template class that implements a bi-directional mapping between
-// two integer types |A| and |B|. More specifically:
-//
-// - The map allocates values of type |B| when a key of type |A| is entered
-// in the map.
-//
-// - keys and values cannot be 0, which is reserved (i.e. means 'invalid').
-//
-// This is used in EmuGL to map liberal 'void*' values (e.g. EGLimages ones)
-// to unique 32-bit IDs that can be written to / read from the wire protocol.
-template <typename A, typename B>
-class UniqueIntegerMap {
-public:
- UniqueIntegerMap() : mForwardPairs(), mBackwardPairs() {}
- ~UniqueIntegerMap() {}
-
- // Return true iff the map is empty.
- const bool empty() const { return mForwardPairs.empty(); }
-
- // Return the number of (key,value) pairs in the map.
- size_t size() const { return mForwardPairs.size(); }
-
- // Find the value associated with |key| in the map.
- // Returns 0 in case of failure, or if |key| is 0.
- B find(const A key) const;
-
- // Find the key associated with a given |value| in the map.
- // Returns 0 if |value| is 0, or in case of failure.
- A findKeyFor(const B value) const;
-
- // Add |key| to the map and return an automatically-allocated
- // unique value for it. Return 0 if |key| is 0.
- B add(const A key);
-
- // Delete the entry associated with a given |key|. The
- // corresponding value may be recycled by future calls to add().
- void del(const A key);
-
-private:
- typedef struct {
- A first;
- B second;
- } ForwardPair;
-
- typedef struct {
- B first;
- A second;
- } BackwardPair;
-
- size_t findKeyIndexPlusOne(const A key) const;
- size_t findValueIndexPlusOne(const B value) const;
-
- B allocValue();
- void freeValue(B value);
-
- PodVector<ForwardPair> mForwardPairs;
- PodVector<BackwardPair> mBackwardPairs;
-
- B mLastValue;
- PodVector<B> mFreeValues;
-};
-
-template <typename A, typename B>
-B UniqueIntegerMap<A,B>::find(const A key) const {
- size_t keyIndex = findKeyIndexPlusOne(key);
- if (!keyIndex) {
- return 0;
- }
- return mForwardPairs[keyIndex - 1U].second;
-}
-
-template <typename A, typename B>
-A UniqueIntegerMap<A,B>::findKeyFor(const B value) const {
- size_t valueIndex = findValueIndexPlusOne(value);
- if (!valueIndex) {
- return 0;
- }
- return mBackwardPairs[valueIndex - 1U].second;
-}
-
-template <typename A, typename B>
-B UniqueIntegerMap<A,B>::add(const A key) {
- // Binary search to find the proper insertion point for the key.
- // Also checks that the key isn't already in the set.
- size_t min = 0;
- size_t max = mForwardPairs.size();
- while (min < max) {
- size_t mid = min + ((max - min) >> 1);
- A midKey = mForwardPairs[mid].first;
- if (midKey < key) {
- min = mid + 1U;
- } else if (midKey > key) {
- max = mid;
- } else {
- // Already in the set.
- return 0;
- }
- }
-
- // Generate new unique value
- B value = allocValue();
-
- ForwardPair* pair = mForwardPairs.emplace(min);
- pair->first = key;
- pair->second = value;
-
- // Binary search to find proper insertion point for the value.
- min = 0;
- max = mBackwardPairs.size();
- while (min < max) {
- size_t mid = min + ((max - min) >> 1);
- B midValue = mBackwardPairs[mid].first;
- if (midValue < value) {
- min = mid + 1U;
- } else {
- max = mid;
- }
- }
-
- BackwardPair* backPair = mBackwardPairs.emplace(min);
- backPair->first = value;
- backPair->second = key;
-
- return value;
-}
-
-template <typename A, typename B>
-void UniqueIntegerMap<A,B>::del(const A key) {
- size_t keyIndex = findKeyIndexPlusOne(key);
- if (!keyIndex) {
- return;
- }
- B value = mForwardPairs[keyIndex - 1U].second;
- size_t valueIndex = findValueIndexPlusOne(value);
- mForwardPairs.remove(keyIndex - 1U);
- mBackwardPairs.remove(valueIndex - 1U);
- freeValue(value);
-}
-
-template <typename A, typename B>
-size_t UniqueIntegerMap<A,B>::findKeyIndexPlusOne(const A key) const {
- // Binary search in forward pair array.
- size_t min = 0;
- size_t max = mForwardPairs.size();
- while (min < max) {
- size_t mid = min + ((max - min) >> 1);
- A midKey = mForwardPairs[mid].first;
- if (midKey < key) {
- min = mid + 1U;
- } else if (midKey > key) {
- max = mid;
- } else {
- return mid + 1U;
- }
- }
- return 0U;
-}
-
-template <typename A, typename B>
-size_t UniqueIntegerMap<A,B>::findValueIndexPlusOne(const B value) const {
- // Binary search in revere pair array.
- size_t min = 0;
- size_t max = mBackwardPairs.size();
- while (min < max) {
- size_t mid = min + ((max - min) >> 1);
- B midValue = mBackwardPairs[mid].first;
- if (midValue < value) {
- min = mid + 1U;
- } else if (midValue > value) {
- max = mid;
- } else {
- return mid + 1U;
- }
- }
- return 0U;
-}
-
-template <typename A, typename B>
-B UniqueIntegerMap<A,B>::allocValue() {
- if (!mFreeValues.empty()) {
- B result = mFreeValues[0];
- mFreeValues.pop();
- return result;
- }
- return ++mLastValue;
-}
-
-template <typename A, typename B>
-void UniqueIntegerMap<A,B>::freeValue(B value) {
- if (!value) {
- return;
- }
- if (value == mLastValue) {
- mLastValue--;
- return;
- }
- mFreeValues.append(value);
-}
-
-} // namespace emugl
-
-#endif // EMUGL_COMMON_INTEGER_MAP_H
diff --git a/distrib/android-emugl/shared/emugl/common/unique_integer_map_unittest.cpp b/distrib/android-emugl/shared/emugl/common/unique_integer_map_unittest.cpp
deleted file mode 100644
index 8aee01327..000000000
--- a/distrib/android-emugl/shared/emugl/common/unique_integer_map_unittest.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (C) 2014 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 "emugl/common/unique_integer_map.h"
-
-#include <gtest/gtest.h>
-
-#include <stdio.h>
-
-namespace emugl {
-
-typedef UniqueIntegerMap<uintptr_t,uint32_t> MyMap;
-
-TEST(UniqueIntegerMap, Empty) {
- MyMap map;
-
- EXPECT_TRUE(map.empty());
- EXPECT_EQ(0U, map.size());
- EXPECT_EQ(0U, map.find(0U));
- EXPECT_EQ(0U, map.find(1U));
- EXPECT_EQ(0U, map.find(2U));
- EXPECT_EQ(0U, map.find(4U));
-}
-
-TEST(UniqueIntegerMap, AddOne) {
- MyMap map;
- uintptr_t key1 = 1U;
- uint32_t val1 = map.add(key1);
-
- EXPECT_NE(0U, val1);
- EXPECT_EQ(val1, map.find(key1));
- EXPECT_EQ(key1, map.findKeyFor(val1));
-
- EXPECT_FALSE(map.empty());
- EXPECT_EQ(1U, map.size());
-
- EXPECT_EQ(0U, map.find(0));
- EXPECT_EQ(0U, map.findKeyFor(0));
-
- EXPECT_EQ(0U, map.find(key1 + 1));
- EXPECT_EQ(0U, map.findKeyFor(val1 + 1));
-}
-
-TEST(UniqueIntegerMap, AddMultiple) {
- MyMap map;
- const size_t kCount = 100;
- const size_t kKeyMultiplier = 3U; // must be >= 2.
- uint32_t values[kCount];
-
- for (size_t n = 0; n < kCount; ++n) {
- uintptr_t key = 1U + n * kKeyMultiplier;
- values[n] = map.add(key);
- EXPECT_NE(0U, values[n]) << "key #" << n;
- }
-
- EXPECT_EQ(kCount, map.size());
-
- for (size_t n = 0; n < kCount; ++n) {
- uintptr_t key = 1U + n * kKeyMultiplier;
- EXPECT_EQ(values[n], map.find(key)) << "key #" << n;
- EXPECT_EQ(0U, map.find(key + 1U)) << "key #" << n;
- }
-
- for (size_t n = 0; n < kCount; ++n) {
- uintptr_t key = 1U + n * kKeyMultiplier;
- EXPECT_EQ(key, map.findKeyFor(values[n]));
- }
-}
-
-TEST(UniqueIntegerMap, Del) {
- MyMap map;
- const size_t kCount = 100;
- const size_t kKeyMultiplier = 3U; // must be >= 2.
- uint32_t values[kCount];
-
- for (size_t n = 0; n < kCount; ++n) {
- uintptr_t key = 1U + n * kKeyMultiplier;
- values[n] = map.add(key);
- }
-
- for (size_t n = 0; n < kCount; ++n) {
- uintptr_t key = 1U + n * kKeyMultiplier;
- map.del(key);
- EXPECT_EQ(kCount - 1U - n, map.size());
- EXPECT_EQ(0U, map.find(key));
- EXPECT_EQ(0U, map.findKeyFor(values[n]));
- }
-
- EXPECT_TRUE(map.empty());
-}
-
-} // namespace emugl
diff --git a/distrib/android-emugl/host/tools/emugen/Android.mk b/host/commands/emugen/Android.mk
index 66119faac..66119faac 100644
--- a/distrib/android-emugl/host/tools/emugen/Android.mk
+++ b/host/commands/emugen/Android.mk
diff --git a/distrib/android-emugl/host/tools/emugen/ApiGen.cpp b/host/commands/emugen/ApiGen.cpp
index fc51ebc78..fc51ebc78 100644
--- a/distrib/android-emugl/host/tools/emugen/ApiGen.cpp
+++ b/host/commands/emugen/ApiGen.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/ApiGen.h b/host/commands/emugen/ApiGen.h
index c4e87b48a..c4e87b48a 100644
--- a/distrib/android-emugl/host/tools/emugen/ApiGen.h
+++ b/host/commands/emugen/ApiGen.h
diff --git a/distrib/android-emugl/host/tools/emugen/EntryPoint.cpp b/host/commands/emugen/EntryPoint.cpp
index cc3bef1e6..cc3bef1e6 100644
--- a/distrib/android-emugl/host/tools/emugen/EntryPoint.cpp
+++ b/host/commands/emugen/EntryPoint.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/EntryPoint.h b/host/commands/emugen/EntryPoint.h
index 1061d255b..1061d255b 100644
--- a/distrib/android-emugl/host/tools/emugen/EntryPoint.h
+++ b/host/commands/emugen/EntryPoint.h
diff --git a/distrib/android-emugl/host/tools/emugen/Parser.cpp b/host/commands/emugen/Parser.cpp
index 0839f2023..0839f2023 100644
--- a/distrib/android-emugl/host/tools/emugen/Parser.cpp
+++ b/host/commands/emugen/Parser.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/Parser.h b/host/commands/emugen/Parser.h
index f62c0763b..f62c0763b 100644
--- a/distrib/android-emugl/host/tools/emugen/Parser.h
+++ b/host/commands/emugen/Parser.h
diff --git a/distrib/android-emugl/host/tools/emugen/Parser_unittest.cpp b/host/commands/emugen/Parser_unittest.cpp
index 904b24737..904b24737 100644
--- a/distrib/android-emugl/host/tools/emugen/Parser_unittest.cpp
+++ b/host/commands/emugen/Parser_unittest.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/README b/host/commands/emugen/README
index 0fe85f941..0fe85f941 100644
--- a/distrib/android-emugl/host/tools/emugen/README
+++ b/host/commands/emugen/README
diff --git a/distrib/android-emugl/host/tools/emugen/TypeFactory.cpp b/host/commands/emugen/TypeFactory.cpp
index 1e0cc96e0..1e0cc96e0 100644
--- a/distrib/android-emugl/host/tools/emugen/TypeFactory.cpp
+++ b/host/commands/emugen/TypeFactory.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/TypeFactory.h b/host/commands/emugen/TypeFactory.h
index deee2ca49..deee2ca49 100644
--- a/distrib/android-emugl/host/tools/emugen/TypeFactory.h
+++ b/host/commands/emugen/TypeFactory.h
diff --git a/distrib/android-emugl/host/tools/emugen/Var.h b/host/commands/emugen/Var.h
index 708d72352..708d72352 100644
--- a/distrib/android-emugl/host/tools/emugen/Var.h
+++ b/host/commands/emugen/Var.h
diff --git a/distrib/android-emugl/host/tools/emugen/VarType.h b/host/commands/emugen/VarType.h
index b6937a002..b6937a002 100644
--- a/distrib/android-emugl/host/tools/emugen/VarType.h
+++ b/host/commands/emugen/VarType.h
diff --git a/distrib/android-emugl/host/tools/emugen/errors.h b/host/commands/emugen/errors.h
index d09c29291..d09c29291 100644
--- a/distrib/android-emugl/host/tools/emugen/errors.h
+++ b/host/commands/emugen/errors.h
diff --git a/distrib/android-emugl/host/tools/emugen/getopt.c b/host/commands/emugen/getopt.c
index 35235386b..35235386b 100644
--- a/distrib/android-emugl/host/tools/emugen/getopt.c
+++ b/host/commands/emugen/getopt.c
diff --git a/distrib/android-emugl/host/tools/emugen/getopt.h b/host/commands/emugen/getopt.h
index cc04850a2..cc04850a2 100644
--- a/distrib/android-emugl/host/tools/emugen/getopt.h
+++ b/host/commands/emugen/getopt.h
diff --git a/distrib/android-emugl/host/tools/emugen/main.cpp b/host/commands/emugen/main.cpp
index 5408617a1..5408617a1 100644
--- a/distrib/android-emugl/host/tools/emugen/main.cpp
+++ b/host/commands/emugen/main.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/strUtils.cpp b/host/commands/emugen/strUtils.cpp
index 357054b5c..357054b5c 100644
--- a/distrib/android-emugl/host/tools/emugen/strUtils.cpp
+++ b/host/commands/emugen/strUtils.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/strUtils.h b/host/commands/emugen/strUtils.h
index 3fa0908d3..3fa0908d3 100644
--- a/distrib/android-emugl/host/tools/emugen/strUtils.h
+++ b/host/commands/emugen/strUtils.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/run-tests.sh b/host/commands/emugen/tests/run-tests.sh
index 67409edcc..67409edcc 100755
--- a/distrib/android-emugl/host/tools/emugen/tests/run-tests.sh
+++ b/host/commands/emugen/tests/run-tests.sh
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_dec.cpp b/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.cpp
index 2fae4c06e..2fae4c06e 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_dec.cpp
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_dec.h b/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.h
index d02509070..d02509070 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_dec.h
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_opcodes.h b/host/commands/emugen/tests/t.001/expected/decoder/foo_opcodes.h
index 7219caaf1..7219caaf1 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_opcodes.h
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_opcodes.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_server_context.cpp b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.cpp
index 22ff47f9d..22ff47f9d 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_server_context.cpp
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_server_context.h b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.h
index 713ff5fe3..713ff5fe3 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_server_context.h
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_server_proc.h b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_proc.h
index da104a13b..da104a13b 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/decoder/foo_server_proc.h
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_proc.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_client_context.cpp b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.cpp
index f09e8811c..f09e8811c 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_client_context.cpp
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_client_context.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.h
index ce60329c5..ce60329c5 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_client_context.h
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_client_proc.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_proc.h
index 6fc27f060..6fc27f060 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_client_proc.h
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_proc.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_enc.cpp b/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.cpp
index c922783e4..c922783e4 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_enc.cpp
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_enc.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.h
index 8325831cf..8325831cf 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_enc.h
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_entry.cpp b/host/commands/emugen/tests/t.001/expected/encoder/foo_entry.cpp
index b91129c03..b91129c03 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_entry.cpp
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_entry.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_ftable.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_ftable.h
index e397e50e2..e397e50e2 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_ftable.h
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_ftable.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_opcodes.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_opcodes.h
index 7219caaf1..7219caaf1 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/encoder/foo_opcodes.h
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_opcodes.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp
index 6e132b104..6e132b104 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp
+++ b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h
index 52db4b6fb..52db4b6fb 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h
+++ b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp
index 7591393c1..7591393c1 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp
+++ b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h
index 294b9587d..294b9587d 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h
+++ b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/input/foo.attrib b/host/commands/emugen/tests/t.001/input/foo.attrib
index 80644d8bb..80644d8bb 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/input/foo.attrib
+++ b/host/commands/emugen/tests/t.001/input/foo.attrib
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/input/foo.in b/host/commands/emugen/tests/t.001/input/foo.in
index 4e98f88b6..4e98f88b6 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/input/foo.in
+++ b/host/commands/emugen/tests/t.001/input/foo.in
diff --git a/distrib/android-emugl/host/tools/emugen/tests/t.001/input/foo.types b/host/commands/emugen/tests/t.001/input/foo.types
index 05d72fbe2..05d72fbe2 100644
--- a/distrib/android-emugl/host/tools/emugen/tests/t.001/input/foo.types
+++ b/host/commands/emugen/tests/t.001/input/foo.types
diff --git a/android/scripts/gen-entries.py b/host/commands/gen-entries.py
index d5fc59fe9..d5fc59fe9 100755
--- a/android/scripts/gen-entries.py
+++ b/host/commands/gen-entries.py
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.cpp b/host/libs/virglrenderer/ChecksumCalculator.cpp
index 6a3a38adf..6a3a38adf 100644
--- a/distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.cpp
+++ b/host/libs/virglrenderer/ChecksumCalculator.cpp
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.h b/host/libs/virglrenderer/ChecksumCalculator.h
index 0cc2f0199..0cc2f0199 100644
--- a/distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculator.h
+++ b/host/libs/virglrenderer/ChecksumCalculator.h
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h b/host/libs/virglrenderer/ChecksumCalculatorThreadInfo.h
index e22d3bade..e22d3bade 100644
--- a/distrib/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h
+++ b/host/libs/virglrenderer/ChecksumCalculatorThreadInfo.h
diff --git a/distrib/android-emugl/host/libs/GLESv1_dec/gles1.addon b/host/libs/virglrenderer/GLESv1_dec/gles1.addon
index 2331f878c..2331f878c 100644
--- a/distrib/android-emugl/host/libs/GLESv1_dec/gles1.addon
+++ b/host/libs/virglrenderer/GLESv1_dec/gles1.addon
diff --git a/distrib/android-emugl/host/libs/GLESv1_dec/gles1.attrib b/host/libs/virglrenderer/GLESv1_dec/gles1.attrib
index 8889bd70c..8889bd70c 100644
--- a/distrib/android-emugl/host/libs/GLESv1_dec/gles1.attrib
+++ b/host/libs/virglrenderer/GLESv1_dec/gles1.attrib
diff --git a/distrib/android-emugl/host/libs/GLESv1_dec/gles1.in b/host/libs/virglrenderer/GLESv1_dec/gles1.in
index 74d5454d3..74d5454d3 100644
--- a/distrib/android-emugl/host/libs/GLESv1_dec/gles1.in
+++ b/host/libs/virglrenderer/GLESv1_dec/gles1.in
diff --git a/distrib/android-emugl/host/libs/GLESv1_dec/gles1.types b/host/libs/virglrenderer/GLESv1_dec/gles1.types
index 05be29e5e..05be29e5e 100644
--- a/distrib/android-emugl/host/libs/GLESv1_dec/gles1.types
+++ b/host/libs/virglrenderer/GLESv1_dec/gles1.types
diff --git a/distrib/android-emugl/host/libs/GLESv1_dec/gles1_types.h b/host/libs/virglrenderer/GLESv1_dec/gles1_types.h
index c8355ada1..c8355ada1 100644
--- a/distrib/android-emugl/host/libs/GLESv1_dec/gles1_types.h
+++ b/host/libs/virglrenderer/GLESv1_dec/gles1_types.h
diff --git a/distrib/android-emugl/host/libs/GLESv2_dec/gles2.attrib b/host/libs/virglrenderer/GLESv3_dec/gles3.attrib
index d84a8b618..d84a8b618 100644
--- a/distrib/android-emugl/host/libs/GLESv2_dec/gles2.attrib
+++ b/host/libs/virglrenderer/GLESv3_dec/gles3.attrib
diff --git a/distrib/android-emugl/host/libs/GLESv2_dec/gles2.in b/host/libs/virglrenderer/GLESv3_dec/gles3.in
index f60db16bf..f60db16bf 100644
--- a/distrib/android-emugl/host/libs/GLESv2_dec/gles2.in
+++ b/host/libs/virglrenderer/GLESv3_dec/gles3.in
diff --git a/distrib/android-emugl/host/libs/GLESv2_dec/gles2.types b/host/libs/virglrenderer/GLESv3_dec/gles3.types
index be4713c78..be4713c78 100644
--- a/distrib/android-emugl/host/libs/GLESv2_dec/gles2.types
+++ b/host/libs/virglrenderer/GLESv3_dec/gles3.types
diff --git a/distrib/android-emugl/host/libs/GLESv2_dec/gles2_types.h b/host/libs/virglrenderer/GLESv3_dec/gles3_types.h
index bfff61de4..bfff61de4 100644
--- a/distrib/android-emugl/host/libs/GLESv2_dec/gles2_types.h
+++ b/host/libs/virglrenderer/GLESv3_dec/gles3_types.h
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/EGLDispatch.cpp b/host/libs/virglrenderer/OpenGLESDispatch/EGLDispatch.cpp
index db42c0b10..db42c0b10 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/EGLDispatch.cpp
+++ b/host/libs/virglrenderer/OpenGLESDispatch/EGLDispatch.cpp
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h b/host/libs/virglrenderer/OpenGLESDispatch/EGLDispatch.h
index a361954fe..a361954fe 100644
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h
+++ b/host/libs/virglrenderer/OpenGLESDispatch/EGLDispatch.h
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/GLESv1Dispatch.cpp b/host/libs/virglrenderer/OpenGLESDispatch/GLESv1Dispatch.cpp
index 3e0d59c88..3e0d59c88 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/GLESv1Dispatch.cpp
+++ b/host/libs/virglrenderer/OpenGLESDispatch/GLESv1Dispatch.cpp
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/GLESv1Dispatch.h b/host/libs/virglrenderer/OpenGLESDispatch/GLESv1Dispatch.h
index 3bcb7a680..3bcb7a680 100644
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/GLESv1Dispatch.h
+++ b/host/libs/virglrenderer/OpenGLESDispatch/GLESv1Dispatch.h
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/GLESv2Dispatch.cpp b/host/libs/virglrenderer/OpenGLESDispatch/GLESv3Dispatch.cpp
index 0fb999821..0fb999821 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/GLESv2Dispatch.cpp
+++ b/host/libs/virglrenderer/OpenGLESDispatch/GLESv3Dispatch.cpp
diff --git a/distrib/android-emugl/host/include/OpenGLESDispatch/GLESv2Dispatch.h b/host/libs/virglrenderer/OpenGLESDispatch/GLESv3Dispatch.h
index 511e7b8e1..511e7b8e1 100644
--- a/distrib/android-emugl/host/include/OpenGLESDispatch/GLESv2Dispatch.h
+++ b/host/libs/virglrenderer/OpenGLESDispatch/GLESv3Dispatch.h
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl.entries b/host/libs/virglrenderer/OpenGLESDispatch/egl.entries
index f49a52df4..f49a52df4 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl.entries
+++ b/host/libs/virglrenderer/OpenGLESDispatch/egl.entries
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl_extensions.entries b/host/libs/virglrenderer/OpenGLESDispatch/egl_extensions.entries
index 6a5fe8a53..6a5fe8a53 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/render_egl_extensions.entries
+++ b/host/libs/virglrenderer/OpenGLESDispatch/egl_extensions.entries
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles12tr.entries b/host/libs/virglrenderer/OpenGLESDispatch/gles1_core.entries
index f42e279f3..f42e279f3 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles12tr.entries
+++ b/host/libs/virglrenderer/OpenGLESDispatch/gles1_core.entries
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_extensions.entries b/host/libs/virglrenderer/OpenGLESDispatch/gles1_extensions.entries
index 1e7f2f1fe..1e7f2f1fe 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles1_extensions.entries
+++ b/host/libs/virglrenderer/OpenGLESDispatch/gles1_extensions.entries
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_only.entries b/host/libs/virglrenderer/OpenGLESDispatch/gles2_core.entries
index 1e2285447..1e2285447 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_only.entries
+++ b/host/libs/virglrenderer/OpenGLESDispatch/gles2_core.entries
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_extensions.entries b/host/libs/virglrenderer/OpenGLESDispatch/gles2_extensions.entries
index 06ee78fa2..06ee78fa2 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles2_extensions.entries
+++ b/host/libs/virglrenderer/OpenGLESDispatch/gles2_extensions.entries
diff --git a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles3_only.entries b/host/libs/virglrenderer/OpenGLESDispatch/gles3_only.entries
index af9665c6f..af9665c6f 100644
--- a/distrib/android-emugl/host/libs/libOpenGLESDispatch/gles3_only.entries
+++ b/host/libs/virglrenderer/OpenGLESDispatch/gles3_only.entries
diff --git a/distrib/android-emugl/host/include/OpenglRender/IOStream.h b/host/libs/virglrenderer/OpenglRender/IOStream.h
index 46b8c6aac..46b8c6aac 100644
--- a/distrib/android-emugl/host/include/OpenglRender/IOStream.h
+++ b/host/libs/virglrenderer/OpenglRender/IOStream.h
diff --git a/distrib/android-emugl/shared/OpenglCodecCommon/ProtocolUtils.h b/host/libs/virglrenderer/ProtocolUtils.h
index 7c323c979..7c323c979 100644
--- a/distrib/android-emugl/shared/OpenglCodecCommon/ProtocolUtils.h
+++ b/host/libs/virglrenderer/ProtocolUtils.h
diff --git a/distrib/android-emugl/shared/emugl/common/logging.h b/host/libs/virglrenderer/emugl/common/logging.h
index e5c77ef17..e5c77ef17 100644
--- a/distrib/android-emugl/shared/emugl/common/logging.h
+++ b/host/libs/virglrenderer/emugl/common/logging.h
diff --git a/distrib/android-emugl/host/libs/renderControl_dec/renderControl.attrib b/host/libs/virglrenderer/renderControl_dec/renderControl.attrib
index 9ff6c9739..ca14e4bea 100644
--- a/distrib/android-emugl/host/libs/renderControl_dec/renderControl.attrib
+++ b/host/libs/virglrenderer/renderControl_dec/renderControl.attrib
@@ -1,5 +1,5 @@
# For documentation on the .attrib file format, see:
-# distrib/android-emugl/host/tools/emugen/README
+# android/android-emugl/host/tools/emugen/README
GLOBAL
base_opcode 10000
diff --git a/distrib/android-emugl/host/libs/renderControl_dec/renderControl.in b/host/libs/virglrenderer/renderControl_dec/renderControl.in
index 6a10beefb..6a10beefb 100644
--- a/distrib/android-emugl/host/libs/renderControl_dec/renderControl.in
+++ b/host/libs/virglrenderer/renderControl_dec/renderControl.in
diff --git a/distrib/android-emugl/host/libs/renderControl_dec/renderControl.types b/host/libs/virglrenderer/renderControl_dec/renderControl.types
index 578492b62..578492b62 100644
--- a/distrib/android-emugl/host/libs/renderControl_dec/renderControl.types
+++ b/host/libs/virglrenderer/renderControl_dec/renderControl.types