Does the “direct3d” renderer still supports windows XP?
I’ve not seen notice anywhere that SDL dropped XP…
I’ve a minimal program that updates a texture in a loop that using both
mingw-w64 2.0.3 binaries from libsdl.org and with self compiled HG head
binaries does work with software renderer but does not with the default
accelerated one (direct3d), while it works perfectly on a wide range of
windows 7 machines (and linux removing outputdebugstring stuff). The
program is supposed to show a white line moving on a black background, in
windows XP it just displays a black window.
The code is here (excuse the indent but I tried to keep it small), maybe
it’s a problem with mingw64 build, can someone try to build it with visual
studio and check if it works?
#include “SDL.h”
#include “debugapi.h”
int SW=352, SH=288;
int main(int argc, char *argv[])
{
OutputDebugString(“Start!”);
if (SDL_Init(SDL_INIT_VIDEO)) { OutputDebugString(SDL_GetError());
return 0; }
SDL_Window *w = SDL_CreateWindow(“Test”, 100, 100, SW, SH,
SDL_WINDOW_RESIZABLE);
if (!w) { OutputDebugString(SDL_GetError()); return 0; }
SDL_Renderer r = SDL_CreateRenderer(w, -1,
SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC / WORKS replacing the
previous flags with SDL_RENDERER_SOFTWARE */);
if (!r) { OutputDebugString(SDL_GetError()); return 0; }
SDL_RendererInfo info;
SDL_GetRendererInfo(r, &info);
OutputDebugString(info.name);
SDL_Texture *t = SDL_CreateTexture(r, SDL_PIXELFORMAT_YV12,
SDL_TEXTUREACCESS_STATIC, SW, SH);
if (!t) { OutputDebugString(SDL_GetError()); return 0; }
Uint8 v = (Uint8)SDL_malloc(SW * SH * 3 / 2);
memset(v, 0, SW * SH * 3 / 2); memset(v + SW * SH, 127, SW * SH / 2);
Uint8 *y = v;
OutputDebugString(“Starting loop!”);
while(1) {
SDL_Event e;
while (SDL_PollEvent(&e)) {
if ( (e.type == SDL_KEYUP && e.key.keysym.sym == SDLK_ESCAPE) ||
(e.type == SDL_WINDOWEVENT && e.window.event ==
SDL_WINDOWEVENT_CLOSE)) {
OutputDebugString(“Quit!”);
SDL_Quit();
return 0;
}
}
y += SW;
memset(v, 0, SW * SH); memset(y, 255, SW * 50);
if ((y + 50 * SW) >= (v + SW * SH)) y = v;
SDL_UpdateYUVTexture(t, NULL, v, SW, v + (SW*SH), SW/2, v +
(SWSH5/4), SW/2);
SDL_RenderCopy(r, t, NULL, NULL);
SDL_RenderPresent®;
}
}–
Bye,
Gabry