2013-02-26 14:12:03 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2015-01-07 17:06:50 +00:00
|
|
|
* Copyright (C) 2011-2015 - Daniel De Matteis
|
2013-02-26 14:12:03 +00:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../../driver.h"
|
|
|
|
#include "../../general.h"
|
2015-03-15 01:47:23 +00:00
|
|
|
#include "../../runloop.h"
|
2015-01-18 19:03:33 +00:00
|
|
|
#include "../video_monitor.h"
|
2013-02-26 14:12:03 +00:00
|
|
|
#include "../gl_common.h"
|
|
|
|
|
|
|
|
#include <EGL/egl.h>
|
2013-02-27 07:05:36 +00:00
|
|
|
#include <bps/screen.h>
|
|
|
|
#include <bps/navigator.h>
|
2013-03-22 15:30:10 +00:00
|
|
|
#include <bps/event.h>
|
2013-02-26 14:12:03 +00:00
|
|
|
#include <screen/screen.h>
|
|
|
|
#include <sys/platform.h>
|
|
|
|
#include <GLES2/gl2.h>
|
|
|
|
|
2014-05-28 19:14:11 +00:00
|
|
|
#include "../image/image.h"
|
|
|
|
|
2013-02-26 14:12:03 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_GLSL
|
|
|
|
#include "../shader_glsl.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define WINDOW_BUFFERS 2
|
|
|
|
|
2014-07-02 16:56:08 +00:00
|
|
|
static bool g_use_hw_ctx;
|
|
|
|
static EGLContext g_egl_hw_ctx;
|
2013-02-26 14:12:03 +00:00
|
|
|
static EGLContext g_egl_ctx;
|
|
|
|
static EGLSurface g_egl_surf;
|
|
|
|
static EGLDisplay g_egl_dpy;
|
2014-07-02 16:56:08 +00:00
|
|
|
static EGLConfig g_config;
|
2013-02-26 14:12:03 +00:00
|
|
|
static bool g_resize;
|
|
|
|
|
2013-04-07 16:14:28 +00:00
|
|
|
screen_context_t screen_ctx;
|
2013-04-19 17:31:51 +00:00
|
|
|
screen_window_t screen_win;
|
2013-02-26 14:12:03 +00:00
|
|
|
static screen_display_t screen_disp;
|
|
|
|
|
|
|
|
static enum gfx_ctx_api g_api;
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static void gfx_ctx_qnx_set_swap_interval(void *data, unsigned interval)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2013-02-26 14:12:03 +00:00
|
|
|
eglSwapInterval(g_egl_dpy, interval);
|
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static void gfx_ctx_qnx_destroy(void *data)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2014-07-02 16:58:16 +00:00
|
|
|
|
|
|
|
if (g_egl_dpy)
|
|
|
|
{
|
|
|
|
if (g_egl_ctx)
|
|
|
|
{
|
|
|
|
eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
|
|
|
eglDestroyContext(g_egl_dpy, g_egl_ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_egl_hw_ctx)
|
|
|
|
eglDestroyContext(g_egl_dpy, g_egl_hw_ctx);
|
|
|
|
|
|
|
|
if (g_egl_surf)
|
|
|
|
eglDestroySurface(g_egl_dpy, g_egl_surf);
|
|
|
|
eglTerminate(g_egl_dpy);
|
|
|
|
}
|
|
|
|
|
2014-10-27 13:35:23 +00:00
|
|
|
/* Be as careful as possible in deinit. */
|
2014-07-02 16:58:16 +00:00
|
|
|
|
|
|
|
g_egl_ctx = NULL;
|
|
|
|
g_egl_hw_ctx = NULL;
|
|
|
|
g_egl_surf = NULL;
|
|
|
|
g_egl_dpy = NULL;
|
|
|
|
g_config = 0;
|
|
|
|
g_resize = false;
|
2013-02-26 14:12:03 +00:00
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static void gfx_ctx_qnx_get_video_size(void *data, unsigned *width, unsigned *height)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2015-01-10 16:51:00 +00:00
|
|
|
EGLint gl_width, gl_height;
|
|
|
|
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2015-01-10 16:51:00 +00:00
|
|
|
|
|
|
|
*width = 0;
|
|
|
|
*height = 0;
|
|
|
|
|
|
|
|
if (!g_egl_dpy)
|
|
|
|
return;
|
|
|
|
|
|
|
|
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
|
|
|
|
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height);
|
|
|
|
*width = gl_width;
|
|
|
|
*height = gl_height;
|
2013-02-26 14:12:03 +00:00
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static bool gfx_ctx_qnx_init(void *data)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2015-01-10 16:51:00 +00:00
|
|
|
EGLint num_config;
|
|
|
|
EGLint egl_version_major, egl_version_minor;
|
|
|
|
EGLint context_attributes[] = {
|
|
|
|
EGL_CONTEXT_CLIENT_VERSION, 2,
|
|
|
|
EGL_NONE
|
|
|
|
};
|
|
|
|
const EGLint attribs[] = {
|
|
|
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
|
|
|
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
|
|
|
EGL_BLUE_SIZE, 8,
|
|
|
|
EGL_GREEN_SIZE, 8,
|
|
|
|
EGL_RED_SIZE, 8,
|
|
|
|
EGL_NONE
|
|
|
|
};
|
|
|
|
int angle, size[2];
|
|
|
|
int usage, format = SCREEN_FORMAT_RGBX8888;
|
|
|
|
|
2013-03-22 15:30:10 +00:00
|
|
|
/* Create a screen context that will be used to
|
|
|
|
* create an EGL surface to receive libscreen events */
|
|
|
|
|
|
|
|
RARCH_LOG("Initializing screen context...\n");
|
2013-03-23 16:21:30 +00:00
|
|
|
if (!screen_ctx)
|
2013-03-22 15:30:10 +00:00
|
|
|
{
|
2013-03-23 16:21:30 +00:00
|
|
|
screen_create_context(&screen_ctx, 0);
|
|
|
|
|
|
|
|
if (screen_request_events(screen_ctx) != BPS_SUCCESS)
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_request_events failed.\n");
|
|
|
|
goto screen_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (navigator_request_events(0) != BPS_SUCCESS)
|
|
|
|
{
|
|
|
|
RARCH_ERR("navigator_request_events failed.\n");
|
|
|
|
goto screen_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (navigator_rotation_lock(false) != BPS_SUCCESS)
|
|
|
|
{
|
|
|
|
RARCH_ERR("navigator_location_lock failed.\n");
|
|
|
|
goto screen_error;
|
|
|
|
}
|
2013-03-22 15:30:10 +00:00
|
|
|
}
|
|
|
|
|
2013-02-26 14:12:03 +00:00
|
|
|
usage = SCREEN_USAGE_OPENGL_ES2 | SCREEN_USAGE_ROTATION;
|
|
|
|
|
|
|
|
RARCH_LOG("Initializing context\n");
|
|
|
|
|
|
|
|
if ((g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY)
|
|
|
|
{
|
|
|
|
RARCH_ERR("eglGetDisplay failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!eglInitialize(g_egl_dpy, &egl_version_major, &egl_version_minor))
|
|
|
|
{
|
|
|
|
RARCH_ERR("eglInitialize failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
|
|
|
{
|
|
|
|
RARCH_ERR("eglBindAPI failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
RARCH_LOG("[BLACKBERRY QNX/EGL]: EGL version: %d.%d\n", egl_version_major, egl_version_minor);
|
|
|
|
|
2014-07-02 16:56:08 +00:00
|
|
|
if (!eglChooseConfig(g_egl_dpy, attribs, &g_config, 1, &num_config))
|
2013-02-26 14:12:03 +00:00
|
|
|
goto error;
|
|
|
|
|
2014-07-02 16:56:08 +00:00
|
|
|
g_egl_ctx = eglCreateContext(g_egl_dpy, g_config, EGL_NO_CONTEXT, context_attributes);
|
|
|
|
|
|
|
|
if (g_egl_ctx == EGL_NO_CONTEXT)
|
2013-02-26 14:12:03 +00:00
|
|
|
goto error;
|
2014-07-02 16:56:08 +00:00
|
|
|
|
|
|
|
if (g_use_hw_ctx)
|
|
|
|
{
|
|
|
|
g_egl_hw_ctx = eglCreateContext(g_egl_dpy, g_config, g_egl_ctx,
|
|
|
|
context_attributes);
|
|
|
|
RARCH_LOG("[Android/EGL]: Created shared context: %p.\n", (void*)g_egl_hw_ctx);
|
|
|
|
|
|
|
|
if (g_egl_hw_ctx == EGL_NO_CONTEXT)
|
|
|
|
goto error;
|
2013-02-26 14:12:03 +00:00
|
|
|
}
|
|
|
|
|
2013-03-23 16:21:30 +00:00
|
|
|
if(!screen_win)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2013-03-23 16:21:30 +00:00
|
|
|
if (screen_create_window(&screen_win, screen_ctx))
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_create_window failed:.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
2013-02-26 14:12:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_FORMAT, &format))
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_set_window_property_iv [SCREEN_PROPERTY_FORMAT] failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage))
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_set_window_property_iv [SCREEN_PROPERTY_USAGE] failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp))
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_get_window_property_pv [SCREEN_PROPERTY_DISPLAY] failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
int screen_resolution[2];
|
|
|
|
|
|
|
|
if (screen_get_display_property_iv(screen_disp, SCREEN_PROPERTY_SIZE, screen_resolution))
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_get_window_property_iv [SCREEN_PROPERTY_SIZE] failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-04-19 17:31:51 +00:00
|
|
|
#ifndef HAVE_BB10
|
2015-01-10 16:51:00 +00:00
|
|
|
angle = atoi(getenv("ORIENTATION"));
|
2013-02-26 14:12:03 +00:00
|
|
|
|
|
|
|
screen_display_mode_t screen_mode;
|
|
|
|
if (screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode))
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_get_display_property_pv [SCREEN_PROPERTY_MODE] failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-04-19 17:31:51 +00:00
|
|
|
if (screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size))
|
|
|
|
{
|
2013-02-26 14:12:03 +00:00
|
|
|
RARCH_ERR("screen_get_window_property_iv [SCREEN_PROPERTY_BUFFER_SIZE] failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
int buffer_size[2] = {size[0], size[1]};
|
|
|
|
|
2015-01-10 16:51:00 +00:00
|
|
|
if ((angle == 0) || (angle == 180))
|
|
|
|
{
|
2013-02-26 14:12:03 +00:00
|
|
|
if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
|
2015-01-10 16:51:00 +00:00
|
|
|
((screen_mode.width < screen_mode.height) && (size[0] > size[1])))
|
|
|
|
{
|
2013-02-26 14:12:03 +00:00
|
|
|
buffer_size[1] = size[0];
|
|
|
|
buffer_size[0] = size[1];
|
|
|
|
}
|
2015-01-10 16:51:00 +00:00
|
|
|
}
|
|
|
|
else if ((angle == 90) || (angle == 270))
|
|
|
|
{
|
2013-02-26 14:12:03 +00:00
|
|
|
if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
|
2015-01-10 16:51:00 +00:00
|
|
|
((screen_mode.width < screen_mode.height && size[0] < size[1])))
|
|
|
|
{
|
2013-02-26 14:12:03 +00:00
|
|
|
buffer_size[1] = size[0];
|
|
|
|
buffer_size[0] = size[1];
|
|
|
|
}
|
2015-01-10 16:51:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-02-26 14:12:03 +00:00
|
|
|
RARCH_ERR("Navigator returned an unexpected orientation angle.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-04-19 17:31:51 +00:00
|
|
|
|
2013-02-26 14:12:03 +00:00
|
|
|
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size))
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_set_window_property_iv [SCREEN_PROPERTY_BUFFER_SIZE] failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle))
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_set_window_property_iv [SCREEN_PROPERTY_ROTATION] failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
2013-04-19 17:31:51 +00:00
|
|
|
#endif
|
2013-02-26 14:12:03 +00:00
|
|
|
|
|
|
|
if (screen_create_window_buffers(screen_win, WINDOW_BUFFERS))
|
|
|
|
{
|
|
|
|
RARCH_ERR("screen_create_window_buffers failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2014-07-02 16:56:08 +00:00
|
|
|
if (!(g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_config, screen_win, 0)))
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
|
|
|
RARCH_ERR("eglCreateWindowSurface failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
|
|
|
|
{
|
|
|
|
RARCH_ERR("eglMakeCurrent failed.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
error:
|
|
|
|
RARCH_ERR("EGL error: %d.\n", eglGetError());
|
2014-05-17 12:36:15 +00:00
|
|
|
gfx_ctx_qnx_destroy(data);
|
2013-03-22 15:30:10 +00:00
|
|
|
screen_error:
|
|
|
|
screen_stop_events(screen_ctx);
|
2013-02-26 14:12:03 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static void gfx_ctx_qnx_swap_buffers(void *data)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2013-02-26 14:12:03 +00:00
|
|
|
eglSwapBuffers(g_egl_dpy, g_egl_surf);
|
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static void gfx_ctx_qnx_check_window(void *data, bool *quit,
|
2013-02-26 14:12:03 +00:00
|
|
|
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
|
|
|
{
|
2015-01-10 16:51:00 +00:00
|
|
|
unsigned new_width, new_height;
|
|
|
|
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2013-02-26 14:12:03 +00:00
|
|
|
(void)frame_count;
|
|
|
|
|
|
|
|
*quit = false;
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
gfx_ctx_qnx_get_video_size(data, &new_width, &new_height);
|
2013-02-26 14:12:03 +00:00
|
|
|
if (new_width != *width || new_height != *height)
|
|
|
|
{
|
|
|
|
*width = new_width;
|
|
|
|
*height = new_height;
|
|
|
|
*resize = true;
|
|
|
|
}
|
|
|
|
|
2014-10-27 13:35:23 +00:00
|
|
|
/* Check if we are exiting. */
|
2014-06-02 07:52:30 +00:00
|
|
|
if (g_extern.system.shutdown)
|
2013-02-26 14:12:03 +00:00
|
|
|
*quit = true;
|
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static void gfx_ctx_qnx_set_resize(void *data, unsigned width, unsigned height)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2013-02-26 14:12:03 +00:00
|
|
|
(void)width;
|
|
|
|
(void)height;
|
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static void gfx_ctx_qnx_update_window_title(void *data)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2013-10-07 18:17:07 +00:00
|
|
|
char buf[128], buf_fps[128];
|
2013-10-08 10:28:38 +00:00
|
|
|
|
2015-01-10 16:51:00 +00:00
|
|
|
(void)data;
|
|
|
|
|
2015-01-18 19:03:33 +00:00
|
|
|
video_monitor_get_fps(buf, sizeof(buf),
|
2015-03-07 22:03:56 +00:00
|
|
|
buf_fps, sizeof(buf_fps));
|
2015-01-12 04:59:11 +00:00
|
|
|
if (g_settings.fps_show)
|
2015-03-15 01:47:23 +00:00
|
|
|
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
|
2013-02-26 14:12:03 +00:00
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static bool gfx_ctx_qnx_set_video_mode(void *data,
|
2013-02-26 14:12:03 +00:00
|
|
|
unsigned width, unsigned height,
|
|
|
|
bool fullscreen)
|
|
|
|
{
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2013-02-26 14:12:03 +00:00
|
|
|
(void)width;
|
|
|
|
(void)height;
|
|
|
|
(void)fullscreen;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-27 13:35:23 +00:00
|
|
|
static void gfx_ctx_qnx_input_driver(void *data,
|
|
|
|
const input_driver_t **input, void **input_data)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2013-02-26 14:12:03 +00:00
|
|
|
*input = NULL;
|
|
|
|
*input_data = NULL;
|
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static gfx_ctx_proc_t gfx_ctx_qnx_get_proc_address(const char *symbol)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
|
|
|
gfx_ctx_proc_t ret;
|
2015-01-10 16:51:00 +00:00
|
|
|
void *sym__;
|
|
|
|
|
|
|
|
rarch_assert(sizeof(void*) == sizeof(void (*)(void)));
|
2013-02-26 14:12:03 +00:00
|
|
|
|
2015-01-10 16:51:00 +00:00
|
|
|
sym__ = eglGetProcAddress(symbol);
|
2013-02-26 14:12:03 +00:00
|
|
|
memcpy(&ret, &sym__, sizeof(void*));
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-10-27 13:35:23 +00:00
|
|
|
static bool gfx_ctx_qnx_bind_api(void *data,
|
|
|
|
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2013-06-22 13:06:56 +00:00
|
|
|
(void)major;
|
|
|
|
(void)minor;
|
2015-01-10 16:51:00 +00:00
|
|
|
|
2013-02-26 14:12:03 +00:00
|
|
|
g_api = api;
|
2015-01-10 16:51:00 +00:00
|
|
|
|
2013-02-26 14:12:03 +00:00
|
|
|
return api == GFX_CTX_OPENGL_ES_API;
|
|
|
|
}
|
|
|
|
|
2014-05-17 12:36:15 +00:00
|
|
|
static bool gfx_ctx_qnx_has_focus(void *data)
|
2013-02-26 14:12:03 +00:00
|
|
|
{
|
2014-03-09 16:11:06 +00:00
|
|
|
(void)data;
|
2013-02-26 14:12:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-18 21:32:14 +00:00
|
|
|
static bool gfx_ctx_qnx_suppress_screensaver(void *data, bool enable)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
(void)enable;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-10-08 15:23:02 +00:00
|
|
|
static bool gfx_ctx_qnx_has_windowed(void *data)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-07-02 16:56:08 +00:00
|
|
|
static void gfx_qnx_ctx_bind_hw_render(void *data, bool enable)
|
|
|
|
{
|
|
|
|
(void)data;
|
2015-01-10 16:51:00 +00:00
|
|
|
|
2014-07-02 16:56:08 +00:00
|
|
|
g_use_hw_ctx = enable;
|
2015-01-10 16:51:00 +00:00
|
|
|
|
|
|
|
if (!g_egl_dpy)
|
|
|
|
return;
|
|
|
|
if (!g_egl_surf)
|
|
|
|
return;
|
|
|
|
|
|
|
|
eglMakeCurrent(g_egl_dpy, g_egl_surf,
|
|
|
|
g_egl_surf, enable ? g_egl_hw_ctx : g_egl_ctx);
|
2014-07-02 16:56:08 +00:00
|
|
|
}
|
|
|
|
|
2013-02-26 14:12:03 +00:00
|
|
|
const gfx_ctx_driver_t gfx_ctx_bbqnx = {
|
2014-05-17 12:36:15 +00:00
|
|
|
gfx_ctx_qnx_init,
|
|
|
|
gfx_ctx_qnx_destroy,
|
|
|
|
gfx_ctx_qnx_bind_api,
|
|
|
|
gfx_ctx_qnx_set_swap_interval,
|
|
|
|
gfx_ctx_qnx_set_video_mode,
|
|
|
|
gfx_ctx_qnx_get_video_size,
|
2015-02-24 20:36:23 +00:00
|
|
|
NULL, /* get_video_output_size */
|
|
|
|
NULL, /* get_video_output_prev */
|
|
|
|
NULL, /* get_video_output_next */
|
2015-02-24 18:58:14 +00:00
|
|
|
NULL,
|
2014-05-17 12:36:15 +00:00
|
|
|
gfx_ctx_qnx_update_window_title,
|
|
|
|
gfx_ctx_qnx_check_window,
|
|
|
|
gfx_ctx_qnx_set_resize,
|
|
|
|
gfx_ctx_qnx_has_focus,
|
2015-01-18 21:32:14 +00:00
|
|
|
gfx_ctx_qnx_suppress_screensaver,
|
2014-10-08 15:23:02 +00:00
|
|
|
gfx_ctx_qnx_has_windowed,
|
2014-05-17 12:36:15 +00:00
|
|
|
gfx_ctx_qnx_swap_buffers,
|
|
|
|
gfx_ctx_qnx_input_driver,
|
|
|
|
gfx_ctx_qnx_get_proc_address,
|
|
|
|
#ifdef HAVE_EGL
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
#endif
|
2013-03-29 12:46:11 +00:00
|
|
|
NULL,
|
2013-02-26 14:12:03 +00:00
|
|
|
"blackberry_qnx",
|
2014-07-02 16:56:08 +00:00
|
|
|
gfx_qnx_ctx_bind_hw_render,
|
2013-02-26 14:12:03 +00:00
|
|
|
};
|