Browse Source

Guarded EGL code with SDL_VIDEO_OPENGL_EGL

Sam Lantinga 7 years ago
parent
commit
ad86eff1a8

+ 10 - 0
src/video/vivante/SDL_vivanteplatform.c

@@ -32,6 +32,16 @@ VIVANTE_SetupPlatform(_THIS)
     return 0;
 }
 
+char *VIVANTE_GetDisplayName(_THIS)
+{
+    return NULL;
+}
+
+void
+VIVANTE_UpdateDisplayScale(_THIS)
+{
+}
+
 void
 VIVANTE_CleanupPlatform(_THIS)
 {

+ 2 - 0
src/video/vivante/SDL_vivanteplatform.h

@@ -36,6 +36,8 @@
 #endif
 
 extern int VIVANTE_SetupPlatform(_THIS);
+extern char *VIVANTE_GetDisplayName(_THIS);
+extern void VIVANTE_UpdateDisplayScale(_THIS);
 extern void VIVANTE_CleanupPlatform(_THIS);
 
 #endif /* SDL_VIDEO_DRIVER_VIVANTE */

+ 12 - 0
src/video/vivante/SDL_vivantevideo.c

@@ -97,6 +97,7 @@ VIVANTE_Create()
     device->DestroyWindow = VIVANTE_DestroyWindow;
     device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo;
 
+#if SDL_VIDEO_OPENGL_EGL
     device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary;
     device->GL_GetProcAddress = VIVANTE_GLES_GetProcAddress;
     device->GL_UnloadLibrary = VIVANTE_GLES_UnloadLibrary;
@@ -106,6 +107,7 @@ VIVANTE_Create()
     device->GL_GetSwapInterval = VIVANTE_GLES_GetSwapInterval;
     device->GL_SwapWindow = VIVANTE_GLES_SwapWindow;
     device->GL_DeleteContext = VIVANTE_GLES_DeleteContext;
+#endif
 
     device->PumpEvents = VIVANTE_PumpEvents;
 
@@ -152,6 +154,9 @@ VIVANTE_AddVideoDisplays(_THIS)
     switch (bpp)
     {
     default: /* Is another format used? */
+    case 32:
+        current_mode.format = SDL_PIXELFORMAT_ARGB8888;
+        break;
     case 16:
         current_mode.format = SDL_PIXELFORMAT_RGB565;
         break;
@@ -160,6 +165,7 @@ VIVANTE_AddVideoDisplays(_THIS)
     current_mode.refresh_rate = 60;
 
     SDL_zero(display);
+    display.name = VIVANTE_GetDisplayName(_this);
     display.desktop_mode = current_mode;
     display.current_mode = current_mode;
     display.driverdata = data;
@@ -208,6 +214,8 @@ VIVANTE_VideoInit(_THIS)
         return -1;
     }
 
+    VIVANTE_UpdateDisplayScale(_this);
+
 #ifdef SDL_INPUT_LINUXEV
     if (SDL_EVDEV_Init() < 0) {
         return -1;
@@ -281,6 +289,7 @@ VIVANTE_CreateWindow(_THIS, SDL_Window * window)
         return SDL_SetError("VIVANTE: Can't create native window");
     }
 
+#if SDL_VIDEO_OPENGL_EGL
     if (window->flags & SDL_WINDOW_OPENGL) {
         data->egl_surface = SDL_EGL_CreateSurface(_this, data->native_window);
         if (data->egl_surface == EGL_NO_SURFACE) {
@@ -289,6 +298,7 @@ VIVANTE_CreateWindow(_THIS, SDL_Window * window)
     } else {
         data->egl_surface = EGL_NO_SURFACE;
     }
+#endif
 
     /* Window has been successfully created */
     return 0;
@@ -302,9 +312,11 @@ VIVANTE_DestroyWindow(_THIS, SDL_Window * window)
 
     data = window->driverdata;
     if (data) {
+#if SDL_VIDEO_OPENGL_EGL
         if (data->egl_surface != EGL_NO_SURFACE) {
             SDL_EGL_DestroySurface(_this, data->egl_surface);
         }
+#endif
 
         if (data->native_window) {
 #if SDL_VIDEO_DRIVER_VIVANTE_VDK