This commit is contained in:
twinaphex 2018-04-24 04:46:13 +02:00
parent 17cbc80a9b
commit 2760586086

View File

@ -878,7 +878,9 @@ static bool video_driver_pixel_converter_init(unsigned size)
if (hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE)
return true;
RARCH_WARN("0RGB1555 pixel format is deprecated, and will be slower. For 15/16-bit, RGB565 format is preferred.\n");
RARCH_WARN("0RGB1555 pixel format is deprecated,"
" and will be slower. For 15/16-bit, RGB565"
" format is preferred.\n");
scalr = (video_pixel_scaler_t*)calloc(1, sizeof(*scalr));
@ -1046,7 +1048,8 @@ static bool video_driver_init_internal(bool *video_is_threaded)
}
else
#endif
video_driver_data = current_video->init(&video, input_get_double_ptr(),
video_driver_data = current_video->init(
&video, input_get_double_ptr(),
input_driver_get_data_ptr());
if (!video_driver_data)
@ -1437,7 +1440,8 @@ void video_driver_monitor_adjust_system_rates(void)
if (timing_skew <= settings->floats.audio_max_timing_skew)
return;
RARCH_LOG("[Video]: Timings deviate too much. Will not adjust. (Display = %.2f Hz, Game = %.2f Hz)\n",
RARCH_LOG("[Video]: Timings deviate too much. Will not adjust."
" (Display = %.2f Hz, Game = %.2f Hz)\n",
video_refresh_rate,
(float)info->fps);
@ -1549,7 +1553,8 @@ void video_driver_menu_settings(void **list_data, void *list_info_data,
parent_group,
general_write_handler,
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 0, 5, 1, true, true);
menu_settings_list_current_add_range(list, list_info,
0, 5, 1, true, true);
#endif
#endif
}
@ -1611,7 +1616,8 @@ bool video_driver_is_stub_frame(void)
bool video_driver_supports_recording(void)
{
settings_t *settings = config_get_ptr();
return settings->bools.video_gpu_record && current_video->read_viewport;
return settings->bools.video_gpu_record
&& current_video->read_viewport;
}
bool video_driver_supports_viewport_read(void)
@ -1637,7 +1643,8 @@ void video_driver_set_viewport_config(void)
{
struct retro_game_geometry *geom = &video_driver_av_info.geometry;
if (geom->aspect_ratio > 0.0f && settings->bools.video_aspect_ratio_auto)
if (geom->aspect_ratio > 0.0f &&
settings->bools.video_aspect_ratio_auto)
aspectratio_lut[ASPECT_RATIO_CONFIG].value = geom->aspect_ratio;
else
{
@ -1864,7 +1871,8 @@ void video_driver_update_viewport(struct video_viewport* vp, bool force_full, bo
}
else if (device_aspect > desired_aspect)
{
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
delta = (desired_aspect / device_aspect - 1.0f)
/ 2.0f + 0.5f;
vp->x = (int)roundf(vp->full_width * (0.5f - delta));
vp->width = (unsigned)roundf(2.0f * vp->full_width * delta);
vp->y = 0;
@ -1874,7 +1882,8 @@ void video_driver_update_viewport(struct video_viewport* vp, bool force_full, bo
{
vp->x = 0;
vp->width = vp->full_width;
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
delta = (device_aspect / desired_aspect - 1.0f)
/ 2.0f + 0.5f;
vp->y = (int)roundf(vp->full_height * (0.5f - delta));
vp->height = (unsigned)roundf(2.0f * vp->full_height * delta);
}
@ -1981,18 +1990,17 @@ bool video_driver_find_driver(void)
void video_driver_apply_state_changes(void)
{
if (!video_driver_poke)
return;
if (video_driver_poke->apply_state_changes)
if (video_driver_poke &&
video_driver_poke->apply_state_changes)
video_driver_poke->apply_state_changes(video_driver_data);
}
bool video_driver_read_viewport(uint8_t *buffer, bool is_idle)
{
if ( current_video->read_viewport
&& current_video->read_viewport(video_driver_data, buffer, is_idle))
&& current_video->read_viewport(
video_driver_data, buffer, is_idle))
return true;
return false;
}
@ -2201,7 +2209,8 @@ void video_driver_gpu_record_deinit(void)
video_driver_record_gpu_buffer = NULL;
}
bool video_driver_get_current_software_framebuffer(struct retro_framebuffer *fb)
bool video_driver_get_current_software_framebuffer(
struct retro_framebuffer *fb)
{
if (
video_driver_poke
@ -2288,7 +2297,8 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
unsigned base_width;
/* Use system reported sizes as these define the
* geometry for the "normal" case. */
unsigned base_height = video_driver_av_info.geometry.base_height;
unsigned base_height =
video_driver_av_info.geometry.base_height;
if (base_height == 0)
base_height = 1;
@ -2449,7 +2459,6 @@ void video_driver_frame(const void *data, unsigned width,
if (video_info.fps_show)
{
if (video_info.framecount_show)
{
snprintf(
video_info.fps_text,
sizeof(video_info.fps_text),
@ -2457,15 +2466,12 @@ void video_driver_frame(const void *data, unsigned width,
last_fps,
msg_hash_to_str(MSG_FRAMES),
(uint64_t)video_driver_frame_count);
}
else
{
snprintf(
video_info.fps_text,
sizeof(video_info.fps_text),
"FPS: %6.1f",
last_fps);
}
}
}
else
@ -2501,7 +2507,8 @@ void video_driver_frame(const void *data, unsigned width,
|| video_driver_record_gpu_buffer
) && recording_data
)
recording_dump_frame(data, width, height, pitch, video_info.runloop_is_idle);
recording_dump_frame(data, width, height,
pitch, video_info.runloop_is_idle);
if (data && video_driver_state_filter &&
video_driver_frame_filter(data, &video_info, width, height, pitch,
@ -2549,7 +2556,8 @@ void video_driver_frame(const void *data, unsigned width,
video_info.osd_stat_params.drop_y = -2;
video_info.osd_stat_params.drop_mod = 0.3f;
video_info.osd_stat_params.drop_alpha = 1.0f;
video_info.osd_stat_params.color = COLOR_ABGR(red, green, blue, alpha);
video_info.osd_stat_params.color = COLOR_ABGR(
red, green, blue, alpha);
compute_audio_buffer_statistics(&audio_stats);
@ -2800,9 +2808,6 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->cb_set_mvp = video_driver_cb_shader_set_mvp;
video_info->userdata = video_driver_get_ptr(false);
#if 0
video_info->cb_set_coords = video_driver_cb_set_coords;
#endif
#ifdef HAVE_THREADS
video_driver_threaded_unlock(is_threaded);
@ -2841,12 +2846,14 @@ bool video_driver_translate_coord_viewport(
return false;
if (mouse_x >= 0 && mouse_x <= norm_full_vp_width)
scaled_screen_x = ((2 * mouse_x * 0x7fff) / norm_full_vp_width) - 0x7fff;
scaled_screen_x = ((2 * mouse_x * 0x7fff)
/ norm_full_vp_width) - 0x7fff;
else
scaled_screen_x = -0x8000; /* OOB */
if (mouse_y >= 0 && mouse_y <= norm_full_vp_height)
scaled_screen_y = ((2 * mouse_y * 0x7fff) / norm_full_vp_height) - 0x7fff;
scaled_screen_y = ((2 * mouse_y * 0x7fff)
/ norm_full_vp_height) - 0x7fff;
else
scaled_screen_y = -0x8000; /* OOB */
@ -2854,12 +2861,14 @@ bool video_driver_translate_coord_viewport(
mouse_y -= vp->y;
if (mouse_x >= 0 && mouse_x <= norm_vp_width)
scaled_x = ((2 * mouse_x * 0x7fff) / norm_vp_width) - 0x7fff;
scaled_x = ((2 * mouse_x * 0x7fff)
/ norm_vp_width) - 0x7fff;
else
scaled_x = -0x8000; /* OOB */
if (mouse_y >= 0 && mouse_y <= norm_vp_height)
scaled_y = ((2 * mouse_y * 0x7fff) / norm_vp_height) - 0x7fff;
scaled_y = ((2 * mouse_y * 0x7fff)
/ norm_vp_height) - 0x7fff;
else
scaled_y = -0x8000; /* OOB */
@ -2884,7 +2893,8 @@ void video_driver_get_status(uint64_t *frame_count, bool * is_alive,
bool *is_focused)
{
*frame_count = video_driver_frame_count;
*is_alive = current_video ? current_video->alive(video_driver_data) : true;
*is_alive = current_video ?
current_video->alive(video_driver_data) : true;
*is_focused = video_driver_cb_has_focus();
}
@ -2937,7 +2947,8 @@ bool video_context_driver_find_prev_driver(void)
bool video_context_driver_find_next_driver(void)
{
settings_t *settings = config_get_ptr();
int i = find_video_context_driver_index(settings->arrays.video_context_driver);
int i = find_video_context_driver_index(
settings->arrays.video_context_driver);
if (i >= 0 && gfx_ctx_drivers[i + 1])
{
@ -2964,7 +2975,8 @@ bool video_context_driver_find_next_driver(void)
*
* Initialize graphics context driver.
*
* Returns: graphics context driver if successfully initialized, otherwise NULL.
* Returns: graphics context driver if successfully initialized,
* otherwise NULL.
**/
static const gfx_ctx_driver_t *video_context_driver_init(
void *data,
@ -3085,7 +3097,8 @@ bool video_context_driver_init_image_buffer(const video_info_t *data)
{
if (
current_video_context.image_buffer_init
&& current_video_context.image_buffer_init(video_context_data, data))
&& current_video_context.image_buffer_init(
video_context_data, data))
return true;
return false;
}
@ -3207,7 +3220,8 @@ bool video_context_driver_get_refresh_rate(float *refresh_rate)
bool video_context_driver_input_driver(gfx_ctx_input_t *inp)
{
settings_t *settings = config_get_ptr();
const char *joypad_name = settings ? settings->arrays.input_joypad_driver : NULL;
const char *joypad_name = settings ?
settings->arrays.input_joypad_driver : NULL;
if (!current_video_context.input_driver)
return false;
@ -3263,7 +3277,8 @@ bool video_context_driver_get_context_data(void *data)
{
if (!current_video_context.get_context_data)
return false;
*(void**)data = current_video_context.get_context_data(video_context_data);
*(void**)data = current_video_context.get_context_data(
video_context_data);
return true;
}
@ -3295,7 +3310,7 @@ bool video_context_driver_get_flags(gfx_ctx_flags_t *flags)
if (deferred_video_context_driver_set_flags)
{
flags->flags = deferred_flag_data.flags;
flags->flags = deferred_flag_data.flags;
deferred_video_context_driver_set_flags = false;
return true;
}
@ -3310,7 +3325,7 @@ bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)
return false;
if (!current_video_context.set_flags)
{
deferred_flag_data.flags = flags->flags;
deferred_flag_data.flags = flags->flags;
deferred_video_context_driver_set_flags = true;
return false;
}
@ -3370,7 +3385,8 @@ bool video_driver_cached_frame_has_valid_framebuffer(void)
return false;
}
static const shader_backend_t *video_shader_set_backend(enum rarch_shader_type type)
static const shader_backend_t *video_shader_set_backend(
enum rarch_shader_type type)
{
switch (type)
{
@ -3446,7 +3462,8 @@ void video_shader_driver_set_parameters(void *data)
}
}
bool video_shader_driver_get_prev_textures(video_shader_ctx_texture_t *texture)
bool video_shader_driver_get_prev_textures(
video_shader_ctx_texture_t *texture)
{
if (!texture || !current_shader)
return false;
@ -3475,7 +3492,8 @@ bool video_shader_driver_get_current_shader(video_shader_ctx_t *shader)
return true;
}
bool video_shader_driver_direct_get_current_shader(video_shader_ctx_t *shader)
bool video_shader_driver_direct_get_current_shader(
video_shader_ctx_t *shader)
{
shader->data = current_shader->get_current_shader(current_shader_data);
@ -3491,7 +3509,7 @@ bool video_shader_driver_deinit(void)
current_shader->deinit(current_shader_data);
current_shader_data = NULL;
current_shader = NULL;
current_shader = NULL;
return true;
}
@ -3512,7 +3530,8 @@ static bool video_driver_cb_set_mvp(void *data,
return true;
}
static struct video_shader *video_shader_driver_get_current_shader_null(void *data)
static struct video_shader *
video_shader_driver_get_current_shader_null(void *data)
{
return NULL;
}
@ -3529,13 +3548,15 @@ static void video_shader_driver_scale_null(void *data,
(void)scale;
}
static bool video_shader_driver_mipmap_input_null(void *data, unsigned idx)
static bool video_shader_driver_mipmap_input_null(
void *data, unsigned idx)
{
(void)idx;
return false;
}
static bool video_shader_driver_filter_type_null(void *data, unsigned idx, bool *smooth)
static bool video_shader_driver_filter_type_null(
void *data, unsigned idx, bool *smooth)
{
(void)idx;
(void)smooth;
@ -3547,7 +3568,8 @@ static unsigned video_shader_driver_num_null(void *data)
return 0;
}
static bool video_shader_driver_get_feedback_pass_null(void *data, unsigned *idx)
static bool video_shader_driver_get_feedback_pass_null(
void *data, unsigned *idx)
{
(void)idx;
return false;
@ -3696,12 +3718,14 @@ void video_driver_set_coords(video_shader_ctx_coords_t *coords)
{
if (current_shader && current_shader->set_coords)
current_shader->set_coords(coords->handle_data,
current_shader_data, (const struct video_coords*)coords->data);
current_shader_data,
(const struct video_coords*)coords->data);
else
{
if (video_driver_poke && video_driver_poke->set_coords)
video_driver_poke->set_coords(coords->handle_data,
current_shader_data, (const struct video_coords*)coords->data);
current_shader_data,
(const struct video_coords*)coords->data);
}
}
@ -3711,11 +3735,13 @@ void video_driver_set_mvp(video_shader_ctx_mvp_t *mvp)
return;
if (current_shader && current_shader->set_mvp)
current_shader->set_mvp(mvp->data, current_shader_data, mvp->matrix);
current_shader->set_mvp(mvp->data,
current_shader_data, mvp->matrix);
else
{
if (video_driver_poke && video_driver_poke->set_mvp)
video_driver_poke->set_mvp(mvp->data, current_shader_data, mvp->matrix);
video_driver_poke->set_mvp(mvp->data,
current_shader_data, mvp->matrix);
}
}