@@ -3245,6 +3245,18 @@ static void gl3_overlay_full_screen(void *data, bool enable)
32453245 }
32463246}
32473247
3248+ static void gl3_overlay_background_fill (void * data , bool enable )
3249+ {
3250+ gl3_t * gl = (gl3_t * )data ;
3251+ if (gl )
3252+ {
3253+ if (enable )
3254+ gl -> flags |= GL3_FLAG_OVERLAY_BACKGROUND_FILL ;
3255+ else
3256+ gl -> flags &= ~GL3_FLAG_OVERLAY_BACKGROUND_FILL ;
3257+ }
3258+ }
3259+
32483260static void gl3_overlay_set_alpha (void * data , unsigned image , float mod )
32493261{
32503262 GLfloat * color = NULL ;
@@ -3267,6 +3279,7 @@ static const video_overlay_interface_t gl3_overlay_interface = {
32673279 gl3_overlay_vertex_geom ,
32683280 gl3_overlay_full_screen ,
32693281 gl3_overlay_set_alpha ,
3282+ gl3_overlay_background_fill ,
32703283};
32713284
32723285static void gl3_get_overlay_interface (void * data ,
@@ -4247,6 +4260,22 @@ static bool gl3_frame(void *data, const void *frame,
42474260 glClearColor (0.0f , 0.0f , 0.0f , 0.0f );
42484261 glClear (GL_COLOR_BUFFER_BIT );
42494262
4263+ #ifdef HAVE_OVERLAY
4264+ /* Render background overlay (behind game viewport) */
4265+ if ((gl -> flags & GL3_FLAG_OVERLAY_ENABLE ) && (gl -> flags & GL3_FLAG_OVERLAY_BACKGROUND_FILL ))
4266+ {
4267+ /* Save current fullscreen state and force full screen for background overlay */
4268+ uint64_t saved_flags = gl -> flags & GL3_FLAG_OVERLAY_FULLSCREEN ;
4269+ gl -> flags |= GL3_FLAG_OVERLAY_FULLSCREEN ;
4270+
4271+ gl3_render_overlay (gl , width , height );
4272+
4273+ /* Restore fullscreen state */
4274+ if (!saved_flags )
4275+ gl -> flags &= ~GL3_FLAG_OVERLAY_FULLSCREEN ;
4276+ }
4277+ #endif
4278+
42504279 gl -> chain .shader -> set_params (& params , gl -> chain .shader_data );
42514280
42524281 gl -> chain .coords .vertices = 4 ;
@@ -4358,6 +4387,23 @@ static bool gl3_frame(void *data, const void *frame,
43584387 glBindFramebuffer (GL_FRAMEBUFFER , 0 );
43594388 glClearColor (0.0f , 0.0f , 0.0f , 0.0f );
43604389 glClear (GL_COLOR_BUFFER_BIT );
4390+
4391+ #ifdef HAVE_OVERLAY
4392+ /* Render background overlay (behind game viewport) */
4393+ if ((gl -> flags & GL3_FLAG_OVERLAY_ENABLE ) && (gl -> flags & GL3_FLAG_OVERLAY_BACKGROUND_FILL ))
4394+ {
4395+ /* Save current fullscreen state and force full screen for background overlay */
4396+ uint64_t saved_flags = gl -> flags & GL3_FLAG_OVERLAY_FULLSCREEN ;
4397+ gl -> flags |= GL3_FLAG_OVERLAY_FULLSCREEN ;
4398+
4399+ gl3_render_overlay (gl , width , height );
4400+
4401+ /* Restore fullscreen state */
4402+ if (!saved_flags )
4403+ gl -> flags &= ~GL3_FLAG_OVERLAY_FULLSCREEN ;
4404+ }
4405+ #endif
4406+
43614407 gl3_filter_chain_build_viewport_pass (filter_chain ,
43624408 & gl -> filter_chain_vp ,
43634409 (gl -> flags & GL3_FLAG_HW_RENDER_BOTTOM_LEFT )
@@ -4368,7 +4414,8 @@ static bool gl3_frame(void *data, const void *frame,
43684414#endif /* HAVE_SLANG */
43694415
43704416#ifdef HAVE_OVERLAY
4371- if ((gl -> flags & GL3_FLAG_OVERLAY_ENABLE ) && overlay_behind_menu )
4417+ if ((gl -> flags & GL3_FLAG_OVERLAY_ENABLE ) && overlay_behind_menu
4418+ && !(gl -> flags & GL3_FLAG_OVERLAY_BACKGROUND_FILL ))
43724419 gl3_render_overlay (gl , width , height );
43734420#endif
43744421
@@ -4388,7 +4435,8 @@ static bool gl3_frame(void *data, const void *frame,
43884435#endif
43894436
43904437#ifdef HAVE_OVERLAY
4391- if ((gl -> flags & GL3_FLAG_OVERLAY_ENABLE ) && !overlay_behind_menu )
4438+ if ((gl -> flags & GL3_FLAG_OVERLAY_ENABLE ) && !overlay_behind_menu
4439+ && !(gl -> flags & GL3_FLAG_OVERLAY_BACKGROUND_FILL ))
43924440 gl3_render_overlay (gl , width , height );
43934441#endif
43944442
0 commit comments