diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index 27dae2b289..263a2e6894 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,20 @@ 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); + 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 if (video_info->statistics_show) @@ -903,7 +919,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 +955,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;