Open bottle2 opened 7 months ago
@Daft-Freak does anything stand out to you as being incorrect here?
Hmm, SDL_CreateRenderer
probably chose the GLES renderer (and created a webgl context), SDL_UpdateWindowSurface
would then try to create a 2d context and fail.
As this code doesn't use the renderer, not creating one would avoid this. Requesting the software renderer could also be a workaround.
in 6 hours I'll time to come up with a MRE, try the two suggested workarounds and pinpoint which version contains the regression
Hmm,
SDL_CreateRenderer
probably chose the GLES renderer (and created a webgl context),SDL_UpdateWindowSurface
would then try to create a 2d context and fail.
According to https://wiki.libsdl.org/SDL2/SDL_GetWindowSurface: "You may not combine this with 3D or the rendering API on this window." Thus I erred on my side by calling SDL_CreateRenderer()
. I removed the improper call which is also useless, and the Web build worked just fine! Maybe it should return NULL
and appropriately set SDL_GetError()
to improve UX. Otherwise, you may close this issue.
Thanks for your herculean efforts.
Yup sounds like we could improve here perhaps. I'll leave this open in case somebody would like to try and fix. Although I guess its really an upsteam SDL issue ...
good night
when I
$ emrun random.html
, both inside Firefox and Edge on Windows 10, the HTML shell says "Exception thrown, see JavaScript console".then I open console. I hit the browser's reload webpage button while holding SHIFT. it is impossible to refresh the webpage using keyboard for some reason.
the console says:
I click on it. I scroll left. I find
SDL2.ctx = Module['createContext'](Module['canvas'], false, true);
now some commands I ran on my own inside browser console:
in the future I might do a binary search on Emscripten versions
Version of emscripten/emsdk:
Full link command and output with
-v
appended:$ EMCC_DEBUG=1 emcc -Os -sASYNCIFY -sSINGLE_FILE -sUSE_SDL=2 random.c -o random.html -v &>
clang64-emcc.txt
$ EMCC_DEBUG=1 emcc -Os -sASYNCIFY -sSINGLE_FILE -sUSE_SDL=2 random.c -o random.html -v &>
wsl2.txt
sorry for not providing minimal reproducible example, I'm tired