(Context drivers) Add get_flags function

This commit is contained in:
twinaphex 2016-05-05 05:35:35 +02:00
parent cc0f8160b5
commit a0425dfb14
19 changed files with 142 additions and 8 deletions

View File

@ -537,6 +537,12 @@ static void *android_gfx_ctx_get_context_data(void *data)
} }
#endif #endif
static uint32_t android_gfx_ctx_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_android = { const gfx_ctx_driver_t gfx_ctx_android = {
android_gfx_ctx_init, android_gfx_ctx_init,
android_gfx_ctx_destroy, android_gfx_ctx_destroy,
@ -562,6 +568,7 @@ const gfx_ctx_driver_t gfx_ctx_android = {
NULL, NULL,
NULL, NULL,
"android", "android",
android_gfx_ctx_get_flags,
android_gfx_ctx_bind_hw_render, android_gfx_ctx_bind_hw_render,
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
android_gfx_ctx_get_context_data android_gfx_ctx_get_context_data

View File

@ -398,6 +398,12 @@ static void gfx_ctx_qnx_get_video_size(void *data,
#endif #endif
} }
static uint32_t gfx_ctx_qnx_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_bbqnx = { const gfx_ctx_driver_t gfx_ctx_bbqnx = {
gfx_ctx_qnx_init, gfx_ctx_qnx_init,
gfx_ctx_qnx_destroy, gfx_ctx_qnx_destroy,
@ -423,5 +429,6 @@ const gfx_ctx_driver_t gfx_ctx_bbqnx = {
NULL, NULL,
NULL, NULL,
"blackberry_qnx", "blackberry_qnx",
gfx_ctx_qnx_bind_hw_render, gfx_ctx_qnx_get_flags,
gfx_ctx_qnx_bind_hw_render
}; };

View File

@ -340,6 +340,12 @@ error:
return NULL; return NULL;
} }
static uint32_t gfx_ctx_cgl_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_cgl = { const gfx_ctx_driver_t gfx_ctx_cgl = {
gfx_ctx_cgl_init, gfx_ctx_cgl_init,
gfx_ctx_cgl_destroy, gfx_ctx_cgl_destroy,
@ -365,5 +371,6 @@ const gfx_ctx_driver_t gfx_ctx_cgl = {
NULL, NULL,
gfx_ctx_cgl_show_mouse, gfx_ctx_cgl_show_mouse,
"cgl", "cgl",
gfx_ctx_cgl_get_flags,
gfx_ctx_cgl_bind_hw_render, gfx_ctx_cgl_bind_hw_render,
}; };

View File

@ -595,6 +595,12 @@ static void cocoagl_gfx_ctx_bind_hw_render(void *data, bool enable)
[g_context makeCurrentContext]; [g_context makeCurrentContext];
} }
static uint32_t cocoagl_gfx_ctx_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_cocoagl = { const gfx_ctx_driver_t gfx_ctx_cocoagl = {
cocoagl_gfx_ctx_init, cocoagl_gfx_ctx_init,
cocoagl_gfx_ctx_destroy, cocoagl_gfx_ctx_destroy,
@ -620,5 +626,6 @@ const gfx_ctx_driver_t gfx_ctx_cocoagl = {
NULL, NULL,
NULL, NULL,
"cocoagl", "cocoagl",
cocoagl_gfx_ctx_get_flags,
cocoagl_gfx_ctx_bind_hw_render, cocoagl_gfx_ctx_bind_hw_render,
}; };

View File

@ -302,6 +302,12 @@ static bool gfx_ctx_d3d_get_metrics(void *data,
return win32_get_metrics(data, type, value); return win32_get_metrics(data, type, value);
} }
static uint32_t gfx_ctx_d3d_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_d3d = { const gfx_ctx_driver_t gfx_ctx_d3d = {
gfx_ctx_d3d_init, gfx_ctx_d3d_init,
gfx_ctx_d3d_destroy, gfx_ctx_d3d_destroy,
@ -327,4 +333,5 @@ const gfx_ctx_driver_t gfx_ctx_d3d = {
NULL, NULL,
gfx_ctx_d3d_show_mouse, gfx_ctx_d3d_show_mouse,
"d3d", "d3d",
gfx_ctx_d3d_get_flags,
}; };

View File

@ -870,6 +870,12 @@ static void gfx_ctx_drm_bind_hw_render(void *data, bool enable)
} }
} }
static uint32_t gfx_ctx_drm_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_drm = { const gfx_ctx_driver_t gfx_ctx_drm = {
gfx_ctx_drm_init, gfx_ctx_drm_init,
gfx_ctx_drm_destroy, gfx_ctx_drm_destroy,
@ -895,5 +901,6 @@ const gfx_ctx_driver_t gfx_ctx_drm = {
NULL, NULL,
NULL, NULL,
"kms", "kms",
gfx_ctx_drm_bind_hw_render, gfx_ctx_drm_get_flags,
gfx_ctx_drm_bind_hw_render
}; };

View File

@ -303,6 +303,12 @@ static void gfx_ctx_emscripten_bind_hw_render(void *data, bool enable)
#endif #endif
} }
static uint32_t gfx_ctx_emscripten_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_emscripten = { const gfx_ctx_driver_t gfx_ctx_emscripten = {
gfx_ctx_emscripten_init, gfx_ctx_emscripten_init,
gfx_ctx_emscripten_destroy, gfx_ctx_emscripten_destroy,
@ -328,5 +334,6 @@ const gfx_ctx_driver_t gfx_ctx_emscripten = {
gfx_ctx_emscripten_write_egl_image, gfx_ctx_emscripten_write_egl_image,
NULL, NULL,
"emscripten", "emscripten",
gfx_ctx_emscripten_bind_hw_render, gfx_ctx_emscripten_get_flags,
gfx_ctx_emscripten_bind_hw_render
}; };

View File

@ -133,6 +133,12 @@ static void *gfx_ctx_null_init(void *video_driver)
return (void*)"null"; return (void*)"null";
} }
static uint32_t gfx_ctx_null_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_null = { const gfx_ctx_driver_t gfx_ctx_null = {
gfx_ctx_null_init, gfx_ctx_null_init,
gfx_ctx_null_destroy, gfx_ctx_null_destroy,
@ -158,6 +164,7 @@ const gfx_ctx_driver_t gfx_ctx_null = {
NULL, NULL,
gfx_ctx_null_show_mouse, gfx_ctx_null_show_mouse,
"null", "null",
gfx_ctx_null_bind_hw_render, gfx_ctx_null_get_flags,
gfx_ctx_null_bind_hw_render
}; };

View File

@ -291,6 +291,12 @@ static void gfx_ctx_mali_fbdev_bind_hw_render(void *data, bool enable)
#endif #endif
} }
static uint32_t gfx_ctx_mali_fbdev_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_mali_fbdev = { const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
gfx_ctx_mali_fbdev_init, gfx_ctx_mali_fbdev_init,
gfx_ctx_mali_fbdev_destroy, gfx_ctx_mali_fbdev_destroy,
@ -316,6 +322,7 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
NULL, NULL,
NULL, NULL,
"mali-fbdev", "mali-fbdev",
gfx_ctx_mali_fbdev_get_flags,
gfx_ctx_mali_fbdev_bind_hw_render gfx_ctx_mali_fbdev_bind_hw_render
}; };

View File

@ -267,6 +267,12 @@ static void gfx_ctx_opendingux_bind_hw_render(void *data, bool enable)
#endif #endif
} }
static uint32_t gfx_ctx_opendingux_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev = { const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev = {
gfx_ctx_opendingux_init, gfx_ctx_opendingux_init,
gfx_ctx_opendingux_destroy, gfx_ctx_opendingux_destroy,
@ -292,5 +298,6 @@ const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev = {
NULL, NULL,
NULL, NULL,
"opendingux-fbdev", "opendingux-fbdev",
gfx_ctx_opendingux_get_flags,
gfx_ctx_opendingux_bind_hw_render gfx_ctx_opendingux_bind_hw_render
}; };

View File

@ -414,6 +414,12 @@ static void gfx_ctx_ps3_get_video_output_next(void *data)
} }
} }
static uint32_t gfx_ctx_ps3_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_ps3 = { const gfx_ctx_driver_t gfx_ctx_ps3 = {
gfx_ctx_ps3_init, gfx_ctx_ps3_init,
gfx_ctx_ps3_destroy, gfx_ctx_ps3_destroy,
@ -439,5 +445,6 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
NULL, NULL,
NULL, NULL,
"ps3", "ps3",
gfx_ctx_ps3_get_flags,
}; };

View File

@ -400,6 +400,12 @@ static void sdl_ctx_show_mouse(void *data, bool state)
SDL_ShowCursor(state); SDL_ShowCursor(state);
} }
static uint32_t sdl_ctx_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_sdl_gl = const gfx_ctx_driver_t gfx_ctx_sdl_gl =
{ {
sdl_ctx_init, sdl_ctx_init,
@ -426,5 +432,6 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl =
NULL, NULL,
sdl_ctx_show_mouse, sdl_ctx_show_mouse,
"sdl_gl", "sdl_gl",
sdl_ctx_get_flags,
NULL /* bind_hw_render */ NULL /* bind_hw_render */
}; };

View File

@ -624,6 +624,12 @@ static gfx_ctx_proc_t gfx_ctx_vc_get_proc_address(const char *symbol)
#endif #endif
} }
static uint32_t gfx_ctx_vc_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_videocore = { const gfx_ctx_driver_t gfx_ctx_videocore = {
gfx_ctx_vc_init, gfx_ctx_vc_init,
gfx_ctx_vc_destroy, gfx_ctx_vc_destroy,
@ -649,5 +655,6 @@ const gfx_ctx_driver_t gfx_ctx_videocore = {
gfx_ctx_vc_image_buffer_write, gfx_ctx_vc_image_buffer_write,
NULL, NULL,
"videocore", "videocore",
gfx_ctx_vc_bind_hw_render, gfx_ctx_vc_get_flags,
gfx_ctx_vc_bind_hw_render
}; };

View File

@ -261,6 +261,12 @@ static void gfx_ctx_vivante_swap_buffers(void *data)
#endif #endif
} }
static uint32_t gfx_ctx_vivante_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = { const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = {
gfx_ctx_vivante_init, gfx_ctx_vivante_init,
gfx_ctx_vivante_destroy, gfx_ctx_vivante_destroy,
@ -286,5 +292,6 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = {
NULL, NULL,
NULL, NULL,
"vivante-fbdev", "vivante-fbdev",
gfx_ctx_vivante_bind_hw_render, gfx_ctx_vivante_get_flags,
gfx_ctx_vivante_bind_hw_render
}; };

View File

@ -1138,6 +1138,12 @@ static void gfx_ctx_wl_bind_hw_render(void *data, bool enable)
} }
} }
static uint32_t gfx_ctx_wl_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_wayland = { const gfx_ctx_driver_t gfx_ctx_wayland = {
gfx_ctx_wl_init, gfx_ctx_wl_init,
gfx_ctx_wl_destroy, gfx_ctx_wl_destroy,
@ -1163,6 +1169,7 @@ const gfx_ctx_driver_t gfx_ctx_wayland = {
NULL, NULL,
NULL, NULL,
"wayland", "wayland",
gfx_ctx_wl_get_flags,
gfx_ctx_wl_bind_hw_render, gfx_ctx_wl_bind_hw_render,
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
gfx_ctx_wl_get_context_data gfx_ctx_wl_get_context_data

View File

@ -448,6 +448,12 @@ static void gfx_ctx_wgl_bind_hw_render(void *data, bool enable)
wglMakeCurrent(g_hdc, enable ? g_hw_hrc : g_hrc); wglMakeCurrent(g_hdc, enable ? g_hw_hrc : g_hrc);
} }
static uint32_t gfx_ctx_wgl_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_wgl = { const gfx_ctx_driver_t gfx_ctx_wgl = {
gfx_ctx_wgl_init, gfx_ctx_wgl_init,
gfx_ctx_wgl_destroy, gfx_ctx_wgl_destroy,
@ -473,6 +479,7 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
NULL, NULL,
gfx_ctx_wgl_show_mouse, gfx_ctx_wgl_show_mouse,
"wgl", "wgl",
gfx_ctx_wgl_bind_hw_render, gfx_ctx_wgl_get_flags,
gfx_ctx_wgl_bind_hw_render
}; };

View File

@ -886,6 +886,12 @@ static void *gfx_ctx_x_get_context_data(void *data)
} }
#endif #endif
static uint32_t gfx_ctx_x_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_x = { const gfx_ctx_driver_t gfx_ctx_x = {
gfx_ctx_x_init, gfx_ctx_x_init,
gfx_ctx_x_destroy, gfx_ctx_x_destroy,
@ -911,6 +917,7 @@ const gfx_ctx_driver_t gfx_ctx_x = {
NULL, NULL,
gfx_ctx_x_show_mouse, gfx_ctx_x_show_mouse,
"x", "x",
gfx_ctx_x_get_flags,
gfx_ctx_x_bind_hw_render, gfx_ctx_x_bind_hw_render,
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN

View File

@ -574,6 +574,12 @@ static gfx_ctx_proc_t gfx_ctx_xegl_get_proc_address(const char *symbol)
return NULL; return NULL;
} }
static uint32_t gfx_ctx_xegl_get_flags(void *data)
{
(void)data;
return GFX_CTX_FLAGS_NONE;
}
const gfx_ctx_driver_t gfx_ctx_x_egl = const gfx_ctx_driver_t gfx_ctx_x_egl =
{ {
gfx_ctx_xegl_init, gfx_ctx_xegl_init,
@ -600,5 +606,6 @@ const gfx_ctx_driver_t gfx_ctx_x_egl =
NULL, NULL,
gfx_ctx_xegl_show_mouse, gfx_ctx_xegl_show_mouse,
"x-egl", "x-egl",
gfx_ctx_xegl_bind_hw_render, gfx_ctx_xegl_get_flags,
gfx_ctx_xegl_bind_hw_render
}; };

View File

@ -52,6 +52,12 @@ enum display_metric_types
DISPLAY_METRIC_DPI DISPLAY_METRIC_DPI
}; };
enum display_flags
{
GFX_CTX_FLAGS_NONE = 0,
GFX_CTX_FLAGS_CORE_GL
};
enum gfx_ctx_ctl_state enum gfx_ctx_ctl_state
{ {
GFX_CTL_NONE = 0, GFX_CTL_NONE = 0,
@ -182,6 +188,8 @@ typedef struct gfx_ctx_driver
/* Human readable string. */ /* Human readable string. */
const char *ident; const char *ident;
uint32_t (*get_flags)(void *data);
/* Optional. Binds HW-render offscreen context. */ /* Optional. Binds HW-render offscreen context. */
void (*bind_hw_render)(void *data, bool enable); void (*bind_hw_render)(void *data, bool enable);