Problems when using SDL2 under Windows XP

Hi, I just discovered that all my applications that were migrated to SDL2 are not working under Windows XP.
I assumed that XP was still supported, but something is not working properly.
Any news on this issue ?
Thanks.------------------------
Armando Alaminos Bouza

I use VisualStudio 2008 as the development environment, but my compiler is Intel Parallel Studio . I use C99, not C++.
I also tried with the precompiled SDL2.dll from the SDL site, and have the same problem, abort at the very beginning.
The same applications run very well on Window Vista, 7, 8, 8.1 .
I have not used XP in a while (years), and today a user told me about a problem running under XP, so I tried with all my applications on XP and any of them with SDL2 fails !

The same applications in the old SDL 1.4 versions are OK.

Thanks.------------------------
Armando Alaminos Bouza

You are compiling a 32bit executable ?

Yes , 32 bits, for sure. The only detail is that the user and myself, we are using virtual machines.
I do not have any real Windows XP machine------------------------
Armando Alaminos Bouza

Do you activate software rendering as well as hardware? Software rendering can’t do various things unfortunately, but you should get something useful

Hi, MrTAToad,

I am using this initialization :

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0) 
{ 
    fprintf(stderr, "Could not initialize SDL");
    exit(-1);
}

Is there any thing for using software rendering in particular ?

Thanks !
Armando------------------------
Armando Alaminos Bouza

Are you using SDL_CreateRenderer or SDL_CreateSoftwareRenderer ?

For the former add SDL_RENDERER_SOFTWARE to your flags

If need be, put in MessageBox functions so you can work out which function is causing the problem

Hi MrTAToad,
You are right! I was using:

renderer = SDL_CreateRenderer(sdlWindow, -1, 0);

but, if I change to :

renderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_SOFTWARE);

the error vanishes. If I use :

renderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_SOFTWARE | SDL_RENDERER_ACCELERATED);

The is no error message, but the program abort. Is it possible to use SDL_RendererInfo() to know the best choice in advance ?

I have several applications with SDL2, and hundreds of users. There are not known issues with Windows Vista, 7, 8, 8.1. This problem was detected with Windows XP on Virtual Machines, and now I discovered the same problem with a Windows7 running in “VirtualBox”, the same Win7 under VMware is OK. So it is a problem that depends on the present video driver.

Thanks !------------------------
Armando Alaminos Bouza

Whilst virtual machine may say that there is hardware acceleration (at least to the operating system), it all has to be done by software unfortunately, hence the need for the software renderer.

Whilst you could get a list of available renderers, dont forget the hardware renderer will probably still appear.

Unless you can work out if you are running in a virtual machine, there would be no easy way to select the software renderer beyond giving the user an option - after all, SDL2 would only report what its told, and if that includes accelerated hardware rendering is available, then there is no real reason for it to doubt what it is being told and use it as default.

It might be worth using the SDL_HINT_RENDER_DRIVER hint before initialising the renderer with a value of “software”, but then again, you’ve got the problem of knowing when to use software and when normal rendering is available.

Of course you could provide two versions - one with just software rendering for everything and one “normal” version.

Hi, MrTAToad.
It is rather hard to determine that an app is running inside a virtual machine (VM). On the other hand, not all VM are equaly wrong. VirtualBox is always wrong in my tests, VMware is wrong only with Windows XP , but it is OK for Win7 and Win8.x.
The problem is that I have a significant number of user with MAC and our applications are for Windows, most of them with VM.
So, I decided to create a file SDL.INI to solve this issue when required. A clause like :

    Renderer = SOFTWARE

Is used to set the value to a variable RendererPreference, and the renderer initializations now became :

renderer = SDL_CreateRenderer(sdlWindow, -1, RendererPreference);
if (renderer == NULL)
{
    renderer = SDL_CreateRenderer(sdlWindow, -1, SDL_RENDERER_SOFTWARE);
        exit(1);
}

With these modifications the applications are able to run properly in any scenario, provide the an SDL.INI is used if necessary.

MrTAToad, Thank you very much for your help !

Armando------------------------
Armando Alaminos Bouza

No problem! You’ve chosen the easiest way of doing it, and it should be no problem now - the advantage is that if there is a proper XP machine that doesn’t have hardware acceleration, it will work fine there too…