When surface is set to 32 bits, bpp=32 the following method and code below fails on windows 7 home edition, x64 os:
inline void* NewAligned(int bpp, int width, int height)
{
// of course Windows has to be difficult about this!
buffer = _aligned_malloc(total, 16);
if (!buffer)
{
throw Exception("Failed to allocate surface");
}
It throws some exception.
Why is this alignment necessary ? Is it perhaps an optimization ? (It seems to be related to SSE/Single instruction multiple data ?)
Googling for: sdl aligned buffer
Leads to:
https://wiki.libsdl.org/SDL_SIMDAllocPerhaps this is a better method to use
Nope: "This function is available since SDL 2.0.10."