Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 6 additions & 5 deletions site/source/docs/tools_reference/settings_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2181,11 +2181,12 @@ Default value: true
USE_SDL
=======

Specify the SDL version that is being linked against.
1, the default, is 1.3, which is implemented in JS
2 is a port of the SDL C code on emscripten-ports
When AUTO_JS_LIBRARIES is set to 0 this defaults to 0 and SDL
is not linked in.
Specify the SDL version that is being linked against:

- 0, the default, means no SDL headers or libraries will be used.
- 1 is port of SDL 1.3 which is implemented in JS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 1 is port of SDL 1.3 which is implemented in JS.
- 1 is a port of SDL 1.3 which is implemented in JS.

- 2 and 3 are upstream ports build from the official SDL codebase.

Alternate syntax for using the port: --use-port=sdl2

.. note:: Applicable during both linking and compilation
Expand Down
10 changes: 4 additions & 6 deletions src/modules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,19 @@ function calculateLibraries() {
'libidbstore.js',
'libasync.js',
);
if (USE_SDL != 2) {
libraries.push('libsdl.js');
}
} else {
if (ASYNCIFY) {
libraries.push('libasync.js');
}
if (USE_SDL == 1) {
libraries.push('libsdl.js');
}
if (USE_SDL == 2) {
libraries.push('libegl.js', 'libwebgl.js', 'libhtml5_webgl.js');
}
}

if (USE_SDL == 1) {
libraries.push('libsdl.js');
}

if (USE_GLFW) {
libraries.push('libglfw.js');
}
Expand Down
11 changes: 6 additions & 5 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1498,11 +1498,12 @@ var LEGALIZE_JS_FFI = true;

// Ports

// Specify the SDL version that is being linked against.
// 1, the default, is 1.3, which is implemented in JS
// 2 is a port of the SDL C code on emscripten-ports
// When AUTO_JS_LIBRARIES is set to 0 this defaults to 0 and SDL
// is not linked in.
// Specify the SDL version that is being linked against:
//
// - 0, the default, means no SDL headers or libraries will be used.
// - 1 is port of SDL 1.3 which is implemented in JS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// - 1 is port of SDL 1.3 which is implemented in JS.
// - 1 is a port of SDL 1.3 which is implemented in JS.

// - 2 and 3 are upstream ports build from the official SDL codebase.
//
// Alternate syntax for using the port: --use-port=sdl2
// [compile+link]
var USE_SDL = 0;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_O0.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 24268,
"a.out.js.gz": 8718,
"a.out.js": 24256,
"a.out.js.gz": 8709,
"a.out.nodebug.wasm": 15138,
"a.out.nodebug.wasm.gz": 7455,
"total": 39406,
"total_gz": 16173,
"total": 39394,
"total_gz": 16164,
"sent": [
"fd_write"
],
Expand Down
220 changes: 3 additions & 217 deletions test/codesize/test_codesize_hello_dylink_all.json
Original file line number Diff line number Diff line change
@@ -1,208 +1,8 @@
{
"a.out.js": 244691,
"a.out.js": 205013,
"a.out.nodebug.wasm": 577706,
"total": 822397,
"total": 782719,
"sent": [
"IMG_Init",
"IMG_Load",
"IMG_Load_RW",
"IMG_Quit",
"Mix_AllocateChannels",
"Mix_ChannelFinished",
"Mix_CloseAudio",
"Mix_FadeInChannelTimed",
"Mix_FadeInMusicPos",
"Mix_FadeOutChannel",
"Mix_FadeOutMusic",
"Mix_FadingChannel",
"Mix_FreeChunk",
"Mix_FreeMusic",
"Mix_HaltChannel",
"Mix_HaltMusic",
"Mix_HookMusicFinished",
"Mix_Init",
"Mix_Linked_Version",
"Mix_LoadMUS",
"Mix_LoadMUS_RW",
"Mix_LoadWAV",
"Mix_LoadWAV_RW",
"Mix_OpenAudio",
"Mix_Pause",
"Mix_PauseMusic",
"Mix_Paused",
"Mix_PausedMusic",
"Mix_PlayChannelTimed",
"Mix_PlayMusic",
"Mix_Playing",
"Mix_PlayingMusic",
"Mix_QuerySpec",
"Mix_QuickLoad_RAW",
"Mix_Quit",
"Mix_ReserveChannels",
"Mix_Resume",
"Mix_ResumeMusic",
"Mix_SetPanning",
"Mix_SetPosition",
"Mix_SetPostMix",
"Mix_Volume",
"Mix_VolumeChunk",
"Mix_VolumeMusic",
"SDL_AddTimer",
"SDL_AllocRW",
"SDL_AudioDriverName",
"SDL_AudioQuit",
"SDL_ClearError",
"SDL_CloseAudio",
"SDL_CondBroadcast",
"SDL_CondSignal",
"SDL_CondWait",
"SDL_CondWaitTimeout",
"SDL_ConvertSurface",
"SDL_CreateCond",
"SDL_CreateMutex",
"SDL_CreateRGBSurface",
"SDL_CreateRGBSurfaceFrom",
"SDL_CreateThread",
"SDL_Delay",
"SDL_DestroyCond",
"SDL_DestroyMutex",
"SDL_DestroyRenderer",
"SDL_DestroyWindow",
"SDL_DisplayFormat",
"SDL_DisplayFormatAlpha",
"SDL_EnableKeyRepeat",
"SDL_EnableUNICODE",
"SDL_FillRect",
"SDL_Flip",
"SDL_FreeRW",
"SDL_FreeSurface",
"SDL_GL_DeleteContext",
"SDL_GL_ExtensionSupported",
"SDL_GL_GetAttribute",
"SDL_GL_GetSwapInterval",
"SDL_GL_MakeCurrent",
"SDL_GL_SetAttribute",
"SDL_GL_SetSwapInterval",
"SDL_GL_SwapBuffers",
"SDL_GL_SwapWindow",
"SDL_GetAppState",
"SDL_GetAudioDriver",
"SDL_GetClipRect",
"SDL_GetCurrentAudioDriver",
"SDL_GetError",
"SDL_GetKeyName",
"SDL_GetKeyState",
"SDL_GetKeyboardState",
"SDL_GetModState",
"SDL_GetMouseState",
"SDL_GetNumAudioDrivers",
"SDL_GetRGB",
"SDL_GetRGBA",
"SDL_GetScancodeFromKey",
"SDL_GetThreadID",
"SDL_GetTicks",
"SDL_GetVideoInfo",
"SDL_GetVideoSurface",
"SDL_GetWindowFlags",
"SDL_GetWindowSize",
"SDL_Has3DNow",
"SDL_Has3DNowExt",
"SDL_HasAltiVec",
"SDL_HasMMX",
"SDL_HasMMXExt",
"SDL_HasRDTSC",
"SDL_HasSSE",
"SDL_HasSSE2",
"SDL_Init",
"SDL_InitSubSystem",
"SDL_JoystickClose",
"SDL_JoystickEventState",
"SDL_JoystickGetAxis",
"SDL_JoystickGetBall",
"SDL_JoystickGetButton",
"SDL_JoystickGetHat",
"SDL_JoystickIndex",
"SDL_JoystickName",
"SDL_JoystickNumAxes",
"SDL_JoystickNumBalls",
"SDL_JoystickNumButtons",
"SDL_JoystickNumHats",
"SDL_JoystickOpen",
"SDL_JoystickOpened",
"SDL_JoystickUpdate",
"SDL_Linked_Version",
"SDL_ListModes",
"SDL_LoadBMP_RW",
"SDL_LockAudio",
"SDL_LockSurface",
"SDL_LogSetOutputFunction",
"SDL_LowerBlit",
"SDL_LowerBlitScaled",
"SDL_MapRGB",
"SDL_MapRGBA",
"SDL_NumJoysticks",
"SDL_OpenAudio",
"SDL_PauseAudio",
"SDL_PeepEvents",
"SDL_PollEvent",
"SDL_PumpEvents",
"SDL_PushEvent",
"SDL_Quit",
"SDL_QuitSubSystem",
"SDL_RWFromConstMem",
"SDL_RWFromFile",
"SDL_RWFromMem",
"SDL_RemoveTimer",
"SDL_SaveBMP_RW",
"SDL_SetAlpha",
"SDL_SetClipRect",
"SDL_SetColorKey",
"SDL_SetColors",
"SDL_SetError",
"SDL_SetGamma",
"SDL_SetGammaRamp",
"SDL_SetPalette",
"SDL_SetVideoMode",
"SDL_SetWindowFullscreen",
"SDL_SetWindowTitle",
"SDL_ShowCursor",
"SDL_StartTextInput",
"SDL_StopTextInput",
"SDL_ThreadID",
"SDL_UnlockAudio",
"SDL_UnlockSurface",
"SDL_UpdateRect",
"SDL_UpdateRects",
"SDL_UpperBlit",
"SDL_UpperBlitScaled",
"SDL_VideoDriverName",
"SDL_VideoModeOK",
"SDL_VideoQuit",
"SDL_WM_GrabInput",
"SDL_WM_IconifyWindow",
"SDL_WM_SetCaption",
"SDL_WM_SetIcon",
"SDL_WM_ToggleFullScreen",
"SDL_WaitThread",
"SDL_WarpMouse",
"SDL_WasInit",
"SDL_mutexP",
"SDL_mutexV",
"TTF_CloseFont",
"TTF_FontAscent",
"TTF_FontDescent",
"TTF_FontHeight",
"TTF_FontLineSkip",
"TTF_GlyphMetrics",
"TTF_Init",
"TTF_OpenFont",
"TTF_Quit",
"TTF_RenderText_Blended",
"TTF_RenderText_Shaded",
"TTF_RenderText_Solid",
"TTF_RenderUTF8_Solid",
"TTF_SizeText",
"TTF_SizeUTF8",
"XChangeWindowAttributes",
"XCreateWindow",
"XInternAtom",
Expand Down Expand Up @@ -382,8 +182,6 @@
"alcOpenDevice",
"alcProcessContext",
"alcSuspendContext",
"boxColor",
"boxRGBA",
"clock_res_get",
"clock_time_get",
"eglBindAPI",
Expand Down Expand Up @@ -412,9 +210,6 @@
"eglWaitClient",
"eglWaitGL",
"eglWaitNative",
"ellipseColor",
"ellipseRGBA",
"emscripten_SDL_SetEventHandler",
"emscripten_alcDevicePauseSOFT",
"emscripten_alcDeviceResumeSOFT",
"emscripten_alcGetStringiSOFT",
Expand Down Expand Up @@ -872,8 +667,6 @@
"fd_seek",
"fd_sync",
"fd_write",
"filledEllipseColor",
"filledEllipseRGBA",
"getaddrinfo",
"getnameinfo",
"getprotobyname",
Expand Down Expand Up @@ -1108,14 +901,8 @@
"glutSpecialUpFunc",
"glutSwapBuffers",
"glutTimerFunc",
"lineColor",
"lineRGBA",
"pixelRGBA",
"proc_exit",
"random_get",
"rectangleColor",
"rectangleRGBA",
"rotozoomSurface",
"setNetworkCallback",
"setprotoent",
"stackAlloc",
Expand All @@ -1133,8 +920,7 @@
"uuid_unparse",
"uuid_unparse_lower",
"uuid_unparse_upper",
"uuid_variant",
"zoomSurface"
"uuid_variant"
],
"imports": [
"GOT.func.alBuffer3f",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_unoptimized_code_size.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hello_world.js": 56965,
"hello_world.js.gz": 17729,
"hello_world.js": 56943,
"hello_world.js.gz": 17715,
"hello_world.wasm": 15138,
"hello_world.wasm.gz": 7455,
"no_asserts.js": 26576,
Expand All @@ -11,6 +11,6 @@
"strict.js.gz": 17045,
"strict.wasm": 15138,
"strict.wasm.gz": 7450,
"total": 180885,
"total_gz": 64544
"total": 180863,
"total_gz": 64530
}
2 changes: 1 addition & 1 deletion test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,7 @@ def test_gl_renderers(self):
@no_2gb('render fails')
@no_4gb('render fails')
def test_gl_stride(self):
self.reftest('gl_stride.c', 'gl_stride.png', cflags=['-sGL_UNSAFE_OPTS=0', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL'])
self.reftest('gl_stride.c', 'gl_stride.png', cflags=['-sGL_UNSAFE_OPTS=0', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL', '-sUSE_SDL'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is -lSDL not enough? (if so, is this a breaking change that needs a changelog mention?)


@requires_graphics_hardware
def test_gl_vertex_buffer_pre(self):
Expand Down
Loading