Add parameter to video_context_driver's 'init' function
This commit is contained in:
parent
fad63aa036
commit
1fa3475d79
|
@ -101,7 +101,7 @@ static void android_gfx_ctx_destroy(void *data)
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *android_gfx_ctx_init(void *video_driver)
|
static void *android_gfx_ctx_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OPENGLES
|
#ifdef HAVE_OPENGLES
|
||||||
EGLint n, major, minor;
|
EGLint n, major, minor;
|
||||||
|
|
|
@ -303,7 +303,7 @@ static CGSSurfaceID attach_gl_context_to_window(CGLContextObj glCtx,
|
||||||
return sid;
|
return sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_cgl_init(void *video_driver)
|
static void *gfx_ctx_cgl_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
CGError err;
|
CGError err;
|
||||||
gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)calloc(1, sizeof(gfx_ctx_cgl_data_t));
|
gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)calloc(1, sizeof(gfx_ctx_cgl_data_t));
|
||||||
|
|
|
@ -213,7 +213,7 @@ void cocoagl_gfx_ctx_update(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *cocoagl_gfx_ctx_init(void *video_driver)
|
static void *cocoagl_gfx_ctx_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
(void)video_driver;
|
(void)video_driver;
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ static bool gfx_ctx_d3d_bind_api(void *data,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_d3d_init(void *video_driver)
|
static void *gfx_ctx_d3d_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
win32_monitor_init();
|
win32_monitor_init();
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,7 @@ static void gfx_ctx_drm_destroy_resources(gfx_ctx_drm_data_t *drm)
|
||||||
g_next_bo = NULL;
|
g_next_bo = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_drm_init(void *video_driver)
|
static void *gfx_ctx_drm_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
int fd, i;
|
int fd, i;
|
||||||
unsigned monitor_index;
|
unsigned monitor_index;
|
||||||
|
|
|
@ -121,7 +121,7 @@ static void gfx_ctx_emscripten_destroy(void *data)
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_emscripten_init(void *video_driver)
|
static void *gfx_ctx_emscripten_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
|
|
|
@ -127,7 +127,7 @@ static void gfx_ctx_null_bind_hw_render(void *data, bool enable)
|
||||||
(void)enable;
|
(void)enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_null_init(void *video_driver)
|
static void *gfx_ctx_null_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
(void)video_driver;
|
(void)video_driver;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void gfx_ctx_khr_display_get_video_size(void *data,
|
||||||
*height = khr->height;
|
*height = khr->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_khr_display_init(void *video_driver)
|
static void *gfx_ctx_khr_display_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)calloc(1, sizeof(*khr));
|
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)calloc(1, sizeof(*khr));
|
||||||
if (!khr)
|
if (!khr)
|
||||||
|
|
|
@ -87,7 +87,7 @@ static void gfx_ctx_mali_fbdev_get_video_size(void *data,
|
||||||
*height = mali->height;
|
*height = mali->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_mali_fbdev_init(void *video_driver)
|
static void *gfx_ctx_mali_fbdev_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
EGLint n;
|
EGLint n;
|
||||||
|
|
|
@ -56,7 +56,7 @@ static void gfx_ctx_opendingux_destroy(void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_opendingux_init(void *video_driver)
|
static void *gfx_ctx_opendingux_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
EGLint n;
|
EGLint n;
|
||||||
|
|
|
@ -140,7 +140,7 @@ static void osmesa_fifo_write(gfx_ctx_osmesa_data_t *osmesa)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *osmesa_ctx_init(void *video_driver)
|
static void *osmesa_ctx_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OSMESA_CREATE_CONTEXT_ATTRIBS
|
#ifdef HAVE_OSMESA_CREATE_CONTEXT_ATTRIBS
|
||||||
const int attribs[] = {
|
const int attribs[] = {
|
||||||
|
|
|
@ -225,7 +225,7 @@ static void gfx_ctx_ps3_get_video_size(void *data,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_ps3_init(void *video_driver)
|
static void *gfx_ctx_ps3_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PSGL
|
#ifdef HAVE_PSGL
|
||||||
PSGLdeviceParameters params;
|
PSGLdeviceParameters params;
|
||||||
|
|
|
@ -72,7 +72,7 @@ static void gfx_ctx_qnx_destroy(void *data)
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_qnx_init(void *video_driver)
|
static void *gfx_ctx_qnx_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
EGLint n;
|
EGLint n;
|
||||||
EGLint major, minor;
|
EGLint major, minor;
|
||||||
|
|
|
@ -73,7 +73,7 @@ static void sdl_ctx_destroy_resources(gfx_ctx_sdl_data_t *sdl)
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *sdl_ctx_init(void *video_driver)
|
static void *sdl_ctx_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)
|
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)
|
||||||
calloc(1, sizeof(gfx_ctx_sdl_data_t));
|
calloc(1, sizeof(gfx_ctx_sdl_data_t));
|
||||||
|
|
|
@ -157,7 +157,7 @@ static void gfx_ctx_vc_get_video_size(void *data,
|
||||||
|
|
||||||
static void gfx_ctx_vc_destroy(void *data);
|
static void gfx_ctx_vc_destroy(void *data);
|
||||||
|
|
||||||
static void *gfx_ctx_vc_init(void *video_driver)
|
static void *gfx_ctx_vc_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
VC_DISPMANX_ALPHA_T alpha;
|
VC_DISPMANX_ALPHA_T alpha;
|
||||||
EGLint n, major, minor;
|
EGLint n, major, minor;
|
||||||
|
|
|
@ -58,7 +58,7 @@ static void gfx_ctx_vivante_destroy(void *data)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_vivante_init(void *video_driver)
|
static void *gfx_ctx_vivante_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
EGLint n;
|
EGLint n;
|
||||||
|
|
|
@ -780,7 +780,7 @@ static bool gfx_ctx_wl_get_metrics(void *data,
|
||||||
EGL_DEPTH_SIZE, 0
|
EGL_DEPTH_SIZE, 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void *gfx_ctx_wl_init(void *video_driver)
|
static void *gfx_ctx_wl_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
static const EGLint egl_attribs_gl[] = {
|
static const EGLint egl_attribs_gl[] = {
|
||||||
|
|
|
@ -426,7 +426,7 @@ static void gfx_ctx_wgl_get_video_size(void *data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_wgl_init(void *video_driver)
|
static void *gfx_ctx_wgl_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
WNDCLASSEX wndclass = {0};
|
WNDCLASSEX wndclass = {0};
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ static bool gfx_ctx_x_set_resize(void *data,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_x_init(void *data)
|
static void *gfx_ctx_x_init(video_frame_info_t video_info, void *data)
|
||||||
{
|
{
|
||||||
int nelements = 0;
|
int nelements = 0;
|
||||||
int major = 0;
|
int major = 0;
|
||||||
|
|
|
@ -101,7 +101,7 @@ static bool gfx_ctx_xegl_set_resize(void *data,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *gfx_ctx_xegl_init(void *video_driver)
|
static void *gfx_ctx_xegl_init(video_frame_info_t video_info, void *video_driver)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
static const EGLint egl_attribs_gl[] = {
|
static const EGLint egl_attribs_gl[] = {
|
||||||
|
|
|
@ -183,15 +183,19 @@ static const gfx_ctx_driver_t *video_context_driver_init(
|
||||||
{
|
{
|
||||||
if (ctx->bind_api(data, api, major, minor))
|
if (ctx->bind_api(data, api, major, minor))
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
video_frame_info_t video_info;
|
||||||
void *ctx_data = ctx->init(data);
|
void *ctx_data = NULL;
|
||||||
|
|
||||||
|
video_driver_build_info(&video_info);
|
||||||
|
|
||||||
|
ctx_data = ctx->init(video_info, data);
|
||||||
|
|
||||||
if (!ctx_data)
|
if (!ctx_data)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (ctx->bind_hw_render)
|
if (ctx->bind_hw_render)
|
||||||
ctx->bind_hw_render(ctx_data,
|
ctx->bind_hw_render(ctx_data,
|
||||||
settings->video.shared_context && hw_render_ctx);
|
video_info.shared_context && hw_render_ctx);
|
||||||
|
|
||||||
video_context_driver_set_data(ctx_data);
|
video_context_driver_set_data(ctx_data);
|
||||||
return ctx;
|
return ctx;
|
||||||
|
|
|
@ -66,7 +66,7 @@ typedef struct gfx_ctx_driver
|
||||||
* to hold a pointer to it as the context never outlives the video driver.
|
* to hold a pointer to it as the context never outlives the video driver.
|
||||||
*
|
*
|
||||||
* The context driver is responsible for it's own data.*/
|
* The context driver is responsible for it's own data.*/
|
||||||
void* (*init)(void *video_driver);
|
void* (*init)(video_frame_info_t video_info, void *video_driver);
|
||||||
void (*destroy)(void *data);
|
void (*destroy)(void *data);
|
||||||
|
|
||||||
/* Which API to bind to. */
|
/* Which API to bind to. */
|
||||||
|
|
|
@ -2205,6 +2205,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||||
video_info->max_swapchain_images = settings->video.max_swapchain_images;
|
video_info->max_swapchain_images = settings->video.max_swapchain_images;
|
||||||
video_info->windowed_fullscreen = settings->video.windowed_fullscreen;
|
video_info->windowed_fullscreen = settings->video.windowed_fullscreen;
|
||||||
video_info->monitor_index = settings->video.monitor_index;
|
video_info->monitor_index = settings->video.monitor_index;
|
||||||
|
video_info->shared_context = settings->video.shared_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,6 +88,7 @@ typedef struct video_info
|
||||||
typedef struct video_frame_info
|
typedef struct video_frame_info
|
||||||
{
|
{
|
||||||
float refresh_rate;
|
float refresh_rate;
|
||||||
|
bool shared_context;
|
||||||
bool black_frame_insertion;
|
bool black_frame_insertion;
|
||||||
bool hard_sync;
|
bool hard_sync;
|
||||||
unsigned hard_sync_frames;
|
unsigned hard_sync_frames;
|
||||||
|
|
Loading…
Reference in New Issue