Only show max swapchain images if supported by video driver and/or

context driver
This commit is contained in:
twinaphex 2018-04-23 13:34:30 +02:00
parent 6f4fd8859a
commit c4c8699ee3
29 changed files with 89 additions and 20 deletions

View File

@ -305,6 +305,7 @@ static void caca_set_osd_msg(void *data,
}
static const video_poke_interface_t caca_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -1133,6 +1133,7 @@ static void ctr_set_osd_msg(void *data,
}
static const video_poke_interface_t ctr_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
ctr_load_texture,

View File

@ -1584,6 +1584,7 @@ d3d10_get_hw_render_interface(void* data, const struct retro_hw_render_interface
#endif
static const video_poke_interface_t d3d10_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
d3d10_gfx_load_texture,

View File

@ -1605,6 +1605,7 @@ d3d11_get_hw_render_interface(void* data, const struct retro_hw_render_interface
}
static const video_poke_interface_t d3d11_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
d3d11_gfx_load_texture,

View File

@ -1751,6 +1751,7 @@ static void d3d12_gfx_unload_texture(void* data, uintptr_t handle)
}
static const video_poke_interface_t d3d12_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
d3d12_gfx_load_texture,

View File

@ -1861,7 +1861,8 @@ static void d3d8_set_video_mode(void *data,
}
static const video_poke_interface_t d3d_poke_interface = {
NULL, /* set_coords */
NULL, /* get_flags */
NULL, /* set_coords */
d3d8_set_mvp,
d3d8_load_texture,
d3d8_unload_texture,

View File

@ -1887,6 +1887,7 @@ static void d3d9_set_video_mode(void *data,
}
static const video_poke_interface_t d3d9_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
d3d9_set_mvp,
d3d9_load_texture,

View File

@ -631,6 +631,7 @@ static void dispmanx_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
}
static const video_poke_interface_t dispmanx_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -966,6 +966,7 @@ static void drm_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
}
static const video_poke_interface_t drm_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -1490,6 +1490,7 @@ static void exynos_show_mouse(void *data, bool state)
}
static const video_poke_interface_t exynos_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -533,6 +533,7 @@ static void gdi_set_video_mode(void *data, unsigned width, unsigned height,
}
static const video_poke_interface_t gdi_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -2601,6 +2601,7 @@ static void gl_set_mvp(void *data, void *shader_data,
}
static const video_poke_interface_t gl_poke_interface = {
NULL, /* get_flags */
gl_set_coords,
gl_set_mvp,
gl_load_texture,

View File

@ -1711,8 +1711,8 @@ static void wiiu_gfx_set_osd_msg(void *data,
}
static const video_poke_interface_t wiiu_poke_interface =
{
static const video_poke_interface_t wiiu_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
wiiu_gfx_load_texture,

View File

@ -1266,6 +1266,7 @@ static void gx_get_video_output_next(void *data)
}
static const video_poke_interface_t gx_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -1140,6 +1140,7 @@ static float omap_get_refresh_rate(void *data)
}
static const video_poke_interface_t omap_gfx_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -831,6 +831,7 @@ static void psp_viewport_info(void *data, struct video_viewport *vp)
}
static const video_poke_interface_t psp_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -721,6 +721,7 @@ static void sdl2_grab_mouse_toggle(void *data)
}
static video_poke_interface_t sdl2_video_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -517,6 +517,7 @@ static void sdl_grab_mouse_toggle(void *data)
}
static const video_poke_interface_t sdl_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -943,6 +943,7 @@ static float sunxi_get_refresh_rate (void *data)
}
static const video_poke_interface_t sunxi_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -387,6 +387,7 @@ static void switch_set_texture_enable(void *data, bool enable, bool full_screen)
}
static const video_poke_interface_t switch_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL, /* load_texture */

View File

@ -390,6 +390,7 @@ static void vga_set_osd_msg(void *data,
}
static const video_poke_interface_t vga_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -790,6 +790,7 @@ static bool vita_get_current_sw_framebuffer(void *data,
}
static const video_poke_interface_t vita_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
vita_load_texture,

View File

@ -2302,7 +2302,17 @@ static float vulkan_get_refresh_rate(void *data)
return 0.0f;
}
static uint32_t vulkan_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_CUSTOMIZABLE_SWAPCHAIN_IMAGES);
return flags;
}
static const video_poke_interface_t vulkan_poke_interface = {
vulkan_get_flags,
NULL, /* set_coords */
NULL, /* set_mvp */
vulkan_load_texture,

View File

@ -204,6 +204,7 @@ static void xshm_grab_mouse_toggle(void *data)
}
static video_poke_interface_t xshm_video_poke_interface = {
NULL, /* get_flags */
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,

View File

@ -934,6 +934,7 @@ static bool xv_read_viewport(void *data, uint8_t *buffer, bool is_idle)
}
static video_poke_interface_t xv_video_poke_interface = {
NULL, /* get_flags */
NULL,
NULL,
NULL,

View File

@ -3280,11 +3280,17 @@ void video_context_driver_set_data(void *data)
video_context_data = data;
}
bool video_driver_get_flags(gfx_ctx_flags_t *flags)
{
if (!flags || !video_driver_poke || !video_driver_poke->get_flags)
return false;
flags->flags = video_driver_poke->get_flags(video_driver_data);
return true;
}
bool video_context_driver_get_flags(gfx_ctx_flags_t *flags)
{
if (!flags)
return false;
if (!current_video_context.get_flags)
if (!flags || !current_video_context.get_flags)
return false;
if (deferred_video_context_driver_set_flags)

View File

@ -694,6 +694,7 @@ struct aspect_ratio_elem
typedef struct video_poke_interface
{
uint32_t (*get_flags)(void *data);
void (*set_coords)(void *handle_data, void *shader_data,
const struct video_coords *coords);
void (*set_mvp)(void *data, void *shader_data,
@ -1285,6 +1286,8 @@ bool video_context_driver_show_mouse(bool *bool_data);
void video_context_driver_set_data(void *data);
bool video_driver_get_flags(gfx_ctx_flags_t *flags);
bool video_context_driver_get_flags(gfx_ctx_flags_t *flags);
bool video_context_driver_set_flags(gfx_ctx_flags_t *flags);

View File

@ -1252,7 +1252,16 @@ static struct video_shader *thread_get_current_shader(void *data)
return thr->poke->get_current_shader(thr->driver_data);
}
static uint32_t thread_get_flags(void *data)
{
thread_video_t *thr = (thread_video_t*)data;
if (!thr || !thr->poke || !thr->poke->get_flags)
return 0;
return thr->poke->get_flags(thr->driver_data);
}
static const video_poke_interface_t thread_poke = {
thread_get_flags,
NULL, /* set_coords */
NULL, /* set_mvp */
thread_load_texture,

View File

@ -3579,20 +3579,38 @@ static bool setting_append_list(
settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_UINT(
list, list_info,
&settings->uints.video_max_swapchain_images,
MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES,
MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES,
max_swapchain_images,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 1, 4, 1, true, true);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
{
gfx_ctx_flags_t flags;
bool customizable_swapchain_set = false;
if (video_driver_get_flags(&flags))
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_CUSTOMIZABLE_SWAPCHAIN_IMAGES))
customizable_swapchain_set = true;
flags.flags = 0;
if (video_context_driver_get_flags(&flags))
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_CUSTOMIZABLE_SWAPCHAIN_IMAGES))
customizable_swapchain_set = true;
if (customizable_swapchain_set)
{
CONFIG_UINT(
list, list_info,
&settings->uints.video_max_swapchain_images,
MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES,
MENU_ENUM_LABEL_VALUE_VIDEO_MAX_SWAPCHAIN_IMAGES,
max_swapchain_images,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 1, 4, 1, true, true);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
}
}
if (string_is_equal(settings->arrays.video_driver, "gl"))
{