Skip to content

Commit cb39845

Browse files
committed
[wasm64] Run all browser tests in 4gb mode
1 parent 24697df commit cb39845

7 files changed

+41
-25
lines changed

src/library_html5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2273,7 +2273,7 @@ var LibraryHTML5 = {
22732273
}
22742274
#if OFFSCREENCANVAS_SUPPORT
22752275
} else if (canvas.canvasSharedPtr) {
2276-
var targetThread = {{{ makeGetValue('canvas.canvasSharedPtr', 8, 'i32') }}};
2276+
var targetThread = {{{ makeGetValue('canvas.canvasSharedPtr', 8, '*') }}};
22772277
setOffscreenCanvasSizeOnTargetThread(targetThread, target, width, height);
22782278
return {{{ cDefs.EMSCRIPTEN_RESULT_DEFERRED }}}; // This will have to be done asynchronously
22792279
#endif

src/library_idbstore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ var LibraryIDBStore = {
103103
}
104104
var buffer = _malloc(byteArray.length); // must be freed by the caller!
105105
HEAPU8.set(byteArray, buffer);
106-
{{{ makeSetValue('pbuffer', 0, 'buffer', 'i32') }}};
106+
{{{ makeSetValue('pbuffer', 0, 'buffer', '*') }}};
107107
{{{ makeSetValue('pnum', 0, 'byteArray.length', 'i32') }}};
108108
{{{ makeSetValue('perror', 0, '0', 'i32') }}};
109109
wakeUp();

src/library_pthread.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ var LibraryPThread = {
875875
// owns the OffscreenCanvas.
876876
for (var canvas of Object.values(offscreenCanvases)) {
877877
// pthread ptr to the thread that owns this canvas.
878-
{{{ makeSetValue('canvas.canvasSharedPtr', 8, 'pthread_ptr', 'i32') }}};
878+
{{{ makeSetValue('canvas.canvasSharedPtr', 8, 'pthread_ptr', '*') }}};
879879
}
880880
#endif
881881

src/library_webgl.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,8 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
17311731
GLctx.readPixels(x, y, width, height, format, type, pixels);
17321732
} else {
17331733
var heap = heapObjectForWebGLType(type);
1734-
GLctx.readPixels(x, y, width, height, format, type, heap, toTypedArrayIndex(pixels, heap));
1734+
var target = toTypedArrayIndex(pixels, heap);
1735+
GLctx.readPixels(x, y, width, height, format, type, heap, target);
17351736
}
17361737
return;
17371738
}
@@ -3310,7 +3311,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
33103311
if (length) {{{ makeSetValue('length', '0', 'numBytesWrittenExclNull', 'i32') }}};
33113312
},
33123313

3313-
glGetShaderiv : (shader, pname, p) => {
3314+
glGetShaderiv: (shader, pname, p) => {
33143315
if (!p) {
33153316
// GLES2 specification does not specify how to behave if p is a null
33163317
// pointer. Since calling this function does not make sense if p == null,

test/browser/webgl2_get_buffer_sub_data.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,19 @@ int main()
2121
glBindBuffer(GL_ARRAY_BUFFER, buffer);
2222
glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_STATIC_DRAW);
2323

24-
uint8_t data2[8] = {};
24+
uint8_t data2[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
2525

2626
// Test full buffer read
2727
glGetBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(data), data2);
28+
printf("read data: %x %x %x %x %x %x %x %x\n",
29+
data2[0],
30+
data2[1],
31+
data2[2],
32+
data2[3],
33+
data2[4],
34+
data2[5],
35+
data2[6],
36+
data2[7]);
2837
assert(!memcmp(data, data2, sizeof(data)));
2938

3039
// Test partial buffer read

test/resize_offscreencanvas_from_main_thread.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
// If not defined, the pthread that owns the OffscreenCanvas is using emscripten_set_main_loop() so periodically yields back to the event loop.
1515
// #define TEST_SYNC_BLOCKING_LOOP
1616

17-
void thread_local_main_loop()
18-
{
17+
void thread_local_main_loop() {
1918
int w = 0, h = 0;
2019
emscripten_get_canvas_element_size("#canvas", &w, &h);
2120
if (w == 699 && h == 299) {
@@ -27,11 +26,10 @@ void thread_local_main_loop()
2726

2827
emscripten_force_exit(0);
2928
}
30-
printf("%dx%d\n", w, h);
29+
printf("thread_local_main_loop: %dx%d\n", w, h);
3130
}
3231

33-
void *thread_main(void *arg)
34-
{
32+
void *thread_main(void *arg) {
3533
EmscriptenWebGLContextAttributes attr;
3634
emscripten_webgl_init_context_attributes(&attr);
3735
attr.explicitSwapControl = EM_TRUE;
@@ -57,31 +55,28 @@ void *thread_main(void *arg)
5755
return 0;
5856
}
5957

60-
void resize_canvas(void *)
61-
{
58+
void resize_canvas(void* arg) {
6259
// Test that on the main thread, we can observe size changes to the canvas size.
6360
int w, h;
6461
emscripten_get_canvas_element_size("#canvas", &w, &h);
62+
printf("Main thread saw canvas to get resized to %dx%d.\n", w, h);
6563
assert(w == 355 && "We did not observe the effect of pthread having resized OffscreenCanvas");
6664
assert(h == 233);
67-
printf("Main thread saw canvas to get resized to %dx%d.\n", w, h);
6865

6966
// Test that on the main thread, we can also change the size. (pthread listens to see this)
7067
printf("Main thread resizing OffscreenCanvas to size 699x299.\n");
7168
emscripten_set_canvas_element_size("#canvas", 699, 299);
7269
}
7370

7471
//should be able to do this regardless of offscreen canvas support
75-
void get_canvas_size()
76-
{
72+
void get_canvas_size() {
7773
int w, h;
7874
emscripten_get_canvas_element_size("#canvas", &w, &h);
7975
assert(h == 150);
8076
assert(w == 300);
8177
}
8278

83-
int main()
84-
{
79+
int main() {
8580
get_canvas_size();
8681
if (!emscripten_supports_offscreencanvas()) {
8782
printf("Current browser does not support OffscreenCanvas. Skipping the rest of the tests.\n");

test/test_browser.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,7 @@ def test_webgl_parallel_shader_compile(self):
13431343
self.btest_exit('webgl_parallel_shader_compile.cpp')
13441344

13451345
@requires_graphics_hardware
1346+
@no_4gb('readPixels fails: https://crbug.com/324992397')
13461347
def test_webgl_explicit_uniform_location(self):
13471348
self.btest_exit('webgl_explicit_uniform_location.c', args=['-sGL_EXPLICIT_UNIFORM_LOCATION', '-sMIN_WEBGL_VERSION=2'])
13481349

@@ -1351,6 +1352,7 @@ def test_webgl_sampler_layout_binding(self):
13511352
self.btest_exit('webgl_sampler_layout_binding.c', args=['-sGL_EXPLICIT_UNIFORM_BINDING'])
13521353

13531354
@requires_graphics_hardware
1355+
@no_4gb('readPixels fails: https://crbug.com/324992397')
13541356
def test_webgl2_ubo_layout_binding(self):
13551357
self.btest_exit('webgl2_ubo_layout_binding.c', args=['-sGL_EXPLICIT_UNIFORM_BINDING', '-sMIN_WEBGL_VERSION=2'])
13561358

@@ -1552,6 +1554,7 @@ def test_sdl_gl_read(self):
15521554
self.btest_exit('test_sdl_gl_read.c', args=['-lSDL', '-lGL'])
15531555

15541556
@requires_graphics_hardware
1557+
@no_4gb('readPixels fails: https://crbug.com/324992397')
15551558
def test_sdl_gl_mapbuffers(self):
15561559
self.btest_exit('test_sdl_gl_mapbuffers.c', args=['-sFULL_ES3', '-lSDL', '-lGL'])
15571560

@@ -2522,7 +2525,7 @@ def test_runtime_misuse(self, mode):
25222525
var xhr = new XMLHttpRequest();
25232526
out('done timeout noted = ' + Module.noted);
25242527
assert(Module.noted);
2525-
xhr.open('GET', 'http://localhost:%s/report_result?' + HEAP32[Module.noted>>2]);
2528+
xhr.open('GET', 'http://localhost:%s/report_result?' + HEAP32[Module.noted/4]);
25262529
xhr.send();
25272530
setTimeout(function() { window.close() }, 1000);
25282531
}, 0);
@@ -2768,6 +2771,7 @@ def test_webgl2(self, args):
27682771

27692772
# Tests the WebGL 2 glGetBufferSubData() functionality.
27702773
@requires_graphics_hardware
2774+
@no_4gb('getBufferSubData fails: https://crbug.com/325090165')
27712775
def test_webgl2_get_buffer_sub_data(self):
27722776
self.btest_exit('webgl2_get_buffer_sub_data.cpp', args=['-sMAX_WEBGL_VERSION=2', '-lGL'])
27732777

@@ -2840,30 +2844,36 @@ def test_webgl2_packed_types(self):
28402844
self.btest_exit('webgl2_draw_packed_triangle.c', args=['-lGL', '-sMAX_WEBGL_VERSION=2', '-sGL_ASSERTIONS'])
28412845

28422846
@requires_graphics_hardware
2847+
@no_4gb('compressedTexSubImage2D fails: https://crbug.com/324562920')
28432848
def test_webgl2_pbo(self):
28442849
self.btest_exit('webgl2_pbo.cpp', args=['-sMAX_WEBGL_VERSION=2', '-lGL'])
28452850

28462851
@no_firefox('fails on CI likely due to GPU drivers there')
28472852
@requires_graphics_hardware
2853+
@no_4gb('fails to render')
28482854
def test_webgl2_sokol_mipmap(self):
28492855
self.btest('third_party/sokol/mipmap-emsc.c', args=['-sMAX_WEBGL_VERSION=2', '-lGL', '-O1'],
28502856
reference='third_party/sokol/mipmap-emsc.png', reference_slack=2)
28512857

28522858
@no_firefox('fails on CI likely due to GPU drivers there')
2859+
@no_4gb('fails to render')
28532860
@requires_graphics_hardware
28542861
def test_webgl2_sokol_mrt(self):
28552862
self.btest('third_party/sokol/mrt-emcc.c', args=['-sMAX_WEBGL_VERSION=2', '-lGL'],
28562863
reference='third_party/sokol/mrt-emcc.png')
28572864

28582865
@requires_graphics_hardware
2866+
@no_4gb('fails to render')
28592867
def test_webgl2_sokol_arraytex(self):
28602868
self.btest('third_party/sokol/arraytex-emsc.c', args=['-sMAX_WEBGL_VERSION=2', '-lGL'],
28612869
reference='third_party/sokol/arraytex-emsc.png')
28622870

2863-
def test_sdl_touch(self):
2864-
for opts in [[], ['-O2', '-g1', '--closure=1']]:
2865-
print(opts)
2866-
self.btest_exit('test_sdl_touch.c', args=opts + ['-DAUTOMATE_SUCCESS=1', '-lSDL', '-lGL'])
2871+
@parameterized({
2872+
'': ([],),
2873+
'closure': (['-O2', '-g1', '--closure=1'],),
2874+
})
2875+
def test_sdl_touch(self, opts):
2876+
self.btest_exit('test_sdl_touch.c', args=opts + ['-DAUTOMATE_SUCCESS=1', '-lSDL', '-lGL'])
28672877

28682878
def test_html5_mouse(self):
28692879
for opts in [[], ['-O2', '-g1', '--closure=1']]:
@@ -4700,9 +4710,9 @@ def test_webgl_draw_base_vertex_base_instance(self):
47004710
'-DWEBGL_CONTEXT_VERSION=2'])
47014711

47024712
@requires_graphics_hardware
4713+
@no_4gb('fails to render')
47034714
def test_webgl_sample_query(self):
4704-
cmd = ['-sMAX_WEBGL_VERSION=2', '-lGL']
4705-
self.btest_exit('webgl_sample_query.cpp', args=cmd)
4715+
self.btest_exit('webgl_sample_query.cpp', args=['-sMAX_WEBGL_VERSION=2', '-lGL'])
47064716

47074717
@requires_graphics_hardware
47084718
@parameterized({
@@ -4758,6 +4768,7 @@ def test_webgl_offscreen_framebuffer_state_restoration(self):
47584768

47594769
# Tests that using an array of structs in GL uniforms works.
47604770
@requires_graphics_hardware
4771+
@no_4gb('fails to render')
47614772
def test_webgl_array_of_structs_uniform(self):
47624773
self.btest('webgl_array_of_structs_uniform.c', args=['-lGL', '-sMAX_WEBGL_VERSION=2'], reference='browser/webgl_array_of_structs_uniform.png')
47634774

0 commit comments

Comments
 (0)