From d83dcba0dd49a47d355403be7b73c5fc1a16b57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Sun, 3 Jan 2021 17:20:04 +0100 Subject: [PATCH 1/2] [VITA] Fixes for GL HW renderer --- gfx/drivers/gl1.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index 27dae2b289..9f7f38877f 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -696,9 +696,10 @@ static bool gl1_gfx_frame(void *data, const void *frame, const void *frame_to_copy = NULL; unsigned mode_width = 0; unsigned mode_height = 0; - unsigned width = 0; - unsigned height = 0; + unsigned width = video_info->width; + unsigned height = video_info->height; bool draw = true; + bool do_swap = false; gl1_t *gl1 = (gl1_t*)data; unsigned bits = gl1->video_bits; unsigned pot_width = 0; @@ -745,6 +746,7 @@ static bool gl1_gfx_frame(void *data, const void *frame, ) draw = false; + do_swap = frame || draw; if ( gl1->video_width != frame_width || gl1->video_height != frame_height || @@ -826,6 +828,8 @@ static bool gl1_gfx_frame(void *data, const void *frame, pot_width = get_pot(width); pot_height = get_pot(height); + do_swap = true; + if (gl1->menu_size_changed) { gl1->menu_size_changed = false; @@ -860,8 +864,14 @@ static bool gl1_gfx_frame(void *data, const void *frame, } } - if (gl1->menu_texture_enable) + if (gl1->menu_texture_enable){ + do_swap = true; +#ifdef VITA + glUseProgram(0); + glDisable(GL_DEPTH_TEST); +#endif menu_driver_frame(menu_is_alive, video_info); + } else #endif if (video_info->statistics_show) @@ -903,7 +913,7 @@ static bool gl1_gfx_frame(void *data, const void *frame, gl1->readback_buffer_screenshot); - if (gl1->ctx_driver->swap_buffers) + if (do_swap && gl1->ctx_driver->swap_buffers) gl1->ctx_driver->swap_buffers(gl1->ctx_data); /* Emscripten has to do black frame insertion in its main loop */ @@ -939,9 +949,11 @@ static bool gl1_gfx_frame(void *data, const void *frame, glFinish(); } - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - + if(draw){ + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + } + gl1_context_bind_hw_render(gl1, true); return true; From 899ec9f9f4dccaadc6272c6f2768bbe9ce0246b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Sun, 3 Jan 2021 17:31:18 +0100 Subject: [PATCH 2/2] [VITA] Disable depth test if needed --- gfx/drivers/gl1.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index 9f7f38877f..263a2e6894 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -868,9 +868,15 @@ static bool gl1_gfx_frame(void *data, const void *frame, do_swap = true; #ifdef VITA glUseProgram(0); - glDisable(GL_DEPTH_TEST); + bool enabled = glIsEnabled(GL_DEPTH_TEST); + if(enabled) + glDisable(GL_DEPTH_TEST); #endif menu_driver_frame(menu_is_alive, video_info); +#ifdef VITA + if(enabled) + glEnable(GL_DEPTH_TEST); +#endif } else #endif