Skip to content

Commit a98af2b

Browse files
authored
Update SDL2 port to version that includes wasm64 fixes. (emscripten-core#22708)
Also, fix a wasm64 bug GL emulation that was only exposed by running the tests which are no longer disabled.
1 parent 18321c5 commit a98af2b

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

src/library_glemu.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,7 @@ var LibraryGLEmulation = {
20472047
GLImmediate.rendererComponents[name] = 1;
20482048
#if ASSERTIONS
20492049
if (GLImmediate.enabledClientAttributes[name]) {
2050-
out("Warning: glTexCoord used after EnableClientState for TEXTURE_COORD_ARRAY for TEXTURE0. Disabling TEXTURE_COORD_ARRAY...");
2050+
warnOnce("Warning: glTexCoord used after EnableClientState for TEXTURE_COORD_ARRAY for TEXTURE0. Disabling TEXTURE_COORD_ARRAY...");
20512051
}
20522052
#endif
20532053
GLImmediate.enabledClientAttributes[name] = true;
@@ -2980,11 +2980,10 @@ var LibraryGLEmulation = {
29802980
var attr = attributes[i];
29812981
var srcStride = Math.max(attr.sizeBytes, attr.stride);
29822982
if ((srcStride & 3) == 0 && (attr.sizeBytes & 3) == 0) {
2983-
var size4 = attr.sizeBytes>>2;
2984-
var srcStride4 = Math.max(attr.sizeBytes, attr.stride)>>2;
29852983
for (var j = 0; j < count; j++) {
2986-
for (var k = 0; k < size4; k++) { // copy in chunks of 4 bytes, our alignment makes this possible
2987-
HEAP32[((start + attr.offset + bytes*j)>>2) + k] = HEAP32[(attr.pointer>>2) + j*srcStride4 + k];
2984+
for (var k = 0; k < attr.sizeBytes; k+=4) { // copy in chunks of 4 bytes, our alignment makes this possible
2985+
var val = {{{ makeGetValue('attr.pointer', 'j*srcStride + k', 'i32') }}};
2986+
{{{ makeSetValue('start + attr.offset', 'bytes*j + k', 'val', 'i32') }}};
29882987
}
29892988
}
29902989
} else {
@@ -3533,7 +3532,7 @@ var LibraryGLEmulation = {
35333532
if (!GLctx.currentElementArrayBufferBinding) {
35343533
assert(type == GLctx.UNSIGNED_SHORT); // We can only emulate buffers of this kind, for now
35353534
}
3536-
out("DrawElements doesn't actually prepareClientAttributes properly.");
3535+
warnOnce("DrawElements doesn't actually prepareClientAttributes properly.");
35373536
#endif
35383537
GLImmediate.prepareClientAttributes(count, false);
35393538
GLImmediate.mode = mode;

test/test_browser.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,8 +3050,6 @@ def test_sdl2_gl_read(self):
30503050
# SDL, OpenGL, readPixels
30513051
self.btest_exit('test_sdl2_gl_read.c', args=['-sUSE_SDL=2'])
30523052

3053-
@no_4gb('https://github.com/libsdl-org/SDL/issues/9052')
3054-
@no_2gb('https://github.com/libsdl-org/SDL/issues/9052')
30553053
@requires_graphics_hardware
30563054
def test_sdl2_glmatrixmode_texture(self):
30573055
self.reftest('test_sdl2_glmatrixmode_texture.c', 'test_sdl2_glmatrixmode_texture.png',
@@ -3105,8 +3103,6 @@ def test_sdl2_fog_linear(self):
31053103
def test_sdl2_unwasteful(self):
31063104
self.btest_exit('test_sdl2_unwasteful.c', args=['-sUSE_SDL=2', '-O1'])
31073105

3108-
@no_2gb('https://github.com/libsdl-org/SDL/issues/9052')
3109-
@no_4gb('https://github.com/libsdl-org/SDL/issues/9052')
31103106
def test_sdl2_canvas_write(self):
31113107
self.btest_exit('test_sdl2_canvas_write.c', args=['-sUSE_SDL=2'])
31123108

tools/ports/sdl2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55

66
import os
77

8-
TAG = 'release-2.30.8'
9-
HASH = '6e54c2f93c675b134ff311cb91e5f7b3ad77eb41335b172dc6d3e9774d2ea4728eba9d51667f799cfa1c52cc63169f88f0420c2330574ad3230ee0cb0642e3d4'
8+
# For now we pin to specific commit since we want to include
9+
# https://github.com/libsdl-org/SDL/pull/11127
10+
# Once the next version of SDL2 is tagged we can use that here instead.
11+
TAG = '3deb07ea395373204462130c1e062bc1f71fe060'
12+
HASH = '551082bffb28442ad20662c6963fb02701449d43e7da6aa68fbec922e47b060609e3cdf5f9e3bfde7458a92547e008f010af79ddadf448665e55ca8759cfbcdb'
1013
SUBDIR = 'SDL-' + TAG
1114

1215
variants = {'sdl2-mt': {'PTHREADS': 1}}
@@ -71,9 +74,6 @@ def create(final):
7174

7275
srcs = [os.path.join(src_dir, 'src', s) for s in srcs]
7376
flags = ['-sUSE_SDL=0']
74-
# SDL2 currently has the wrong definition of SDL_PRIs64 for emscripten.
75-
# TODO: Remove this when we roll SDL2 to include https://github.com/libsdl-org/SDL/pull/11127
76-
flags += ['-Wno-format']
7777
includes = [ports.get_include_dir('SDL2')]
7878
if settings.PTHREADS:
7979
flags += ['-pthread']

0 commit comments

Comments
 (0)