mirror of
https://github.com/libretro/RetroArch
synced 2024-07-08 12:15:49 +00:00
Refactors, move some functions to retroarch.c and make them static
This commit is contained in:
parent
698b0d6ce6
commit
8a5a59da50
|
@ -947,23 +947,6 @@ void audio_driver_set_buffer_size(size_t bufsize)
|
|||
audio_driver_st.buffer_size = bufsize;
|
||||
}
|
||||
|
||||
float audio_driver_monitor_adjust_system_rates(
|
||||
double input_sample_rate,
|
||||
double input_fps,
|
||||
float video_refresh_rate,
|
||||
unsigned video_swap_interval,
|
||||
float audio_max_timing_skew)
|
||||
{
|
||||
float inp_sample_rate = input_sample_rate;
|
||||
float target_video_sync_rate = video_refresh_rate
|
||||
/ (float)video_swap_interval;
|
||||
float timing_skew =
|
||||
fabs(1.0f - input_fps / target_video_sync_rate);
|
||||
if (timing_skew <= audio_max_timing_skew)
|
||||
return (inp_sample_rate * target_video_sync_rate / input_fps);
|
||||
return inp_sample_rate;
|
||||
}
|
||||
|
||||
#ifdef HAVE_REWIND
|
||||
void audio_driver_setup_rewind(void)
|
||||
{
|
||||
|
|
|
@ -304,13 +304,6 @@ bool audio_driver_is_ai_service_speech_running(void);
|
|||
**/
|
||||
bool audio_compute_buffer_statistics(audio_statistics_t *stats);
|
||||
|
||||
float audio_driver_monitor_adjust_system_rates(
|
||||
double input_sample_rate,
|
||||
double input_fps,
|
||||
float video_refresh_rate,
|
||||
unsigned video_swap_interval,
|
||||
float audio_max_timing_skew);
|
||||
|
||||
bool audio_driver_init_internal(
|
||||
void *settings_data,
|
||||
bool audio_cb_inited);
|
||||
|
|
|
@ -144,7 +144,7 @@ font_renderer_t caca_font = {
|
|||
caca_font_init,
|
||||
caca_font_free,
|
||||
caca_font_render_msg,
|
||||
"caca font",
|
||||
"caca",
|
||||
caca_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -446,7 +446,7 @@ font_renderer_t ctr_font =
|
|||
ctr_font_init,
|
||||
ctr_font_free,
|
||||
ctr_font_render_msg,
|
||||
"ctr_font",
|
||||
"ctr",
|
||||
ctr_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush_block */
|
||||
|
|
|
@ -380,7 +380,7 @@ font_renderer_t d3d10_font = {
|
|||
d3d10_font_init,
|
||||
d3d10_font_free,
|
||||
d3d10_font_render_msg,
|
||||
"d3d10font",
|
||||
"d3d10",
|
||||
d3d10_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -383,7 +383,7 @@ font_renderer_t d3d11_font = {
|
|||
d3d11_font_init,
|
||||
d3d11_font_free,
|
||||
d3d11_font_render_msg,
|
||||
"d3d11_font",
|
||||
"d3d11",
|
||||
d3d11_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -388,7 +388,7 @@ font_renderer_t d3d12_font = {
|
|||
d3d12_font_init,
|
||||
d3d12_font_free,
|
||||
d3d12_font_render_msg,
|
||||
"d3d12_font",
|
||||
"d3d12",
|
||||
d3d12_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -201,7 +201,7 @@ font_renderer_t gdi_font = {
|
|||
gdi_font_init,
|
||||
gdi_font_free,
|
||||
gdi_font_render_msg,
|
||||
"gdi_font",
|
||||
"gdi",
|
||||
NULL, /* get_glyph */
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -379,10 +379,15 @@ static void gl1_raster_font_render_message(
|
|||
}
|
||||
}
|
||||
|
||||
static void gl1_raster_font_setup_viewport(unsigned width, unsigned height,
|
||||
static void gl1_raster_font_setup_viewport(
|
||||
video_driver_state_t *video_st,
|
||||
unsigned width, unsigned height,
|
||||
gl1_raster_t *font, bool full_screen)
|
||||
{
|
||||
video_driver_set_viewport(width, height, full_screen, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height,
|
||||
full_screen, false);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -403,6 +408,7 @@ static void gl1_raster_font_render_msg(
|
|||
enum text_alignment text_align = TEXT_ALIGN_LEFT;
|
||||
bool full_screen = false;
|
||||
gl1_raster_t *font = (gl1_raster_t*)data;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
unsigned width = font->gl->video_width;
|
||||
unsigned height = font->gl->video_height;
|
||||
|
||||
|
@ -458,7 +464,7 @@ static void gl1_raster_font_render_msg(
|
|||
if (font->block)
|
||||
font->block->fullscreen = full_screen;
|
||||
else
|
||||
gl1_raster_font_setup_viewport(width, height, font, full_screen);
|
||||
gl1_raster_font_setup_viewport(video_st, width, height, font, full_screen);
|
||||
|
||||
if (font->gl)
|
||||
{
|
||||
|
@ -485,12 +491,14 @@ static void gl1_raster_font_render_msg(
|
|||
|
||||
if (!font->block)
|
||||
{
|
||||
/* restore viewport */
|
||||
/* Restore viewport */
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, font->gl->texture[font->gl->tex_index]);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
video_driver_set_viewport(width, height, false, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -508,22 +516,25 @@ static void gl1_raster_font_flush_block(unsigned width, unsigned height,
|
|||
void *data)
|
||||
{
|
||||
gl1_raster_t *font = (gl1_raster_t*)data;
|
||||
video_font_raster_block_t *block = font ? font->block : NULL;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
video_font_raster_block_t *block = font ? font->block : NULL;
|
||||
|
||||
if (!font || !block || !block->carr.coords.vertices)
|
||||
return;
|
||||
|
||||
gl1_raster_font_setup_viewport(width, height, font, block->fullscreen);
|
||||
gl1_raster_font_setup_viewport(video_st, width, height, font, block->fullscreen);
|
||||
gl1_raster_font_draw_vertices(font, (video_coords_t*)&block->carr.coords);
|
||||
|
||||
if (font->gl)
|
||||
{
|
||||
/* restore viewport */
|
||||
/* Restore viewport */
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, font->gl->texture[font->gl->tex_index]);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
video_driver_set_viewport(width, height, block->fullscreen, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, block->fullscreen, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -548,7 +559,7 @@ font_renderer_t gl1_raster_font = {
|
|||
gl1_raster_font_init,
|
||||
gl1_raster_font_free,
|
||||
gl1_raster_font_render_msg,
|
||||
"gl1_raster_font",
|
||||
"gl1",
|
||||
gl1_raster_font_get_glyph,
|
||||
gl1_raster_font_bind_block,
|
||||
gl1_raster_font_flush_block,
|
||||
|
|
|
@ -343,12 +343,15 @@ static void gl2_raster_font_render_message(
|
|||
}
|
||||
|
||||
static void gl2_raster_font_setup_viewport(
|
||||
video_driver_state_t *video_st,
|
||||
gl2_raster_t *font,
|
||||
unsigned width, unsigned height,
|
||||
bool full_screen)
|
||||
{
|
||||
video_driver_set_viewport(width, height, full_screen, false);
|
||||
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, full_screen, true);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
|
@ -372,6 +375,7 @@ static void gl2_raster_font_render_msg(
|
|||
enum text_alignment text_align = TEXT_ALIGN_LEFT;
|
||||
bool full_screen = false ;
|
||||
gl2_raster_t *font = (gl2_raster_t*)data;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
unsigned width = font->gl->video_width;
|
||||
unsigned height = font->gl->video_height;
|
||||
|
||||
|
@ -427,7 +431,7 @@ static void gl2_raster_font_render_msg(
|
|||
if (font->block)
|
||||
font->block->fullscreen = full_screen;
|
||||
else
|
||||
gl2_raster_font_setup_viewport(font, width, height, full_screen);
|
||||
gl2_raster_font_setup_viewport(video_st, font, width, height, full_screen);
|
||||
|
||||
if (font->gl)
|
||||
{
|
||||
|
@ -454,11 +458,13 @@ static void gl2_raster_font_render_msg(
|
|||
|
||||
if (!font->block)
|
||||
{
|
||||
/* restore viewport */
|
||||
/* Restore viewport */
|
||||
glBindTexture(GL_TEXTURE_2D,
|
||||
font->gl->texture[font->gl->tex_index]);
|
||||
glDisable(GL_BLEND);
|
||||
video_driver_set_viewport(width, height, false, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -476,21 +482,24 @@ static void gl2_raster_font_flush_block(unsigned width, unsigned height,
|
|||
void *data)
|
||||
{
|
||||
gl2_raster_t *font = (gl2_raster_t*)data;
|
||||
video_font_raster_block_t *block = font ? font->block : NULL;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
video_font_raster_block_t *block = font ? font->block : NULL;
|
||||
|
||||
if (!font || !block || !block->carr.coords.vertices)
|
||||
return;
|
||||
|
||||
gl2_raster_font_setup_viewport(font, width, height, block->fullscreen);
|
||||
gl2_raster_font_setup_viewport(video_st, font, width, height, block->fullscreen);
|
||||
gl2_raster_font_draw_vertices(font, (video_coords_t*)&block->carr.coords);
|
||||
|
||||
if (font->gl)
|
||||
{
|
||||
/* restore viewport */
|
||||
/* Restore viewport */
|
||||
glBindTexture(GL_TEXTURE_2D, font->gl->texture[font->gl->tex_index]);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
video_driver_set_viewport(width, height, block->fullscreen, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, block->fullscreen, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -515,7 +524,7 @@ font_renderer_t gl2_raster_font = {
|
|||
gl2_raster_font_init,
|
||||
gl2_raster_font_free,
|
||||
gl2_raster_font_render_msg,
|
||||
"gl2_raster_font",
|
||||
"gl",
|
||||
gl2_raster_font_get_glyph,
|
||||
gl2_raster_font_bind_block,
|
||||
gl2_raster_font_flush_block,
|
||||
|
|
|
@ -320,10 +320,14 @@ static void gl3_raster_font_render_message(
|
|||
}
|
||||
}
|
||||
|
||||
static void gl3_raster_font_setup_viewport(unsigned width, unsigned height,
|
||||
static void gl3_raster_font_setup_viewport(
|
||||
video_driver_state_t *video_st,
|
||||
unsigned width, unsigned height,
|
||||
gl3_raster_t *font, bool full_screen)
|
||||
{
|
||||
video_driver_set_viewport(width, height, full_screen, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, full_screen, false);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -343,7 +347,8 @@ static void gl3_raster_font_render_msg(
|
|||
GLfloat x, y, scale, drop_mod, drop_alpha;
|
||||
enum text_alignment text_align = TEXT_ALIGN_LEFT;
|
||||
bool full_screen = false ;
|
||||
gl3_raster_t *font = (gl3_raster_t*)data;
|
||||
gl3_raster_t *font = (gl3_raster_t*)data;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
unsigned width = font->gl->video_width;
|
||||
unsigned height = font->gl->video_height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
@ -399,7 +404,7 @@ static void gl3_raster_font_render_msg(
|
|||
if (font->block)
|
||||
font->block->fullscreen = full_screen;
|
||||
else
|
||||
gl3_raster_font_setup_viewport(width, height, font, full_screen);
|
||||
gl3_raster_font_setup_viewport(video_st, width, height, font, full_screen);
|
||||
|
||||
if (font->gl)
|
||||
{
|
||||
|
@ -427,7 +432,9 @@ static void gl3_raster_font_render_msg(
|
|||
if (!font->block)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
video_driver_set_viewport(width, height, false, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -445,18 +452,21 @@ static void gl3_raster_font_flush_block(unsigned width, unsigned height,
|
|||
void *data)
|
||||
{
|
||||
gl3_raster_t *font = (gl3_raster_t*)data;
|
||||
video_font_raster_block_t *block = font ? font->block : NULL;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
video_font_raster_block_t *block = font ? font->block : NULL;
|
||||
|
||||
if (!font || !block || !block->carr.coords.vertices)
|
||||
return;
|
||||
|
||||
gl3_raster_font_setup_viewport(width, height, font, block->fullscreen);
|
||||
gl3_raster_font_setup_viewport(video_st, width, height, font, block->fullscreen);
|
||||
gl3_raster_font_draw_vertices(font, (video_coords_t*)&block->carr.coords);
|
||||
|
||||
if (font->gl)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
video_driver_set_viewport(width, height, block->fullscreen, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, block->fullscreen, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +491,7 @@ font_renderer_t gl3_raster_font = {
|
|||
gl3_raster_font_init,
|
||||
gl3_raster_font_free,
|
||||
gl3_raster_font_render_msg,
|
||||
"gl3_raster_font",
|
||||
"glcore",
|
||||
gl3_raster_font_get_glyph,
|
||||
gl3_raster_font_bind_block,
|
||||
gl3_raster_font_flush_block,
|
||||
|
|
|
@ -547,7 +547,7 @@ font_renderer_t metal_raster_font = {
|
|||
metal_raster_font_init,
|
||||
metal_raster_font_free,
|
||||
metal_raster_font_render_msg,
|
||||
"metal_raster",
|
||||
"metal",
|
||||
metal_raster_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush_block */
|
||||
|
|
|
@ -372,7 +372,7 @@ font_renderer_t ps2_font = {
|
|||
ps2_font_init,
|
||||
ps2_font_free,
|
||||
ps2_font_render_msg,
|
||||
"ps2_font",
|
||||
"ps2",
|
||||
ps2_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
#endif
|
||||
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../common/rsx_common.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
|
||||
#define RSX_FONT_EMIT(c, vx, vy) \
|
||||
|
@ -424,10 +422,14 @@ static void rsx_font_render_message(
|
|||
}
|
||||
}
|
||||
|
||||
static void rsx_font_setup_viewport(unsigned width, unsigned height,
|
||||
static void rsx_font_setup_viewport(
|
||||
video_driver_state_t *video_st,
|
||||
unsigned width, unsigned height,
|
||||
rsx_font_t *font, bool full_screen)
|
||||
{
|
||||
video_driver_set_viewport(width, height, full_screen, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, full_screen, false);
|
||||
|
||||
if (font->rsx)
|
||||
{
|
||||
|
@ -454,6 +456,7 @@ static void rsx_font_render_msg(
|
|||
enum text_alignment text_align = TEXT_ALIGN_LEFT;
|
||||
bool full_screen = false ;
|
||||
rsx_font_t *font = (rsx_font_t*)data;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
unsigned width = font->rsx->width;
|
||||
unsigned height = font->rsx->height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
@ -540,7 +543,9 @@ static void rsx_font_render_msg(
|
|||
rsxTextureControl(font->rsx->context, font->tex_unit->index,
|
||||
GCM_TRUE, 0 << 8, 12 << 8, GCM_TEXTURE_MAX_ANISO_1);
|
||||
rsxSetBlendEnable(font->rsx->context, GCM_FALSE);
|
||||
video_driver_set_viewport(width, height, false, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, false, true);
|
||||
}
|
||||
font->rsx->font_vert_idx = 0;
|
||||
}
|
||||
|
@ -558,13 +563,14 @@ static const struct font_glyph *rsx_font_get_glyph(
|
|||
static void rsx_font_flush_block(unsigned width, unsigned height,
|
||||
void *data)
|
||||
{
|
||||
rsx_font_t *font = (rsx_font_t*)data;
|
||||
rsx_font_t *font = (rsx_font_t*)data;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
video_font_raster_block_t *block = font ? font->block : NULL;
|
||||
|
||||
if (!font || !block || !block->carr.coords.vertices)
|
||||
return;
|
||||
|
||||
rsx_font_setup_viewport(width, height, font, block->fullscreen);
|
||||
rsx_font_setup_viewport(video_st, width, height, font, block->fullscreen);
|
||||
rsx_font_draw_vertices(font, (video_coords_t*)&block->carr.coords);
|
||||
|
||||
if (font->rsx)
|
||||
|
@ -573,7 +579,9 @@ static void rsx_font_flush_block(unsigned width, unsigned height,
|
|||
rsxTextureControl(font->rsx->context, font->tex_unit->index,
|
||||
GCM_TRUE, 0 << 8, 12 << 8, GCM_TEXTURE_MAX_ANISO_1);
|
||||
rsxSetBlendEnable(font->rsx->context, GCM_FALSE);
|
||||
video_driver_set_viewport(width, height, block->fullscreen, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, block->fullscreen, true);
|
||||
}
|
||||
font->rsx->font_vert_idx = 0;
|
||||
}
|
||||
|
@ -599,7 +607,7 @@ font_renderer_t rsx_font = {
|
|||
rsx_font_init,
|
||||
rsx_font_free,
|
||||
rsx_font_render_msg,
|
||||
"rsx_font",
|
||||
"rsx",
|
||||
rsx_font_get_glyph,
|
||||
rsx_font_bind_block,
|
||||
rsx_font_flush_block,
|
||||
|
|
|
@ -133,7 +133,7 @@ font_renderer_t sixel_font = {
|
|||
sixel_font_init,
|
||||
sixel_font_free,
|
||||
sixel_font_render_msg,
|
||||
"sixel_font",
|
||||
"sixel",
|
||||
sixel_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -302,7 +302,7 @@ font_renderer_t switch_font =
|
|||
switch_font_init,
|
||||
switch_font_free,
|
||||
switch_font_render_msg,
|
||||
"switch_font",
|
||||
"switch",
|
||||
switch_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush_block */
|
||||
|
|
|
@ -137,7 +137,7 @@ font_renderer_t vga_font = {
|
|||
vga_font_init,
|
||||
vga_font_render_free,
|
||||
vga_font_render_msg,
|
||||
"vga_font",
|
||||
"vga",
|
||||
vga_font_get_glyph, /* get_glyph */
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
#include <encodings/utf.h>
|
||||
|
||||
#include "../common/vita2d_common.h"
|
||||
|
||||
#include "../font_driver.h"
|
||||
|
||||
#include "../../configuration.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -266,11 +264,12 @@ static void vita2d_font_render_msg(
|
|||
unsigned color, r, g, b, alpha;
|
||||
enum text_alignment text_align;
|
||||
float x, y, scale, drop_mod, drop_alpha;
|
||||
bool full_screen = false;
|
||||
vita_video_t *vita = (vita_video_t *)userdata;
|
||||
vita_font_t *font = (vita_font_t *)data;
|
||||
unsigned width = vita->video_width;
|
||||
unsigned height = vita->video_height;
|
||||
bool full_screen = false;
|
||||
vita_video_t *vita = (vita_video_t *)userdata;
|
||||
vita_font_t *font = (vita_font_t *)data;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
unsigned width = vita->video_width;
|
||||
unsigned height = vita->video_height;
|
||||
|
||||
if (!font || !msg || !*msg)
|
||||
return;
|
||||
|
@ -318,7 +317,9 @@ static void vita2d_font_render_msg(
|
|||
drop_alpha = 1.0f;
|
||||
}
|
||||
|
||||
video_driver_set_viewport(width, height, full_screen, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, full_screen, false);
|
||||
|
||||
if (drop_x || drop_y)
|
||||
{
|
||||
|
@ -358,7 +359,7 @@ font_renderer_t vita2d_vita_font = {
|
|||
vita2d_font_init,
|
||||
vita2d_font_free,
|
||||
vita2d_font_render_msg,
|
||||
"vita2d_font",
|
||||
"vita2d",
|
||||
vita2d_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -363,6 +363,7 @@ static void vulkan_font_render_msg(
|
|||
float x, y, scale, drop_mod, drop_alpha;
|
||||
vk_t *vk = NULL;
|
||||
vulkan_raster_t *font = (vulkan_raster_t*)data;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
float video_msg_pos_x = settings->floats.video_msg_pos_x;
|
||||
float video_msg_pos_y = settings->floats.video_msg_pos_y;
|
||||
|
@ -417,7 +418,9 @@ static void vulkan_font_render_msg(
|
|||
color[3] = 1.0f;
|
||||
}
|
||||
|
||||
video_driver_set_viewport(width, height, full_screen, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, full_screen, false);
|
||||
|
||||
max_glyphs = strlen(msg);
|
||||
if (drop_x || drop_y)
|
||||
|
@ -481,7 +484,7 @@ font_renderer_t vulkan_raster_font = {
|
|||
vulkan_font_init,
|
||||
vulkan_font_free,
|
||||
vulkan_font_render_msg,
|
||||
"vulkan_font",
|
||||
"vulkan",
|
||||
vulkan_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush_block */
|
||||
|
|
|
@ -385,7 +385,7 @@ font_renderer_t wiiu_font =
|
|||
wiiu_font_init,
|
||||
wiiu_font_free,
|
||||
wiiu_font_render_msg,
|
||||
"wiiu_font",
|
||||
"gx2",
|
||||
wiiu_font_get_glyph,
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -122,7 +122,7 @@ font_renderer_t d3d_xdk1_font = {
|
|||
xfonts_init,
|
||||
xfonts_free,
|
||||
xfonts_render_msg,
|
||||
"xfonts",
|
||||
"xdk1",
|
||||
NULL, /* get_glyph */
|
||||
NULL, /* bind_block */
|
||||
NULL, /* flush */
|
||||
|
|
|
@ -1480,6 +1480,7 @@ void gfx_widgets_frame(void *data)
|
|||
video_frame_info_t *video_info = (video_frame_info_t*)data;
|
||||
gfx_display_t *p_disp = (gfx_display_t*)video_info->disp_userdata;
|
||||
gfx_display_ctx_driver_t *dispctx= p_disp->dispctx;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)video_info->widgets_userdata;
|
||||
bool fps_show = video_info->fps_show;
|
||||
bool framecount_show = video_info->framecount_show;
|
||||
|
@ -1503,7 +1504,9 @@ void gfx_widgets_frame(void *data)
|
|||
if (menu_screensaver_active || notifications_hidden)
|
||||
return;
|
||||
|
||||
video_driver_set_viewport(video_width, video_height, true, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, true, false);
|
||||
|
||||
/* Font setup */
|
||||
gfx_widgets_font_bind(&p_dispwidget->gfx_widget_fonts.regular);
|
||||
|
@ -1777,7 +1780,9 @@ void gfx_widgets_frame(void *data)
|
|||
gfx_widgets_font_unbind(&p_dispwidget->gfx_widget_fonts.bold);
|
||||
gfx_widgets_font_unbind(&p_dispwidget->gfx_widget_fonts.msg_queue);
|
||||
|
||||
video_driver_set_viewport(video_width, video_height, false, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, false, true);
|
||||
}
|
||||
|
||||
static void gfx_widgets_free(dispgfx_widget_t *p_dispwidget)
|
||||
|
|
|
@ -90,14 +90,17 @@ static void crt_aspect_ratio_switch(
|
|||
RARCH_LOG("[CRT]: Setting Aspect Ratio: %f \n", fly_aspect);
|
||||
RARCH_LOG("[CRT]: Setting Video Screen Size to: %dx%d \n",
|
||||
width, height);
|
||||
video_driver_set_size(width , height);
|
||||
video_driver_set_viewport(width , height,1,1);
|
||||
video_driver_set_size(width, height);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, true, true);
|
||||
|
||||
video_driver_apply_state_changes();
|
||||
|
||||
}
|
||||
|
||||
static void set_aspect(videocrt_switch_t *p_switch,
|
||||
static void crt_switch_set_aspect(
|
||||
videocrt_switch_t *p_switch,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int srm_width, unsigned srm_height,
|
||||
float srm_xscale, float srm_yscale,
|
||||
|
@ -320,7 +323,7 @@ static void switch_res_crt(
|
|||
get_modeline_for_kms(p_switch, &srm);
|
||||
#if 0
|
||||
/* Need trigger the context set video mode */
|
||||
crt_switch_driver_refresh();
|
||||
video_driver_reinit(DRIVER_VIDEO_MASK);
|
||||
#endif
|
||||
video_driver_set_video_mode(srm.width, srm.height, true);
|
||||
}
|
||||
|
@ -330,12 +333,17 @@ static void switch_res_crt(
|
|||
RARCH_LOG("[CRT]: SR failed to switch mode\n");
|
||||
p_switch->sr_core_hz = (float)srm.vfreq;
|
||||
|
||||
set_aspect(p_switch, retroarch_get_rotation()? h : w , retroarch_get_rotation()? w : h, srm.width, srm.height,
|
||||
crt_switch_set_aspect(p_switch,
|
||||
retroarch_get_rotation() ? h : w,
|
||||
retroarch_get_rotation() ? w : h,
|
||||
srm.width, srm.height,
|
||||
(float)srm.x_scale, (float)srm.y_scale, srm.is_stretched);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_aspect(p_switch, width , height, width, height,
|
||||
crt_switch_set_aspect(p_switch,
|
||||
width, height,
|
||||
width, height,
|
||||
(float)1, (float)1, false);
|
||||
video_driver_set_size(width , height);
|
||||
video_driver_apply_state_changes();
|
||||
|
@ -405,7 +413,7 @@ void crt_switch_res_core(
|
|||
int corrected_height = 240;
|
||||
switch_res_crt(p_switch, corrected_width, corrected_height,
|
||||
crt_mode, corrected_width, monitor_index-1, super_width);
|
||||
set_aspect(p_switch, native_width, height, native_width,
|
||||
crt_switch_set_aspect(p_switch, native_width, height, native_width,
|
||||
height ,(float)1,(float)1, false);
|
||||
video_driver_set_size(native_width , height);
|
||||
}
|
||||
|
@ -519,7 +527,7 @@ static void crt_rpi_switch(videocrt_switch_t *p_switch,
|
|||
/* set core refresh from hz */
|
||||
video_monitor_set_refresh_rate(hz);
|
||||
|
||||
set_aspect(p_switch, width,
|
||||
crt_switch_set_aspect(p_switch, width,
|
||||
height, width, height,
|
||||
(float)1, (float)1, false);
|
||||
|
||||
|
@ -617,6 +625,6 @@ static void crt_rpi_switch(videocrt_switch_t *p_switch,
|
|||
"fbset -g %d %d %d %d 24 > /dev/null",
|
||||
width, height, width, height);
|
||||
system(output2);
|
||||
crt_switch_driver_refresh();
|
||||
video_driver_reinit(DRIVER_VIDEO_MASK);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -378,12 +378,6 @@ video_driver_state_t *video_state_get_ptr(void)
|
|||
return &video_driver_st;
|
||||
}
|
||||
|
||||
void crt_switch_driver_refresh(void)
|
||||
{
|
||||
video_driver_reinit(DRIVER_VIDEO_MASK);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
void *video_thread_get_ptr(video_driver_state_t *video_st)
|
||||
{
|
||||
|
@ -602,10 +596,10 @@ bool video_driver_translate_coord_viewport(
|
|||
int scaled_screen_y = -0x8000; /* OOB */
|
||||
int scaled_x = -0x8000; /* OOB */
|
||||
int scaled_y = -0x8000; /* OOB */
|
||||
if (norm_vp_width <= 0 ||
|
||||
norm_vp_height <= 0 ||
|
||||
norm_full_vp_width <= 0 ||
|
||||
norm_full_vp_height <= 0)
|
||||
if ( (norm_vp_width <= 0)
|
||||
|| (norm_vp_height <= 0)
|
||||
|| (norm_full_vp_width <= 0)
|
||||
|| (norm_full_vp_height <= 0))
|
||||
return false;
|
||||
|
||||
if (mouse_x >= 0 && mouse_x <= norm_full_vp_width)
|
||||
|
@ -888,37 +882,6 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool video_driver_monitor_adjust_system_rates(
|
||||
float timing_skew_hz,
|
||||
float video_refresh_rate,
|
||||
bool vrr_runloop_enable,
|
||||
float audio_max_timing_skew,
|
||||
unsigned video_swap_interval,
|
||||
double input_fps)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
float target_video_sync_rate = timing_skew_hz;
|
||||
|
||||
/* Divide target rate only when using Auto interval */
|
||||
if (settings->uints.video_swap_interval == 0)
|
||||
target_video_sync_rate /= (float)video_swap_interval;
|
||||
|
||||
if (!vrr_runloop_enable)
|
||||
{
|
||||
float timing_skew = fabs(
|
||||
1.0f - input_fps / target_video_sync_rate);
|
||||
/* We don't want to adjust pitch too much. If we have extreme cases,
|
||||
* just don't readjust at all. */
|
||||
if (timing_skew <= audio_max_timing_skew)
|
||||
return true;
|
||||
RARCH_LOG("[Video]: Timings deviate too much. Will not adjust."
|
||||
" (Target = %.2f Hz, Game = %.2f Hz)\n",
|
||||
target_video_sync_rate,
|
||||
(float)input_fps);
|
||||
}
|
||||
return input_fps <= target_video_sync_rate;
|
||||
}
|
||||
|
||||
void video_driver_gpu_record_deinit(void)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
|
@ -1285,15 +1248,13 @@ bool video_display_server_get_flags(gfx_ctx_flags_t *flags)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
bool video_driver_is_threaded(void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
return VIDEO_DRIVER_IS_THREADED_INTERNAL(video_st);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
bool *video_driver_get_threaded(void)
|
||||
{
|
||||
|
@ -1615,16 +1576,6 @@ void video_driver_set_viewport_square_pixel(struct retro_game_geometry *geom)
|
|||
aspectratio_lut[ASPECT_RATIO_SQUARE].value = (float)aspect_x / aspect_y;
|
||||
}
|
||||
|
||||
void video_driver_set_viewport(unsigned width, unsigned height,
|
||||
bool force_fullscreen, bool allow_rotate)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height,
|
||||
force_fullscreen, allow_rotate);
|
||||
}
|
||||
|
||||
bool video_driver_set_rotation(unsigned rotation)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
|
@ -1704,11 +1655,12 @@ void video_driver_set_size(unsigned width, unsigned height)
|
|||
#ifdef HAVE_THREADS
|
||||
bool is_threaded = VIDEO_DRIVER_IS_THREADED_INTERNAL(video_st);
|
||||
VIDEO_DRIVER_THREADED_LOCK(video_st, is_threaded);
|
||||
#endif
|
||||
video_st->width = width;
|
||||
video_st->height = height;
|
||||
#ifdef HAVE_THREADS
|
||||
VIDEO_DRIVER_THREADED_UNLOCK(video_st, is_threaded);
|
||||
#else
|
||||
video_st->width = width;
|
||||
video_st->height = height;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1786,9 +1738,7 @@ void video_driver_lock_new(void)
|
|||
{
|
||||
#ifdef HAVE_THREADS
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
#endif
|
||||
VIDEO_DRIVER_LOCK_FREE(video_st);
|
||||
#ifdef HAVE_THREADS
|
||||
if (!video_st->display_lock)
|
||||
video_st->display_lock = slock_new();
|
||||
|
||||
|
@ -2849,15 +2799,15 @@ enum gfx_ctx_api video_context_driver_get_api(void)
|
|||
return ctx_api;
|
||||
}
|
||||
|
||||
#if !(defined(RARCH_CONSOLE) || defined(RARCH_MOBILE))
|
||||
bool video_driver_has_windowed(void)
|
||||
{
|
||||
#if !(defined(RARCH_CONSOLE) || defined(RARCH_MOBILE))
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
if (video_st->data && video_st->current_video->has_windowed)
|
||||
return video_st->current_video->has_windowed(video_st->data);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool video_shader_driver_get_current_shader(video_shader_ctx_t *shader)
|
||||
{
|
||||
|
@ -2881,16 +2831,6 @@ float video_driver_get_refresh_rate(void)
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
#if defined(HAVE_GFX_WIDGETS)
|
||||
bool video_driver_has_widgets(void)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
return video_st->current_video
|
||||
&& video_st->current_video->gfx_widgets_enabled
|
||||
&& video_st->current_video->gfx_widgets_enabled(video_st->data);
|
||||
}
|
||||
#endif
|
||||
|
||||
void video_driver_set_gpu_device_string(const char *str)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
|
|
|
@ -888,7 +888,17 @@ struct aspect_ratio_elem
|
|||
|
||||
extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
|
||||
|
||||
#if !(defined(RARCH_CONSOLE) || defined(RARCH_MOBILE))
|
||||
bool video_driver_has_windowed(void);
|
||||
#else
|
||||
#define video_driver_has_windowed() (false)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
bool video_driver_is_threaded(void);
|
||||
#else
|
||||
#define video_driver_is_threaded() (false)
|
||||
#endif
|
||||
|
||||
bool video_driver_has_focus(void);
|
||||
|
||||
|
@ -968,9 +978,6 @@ void video_driver_set_filtering(unsigned index, bool smooth, bool ctx_scaling);
|
|||
|
||||
const char *video_driver_get_ident(void);
|
||||
|
||||
void video_driver_set_viewport(unsigned width, unsigned height,
|
||||
bool force_fullscreen, bool allow_rotate);
|
||||
|
||||
void video_driver_get_size(unsigned *width, unsigned *height);
|
||||
|
||||
void video_driver_set_size(unsigned width, unsigned height);
|
||||
|
@ -1029,16 +1036,6 @@ void video_monitor_compute_fps_statistics(uint64_t
|
|||
bool video_monitor_fps_statistics(double *refresh_rate,
|
||||
double *deviation, unsigned *sample_points);
|
||||
|
||||
bool video_driver_monitor_adjust_system_rates(
|
||||
float timing_skew_hz,
|
||||
float video_refresh_rate,
|
||||
bool vrr_runloop_enable,
|
||||
float audio_max_timing_skew,
|
||||
unsigned video_swap_interval,
|
||||
double input_fps);
|
||||
|
||||
void crt_switch_driver_refresh(void);
|
||||
|
||||
#define video_driver_translate_coord_viewport_wrap(vp, mouse_x, mouse_y, res_x, res_y, res_screen_x, res_screen_y) \
|
||||
(video_driver_get_viewport_info(vp) ? video_driver_translate_coord_viewport(vp, mouse_x, mouse_y, res_x, res_y, res_screen_x, res_screen_y) : false)
|
||||
|
||||
|
@ -1163,11 +1160,6 @@ bool video_shader_driver_get_current_shader(video_shader_ctx_t *shader);
|
|||
|
||||
float video_driver_get_refresh_rate(void);
|
||||
|
||||
#if defined(HAVE_GFX_WIDGETS)
|
||||
bool video_driver_has_widgets(void);
|
||||
#endif
|
||||
|
||||
bool video_driver_is_threaded(void);
|
||||
|
||||
bool video_context_driver_get_flags(gfx_ctx_flags_t *flags);
|
||||
|
||||
|
|
|
@ -7022,6 +7022,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||
materialui_handle_t *mui = (materialui_handle_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_display_t *p_disp = disp_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
menu_list_t *menu_list = menu_st->entries.list;
|
||||
menu_input_t *menu_input = &menu_st->input_state;
|
||||
|
@ -7062,7 +7063,9 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||
gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata);
|
||||
}
|
||||
|
||||
video_driver_set_viewport(video_width, video_height, true, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, true, false);
|
||||
|
||||
/* Clear text */
|
||||
materialui_font_bind(&mui->font_data.title);
|
||||
|
@ -7303,7 +7306,9 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||
materialui_font_unbind(&mui->font_data.list);
|
||||
materialui_font_unbind(&mui->font_data.hint);
|
||||
|
||||
video_driver_set_viewport(video_width, video_height, false, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, false, true);
|
||||
}
|
||||
|
||||
/* Determines current list view type, based on
|
||||
|
|
|
@ -11372,6 +11372,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
|
|||
gfx_display_t *p_disp = (gfx_display_t*)video_info->disp_userdata;
|
||||
gfx_animation_t *p_anim = anim_get_ptr();
|
||||
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
menu_list_t *menu_list = menu_st->entries.list;
|
||||
|
||||
|
@ -11477,7 +11478,9 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
|
|||
return;
|
||||
}
|
||||
|
||||
video_driver_set_viewport(video_width, video_height, true, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, true, false);
|
||||
|
||||
/* Clear text */
|
||||
ozone_font_bind(&ozone->fonts.footer);
|
||||
|
@ -11748,7 +11751,9 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
|
|||
ozone_font_unbind(&ozone->fonts.entries_sublabel);
|
||||
ozone_font_unbind(&ozone->fonts.sidebar);
|
||||
|
||||
video_driver_set_viewport(video_width, video_height, false, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, false, true);
|
||||
}
|
||||
|
||||
static void ozone_set_header(ozone_handle_t *ozone)
|
||||
|
|
|
@ -5683,6 +5683,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
|||
gfx_display_t *p_disp = (gfx_display_t*)video_info->disp_userdata;
|
||||
gfx_animation_t *p_anim = anim_get_ptr();
|
||||
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
menu_list_t *menu_list = menu_st->entries.list;
|
||||
bool input_dialog_display_kb = menu_input_dialog_get_display_kb();
|
||||
|
@ -5703,7 +5704,9 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
|||
return;
|
||||
}
|
||||
|
||||
video_driver_set_viewport(video_width, video_height, true, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, true, false);
|
||||
|
||||
pseudo_font_length = xmb->icon_spacing_horizontal * 4 - xmb->icon_size / 4.0f;
|
||||
left_thumbnail_margin_width = xmb->icon_size * 3.4f;
|
||||
|
@ -6405,7 +6408,9 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
|||
video_height);
|
||||
}
|
||||
|
||||
video_driver_set_viewport(video_width, video_height, false, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, false, true);
|
||||
}
|
||||
|
||||
static void xmb_layout_ps3(xmb_handle_t *xmb, int width)
|
||||
|
|
|
@ -9717,7 +9717,10 @@ unsigned menu_displaylist_build_list(
|
|||
bool video_font_enable = settings->bools.video_font_enable;
|
||||
bool video_msg_bgcolor_enable = settings->bools.video_msg_bgcolor_enable;
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
bool widgets_supported = video_driver_has_widgets();
|
||||
video_driver_state_t *video_st= video_state_get_ptr();
|
||||
bool widgets_supported = video_st->current_video
|
||||
&& video_st->current_video->gfx_widgets_enabled
|
||||
&& video_st->current_video->gfx_widgets_enabled(video_st->data);
|
||||
bool widgets_active = gfx_widgets_ready();
|
||||
bool menu_widget_scale_auto = settings->bools.menu_widget_scale_auto;
|
||||
#else
|
||||
|
|
|
@ -749,9 +749,10 @@ void menu_screensaver_iterate(
|
|||
void menu_screensaver_frame(menu_screensaver_t *screensaver,
|
||||
video_frame_info_t *video_info, gfx_display_t *p_disp)
|
||||
{
|
||||
void *userdata = NULL;
|
||||
unsigned video_width;
|
||||
unsigned video_height;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
void *userdata = NULL;
|
||||
|
||||
if (!screensaver)
|
||||
return;
|
||||
|
@ -761,7 +762,9 @@ void menu_screensaver_frame(menu_screensaver_t *screensaver,
|
|||
userdata = video_info->userdata;
|
||||
|
||||
/* Set viewport */
|
||||
video_driver_set_viewport(video_width, video_height, true, false);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, true, false);
|
||||
|
||||
/* Draw background */
|
||||
gfx_display_draw_quad(
|
||||
|
@ -816,5 +819,7 @@ void menu_screensaver_frame(menu_screensaver_t *screensaver,
|
|||
}
|
||||
|
||||
/* Unset viewport */
|
||||
video_driver_set_viewport(video_width, video_height, false, true);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, video_width, video_height, false, true);
|
||||
}
|
||||
|
|
94
retroarch.c
94
retroarch.c
|
@ -575,15 +575,64 @@ static bool driver_find_next(const char *label, char *s, size_t len)
|
|||
return false;
|
||||
}
|
||||
|
||||
static float audio_driver_monitor_adjust_system_rates(
|
||||
double input_sample_rate,
|
||||
double input_fps,
|
||||
float video_refresh_rate,
|
||||
unsigned video_swap_interval,
|
||||
float audio_max_timing_skew)
|
||||
{
|
||||
float inp_sample_rate = input_sample_rate;
|
||||
float target_video_sync_rate = video_refresh_rate
|
||||
/ (float)video_swap_interval;
|
||||
float timing_skew =
|
||||
fabs(1.0f - input_fps / target_video_sync_rate);
|
||||
if (timing_skew <= audio_max_timing_skew)
|
||||
return (inp_sample_rate * target_video_sync_rate / input_fps);
|
||||
return inp_sample_rate;
|
||||
}
|
||||
|
||||
static bool video_driver_monitor_adjust_system_rates(
|
||||
unsigned _video_swap_interval,
|
||||
float timing_skew_hz,
|
||||
float video_refresh_rate,
|
||||
bool vrr_runloop_enable,
|
||||
float audio_max_timing_skew,
|
||||
unsigned video_swap_interval,
|
||||
double input_fps)
|
||||
{
|
||||
float target_video_sync_rate = timing_skew_hz;
|
||||
|
||||
/* Divide target rate only when using Auto interval */
|
||||
if (_video_swap_interval == 0)
|
||||
target_video_sync_rate /= (float)video_swap_interval;
|
||||
|
||||
if (!vrr_runloop_enable)
|
||||
{
|
||||
float timing_skew = fabs(
|
||||
1.0f - input_fps / target_video_sync_rate);
|
||||
/* We don't want to adjust pitch too much. If we have extreme cases,
|
||||
* just don't readjust at all. */
|
||||
if (timing_skew <= audio_max_timing_skew)
|
||||
return true;
|
||||
RARCH_LOG("[Video]: Timings deviate too much. Will not adjust."
|
||||
" (Target = %.2f Hz, Game = %.2f Hz)\n",
|
||||
target_video_sync_rate,
|
||||
(float)input_fps);
|
||||
}
|
||||
return input_fps <= target_video_sync_rate;
|
||||
}
|
||||
|
||||
static void driver_adjust_system_rates(
|
||||
runloop_state_t *runloop_st,
|
||||
video_driver_state_t *video_st,
|
||||
settings_t *settings,
|
||||
bool vrr_runloop_enable,
|
||||
float video_refresh_rate,
|
||||
float audio_max_timing_skew,
|
||||
bool video_adaptive_vsync,
|
||||
unsigned video_swap_interval)
|
||||
{
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
struct retro_system_av_info *av_info = &video_st->av_info;
|
||||
const struct retro_system_timing *info =
|
||||
(const struct retro_system_timing*)&av_info->timing;
|
||||
|
@ -631,12 +680,13 @@ static void driver_adjust_system_rates(
|
|||
video_st->core_hz = input_fps;
|
||||
|
||||
if (!video_driver_monitor_adjust_system_rates(
|
||||
timing_skew_hz,
|
||||
video_refresh_rate,
|
||||
vrr_runloop_enable,
|
||||
audio_max_timing_skew,
|
||||
video_swap_interval,
|
||||
input_fps))
|
||||
settings->uints.video_swap_interval,
|
||||
timing_skew_hz,
|
||||
video_refresh_rate,
|
||||
vrr_runloop_enable,
|
||||
audio_max_timing_skew,
|
||||
video_swap_interval,
|
||||
input_fps))
|
||||
{
|
||||
/* We won't be able to do VSync reliably
|
||||
when game FPS > monitor FPS. */
|
||||
|
@ -746,7 +796,7 @@ void drivers_init(
|
|||
#endif
|
||||
|
||||
if (flags & (DRIVER_VIDEO_MASK | DRIVER_AUDIO_MASK))
|
||||
driver_adjust_system_rates(
|
||||
driver_adjust_system_rates(runloop_st, video_st, settings,
|
||||
settings->bools.vrr_runloop_enable,
|
||||
settings->floats.video_refresh_rate,
|
||||
settings->floats.audio_max_timing_skew,
|
||||
|
@ -892,7 +942,9 @@ void drivers_init(
|
|||
* a global notifications on/off toggle switch */
|
||||
if ( video_font_enable
|
||||
&& menu_enable_widgets
|
||||
&& video_driver_has_widgets())
|
||||
&& video_st->current_video
|
||||
&& video_st->current_video->gfx_widgets_enabled
|
||||
&& video_st->current_video->gfx_widgets_enabled(video_st->data))
|
||||
{
|
||||
bool rarch_force_fullscreen = video_st->flags &
|
||||
VIDEO_FLAG_FORCE_FULLSCREEN;
|
||||
|
@ -1160,17 +1212,19 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
|
|||
{
|
||||
case RARCH_DRIVER_CTL_SET_REFRESH_RATE:
|
||||
{
|
||||
float *hz = (float*)data;
|
||||
float *hz = (float*)data;
|
||||
audio_driver_state_t
|
||||
*audio_st = audio_state_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
*audio_st = audio_state_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
video_driver_state_t*video_st = video_state_get_ptr();
|
||||
unsigned
|
||||
audio_output_sample_rate = settings->uints.audio_output_sample_rate;
|
||||
bool vrr_runloop_enable = settings->bools.vrr_runloop_enable;
|
||||
float video_refresh_rate = settings->floats.video_refresh_rate;
|
||||
float audio_max_timing_skew = settings->floats.audio_max_timing_skew;
|
||||
bool video_adaptive_vsync = settings->bools.video_adaptive_vsync;
|
||||
unsigned video_swap_interval = settings->uints.video_swap_interval;
|
||||
audio_output_sample_rate = settings->uints.audio_output_sample_rate;
|
||||
bool vrr_runloop_enable = settings->bools.vrr_runloop_enable;
|
||||
float video_refresh_rate = settings->floats.video_refresh_rate;
|
||||
float audio_max_timing_skew = settings->floats.audio_max_timing_skew;
|
||||
bool video_adaptive_vsync = settings->bools.video_adaptive_vsync;
|
||||
unsigned video_swap_interval = settings->uints.video_swap_interval;
|
||||
|
||||
video_monitor_set_refresh_rate(*hz);
|
||||
|
||||
|
@ -1179,7 +1233,7 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
|
|||
audio_st->source_ratio_current =
|
||||
(double)audio_output_sample_rate / audio_st->input;
|
||||
|
||||
driver_adjust_system_rates(
|
||||
driver_adjust_system_rates(runloop_st, video_st, settings,
|
||||
vrr_runloop_enable,
|
||||
video_refresh_rate,
|
||||
audio_max_timing_skew,
|
||||
|
|
Loading…
Reference in New Issue
Block a user