Use SDL_GetRendererName for Direct3D9 check

This commit is contained in:
Andy Vandijck 2025-06-29 13:02:37 +02:00
parent e36fc38eba
commit d1d2cd7ba7
1 changed files with 9 additions and 1 deletions

View File

@ -2512,7 +2512,7 @@ void SDLDrawingPanel::DrawingPanelInit()
#endif
} else {
#ifdef ENABLE_SDL3
if (OPTION(kSDLRenderer) == wxString("direct3d")) {
if (!strcmp(SDL_GetRendererName(renderer), "direct3d")) {
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, (width * scale), (height * scale));
} else {
texture = SDL_CreateTexture(renderer, SDL_GetPixelFormatForMasks(32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000), SDL_TEXTUREACCESS_STREAMING, (width * scale), (height * scale));
@ -2566,7 +2566,11 @@ void SDLDrawingPanel::DrawArea()
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);
SDL_RenderClear(renderer);
#ifdef ENABLE_SDL3
if ((!strcmp(SDL_GetRendererName(renderer), "direct3d")) && (systemColorDepth == 32)) {
#else
if ((OPTION(kSDLRenderer) == wxString("direct3d") && (systemColorDepth == 32)) {
#endif
todraw_argb8888 = (uint32_t *)(todraw + srcPitch));
for (int i = 0; i < (height * scale); i++) {
@ -2576,7 +2580,11 @@ void SDLDrawingPanel::DrawArea()
}
SDL_UpdateTexture(texture, NULL, todraw_argb, srcPitch);
#ifdef ENABLE_SDL3
if ((!strcmp(SDL_GetRendererName(renderer), "direct3d")) && (systemColorDepth == 16)) {
#else
} else if ((OPTION(kSDLRenderer) == wxString("direct3d") && (systemColorDepth == 16)) {
#endif
todraw_rgb565 = (uint16_t *)(todraw + srcPitch))
for (int i = 0; i < (height * scale); i++) {
for (int j = 0; j < (width * scale); j++) {