Skip to content

Surface module compiling in SDL3 #3435

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Starbuck5
Copy link
Member

@Starbuck5 Starbuck5 commented May 24, 2025

This PR consists of 4 commits, and it gets the surface module to compile with SDL3. It still fails lots of tests when run in SDL3 mode, but there is lots of SDL-function porting to be done with int->bool stuff.

Commit 1 focuses on Surface.c

This commit does not change the SDL2 codepath at all, except for a cliprect thing similar to what I've done in other PRs.

The RLEaccel stuff is confusing, even digging through the SDL2 source it's hard to understand. Our code uses surf->flags & SDL_RLEACCEL to check, interchangeably with SDL_SurfaceHasRLE(surf), but if you check the source SDL_SurfaceHasRLE does not check the same flags. However, in testing it seems to be equivalent, somehow.

I also just declined to port a whole section that covers a blitting edge case, we'll get to it later, for now I think it will be valuable to have people able to compile at all.

EDIT: also added a commit 5 for surface.c.

Commit 2 and 3 focus on filling and blitting respectively

There are a lot of lines changed but it's just passing formats around, nothing complex

Commit 4 makes intrinsics compile properly

I took Ankith's prior work on this and moved it up to _surface.h, as well as making sure it defines SSE2 and AVX2 itself if necessary. On my (Windows) system it doesn't compile at least the SSE2 stuff without this, so in SDL2 we must be getting that define from SDL itself.

@Starbuck5 Starbuck5 requested a review from a team as a code owner May 24, 2025 05:11
@Starbuck5 Starbuck5 added Surface pygame.Surface sdl3 labels May 24, 2025
@Starbuck5 Starbuck5 marked this pull request as draft May 24, 2025 05:19
@Starbuck5 Starbuck5 force-pushed the surface-sdl3-comp branch 2 times, most recently from 2025f7e to a756521 Compare May 31, 2025 09:40
@Starbuck5 Starbuck5 force-pushed the surface-sdl3-comp branch from a756521 to c44f364 Compare May 31, 2025 22:55
@Starbuck5 Starbuck5 changed the title Get surface.c compiling in SDL3 Surface module compiling in SDL3 May 31, 2025
@Starbuck5 Starbuck5 marked this pull request as ready for review May 31, 2025 23:20
@ankith26 ankith26 added this to the 2.5.6 milestone Jun 14, 2025
@Starbuck5 Starbuck5 force-pushed the surface-sdl3-comp branch from c44f364 to 741db24 Compare June 21, 2025 09:17
Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the PR 🎉

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

Successfully merging this pull request may close these issues.

2 participants