Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Guarded EGL code with SDL_VIDEO_OPENGL_EGL
  • Loading branch information
slouken committed Sep 22, 2017
1 parent 499f928 commit ad86eff
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/video/vivante/SDL_vivanteplatform.c
Expand Up @@ -32,6 +32,16 @@ VIVANTE_SetupPlatform(_THIS)
return 0;
}

char *VIVANTE_GetDisplayName(_THIS)
{
return NULL;
}

void
VIVANTE_UpdateDisplayScale(_THIS)
{
}

void
VIVANTE_CleanupPlatform(_THIS)
{
Expand Down
2 changes: 2 additions & 0 deletions src/video/vivante/SDL_vivanteplatform.h
Expand Up @@ -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 */
Expand Down
12 changes: 12 additions & 0 deletions src/video/vivante/SDL_vivantevideo.c
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -208,6 +214,8 @@ VIVANTE_VideoInit(_THIS)
return -1;
}

VIVANTE_UpdateDisplayScale(_this);

#ifdef SDL_INPUT_LINUXEV
if (SDL_EVDEV_Init() < 0) {
return -1;
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit ad86eff

Please sign in to comment.