Browse files

Add EGL static dispatch initialisation for ES2/EGL static linking pur…

…poses.

Re-do ES2 dispatch table initialization.
eglMakeCurrent calls RegalMakeCurrent.
Avoid crashing if Regal::GetProcAddress points to Regal entry point. (oops!)
README.rst updates - REGAL_NO_TLS, etc.
Rename GL_REGAL_enable GL_LOADER_REGAL to GL_DRIVER_REGAL

Compile-time support for REGAL_DRIVER.
Add support for compile-time REGAL_EMULATION=0 to compile-out emulation support.
Add support for REGAL_EMULATION environment variable - replaces REGAL_NO_EMULATION.
  • Loading branch information...
1 parent 2cee20d commit 1bd8eaea10fdc6be606d234b10296f5bf58dc46a @nigels-com nigels-com committed Aug 24, 2012
View
1 Makefile
@@ -78,6 +78,7 @@ LIB.SRCS += src/regal/RegalDispatchError.cpp
LIB.SRCS += src/regal/RegalDispatchLoader.cpp
LIB.SRCS += src/regal/RegalDispatchNacl.cpp
LIB.SRCS += src/regal/RegalDispatchStaticES2.cpp
+LIB.SRCS += src/regal/RegalDispatchStaticEGL.cpp
LIB.SRCS += src/regal/RegalDispatchMissing.cpp
LIB.SRCS += src/regal/RegalHttp.cpp
LIB.SRCS += src/regal/RegalFavicon.cpp
View
2 Makefile.nacl
@@ -75,6 +75,8 @@ LIB.SRCS += src/regal/RegalDispatchDebug.cpp
LIB.SRCS += src/regal/RegalDispatchError.cpp
LIB.SRCS += src/regal/RegalDispatchLoader.cpp
LIB.SRCS += src/regal/RegalDispatchNacl.cpp
+LIB.SRCS += src/regal/RegalDispatchStaticES2.cpp
+LIB.SRCS += src/regal/RegalDispatchStaticEGL.cpp
LIB.SRCS += src/regal/RegalDispatchMissing.cpp
LIB.SRCS += src/regal/RegalHttp.cpp
LIB.SRCS += src/regal/RegalFavicon.cpp
View
158 README.rst
@@ -3,11 +3,17 @@
:width: 128 px
:align: right
+=====
Regal
=====
https://github.com/p3/regal
+.. contents::
+
+Summary
+=======
+
OpenGL portability layer for OpenGL 2.x, 3.x, 4.x, Core contexts and ES 2.0
+---------------+----------------------------------------------------------------------+
@@ -17,7 +23,7 @@ OpenGL portability layer for OpenGL 2.x, 3.x, 4.x, Core contexts and ES 2.0
+---------------+----------------------------------------------------------------------+
Goals
------
+=====
Regal is a portable OpenGL layer on top of existing OpenGL implementations.
Compile and link an app against Regal and deploy on various OpenGL implementations
@@ -47,7 +53,7 @@ including compatibility, core and ES 2.0 OpenGL contexts.
For example, tessellation support requires tessellation hardware.
Deployment
-----------
+==========
* Most code remains unchanged.
* Optionally **#include <GL/Regal.h>**
@@ -58,9 +64,10 @@ You link with it instead of your platform's OpenGL library or framework, and tha
all you have to do to use Regal. The rest of your code can remain unchanged.
Features
---------
+========
-* Emulation
+Emulation
+---------
- Fixed function texturing, lighting and fog.
- Direct State Access extension
@@ -71,45 +78,36 @@ Features
http://www.khronos.org/registry/gles/extensions/EXT/EXT_debug_marker.txt
- - Fixed function and DSA emulation enabled by default.
+ - Fixed function and DSA emulation enabled by default, except when compatibility context
+ with DSA extension detected.
- Build-time configuration:
- - **REGAL_NO_EMULATION** -- Disable the use of emulation
+ - **REGAL_EMULATION** -- Enable/disable the use of emulation
- **REGAL_FORCE_EMULATION** -- Force the use of emulation, even for compatibility contexts with DSA
- Environment variable configuration:
- - **REGAL_NO_EMULATION** -- Disable the use of emulation
+ - **REGAL_EMULATION** -- Enable/disable the use of emulation
- **REGAL_FORCE_EMULATION** -- Force the use of emulation, even for compatibility contexts with DSA
-* OpenGL error checking
+ - Runime configuration via GL_REGAL_enable_:
+
+ - **GL_EMULATION_REGAL** -- glEnable/glDisable emulation
+
+OpenGL error checking
+---------------------
- Disabled by default.
- Build-time configuration: **REGAL_ERROR**
- Environment variable configuration: **REGAL_ERROR**
-* Browser-based interface
-
- - Enabled by default.
-
- - **REGAL_NO_HTTP** --- Build-time and environment variable enable/disable.
- - **REGAL_HTTP_PORT** --- Port for HTTP connections (8080 by default)
- - **REGAL_HTTP_LOG_LIMIT** --- Number of lines of logging buffered
-
- - `http://127.0.0.1:8080/log`_ --- View log
- - `http://127.0.0.1:8080/glEnable?GL_LOG_APP_REGAL`_ --- Enable/disable application logging
- - `http://127.0.0.1:8080/glEnable?GL_LOG_DRIVER_REGAL`_ --- Enable/disable driver logging
- - `http://127.0.0.1:8080`_ --- State information
-
-.. _http://127.0.0.1:8080/log: http://127.0.0.1:8080/log
-.. _http://127.0.0.1:8080/glEnable?GL_LOG_APP_REGAL: http://127.0.0.1:8080/glEnable?GL_LOG_APP_REGAL
-.. _http://127.0.0.1:8080/glEnable?GL_LOG_DRIVER_REGAL: http://127.0.0.1:8080/glEnable?GL_LOG_DRIVER_REGAL
-.. _http://127.0.0.1:8080: http://127.0.0.1:8080
+ - Runtime configuration via GL_REGAL_enable_: **GL_ERROR_REGAL**
-* Logging
+Logging
+-------
Regal supports detailed logging for development purposes.
@@ -149,7 +147,7 @@ Features
Environment variable lookup is globally disabled by defining **REGAL_NO_GETENV**
at compile-time.
- Runtime configuration via **GL_REGAL_log** extension: (**glEnable/glDisable/glIsEnabled**)
+ Runtime configuration via GL_REGAL_log_ extension: (**glEnable/glDisable/glIsEnabled**)
- **GL_LOG_ERROR_REGAL**
- **GL_LOG_WARNING_REGAL**
@@ -159,7 +157,15 @@ Features
- **GL_LOG_INTERNAL_REGAL**
- **GL_LOG_HTTP_REGAL**
-* Spoofing OpenGL vendor, renderer, version and extension strings
+Multi-threading support
+-----------------------
+
+ - Enabled by default.
+
+ - Build-time configuration: **REGAL_NO_TLS**
+
+Spoofing OpenGL vendor, renderer, version and extension strings
+---------------------------------------------------------------
Build-time configuration
@@ -178,24 +184,108 @@ Features
Environment variable lookup is globally disabled by defining **REGAL_NO_GETENV**
at compile-time.
-* Regal OpenGL extensions
+Browser-based interface
+-----------------------
+
+ - Enabled by default.
+
+ - **REGAL_NO_HTTP** --- Build-time and environment variable enable/disable.
+ - **REGAL_HTTP_PORT** --- Port for HTTP connections (8080 by default)
+ - **REGAL_HTTP_LOG_LIMIT** --- Number of lines of logging buffered
+
+ - `http://127.0.0.1:8080/log`_ --- View log
+ - `http://127.0.0.1:8080/glEnable?GL_LOG_APP_REGAL`_ --- Enable/disable application logging
+ - `http://127.0.0.1:8080/glEnable?GL_LOG_DRIVER_REGAL`_ --- Enable/disable driver logging
+ - `http://127.0.0.1:8080`_ --- State information
+
+.. _http://127.0.0.1:8080/log: http://127.0.0.1:8080/log
+.. _http://127.0.0.1:8080/glEnable?GL_LOG_APP_REGAL: http://127.0.0.1:8080/glEnable?GL_LOG_APP_REGAL
+.. _http://127.0.0.1:8080/glEnable?GL_LOG_DRIVER_REGAL: http://127.0.0.1:8080/glEnable?GL_LOG_DRIVER_REGAL
+.. _http://127.0.0.1:8080: http://127.0.0.1:8080
+
+Regal OpenGL extensions
+-----------------------
+
+ - GL_REGAL_error_string_ for GLU-style GLenum to error string conversion.
+ - GL_REGAL_extension_query_ for GLEW-style extension checking.
+ - GL_REGAL_log_ for Regal logging configuration.
+ - GL_REGAL_enable_ for Regal feature configuration.
+
+In Progress
+===========
- - **GL_REGAL_error_string** for GLU-style GLenum to error string conversion.
- - **GL_REGAL_extension_query** for GLEW-style extension checking.
- - **GL_REGAL_log** for Regal logging configuration.
+* Google Native Client (NaCL) 1st class support
+* glPushAttrib emulation
Planned Features
-----------------
+================
* Debug label.
* Debug output.
* Web browser-based debugging tools.
* Display list emulation.
Limitations
------------
+===========
* Incomplete implementation, so far.
* Limited GLSL language support.
* GL_QUADS only works in immediate mode or with DrawArrays for ES and core profiles.
+.. _GL_REGAL_error_string: https://github.com/p3/regal/blob/master/doc/extensions/GL_REGAL_error_string.txt
+.. _GL_REGAL_extension_query: https://github.com/p3/regal/blob/master/doc/extensions/GL_REGAL_extension_query.txt
+.. _GL_REGAL_log: https://github.com/p3/regal/blob/master/doc/extensions/GL_REGAL_log.txt
+.. _GL_REGAL_enable: https://github.com/p3/regal/blob/master/doc/extensions/GL_REGAL_enable.txt
+
+License and Credits
+===================
+
+Regal code, API database and generators are `BSD <http://opensource.org/licenses/bsd-license.php>`_ licensed.
+
+::
+
+ Copyright (c) 2011 NVIDIA Corporation
+ Copyright (c) 2011-2012 Cass Everitt
+ Copyright (c) 2012 Scott Nations
+ Copyright (c) 2012 Mathias Schott
+ Copyright (c) 2012 Nigel Stewart
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Boost is licensed under `Boost Software License <http://www.boost.org/users/license.html>`_.
+
+GLEW is licensed under `BSD and MIT License <http://glew.sourceforge.net/credits.html>`_.
+
+GLU is licensed under `SGI FREE SOFTWARE LICENSE B <http://oss.sgi.com/projects/FreeB/>`_.
+
+GLUT license:
+
+::
+
+ /* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
+
+ /* This program is freely distributable without licensing fees and is
+ provided without guarantee or warrantee expressed or implied. This
+ program is -not- in the public domain. */
+
+Dreamtorus example program is `public domain <http://unlicense.org/>`_.
View
9 doc/extensions/GL_REGAL_enable.txt
@@ -22,8 +22,8 @@ Status
Version
- Last Modified Date: August 14, 2012
- Revision: 1
+ Last Modified Date: August 22, 2012
+ Revision: 2
Number
@@ -62,7 +62,7 @@ New Tokens
DEBUG_REGAL 0x9323
LOG_REGAL 0x9324
EMULATION_REGAL 0x9325
- LOADER_REGAL 0x9326
+ DRIVER_REGAL 0x9326
Additions to Chapter x of the OpenGL 4.2 (Core Profile) Specification
(OpenGL Operation)
@@ -87,5 +87,8 @@ Issues
Revision History
+ Revision 2, 2012/08/22
+ - LOADER_REGAL renamed to DRIVER_REGAL
+
Revision 1, 2012/08/14
- Initial revision.
View
2 examples/dreamtorus/glut/code/main.cpp
@@ -101,7 +101,7 @@ static void myKeyboard(unsigned char c, int x, int y)
case 'r':
case 'R':
- myToggle(GL_LOADER_REGAL,"Regal driver is");
+ myToggle(GL_DRIVER_REGAL,"Regal driver is");
break;
}
}
View
2 include/GL/Regal.h
@@ -19439,7 +19439,7 @@ REGAL_DECL void REGAL_CALL glTexParameterxv(GLenum target, GLenum pname, const G
#define GL_DEBUG_REGAL 0x9323 /* 37667 */
#define GL_LOG_REGAL 0x9324 /* 37668 */
#define GL_EMULATION_REGAL 0x9325 /* 37669 */
-#define GL_LOADER_REGAL 0x9326 /* 37670 */
+#define GL_DRIVER_REGAL 0x9326 /* 37670 */
#endif
/**
View
2 include/GL/RegalGLEW.h
@@ -13258,7 +13258,7 @@ typedef void (GLAPIENTRY * PFNGLTEXPARAMETERXVPROC) (GLenum target, GLenum pname
#define GL_DEBUG_REGAL 0x9323
#define GL_LOG_REGAL 0x9324
#define GL_EMULATION_REGAL 0x9325
-#define GL_LOADER_REGAL 0x9326
+#define GL_DRIVER_REGAL 0x9326
#define GLEW_REGAL_enable GLEW_GET_VAR(__GLEW_REGAL_enable)
View
6 scripts/EmuEnable.py
@@ -37,7 +37,7 @@
' #endif',
' return;',
'',
-' case GL_LOADER_REGAL:',
+' case GL_DRIVER_REGAL:',
' #if REGAL_DRIVER',
' _context->dispatcher.enable(_context->dispatcher.driver);',
' #endif',
@@ -75,7 +75,7 @@
' #endif',
' return;',
'',
-' case GL_LOADER_REGAL:',
+' case GL_DRIVER_REGAL:',
' #if REGAL_DRIVER',
' _context->dispatcher.disable(_context->dispatcher.driver);',
' #endif',
@@ -117,7 +117,7 @@
' return GL_FALSE;',
' #endif',
'',
-' case GL_LOADER_REGAL:',
+' case GL_DRIVER_REGAL:',
' #if REGAL_DRIVER',
' return _context->dispatcher.isEnabled(_context->dispatcher.driver) ? GL_TRUE : GL_FALSE;',
' #else',
View
207 scripts/Export.py
@@ -180,6 +180,7 @@ def generate(apis, args):
generateMissingSource( apis, args )
generateNaclSource( apis, args )
generateStaticES2Source( apis, args )
+ generateStaticEGLSource( apis, args )
generatePublicHeader(apis, args)
generateDispatchHeader(apis, args)
generateContextHeader(apis, args)
@@ -490,7 +491,9 @@ def generateDispatchHeader(apis, args):
#include "RegalContext.h"
#include "RegalDebugInfo.h"
#include "RegalContextInfo.h"
-${EMU_INCLUDES}
+
+${INCLUDES}#if REGAL_EMULATION
+${EMU_INCLUDES}#endif
REGAL_GLOBAL_END
@@ -502,7 +505,8 @@ def generateDispatchHeader(apis, args):
: dispatcher(),
dbg(NULL),
info(NULL),
-${EMU_MEMBER_CONSTRUCT}
+${MEMBER_CONSTRUCT}#if REGAL_EMULATION
+${EMU_MEMBER_CONSTRUCT}#endif
#if defined(__native_client__)
naclES2(NULL),
naclResource(NULL),
@@ -532,6 +536,7 @@ def generateDispatchHeader(apis, args):
${MEMBER_INIT}
+#if REGAL_EMULATION
#if !REGAL_FORCE_EMULATION
if
(
@@ -550,13 +555,16 @@ def generateDispatchHeader(apis, args):
RegalAssert(info);
${EMU_MEMBER_INIT}
}
+#endif
}
RegalContext::~RegalContext()
{
ITrace("RegalContext::~RegalContext");
delete info;
-${EMU_MEMBER_CLEANUP}
+${MEMBER_CLEANUP}
+#if REGAL_EMULATION
+${EMU_MEMBER_CLEANUP}#endif
}
REGAL_NAMESPACE_END
@@ -572,6 +580,9 @@ def generateContextHeader(apis, args):
emuForwardDeclare += 'struct %s;\n' % i['type']
emuMemberDeclare += ' %-18s *%s;\n' % ( i['type'], i['member'] )
+ emuForwardDeclare += '#if REGAL_EMULATION\n'
+ emuMemberDeclare += '#if REGAL_EMULATION\n'
+
emuMemberDeclare += ' // Fixed function emulation\n'
emuMemberDeclare += ' int emuLevel;\n'
@@ -580,6 +591,9 @@ def generateContextHeader(apis, args):
emuForwardDeclare += 'struct %s;\n' % i['type']
emuMemberDeclare += ' %-18s *%s;\n' % ( i['type'], i['member'] )
+ emuForwardDeclare += '#endif\n'
+ emuMemberDeclare += '#endif\n'
+
# Output
substitute = {}
@@ -597,18 +611,21 @@ def generateContextHeader(apis, args):
def generateContextSource(apis, args):
+ includes = ''
+ memberConstruct = ''
+ memberInit = ''
+ memberCleanup = ''
emuIncludes = ''
emuMemberConstruct = ''
- memberInit = ''
emuMemberInit = ''
emuMemberCleanup = ''
for i in emuRegal:
if i['member']:
- emuMemberConstruct += ' %s(NULL),\n' % ( i['member'] )
- emuIncludes += '#include "Regal%s.h"\n' % i['type']
- memberInit += ' %s = new %s;\n'%(i['member'],i['type'])
- emuMemberCleanup += ' delete %s;\n' % i['member']
+ includes += '#include "Regal%s.h"\n' % i['type']
+ memberConstruct += ' %s(NULL),\n' % ( i['member'] )
+ memberInit += ' %s = new %s;\n'%(i['member'],i['type'])
+ memberCleanup += ' delete %s;\n' % i['member']
emuMemberConstruct += ' emuLevel(0),\n'
@@ -648,11 +665,14 @@ def generateContextSource(apis, args):
substitute['AUTOGENERATED'] = autoGeneratedMessage
substitute['COPYRIGHT'] = args.copyright
- substitute['EMU_INCLUDES'] = emuIncludes
- substitute['MEMBER_INIT'] = memberInit
+ substitute['INCLUDES'] = includes
+ substitute['MEMBER_CONSTRUCT'] = memberConstruct
+ substitute['MEMBER_INIT'] = memberInit
+ substitute['MEMBER_CLEANUP'] = memberCleanup
+ substitute['EMU_INCLUDES'] = emuIncludes
substitute['EMU_MEMBER_CONSTRUCT'] = emuMemberConstruct
- substitute['EMU_MEMBER_INIT'] = emuMemberInit
- substitute['EMU_MEMBER_CLEANUP'] = emuMemberCleanup
+ substitute['EMU_MEMBER_INIT'] = emuMemberInit
+ substitute['EMU_MEMBER_CLEANUP'] = emuMemberCleanup
outputCode( '%s/RegalContext.cpp' % args.outdir, contextSourceTemplate.substitute(substitute))
@@ -1740,7 +1760,9 @@ def generateDefFile(apis, args, additional_exports):
#include "RegalToken.h"
#include "RegalState.h"
#include "RegalHelper.h"
+#include "RegalPrivate.h"
#include "RegalDebugInfo.h"
+#include "RegalContextInfo.h"
#include "RegalMarker.h"
@@ -1784,7 +1806,6 @@ def generateSource(apis, args):
##############################################################################################
-
dispatchSourceTemplate = Template('''${AUTOGENERATED}
${LICENSE}
@@ -1846,7 +1867,7 @@ def generateLoaderSource(apis, args):
substitute['COPYRIGHT'] = args.copyright
substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine
substitute['API_DISPATCH_FUNC_INIT'] = funcInit
- substitute['IFDEF'] = '#ifndef __native_client__\n\n'
+ substitute['IFDEF'] = '#if REGAL_DRIVER && !defined(__native_client__)\n\n'
substitute['ENDIF'] = '#endif\n'
outputCode( '%s/RegalDispatchLoader.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
@@ -1890,8 +1911,8 @@ def generateEmuSource(apis, args):
substitute['COPYRIGHT'] = args.copyright
substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine
substitute['API_DISPATCH_FUNC_INIT'] = funcInit
- substitute['IFDEF'] = ''
- substitute['ENDIF'] = ''
+ substitute['IFDEF'] = '#if REGAL_EMULATION\n\n'
+ substitute['ENDIF'] = '#endif\n'
outputCode( '%s/RegalDispatchEmu.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
@@ -2008,7 +2029,7 @@ def generateNaclSource(apis, args):
substitute['COPYRIGHT'] = args.copyright
substitute['API_DISPATCH_FUNC_DEFINE'] = funcDefine
substitute['API_DISPATCH_FUNC_INIT'] = funcInit
- substitute['IFDEF'] = '#if defined(__native_client__)\n'
+ substitute['IFDEF'] = '#if REGAL_DRIVER && defined(__native_client__)\n'
substitute['ENDIF'] = '#endif\n'
outputCode( '%s/RegalDispatchNacl.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
@@ -2018,54 +2039,160 @@ def generateNaclSource(apis, args):
def apiStaticES2FuncInitCode(apis, args):
- code = ''
+ code = '// OpenGL ES 2.0 only\n\n'
- code += '#ifdef REGAL_NAMESPACE\n'
- code += '#undef REGAL_NAMESPACE\n'
- code += '\n'
+ for api in apis:
+ if api.name=='gl':
+ for function in api.functions:
+ if not function.needsContext:
+ continue
+ if getattr(function,'esVersions',None)==None or 2.0 not in function.esVersions:
+ continue
+ name = function.name
+ code += ' tbl.r%s = %s;\n' % ( name, name )
- code = '// OpenGL ES 2.0 only\n'
+ return code
- for api in apis:
+def generateStaticES2Source(apis, args):
+
+ code = '\n'
+
+ code += '#ifndef REGAL_NAMESPACE\n'
+ code += '#error REGAL_STATIC_ES2 requires REGAL_NAMESPACE\n'
+ code += '#endif\n\n'
+ for api in apis:
if api.name=='gl':
for function in api.functions:
if not function.needsContext:
continue
if getattr(function,'esVersions',None)==None or 2.0 not in function.esVersions:
continue
-
name = function.name
+ code += '#undef %s\n' % ( name )
+
+ code += '\n'
+ code += 'extern "C"\n'
+ code += '{\n'
+
+ for function in api.functions:
+ if not function.needsContext:
+ continue
+ if getattr(function,'esVersions',None)==None or 2.0 not in function.esVersions:
+ continue
params = paramsDefaultCode(function.parameters, True)
- callParams = paramsNameCode(function.parameters)
rType = typeCode(function.ret.type)
+ code += ' extern %s REGAL_CALL %s(%s);\n' % (rType, function.name, params)
+
+ code += '}\n'
+
+ substitute = {}
+
+ substitute['LICENSE'] = regalLicense
+ substitute['DISPATCH_NAME'] = 'StaticES2'
+ substitute['LOCAL_INCLUDE'] = code
+ substitute['LOCAL_CODE'] = ''
+ substitute['AUTOGENERATED'] = autoGeneratedMessage
+ substitute['COPYRIGHT'] = args.copyright
+ substitute['API_DISPATCH_FUNC_DEFINE'] = ''
+ substitute['API_DISPATCH_FUNC_INIT'] = apiStaticES2FuncInitCode( apis, args )
+ substitute['IFDEF'] = '#if REGAL_DRIVER && REGAL_STATIC_ES2\n\n'
+ substitute['ENDIF'] = '#endif\n'
+
+ outputCode( '%s/RegalDispatchStaticES2.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
+
+##############################################################################################
+
+dispatchGlobalSourceTemplate = Template('''${AUTOGENERATED}
+${LICENSE}
- code += ' tbl.%s = %s;\n' % ( name, name )
+#include "pch.h" /* For MS precompiled header support */
+
+#include "RegalUtil.h"
+
+${IFDEF}REGAL_GLOBAL_BEGIN
+
+#include <string>
+using namespace std;
+
+#include "RegalDispatch.h"
+${LOCAL_INCLUDE}
+
+REGAL_GLOBAL_END
+
+REGAL_NAMESPACE_BEGIN
+
+using namespace ::REGAL_NAMESPACE_INTERNAL::Logging;
+using namespace ::REGAL_NAMESPACE_INTERNAL::Token;
+
+${LOCAL_CODE}
+
+${API_DISPATCH_FUNC_DEFINE}
+
+void InitDispatchTable${DISPATCH_NAME}(DispatchTableGlobal &tbl)
+{
+ ${API_DISPATCH_FUNC_INIT}
+}
+
+REGAL_NAMESPACE_END
+
+${ENDIF}''')
+
+def apiStaticEGLFuncInitCode(apis, args):
+
+ code = ''
+
+ code += '// EGL global dispatch\n'
+
+ for api in apis:
+ if api.name=='egl':
+ for function in api.functions:
+ name = function.name
+ code += ' tbl.r%s = ::%s;\n' % ( name, name )
return code
-def generateStaticES2Source(apis, args):
+def generateStaticEGLSource(apis, args):
- funcInit = apiStaticES2FuncInitCode( apis, args )
+ code = '\n'
- # Output
+ code += '#ifndef REGAL_NAMESPACE\n'
+ code += '#error REGAL_STATIC_EGL requires REGAL_NAMESPACE\n'
+ code += '#endif\n\n'
+
+ for api in apis:
+ if api.name=='egl':
+
+ for function in api.functions:
+ name = function.name
+ code += '#undef %s\n' % ( name )
+
+ code += '\n'
+ code += 'extern "C"\n'
+ code += '{\n'
+
+ for function in api.functions:
+ params = paramsDefaultCode(function.parameters, True)
+ rType = typeCode(function.ret.type)
+ code += ' extern %s REGAL_CALL %s(%s);\n' % (rType, function.name, params)
+
+ code += '}\n'
substitute = {}
substitute['LICENSE'] = regalLicense
- substitute['DISPATCH_NAME'] = 'StaticES2'
- substitute['LOCAL_INCLUDE'] = ''
+ substitute['DISPATCH_NAME'] = 'StaticEGL'
+ substitute['LOCAL_INCLUDE'] = code
substitute['LOCAL_CODE'] = ''
substitute['AUTOGENERATED'] = autoGeneratedMessage
substitute['COPYRIGHT'] = args.copyright
substitute['API_DISPATCH_FUNC_DEFINE'] = ''
- substitute['API_DISPATCH_FUNC_INIT'] = funcInit
- substitute['IFDEF'] = '#if REGAL_STATIC_ES2\n'
+ substitute['API_DISPATCH_FUNC_INIT'] = apiStaticEGLFuncInitCode( apis, args )
+ substitute['IFDEF'] = '#if REGAL_SYS_ANDROID && REGAL_DRIVER && REGAL_STATIC_EGL\n\n'
substitute['ENDIF'] = '#endif\n'
- outputCode( '%s/RegalDispatchStaticES2.cpp' % args.outdir, dispatchSourceTemplate.substitute(substitute))
-
+ outputCode( '%s/RegalDispatchStaticEGL.cpp' % args.outdir, dispatchGlobalSourceTemplate.substitute(substitute))
##############################################################################################
@@ -2604,6 +2731,8 @@ def apiFuncDefineCode(apis, args):
c += ' if (dispatchTableGlobal.%s == NULL) {\n' % name
c += ' GetProcAddress( dispatchTableGlobal.%s, "%s" );\n' % ( name, name )
c += ' RegalAssert(dispatchTableGlobal.%s!=%s);\n' % ( name, name )
+ c += ' if (dispatchTableGlobal.%s==%s)\n' % ( name, name )
+ c += ' dispatchTableGlobal.%s = NULL;\n' % ( name )
c += ' }\n'
if not typeIsVoid(rType):
@@ -2621,11 +2750,13 @@ def apiFuncDefineCode(apis, args):
c += 'ret = '
c += 'dispatchTableGlobal.%s(%s);\n' % ( name, callParams )
if name == 'wglMakeCurrent':
- c += ' RegalMakeCurrent(RegalSystemContext(hglrc));\n'
+ c += ' RegalMakeCurrent(RegalSystemContext(hglrc));\n'
elif name == 'CGLSetCurrentContext':
- c += ' RegalMakeCurrent( ctx );\n'
+ c += ' RegalMakeCurrent( ctx );\n'
elif name == 'glXMakeCurrent':
- c += ' RegalMakeCurrent( RegalSystemContext(ctx) );\n'
+ c += ' RegalMakeCurrent( RegalSystemContext(ctx) );\n'
+ elif name == 'eglMakeCurrent':
+ c += ' RegalMakeCurrent( ctx );\n'
c += ' }\n'
c += ' else\n'
c += ' Warning( "%s not available." );\n' % name
View
4 scripts/gl.py
@@ -9645,15 +9645,15 @@
# GL_REGAL_enable
GL_DEBUG_REGAL = Enumerant('GL_DEBUG_REGAL', 0x9323, 'GL_REGAL_enable')
+GL_DRIVER_REGAL = Enumerant('GL_DRIVER_REGAL', 0x9326, 'GL_REGAL_enable')
GL_EMULATION_REGAL = Enumerant('GL_EMULATION_REGAL', 0x9325, 'GL_REGAL_enable')
GL_ERROR_REGAL = Enumerant('GL_ERROR_REGAL', 0x9322, 'GL_REGAL_enable')
-GL_LOADER_REGAL = Enumerant('GL_LOADER_REGAL', 0x9326, 'GL_REGAL_enable')
GL_LOG_REGAL = Enumerant('GL_LOG_REGAL', 0x9324, 'GL_REGAL_enable')
defines.add(GL_DEBUG_REGAL)
+defines.add(GL_DRIVER_REGAL)
defines.add(GL_EMULATION_REGAL)
defines.add(GL_ERROR_REGAL)
-defines.add(GL_LOADER_REGAL)
defines.add(GL_LOG_REGAL)
# GL_REGAL_log
View
2 src/glew/include/GL/glew.h
@@ -13258,7 +13258,7 @@ typedef void (GLAPIENTRY * PFNGLTEXPARAMETERXVPROC) (GLenum target, GLenum pname
#define GL_DEBUG_REGAL 0x9323
#define GL_LOG_REGAL 0x9324
#define GL_EMULATION_REGAL 0x9325
-#define GL_LOADER_REGAL 0x9326
+#define GL_DRIVER_REGAL 0x9326
#define GLEW_REGAL_enable GLEW_GET_VAR(__GLEW_REGAL_enable)
View
699 src/regal/Regal.cpp
693 additions, 6 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
35 src/regal/RegalConfig.cpp
@@ -48,10 +48,11 @@ namespace Config {
bool forceCoreProfile = false;
bool forceEmulation = REGAL_FORCE_EMULATION;
-bool enableEmulation = true;
+bool enableEmulation = REGAL_EMULATION;
bool enableDebug = false;
bool enableError = false;
-bool enableLog = true;
+bool enableLog = REGAL_LOG;
+bool enableDriver = REGAL_DRIVER;
bool enableEmuPpa = REGAL_EMU_PPA;
bool enableEmuObj = REGAL_EMU_OBJ;
bool enableEmuBin = REGAL_EMU_BIN;
@@ -74,6 +75,13 @@ void Init()
if (tmp) forceEmulation = atoi(tmp)!=0;
#endif
+#if REGAL_EMULATION
+ tmp = GetEnv( "REGAL_EMULATION" );
+ if (tmp) enableEmulation = atoi(tmp)!=0;
+#endif
+
+ // Deprecated
+
tmp = GetEnv( "REGAL_NO_EMULATION" );
if (tmp) enableEmulation = atoi(tmp)==0;
@@ -87,6 +95,16 @@ void Init()
if (tmp) enableError = atoi(tmp)!=0;
#endif
+#if REGAL_LOG
+ tmp = GetEnv( "REGAL_LOG" );
+ if (tmp) enableLog = atoi(tmp)!=0;
+#endif
+
+#if REGAL_DRIVER
+ tmp = GetEnv( "REGAL_DRIVER" );
+ if (tmp) enableDriver = atoi(tmp)!=0;
+#endif
+
#if REGAL_EMU_PPA
tmp = GetEnv( "REGAL_EMU_PPA" );
if (tmp) enableEmuObj = atoi(tmp)!=0;
@@ -122,19 +140,20 @@ void Init()
forceCoreProfile = (REGAL_FORCE_CORE_PROFILE) != 0;
#endif
-#ifdef REGAL_NO_EMULATION
- enableEmulation = (REGAL_NO_EMULATION) == 0;
-#endif
+ // REGAL_NO_EMULATION is deprecated, use REGAL_EMULATION=0 instead.
-#if !REGAL_LOG
- enableLog = false;
+#if REGAL_EMULATION && defined(REGAL_NO_EMULATION) && REGAL_NO_EMULATION
+ enableEmulation = false;
#endif
Info("REGAL_FORCE_CORE_PROFILE ", forceCoreProfile ? "enabled" : "disabled");
+
Info("REGAL_FORCE_EMULATION ", forceEmulation ? "enabled" : "disabled");
- Info("REGAL_NO_EMULATION ", !enableEmulation ? "enabled" : "disabled");
Info("REGAL_DEBUG ", enableDebug ? "enabled" : "disabled");
Info("REGAL_ERROR ", enableError ? "enabled" : "disabled");
+ Info("REGAL_EMULATION ", enableEmulation ? "enabled" : "disabled");
+ Info("REGAL_LOG ", enableLog ? "enabled" : "disabled");
+ Info("REGAL_DRIVER ", enableDriver ? "enabled" : "disabled");
Info("REGAL_EMU_PPA ", enableEmuPpa ? "enabled" : "disabled");
Info("REGAL_EMU_OBJ ", enableEmuObj ? "enabled" : "disabled");
View
6 src/regal/RegalConfig.h
@@ -44,11 +44,17 @@ namespace Config
void Init();
extern bool forceCoreProfile;
+
+ // Initial dispatch enable/disable state
+
extern bool forceEmulation;
extern bool enableEmulation;
extern bool enableDebug;
extern bool enableError;
extern bool enableLog;
+ extern bool enableDriver;
+
+ // Initial emulation layer enable/disable
extern bool enableEmuPpa;
extern bool enableEmuObj;
View
12 src/regal/RegalContext.cpp
@@ -42,13 +42,16 @@ REGAL_GLOBAL_BEGIN
#include "RegalContext.h"
#include "RegalDebugInfo.h"
#include "RegalContextInfo.h"
+
#include "RegalMarker.h"
+#if REGAL_EMULATION
#include "RegalObj.h"
#include "RegalPpa.h"
#include "RegalBin.h"
#include "RegalDsa.h"
#include "RegalIff.h"
#include "RegalVao.h"
+#endif
REGAL_GLOBAL_END
@@ -61,14 +64,15 @@ RegalContext::RegalContext()
dbg(NULL),
info(NULL),
marker(NULL),
+#if REGAL_EMULATION
emuLevel(0),
obj(NULL),
ppa(NULL),
bin(NULL),
dsa(NULL),
iff(NULL),
vao(NULL),
-
+#endif
#if defined(__native_client__)
naclES2(NULL),
naclResource(NULL),
@@ -98,6 +102,7 @@ RegalContext::Init()
marker = new Marker;
+#if REGAL_EMULATION
#if !REGAL_FORCE_EMULATION
if
(
@@ -170,21 +175,24 @@ RegalContext::Init()
#endif /* REGAL_EMU_OBJ */
}
+#endif
}
RegalContext::~RegalContext()
{
ITrace("RegalContext::~RegalContext");
delete info;
delete marker;
+
+#if REGAL_EMULATION
// emu
delete obj;
delete ppa;
delete bin;
delete dsa;
delete iff;
delete vao;
-
+#endif
}
REGAL_NAMESPACE_END
View
4 src/regal/RegalContext.h
@@ -57,12 +57,14 @@ struct DebugInfo;
struct ContextInfo;
struct Marker;
+#if REGAL_EMULATION
struct RegalObj;
struct RegalPpa;
struct RegalBin;
struct RegalDsa;
struct RegalIff;
struct RegalVao;
+#endif
struct RegalContext
{
@@ -76,6 +78,7 @@ struct RegalContext
DebugInfo *dbg;
ContextInfo *info;
Marker *marker;
+#if REGAL_EMULATION
// Fixed function emulation
int emuLevel;
RegalObj *obj;
@@ -84,6 +87,7 @@ struct RegalContext
RegalDsa *dsa;
RegalIff *iff;
RegalVao *vao;
+#endif
#if defined(__native_client__)
PPB_OpenGLES2 *naclES2;
View
4 src/regal/RegalDispatchEmu.cpp
@@ -36,6 +36,8 @@
#include "RegalUtil.h"
+#if REGAL_EMULATION
+
REGAL_GLOBAL_BEGIN
#include <string>
@@ -28946,3 +28948,5 @@ void InitDispatchTableEmu(DispatchTable &tbl)
}
REGAL_NAMESPACE_END
+
+#endif
View
2 src/regal/RegalDispatchLoader.cpp
@@ -36,7 +36,7 @@
#include "RegalUtil.h"
-#ifndef __native_client__
+#if REGAL_DRIVER && !defined(__native_client__)
REGAL_GLOBAL_BEGIN
View
2 src/regal/RegalDispatchNacl.cpp
@@ -36,7 +36,7 @@
#include "RegalUtil.h"
-#if defined(__native_client__)
+#if REGAL_DRIVER && defined(__native_client__)
REGAL_GLOBAL_BEGIN
#include <string>
View
174 src/regal/RegalDispatchStaticEGL.cpp
@@ -0,0 +1,174 @@
+/* NOTE: Do not edit this file, it is generated by a script:
+ Export.py --api gl 4.2 --api wgl 4.0 --api glx 4.0 --api cgl 1.4 --api egl 1.0 --outdir src/regal
+*/
+
+/*
+ Copyright (c) 2011 NVIDIA Corporation
+ Copyright (c) 2011-2012 Cass Everitt
+ Copyright (c) 2012 Scott Nations
+ Copyright (c) 2012 Mathias Schott
+ Copyright (c) 2012 Nigel Stewart
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "pch.h" /* For MS precompiled header support */
+
+#include "RegalUtil.h"
+
+#if REGAL_SYS_ANDROID && REGAL_DRIVER && REGAL_STATIC_EGL
+
+REGAL_GLOBAL_BEGIN
+
+#include <string>
+using namespace std;
+
+#include "RegalDispatch.h"
+
+#ifndef REGAL_NAMESPACE
+#error REGAL_STATIC_EGL requires REGAL_NAMESPACE
+#endif
+
+#undef eglChooseConfig
+#undef eglCopyBuffers
+#undef eglCreateContext
+#undef eglCreatePbufferSurface
+#undef eglCreatePixmapSurface
+#undef eglCreateWindowSurface
+#undef eglDestroyContext
+#undef eglDestroySurface
+#undef eglGetConfigAttrib
+#undef eglGetConfigs
+#undef eglGetCurrentContext
+#undef eglGetCurrentDisplay
+#undef eglGetCurrentSurface
+#undef eglGetDisplay
+#undef eglGetError
+#undef eglGetProcAddress
+#undef eglInitialize
+#undef eglMakeCurrent
+#undef eglQueryContext
+#undef eglQueryString
+#undef eglQuerySurface
+#undef eglSwapBuffers
+#undef eglTerminate
+#undef eglWaitGL
+#undef eglWaitNative
+#undef eglBindTexImage
+#undef eglReleaseTexImage
+#undef eglBindAPI
+#undef eglCreatePbufferFromClientBuffer
+#undef eglQueryAPI
+#undef eglReleaseThread
+#undef eglSurfaceAttrib
+#undef eglSwapInterval
+#undef eglWaitClient
+
+extern "C"
+{
+ extern EGLBoolean REGAL_CALL eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+ extern EGLBoolean REGAL_CALL eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+ extern EGLContext REGAL_CALL eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
+ extern EGLSurface REGAL_CALL eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+ extern EGLSurface REGAL_CALL eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+ extern EGLSurface REGAL_CALL eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
+ extern EGLBoolean REGAL_CALL eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
+ extern EGLBoolean REGAL_CALL eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
+ extern EGLBoolean REGAL_CALL eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+ extern EGLBoolean REGAL_CALL eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+ extern EGLContext REGAL_CALL eglGetCurrentContext(void);
+ extern EGLDisplay REGAL_CALL eglGetCurrentDisplay(void);
+ extern EGLSurface REGAL_CALL eglGetCurrentSurface(EGLint readdraw);
+ extern EGLDisplay REGAL_CALL eglGetDisplay(EGLNativeDisplayType display_id);
+ extern EGLint REGAL_CALL eglGetError(void);
+ extern __eglMustCastToProperFunctionPointerType REGAL_CALL eglGetProcAddress(const char *procname);
+ extern EGLBoolean REGAL_CALL eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
+ extern EGLBoolean REGAL_CALL eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+ extern EGLBoolean REGAL_CALL eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+ extern const char * REGAL_CALL eglQueryString(EGLDisplay dpy, EGLint name);
+ extern EGLBoolean REGAL_CALL eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+ extern EGLBoolean REGAL_CALL eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
+ extern EGLBoolean REGAL_CALL eglTerminate(EGLDisplay dpy);
+ extern EGLBoolean REGAL_CALL eglWaitGL(void);
+ extern EGLBoolean REGAL_CALL eglWaitNative(EGLint engine);
+ extern EGLBoolean REGAL_CALL eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+ extern EGLBoolean REGAL_CALL eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+ extern EGLBoolean REGAL_CALL eglBindAPI(EGLenum api);
+ extern EGLSurface REGAL_CALL eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+ extern EGLenum REGAL_CALL eglQueryAPI(void);
+ extern EGLBoolean REGAL_CALL eglReleaseThread(void);
+ extern EGLBoolean REGAL_CALL eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+ extern EGLBoolean REGAL_CALL eglSwapInterval(EGLDisplay dpy, EGLint interval);
+ extern EGLBoolean REGAL_CALL eglWaitClient(void);
+}
+
+REGAL_GLOBAL_END
+
+REGAL_NAMESPACE_BEGIN
+
+using namespace ::REGAL_NAMESPACE_INTERNAL::Logging;
+using namespace ::REGAL_NAMESPACE_INTERNAL::Token;
+
+void InitDispatchTableStaticEGL(DispatchTableGlobal &tbl)
+{
+ // EGL global dispatch
+ tbl.reglChooseConfig = ::eglChooseConfig;
+ tbl.reglCopyBuffers = ::eglCopyBuffers;
+ tbl.reglCreateContext = ::eglCreateContext;
+ tbl.reglCreatePbufferSurface = ::eglCreatePbufferSurface;
+ tbl.reglCreatePixmapSurface = ::eglCreatePixmapSurface;
+ tbl.reglCreateWindowSurface = ::eglCreateWindowSurface;
+ tbl.reglDestroyContext = ::eglDestroyContext;
+ tbl.reglDestroySurface = ::eglDestroySurface;
+ tbl.reglGetConfigAttrib = ::eglGetConfigAttrib;
+ tbl.reglGetConfigs = ::eglGetConfigs;
+ tbl.reglGetCurrentContext = ::eglGetCurrentContext;
+ tbl.reglGetCurrentDisplay = ::eglGetCurrentDisplay;
+ tbl.reglGetCurrentSurface = ::eglGetCurrentSurface;
+ tbl.reglGetDisplay = ::eglGetDisplay;
+ tbl.reglGetError = ::eglGetError;
+ tbl.reglGetProcAddress = ::eglGetProcAddress;
+ tbl.reglInitialize = ::eglInitialize;
+ tbl.reglMakeCurrent = ::eglMakeCurrent;
+ tbl.reglQueryContext = ::eglQueryContext;
+ tbl.reglQueryString = ::eglQueryString;
+ tbl.reglQuerySurface = ::eglQuerySurface;
+ tbl.reglSwapBuffers = ::eglSwapBuffers;
+ tbl.reglTerminate = ::eglTerminate;
+ tbl.reglWaitGL = ::eglWaitGL;
+ tbl.reglWaitNative = ::eglWaitNative;
+ tbl.reglBindTexImage = ::eglBindTexImage;
+ tbl.reglReleaseTexImage = ::eglReleaseTexImage;
+ tbl.reglBindAPI = ::eglBindAPI;
+ tbl.reglCreatePbufferFromClientBuffer = ::eglCreatePbufferFromClientBuffer;
+ tbl.reglQueryAPI = ::eglQueryAPI;
+ tbl.reglReleaseThread = ::eglReleaseThread;
+ tbl.reglSurfaceAttrib = ::eglSurfaceAttrib;
+ tbl.reglSwapInterval = ::eglSwapInterval;
+ tbl.reglWaitClient = ::eglWaitClient;
+
+}
+
+REGAL_NAMESPACE_END
+
+#endif
View
581 src/regal/RegalDispatchStaticES2.cpp
@@ -36,7 +36,8 @@
#include "RegalUtil.h"
-#if REGAL_STATIC_ES2
+#if REGAL_DRIVER && REGAL_STATIC_ES2
+
REGAL_GLOBAL_BEGIN
#include <string>
@@ -48,6 +49,299 @@ using namespace std;
#include "RegalPrivate.h"
#include "RegalContext.h"
+#ifndef REGAL_NAMESPACE
+#error REGAL_STATIC_ES2 requires REGAL_NAMESPACE
+#endif
+
+#undef glBlendFunc
+#undef glClear
+#undef glClearColor
+#undef glClearStencil
+#undef glColorMask
+#undef glCullFace
+#undef glDepthFunc
+#undef glDepthMask
+#undef glDisable
+#undef glEnable
+#undef glFinish
+#undef glFlush
+#undef glFrontFace
+#undef glGetBooleanv
+#undef glGetError
+#undef glGetFloatv
+#undef glGetIntegerv
+#undef glGetString
+#undef glGetTexParameterfv
+#undef glGetTexParameteriv
+#undef glHint
+#undef glIsEnabled
+#undef glLineWidth
+#undef glPixelStorei
+#undef glReadPixels
+#undef glScissor
+#undef glStencilFunc
+#undef glStencilMask
+#undef glStencilOp
+#undef glTexImage2D
+#undef glTexParameterf
+#undef glTexParameterfv
+#undef glTexParameteri
+#undef glTexParameteriv
+#undef glViewport
+#undef glBindTexture
+#undef glCopyTexImage2D
+#undef glCopyTexSubImage2D
+#undef glDeleteTextures
+#undef glDrawArrays
+#undef glDrawElements
+#undef glGenTextures
+#undef glIsTexture
+#undef glPolygonOffset
+#undef glTexSubImage2D
+#undef glBlendColor
+#undef glBlendEquation
+#undef glActiveTexture
+#undef glCompressedTexImage2D
+#undef glCompressedTexSubImage2D
+#undef glSampleCoverage
+#undef glBlendFuncSeparate
+#undef glBindBuffer
+#undef glBufferData
+#undef glBufferSubData
+#undef glDeleteBuffers
+#undef glGenBuffers
+#undef glGetBufferParameteriv
+#undef glIsBuffer
+#undef glAttachShader
+#undef glBindAttribLocation
+#undef glBlendEquationSeparate
+#undef glCompileShader
+#undef glCreateProgram
+#undef glCreateShader
+#undef glDeleteProgram
+#undef glDeleteShader
+#undef glDetachShader
+#undef glDisableVertexAttribArray
+#undef glEnableVertexAttribArray
+#undef glGetActiveAttrib
+#undef glGetActiveUniform
+#undef glGetAttachedShaders
+#undef glGetAttribLocation
+#undef glGetProgramInfoLog
+#undef glGetProgramiv
+#undef glGetShaderInfoLog
+#undef glGetShaderSource
+#undef glGetShaderiv
+#undef glGetUniformLocation
+#undef glGetUniformfv
+#undef glGetUniformiv
+#undef glGetVertexAttribPointerv
+#undef glGetVertexAttribfv
+#undef glGetVertexAttribiv
+#undef glIsProgram
+#undef glIsShader
+#undef glLinkProgram
+#undef glShaderSource
+#undef glStencilFuncSeparate
+#undef glStencilMaskSeparate
+#undef glStencilOpSeparate
+#undef glUniform1f
+#undef glUniform1fv
+#undef glUniform1i
+#undef glUniform1iv
+#undef glUniform2f
+#undef glUniform2fv
+#undef glUniform2i
+#undef glUniform2iv
+#undef glUniform3f
+#undef glUniform3fv
+#undef glUniform3i
+#undef glUniform3iv
+#undef glUniform4f
+#undef glUniform4fv
+#undef glUniform4i
+#undef glUniform4iv
+#undef glUniformMatrix2fv
+#undef glUniformMatrix3fv
+#undef glUniformMatrix4fv
+#undef glUseProgram
+#undef glValidateProgram
+#undef glVertexAttrib1f
+#undef glVertexAttrib1fv
+#undef glVertexAttrib2f
+#undef glVertexAttrib2fv
+#undef glVertexAttrib3f
+#undef glVertexAttrib3fv
+#undef glVertexAttrib4f
+#undef glVertexAttrib4fv
+#undef glVertexAttribPointer
+#undef glClearDepthf
+#undef glDepthRangef
+#undef glGetShaderPrecisionFormat
+#undef glReleaseShaderCompiler
+#undef glShaderBinary
+#undef glBindFramebuffer
+#undef glBindRenderbuffer
+#undef glCheckFramebufferStatus
+#undef glDeleteFramebuffers
+#undef glDeleteRenderbuffers
+#undef glFramebufferRenderbuffer
+#undef glFramebufferTexture2D
+#undef glGenFramebuffers
+#undef glGenRenderbuffers
+#undef glGenerateMipmap
+#undef glGetFramebufferAttachmentParameteriv
+#undef glGetRenderbufferParameteriv
+#undef glIsFramebuffer
+#undef glIsRenderbuffer
+#undef glRenderbufferStorage
+
+extern "C"
+{
+ extern void REGAL_CALL glBlendFunc(GLenum sfactor, GLenum dfactor);
+ extern void REGAL_CALL glClear(GLbitfield mask);
+ extern void REGAL_CALL glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+ extern void REGAL_CALL glClearStencil(GLint s);
+ extern void REGAL_CALL glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+ extern void REGAL_CALL glCullFace(GLenum mode);
+ extern void REGAL_CALL glDepthFunc(GLenum func);
+ extern void REGAL_CALL glDepthMask(GLboolean flag);
+ extern void REGAL_CALL glDisable(GLenum cap);
+ extern void REGAL_CALL glEnable(GLenum cap);
+ extern void REGAL_CALL glFinish(void);
+ extern void REGAL_CALL glFlush(void);
+ extern void REGAL_CALL glFrontFace(GLenum mode);
+ extern void REGAL_CALL glGetBooleanv(GLenum pname, GLboolean *params);
+ extern GLenum REGAL_CALL glGetError(void);
+ extern void REGAL_CALL glGetFloatv(GLenum pname, GLfloat *params);
+ extern void REGAL_CALL glGetIntegerv(GLenum pname, GLint *params);
+ extern const GLubyte * REGAL_CALL glGetString(GLenum name);
+ extern void REGAL_CALL glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
+ extern void REGAL_CALL glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
+ extern void REGAL_CALL glHint(GLenum target, GLenum mode);
+ extern GLboolean REGAL_CALL glIsEnabled(GLenum cap);
+ extern void REGAL_CALL glLineWidth(GLfloat width);
+ extern void REGAL_CALL glPixelStorei(GLenum pname, GLint param);
+ extern void REGAL_CALL glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
+ extern void REGAL_CALL glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
+ extern void REGAL_CALL glStencilFunc(GLenum func, GLint ref, GLuint mask);
+ extern void REGAL_CALL glStencilMask(GLuint mask);
+ extern void REGAL_CALL glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
+ extern void REGAL_CALL glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+ extern void REGAL_CALL glTexParameterf(GLenum target, GLenum pname, GLfloat param);
+ extern void REGAL_CALL glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
+ extern void REGAL_CALL glTexParameteri(GLenum target, GLenum pname, GLint param);
+ extern void REGAL_CALL glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
+ extern void REGAL_CALL glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
+ extern void REGAL_CALL glBindTexture(GLenum target, GLuint texture);
+ extern void REGAL_CALL glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+ extern void REGAL_CALL glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+ extern void REGAL_CALL glDeleteTextures(GLsizei n, const GLuint *textures);
+ extern void REGAL_CALL glDrawArrays(GLenum mode, GLint first, GLsizei count);
+ extern void REGAL_CALL glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
+ extern void REGAL_CALL glGenTextures(GLsizei n, GLuint *textures);
+ extern GLboolean REGAL_CALL glIsTexture(GLuint texture);
+ extern void REGAL_CALL glPolygonOffset(GLfloat factor, GLfloat units);
+ extern void REGAL_CALL glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+ extern void REGAL_CALL glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+ extern void REGAL_CALL glBlendEquation(GLenum mode);
+ extern void REGAL_CALL glActiveTexture(GLenum texture);
+ extern void REGAL_CALL glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+ extern void REGAL_CALL glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+ extern void REGAL_CALL glSampleCoverage(GLclampf value, GLboolean invert);
+ extern void REGAL_CALL glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+ extern void REGAL_CALL glBindBuffer(GLenum target, GLuint buffer);
+ extern void REGAL_CALL glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
+ extern void REGAL_CALL glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
+ extern void REGAL_CALL glDeleteBuffers(GLsizei n, const GLuint *buffers);
+ extern void REGAL_CALL glGenBuffers(GLsizei n, GLuint *buffers);
+ extern void REGAL_CALL glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
+ extern GLboolean REGAL_CALL glIsBuffer(GLuint buffer);
+ extern void REGAL_CALL glAttachShader(GLuint program, GLuint shader);
+ extern void REGAL_CALL glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
+ extern void REGAL_CALL glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
+ extern void REGAL_CALL glCompileShader(GLuint shader);
+ extern GLuint REGAL_CALL glCreateProgram(void);
+ extern GLuint REGAL_CALL glCreateShader(GLenum type);
+ extern void REGAL_CALL glDeleteProgram(GLuint program);
+ extern void REGAL_CALL glDeleteShader(GLuint shader);
+ extern void REGAL_CALL glDetachShader(GLuint program, GLuint shader);
+ extern void REGAL_CALL glDisableVertexAttribArray(GLuint index);
+ extern void REGAL_CALL glEnableVertexAttribArray(GLuint index);
+ extern void REGAL_CALL glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+ extern void REGAL_CALL glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+ extern void REGAL_CALL glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+ extern GLint REGAL_CALL glGetAttribLocation(GLuint program, const GLchar *name);
+ extern void REGAL_CALL glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+ extern void REGAL_CALL glGetProgramiv(GLuint program, GLenum pname, GLint *params);
+ extern void REGAL_CALL glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+ extern void REGAL_CALL glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+ extern void REGAL_CALL glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
+ extern GLint REGAL_CALL glGetUniformLocation(GLuint program, const GLchar *name);
+ extern void REGAL_CALL glGetUniformfv(GLuint program, GLint location, GLfloat *params);
+ extern void REGAL_CALL glGetUniformiv(GLuint program, GLint location, GLint *params);
+ extern void REGAL_CALL glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer);
+ extern void REGAL_CALL glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
+ extern void REGAL_CALL glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
+ extern GLboolean REGAL_CALL glIsProgram(GLuint program);
+ extern GLboolean REGAL_CALL glIsShader(GLuint shader);
+ extern void REGAL_CALL glLinkProgram(GLuint program);
+ extern void REGAL_CALL glShaderSource(GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
+ extern void REGAL_CALL glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
+ extern void REGAL_CALL glStencilMaskSeparate(GLenum face, GLuint mask);
+ extern void REGAL_CALL glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+ extern void REGAL_CALL glUniform1f(GLint location, GLfloat v0);
+ extern void REGAL_CALL glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
+ extern void REGAL_CALL glUniform1i(GLint location, GLint v0);
+ extern void REGAL_CALL glUniform1iv(GLint location, GLsizei count, const GLint *value);
+ extern void REGAL_CALL glUniform2f(GLint location, GLfloat v0, GLfloat v1);
+ extern void REGAL_CALL glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
+ extern void REGAL_CALL glUniform2i(GLint location, GLint v0, GLint v1);
+ extern void REGAL_CALL glUniform2iv(GLint location, GLsizei count, const GLint *value);
+ extern void REGAL_CALL glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+ extern void REGAL_CALL glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
+ extern void REGAL_CALL glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
+ extern void REGAL_CALL glUniform3iv(GLint location, GLsizei count, const GLint *value);
+ extern void REGAL_CALL glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+ extern void REGAL_CALL glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
+ extern void REGAL_CALL glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+ extern void REGAL_CALL glUniform4iv(GLint location, GLsizei count, const GLint *value);
+ extern void REGAL_CALL glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ extern void REGAL_CALL glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ extern void REGAL_CALL glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+ extern void REGAL_CALL glUseProgram(GLuint program);
+ extern void REGAL_CALL glValidateProgram(GLuint program);
+ extern void REGAL_CALL glVertexAttrib1f(GLuint index, GLfloat x);
+ extern void REGAL_CALL glVertexAttrib1fv(GLuint index, const GLfloat *v);
+ extern void REGAL_CALL glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
+ extern void REGAL_CALL glVertexAttrib2fv(GLuint index, const GLfloat *v);
+ extern void REGAL_CALL glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
+ extern void REGAL_CALL glVertexAttrib3fv(GLuint index, const GLfloat *v);
+ extern void REGAL_CALL glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+ extern void REGAL_CALL glVertexAttrib4fv(GLuint index, const GLfloat *v);
+ extern void REGAL_CALL glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+ extern void REGAL_CALL glClearDepthf(GLclampf d);
+ extern void REGAL_CALL glDepthRangef(GLclampf n, GLclampf f);
+ extern void REGAL_CALL glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+ extern void REGAL_CALL glReleaseShaderCompiler(void);
+ extern void REGAL_CALL glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
+ extern void REGAL_CALL glBindFramebuffer(GLenum target, GLuint framebuffer);
+ extern void REGAL_CALL glBindRenderbuffer(GLenum target, GLuint renderbuffer);
+ extern GLenum REGAL_CALL glCheckFramebufferStatus(GLenum target);
+ extern void REGAL_CALL glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
+ extern void REGAL_CALL glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
+ extern void REGAL_CALL glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+ extern void REGAL_CALL glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+ extern void REGAL_CALL glGenFramebuffers(GLsizei n, GLuint *framebuffers);
+ extern void REGAL_CALL glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
+ extern void REGAL_CALL glGenerateMipmap(GLenum target);
+ extern void REGAL_CALL glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
+ extern void REGAL_CALL glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
+ extern GLboolean REGAL_CALL glIsFramebuffer(GLuint framebuffer);
+ extern GLboolean REGAL_CALL glIsRenderbuffer(GLuint renderbuffer);
+ extern void REGAL_CALL glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+}
+
REGAL_GLOBAL_END
REGAL_NAMESPACE_BEGIN
@@ -58,148 +352,149 @@ using namespace ::REGAL_NAMESPACE_INTERNAL::Token;
void InitDispatchTableStaticES2(DispatchTable &tbl)
{
// OpenGL ES 2.0 only
- tbl.glBlendFunc = glBlendFunc;
- tbl.glClear = glClear;
- tbl.glClearColor = glClearColor;
- tbl.glClearStencil = glClearStencil;
- tbl.glColorMask = glColorMask;
- tbl.glCullFace = glCullFace;
- tbl.glDepthFunc = glDepthFunc;
- tbl.glDepthMask = glDepthMask;
- tbl.glDisable = glDisable;
- tbl.glEnable = glEnable;
- tbl.glFinish = glFinish;
- tbl.glFlush = glFlush;
- tbl.glFrontFace = glFrontFace;
- tbl.glGetBooleanv = glGetBooleanv;
- tbl.glGetError = glGetError;
- tbl.glGetFloatv = glGetFloatv;
- tbl.glGetIntegerv = glGetIntegerv;
- tbl.glGetString = glGetString;
- tbl.glGetTexParameterfv = glGetTexParameterfv;
- tbl.glGetTexParameteriv = glGetTexParameteriv;
- tbl.glHint = glHint;
- tbl.glIsEnabled = glIsEnabled;
- tbl.glLineWidth = glLineWidth;
- tbl.glPixelStorei = glPixelStorei;
- tbl.glReadPixels = glReadPixels;
- tbl.glScissor = glScissor;
- tbl.glStencilFunc = glStencilFunc;
- tbl.glStencilMask = glStencilMask;
- tbl.glStencilOp = glStencilOp;
- tbl.glTexImage2D = glTexImage2D;
- tbl.glTexParameterf = glTexParameterf;
- tbl.glTexParameterfv = glTexParameterfv;
- tbl.glTexParameteri = glTexParameteri;
- tbl.glTexParameteriv = glTexParameteriv;
- tbl.glViewport = glViewport;
- tbl.glBindTexture = glBindTexture;
- tbl.glCopyTexImage2D = glCopyTexImage2D;
- tbl.glCopyTexSubImage2D = glCopyTexSubImage2D;
- tbl.glDeleteTextures = glDeleteTextures;
- tbl.glDrawArrays = glDrawArrays;
- tbl.glDrawElements = glDrawElements;
- tbl.glGenTextures = glGenTextures;
- tbl.glIsTexture = glIsTexture;
- tbl.glPolygonOffset = glPolygonOffset;
- tbl.glTexSubImage2D = glTexSubImage2D;
- tbl.glBlendColor = glBlendColor;
- tbl.glBlendEquation = glBlendEquation;
- tbl.glActiveTexture = glActiveTexture;
- tbl.glCompressedTexImage2D = glCompressedTexImage2D;
- tbl.glCompressedTexSubImage2D = glCompressedTexSubImage2D;
- tbl.glSampleCoverage = glSampleCoverage;
- tbl.glBlendFuncSeparate = glBlendFuncSeparate;
- tbl.glBindBuffer = glBindBuffer;
- tbl.glBufferData = glBufferData;
- tbl.glBufferSubData = glBufferSubData;
- tbl.glDeleteBuffers = glDeleteBuffers;
- tbl.glGenBuffers = glGenBuffers;
- tbl.glGetBufferParameteriv = glGetBufferParameteriv;
- tbl.glIsBuffer = glIsBuffer;
- tbl.glAttachShader = glAttachShader;
- tbl.glBindAttribLocation = glBindAttribLocation;
- tbl.glBlendEquationSeparate = glBlendEquationSeparate;
- tbl.glCompileShader = glCompileShader;
- tbl.glCreateProgram = glCreateProgram;
- tbl.glCreateShader = glCreateShader;
- tbl.glDeleteProgram = glDeleteProgram;
- tbl.glDeleteShader = glDeleteShader;
- tbl.glDetachShader = glDetachShader;
- tbl.glDisableVertexAttribArray = glDisableVertexAttribArray;
- tbl.glEnableVertexAttribArray = glEnableVertexAttribArray;
- tbl.glGetActiveAttrib = glGetActiveAttrib;
- tbl.glGetActiveUniform = glGetActiveUniform;
- tbl.glGetAttachedShaders = glGetAttachedShaders;
- tbl.glGetAttribLocation = glGetAttribLocation;
- tbl.glGetProgramInfoLog = glGetProgramInfoLog;
- tbl.glGetProgramiv = glGetProgramiv;
- tbl.glGetShaderInfoLog = glGetShaderInfoLog;
- tbl.glGetShaderSource = glGetShaderSource;
- tbl.glGetShaderiv = glGetShaderiv;
- tbl.glGetUniformLocation = glGetUniformLocation;
- tbl.glGetUniformfv = glGetUniformfv;
- tbl.glGetUniformiv = glGetUniformiv;
- tbl.glGetVertexAttribPointerv = glGetVertexAttribPointerv;
- tbl.glGetVertexAttribfv = glGetVertexAttribfv;
- tbl.glGetVertexAttribiv = glGetVertexAttribiv;
- tbl.glIsProgram = glIsProgram;
- tbl.glIsShader = glIsShader;
- tbl.glLinkProgram = glLinkProgram;
- tbl.glShaderSource = glShaderSource;
- tbl.glStencilFuncSeparate = glStencilFuncSeparate;
- tbl.glStencilMaskSeparate = glStencilMaskSeparate;
- tbl.glStencilOpSeparate = glStencilOpSeparate;
- tbl.glUniform1f = glUniform1f;
- tbl.glUniform1fv = glUniform1fv;
- tbl.glUniform1i = glUniform1i;
- tbl.glUniform1iv = glUniform1iv;
- tbl.glUniform2f = glUniform2f;
- tbl.glUniform2fv = glUniform2fv;
- tbl.glUniform2i = glUniform2i;
- tbl.glUniform2iv = glUniform2iv;
- tbl.glUniform3f = glUniform3f;
- tbl.glUniform3fv = glUniform3fv;
- tbl.glUniform3i = glUniform3i;
- tbl.glUniform3iv = glUniform3iv;
- tbl.glUniform4f = glUniform4f;
- tbl.glUniform4fv = glUniform4fv;
- tbl.glUniform4i = glUniform4i;
- tbl.glUniform4iv = glUniform4iv;
- tbl.glUniformMatrix2fv = glUniformMatrix2fv;
- tbl.glUniformMatrix3fv = glUniformMatrix3fv;
- tbl.glUniformMatrix4fv = glUniformMatrix4fv;
- tbl.glUseProgram = glUseProgram;
- tbl.glValidateProgram = glValidateProgram;
- tbl.glVertexAttrib1f = glVertexAttrib1f;
- tbl.glVertexAttrib1fv = glVertexAttrib1fv;
- tbl.glVertexAttrib2f = glVertexAttrib2f;
- tbl.glVertexAttrib2fv = glVertexAttrib2fv;
- tbl.glVertexAttrib3f = glVertexAttrib3f;
- tbl.glVertexAttrib3fv = glVertexAttrib3fv;
- tbl.glVertexAttrib4f = glVertexAttrib4f;
- tbl.glVertexAttrib4fv = glVertexAttrib4fv;
- tbl.glVertexAttribPointer = glVertexAttribPointer;
- tbl.glClearDepthf = glClearDepthf;
- tbl.glDepthRangef = glDepthRangef;
- tbl.glGetShaderPrecisionFormat = glGetShaderPrecisionFormat;
- tbl.glReleaseShaderCompiler = glReleaseShaderCompiler;
- tbl.glShaderBinary = glShaderBinary;
- tbl.glBindFramebuffer = glBindFramebuffer;
- tbl.glBindRenderbuffer = glBindRenderbuffer;
- tbl.glCheckFramebufferStatus = glCheckFramebufferStatus;
- tbl.glDeleteFramebuffers = glDeleteFramebuffers;
- tbl.glDeleteRenderbuffers = glDeleteRenderbuffers;
- tbl.glFramebufferRenderbuffer = glFramebufferRenderbuffer;
- tbl.glFramebufferTexture2D = glFramebufferTexture2D;
- tbl.glGenFramebuffers = glGenFramebuffers;
- tbl.glGenRenderbuffers = glGenRenderbuffers;
- tbl.glGenerateMipmap = glGenerateMipmap;
- tbl.glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv;
- tbl.glGetRenderbufferParameteriv = glGetRenderbufferParameteriv;
- tbl.glIsFramebuffer = glIsFramebuffer;
- tbl.glIsRenderbuffer = glIsRenderbuffer;
- tbl.glRenderbufferStorage = glRenderbufferStorage;
+
+ tbl.rglBlendFunc = glBlendFunc;
+ tbl.rglClear = glClear;
+ tbl.rglClearColor = glClearColor;
+ tbl.rglClearStencil = glClearStencil;
+ tbl.rglColorMask = glColorMask;
+ tbl.rglCullFace = glCullFace;
+ tbl.rglDepthFunc = glDepthFunc;
+ tbl.rglDepthMask = glDepthMask;
+ tbl.rglDisable = glDisable;
+ tbl.rglEnable = glEnable;
+ tbl.rglFinish = glFinish;
+ tbl.rglFlush = glFlush;
+ tbl.rglFrontFace = glFrontFace;
+ tbl.rglGetBooleanv = glGetBooleanv;
+ tbl.rglGetError = glGetError;
+ tbl.rglGetFloatv = glGetFloatv;
+ tbl.rglGetIntegerv = glGetIntegerv;
+ tbl.rglGetString = glGetString;
+ tbl.rglGetTexParameterfv = glGetTexParameterfv;
+ tbl.rglGetTexParameteriv = glGetTexParameteriv;
+ tbl.rglHint = glHint;
+ tbl.rglIsEnabled = glIsEnabled;
+ tbl.rglLineWidth = glLineWidth;
+ tbl.rglPixelStorei = glPixelStorei;
+ tbl.rglReadPixels = glReadPixels;
+ tbl.rglScissor = glScissor;
+ tbl.rglStencilFunc = glStencilFunc;
+ tbl.rglStencilMask = glStencilMask;
+ tbl.rglStencilOp = glStencilOp;
+ tbl.rglTexImage2D = glTexImage2D;
+ tbl.rglTexParameterf = glTexParameterf;
+ tbl.rglTexParameterfv = glTexParameterfv;
+ tbl.rglTexParameteri = glTexParameteri;
+ tbl.rglTexParameteriv = glTexParameteriv;
+ tbl.rglViewport = glViewport;
+ tbl.rglBindTexture = glBindTexture;
+ tbl.rglCopyTexImage2D = glCopyTexImage2D;
+ tbl.rglCopyTexSubImage2D = glCopyTexSubImage2D;
+ tbl.rglDeleteTextures = glDeleteTextures;
+ tbl.rglDrawArrays = glDrawArrays;
+ tbl.rglDrawElements = glDrawElements;
+ tbl.rglGenTextures = glGenTextures;
+ tbl.rglIsTexture = glIsTexture;
+ tbl.rglPolygonOffset = glPolygonOffset;
+ tbl.rglTexSubImage2D = glTexSubImage2D;
+ tbl.rglBlendColor = glBlendColor;
+ tbl.rglBlendEquation = glBlendEquation;
+ tbl.rglActiveTexture = glActiveTexture;
+ tbl.rglCompressedTexImage2D = glCompressedTexImage2D;
+ tbl.rglCompressedTexSubImage2D = glCompressedTexSubImage2D;
+ tbl.rglSampleCoverage = glSampleCoverage;
+ tbl.rglBlendFuncSeparate = glBlendFuncSeparate;
+ tbl.rglBindBuffer = glBindBuffer;
+ tbl.rglBufferData = glBufferData;
+ tbl.rglBufferSubData = glBufferSubData;
+ tbl.rglDeleteBuffers = glDeleteBuffers;
+ tbl.rglGenBuffers = glGenBuffers;
+ tbl.rglGetBufferParameteriv = glGetBufferParameteriv;
+ tbl.rglIsBuffer = glIsBuffer;
+ tbl.rglAttachShader = glAttachShader;
+ tbl.rglBindAttribLocation = glBindAttribLocation;
+ tbl.rglBlendEquationSeparate = glBlendEquationSeparate;
+ tbl.rglCompileShader = glCompileShader;
+ tbl.rglCreateProgram = glCreateProgram;
+ tbl.rglCreateShader = glCreateShader;
+ tbl.rglDeleteProgram = glDeleteProgram;
+ tbl.rglDeleteShader = glDeleteShader;
+ tbl.rglDetachShader = glDetachShader;
+ tbl.rglDisableVertexAttribArray = glDisableVertexAttribArray;
+ tbl.rglEnableVertexAttribArray = glEnableVertexAttribArray;
+ tbl.rglGetActiveAttrib = glGetActiveAttrib;
+ tbl.rglGetActiveUniform = glGetActiveUniform;
+ tbl.rglGetAttachedShaders = glGetAttachedShaders;
+ tbl.rglGetAttribLocation = glGetAttribLocation;
+ tbl.rglGetProgramInfoLog = glGetProgramInfoLog;
+ tbl.rglGetProgramiv = glGetProgramiv;
+ tbl.rglGetShaderInfoLog = glGetShaderInfoLog;
+ tbl.rglGetShaderSource = glGetShaderSource;
+ tbl.rglGetShaderiv = glGetShaderiv;
+ tbl.rglGetUniformLocation = glGetUniformLocation;
+ tbl.rglGetUniformfv = glGetUniformfv;
+ tbl.rglGetUniformiv = glGetUniformiv;
+ tbl.rglGetVertexAttribPointerv = glGetVertexAttribPointerv;
+ tbl.rglGetVertexAttribfv = glGetVertexAttribfv;
+ tbl.rglGetVertexAttribiv = glGetVertexAttribiv;
+ tbl.rglIsProgram = glIsProgram;
+ tbl.rglIsShader = glIsShader;
+ tbl.rglLinkProgram = glLinkProgram;
+ tbl.rglShaderSource = glShaderSource;
+ tbl.rglStencilFuncSeparate = glStencilFuncSeparate;
+ tbl.rglStencilMaskSeparate = glStencilMaskSeparate;
+ tbl.rglStencilOpSeparate = glStencilOpSeparate;
+ tbl.rglUniform1f = glUniform1f;
+ tbl.rglUniform1fv = glUniform1fv;
+ tbl.rglUniform1i = glUniform1i;
+ tbl.rglUniform1iv = glUniform1iv;
+ tbl.rglUniform2f = glUniform2f;
+ tbl.rglUniform2fv = glUniform2fv;
+ tbl.rglUniform2i = glUniform2i;
+ tbl.rglUniform2iv = glUniform2iv;
+ tbl.rglUniform3f = glUniform3f;
+ tbl.rglUniform3fv = glUniform3fv;
+ tbl.rglUniform3i = glUniform3i;
+ tbl.rglUniform3iv = glUniform3iv;
+ tbl.rglUniform4f = glUniform4f;
+ tbl.rglUniform4fv = glUniform4fv;
+ tbl.rglUniform4i = glUniform4i;
+ tbl.rglUniform4iv = glUniform4iv;
+ tbl.rglUniformMatrix2fv = glUniformMatrix2fv;
+ tbl.rglUniformMatrix3fv = glUniformMatrix3fv;
+ tbl.rglUniformMatrix4fv = glUniformMatrix4fv;
+ tbl.rglUseProgram = glUseProgram;
+ tbl.rglValidateProgram = glValidateProgram;
+ tbl.rglVertexAttrib1f = glVertexAttrib1f;
+ tbl.rglVertexAttrib1fv = glVertexAttrib1fv;
+ tbl.rglVertexAttrib2f = glVertexAttrib2f;
+ tbl.rglVertexAttrib2fv = glVertexAttrib2fv;
+ tbl.rglVertexAttrib3f = glVertexAttrib3f;
+ tbl.rglVertexAttrib3fv = glVertexAttrib3fv;
+ tbl.rglVertexAttrib4f = glVertexAttrib4f;
+ tbl.rglVertexAttrib4fv = glVertexAttrib4fv;
+ tbl.rglVertexAttribPointer = glVertexAttribPointer;
+ tbl.rglClearDepthf = glClearDepthf;
+ tbl.rglDepthRangef = glDepthRangef;
+ tbl.rglGetShaderPrecisionFormat = glGetShaderPrecisionFormat;
+ tbl.rglReleaseShaderCompiler = glReleaseShaderCompiler;
+ tbl.rglShaderBinary = glShaderBinary;
+ tbl.rglBindFramebuffer = glBindFramebuffer;
+ tbl.rglBindRenderbuffer = glBindRenderbuffer;
+ tbl.rglCheckFramebufferStatus = glCheckFramebufferStatus;
+ tbl.rglDeleteFramebuffers = glDeleteFramebuffers;
+ tbl.rglDeleteRenderbuffers = glDeleteRenderbuffers;
+ tbl.rglFramebufferRenderbuffer = glFramebufferRenderbuffer;
+ tbl.rglFramebufferTexture2D = glFramebufferTexture2D;
+ tbl.rglGenFramebuffers = glGenFramebuffers;
+ tbl.rglGenRenderbuffers = glGenRenderbuffers;
+ tbl.rglGenerateMipmap = glGenerateMipmap;
+ tbl.rglGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv;
+ tbl.rglGetRenderbufferParameteriv = glGetRenderbufferParameteriv;
+ tbl.rglIsFramebuffer = glIsFramebuffer;
+ tbl.rglIsRenderbuffer = glIsRenderbuffer;
+ tbl.rglRenderbufferStorage = glRenderbufferStorage;
}
View
42 src/regal/RegalDispatcher.cpp
@@ -41,13 +41,14 @@ REGAL_GLOBAL_END
REGAL_NAMESPACE_BEGIN
-void InitDispatchTableDebug (DispatchTable &tbl);
-void InitDispatchTableError (DispatchTable &tbl);
-void InitDispatchTableEmu (DispatchTable &tbl);
-void InitDispatchTableLoader (DispatchTable &tbl);
-void InitDispatchTableLog (DispatchTable &tbl);
-void InitDispatchTableNacl (DispatchTable &tbl);
-void InitDispatchTableMissing(DispatchTable &tbl);
+void InitDispatchTableDebug (DispatchTable &tbl);
+void InitDispatchTableError (DispatchTable &tbl);
+void InitDispatchTableEmu (DispatchTable &tbl);
+void InitDispatchTableLog (DispatchTable &tbl);
+void InitDispatchTableLoader (DispatchTable &tbl);
+void InitDispatchTableNacl (DispatchTable &tbl);
+void InitDispatchTableStaticES2(DispatchTable &tbl);
+void InitDispatchTableMissing (DispatchTable &tbl);
Dispatcher::Dispatcher()
: current(0)
@@ -62,28 +63,29 @@ Dispatcher::Dispatcher()
push_back(error,Config::enableError);
#endif
-#if 0
- #if REGAL_LOG
- InitDispatchTableLog(emulation);
- #endif
-#endif
-
+ #if REGAL_EMULATION
::memset(&emulation,0,sizeof(DispatchTable));
- InitDispatchTableEmu(emulation); // overrides emulated functions only
- push_back(emulation,true);
+ InitDispatchTableEmu(emulation); // emulated functions only
+ push_back(emulation,Config::enableEmulation);
+ #endif
#if REGAL_LOG
InitDispatchTableLog(logging);
push_back(logging,Config::enableLog);
#endif
- #if defined(__native_client__)
- ::memset(&emulation,0,sizeof(DispatchTable));
- InitDispatchTableNacl (driver);
+ #if REGAL_DRIVER
+ #if REGAL_STATIC_ES2
+ ::memset(&driver,0,sizeof(DispatchTable));
+ InitDispatchTableStaticES2(driver); // ES 2.0 functions only
+ #elif defined(__native_client__)
+ ::memset(&driver,0,sizeof(DispatchTable));
+ InitDispatchTableNacl(driver); // ES 2.0 functions only
#else
- InitDispatchTableLoader (driver);
+ InitDispatchTableLoader(driver); // Desktop/ES2.0 lazy loader
+ #endif
+ push_back(driver,Config::enableDriver);
#endif
- push_back(driver,true);
InitDispatchTableMissing(missing);
push_back(missing,true);
View
4 src/regal/RegalEmu.h
@@ -39,6 +39,8 @@
#include "RegalUtil.h"
+#if REGAL_EMULATION
+
REGAL_GLOBAL_BEGIN
#include <assert.h>
@@ -132,6 +134,8 @@ struct RegalEmuScopedActivate {
REGAL_NAMESPACE_END
+#endif // REGAL_EMULATION
+
#endif // ! __REGAL_EMU_H__
View
2 src/regal/RegalEnum.h
@@ -4089,9 +4089,9 @@ enum Enum {
RGL_VERTEX_CONSISTENT_HINT_PGI = GL_VERTEX_CONSISTENT_HINT_PGI,
RGL_VERTEX_DATA_HINT_PGI = GL_VERTEX_DATA_HINT_PGI,
RGL_DEBUG_REGAL = GL_DEBUG_REGAL,
+ RGL_DRIVER_REGAL = GL_DRIVER_REGAL,
RGL_EMULATION_REGAL = GL_EMULATION_REGAL,
RGL_ERROR_REGAL = GL_ERROR_REGAL,
- RGL_LOADER_REGAL = GL_LOADER_REGAL,
RGL_LOG_REGAL = GL_LOG_REGAL,
RGL_LOG_APP_REGAL = GL_LOG_APP_REGAL,
RGL_LOG_DEBUG_REGAL = GL_LOG_DEBUG_REGAL,
View
2 src/regal/RegalHttp.cpp
@@ -186,13 +186,15 @@ namespace Http
body += br;
}
+#if REGAL_EMULATION
if (ctx->ppa)
{
body += print_string("<b>GL_STENCIL_BIT</b><br/>",ctx->ppa->State::Stencil::toString(br),br);
body += print_string("<b>GL_DEPTH_BIT</b><br/>", ctx->ppa->State::Depth::toString(br),br);
body += print_string("<b>GL_POLYGON_BIT</b><br/>",ctx->ppa->State::Polygon::toString(br),br);
body += br;
}
+#endif
}
}
}
View
4 src/regal/RegalIff.cpp
@@ -31,6 +31,8 @@
#include "RegalUtil.h"
+#if REGAL_EMULATION
+
REGAL_GLOBAL_BEGIN
#include <string>
@@ -2019,3 +2021,5 @@ void RFF::LinkProgram( RegalContext *ctx, GLuint program ) {
}
REGAL_NAMESPACE_END
+
+#endif // REGAL_EMULATION
View
11 src/regal/RegalIff.h
@@ -39,6 +39,11 @@
#include "RegalUtil.h"
+#define REGAL_MAX_VERTEX_ATTRIBS 16
+#define REGAL_IMMEDIATE_BUFFER_SIZE 8192
+
+#if REGAL_EMULATION
+
REGAL_GLOBAL_BEGIN
#include <climits>
@@ -58,9 +63,6 @@ REGAL_GLOBAL_END
REGAL_NAMESPACE_BEGIN
-#define REGAL_MAX_VERTEX_ATTRIBS 16
-#define REGAL_IMMEDIATE_BUFFER_SIZE 8192
-
const GLenum texenvModeGL[] = {
GL_FALSE,
GL_REPLACE,
@@ -71,7 +73,6 @@ const GLenum texenvModeGL[] = {
GL_COMBINE
};
-
#define REGAL_FIXED_FUNCTION_MAX_TEXTURE_UNITS 16
#define REGAL_FIXED_FUNCTION_NUM_TEXTURE_TARGETS 5
#define REGAL_FIXED_FUNCTION_MATRIX_STACK_DEPTH 128
@@ -2099,4 +2100,6 @@ inline bool operator < ( const RegalIff::State & lhs, const RegalIff::State & rh
REGAL_NAMESPACE_END
+#endif // REGAL_EMULATION
+
#endif // __REGAL_FIXED_FUNCTION_H__
View
12 src/regal/RegalInit.cpp
@@ -61,6 +61,12 @@ using Token::toString;
static Init *init = NULL;
+DispatchTableGlobal dispatchTableGlobal;
+
+#if REGAL_SYS_ANDROID && REGAL_STATIC_EGL
+extern void InitDispatchTableStaticEGL(DispatchTableGlobal &tbl);
+#endif
+
#if !defined(REGAL_NAMESPACE) && REGAL_SYS_WGL
// Phony advapi32.dll, gdi32.dll and user32.dll dependencies for
// closely matching opengl32.dll
@@ -84,6 +90,10 @@ Init::Init()
return;
#endif
+#if REGAL_SYS_ANDROID && REGAL_STATIC_EGL
+ InitDispatchTableStaticEGL(dispatchTableGlobal);
+#endif
+
Logging::Init();
Config::Init();
Http::Init();
@@ -100,8 +110,6 @@ Init::~Init()
extern "C" { DWORD __stdcall GetCurrentThreadId(void); }
#endif
-DispatchTableGlobal dispatchTableGlobal;
-
// Single-threaded RegalContext
RegalContext *currentContext = NULL;
View
4 src/regal/RegalPpa.h
@@ -39,6 +39,8 @@
#include "RegalUtil.h"
+#if REGAL_EMULATION
+
REGAL_GLOBAL_BEGIN
#include <vector>
@@ -203,4 +205,6 @@ struct RegalPpa : public RegalEmu, State::Stencil, State::Depth, State::Polygon
REGAL_NAMESPACE_END
+#endif // REGAL_EMULATION
+
#endif // ! __REGAL_PPA_H__
View
2 src/regal/RegalToken.cpp
@@ -3058,7 +3058,7 @@ namespace Token {
case 0x00009323: return "GL_DEBUG_REGAL";
case 0x00009324: return "GL_LOG_REGAL";
case 0x00009325: return "GL_EMULATION_REGAL";
- case 0x00009326: return "GL_LOADER_REGAL";
+ case 0x00009326: return "GL_DRIVER_REGAL";
case 0x00009380: return "GL_NUM_SAMPLE_COUNTS";
case 0x000093b0: return "GL_COMPRESSED_RGBA_ASTC_4x4_KHR";
case 0x000093b1: return "GL_COMPRESSED_RGBA_ASTC_5x4_KHR";
View
10 src/regal/RegalUtil.h
@@ -170,6 +170,16 @@ are permitted provided that the following conditions are met:
#define REGAL_EMU_VAO 1
#endif
+//
+
+#ifndef REGAL_STATIC_ES2
+#define REGAL_STATIC_ES2 0
+#endif
+
+#ifndef REGAL_STATIC_EGL
+#define REGAL_STATIC_EGL 0
+#endif
+
// AssertFunction depends on Error log, but
// ideally we wouldn't depend on RegalLog.h here

0 comments on commit 1bd8eae

Please sign in to comment.