Settings cleanups

This commit is contained in:
twinaphex 2020-03-02 20:24:00 +01:00
parent 0ef1b342e4
commit 80991a00f0
6 changed files with 63 additions and 47 deletions

View File

@ -503,8 +503,10 @@ static void d3d8_overlay_render(d3d8_video_t *d3d,
if (!force_linear)
{
settings_t *settings = config_get_ptr();
if (!settings->bools.menu_linear_filter)
settings_t *settings = config_get_ptr();
bool menu_linear_filter = settings->bools.menu_linear_filter;
if (!menu_linear_filter)
filter_type = D3DTEXF_POINT;
}

View File

@ -3591,6 +3591,7 @@ static void *gl2_init(const video_info_t *video,
unsigned full_x, full_y;
video_shader_ctx_info_t shader_info;
settings_t *settings = config_get_ptr();
bool video_gpu_record = settings->bools.video_gpu_record;
int interval = 0;
unsigned mip_level = 0;
unsigned win_width = 0;
@ -3918,7 +3919,7 @@ static void *gl2_init(const video_info_t *video,
* driver.recording_data, because recording is
* not initialized yet.
*/
gl->pbo_readback_enable = settings->bools.video_gpu_record
gl->pbo_readback_enable = video_gpu_record
&& recording_is_enabled();
if (gl->pbo_readback_enable && gl2_init_pbo_readback(gl))

View File

@ -242,6 +242,9 @@ static void *gl1_gfx_init(const video_info_t *video,
unsigned win_width = 0, win_height = 0;
unsigned temp_width = 0, temp_height = 0;
settings_t *settings = config_get_ptr();
bool video_smooth = settings->bools.video_smooth;
bool video_font_enable = settings->bools.video_font_enable;
const char *video_context_driver = settings->arrays.video_context_driver;
gl1_t *gl1 = (gl1_t*)calloc(1, sizeof(*gl1));
const char *vendor = NULL;
const char *renderer = NULL;
@ -268,7 +271,7 @@ static void *gl1_gfx_init(const video_info_t *video,
gl1_video_pitch = video->width * 2;
ctx_driver = video_context_driver_init_first(gl1,
settings->arrays.video_context_driver,
video_context_driver,
GFX_CTX_OPENGL_API, 1, 1, false, &ctx_data);
if (!ctx_driver)
@ -290,7 +293,8 @@ static void *gl1_gfx_init(const video_info_t *video,
mode.width = 0;
mode.height = 0;
#ifdef VITA
if (!vgl_inited) {
if (!vgl_inited)
{
vglInitExtended(0x1400000, full_x, full_y, 0x100000, SCE_GXM_MULTISAMPLE_4X);
vglUseVram(GL_TRUE);
vglStartRendering();
@ -393,14 +397,14 @@ static void *gl1_gfx_init(const video_info_t *video,
video_context_driver_input_driver(&inp);
if (settings->bools.video_font_enable)
if (video_font_enable)
font_driver_init_osd(gl1,
video,
false,
video->is_threaded,
FONT_DRIVER_RENDER_OPENGL1_API);
gl1->smooth = settings->bools.video_smooth;
gl1->smooth = video_smooth;
gl1->supports_bgra = string_list_find_elem(gl1->extensions, "GL_EXT_bgra");
glDisable(GL_BLEND);

View File

@ -91,14 +91,16 @@ static void wiiu_set_projection(wiiu_video_t *wiiu)
static void wiiu_gfx_update_viewport(wiiu_video_t *wiiu)
{
int x = 0;
int y = 0;
unsigned viewport_width = wiiu->color_buffer.surface.width;
unsigned viewport_height = wiiu->color_buffer.surface.height;
float device_aspect = (float)viewport_width / viewport_height;
settings_t *settings = config_get_ptr();
int x = 0;
int y = 0;
unsigned viewport_width = wiiu->color_buffer.surface.width;
unsigned viewport_height = wiiu->color_buffer.surface.height;
float device_aspect = (float)viewport_width / viewport_height;
settings_t *settings = config_get_ptr();
bool video_scale_integer = settings->bools.video_scale_integer;
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
if (settings->bools.video_scale_integer)
if (video_scale_integer)
{
video_viewport_get_scaled_integer(&wiiu->vp,
viewport_width, viewport_height,
@ -111,8 +113,7 @@ static void wiiu_gfx_update_viewport(wiiu_video_t *wiiu)
float desired_aspect = video_driver_get_aspect_ratio();
#if defined(HAVE_MENU)
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
@ -183,12 +184,13 @@ static void *wiiu_gfx_init(const video_info_t *video,
input_driver_t **input, void **input_data)
{
unsigned i;
settings_t *settings = config_get_ptr();
float refresh_rate = 60.0f / 1.001f;
u32 size = 0;
u32 tmp = 0;
void *wiiuinput = NULL;
wiiu_video_t *wiiu = calloc(1, sizeof(*wiiu));
float refresh_rate = 60.0f / 1.001f;
u32 size = 0;
u32 tmp = 0;
void *wiiuinput = NULL;
wiiu_video_t *wiiu = (wiiu_video_t*)calloc(1, sizeof(*wiiu));
settings_t *settings = config_get_ptr();
const char *input_joypad_driver = settings->arrays.input_joypad_driver;
if (!wiiu)
return NULL;
@ -198,7 +200,7 @@ static void *wiiu_gfx_init(const video_info_t *video,
if (input && input_data)
{
wiiuinput = input_wiiu.init(settings->arrays.input_joypad_driver);
wiiuinput = input_wiiu.init(input_joypad_driver);
*input = wiiuinput ? &input_wiiu : NULL;
*input_data = wiiuinput;
}

View File

@ -774,14 +774,15 @@ static void gx_efb_screenshot(void)
static void *gx_init(const video_info_t *video,
input_driver_t **input, void **input_data)
{
void *gxinput = NULL;
settings_t *settings = config_get_ptr();
gx_video_t *gx = (gx_video_t*)calloc(1, sizeof(gx_video_t));
bool video_smooth = settings->bools.video_smooth;
void *gxinput = NULL;
settings_t *settings = config_get_ptr();
gx_video_t *gx = (gx_video_t*)calloc(1, sizeof(gx_video_t));
bool video_smooth = settings->bools.video_smooth;
const char *input_joypad_driver = settings->arrays.input_joypad_driver;
if (!gx)
return NULL;
gxinput = input_gx.init(settings->arrays.input_joypad_driver);
gxinput = input_gx.init(input_joypad_driver);
*input = gxinput ? &input_gx : NULL;
*input_data = gxinput;
@ -1553,10 +1554,14 @@ static bool gx_frame(void *data, const void *frame,
uint32_t level = 0;
unsigned overscan_corr_top = settings->uints.video_overscan_correction_top;
unsigned overscan_corr_bottom = settings->uints.video_overscan_correction_bottom;
bool video_smooth = settings->bools.video_smooth;
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
unsigned overscan_corr_top = settings->uints.video_overscan_correction_top;
unsigned overscan_corr_bottom = settings->uints.video_overscan_correction_bottom;
fps_text_buf[0] = '\0';
if(!gx || (!frame && !gx->menu_texture_enable) || !settings)
if(!gx || (!frame && !gx->menu_texture_enable))
return true;
if (!frame)
@ -1573,10 +1578,10 @@ static bool gx_frame(void *data, const void *frame,
if(gx->should_resize)
{
gx_resize(gx,
settings->bools.video_smooth,
settings->uints.video_aspect_ratio_idx,
settings->uints.video_overscan_correction_top,
settings->uints.video_overscan_correction_bottom);
video_smooth,
video_aspect_ratio_idx,
overscan_corr_top,
overscan_corr_bottom);
clear_efb = GX_TRUE;
}
@ -1589,7 +1594,7 @@ static bool gx_frame(void *data, const void *frame,
if (width != gx_old_width || height != gx_old_height)
{
init_texture(gx, width, height,
settings->bools.video_smooth ? GX_LINEAR : GX_NEAR);
video_smooth ? GX_LINEAR : GX_NEAR);
gx_old_width = width;
gx_old_height = height;
}
@ -1650,11 +1655,12 @@ static bool gx_frame(void *data, const void *frame,
#endif
_CPU_ISR_Disable(level);
if (referenceRetraceCount > retraceCount) {
if(g_vsync) {
if (referenceRetraceCount > retraceCount)
{
if(g_vsync)
VIDEO_WaitVSync();
}
}
referenceRetraceCount = retraceCount;
_CPU_ISR_Restore(level);

View File

@ -256,16 +256,17 @@ static void metal_apply_state_changes(void *data)
}
static void metal_set_texture_frame(void *data, const void *frame,
bool rgb32, unsigned width, unsigned height,
float alpha)
bool rgb32, unsigned width, unsigned height,
float alpha)
{
MetalDriver *md = (__bridge MetalDriver *)data;
settings_t *settings = config_get_ptr();
MetalDriver *md = (__bridge MetalDriver *)data;
settings_t *settings = config_get_ptr();
bool menu_linear_filter = settings->bools.menu_linear_filter;
[md.menu updateWidth:width
height:height
format:rgb32 ? RPixelFormatBGRA8Unorm : RPixelFormatBGRA4Unorm
filter:settings->bools.menu_linear_filter ? RTextureFilterLinear : RTextureFilterNearest];
filter:menu_linear_filter ? RTextureFilterLinear : RTextureFilterNearest];
[md.menu updateFrame:frame];
md.menu.alpha = alpha;
}
@ -306,7 +307,7 @@ static uint32_t metal_get_flags(void *data)
BIT32_SET(flags, GFX_CTX_FLAGS_SCREENSHOTS_SUPPORTED);
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
return flags;
@ -329,7 +330,7 @@ static const video_poke_interface_t metal_poke_interface = {
};
static void metal_get_poke_interface(void *data,
const video_poke_interface_t **iface)
const video_poke_interface_t **iface)
{
(void)data;
*iface = &metal_poke_interface;
@ -346,7 +347,7 @@ static void metal_overlay_enable(void *data, bool state)
}
static bool metal_overlay_load(void *data,
const void *images, unsigned num_images)
const void *images, unsigned num_images)
{
MetalDriver *md = (__bridge MetalDriver *)data;
if (!md)
@ -356,7 +357,7 @@ static bool metal_overlay_load(void *data,
}
static void metal_overlay_tex_geom(void *data, unsigned index,
float x, float y, float w, float h)
float x, float y, float w, float h)
{
MetalDriver *md = (__bridge MetalDriver *)data;
if (!md)
@ -366,7 +367,7 @@ static void metal_overlay_tex_geom(void *data, unsigned index,
}
static void metal_overlay_vertex_geom(void *data, unsigned index,
float x, float y, float w, float h)
float x, float y, float w, float h)
{
MetalDriver *md = (__bridge MetalDriver *)data;
if (!md)