Skip to content

Commit d7aa36b

Browse files
committed
Merge branch 'main' into update_libcxx_libcxxabi_19
2 parents b132cff + 58889f9 commit d7aa36b

File tree

4 files changed

+49
-21
lines changed

4 files changed

+49
-21
lines changed

test/browser/webgl_offscreen_framebuffer_swap_with_bad_state.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ int main() {
2828
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context("#canvas", &attr);
2929
emscripten_webgl_make_context_current(ctx);
3030

31-
#if !TEST_WEBGL2 && TEST_VAO
31+
#if !TEST_WEBGL2 && TEST_VERIFY_WEBGL1_VAO_SUPPORT
3232
// This test cannot run without browser support for OES_vertex_array_object.
33+
// This check is just to verify that the browser has support; otherwise, we
34+
// will end up testing the non-VAO path. Enabling it here does not actually do
35+
// anything, because offscreen framebuffer has already been initialized. Note
36+
// that if GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=0, then offscreen
37+
// framebuffer will _never_ use VAOs on WebGL 1 (unless something enables
38+
// OES_vertex_array_object before createOffscreenFramebuffer runs).
3339
if (!emscripten_webgl_enable_extension(ctx, "OES_vertex_array_object")) {
3440
return 1;
3541
}

test/test_browser.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4322,22 +4322,22 @@ def test_webgl_vao_without_automatic_extensions(self):
43224322

43234323
# Tests that offscreen framebuffer state restoration works
43244324
@requires_graphics_hardware
4325-
def test_webgl_offscreen_framebuffer_state_restoration(self):
4326-
for args in [
4327-
# full state restoration path on WebGL 1.0
4328-
['-sMAX_WEBGL_VERSION', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],
4329-
# VAO path on WebGL 1.0
4330-
['-sMAX_WEBGL_VERSION'],
4331-
['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=0'],
4332-
# VAO path on WebGL 2.0
4333-
['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-DTEST_REQUIRE_VAO=1'],
4334-
# full state restoration path on WebGL 2.0
4335-
['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],
4336-
# blitFramebuffer path on WebGL 2.0 (falls back to VAO on Firefox < 67)
4337-
['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=0'],
4338-
]:
4339-
cmd = args + ['-lGL', '-sOFFSCREEN_FRAMEBUFFER', '-DEXPLICIT_SWAP=1']
4340-
self.btest_exit('webgl_offscreen_framebuffer_swap_with_bad_state.c', args=cmd)
4325+
@parameterized({
4326+
# full state restoration path on WebGL 1.0
4327+
'gl1_no_vao': (['-sMAX_WEBGL_VERSION=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],),
4328+
# VAO path on WebGL 1.0
4329+
'gl1': (['-sMAX_WEBGL_VERSION=1', '-DTEST_VERIFY_WEBGL1_VAO_SUPPORT=1'],),
4330+
'gl1_max_gl2': (['-sMAX_WEBGL_VERSION=2'],),
4331+
# VAO path on WebGL 2.0
4332+
'gl2': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1'],),
4333+
# full state restoration path on WebGL 2.0
4334+
'gl2_no_vao': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=1', '-sOFFSCREEN_FRAMEBUFFER_FORBID_VAO_PATH'],),
4335+
# blitFramebuffer path on WebGL 2.0 (falls back to VAO on Firefox < 67)
4336+
'gl2_no_aa': (['-sMAX_WEBGL_VERSION=2', '-DTEST_WEBGL2=1', '-DTEST_ANTIALIAS=0'],),
4337+
})
4338+
def test_webgl_offscreen_framebuffer_state_restoration(self, args, skip_vao=False):
4339+
cmd = args + ['-lGL', '-sOFFSCREEN_FRAMEBUFFER', '-DEXPLICIT_SWAP=1']
4340+
self.btest_exit('webgl_offscreen_framebuffer_swap_with_bad_state.c', args=cmd)
43414341

43424342
@parameterized({
43434343
'': ([],),

test/test_other.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15412,3 +15412,25 @@ def test_rust_integration_basics(self):
1541215412
return 0;
1541315413
}''')
1541415414
self.do_runf('main.cpp', 'Hello from rust!', emcc_args=[lib])
15415+
15416+
@crossplatform
15417+
def test_create_cache_directory(self):
15418+
if config.FROZEN_CACHE:
15419+
self.skipTest("test doesn't work with frozen cache")
15420+
15421+
# Test that the cache directory (including parent directories) is
15422+
# created on demand.
15423+
with env_modify({'EM_CACHE': os.path.abspath('foo/bar')}):
15424+
self.run_process([EMCC, '-c', test_file('hello_world.c')])
15425+
self.assertExists('foo/bar/sysroot_install.stamp')
15426+
15427+
if not WINDOWS:
15428+
# Test that we generate a nice error when we cannot create the cache
15429+
# because it is in a read-only location.
15430+
# For some reason this doesn't work on windows, at least not in CI.
15431+
os.mkdir('rodir')
15432+
os.chmod('rodir', 0o444)
15433+
self.assertFalse(os.access('rodir', os.W_OK))
15434+
with env_modify({'EM_CACHE': os.path.abspath('rodir/foo')}):
15435+
err = self.expect_fail([EMCC, '-c', test_file('hello_world.c')])
15436+
self.assertContained('emcc: error: unable to create cache directory', err)

tools/cache.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ def lock(reason):
7575
def ensure():
7676
ensure_setup()
7777
if not os.path.isdir(cachedir):
78-
parent_dir = os.path.dirname(cachedir)
79-
if not is_writable(parent_dir):
80-
utils.exit_with_error(f'unable to create cache directory "{cachedir}": parent directory not writable (see https://emscripten.org/docs/tools_reference/emcc.html for info on setting the cache directory)')
81-
utils.safe_ensure_dirs(cachedir)
78+
try:
79+
utils.safe_ensure_dirs(cachedir)
80+
except Exception as e:
81+
utils.exit_with_error(f'unable to create cache directory "{cachedir}": {e} (see https://emscripten.org/docs/tools_reference/emcc.html for info on setting the cache directory)')
8282

8383

8484
def erase():

0 commit comments

Comments
 (0)