Previously, GPU Hard Sync options would only show up if the

video driver was explicitly set to the GL driver; now, it can be
dynamically shown for more video drivers if there are going to be
more drivers supporting this feature other than GL
This commit is contained in:
twinaphex 2018-04-23 13:42:09 +02:00
parent c4c8699ee3
commit f1fa1d4879
3 changed files with 56 additions and 33 deletions

View File

@ -2600,8 +2600,18 @@ static void gl_set_mvp(void *data, void *shader_data,
shader_data, mat_data);
}
static uint32_t gl_get_flags(void *data)
{
uint32_t flags = 0;
if (gl_check_capability(GL_CAPS_SYNC))
BIT32_SET(flags, GFX_CTX_FLAGS_HARD_SYNC);
return flags;
}
static const video_poke_interface_t gl_poke_interface = {
NULL, /* get_flags */
gl_get_flags,
gl_set_coords,
gl_set_mvp,
gl_load_texture,

View File

@ -113,7 +113,8 @@ enum display_flags
GFX_CTX_FLAGS_NONE = 0,
GFX_CTX_FLAGS_GL_CORE_CONTEXT,
GFX_CTX_FLAGS_MULTISAMPLING,
GFX_CTX_FLAGS_CUSTOMIZABLE_SWAPCHAIN_IMAGES
GFX_CTX_FLAGS_CUSTOMIZABLE_SWAPCHAIN_IMAGES,
GFX_CTX_FLAGS_HARD_SYNC
};
enum shader_uniform_type

View File

@ -3608,42 +3608,54 @@ static bool setting_append_list(
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"))
{
CONFIG_BOOL(
list, list_info,
&settings->bools.video_hard_sync,
MENU_ENUM_LABEL_VIDEO_HARD_SYNC,
MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC,
hard_sync,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE
);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
gfx_ctx_flags_t flags;
bool hard_sync_supported = false;
CONFIG_UINT(
list, list_info,
&settings->uints.video_hard_sync_frames,
MENU_ENUM_LABEL_VIDEO_HARD_SYNC_FRAMES,
MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC_FRAMES,
hard_sync_frames,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 0, 3, 1, true, true);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
if (video_driver_get_flags(&flags))
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_HARD_SYNC))
hard_sync_supported = true;
flags.flags = 0;
if (video_context_driver_get_flags(&flags))
if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_HARD_SYNC))
hard_sync_supported = true;
if (hard_sync_supported)
{
CONFIG_BOOL(
list, list_info,
&settings->bools.video_hard_sync,
MENU_ENUM_LABEL_VIDEO_HARD_SYNC,
MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC,
hard_sync,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE
);
CONFIG_UINT(
list, list_info,
&settings->uints.video_hard_sync_frames,
MENU_ENUM_LABEL_VIDEO_HARD_SYNC_FRAMES,
MENU_ENUM_LABEL_VALUE_VIDEO_HARD_SYNC_FRAMES,
hard_sync_frames,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 0, 3, 1, true, true);
}
}
CONFIG_UINT(