SDL_VideoModeOK behaviour

Hello,

I’m new.

I’ve picked up the PHP SDL binding extension, and I’m currently writing test
scripts to see if the extension does what I expect. When testing the
SDL_VideoModeOK call, I found when I query for bit depths between 9 and 14,
the call just returns the value (9-14) I put into the function. 8, 15, 16
and 32 are ‘normal’ depths so they work as expected. Between 17 and 31 the
call always returns 32, since my video card does not support 24 bpp.

So I wondered why the call doesn’t return 15 when I input values between 9
and 14. I dived into the source, and found that it calls SDL_ListModes to
get available modes for the given depth. I found that it just returns a full
list of modes for bpp’s between 9 and 14. But when I call SetVideoMode with
a weird bit depth like that, it fails as expected.

I tested in a normal C program aswell and it produces the same weird
results. Does anybody have an idea why this happens, or an explanation about
why these results are valid after all?

Regards,

JW