Add option for showing the overlay behind the menu (#13360)

* Add option for showing the overlay behind the menu

This commit lays the groundwork for this option. Support for this option
in the video drivers themselves is going to be added in later commits.

* gl1: Add overlay behind menu support

* gl2: Add overlay behind menu support

* gl3: Add overlay behind menu support

* vulkan: Add overlay behind menu support

* ctr: Add overlay behind menu support

* d3d9: Add overlay behind menu support

* d3d10: Add overlay behind menu support

* d3d11: Add overlay behind menu support

* d3d12: Add overlay behind menu support

* CHANGES.md: overlay behind menu

Co-authored-by: MrHuu <MrHuu@users.noreply.github.com>
Co-authored-by: Tony <45124675+sonninnos@users.noreply.github.com>
This commit is contained in:
Nikos Chantziaras 2021-12-26 05:56:44 +02:00 committed by GitHub
parent 22df09885e
commit be650a790c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 236 additions and 81 deletions

View file

@ -1,6 +1,7 @@
# Future
- LINUX: Added support for Linux GameMode (https://github.com/FeralInteractive/gamemode), which can be toggled on/off in the Power Management or Latency settings menus.
- Added a hotkey toggle for the on-screen technical statistics.
- Added support for showing the overlay behind the menu instead of in front. This is currently only supported on the GL, Vulkan, D3D 9/10/11/12 and 3DS drivers.
# 1.9.14
- ANDROID/PLAYSTORE: Implement MANAGE_EXTERNAL_STORAGE permission

View file

@ -497,6 +497,8 @@
/* Initialise file browser with the last used start directory */
#define DEFAULT_USE_LAST_START_DIRECTORY false
#define DEFAULT_OVERLAY_BEHIND_MENU false
#define DEFAULT_OVERLAY_HIDE_IN_MENU true
/* Automatically disable overlays when a

View file

@ -1907,6 +1907,7 @@ static struct config_bool_setting *populate_settings_bool(
#ifdef HAVE_OVERLAY
SETTING_BOOL("input_overlay_enable", &settings->bools.input_overlay_enable, true, config_overlay_enable_default(), false);
SETTING_BOOL("input_overlay_enable_autopreferred", &settings->bools.input_overlay_enable_autopreferred, true, DEFAULT_OVERLAY_ENABLE_AUTOPREFERRED, false);
SETTING_BOOL("input_overlay_behind_menu", &settings->bools.input_overlay_behind_menu, true, DEFAULT_OVERLAY_BEHIND_MENU, false);
SETTING_BOOL("input_overlay_hide_in_menu", &settings->bools.input_overlay_hide_in_menu, true, DEFAULT_OVERLAY_HIDE_IN_MENU, false);
SETTING_BOOL("input_overlay_hide_when_gamepad_connected", &settings->bools.input_overlay_hide_when_gamepad_connected, true, DEFAULT_OVERLAY_HIDE_WHEN_GAMEPAD_CONNECTED, false);
SETTING_BOOL("input_overlay_show_mouse_cursor", &settings->bools.input_overlay_show_mouse_cursor, true, DEFAULT_OVERLAY_SHOW_MOUSE_CURSOR, false);

View file

@ -591,6 +591,7 @@ typedef struct settings
bool input_sensors_enable;
bool input_overlay_enable;
bool input_overlay_enable_autopreferred;
bool input_overlay_behind_menu;
bool input_overlay_hide_in_menu;
bool input_overlay_hide_when_gamepad_connected;
bool input_overlay_show_mouse_cursor;

View file

@ -1258,6 +1258,7 @@ static bool ctr_frame(void* data, const void* frame,
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
#endif
bool overlay_behind_menu = video_info->overlay_behind_menu;
bool lcd_bottom = false;
if (!width || !height || !settings)
@ -1563,6 +1564,11 @@ static bool ctr_frame(void* data, const void* frame,
GPU_SetTexEnv(2, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
}
#ifdef HAVE_OVERLAY
if (ctr->overlay_enabled && overlay_behind_menu)
ctr_render_overlay(ctr);
#endif
#ifdef HAVE_MENU
if (ctr->menu_texture_enable)
{
@ -1610,7 +1616,7 @@ static bool ctr_frame(void* data, const void* frame,
#endif
#ifdef HAVE_OVERLAY
if (ctr->overlay_enabled)
if (ctr->overlay_enabled && !overlay_behind_menu)
ctr_render_overlay(ctr);
#endif
@ -2290,6 +2296,8 @@ static uint32_t ctr_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED);
return flags;
}

View file

@ -236,6 +236,31 @@ static void d3d10_get_overlay_interface(void* data, const video_overlay_interfac
*iface = &overlay_interface;
}
static void d3d10_render_overlay(void *data)
{
unsigned i;
d3d10_video_t* d3d10 = (d3d10_video_t*)data;
if (!d3d10)
return;
if (d3d10->overlays.fullscreen)
D3D10SetViewports(d3d10->device, 1, &d3d10->viewport);
else
D3D10SetViewports(d3d10->device, 1, &d3d10->frame.viewport);
D3D10SetBlendState(d3d10->device, d3d10->blend_enable, NULL, D3D10_DEFAULT_SAMPLE_MASK);
D3D10SetVertexBuffer(d3d10->device, 0, d3d10->overlays.vbo, sizeof(d3d10_sprite_t), 0);
D3D10SetPShaderSamplers(
d3d10->device, 0, 1, &d3d10->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]);
for (i = 0; i < (unsigned)d3d10->overlays.count; i++)
{
D3D10SetPShaderResources(d3d10->device, 0, 1, &d3d10->overlays.textures[i].view);
D3D10Draw(d3d10->device, 1, i);
}
}
#endif
static void d3d10_set_filtering(void* data, unsigned index, bool smooth, bool ctx_scaling)
@ -1224,6 +1249,7 @@ static bool d3d10_gfx_frame(
&video_info->osd_stat_params;
const char *stat_text = video_info->stat_text;
bool menu_is_alive = video_info->menu_is_alive;
bool overlay_behind_menu = video_info->overlay_behind_menu;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
#endif
@ -1479,6 +1505,11 @@ static bool d3d10_gfx_frame(
d3d10->sprites.enabled = true;
#ifdef HAVE_OVERLAY
if (d3d10->overlays.enabled && overlay_behind_menu)
d3d10_render_overlay(d3d10);
#endif
#ifdef HAVE_MENU
#ifndef HAVE_GFX_WIDGETS
if (d3d10->menu.enabled)
@ -1508,24 +1539,8 @@ static bool d3d10_gfx_frame(
}
#ifdef HAVE_OVERLAY
if (d3d10->overlays.enabled)
{
if (d3d10->overlays.fullscreen)
D3D10SetViewports(context, 1, &d3d10->viewport);
else
D3D10SetViewports(context, 1, &d3d10->frame.viewport);
D3D10SetBlendState(d3d10->device, d3d10->blend_enable, NULL, D3D10_DEFAULT_SAMPLE_MASK);
D3D10SetVertexBuffer(context, 0, d3d10->overlays.vbo, sizeof(d3d10_sprite_t), 0);
D3D10SetPShaderSamplers(
context, 0, 1, &d3d10->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]);
for (i = 0; i < (unsigned)d3d10->overlays.count; i++)
{
D3D10SetPShaderResources(context, 0, 1, &d3d10->overlays.textures[i].view);
D3D10Draw(d3d10->device, 1, i);
}
}
if (d3d10->overlays.enabled && !overlay_behind_menu)
d3d10_render_overlay(d3d10);
#endif
#ifdef HAVE_GFX_WIDGETS
@ -1741,6 +1756,7 @@ static uint32_t d3d10_get_flags(void *data)
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING);
BIT32_SET(flags, GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED);
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif

View file

@ -83,6 +83,7 @@ static uint32_t d3d11_get_flags(void *data)
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING);
BIT32_SET(flags, GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED);
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
@ -260,6 +261,31 @@ static void d3d11_get_overlay_interface(
*iface = &overlay_interface;
}
static void d3d11_render_overlay(void *data)
{
unsigned i;
d3d11_video_t* d3d11 = (d3d11_video_t*)data;
if (!d3d11)
return;
if (d3d11->overlays.fullscreen)
D3D11SetViewports(d3d11->context, 1, &d3d11->viewport);
else
D3D11SetViewports(d3d11->context, 1, &d3d11->frame.viewport);
D3D11SetBlendState(d3d11->context, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
D3D11SetVertexBuffer(d3d11->context, 0, d3d11->overlays.vbo, sizeof(d3d11_sprite_t), 0);
D3D11SetPShaderSamplers(
d3d11->context, 0, 1, &d3d11->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]);
for (i = 0; i < (unsigned)d3d11->overlays.count; i++)
{
D3D11SetPShaderResources(d3d11->context, 0, 1, &d3d11->overlays.textures[i].view);
D3D11Draw(d3d11->context, 1, i);
}
}
#endif
#ifdef HAVE_DXGI_HDR
@ -1737,6 +1763,7 @@ static bool d3d11_gfx_frame(
bool statistics_show = video_info->statistics_show;
struct font_params* osd_params = (struct font_params*)&video_info->osd_stat_params;
bool menu_is_alive = video_info->menu_is_alive;
bool overlay_behind_menu = video_info->overlay_behind_menu;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
#endif
@ -2073,6 +2100,21 @@ static bool d3d11_gfx_frame(
D3D11SetVertexBuffer(context, 0, d3d11->sprites.vbo, sizeof(d3d11_sprite_t), 0);
d3d11->sprites.enabled = true;
#ifdef HAVE_OVERLAY
if (d3d11->overlays.enabled && overlay_behind_menu)
d3d11_render_overlay(d3d11);
#endif
#ifdef HAVE_MENU
#ifndef HAVE_GFX_WIDGETS
if (d3d11->menu.enabled)
#endif
{
D3D11SetViewports(context, 1, &d3d11->viewport);
D3D11SetVertexBuffer(context, 0, d3d11->sprites.vbo, sizeof(d3d11_sprite_t), 0);
}
#endif
#ifdef HAVE_MENU
if (d3d11->menu.enabled)
menu_driver_frame(menu_is_alive, video_info);
@ -2092,24 +2134,8 @@ static bool d3d11_gfx_frame(
}
#ifdef HAVE_OVERLAY
if (d3d11->overlays.enabled)
{
if (d3d11->overlays.fullscreen)
D3D11SetViewports(context, 1, &d3d11->viewport);
else
D3D11SetViewports(context, 1, &d3d11->frame.viewport);
D3D11SetBlendState(d3d11->context, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
D3D11SetVertexBuffer(context, 0, d3d11->overlays.vbo, sizeof(d3d11_sprite_t), 0);
D3D11SetPShaderSamplers(
context, 0, 1, &d3d11->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]);
for (i = 0; i < (unsigned)d3d11->overlays.count; i++)
{
D3D11SetPShaderResources(context, 0, 1, &d3d11->overlays.textures[i].view);
D3D11Draw(d3d11->context, 1, i);
}
}
if (d3d11->overlays.enabled && !overlay_behind_menu)
d3d11_render_overlay(d3d11);
#endif
#ifdef HAVE_GFX_WIDGETS

View file

@ -243,6 +243,51 @@ static void d3d12_get_overlay_interface(void* data, const video_overlay_interfac
*iface = &overlay_interface;
}
static void d3d12_render_overlay(void* data)
{
unsigned i;
d3d12_video_t* d3d12 = (d3d12_video_t*)data;
if (!d3d12)
return;
if (d3d12->overlays.fullscreen)
{
D3D12RSSetViewports(d3d12->queue.cmd, 1,
&d3d12->chain.viewport);
D3D12RSSetScissorRects(d3d12->queue.cmd, 1,
&d3d12->chain.scissorRect);
}
else
{
D3D12RSSetViewports(d3d12->queue.cmd, 1,
&d3d12->frame.viewport);
D3D12RSSetScissorRects(d3d12->queue.cmd, 1,
&d3d12->frame.scissorRect);
}
D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1,
&d3d12->overlays.vbo_view);
D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe_blend);
D3D12SetGraphicsRootDescriptorTable(
d3d12->queue.cmd, ROOT_ID_SAMPLER_T,
d3d12->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]);
for (i = 0; i < (unsigned)d3d12->overlays.count; i++)
{
if (d3d12->overlays.textures[i].dirty)
d3d12_upload_texture(d3d12->queue.cmd,
&d3d12->overlays.textures[i],
d3d12);
D3D12SetGraphicsRootDescriptorTable(
d3d12->queue.cmd, ROOT_ID_TEXTURE_T,
d3d12->overlays.textures[i].gpu_descriptor[0]);
D3D12DrawInstanced(d3d12->queue.cmd, 1, 1, i, 0);
}
}
#endif
#ifdef HAVE_DXGI_HDR
@ -1403,6 +1448,7 @@ static bool d3d12_gfx_frame(
struct font_params *osd_params = (struct font_params*)
&video_info->osd_stat_params;
bool menu_is_alive = video_info->menu_is_alive;
bool overlay_behind_menu = video_info->overlay_behind_menu;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
#endif
@ -1880,6 +1926,11 @@ static bool d3d12_gfx_frame(
d3d12->sprites.enabled = true;
#ifdef HAVE_OVERLAY
if (d3d12->overlays.enabled && overlay_behind_menu)
d3d12_render_overlay(d3d12);
#endif
#ifdef HAVE_MENU
#ifndef HAVE_GFX_WIDGETS
if (d3d12->menu.enabled)
@ -1916,44 +1967,8 @@ static bool d3d12_gfx_frame(
}
}
#ifdef HAVE_OVERLAY
if (d3d12->overlays.enabled)
{
if (d3d12->overlays.fullscreen)
{
D3D12RSSetViewports(d3d12->queue.cmd, 1,
&d3d12->chain.viewport);
D3D12RSSetScissorRects(d3d12->queue.cmd, 1,
&d3d12->chain.scissorRect);
}
else
{
D3D12RSSetViewports(d3d12->queue.cmd, 1,
&d3d12->frame.viewport);
D3D12RSSetScissorRects(d3d12->queue.cmd, 1,
&d3d12->frame.scissorRect);
}
D3D12IASetVertexBuffers(d3d12->queue.cmd, 0, 1,
&d3d12->overlays.vbo_view);
D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe_blend);
D3D12SetGraphicsRootDescriptorTable(
d3d12->queue.cmd, ROOT_ID_SAMPLER_T,
d3d12->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]);
for (i = 0; i < (unsigned)d3d12->overlays.count; i++)
{
if (d3d12->overlays.textures[i].dirty)
d3d12_upload_texture(d3d12->queue.cmd,
&d3d12->overlays.textures[i],
d3d12);
D3D12SetGraphicsRootDescriptorTable(
d3d12->queue.cmd, ROOT_ID_TEXTURE_T,
d3d12->overlays.textures[i].gpu_descriptor[0]);
D3D12DrawInstanced(d3d12->queue.cmd, 1, 1, i, 0);
}
}
if (d3d12->overlays.enabled && !overlay_behind_menu)
d3d12_render_overlay(d3d12);
#endif
#ifdef HAVE_GFX_WIDGETS
@ -2248,6 +2263,7 @@ static uint32_t d3d12_get_flags(void *data)
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING);
BIT32_SET(flags, GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED);
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif

View file

@ -1519,6 +1519,7 @@ static bool d3d9_frame(void *data, const void *frame,
&video_info->osd_stat_params;
const char *stat_text = video_info->stat_text;
bool menu_is_alive = video_info->menu_is_alive;
bool overlay_behind_menu = video_info->overlay_behind_menu;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
#endif
@ -1583,6 +1584,15 @@ static bool d3d9_frame(void *data, const void *frame,
}
}
#ifdef HAVE_OVERLAY
if (d3d->overlays_enabled && overlay_behind_menu)
{
d3d9_set_mvp(d3d->dev, &d3d->mvp_transposed);
for (i = 0; i < d3d->overlays_size; i++)
d3d9_overlay_render(d3d, width, height, &d3d->overlays[i], true);
}
#endif
#ifdef HAVE_MENU
if (d3d->menu && d3d->menu->enabled)
{
@ -1610,7 +1620,7 @@ static bool d3d9_frame(void *data, const void *frame,
#endif
#ifdef HAVE_OVERLAY
if (d3d->overlays_enabled)
if (d3d->overlays_enabled && !overlay_behind_menu)
{
d3d9_set_mvp(d3d->dev, &d3d->mvp_transposed);
for (i = 0; i < d3d->overlays_size; i++)

View file

@ -718,6 +718,7 @@ static bool gl1_gfx_frame(void *data, const void *frame,
bool hard_sync = video_info->hard_sync;
struct font_params *osd_params = (struct font_params*)
&video_info->osd_stat_params;
bool overlay_behind_menu = video_info->overlay_behind_menu;
/* FIXME: Force these settings off as they interfere with the rendering */
video_info->xmb_shadows_enable = false;
@ -867,6 +868,11 @@ static bool gl1_gfx_frame(void *data, const void *frame,
}
}
#ifdef HAVE_OVERLAY
if (gl1->overlay_enable && overlay_behind_menu)
gl1_render_overlay(gl1, video_width, video_height);
#endif
if (gl1->menu_texture_enable){
do_swap = true;
#ifdef VITA
@ -904,7 +910,7 @@ static bool gl1_gfx_frame(void *data, const void *frame,
#endif
#ifdef HAVE_OVERLAY
if (gl1->overlay_enable)
if (gl1->overlay_enable && !overlay_behind_menu)
gl1_render_overlay(gl1, video_width, video_height);
#endif
@ -1429,6 +1435,7 @@ static uint32_t gl1_get_flags(void *data)
BIT32_SET(flags, GFX_CTX_FLAGS_HARD_SYNC);
BIT32_SET(flags, GFX_CTX_FLAGS_BLACK_FRAME_INSERTION);
BIT32_SET(flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING);
BIT32_SET(flags, GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED);
return flags;
}

View file

@ -2841,6 +2841,7 @@ static bool gl2_frame(void *data, const void *frame,
bool runloop_is_slowmotion = video_info->runloop_is_slowmotion;
bool runloop_is_paused = video_info->runloop_is_paused;
#endif
bool overlay_behind_menu = video_info->overlay_behind_menu;
if (!gl)
return false;
@ -3046,6 +3047,12 @@ static bool gl2_frame(void *data, const void *frame,
#ifdef HAVE_VIDEO_LAYOUT
gl2_video_layout_render(gl);
#endif
#ifdef HAVE_OVERLAY
if (gl->overlay_enable && overlay_behind_menu)
gl2_render_overlay(gl);
#endif
#if defined(HAVE_MENU)
if (gl->menu_texture_enable)
{
@ -3063,7 +3070,7 @@ static bool gl2_frame(void *data, const void *frame,
#endif
#ifdef HAVE_OVERLAY
if (gl->overlay_enable)
if (gl->overlay_enable && !overlay_behind_menu)
gl2_render_overlay(gl);
#endif
@ -4573,6 +4580,7 @@ static uint32_t gl2_get_flags(void *data)
BIT32_SET(flags, GFX_CTX_FLAGS_BLACK_FRAME_INSERTION);
BIT32_SET(flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING);
BIT32_SET(flags, GFX_CTX_FLAGS_SCREENSHOTS_SUPPORTED);
BIT32_SET(flags, GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED);
return flags;
}

View file

@ -1876,6 +1876,7 @@ static bool gl3_frame(void *data, const void *frame,
bool widgets_active = video_info->widgets_active;
#endif
bool hard_sync = video_info->hard_sync;
bool overlay_behind_menu = video_info->overlay_behind_menu;
if (!gl)
return false;
@ -1949,6 +1950,11 @@ static bool gl3_frame(void *data, const void *frame,
gl->hw_render_bottom_left ? gl->mvp.data : gl->mvp_yflip.data);
gl3_filter_chain_end_frame(gl->filter_chain);
#ifdef HAVE_OVERLAY
if (gl->overlay_enable && overlay_behind_menu)
gl3_render_overlay(gl, width, height);
#endif
#if defined(HAVE_MENU)
if (gl->menu_texture_enable)
{
@ -1965,7 +1971,7 @@ static bool gl3_frame(void *data, const void *frame,
#endif
#ifdef HAVE_OVERLAY
if (gl->overlay_enable)
if (gl->overlay_enable && !overlay_behind_menu)
gl3_render_overlay(gl, width, height);
#endif
@ -2045,6 +2051,7 @@ static uint32_t gl3_get_flags(void *data)
BIT32_SET(flags, GFX_CTX_FLAGS_BLACK_FRAME_INSERTION);
BIT32_SET(flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING);
BIT32_SET(flags, GFX_CTX_FLAGS_SCREENSHOTS_SUPPORTED);
BIT32_SET(flags, GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED);
return flags;
}

View file

@ -1758,6 +1758,7 @@ static bool vulkan_frame(void *data, const void *frame,
vk->context->current_frame_index;
unsigned swapchain_index =
vk->context->current_swapchain_index;
bool overlay_behind_menu = video_info->overlay_behind_menu;
/* Bookkeeping on start of frame. */
struct vk_per_frame *chain = &vk->swapchain[frame_index];
@ -2027,6 +2028,11 @@ static bool vulkan_frame(void *data, const void *frame,
(vulkan_filter_chain_t*)vk->filter_chain, vk->cmd,
&vk->vk_vp, vk->mvp.data);
#ifdef HAVE_OVERLAY
if (vk->overlay.enable && overlay_behind_menu)
vulkan_render_overlay(vk, video_width, video_height);
#endif
#if defined(HAVE_MENU)
if (vk->menu.enable)
{
@ -2077,7 +2083,7 @@ static bool vulkan_frame(void *data, const void *frame,
#endif
#ifdef HAVE_OVERLAY
if (vk->overlay.enable)
if (vk->overlay.enable && !overlay_behind_menu)
vulkan_render_overlay(vk, video_width, video_height);
#endif
@ -2588,6 +2594,7 @@ static uint32_t vulkan_get_flags(void *data)
BIT32_SET(flags, GFX_CTX_FLAGS_BLACK_FRAME_INSERTION);
BIT32_SET(flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING);
BIT32_SET(flags, GFX_CTX_FLAGS_SCREENSHOTS_SUPPORTED);
BIT32_SET(flags, GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED);
return flags;
}

View file

@ -206,7 +206,8 @@ enum display_flags
GFX_CTX_FLAGS_SHADERS_CG,
GFX_CTX_FLAGS_SHADERS_HLSL,
GFX_CTX_FLAGS_SHADERS_SLANG,
GFX_CTX_FLAGS_SCREENSHOTS_SUPPORTED
GFX_CTX_FLAGS_SCREENSHOTS_SUPPORTED,
GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED
};
enum shader_uniform_type

View file

@ -2780,6 +2780,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
settings->floats.menu_wallpaper_opacity;
video_info->menu_framebuffer_opacity =
settings->floats.menu_framebuffer_opacity;
video_info->overlay_behind_menu = settings->bools.input_overlay_behind_menu;
video_info->libretro_running = runloop_st->current_core.game_loaded;
#else
@ -2797,6 +2798,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->xmb_alpha_factor = 0.0f;
video_info->menu_framebuffer_opacity = 0.0f;
video_info->menu_wallpaper_opacity = 0.0f;
video_info->overlay_behind_menu = false;
#endif
video_info->runloop_is_paused = runloop_st->paused;

View file

@ -502,6 +502,7 @@ typedef struct video_frame_info
bool msg_bgcolor_enable;
bool crt_switch_hires_menu;
bool hdr_enable;
bool overlay_behind_menu;
} video_frame_info_t;
typedef void (*update_window_title_cb)(void*);

View file

@ -1554,6 +1554,10 @@ MSG_HASH(
MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE,
"input_overlay_enable"
)
MSG_HASH(
MENU_ENUM_LABEL_INPUT_OVERLAY_BEHIND_MENU,
"overlay_behind_menu"
)
MSG_HASH(
MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU,
"overlay_hide_in_menu"

View file

@ -3631,6 +3631,15 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE,
"Overlays are used for borders and on-screen controls."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_BEHIND_MENU,
"Show Overlay Behind Menu"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_OVERLAY_BEHIND_MENU,
"Show the overlay behind instead of in front of the menu."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU,
"Hide Overlay in Menu"

View file

@ -471,6 +471,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_custom_size_enable, MEN
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_message_pos_x, MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_X)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_message_pos_y, MENU_ENUM_SUBLABEL_VIDEO_MESSAGE_POS_Y)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_font_size, MENU_ENUM_SUBLABEL_VIDEO_FONT_SIZE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_behind_menu, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_BEHIND_MENU)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_hide_in_menu, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_IN_MENU)
#if defined(ANDROID)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_hide_when_gamepad_connected_android, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_HIDE_WHEN_GAMEPAD_CONNECTED_ANDROID)
@ -3445,6 +3446,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_PLAYLISTS_TAB:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_content_collection_list);
break;
case MENU_ENUM_LABEL_INPUT_OVERLAY_BEHIND_MENU:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_behind_menu);
break;
case MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_hide_in_menu);
break;

View file

@ -8334,6 +8334,7 @@ unsigned menu_displaylist_build_list(
menu_displaylist_build_info_selective_t build_list[] = {
{MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_INPUT_OVERLAY_BEHIND_MENU, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_WHEN_GAMEPAD_CONNECTED, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_INPUTS, PARSE_ONLY_UINT, false },
@ -8361,6 +8362,7 @@ unsigned menu_displaylist_build_list(
{
switch (build_list[i].enum_idx)
{
case MENU_ENUM_LABEL_INPUT_OVERLAY_BEHIND_MENU:
case MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_IN_MENU:
case MENU_ENUM_LABEL_INPUT_OVERLAY_HIDE_WHEN_GAMEPAD_CONNECTED:
case MENU_ENUM_LABEL_INPUT_OVERLAY_SHOW_INPUTS:

View file

@ -14757,6 +14757,24 @@ static bool setting_append_list(
);
(*list)[list_info->index - 1].change_handler = overlay_enable_toggle_change_handler;
if (video_driver_test_all_flags(GFX_CTX_FLAGS_OVERLAY_BEHIND_MENU_SUPPORTED))
{
CONFIG_BOOL(
list, list_info,
&settings->bools.input_overlay_behind_menu,
MENU_ENUM_LABEL_INPUT_OVERLAY_BEHIND_MENU,
MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_BEHIND_MENU,
DEFAULT_OVERLAY_BEHIND_MENU,
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_BOOL(
list, list_info,
&settings->bools.input_overlay_hide_in_menu,

View file

@ -1001,6 +1001,7 @@ enum msg_hash_enums
MENU_LABEL(INPUT_OSK_OVERLAY_ENABLE),
MENU_LABEL(INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO),
MENU_LABEL(INPUT_QUIT_GAMEPAD_COMBO),
MENU_LABEL(INPUT_OVERLAY_BEHIND_MENU),
MENU_LABEL(INPUT_OVERLAY_HIDE_IN_MENU),
MENU_LABEL(INPUT_OVERLAY_HIDE_WHEN_GAMEPAD_CONNECTED),
#if defined(ANDROID)

View file

@ -348,6 +348,9 @@
# Enable the overlay.
# input_overlay_enable = true
# Show the overlay behind the menu instead of in front.
# input_overlay_behind_menu = "false"
# Hide the current overlay from appearing inside the menu.
# input_overlay_hide_in_menu = true