SDL_CreateRGBSurfaceWithFormat depth parameter unused


Looking at the SDL_CreateRGBSurfaceWithFormat it seemed quite annoying and suspicious that a separate depth parameter is required, when that information is part of the specified pixel format, so I decided to look how is it used in the code, and sure enough it isn’t… at all. I’m guessing changing the API immediately will be a no-no, so maybe it’s worth a remark in the wiki for starters?

Same situation with SDL_CreateRGBSurfaceWithFormatFrom.

You’re right, that parameter is superfluous. Not sure why I missed that when I implemented those functions - this should probably be fixed in SDL 2.1

But providing that parameter is less annoying than specifying the format as depth and 4 endian-specific color masks (like you have to in SDL_CreateRGBSurfaceFrom() and SDL_CreateRGBSurface()) so it’s still an improvement :wink:

Alright, makes sense. And yes, definitely less annoying than the old versions. In fact for my purposes (writing a wrapper library) knowing that I can just zero the depth parameter makes those “WithFromat” functions pretty much perfect.

Thanks for the reply and for implementing those :smiley: