SDL icon indicating copy to clipboard operation
SDL copied to clipboard

SDL2 - RLE Not Working?

Open Henrique194 opened this issue 7 months ago • 6 comments

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 avatar May 23 '25 15:05 Henrique194

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?

Henrique194 avatar May 23 '25 15:05 Henrique194

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 avatar May 23 '25 15:05 slouken

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?

Henrique194 avatar May 23 '25 15:05 Henrique194

No, those builds have all the features enabled.

slouken avatar May 23 '25 16:05 slouken

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 avatar May 23 '25 17:05 Henrique194

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

Image

Henrique194 avatar May 23 '25 23:05 Henrique194