SDL2 - RLE Not Working?
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.
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?
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. :)
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?
No, those builds have all the features enabled.
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.
Okay, I've tested version v2.32.6, and the issue persists. I'm using the MinGW build for 32-bit systems (i686).