Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point SDL2 port at upstream #15452

Merged
merged 6 commits into from Jan 4, 2022
Merged

Conversation

Daft-Freak
Copy link
Collaborator

Everything should be there now. This is also an update from 2.0.10 to 2.0.17 git from this morning.

Required some minor test updates, looks like togglefullscreen has been broken for a while though.

@sbc100
Copy link
Collaborator

sbc100 commented Nov 8, 2021

Very exciting! I guess this means we can/should archive the https://github.com/emscripten-ports/SDL2 repository?

The codesize failures should go away with a rebase.

test_webgl_context_attributes looks like maybe a real failure?

@@ -110,7 +110,5 @@ int main(int argc, char* argv[]) {

glDeleteTextures(1, &texture);

SDL_Quit();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why remove these calls/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Otherwise all windows get destroyed and the tests fail because the canvas is gone (well, 0x0).

Copy link
Collaborator

Choose a reason for hiding this comment

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

So have these tests been failing forever?

Can we perhaps land all these test fixes separately (first), since they seem independent of the SDL2 update?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think these were passing with the old version, so something may have changed there. I can split the test fixes out though.

(The testfullscreen one has likely been failing for a while.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I did slightly worry that we have a behavioral change here? My understanding is that switching to upstream SDL would essentially be a no-op but this seem to contradict that.

Can you explain a little more what you mean by "tests fail because the canvas is gone (well, 0x0)."? Is this test run as part of CI? i.e. would reverting this part of the change cause CI to fail?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, thanks for clarifying. Makes sense. Could you replace these with a comment maybe // Exiting without calling SDL_Quit so the test framework can the canvas data (or something like that.. I'm not sure I have the working corret.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, some of the other tests already have something like that:

// Don't quit - we need to reftest the canvas! SDL_Quit();

Must have been missed in these ones due to the missing SDL_Init and the bug in quit... will update

Copy link
Member

Choose a reason for hiding this comment

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

Maybe also a good idea to add a changlog entry for this? Both in general for the change to use latest upstream, and specifically for this noticeable issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ooh, yeah +4 SDL releases is probably worth a changelog entry! I'll try to come up with something...

(note that the issue here is only noticeable if you don't call SDL_Init but do call SDL_Quit... otherwise it happened a few updates ago)

Copy link
Member

Choose a reason for hiding this comment

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

I see, thanks! Yeah, I guess the breaking change here is not that important to mention then. But the +4 versions is 😄 Any positive highlights that people might notice could also be worth mentioning briefly in the log.

@@ -136,7 +136,7 @@ int main() {
/* SDL 1 limits which events can be used here.
* Click and mouseup don't work.
*/
if (emscripten_set_mouseup_callback(NULL, NULL, 1, mouseup) != EMSCRIPTEN_RESULT_SUCCESS) {
if (emscripten_set_mouseup_callback("#canvas", NULL, 1, mouseup) != EMSCRIPTEN_RESULT_SUCCESS) {
printf("Couldn't to set mouse callback. Test failed.\n");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add return 1; here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

TAG = 'version_24'
HASH = '5a8181acdcce29cdda7e7a4cc876602740f5b9deebd366ecec71ae15c4bbf1f352da4dd0e3c5e0ba8160709dda0270566d64a6cd3892da894463ecf8502836aa'
SUBDIR = 'SDL2-' + TAG
TAG = '5b646cd19e36e02c658fcbf792721b5bdce8491f'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there some tag we could use here? I wonder if upstream could mind tagging a release so that we could point to something here?

Copy link
Collaborator Author

@Daft-Freak Daft-Freak Nov 8, 2021

Choose a reason for hiding this comment

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

Hmm, there will be a tag when 2.01.8 releases. Until then there isn't a released version with all the downstream changes. (Mostly missing timers without threads)

EDIT: might need to change this anyway, the config.h needs a fix.

Copy link
Collaborator

@sbc100 sbc100 Nov 8, 2021

Choose a reason for hiding this comment

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

OK, sgtm to use the raw hash for now then. Perhaps add a TODO to update to 2.01.8 once it is released?

@Daft-Freak
Copy link
Collaborator Author

Ah, I didn't see that that test had a SDL2 variant. I'll go see what's going on there...

@Daft-Freak
Copy link
Collaborator Author

Seemed to be some conflict between the GL context the test was creating and the one SDL was creating internally for its renderer (probably the fact that they end up being the same context). Since that test was only using GL and none of the SDL render APIs, I just removed the call to SDL_CreateRenderer.

@Daft-Freak
Copy link
Collaborator Author

2.0.18 has been released now, so updated to use the tag. Also rebased.

This destroys the window on newer SDL, causing the tests to fail as the
rendered result is gone.
Seems some state from the renderer is causing the context created later to not draw anything. This test doesn't use the renderer API anyway, so remove it.
@a20eac1d
Copy link

a20eac1d commented Jan 3, 2022

@Daft-Freak I am very excited about this change. Do you have any update on when this can be merged and deployed?

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

lgtm. Looks like the there is conflict that needs resolving but otherwise I think we can land.

@kripken kripken enabled auto-merge (squash) January 4, 2022 19:53
@kripken kripken merged commit e325125 into emscripten-core:main Jan 4, 2022
@Daft-Freak Daft-Freak deleted the upstream-sdl branch January 5, 2022 15:18
@a20eac1d
Copy link

a20eac1d commented Jan 7, 2022

Thank you everybody for working on this!

@kripken Can we pull this change yet somehow, or do we have to wait for the next official release build to update our EMSDK?

@sbc100
Copy link
Collaborator

sbc100 commented Jan 7, 2022

You can try it now by installing tot (i.e. ./emsdk install tot).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants