Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regal port update #9947

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9707c42
Merge pull request #1 from emscripten-core/incoming
gabrielcuvillier Jul 26, 2019
564aad8
Merge pull request #2 from emscripten-core/incoming
gabrielcuvillier Jul 27, 2019
091767b
Merge pull request #3 from emscripten-core/incoming
gabrielcuvillier Sep 26, 2019
d9df69e
Merge branch 'incoming' of https://github.com/emscripten-core/emscrip…
Oct 6, 2019
15c39a8
Merge pull request #4 from emscripten-core/incoming
gabrielcuvillier Dec 3, 2019
31479ba
Updated Regal port:
gabrielcuvillier Dec 3, 2019
8059957
don't clear library as we don't know what are the compilation settings
gabrielcuvillier Dec 3, 2019
6db5f31
Regal port: implemented clear() method + updates to embuilder.py to t…
gabrielcuvillier Dec 4, 2019
a7cc8da
fixed flake8 issues
gabrielcuvillier Dec 4, 2019
c0542c0
bugfix
gabrielcuvillier Dec 4, 2019
54f5f44
added get_lib_name (refactor)
gabrielcuvillier Dec 4, 2019
34812cc
flake8 fix
gabrielcuvillier Dec 4, 2019
d0e7de0
syntax error fix
gabrielcuvillier Dec 4, 2019
2c7feb2
Added more tests coverage for various targets: 'regal', 'regal-noexce…
gabrielcuvillier Dec 4, 2019
7fcbdef
Added more tests coverage for various targets: 'regal', 'regal-noexce…
gabrielcuvillier Dec 4, 2019
12c5264
fighting with flake8
gabrielcuvillier Dec 4, 2019
2596615
removed duplicate test
gabrielcuvillier Dec 4, 2019
89f69c5
fighting with flake8
gabrielcuvillier Dec 4, 2019
1046275
Changing regal+mt test cases to not use preloaded plugins
gabrielcuvillier Dec 9, 2019
96c7807
Restored mistakenly deleted test
gabrielcuvillier Dec 9, 2019
c738725
Merge branch 'incoming' of https://github.com/gabrielcuvillier/emscri…
gabrielcuvillier Dec 9, 2019
e132c3d
Merge pull request #5 from emscripten-core/incoming
gabrielcuvillier Dec 9, 2019
6a137dc
Merge branch 'incoming' of https://github.com/gabrielcuvillier/emscri…
gabrielcuvillier Dec 9, 2019
f9ec407
Merge branch 'incoming' into gab_regal_port_update
gabrielcuvillier Dec 9, 2019
16e0f01
Merge remote-tracking branch 'remotes/upstream/incoming' into gab_reg…
gabrielcuvillier Dec 11, 2019
e597a61
Merge remote-tracking branch 'upstream/incoming' into gab_regal_port_…
gabrielcuvillier Dec 13, 2019
0a76281
Regal is now always 'noexpect'
gabrielcuvillier Dec 17, 2019
5005392
Merge remote-tracking branch 'upstream/incoming' into gab_regal_port_…
gabrielcuvillier Dec 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions embuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
'libpng',
'ogg',
'regal',
'regal-mt',
'sdl2',
'sdl2-mt',
'sdl2-gfx',
Expand Down Expand Up @@ -240,6 +241,8 @@ def main():
build_port('cocos2d', libname('libcocos2d'), ['-s', 'USE_COCOS2D=3', '-s', 'USE_ZLIB=1', '-s', 'USE_LIBPNG=1', '-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0'])
elif what == 'regal':
build_port('regal', libname('libregal'), ['-s', 'USE_REGAL=1'])
elif what == 'regal-mt':
build_port('regal', libname('libregal'), ['-s', 'USE_REGAL=1', '-s', 'USE_PTHREADS=1', '-pthread'])
elif what == 'boost_headers':
build_port('boost_headers', libname('libboost_headers'), ['-s', 'USE_BOOST_HEADERS=1'])
elif what == 'libsockets':
Expand Down
5 changes: 5 additions & 0 deletions tests/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1985,6 +1985,11 @@ def test_cubegeom(self):
def test_cubegeom_regal(self):
self.btest('cubegeom.c', reference='cubegeom.png', args=['-O2', '-g', '-DUSE_REGAL', '-s', 'USE_REGAL=1', '-lGL', '-lSDL'], also_proxied=True)

@requires_threads
@requires_graphics_hardware
def test_cubegeom_regal_mt(self):
self.btest('cubegeom.c', reference='cubegeom.png', args=['-O2', '-g', '-pthread', '-DUSE_REGAL', '-s', 'USE_PTHREADS=1', '-s', 'USE_REGAL=1', '-lGL', '-lSDL'], also_proxied=False)

@requires_graphics_hardware
def test_cubegeom_proc(self):
create_test_file('side.c', r'''
Expand Down
74 changes: 31 additions & 43 deletions tools/ports/regal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
import os
import shutil

TAG = 'version_4'
HASH = 'db702ee677d6ee276663922560012fe8d28c5f414ba50a628320432212bdcb606c34bc71f7a533416f43bd0226ceb819f79af822f11518d53552a071a27fc841'
TAG = 'version_7'
HASH = 'a921dab254f21cf5d397581c5efe58faf147c31527228b4fb34aed75164c736af4b3347092a8d9ec1249160230fa163309a87a20c2b9ceef8554566cc215de9d'


def get_lib_name(ports, settings):
return ports.get_lib_name('libregal' + ('-mt' if settings.USE_PTHREADS else ''))


def get(ports, settings, shared):
Expand All @@ -17,38 +21,27 @@ def get(ports, settings, shared):

ports.fetch_project('regal', 'https://github.com/emscripten-ports/regal/archive/' + TAG + '.zip',
'regal-' + TAG, sha512hash=HASH)
libname = ports.get_lib_name('libregal')

def create():
logging.info('building port: regal')
ports.clear_project_build('regal')

# copy sources
# only what is needed is copied: regal, md5, jsonsl, boost, lookup3,
# Note: GLSL Optimizer is included (needed for headers) but not built
# only what is needed is copied: regal, boost, lookup3
source_path_src = os.path.join(ports.get_dir(), 'regal', 'regal-' + TAG, 'src')
dest_path_src = os.path.join(ports.get_build_dir(), 'regal', 'src')

source_path_regal = os.path.join(source_path_src, 'regal')
source_path_md5 = os.path.join(source_path_src, 'md5')
source_path_jsonsl = os.path.join(source_path_src, 'jsonsl')
source_path_boost = os.path.join(source_path_src, 'boost')
source_path_lookup3 = os.path.join(source_path_src, 'lookup3')
source_path_glslopt = os.path.join(source_path_src, 'glsl')
dest_path_regal = os.path.join(dest_path_src, 'regal')
dest_path_md5 = os.path.join(dest_path_src, 'md5')
dest_path_jsonsl = os.path.join(dest_path_src, 'jsonsl')
dest_path_boost = os.path.join(dest_path_src, 'boost')
dest_path_lookup3 = os.path.join(dest_path_src, 'lookup3')
dest_path_glslopt = os.path.join(dest_path_src, 'glsl')

shutil.rmtree(dest_path_src, ignore_errors=True)
shutil.copytree(source_path_regal, dest_path_regal)
shutil.copytree(source_path_md5, dest_path_md5)
shutil.copytree(source_path_jsonsl, dest_path_jsonsl)
shutil.copytree(source_path_boost, dest_path_boost)
shutil.copytree(source_path_lookup3, dest_path_lookup3)
shutil.copytree(source_path_glslopt, dest_path_glslopt)

# includes
source_path_include = os.path.join(ports.get_dir(), 'regal', 'regal-' + TAG, 'include', 'GL')
Expand Down Expand Up @@ -108,9 +101,7 @@ def create():
'regal/RegalFilt.cpp',
'regal/RegalXfer.cpp',
'regal/RegalX11.cpp',
'regal/RegalDllMain.cpp',
'md5/src/md5.c',
'jsonsl/jsonsl.c']
'regal/RegalDllMain.cpp']

commands = []
o_s = []
Expand All @@ -119,41 +110,38 @@ def create():
c = os.path.join(dest_path_src, src)
o = os.path.join(dest_path_src, src + '.o')
shared.safe_ensure_dirs(os.path.dirname(o))
commands.append([shared.PYTHON, shared.EMCC, '-c', c,
# specify the defined symbols as the Regal Makefiles does for Emscripten+Release
# the define logic for other symbols will be handled automatically by Regal headers (SYS_EMSCRIPTEN, SYS_EGL, SYS_ES2, etc.)
'-DNDEBUG',
'-DREGAL_NO_PNG=1',
'-DREGAL_LOG=0',
'-DREGAL_NO_TLS=1',
'-DREGAL_THREAD_LOCKING=0',
'-DREGAL_GLSL_OPTIMIZER=0',
'-fomit-frame-pointer',
'-Wno-constant-logical-operand',
'-fvisibility=hidden',
'-O2',
'-o', o,
'-I' + dest_path_regal,
'-I' + os.path.join(dest_path_md5, 'include'),
'-I' + dest_path_lookup3,
'-I' + dest_path_jsonsl,
'-I' + dest_path_boost,
'-I' + os.path.join(dest_path_glslopt, 'include'),
'-I' + os.path.join(dest_path_glslopt, 'src', 'glsl'),
'-I' + os.path.join(dest_path_glslopt, 'src', 'mesa'),
'-w'])

command = [shared.PYTHON, shared.EMCC, '-c', c,
'-DNDEBUG',
'-DREGAL_LOG=0', # Set to 1 if you need to have some logging info
'-DREGAL_MISSING=0', # Set to 1 if you don't want to crash in case of missing GL implementation
'-fno-rtti',
'-fno-exceptions', # Disable exceptions (in STL containers mostly), as they are not used at all
'-O3',
'-o', o,
'-I' + dest_path_regal,
'-I' + dest_path_lookup3,
'-I' + dest_path_boost,
'-Wall',
'-Wno-unused-parameter']
if settings.USE_PTHREADS:
command += ['-pthread']
if settings.WASM_OBJECT_FILES != 1:
command += ['-flto']
commands.append(command)

o_s.append(o)

ports.run_commands(commands)
final = os.path.join(ports.get_build_dir(), 'regal', libname)
final = os.path.join(ports.get_build_dir(), 'regal', get_lib_name(ports, settings))
ports.create_lib(final, o_s)
return final

return [shared.Cache.get(libname, create, what='port')]
return [shared.Cache.get(get_lib_name(ports, settings), create, what='port')]


def clear(ports, shared):
shared.Cache.erase_file(ports.get_lib_name('libregal'))
shared.Cache.erase_file(get_lib_name(ports, shared.Settings))


def process_dependencies(settings):
Expand Down