Skip to content

SDL2 - RLE Not Working? #13106

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
Henrique194 opened this issue May 23, 2025 · 6 comments
Open

SDL2 - RLE Not Working? #13106

Henrique194 opened this issue May 23, 2025 · 6 comments
Milestone

Comments

@Henrique194
Copy link

Henrique194 commented May 23, 2025

I’m working with a surface in SDL and trying to enable RLE acceleration using:
SDL_SetSurfaceRLE(surf, 1);

However, SDL_MUSTLOCK(surf) always returns false, which seems to indicate that the surface isn’t actually using RLE acceleration. Am I missing something here? Is there something else I need to do to properly enable RLE on a surface?

For reference, I am using SDL2 v2.26.4.

@Henrique194
Copy link
Author

While digging through the SDL2 source code, I noticed that RLE acceleration seems to depend on the SDL_HAVE_RLE macro being defined. Is there a straightforward way to check if SDL_HAVE_RLE is actually defined in my build? And if it’s not, how can I enable or define it manually?

@slouken
Copy link
Collaborator

slouken commented May 23, 2025

You can throw an #error inside code gated with that ifdef, just to see if it's getting triggered. If not, you're likely building with lean and mean, which removes lots of features like this.

Also, I recommend upgrading your version of SDL. :)

@slouken slouken added this to the 2.x milestone May 23, 2025
@Henrique194
Copy link
Author

I actually downloaded my build directly from the Releases page. So are those builds compiled using the "lean and mean" configuration? Do I need to manually compile SDL2 if I want to disable it?

@slouken
Copy link
Collaborator

slouken commented May 23, 2025

No, those builds have all the features enabled.

@Henrique194
Copy link
Author

Henrique194 commented May 23, 2025

That's odd. I tried the #error approach you suggested, and it turns out SDL_HAVE_RLE wasn't defined, so my code really wasn't using RLE. I'll upgrade to version v2.32.6 later today and check if the issue persists.

@Henrique194
Copy link
Author

Okay, I've tested version v2.32.6, and the issue persists. I'm using the MinGW build for 32-bit systems (i686).

Image

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

No branches or pull requests

2 participants