Skip to content

Commit bdca425

Browse files
committed
[wasm64] Run glbook tests under browser64. NFC
Split out from emscripten-core#20516
1 parent 1375c03 commit bdca425

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,8 @@ jobs:
795795
browser64.test_idbstore*
796796
browser64.test_fs_idbfs*
797797
browser64.test_webgl*
798+
browser64.test_glbook
799+
browser64.test_gles2_emulation*
798800
"
799801
test-browser-firefox:
800802
executor: bionic

test/test_browser.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,19 +1839,19 @@ def test_glbook(self):
18391839
'Chapter_13/ParticleSystem/CH13_ParticleSystem.o',
18401840
], configure=None)
18411841

1842-
def book_path(*pathelems):
1843-
return test_file('third_party/glbook', *pathelems)
1842+
def book_path(path):
1843+
return test_file('third_party/glbook', path)
18441844

18451845
for program in programs:
18461846
print(program)
18471847
basename = os.path.basename(program)
18481848
args = ['-lGL', '-lEGL', '-lX11']
18491849
if basename == 'CH10_MultiTexture.o':
1850-
shutil.copyfile(book_path('Chapter_10', 'MultiTexture', 'basemap.tga'), 'basemap.tga')
1851-
shutil.copyfile(book_path('Chapter_10', 'MultiTexture', 'lightmap.tga'), 'lightmap.tga')
1850+
shutil.copyfile(book_path('Chapter_10/MultiTexture/basemap.tga'), 'basemap.tga')
1851+
shutil.copyfile(book_path('Chapter_10/MultiTexture/lightmap.tga'), 'lightmap.tga')
18521852
args += ['--preload-file', 'basemap.tga', '--preload-file', 'lightmap.tga']
18531853
elif basename == 'CH13_ParticleSystem.o':
1854-
shutil.copyfile(book_path('Chapter_13', 'ParticleSystem', 'smoke.tga'), 'smoke.tga')
1854+
shutil.copyfile(book_path('Chapter_13/ParticleSystem/smoke.tga'), 'smoke.tga')
18551855
args += ['--preload-file', 'smoke.tga', '-O2'] # test optimizations and closure here as well for more coverage
18561856

18571857
self.btest(program,
@@ -1865,23 +1865,22 @@ def book_path(*pathelems):
18651865
'full_es3': (['-sFULL_ES3'],)
18661866
})
18671867
def test_gles2_emulation(self, args):
1868-
print(args)
18691868
shutil.copyfile(test_file('third_party/glbook/Chapter_10/MultiTexture/basemap.tga'), 'basemap.tga')
18701869
shutil.copyfile(test_file('third_party/glbook/Chapter_10/MultiTexture/lightmap.tga'), 'lightmap.tga')
18711870
shutil.copyfile(test_file('third_party/glbook/Chapter_13/ParticleSystem/smoke.tga'), 'smoke.tga')
18721871

18731872
for source, reference in [
1874-
(Path('third_party/glbook/Chapter_2', 'Hello_Triangle', 'Hello_Triangle_orig.c'), test_file('third_party/glbook/CH02_HelloTriangle.png')),
1875-
# (Path('third_party/glbook/Chapter_8', 'Simple_VertexShader', 'Simple_VertexShader_orig.c'), test_file('third_party/glbook/CH08_SimpleVertexShader.png')), # XXX needs INT extension in WebGL
1876-
(Path('third_party/glbook/Chapter_9', 'TextureWrap', 'TextureWrap_orig.c'), test_file('third_party/glbook/CH09_TextureWrap.png')),
1877-
# (Path('third_party/glbook/Chapter_9', 'Simple_TextureCubemap', 'Simple_TextureCubemap_orig.c'), test_file('third_party/glbook/CH09_TextureCubemap.png')), # XXX needs INT extension in WebGL
1878-
(Path('third_party/glbook/Chapter_9', 'Simple_Texture2D', 'Simple_Texture2D_orig.c'), test_file('third_party/glbook/CH09_SimpleTexture2D.png')),
1879-
(Path('third_party/glbook/Chapter_10', 'MultiTexture', 'MultiTexture_orig.c'), test_file('third_party/glbook/CH10_MultiTexture.png')),
1880-
(Path('third_party/glbook/Chapter_13', 'ParticleSystem', 'ParticleSystem_orig.c'), test_file('third_party/glbook/CH13_ParticleSystem.png')),
1873+
('third_party/glbook/Chapter_2/Hello_Triangle/Hello_Triangle_orig.c', 'third_party/glbook/CH02_HelloTriangle.png'),
1874+
# ('third_party/glbook/Chapter_8/Simple_VertexShader/Simple_VertexShader_orig.c', 'third_party/glbook/CH08_SimpleVertexShader.png'), # XXX needs INT extension in WebGL
1875+
('third_party/glbook/Chapter_9/TextureWrap/TextureWrap_orig.c', 'third_party/glbook/CH09_TextureWrap.png'),
1876+
# ('third_party/glbook/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap_orig.c', 'third_party/glbook/CH09_TextureCubemap.png'), # XXX needs INT extension in WebGL
1877+
('third_party/glbook/Chapter_9/Simple_Texture2D/Simple_Texture2D_orig.c', 'third_party/glbook/CH09_SimpleTexture2D.png'),
1878+
('third_party/glbook/Chapter_10/MultiTexture/MultiTexture_orig.c', 'third_party/glbook/CH10_MultiTexture.png'),
1879+
('third_party/glbook/Chapter_13/ParticleSystem/ParticleSystem_orig.c', 'third_party/glbook/CH13_ParticleSystem.png'),
18811880
]:
18821881
print(source)
18831882
self.btest(source,
1884-
reference=reference,
1883+
reference=test_file(reference),
18851884
args=['-I' + test_file('third_party/glbook/Common'),
18861885
test_file('third_party/glbook/Common/esUtil.c'),
18871886
test_file('third_party/glbook/Common/esShader.c'),

test/third_party/glbook/Common/esUtil.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ EGLBoolean CreateEGLContext ( EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
5353
EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };
5454

5555
// Get Display
56+
#if __EMSCRIPTEN__
57+
display = eglGetDisplay((EGLNativeDisplayType)0);
58+
#else
5659
display = eglGetDisplay((EGLNativeDisplayType)x_display);
60+
#endif
5761
if ( display == EGL_NO_DISPLAY )
5862
{
5963
return EGL_FALSE;

0 commit comments

Comments
 (0)