Consistent viewport naming conventions

This commit is contained in:
libretroadmin 2024-12-24 22:50:51 +01:00
parent 83a187784a
commit 44238e909f
44 changed files with 533 additions and 551 deletions

View File

@ -2279,11 +2279,11 @@ static struct config_float_setting *populate_settings_float(
#endif
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, DEFAULT_ASPECT_RATIO, false);
SETTING_FLOAT("video_viewport_bias_x", &settings->floats.video_viewport_bias_x, true, DEFAULT_VIEWPORT_BIAS_X, false);
SETTING_FLOAT("video_viewport_bias_y", &settings->floats.video_viewport_bias_y, true, DEFAULT_VIEWPORT_BIAS_Y, false);
SETTING_FLOAT("video_viewport_bias_x", &settings->floats.video_vp_bias_x, true, DEFAULT_VIEWPORT_BIAS_X, false);
SETTING_FLOAT("video_viewport_bias_y", &settings->floats.video_vp_bias_y, true, DEFAULT_VIEWPORT_BIAS_Y, false);
#if defined(RARCH_MOBILE)
SETTING_FLOAT("video_viewport_bias_portrait_x", &settings->floats.video_viewport_bias_portrait_x, true, DEFAULT_VIEWPORT_BIAS_PORTRAIT_X, false);
SETTING_FLOAT("video_viewport_bias_portrait_y", &settings->floats.video_viewport_bias_portrait_y, true, DEFAULT_VIEWPORT_BIAS_PORTRAIT_Y, false);
SETTING_FLOAT("video_viewport_bias_portrait_x", &settings->floats.video_vp_bias_portrait_x, true, DEFAULT_VIEWPORT_BIAS_PORTRAIT_X, false);
SETTING_FLOAT("video_viewport_bias_portrait_y", &settings->floats.video_vp_bias_portrait_y, true, DEFAULT_VIEWPORT_BIAS_PORTRAIT_Y, false);
#endif
SETTING_FLOAT("video_refresh_rate", &settings->floats.video_refresh_rate, true, DEFAULT_REFRESH_RATE, false);
SETTING_FLOAT("video_autoswitch_pal_threshold", &settings->floats.video_autoswitch_pal_threshold, true, DEFAULT_AUTOSWITCH_PAL_THRESHOLD, false);
@ -2431,10 +2431,10 @@ static struct config_uint_setting *populate_settings_uint(
SETTING_UINT("crt_switch_resolution", &settings->uints.crt_switch_resolution, true, DEFAULT_CRT_SWITCH_RESOLUTION, false);
SETTING_UINT("crt_switch_resolution_super", &settings->uints.crt_switch_resolution_super, true, DEFAULT_CRT_SWITCH_RESOLUTION_SUPER, false);
SETTING_UINT("custom_viewport_width", &settings->video_viewport_custom.width, false, 0 /* TODO */, false);
SETTING_UINT("custom_viewport_height", &settings->video_viewport_custom.height, false, 0 /* TODO */, false);
SETTING_UINT("custom_viewport_x", (unsigned*)&settings->video_viewport_custom.x, false, 0 /* TODO */, false);
SETTING_UINT("custom_viewport_y", (unsigned*)&settings->video_viewport_custom.y, false, 0 /* TODO */, false);
SETTING_UINT("custom_viewport_width", &settings->video_vp_custom.width, false, 0 /* TODO */, false);
SETTING_UINT("custom_viewport_height", &settings->video_vp_custom.height, false, 0 /* TODO */, false);
SETTING_UINT("custom_viewport_x", (unsigned*)&settings->video_vp_custom.x, false, 0 /* TODO */, false);
SETTING_UINT("custom_viewport_y", (unsigned*)&settings->video_vp_custom.y, false, 0 /* TODO */, false);
SETTING_UINT("aspect_ratio_index", &settings->uints.video_aspect_ratio_idx, true, DEFAULT_ASPECT_RATIO_IDX, false);
SETTING_UINT("video_autoswitch_refresh_rate", &settings->uints.video_autoswitch_refresh_rate, true, DEFAULT_AUTOSWITCH_REFRESH_RATE, false);
SETTING_UINT("video_monitor_index", &settings->uints.video_monitor_index, true, DEFAULT_MONITOR_INDEX, false);
@ -2735,7 +2735,7 @@ void config_set_defaults(void *data)
const char *def_record = config_get_default_record();
const char *def_midi = config_get_default_midi();
const char *def_mitm = DEFAULT_NETPLAY_MITM_SERVER;
struct video_viewport *custom_vp = &settings->video_viewport_custom;
struct video_viewport *custom_vp = &settings->video_vp_custom;
struct config_float_setting *float_settings = populate_settings_float (settings, &float_settings_size);
struct config_bool_setting *bool_settings = populate_settings_bool (settings, &bool_settings_size);
struct config_int_setting *int_settings = populate_settings_int (settings, &int_settings_size);

View File

@ -102,7 +102,7 @@ typedef struct settings
size_t rewind_buffer_size;
} sizes;
video_viewport_t video_viewport_custom; /* int alignment */
video_viewport_t video_vp_custom; /* int alignment */
struct
{
@ -384,11 +384,11 @@ typedef struct settings
{
float placeholder;
float video_aspect_ratio;
float video_viewport_bias_x;
float video_viewport_bias_y;
float video_vp_bias_x;
float video_vp_bias_y;
#if defined(RARCH_MOBILE)
float video_viewport_bias_portrait_x;
float video_viewport_bias_portrait_y;
float video_vp_bias_portrait_x;
float video_vp_bias_portrait_y;
#endif
float video_refresh_rate;
float video_autoswitch_pal_threshold;

View File

@ -27,11 +27,11 @@
#define CTR_BOTTOM_FRAMEBUFFER_HEIGHT 240
#define CTR_STATE_DATE_SIZE 11
#define CTR_SET_SCALE_VECTOR(vec, viewport_width, viewport_height, texture_width, texture_height) \
(vec)->x = -2.0f / (viewport_width); \
(vec)->y = -2.0f / (viewport_height); \
(vec)->u = 1.0f / (texture_width); \
(vec)->v = -1.0f / (texture_height)
#define CTR_SET_SCALE_VECTOR(vec, vp_width, vp_height, tex_width, tex_height) \
(vec)->x = -2.0f / (vp_width); \
(vec)->y = -2.0f / (vp_height); \
(vec)->u = 1.0f / (tex_width); \
(vec)->v = -1.0f / (tex_height)
typedef enum
{
@ -79,19 +79,19 @@ typedef struct ctr_video
struct
{
uint32_t* display_list;
int display_list_size;
void* texture_linear;
void* texture_swizzled;
ctr_vertex_t* frame_coords;
int display_list_size;
int texture_width;
int texture_height;
ctr_scale_vector_t scale_vector;
ctr_vertex_t* frame_coords;
}menu;
uint32_t* display_list;
uint32_t *display_list;
void *texture_linear;
void *texture_swizzled;
int display_list_size;
void* texture_linear;
void* texture_swizzled;
int texture_width;
int texture_height;
@ -115,7 +115,6 @@ typedef struct ctr_video
int current_buffer_top;
int current_buffer_bottom;
struct
{
ctr_vertex_t* buffer;
@ -186,7 +185,7 @@ extern u8* gfxBottomFramebuffers[2];
#ifdef CONSOLE_LOG
extern PrintConsole* ctrConsole;
#endif
#endif
extern const u8 ctr_sprite_shbin[];
extern const u32 ctr_sprite_shbin_size;

View File

@ -39,7 +39,7 @@ typedef struct d3d8_video
WNDCLASSEX windowClass;
#endif
LPDIRECT3DDEVICE8 dev;
D3DVIEWPORT8 final_viewport;
D3DVIEWPORT8 out_vp;
char *shader_path;

View File

@ -829,10 +829,10 @@ void d3d9_viewport_info(void *data, struct video_viewport *vp)
video_driver_get_size(&width, &height);
vp->x = d3d->final_viewport.X;
vp->y = d3d->final_viewport.Y;
vp->width = d3d->final_viewport.Width;
vp->height = d3d->final_viewport.Height;
vp->x = d3d->out_vp.X;
vp->y = d3d->out_vp.Y;
vp->width = d3d->out_vp.Width;
vp->height = d3d->out_vp.Height;
vp->full_width = width;
vp->full_height = height;
@ -906,12 +906,12 @@ void d3d9_set_viewport(void *data,
d3d->needs_restore = true;
}
d3d->final_viewport.X = x;
d3d->final_viewport.Y = y;
d3d->final_viewport.Width = width;
d3d->final_viewport.Height = height;
d3d->final_viewport.MinZ = 0.0f;
d3d->final_viewport.MaxZ = 1.0f;
d3d->out_vp.X = x;
d3d->out_vp.Y = y;
d3d->out_vp.Width = width;
d3d->out_vp.Height = height;
d3d->out_vp.MinZ = 0.0f;
d3d->out_vp.MaxZ = 1.0f;
d3d9_set_font_rect(d3d, NULL);
}
@ -1038,7 +1038,7 @@ void d3d9_overlay_render(d3d9_video_t *d3d,
/* Restore previous state. */
IDirect3DDevice9_SetRenderState(dev, D3DRS_ALPHABLENDENABLE, false);
IDirect3DDevice9_SetViewport(dev, (D3DVIEWPORT9*)&d3d->final_viewport);
IDirect3DDevice9_SetViewport(dev, (D3DVIEWPORT9*)&d3d->out_vp);
}
void d3d9_free_overlay(d3d9_video_t *d3d, overlay_t *overlay)
@ -1304,14 +1304,14 @@ bool d3d9_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{
unsigned x, y;
unsigned vp_width = (d3d->final_viewport.Width > width) ? width : d3d->final_viewport.Width;
unsigned vp_height = (d3d->final_viewport.Height > height) ? height : d3d->final_viewport.Height;
unsigned vp_width = (d3d->out_vp.Width > width) ? width : d3d->out_vp.Width;
unsigned vp_height = (d3d->out_vp.Height > height) ? height : d3d->out_vp.Height;
unsigned pitchpix = rect.Pitch / 4;
const uint32_t *pixels = (const uint32_t*)rect.pBits;
pixels += d3d->final_viewport.X;
pixels += d3d->out_vp.X;
pixels += (vp_height - 1) * pitchpix;
pixels -= d3d->final_viewport.Y * pitchpix;
pixels -= d3d->out_vp.Y * pitchpix;
for (y = 0; y < vp_height; y++, pixels -= pitchpix)
{

View File

@ -77,7 +77,7 @@ typedef struct d3d9_video
WNDCLASSEX windowClass;
#endif
LPDIRECT3DDEVICE9 dev;
D3DVIEWPORT9 final_viewport;
D3DVIEWPORT9 out_vp;
float translate_x;
float translate_y;
@ -258,7 +258,7 @@ void d3d9_set_osd_msg(void *data,
const char *msg,
const struct font_params *params, void *font);
void d3d9_unload_texture(void *data,
void d3d9_unload_texture(void *data,
bool threaded, uintptr_t id);
void d3d9_set_video_mode(void *data,

View File

@ -102,8 +102,8 @@ typedef struct gl1
unsigned menu_pitch;
unsigned video_bits;
unsigned menu_bits;
unsigned vp_out_width;
unsigned vp_out_height;
unsigned out_vp_width;
unsigned out_vp_height;
unsigned tex_index; /* For use with PREV. */
unsigned textures;
unsigned rotation;

View File

@ -228,8 +228,8 @@ struct gl2
unsigned textures;
unsigned fbo_feedback_pass;
unsigned rotation;
unsigned vp_out_width;
unsigned vp_out_height;
unsigned out_vp_width;
unsigned out_vp_height;
unsigned tex_w;
unsigned tex_h;
unsigned base_size; /* 2 or 4 */

View File

@ -114,8 +114,8 @@ typedef struct gl3
unsigned overlays;
unsigned version_major;
unsigned version_minor;
unsigned vp_out_width;
unsigned vp_out_height;
unsigned out_vp_width;
unsigned out_vp_height;
unsigned rotation;
unsigned textures_index;
unsigned scratch_vbo_index;

View File

@ -565,7 +565,8 @@ typedef struct vk
unsigned video_height;
unsigned tex_w, tex_h;
unsigned vp_out_width, vp_out_height;
unsigned out_vp_width;
unsigned out_vp_height;
unsigned rotation;
unsigned num_swapchain_images;
unsigned last_valid_index;

View File

@ -402,8 +402,8 @@ static const video_poke_interface_t caca_poke_interface = {
static void caca_get_poke_interface(void *data,
const video_poke_interface_t **iface) { *iface = &caca_poke_interface; }
static void caca_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate) { }
static void caca_set_viewport(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate) { }
video_driver_t video_caca = {
caca_init,

View File

@ -768,9 +768,7 @@ static void ctr_update_viewport(
true);
}
else if (ctr->keep_aspect)
{
video_viewport_get_scaled_aspect(&ctr->vp, width, height, true);
}
else
{
ctr->vp.x = 0;

View File

@ -437,7 +437,7 @@ static void d3d8_render(
video_smooth ?
D3DTEXF_LINEAR : D3DTEXF_POINT);
IDirect3DDevice8_SetViewport(chain->dev, (D3DVIEWPORT8*)&d3d->final_viewport);
IDirect3DDevice8_SetViewport(chain->dev, (D3DVIEWPORT8*)&d3d->out_vp);
IDirect3DDevice8_SetVertexShader(d3dr,
D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_DIFFUSE);
IDirect3DDevice8_SetStreamSource(d3dr,
@ -477,7 +477,7 @@ static bool d3d8_setup_init(void *data,
LPDIRECT3DDEVICE8 d3dr = (LPDIRECT3DDEVICE8)d3d->dev;
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)d3d->renderchain_data;
unsigned fmt = (rgb32) ? RETRO_PIXEL_FORMAT_XRGB8888 : RETRO_PIXEL_FORMAT_RGB565;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
video_viewport_t *custom_vp = &settings->video_vp_custom;
video_driver_get_size(&width, &height);
@ -759,10 +759,10 @@ static void d3d8_viewport_info(void *data, struct video_viewport *vp)
video_driver_get_size(&width, &height);
vp->x = d3d->final_viewport.X;
vp->y = d3d->final_viewport.Y;
vp->width = d3d->final_viewport.Width;
vp->height = d3d->final_viewport.Height;
vp->x = d3d->out_vp.X;
vp->y = d3d->out_vp.Y;
vp->width = d3d->out_vp.Width;
vp->height = d3d->out_vp.Height;
vp->full_width = width;
vp->full_height = height;
@ -871,7 +871,7 @@ static void d3d8_overlay_render(d3d8_video_t *d3d,
/* Restore previous state. */
IDirect3DDevice8_SetRenderState(d3d->dev, D3DRS_ALPHABLENDENABLE, false);
IDirect3DDevice8_SetViewport(d3d->dev, (D3DVIEWPORT8*)&d3d->final_viewport);
IDirect3DDevice8_SetViewport(d3d->dev, (D3DVIEWPORT8*)&d3d->out_vp);
}
static void d3d8_free_overlay(d3d8_video_t *d3d, overlay_t *overlay)
@ -1209,12 +1209,12 @@ static void d3d8_set_viewport(void *data,
if (y < 0)
y = 0;
d3d->final_viewport.X = x;
d3d->final_viewport.Y = y;
d3d->final_viewport.Width = width;
d3d->final_viewport.Height = height;
d3d->final_viewport.MinZ = 0.0f;
d3d->final_viewport.MaxZ = 0.0f;
d3d->out_vp.X = x;
d3d->out_vp.Y = y;
d3d->out_vp.Width = width;
d3d->out_vp.Height = height;
d3d->out_vp.MinZ = 0.0f;
d3d->out_vp.MaxZ = 0.0f;
d3d_matrix_identity(&ortho);
d3d_matrix_ortho_off_center_lh(&ortho, 0, 1, 0, 1, 0.0f, 1.0f);

View File

@ -87,7 +87,7 @@ typedef struct d3d9_renderchain
unsigned last_height[TEXTURES];
} prev;
LPDIRECT3DDEVICE9 dev;
D3DVIEWPORT9 *final_viewport;
D3DVIEWPORT9 *out_vp;
struct shader_pass_vector_list *passes;
struct unsigned_vector_list *bound_tex;
struct unsigned_vector_list *bound_vert;
@ -285,7 +285,7 @@ static INLINE bool d3d9_renderchain_set_pass_size(
width, height, 1,
D3DUSAGE_RENDERTARGET,
(pass2->info.pass->fbo.flags & FBO_SCALE_FLAG_FP_FBO)
? D3DFMT_A32B32G32R32F
? D3DFMT_A32B32G32R32F
: D3D9_ARGB8888_FORMAT,
D3DPOOL_DEFAULT, 0, 0, 0,
NULL, NULL, false);
@ -308,12 +308,12 @@ static INLINE void d3d9_convert_geometry(
unsigned *out_height,
unsigned width,
unsigned height,
D3DVIEWPORT9 *final_viewport)
D3DVIEWPORT9 *out_vp)
{
switch (info->pass->fbo.type_x)
{
case RARCH_SCALE_VIEWPORT:
*out_width = info->pass->fbo.scale_x * final_viewport->Width;
*out_width = info->pass->fbo.scale_x * out_vp->Width;
break;
case RARCH_SCALE_ABSOLUTE:
@ -328,7 +328,7 @@ static INLINE void d3d9_convert_geometry(
switch (info->pass->fbo.type_y)
{
case RARCH_SCALE_VIEWPORT:
*out_height = info->pass->fbo.scale_y * final_viewport->Height;
*out_height = info->pass->fbo.scale_y * out_vp->Height;
break;
case RARCH_SCALE_ABSOLUTE:
@ -374,7 +374,7 @@ static INLINE void d3d9_recompute_pass_sizes(
d3d9_convert_geometry(
&link_info,
&out_width, &out_height,
current_width, current_height, &d3d->final_viewport);
current_width, current_height, &d3d->out_vp);
link_info.tex_w = next_pow2(out_width);
link_info.tex_h = next_pow2(out_height);

View File

@ -528,12 +528,9 @@ static void d3d9_cg_renderchain_set_shader_params(
d3d9_renderchain_t *chain,
LPDIRECT3DDEVICE9 dev,
struct shader_pass *pass,
unsigned video_w,
unsigned video_h,
unsigned tex_w,
unsigned tex_h,
unsigned viewport_w,
unsigned viewport_h)
unsigned video_w, unsigned video_h,
unsigned tex_w, unsigned tex_h,
unsigned vp_width, unsigned vp_height)
{
CGparameter param;
float frame_cnt;
@ -547,8 +544,8 @@ static void d3d9_cg_renderchain_set_shader_params(
video_size[1] = video_h;
texture_size[0] = tex_w;
texture_size[1] = tex_h;
output_size[0] = viewport_w;
output_size[1] = viewport_h;
output_size[0] = vp_width;
output_size[1] = vp_height;
frame_cnt = chain->frame_count;
@ -1127,7 +1124,7 @@ static bool d3d9_cg_renderchain_create_first_pass(
static bool d3d9_cg_renderchain_init(
d3d9_video_t *d3d,
LPDIRECT3DDEVICE9 dev,
const D3DVIEWPORT9 *final_viewport,
const D3DVIEWPORT9 *out_vp,
const struct LinkInfo *info,
bool rgb32)
{
@ -1143,7 +1140,7 @@ static bool d3d9_cg_renderchain_init(
}
chain->chain.dev = dev;
chain->chain.final_viewport = (D3DVIEWPORT9*)final_viewport;
chain->chain.out_vp = (D3DVIEWPORT9*)out_vp;
chain->chain.frame_count = 0;
chain->chain.pixel_size = (fmt == RETRO_PIXEL_FORMAT_RGB565) ? 2 : 4;
@ -1399,7 +1396,7 @@ static void d3d9_cg_renderchain_render(
d3d9_convert_geometry(
&first_pass->info,
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
current_width, current_height, chain->out_vp);
d3d9_blit_to_texture(first_pass->tex,
frame_data,
@ -1427,7 +1424,7 @@ static void d3d9_cg_renderchain_render(
d3d9_convert_geometry(&from_pass->info,
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
current_width, current_height, chain->out_vp);
/* Clear out whole FBO. */
viewport.Width = to_pass->info.tex_w;
@ -1467,16 +1464,16 @@ static void d3d9_cg_renderchain_render(
d3d9_convert_geometry(&last_pass->info,
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
current_width, current_height, chain->out_vp);
IDirect3DDevice9_SetViewport(chain->dev, (D3DVIEWPORT9*)chain->final_viewport);
IDirect3DDevice9_SetViewport(chain->dev, (D3DVIEWPORT9*)chain->out_vp);
d3d9_cg_renderchain_set_vertices(
chain, last_pass,
current_width, current_height,
out_width, out_height,
chain->final_viewport->Width,
chain->final_viewport->Height,
chain->out_vp->Width,
chain->out_vp->Height,
rotation);
d3d9_cg_renderchain_render_pass(chain,
@ -1493,8 +1490,8 @@ static void d3d9_cg_renderchain_render(
cgD3D9BindProgram((CGprogram)&_chain->stock_shader.vprg);
d3d9_cg_renderchain_calc_and_set_shader_mvp(
(CGprogram)_chain->stock_shader.vprg,
chain->final_viewport->Width,
chain->final_viewport->Height, 0);
chain->out_vp->Width,
chain->out_vp->Height, 0);
}
static uint32_t d3d9_cg_get_flags(void *data)
@ -1609,7 +1606,7 @@ static bool d3d9_cg_init_chain(d3d9_video_t *d3d,
if (
!d3d9_cg_renderchain_init(
d3d,
d3d->dev, &d3d->final_viewport, &link_info,
d3d->dev, &d3d->out_vp, &link_info,
rgb32)
)
{
@ -1629,7 +1626,7 @@ static bool d3d9_cg_init_chain(d3d9_video_t *d3d,
d3d9_convert_geometry(
&link_info,
&out_width, &out_height,
current_width, current_height, &d3d->final_viewport);
current_width, current_height, &d3d->out_vp);
link_info.pass = &d3d->shader.pass[i];
link_info.tex_w = next_pow2(out_width);
@ -1760,14 +1757,14 @@ static bool d3d9_cg_initialize(d3d9_video_t *d3d, const video_info_t *info)
if (d3d->translate_x)
{
struct d3d_matrix *pout = (struct d3d_matrix*)&d3d->mvp;
float vp_x = -(d3d->translate_x/(float)d3d->final_viewport.Width);
float vp_x = -(d3d->translate_x/(float)d3d->out_vp.Width);
pout->m[3][0] = -1.0f + vp_x - 2.0f * 1 / (0 - 1);
}
if (d3d->translate_y)
{
struct d3d_matrix *pout = (struct d3d_matrix*)&d3d->mvp;
float vp_y = -(d3d->translate_y/(float)d3d->final_viewport.Height);
float vp_y = -(d3d->translate_y/(float)d3d->out_vp.Height);
pout->m[3][1] = 1.0f + vp_y + 2.0f * 1 / (0 - 1);
}
@ -2078,7 +2075,7 @@ static bool d3d9_cg_frame(void *data, const void *frame,
d3d9_set_viewport(d3d, width, height, false, true);
if (chain)
chain->final_viewport = (D3DVIEWPORT9*)&d3d->final_viewport;
chain->out_vp = (D3DVIEWPORT9*)&d3d->out_vp;
d3d9_recompute_pass_sizes(chain->dev, chain, d3d);

View File

@ -540,7 +540,7 @@ static void hlsl_d3d9_renderchain_set_shader_params(
struct shader_pass *pass,
unsigned video_w, unsigned video_h,
unsigned tex_w, unsigned tex_h,
unsigned viewport_w, unsigned viewport_h)
unsigned vp_width, unsigned vp_height)
{
float frame_cnt;
float video_size[2];
@ -553,8 +553,8 @@ static void hlsl_d3d9_renderchain_set_shader_params(
video_size[1] = video_h;
texture_size[0] = tex_w;
texture_size[1] = tex_h;
output_size[0] = viewport_w;
output_size[1] = viewport_h;
output_size[0] = vp_width;
output_size[1] = vp_height;
d3d9x_constant_table_set_defaults(dev, fprg);
d3d9x_constant_table_set_defaults(dev, vprg);
@ -827,13 +827,13 @@ static bool hlsl_d3d9_renderchain_init(
d3d9_video_t *d3d,
hlsl_renderchain_t *chain,
LPDIRECT3DDEVICE9 dev,
const D3DVIEWPORT9 *final_viewport,
const D3DVIEWPORT9 *out_vp,
const struct LinkInfo *info,
unsigned fmt
)
{
chain->chain.dev = dev;
chain->chain.final_viewport = (D3DVIEWPORT9*)final_viewport;
chain->chain.out_vp = (D3DVIEWPORT9*)out_vp;
chain->chain.frame_count = 0;
chain->chain.pixel_size = (fmt == RETRO_PIXEL_FORMAT_RGB565) ? 2 : 4;
@ -966,7 +966,7 @@ static void hlsl_d3d9_renderchain_render(
d3d9_convert_geometry(
&first_pass->info,
&out_width, &out_height,
current_width, current_height, chain->chain.final_viewport);
current_width, current_height, chain->chain.out_vp);
d3d9_blit_to_texture(first_pass->tex,
frame,
@ -998,7 +998,7 @@ static void hlsl_d3d9_renderchain_render(
d3d9_convert_geometry(&from_pass->info,
&out_width, &out_height,
current_width, current_height, chain->chain.final_viewport);
current_width, current_height, chain->chain.out_vp);
/* Clear out whole FBO. */
viewport.Width = to_pass->info.tex_w;
@ -1043,18 +1043,18 @@ static void hlsl_d3d9_renderchain_render(
d3d9_convert_geometry(&last_pass->info,
&out_width, &out_height,
current_width, current_height, chain->chain.final_viewport);
current_width, current_height, chain->chain.out_vp);
IDirect3DDevice9_SetViewport(
chain->chain.dev, (D3DVIEWPORT9*)chain->chain.final_viewport);
chain->chain.dev, (D3DVIEWPORT9*)chain->chain.out_vp);
hlsl_d3d9_renderchain_set_vertices(
d3d,
chain, last_pass,
current_width, current_height,
out_width, out_height,
chain->chain.final_viewport->Width,
chain->chain.final_viewport->Height,
chain->chain.out_vp->Width,
chain->chain.out_vp->Height,
chain->chain.frame_count, rotation);
hlsl_d3d9_renderchain_render_pass(chain, last_pass,
@ -1069,8 +1069,8 @@ static void hlsl_d3d9_renderchain_render(
d3d9_hlsl_bind_program(chain->chain.dev, &chain->stock_shader);
hlsl_d3d9_renderchain_calc_and_set_shader_mvp(
chain, &chain->stock_shader,
chain->chain.final_viewport->Width,
chain->chain.final_viewport->Height, 0);
chain->chain.out_vp->Width,
chain->chain.out_vp->Height, 0);
}
static bool hlsl_d3d9_renderchain_add_pass(
@ -1192,7 +1192,7 @@ static bool d3d9_hlsl_init_chain(d3d9_video_t *d3d,
if (
!hlsl_d3d9_renderchain_init(
d3d, (hlsl_renderchain_t*)d3d->renderchain_data,
d3d->dev, &d3d->final_viewport, &link_info,
d3d->dev, &d3d->out_vp, &link_info,
rgb32
? RETRO_PIXEL_FORMAT_XRGB8888
: RETRO_PIXEL_FORMAT_RGB565
@ -1213,7 +1213,7 @@ static bool d3d9_hlsl_init_chain(d3d9_video_t *d3d,
d3d9_convert_geometry(
&link_info,
&out_width, &out_height,
current_width, current_height, &d3d->final_viewport);
current_width, current_height, &d3d->out_vp);
link_info.pass = &d3d->shader.pass[i];
link_info.tex_w = next_pow2(out_width);
@ -1348,14 +1348,14 @@ static bool d3d9_hlsl_initialize(
if (d3d->translate_x)
{
struct d3d_matrix *pout = (struct d3d_matrix*)&d3d->mvp;
float vp_x = -(d3d->translate_x/(float)d3d->final_viewport.Width);
float vp_x = -(d3d->translate_x/(float)d3d->out_vp.Width);
pout->m[3][0] = -1.0f + vp_x - 2.0f * 1 / (0 - 1);
}
if (d3d->translate_y)
{
struct d3d_matrix *pout = (struct d3d_matrix*)&d3d->mvp;
float vp_y = -(d3d->translate_y/(float)d3d->final_viewport.Height);
float vp_y = -(d3d->translate_y/(float)d3d->out_vp.Height);
pout->m[3][1] = 1.0f + vp_y + 2.0f * 1 / (0 - 1);
}
@ -1673,7 +1673,7 @@ static bool d3d9_hlsl_frame(void *data, const void *frame,
d3d9_set_viewport(d3d, width, height, false, true);
if (chain)
chain->final_viewport = (D3DVIEWPORT9*)&d3d->final_viewport;
chain->out_vp = (D3DVIEWPORT9*)&d3d->out_vp;
d3d9_recompute_pass_sizes(chain->dev, chain, d3d);

View File

@ -393,8 +393,8 @@ static void fpga_get_poke_interface(void *data,
}
/* TODO/FIXME - implement */
static void fpga_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate) { }
static void fpga_set_viewport(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate) { }
video_driver_t video_fpga = {
fpga_init,

View File

@ -999,8 +999,8 @@ static const video_poke_interface_t gdi_poke_interface = {
static void gdi_get_poke_interface(void *data,
const video_poke_interface_t **iface) { *iface = &gdi_poke_interface; }
static void gdi_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate) { }
static void gdi_set_viewport(void *data, unsigned vp_width, unsigned vp_height,
bool force_full, bool allow_rotate) { }
video_driver_t video_gdi = {
gdi_init,

View File

@ -148,8 +148,7 @@ static const GLfloat gl1_white_color[16] = {
* FORWARD DECLARATIONS
*/
static void gl1_set_viewport(gl1_t *gl1,
unsigned viewport_width,
unsigned viewport_height,
unsigned vp_width, unsigned vp_height,
bool force_full, bool allow_rotate);
/**
@ -1208,41 +1207,41 @@ static void gl1_set_projection(gl1_t *gl1,
}
static void gl1_set_viewport(gl1_t *gl1,
unsigned viewport_width,
unsigned viewport_height,
unsigned vp_width, unsigned vp_height,
bool force_full, bool allow_rotate)
{
settings_t *settings = config_get_ptr();
unsigned height = gl1->video_height;
int x = 0;
int y = 0;
float device_aspect = (float)viewport_width / viewport_height;
float device_aspect = (float)vp_width / vp_height;
if (gl1->ctx_driver->translate_aspect)
device_aspect = gl1->ctx_driver->translate_aspect(
gl1->ctx_data, viewport_width, viewport_height);
gl1->ctx_data, vp_width, vp_height);
if (settings->bools.video_scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&gl1->vp,
viewport_width, viewport_height,
vp_width, vp_height,
video_driver_get_aspect_ratio(),
gl1->flags & GL1_FLAG_KEEP_ASPECT, false);
viewport_width = gl1->vp.width;
viewport_height = gl1->vp.height;
vp_width = gl1->vp.width;
vp_height = gl1->vp.height;
}
else if ((gl1->flags & GL1_FLAG_KEEP_ASPECT) && !force_full)
{
gl1->vp.full_height = gl1->video_height;
video_viewport_get_scaled_aspect2(&gl1->vp, viewport_width, viewport_height, false, device_aspect, video_driver_get_aspect_ratio());
viewport_width = gl1->vp.width;
viewport_height = gl1->vp.height;
video_viewport_get_scaled_aspect2(&gl1->vp, vp_width, vp_height,
false, device_aspect, video_driver_get_aspect_ratio());
vp_width = gl1->vp.width;
vp_height = gl1->vp.height;
}
else
{
gl1->vp.x = gl1->vp.y = 0;
gl1->vp.width = viewport_width;
gl1->vp.height = viewport_height;
gl1->vp.x = gl1->vp.y = 0;
gl1->vp.width = vp_width;
gl1->vp.height = vp_height;
}
glViewport(gl1->vp.x, gl1->vp.y, gl1->vp.width, gl1->vp.height);
@ -1251,8 +1250,8 @@ static void gl1_set_viewport(gl1_t *gl1,
/* Set last backbuffer viewport. */
if (!force_full)
{
gl1->vp_out_width = viewport_width;
gl1->vp_out_height = viewport_height;
gl1->out_vp_width = vp_width;
gl1->out_vp_height = vp_height;
}
}
@ -2235,12 +2234,11 @@ static void gl1_get_poke_interface(void *data,
static bool gl1_widgets_enabled(void *data) { return true; }
#endif
static void gl1_set_viewport_wrapper(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
static void gl1_set_viewport_wrapper(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate)
{
gl1_t *gl1 = (gl1_t*)data;
gl1_set_viewport(gl1,
viewport_width, viewport_height, force_full, allow_rotate);
gl1_t *gl1 = (gl1_t*)data;
gl1_set_viewport(gl1, vp_width, vp_height, force_full, allow_rotate);
}
#ifdef HAVE_OVERLAY

View File

@ -320,8 +320,7 @@ static const GLfloat white_color[16] = {
* FORWARD DECLARATIONS
*/
static void gl2_set_viewport(gl2_t *gl,
unsigned viewport_width,
unsigned viewport_height,
unsigned vp_width, unsigned vp_height,
bool force_full, bool allow_rotate);
#ifdef IOS
@ -1268,39 +1267,40 @@ static void gl2_set_projection(gl2_t *gl,
}
static void gl2_set_viewport(gl2_t *gl,
unsigned viewport_width,
unsigned viewport_height,
unsigned vp_width,
unsigned vp_height,
bool force_full, bool allow_rotate)
{
settings_t *settings = config_get_ptr();
float device_aspect = (float) viewport_width / (float)viewport_height;
float device_aspect = (float)vp_width / (float)vp_height;
if (gl->ctx_driver->translate_aspect)
device_aspect = gl->ctx_driver->translate_aspect(
gl->ctx_data, viewport_width, viewport_height);
gl->ctx_data, vp_width, vp_height);
if (settings->bools.video_scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&gl->vp,
viewport_width, viewport_height,
vp_width, vp_height,
video_driver_get_aspect_ratio(),
(gl->flags & GL2_FLAG_KEEP_ASPECT) ? true : false,
false);
viewport_width = gl->vp.width;
viewport_height = gl->vp.height;
vp_width = gl->vp.width;
vp_height = gl->vp.height;
}
else if ((gl->flags & GL2_FLAG_KEEP_ASPECT) && !force_full)
{
gl->vp.full_height = gl->video_height;
video_viewport_get_scaled_aspect2(&gl->vp, viewport_width, viewport_height, false, device_aspect, video_driver_get_aspect_ratio());
viewport_width = gl->vp.width;
viewport_height = gl->vp.height;
video_viewport_get_scaled_aspect2(&gl->vp, vp_width, vp_height,
false, device_aspect, video_driver_get_aspect_ratio());
vp_width = gl->vp.width;
vp_height = gl->vp.height;
}
else
{
gl->vp.x = gl->vp.y = 0;
gl->vp.width = viewport_width;
gl->vp.height = viewport_height;
gl->vp.width = vp_width;
gl->vp.height = vp_height;
}
glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height);
@ -1309,12 +1309,12 @@ static void gl2_set_viewport(gl2_t *gl,
/* Set last backbuffer viewport. */
if (!force_full)
{
gl->vp_out_width = viewport_width;
gl->vp_out_height = viewport_height;
gl->out_vp_width = vp_width;
gl->out_vp_height = vp_height;
}
#if 0
RARCH_LOG("Setting viewport @ %ux%u\n", viewport_width, viewport_height);
RARCH_LOG("Setting viewport @ %ux%u\n", vp_width, vp_height);
#endif
}
@ -2765,12 +2765,11 @@ static void gl2_render_overlay(gl2_t *gl)
}
#endif
static void gl2_set_viewport_wrapper(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
static void gl2_set_viewport_wrapper(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate)
{
gl2_t *gl = (gl2_t*)data;
gl2_set_viewport(gl,
viewport_width, viewport_height, force_full, allow_rotate);
gl2_set_viewport(gl, vp_width, vp_height, force_full, allow_rotate);
}
/* Shaders */
@ -3420,7 +3419,7 @@ static bool gl2_frame(void *data, const void *frame,
gl2_renderchain_recompute_pass_sizes(
gl, chain,
frame_width, frame_height,
gl->vp_out_width, gl->vp_out_height);
gl->out_vp_width, gl->out_vp_height);
gl2_renderchain_start_render(gl, chain);
}

View File

@ -86,9 +86,8 @@ static const float gl3_colors[16] = {
* FORWARD DECLARATIONS
*/
static void gl3_set_viewport(gl3_t *gl,
unsigned viewport_width,
unsigned viewport_height,
bool force_full, bool allow_rotate);
unsigned vp_width, unsigned vp_height,
bool force_full, bool allow_rotate);
/**
* GL3 COMMON
@ -1564,40 +1563,39 @@ static void gl3_set_projection(gl3_t *gl,
}
static void gl3_set_viewport(gl3_t *gl,
unsigned viewport_width,
unsigned viewport_height,
unsigned vp_width, unsigned vp_height,
bool force_full, bool allow_rotate)
{
settings_t *settings = config_get_ptr();
float device_aspect = (float)viewport_width / viewport_height;
float device_aspect = (float)vp_width / vp_height;
bool video_scale_integer = settings->bools.video_scale_integer;
if (gl->ctx_driver->translate_aspect)
device_aspect = gl->ctx_driver->translate_aspect(
gl->ctx_data, viewport_width, viewport_height);
gl->ctx_data, vp_width, vp_height);
if (video_scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&gl->vp,
viewport_width, viewport_height,
vp_width, vp_height,
video_driver_get_aspect_ratio(),
(gl->flags & GL3_FLAG_KEEP_ASPECT) ? true : false,
false);
viewport_width = gl->vp.width;
viewport_height = gl->vp.height;
vp_width = gl->vp.width;
vp_height = gl->vp.height;
}
else if ((gl->flags & GL3_FLAG_KEEP_ASPECT) && !force_full)
{
gl->vp.full_height = gl->video_height;
video_viewport_get_scaled_aspect2(&gl->vp, viewport_width, viewport_height, false, device_aspect, video_driver_get_aspect_ratio());
viewport_width = gl->vp.width;
viewport_height = gl->vp.height;
video_viewport_get_scaled_aspect2(&gl->vp, vp_width, vp_height, false, device_aspect, video_driver_get_aspect_ratio());
vp_width = gl->vp.width;
vp_height = gl->vp.height;
}
else
{
gl->vp.x = gl->vp.y = 0;
gl->vp.width = viewport_width;
gl->vp.height = viewport_height;
gl->vp.x = gl->vp.y = 0;
gl->vp.width = vp_width;
gl->vp.height = vp_height;
}
glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height);
@ -1606,8 +1604,8 @@ static void gl3_set_viewport(gl3_t *gl,
/* Set last backbuffer viewport. */
if (!force_full)
{
gl->vp_out_width = viewport_width;
gl->vp_out_height = viewport_height;
gl->out_vp_width = vp_width;
gl->out_vp_height = vp_height;
}
gl->filter_chain_vp.x = gl->vp.x;
@ -1616,7 +1614,7 @@ static void gl3_set_viewport(gl3_t *gl,
gl->filter_chain_vp.height = gl->vp.height;
#if 0
RARCH_LOG("Setting viewport @ %ux%u\n", viewport_width, viewport_height);
RARCH_LOG("Setting viewport @ %ux%u\n", vp_width, vp_height);
#endif
}
@ -1897,12 +1895,12 @@ static void gl3_begin_debug(gl3_t *gl)
#endif
static void gl3_set_viewport_wrapper(void *data,
unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
unsigned vp_width, unsigned vp_height,
bool force_full, bool allow_rotate)
{
gl3_t *gl = (gl3_t*)data;
gl3_set_viewport(gl,
viewport_width, viewport_height, force_full, allow_rotate);
gl3_set_viewport(gl, vp_width, vp_height,
force_full, allow_rotate);
}

View File

@ -923,29 +923,27 @@ static void gx2_set_projection(wiiu_video_t *wiiu)
static void gx2_update_viewport(wiiu_video_t *wiiu)
{
unsigned viewport_width = wiiu->color_buffer.surface.width;
unsigned viewport_height = wiiu->color_buffer.surface.height;
unsigned vp_width = wiiu->color_buffer.surface.width;
unsigned vp_height = wiiu->color_buffer.surface.height;
settings_t *settings = config_get_ptr();
bool video_scale_integer = settings->bools.video_scale_integer;
if (video_scale_integer)
{
video_viewport_get_scaled_integer(&wiiu->vp,
viewport_width, viewport_height,
vp_width, vp_height,
video_driver_get_aspect_ratio(), wiiu->keep_aspect, true);
viewport_width = wiiu->vp.width;
viewport_height = wiiu->vp.height;
vp_width = wiiu->vp.width;
vp_height = wiiu->vp.height;
}
else if (wiiu->keep_aspect)
{
video_viewport_get_scaled_aspect(&wiiu->vp, viewport_width, viewport_height, true);
}
video_viewport_get_scaled_aspect(&wiiu->vp, vp_width, vp_height, true);
else
{
wiiu->vp.x = 0;
wiiu->vp.y = 0;
wiiu->vp.width = viewport_width;
wiiu->vp.height = viewport_height;
wiiu->vp.width = vp_width;
wiiu->vp.height = vp_height;
}
gx2_set_projection(wiiu);

View File

@ -2396,12 +2396,12 @@ static void metal_free(void *data)
md = nil;
}
static void metal_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
static void metal_set_viewport(void *data, unsigned vp_width, unsigned vp_height,
bool force_full, bool allow_rotate)
{
MetalDriver *md = (__bridge MetalDriver *)data;
if (md)
[md setViewportWidth:viewport_width height:viewport_height forceFull:force_full allowRotate:allow_rotate];
[md setViewportWidth:vp_width height:vp_height forceFull:force_full allowRotate:allow_rotate];
}
static void metal_set_rotation(void *data, unsigned rotation)

View File

@ -468,8 +468,8 @@ static void network_gfx_get_poke_interface(void *data,
*iface = &network_poke_interface;
}
static void network_gfx_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate) { }
static void network_gfx_set_viewport(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate) { }
bool network_has_menu_frame(void)
{

View File

@ -130,8 +130,8 @@ static const float rsx_tex_coords[8] = {
* FORWARD DECLARATIONS
*/
static void rsx_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate);
static void rsx_set_viewport(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate);
/*
* DISPLAY DRIVER
@ -977,9 +977,8 @@ static void rsx_set_projection(rsx_t *rsx,
matrix_4x4_multiply(rsx->mvp, rot, rsx->mvp_no_rot);
}
static void rsx_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
static void rsx_set_viewport(void *data, unsigned vp_width, unsigned vp_height,
bool force_full, bool allow_rotate)
{
int i;
rsx_viewport_t vp;
@ -991,24 +990,24 @@ static void rsx_set_viewport(void *data, unsigned viewport_width,
if (video_scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&rsx->vp,
viewport_width, viewport_height,
vp_width, vp_height,
video_driver_get_aspect_ratio(), rsx->keep_aspect,
true);
viewport_width = rsx->vp.width;
viewport_height = rsx->vp.height;
vp_width = rsx->vp.width;
vp_height = rsx->vp.height;
}
else if (rsx->keep_aspect && !force_full)
{
video_viewport_get_scaled_aspect(&rsx->vp, viewport_width, viewport_height, true);
viewport_width = rsx->vp.width;
viewport_height = rsx->vp.height;
video_viewport_get_scaled_aspect(&rsx->vp, vp_width, vp_height, true);
vp_width = rsx->vp.width;
vp_height = rsx->vp.height;
}
else
{
rsx->vp.x = 0;
rsx->vp.y = 0;
rsx->vp.width = viewport_width;
rsx->vp.height = viewport_height;
rsx->vp.width = vp_width;
rsx->vp.height = vp_height;
}
vp.min = 0.0f;
@ -1036,8 +1035,8 @@ static void rsx_set_viewport(void *data, unsigned viewport_width,
/* Set last backbuffer viewport. */
if (!force_full)
{
rsx->vp.width = viewport_width;
rsx->vp.height = viewport_height;
rsx->vp.width = vp_width;
rsx->vp.height = vp_height;
}
}
@ -1440,20 +1439,20 @@ static void rsx_update_viewport(rsx_t* rsx)
{
int x = 0;
int y = 0;
unsigned viewport_width = rsx->width;
unsigned viewport_height = rsx->height;
float device_aspect = ((float)viewport_width) / viewport_height;
unsigned vp_width = rsx->width;
unsigned vp_height = rsx->height;
float device_aspect = ((float)vp_width) / vp_height;
settings_t *settings = config_get_ptr();
bool video_scale_integer = settings->bools.video_scale_integer;
unsigned aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
if (video_scale_integer)
{
video_viewport_get_scaled_integer(&rsx->vp, viewport_width,
viewport_height, video_driver_get_aspect_ratio(), rsx->keep_aspect,
video_viewport_get_scaled_integer(&rsx->vp, vp_width, vp_height,
video_driver_get_aspect_ratio(), rsx->keep_aspect,
true);
viewport_width = rsx->vp.width;
viewport_height = rsx->vp.height;
vp_width = rsx->vp.width;
vp_height = rsx->vp.height;
}
else if (rsx->keep_aspect)
{
@ -1462,12 +1461,12 @@ static void rsx_update_viewport(rsx_t* rsx)
#if defined(HAVE_MENU)
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
video_viewport_t *custom_vp = &settings->video_viewport_custom;
video_viewport_t *custom_vp = &settings->video_vp_custom;
/* RSX/libgcm has top-left origin viewport. */
x = custom_vp->x;
y = custom_vp->y;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
vp_width = custom_vp->width;
vp_height = custom_vp->height;
}
else
#endif
@ -1483,33 +1482,33 @@ static void rsx_update_viewport(rsx_t* rsx)
}
else if (device_aspect > desired_aspect)
{
float viewport_bias = settings->floats.video_viewport_bias_x;
float viewport_bias = settings->floats.video_vp_bias_x;
delta = (desired_aspect / device_aspect - 1.0f)
/ 2.0f + 0.5f;
x = (int)roundf(viewport_width * ((0.5f - delta) * (viewport_bias * 2.0f)));
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
x = (int)roundf(vp_width * ((0.5f - delta) * (viewport_bias * 2.0f)));
vp_width = (unsigned)roundf(2.0f * vp_width * delta);
}
else
{
float viewport_bias = 1.0 - settings->floats.video_viewport_bias_y;
float viewport_bias = 1.0 - settings->floats.video_vp_bias_y;
delta = (device_aspect / desired_aspect - 1.0f)
/ 2.0f + 0.5f;
y = (int)roundf(viewport_height * ((0.5f - delta) * (viewport_bias * 2.0f)));
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
y = (int)roundf(vp_height * ((0.5f - delta) * (viewport_bias * 2.0f)));
vp_height = (unsigned)roundf(2.0f * vp_height * delta);
}
}
rsx->vp.x = x;
rsx->vp.y = y;
rsx->vp.width = viewport_width;
rsx->vp.height = viewport_height;
rsx->vp.width = vp_width;
rsx->vp.height = vp_height;
}
else
{
rsx->vp.x = 0;
rsx->vp.y = 0;
rsx->vp.width = viewport_width;
rsx->vp.height = viewport_height;
rsx->vp.width = vp_width;
rsx->vp.height = vp_height;
}
rsx->should_resize = false;

View File

@ -244,9 +244,7 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
win_w, win_h, video_driver_get_aspect_ratio(),
vid->video.force_aspect, true);
else if (vid->video.force_aspect)
{
video_viewport_get_scaled_aspect(&vid->vp, win_w, win_h, true);
}
vid->flags &= ~SDL2_FLAG_SHOULD_RESIZE;

View File

@ -634,10 +634,8 @@ static void sixel_gfx_get_poke_interface(void *data,
*iface = &sixel_poke_interface;
}
static void sixel_gfx_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
{
}
static void sixel_gfx_set_viewport(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate) { }
bool sixel_has_menu_frame(void)
{

View File

@ -316,37 +316,35 @@ static void vg_free(void *data)
}
static void vg_calculate_quad(vg_t *vg,
unsigned width, unsigned height)
unsigned vp_width, unsigned vp_height)
{
struct video_viewport_t vp;
settings_t *settings = config_get_ptr();
bool video_scale_integer = settings->bools.video_scale_integer;
float device_aspect = (float)width / height;
struct video_viewport_t vp;
vp.x = 0;
vp.y = 0;
vp.width = width;
vp.height = height;
vp.full_width = width;
vp.full_height = height;
vp.x = 0;
vp.y = 0;
vp.width = vp_width;
vp.height = vp_height;
vp.full_width = vp_width;
vp.full_height = vp_height;
if (vg->ctx_driver->translate_aspect)
device_aspect = vg->ctx_driver->translate_aspect(vg->ctx_data, width, height);
device_aspect = vg->ctx_driver->translate_aspect(vg->ctx_data, vp_width, vp_height);
vg->mScreenAspect = device_aspect;
/* OpenVG uses a bottom-left origin coordinate system */
if (video_scale_integer)
{
video_viewport_get_scaled_integer(&vp,
width, height,
vp_width, vp_height,
video_driver_get_aspect_ratio(),
vg->keep_aspect,
false);
}
else if (vg->keep_aspect)
{
video_viewport_get_scaled_aspect(&vp, viewport_width, viewport_height, false);
}
video_viewport_get_scaled_aspect(&vp, vp_width, vp_height, false);
vg->x1 = vp.x;
vg->y1 = vp.y;
vg->x2 = vp.width;

View File

@ -469,8 +469,8 @@ static const video_poke_interface_t vga_poke_interface = {
static void vga_gfx_get_poke_interface(void *data,
const video_poke_interface_t **iface) { *iface = &vga_poke_interface; }
void vga_gfx_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate) { }
void vga_gfx_set_viewport(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate) { }
video_driver_t video_vga = {
vga_gfx_init,

View File

@ -81,8 +81,8 @@ static const float vita2d_colors[16] = {
extern void *memcpy_neon(void *dst, const void *src, size_t n);
static void vita2d_update_viewport(vita_video_t* vita,
video_frame_info_t *video_info);
static void vita2d_set_viewport_wrapper(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate);
static void vita2d_set_viewport_wrapper(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate);
/*
* DISPLAY DRIVER
@ -903,12 +903,12 @@ static void vita2d_update_viewport(vita_video_t* vita,
}
static void vita2d_set_viewport_wrapper(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
static void vita2d_set_viewport_wrapper(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate)
{
int x = 0;
int y = 0;
float device_aspect = (float)viewport_width / viewport_height;
float device_aspect = (float)vp_width / vp_height;
struct video_ortho ortho = {0, 1, 0, 1, -1, 1};
settings_t *settings = config_get_ptr();
vita_video_t *vita = (vita_video_t*)data;
@ -919,10 +919,10 @@ static void vita2d_set_viewport_wrapper(void *data, unsigned viewport_width,
{
/* TODO: Does Vita use top-left or bottom-left origin? I'm assuming top left. */
video_viewport_get_scaled_integer(&vita->vp,
viewport_width, viewport_height,
vp_width, vp_height,
video_driver_get_aspect_ratio(), vita->keep_aspect, true);
viewport_width = vita->vp.width;
viewport_height = vita->vp.height;
vp_width = vita->vp.width;
vp_height = vita->vp.height;
}
else if (vita->keep_aspect && !force_full)
{
@ -931,11 +931,11 @@ static void vita2d_set_viewport_wrapper(void *data, unsigned viewport_width,
#if defined(HAVE_MENU)
if (aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
video_viewport_t *custom_vp = &settings->video_viewport_custom;
video_viewport_t *custom_vp = &settings->video_vp_custom;
x = custom_vp->x;
y = custom_vp->y;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
vp_width = custom_vp->width;
vp_height = custom_vp->height;
}
else
#endif
@ -950,34 +950,34 @@ static void vita2d_set_viewport_wrapper(void *data, unsigned viewport_width,
}
else if (device_aspect > desired_aspect)
{
float viewport_bias = settings->floats.video_viewport_bias_x;
float viewport_bias = settings->floats.video_vp_bias_x;
delta = (desired_aspect / device_aspect - 1.0f)
/ 2.0f + 0.5f;
x = (int)roundf(viewport_width * ((0.5f - delta) * (viewport_bias * 2.0f)));
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
x = (int)roundf(vp_width * ((0.5f - delta) * (viewport_bias * 2.0f)));
vp_width = (unsigned)roundf(2.0f * vp_width * delta);
}
else
{
/* TODO: Does Vita use top-left or bottom-left origin? I'm assuming top left. */
float viewport_bias = settings->floats.video_viewport_bias_y;
float viewport_bias = settings->floats.video_vp_bias_y;
delta = (device_aspect / desired_aspect - 1.0f)
/ 2.0f + 0.5f;
y = (int)roundf(viewport_height * ((0.5f - delta) * (viewport_bias * 2.0f)));
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
y = (int)roundf(vp_height * ((0.5f - delta) * (viewport_bias * 2.0f)));
vp_height = (unsigned)roundf(2.0f * vp_height * delta);
}
}
vita->vp.x = x;
vita->vp.y = y;
vita->vp.width = viewport_width;
vita->vp.height = viewport_height;
vita->vp.width = vp_width;
vita->vp.height = vp_height;
}
else
{
vita->vp.x = 0;
vita->vp.y = 0;
vita->vp.width = viewport_width;
vita->vp.height = viewport_height;
vita->vp.width = vp_width;
vita->vp.height = vp_height;
}
vita2d_set_viewport(vita->vp.x, vita->vp.y, vita->vp.width, vita->vp.height);
@ -986,8 +986,8 @@ static void vita2d_set_viewport_wrapper(void *data, unsigned viewport_width,
/* Set last backbuffer viewport. */
if (!force_full)
{
vita->vp.width = viewport_width;
vita->vp.height = viewport_height;
vita->vp.width = vp_width;
vita->vp.height = vp_height;
}
}

View File

@ -1009,8 +1009,8 @@ static void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd,
/**
* FORWARD DECLARATIONS
*/
static void vulkan_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate);
static void vulkan_set_viewport(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate);
static bool vulkan_is_mapped_swapchain_texture_ptr(const vk_t* vk,
const void* ptr);
@ -2247,7 +2247,7 @@ static void vulkan_init_pipelines(vk_t *vk)
VkPipelineColorBlendAttachmentState blend_attachment = {0};
VkPipelineColorBlendStateCreateInfo blend = {
VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO };
VkPipelineViewportStateCreateInfo viewport = {
VkPipelineViewportStateCreateInfo vp = {
VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO };
VkPipelineDepthStencilStateCreateInfo depth_stencil = {
VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO };
@ -2317,8 +2317,8 @@ static void vulkan_init_pipelines(vk_t *vk)
blend.pAttachments = &blend_attachment;
/* Viewport state */
viewport.viewportCount = 1;
viewport.scissorCount = 1;
vp.viewportCount = 1;
vp.scissorCount = 1;
/* Depth-stencil state */
depth_stencil.depthTestEnable = VK_FALSE;
@ -2350,7 +2350,7 @@ static void vulkan_init_pipelines(vk_t *vk)
pipe.pRasterizationState = &raster;
pipe.pColorBlendState = &blend;
pipe.pMultisampleState = &multisample;
pipe.pViewportState = &viewport;
pipe.pViewportState = &vp;
pipe.pDepthStencilState = &depth_stencil;
pipe.pDynamicState = &dynamic;
pipe.renderPass = vk->render_pass;
@ -2839,7 +2839,7 @@ static bool vulkan_init_default_filter_chain(vk_t *vk)
info.original_format = VK_REMAP_TO_TEXFMT(vk->tex_fmt);
info.max_input_size.width = vk->tex_w;
info.max_input_size.height = vk->tex_h;
info.swapchain.viewport = vk->vk_vp;
info.swapchain.vp = vk->vk_vp;
info.swapchain.format = vk->context->swapchain_format;
info.swapchain.render_pass = vk->render_pass;
info.swapchain.num_indices = vk->context->num_swapchain_images;
@ -2911,7 +2911,7 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path)
info.original_format = VK_REMAP_TO_TEXFMT(vk->tex_fmt);
info.max_input_size.width = vk->tex_w;
info.max_input_size.height = vk->tex_h;
info.swapchain.viewport = vk->vk_vp;
info.swapchain.vp = vk->vk_vp;
info.swapchain.format = vk->context->swapchain_format;
info.swapchain.render_pass = vk->render_pass;
info.swapchain.num_indices = vk->context->num_swapchain_images;
@ -3645,7 +3645,7 @@ static void vulkan_check_swapchain(vk_t *vk)
}
vk->context->flags &= ~VK_CTX_FLAG_INVALID_SWAPCHAIN;
filter_info.viewport = vk->vk_vp;
filter_info.vp = vk->vk_vp;
filter_info.format = vk->context->swapchain_format;
filter_info.render_pass = vk->render_pass;
filter_info.num_indices = vk->context->num_swapchain_images;
@ -3825,10 +3825,10 @@ static void vulkan_set_video_mode(void *data,
width, height, fullscreen);
}
static void vulkan_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
static void vulkan_set_viewport(void *data, unsigned vp_width,
unsigned vp_height, bool force_full, bool allow_rotate)
{
float device_aspect = (float)viewport_width / viewport_height;
float device_aspect = (float)vp_width / vp_height;
struct video_ortho ortho = {0, 1, 0, 1, -1, 1};
settings_t *settings = config_get_ptr();
bool video_scale_integer = settings->bools.video_scale_integer;
@ -3836,31 +3836,31 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width,
if (vk->ctx_driver->translate_aspect)
device_aspect = vk->ctx_driver->translate_aspect(
vk->ctx_data, viewport_width, viewport_height);
vk->ctx_data, vp_width, vp_height);
if (video_scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&vk->vp,
viewport_width, viewport_height,
vp_width, vp_height,
video_driver_get_aspect_ratio(),
vk->flags & VK_FLAG_KEEP_ASPECT,
true);
viewport_width = vk->vp.width;
viewport_height = vk->vp.height;
vp_width = vk->vp.width;
vp_height = vk->vp.height;
}
else if ((vk->flags & VK_FLAG_KEEP_ASPECT) && !force_full)
{
video_viewport_get_scaled_aspect2(&vk->vp, viewport_width, viewport_height,
video_viewport_get_scaled_aspect2(&vk->vp, vp_width, vp_height,
true, device_aspect, video_driver_get_aspect_ratio());
viewport_width = vk->vp.width;
viewport_height = vk->vp.height;
vp_width = vk->vp.width;
vp_height = vk->vp.height;
}
else
{
vk->vp.x = 0;
vk->vp.y = 0;
vk->vp.width = viewport_width;
vk->vp.height = viewport_height;
vk->vp.x = 0;
vk->vp.y = 0;
vk->vp.width = vp_width;
vk->vp.height = vp_height;
}
if (vk->vp.x < 0)
@ -3884,8 +3884,8 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width,
/* Set last backbuffer viewport. */
if (!force_full)
{
vk->vp_out_width = viewport_width;
vk->vp_out_height = viewport_height;
vk->out_vp_width = vp_width;
vk->out_vp_height = vp_height;
}
vk->vk_vp.x = (float)vk->vp.x;
@ -4313,21 +4313,21 @@ static void vulkan_run_hdr_pipeline(VkPipeline pipeline, VkRenderPass render_pas
}
{
VkViewport viewport;
VkViewport vp;
VkRect2D sci;
viewport.x = 0.0f;
viewport.y = 0.0f;
viewport.width = vk->context->swapchain_width;
viewport.height = vk->context->swapchain_height;
viewport.minDepth = 0.0f;
viewport.maxDepth = 1.0f;
vp.x = 0.0f;
vp.y = 0.0f;
vp.width = vk->context->swapchain_width;
vp.height = vk->context->swapchain_height;
vp.minDepth = 0.0f;
vp.maxDepth = 1.0f;
sci.offset.x = (int32_t)viewport.x;
sci.offset.y = (int32_t)viewport.y;
sci.extent.width = (uint32_t)viewport.width;
sci.extent.height = (uint32_t)viewport.height;
vkCmdSetViewport(vk->cmd, 0, 1, &viewport);
sci.offset.x = (int32_t)vp.x;
sci.offset.y = (int32_t)vp.y;
sci.extent.width = (uint32_t)vp.width;
sci.extent.height = (uint32_t)vp.height;
vkCmdSetViewport(vk->cmd, 0, 1, &vp);
vkCmdSetScissor(vk->cmd, 0, 1, &sci);
}

View File

@ -611,9 +611,7 @@ static void xv_calc_out_rect(bool keep_aspect,
vp->height = vp_height;
}
else
{
video_viewport_get_scaled_aspect(vp, vp_width, vp_height, true);
}
}
static void *xv_init(const video_info_t *video,

View File

@ -849,7 +849,7 @@ private:
CommonResources *common = nullptr;
Size2D current_framebuffer_size = {};
gl3_viewport current_viewport;
gl3_viewport curr_vp;
gl3_filter_chain_pass_info pass_info;
std::vector<uint32_t> vertex_shader;
@ -1154,7 +1154,7 @@ Size2D Pass::get_output_size(const Size2D &original,
break;
case GLSLANG_FILTER_CHAIN_SCALE_VIEWPORT:
width = (retroarch_get_rotation() % 2 ? current_viewport.height : current_viewport.width) * pass_info.scale_x;
width = (retroarch_get_rotation() % 2 ? curr_vp.height : curr_vp.width) * pass_info.scale_x;
break;
case GLSLANG_FILTER_CHAIN_SCALE_ABSOLUTE:
@ -1176,7 +1176,7 @@ Size2D Pass::get_output_size(const Size2D &original,
break;
case GLSLANG_FILTER_CHAIN_SCALE_VIEWPORT:
height = (retroarch_get_rotation() % 2 ? current_viewport.width : current_viewport.height) * pass_info.scale_y;
height = (retroarch_get_rotation() % 2 ? curr_vp.width : curr_vp.height) * pass_info.scale_y;
break;
case GLSLANG_FILTER_CHAIN_SCALE_ABSOLUTE:
@ -1563,8 +1563,8 @@ void Pass::build_semantics(uint8_t *buffer,
current_framebuffer_size.width,
current_framebuffer_size.height);
build_semantic_vec4(buffer, SLANG_SEMANTIC_FINAL_VIEWPORT,
unsigned(current_viewport.width),
unsigned(current_viewport.height));
unsigned(curr_vp.width),
unsigned(curr_vp.height));
build_semantic_uint(buffer, SLANG_SEMANTIC_FRAME_COUNT,
frame_count_period
@ -1640,7 +1640,7 @@ void Pass::build_commands(
const gl3_viewport &vp,
const float *mvp)
{
current_viewport = vp;
curr_vp = vp;
Size2D size = get_output_size(
{ original.texture.width, original.texture.height },
{ source.texture.width, source.texture.height });
@ -1720,22 +1720,22 @@ void Pass::build_commands(
if (final_pass)
{
glViewport(current_viewport.x, current_viewport.y,
current_viewport.width, current_viewport.height);
glViewport(curr_vp.x, curr_vp.y,
curr_vp.width, curr_vp.height);
#ifdef GL3_ROLLING_SCANLINE_SIMULATION
if (simulate_scanline)
{
glScissor( current_viewport.x,
int32_t((float(current_viewport.height) / float(total_subframes))
glScissor( curr_vp.x,
int32_t((float(curr_vp.height) / float(total_subframes))
* float(current_subframe - 1)),
current_viewport.width,
uint32_t(float(current_viewport.height) / float(total_subframes))
curr_vp.width,
uint32_t(float(curr_vp.height) / float(total_subframes))
);
}
else
{
glScissor( current_viewport.x, current_viewport.y,
current_viewport.width, current_viewport.height);
glScissor( curr_vp.x, curr_vp.y,
curr_vp.width, curr_vp.height);
}
#endif /* GL3_ROLLING_SCANLINE_SIMULATION */
}

View File

@ -1293,8 +1293,8 @@ static void gl_glsl_set_params(void *dat, void *shader_data)
float input_size[2], output_size[2], texture_size[2], final_vp_size[2];
video_shader_ctx_params_t *params = (video_shader_ctx_params_t*)dat;
gl2_t *gl_data = (gl2_t*)params->data;
unsigned vp_width = gl_data->vp_out_width;
unsigned vp_height = gl_data->vp_out_height;
unsigned vp_width = gl_data->out_vp_width;
unsigned vp_height = gl_data->out_vp_height;
unsigned width = params->width;
unsigned height = params->height;
unsigned tex_width = params->tex_width;

View File

@ -305,7 +305,7 @@ class Pass
CommonResources *common = nullptr;
Size2D current_framebuffer_size;
VkViewport current_viewport;
VkViewport curr_vp;
vulkan_filter_chain_pass_info pass_info;
std::vector<uint32_t> vertex_shader;
@ -1638,7 +1638,7 @@ Size2D Pass::get_output_size(const Size2D &original,
break;
case GLSLANG_FILTER_CHAIN_SCALE_VIEWPORT:
width = (retroarch_get_rotation() % 2 ? current_viewport.height : current_viewport.width) * pass_info.scale_x;
width = (retroarch_get_rotation() % 2 ? curr_vp.height : curr_vp.width) * pass_info.scale_x;
break;
case GLSLANG_FILTER_CHAIN_SCALE_ABSOLUTE:
@ -1660,7 +1660,7 @@ Size2D Pass::get_output_size(const Size2D &original,
break;
case GLSLANG_FILTER_CHAIN_SCALE_VIEWPORT:
height = (retroarch_get_rotation() % 2 ? current_viewport.width : current_viewport.height) * pass_info.scale_y;
height = (retroarch_get_rotation() % 2 ? curr_vp.width : curr_vp.height) * pass_info.scale_y;
break;
case GLSLANG_FILTER_CHAIN_SCALE_ABSOLUTE:
@ -1682,7 +1682,7 @@ Size2D Pass::set_pass_info(
{
clear_vk();
current_viewport = swapchain.viewport;
curr_vp = swapchain.vp;
pass_info = info;
num_sync_indices = swapchain.num_indices;
@ -1838,7 +1838,7 @@ bool Pass::init_pipeline()
VkShaderModuleCreateInfo module_info;
VkPipelineMultisampleStateCreateInfo multisample;
VkVertexInputAttributeDescription attributes[2];
VkPipelineViewportStateCreateInfo viewport;
VkPipelineViewportStateCreateInfo vp;
VkPipelineColorBlendAttachmentState blend_attachment = {0};
VkPipelineColorBlendStateCreateInfo blend = {
VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO };
@ -1905,13 +1905,13 @@ bool Pass::init_pipeline()
blend.pAttachments = &blend_attachment;
/* Viewport state */
viewport.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewport.pNext = NULL;
viewport.flags = 0;
viewport.viewportCount = 1;
viewport.pViewports = NULL;
viewport.scissorCount = 1;
viewport.pScissors = NULL;
vp.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
vp.pNext = NULL;
vp.flags = 0;
vp.viewportCount = 1;
vp.pViewports = NULL;
vp.scissorCount = 1;
vp.pScissors = NULL;
/* Depth-stencil state */
depth_stencil.depthTestEnable = VK_FALSE;
@ -1964,7 +1964,7 @@ bool Pass::init_pipeline()
pipe.pVertexInputState = &vertex_input;
pipe.pInputAssemblyState = &input_assembly;
pipe.pTessellationState = NULL;
pipe.pViewportState = &viewport;
pipe.pViewportState = &vp;
pipe.pRasterizationState = &raster;
pipe.pMultisampleState = &multisample;
pipe.pDepthStencilState = &depth_stencil;
@ -2379,8 +2379,8 @@ void Pass::build_semantics(VkDescriptorSet set, uint8_t *buffer,
current_framebuffer_size.width,
current_framebuffer_size.height);
build_semantic_vec4(buffer, SLANG_SEMANTIC_FINAL_VIEWPORT,
unsigned(current_viewport.width),
unsigned(current_viewport.height));
unsigned(curr_vp.width),
unsigned(curr_vp.height));
build_semantic_uint(buffer, SLANG_SEMANTIC_FRAME_COUNT,
frame_count_period
@ -2461,7 +2461,7 @@ void Pass::build_commands(
{
uint8_t *u = nullptr;
current_viewport = vp;
curr_vp = vp;
Size2D size = get_output_size(
{ original.texture.width, original.texture.height },
{ source.texture.width, source.texture.height });
@ -2545,20 +2545,20 @@ void Pass::build_commands(
if (final_pass)
{
vkCmdSetViewport(cmd, 0, 1, &current_viewport);
vkCmdSetViewport(cmd, 0, 1, &curr_vp);
#ifdef VULKAN_ROLLING_SCANLINE_SIMULATION
if (simulate_scanline)
{
const VkRect2D sci = {
{
int32_t(current_viewport.x),
int32_t((current_viewport.height / float(total_subframes))
int32_t(curr_vp.x),
int32_t((curr_vp.height / float(total_subframes))
* float(current_subframe - 1))
},
{
uint32_t(current_viewport.width),
uint32_t(current_viewport.height / float(total_subframes))
uint32_t(curr_vp.width),
uint32_t(curr_vp.height / float(total_subframes))
},
};
vkCmdSetScissor(cmd, 0, 1, &sci);
@ -2568,12 +2568,12 @@ void Pass::build_commands(
{
const VkRect2D sci = {
{
int32_t(current_viewport.x),
int32_t(current_viewport.y)
int32_t(curr_vp.x),
int32_t(curr_vp.y)
},
{
uint32_t(current_viewport.width),
uint32_t(current_viewport.height)
uint32_t(curr_vp.width),
uint32_t(curr_vp.height)
},
};
vkCmdSetScissor(cmd, 0, 1, &sci);

View File

@ -66,7 +66,7 @@ struct vulkan_filter_chain_pass_info
struct vulkan_filter_chain_swapchain_info
{
VkViewport viewport;
VkViewport vp;
VkFormat format;
VkRenderPass render_pass;
unsigned num_indices;

View File

@ -1926,27 +1926,22 @@ void video_driver_unset_stub_frame(void)
video_st->frame_bak = NULL;
}
/* Get time diff between frames in usec*/
/* Get time diff between frames in usec (microseconds) */
uint32_t video_driver_get_frame_time_delta_usec(void)
{
static retro_time_t last_time;
retro_time_t now_time;
retro_time_t delta_time;
now_time = cpu_features_get_time_usec();
delta_time = now_time - last_time;
last_time = now_time;
retro_time_t now_time = cpu_features_get_time_usec();
retro_time_t delta_time = now_time - last_time;
last_time = now_time;
return delta_time;
}
/* Get Original fps (core fps) */
/* Get original FPS (core FPS) */
float video_driver_get_original_fps(void)
{
video_driver_state_t *video_st = &video_driver_st;
struct retro_system_av_info *av_info = &video_st->av_info;
float original_fps = (float)video_st->av_info.timing.fps;
return original_fps;
video_driver_state_t *video_st = &video_driver_st;
struct retro_system_av_info *av_info = &video_st->av_info;
return (float)video_st->av_info.timing.fps;
}
/* Get aspect ratio (DAR) requested by the core */
@ -2105,53 +2100,58 @@ void video_driver_set_aspect_ratio(void)
video_st->poke->set_aspect_ratio(video_st->data, aspect_ratio_idx);
}
void video_viewport_get_scaled_aspect(struct video_viewport *vp, unsigned viewport_width, unsigned viewport_height, bool ydown)
void video_viewport_get_scaled_aspect(struct video_viewport *vp,
unsigned vp_width, unsigned vp_height, bool y_down)
{
float device_aspect = (float)viewport_width / viewport_height;
float device_aspect = (float)vp_width / vp_height;
float desired_aspect = video_driver_get_aspect_ratio();
video_viewport_get_scaled_aspect2(vp, viewport_width, viewport_height, ydown, device_aspect, desired_aspect);
video_viewport_get_scaled_aspect2(vp, vp_width, vp_height,
y_down, device_aspect, desired_aspect);
}
void video_viewport_get_scaled_aspect2(struct video_viewport *vp, unsigned viewport_width, unsigned viewport_height, bool ydown, float device_aspect, float desired_aspect)
void video_viewport_get_scaled_aspect2(struct video_viewport *vp,
unsigned vp_width, unsigned vp_height, bool y_down,
float device_aspect, float desired_aspect)
{
settings_t *settings = config_get_ptr();
video_driver_state_t *video_st = &video_driver_st;
int x = 0;
int y = 0;
float viewport_bias_x = settings->floats.video_viewport_bias_x;
float viewport_bias_y = settings->floats.video_viewport_bias_y;
settings_t *settings = config_get_ptr();
video_driver_state_t
*video_st = &video_driver_st;
int x = 0;
int y = 0;
float vp_bias_x = settings->floats.video_vp_bias_x;
float vp_bias_y = settings->floats.video_vp_bias_y;
#if defined(RARCH_MOBILE)
if (viewport_width < viewport_height)
if (vp_width < vp_height)
{
viewport_bias_x = settings->floats.video_viewport_bias_portrait_x;
viewport_bias_y = settings->floats.video_viewport_bias_portrait_y;
vp_bias_x = settings->floats.video_vp_bias_portrait_x;
vp_bias_y = settings->floats.video_vp_bias_portrait_y;
}
#endif
if (!ydown)
viewport_bias_y = 1.0 - viewport_bias_y;
if (!y_down)
vp_bias_y = 1.0 - vp_bias_y;
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
video_viewport_t *custom_vp = &settings->video_viewport_custom;
int padding_x = 0;
int padding_y = 0;
video_viewport_t
*custom_vp = &settings->video_vp_custom;
int padding_x = 0;
int padding_y = 0;
x = custom_vp->x;
y = custom_vp->y;
x = custom_vp->x;
y = custom_vp->y;
if (!ydown)
y = vp->full_height - (y + custom_vp->height);
padding_x += (viewport_width - custom_vp->width);
if (!y_down)
y = vp->full_height - (y + custom_vp->height);
padding_x += (vp_width - custom_vp->width);
if (padding_x < 0)
padding_x *= 2;
padding_y = viewport_height - custom_vp->height;
padding_x *= 2;
padding_y = vp_height - custom_vp->height;
if (padding_y < 0)
padding_y *= 2;
viewport_width = custom_vp->width;
viewport_height = custom_vp->height;
x += padding_x * viewport_bias_x;
y += padding_y * viewport_bias_y;
padding_y *= 2;
vp_width = custom_vp->width;
vp_height = custom_vp->height;
x += padding_x * vp_bias_x;
y += padding_y * vp_bias_y;
}
else
{
@ -2166,22 +2166,22 @@ void video_viewport_get_scaled_aspect2(struct video_viewport *vp, unsigned viewp
}
else if (device_aspect > desired_aspect)
{
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
x += (int)roundf(viewport_width * ((0.5f - delta) * (viewport_bias_x * 2.0f)));
viewport_width = (unsigned)roundf(2.0f * viewport_width * delta);
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
x += (int)roundf(vp_width * ((0.5f - delta) * (vp_bias_x * 2.0f)));
vp_width = (unsigned)roundf(2.0f * vp_width * delta);
}
else
{
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
y += (int)roundf(viewport_height * ((0.5f - delta) * (viewport_bias_y * 2.0f)));
viewport_height = (unsigned)roundf(2.0f * viewport_height * delta);
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
y += (int)roundf(vp_height * ((0.5f - delta) * (vp_bias_y * 2.0f)));
vp_height = (unsigned)roundf(2.0f * vp_height * delta);
}
}
vp->x = x;
vp->y = y;
vp->width = viewport_width;
vp->height = viewport_height;
vp->width = vp_width;
vp->height = vp_height;
/* Statistics */
video_st->scale_width = vp->width;
@ -2397,7 +2397,7 @@ bool video_driver_get_viewport_info(struct video_viewport *viewport)
* @height : Height.
* @aspect_ratio : Aspect ratio (in float).
* @keep_aspect : Preserve aspect ratio?
* @ydown : Positive y points down?
* @y_down : Positive y points down?
*
* Gets viewport scaling dimensions based on
* scaled integer aspect ratio.
@ -2405,7 +2405,7 @@ bool video_driver_get_viewport_info(struct video_viewport *viewport)
void video_viewport_get_scaled_integer(struct video_viewport *vp,
unsigned width, unsigned height,
float aspect_ratio, bool keep_aspect,
bool ydown)
bool y_down)
{
int x = 0;
int y = 0;
@ -2416,24 +2416,24 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
unsigned axis = settings->uints.video_scale_integer_axis;
int padding_x = 0;
int padding_y = 0;
float viewport_bias_x = settings->floats.video_viewport_bias_x;
float viewport_bias_y = settings->floats.video_viewport_bias_y;
float vp_bias_x = settings->floats.video_vp_bias_x;
float vp_bias_y = settings->floats.video_vp_bias_y;
unsigned content_width = video_st->frame_cache_width;
unsigned content_height = video_st->frame_cache_height;
unsigned int rotation = retroarch_get_rotation();
#if defined(RARCH_MOBILE)
if (width < height)
{
viewport_bias_x = settings->floats.video_viewport_bias_portrait_x;
viewport_bias_y = settings->floats.video_viewport_bias_portrait_y;
vp_bias_x = settings->floats.video_vp_bias_portrait_x;
vp_bias_y = settings->floats.video_vp_bias_portrait_y;
}
#endif
content_width = (content_width <= 4) ? video_st->av_info.geometry.base_width : content_width;
content_height = (content_height <= 4) ? video_st->av_info.geometry.base_height : content_height;
if (!ydown)
viewport_bias_y = 1.0 - viewport_bias_y;
if (!y_down)
vp_bias_y = 1.0 - vp_bias_y;
if (rotation % 2)
content_height = content_width;
@ -2452,7 +2452,7 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
/* Use regular scaling if there is no room for 1x */
if (content_width > width || content_height > height)
{
video_viewport_get_scaled_aspect(vp, width, height, ydown);
video_viewport_get_scaled_aspect(vp, width, height, y_down);
return;
}
@ -2461,13 +2461,13 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
struct video_viewport *custom_vp = &settings->video_viewport_custom;
struct video_viewport *custom_vp = &settings->video_vp_custom;
if (custom_vp)
{
x = custom_vp->x;
y = custom_vp->y;
if (!ydown)
if (!y_down)
y = vp->height - (y + custom_vp->height);
padding_x = width - custom_vp->width;
if (padding_x < 0)
@ -2565,12 +2565,14 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
/* Use regular scaling if there is no room for 1x */
if (content_width > width || content_height > height)
{
video_viewport_get_scaled_aspect(vp, width, height, ydown);
video_viewport_get_scaled_aspect(vp, width, height, y_down);
return;
}
if (scaling == VIDEO_SCALE_INTEGER_SCALING_SMART)
max_scale_h = ((int)(height - content_height * overscale_h) < -(int)(height * 0.20f)) ? overscale_h - 1 : overscale_h;
max_scale_h = ((int)(height - content_height * overscale_h) < -(int)(height * 0.20f))
? overscale_h - 1
: overscale_h;
else if (scaling == VIDEO_SCALE_INTEGER_SCALING_OVERSCALE)
max_scale_h = overscale_h;
else
@ -2648,13 +2650,13 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
height -= padding_y;
}
x += padding_x * viewport_bias_x;
y += padding_y * viewport_bias_y;
x += padding_x * vp_bias_x;
y += padding_y * vp_bias_y;
vp->width = width;
vp->height = height;
vp->x = x;
vp->y = y;
vp->width = width;
vp->height = height;
vp->x = x;
vp->y = y;
/* Statistics */
video_st->scale_width = vp->width;
@ -2822,7 +2824,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
VIDEO_DRIVER_THREADED_LOCK(video_st, is_threaded);
#endif
custom_vp = &settings->video_viewport_custom;
custom_vp = &settings->video_vp_custom;
#ifdef HAVE_GFX_WIDGETS
video_info->widgets_active = p_dispwidget->active;
#else
@ -3311,7 +3313,7 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
settings->bools.video_aspect_ratio_auto);
/* Update CUSTOM viewport. */
custom_vp = &settings->video_viewport_custom;
custom_vp = &settings->video_vp_custom;
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
@ -3640,7 +3642,6 @@ void video_driver_frame(const void *data, unsigned width,
static retro_time_t curr_time;
static retro_time_t fps_time;
static float last_fps, frame_time;
static uint64_t last_used_memory, last_total_memory;
static uint16_t frame_time_accumulator;
/* Mark the start of nonblock state for
* ignoring initial previous frame time */
@ -3836,6 +3837,8 @@ void video_driver_frame(const void *data, unsigned width,
if (video_info.memory_show)
{
static uint64_t last_used_memory, last_total_memory;
if ((video_st->frame_count % memory_update_interval) == 0)
{
last_total_memory = frontend_driver_get_total_memory();

View File

@ -342,14 +342,14 @@ static void video_shader_replace_wildcards(char *s, size_t len, char *in_preset_
break;
case RARCH_WC_VIEWPORT_ASPECT_ORIENTATION:
{
unsigned viewport_width = 0;
unsigned viewport_height = 0;
video_driver_get_size(&viewport_width, &viewport_height);
unsigned vp_width = 0;
unsigned vp_height = 0;
video_driver_get_size(&vp_width, &vp_height);
replace_len = strlcpy(replace_text,
"VIEW-ASPECT-ORIENT-",
sizeof(replace_text));
replace_len += strlcpy(replace_text + replace_len,
((float)viewport_width / viewport_height < 1)
((float)vp_width / vp_height < 1)
? "VERT" : "HORZ",
sizeof(replace_text) - replace_len);
}

View File

@ -90,9 +90,9 @@ static int16_t rvl_input_state(
unsigned input_mouse_scale = settings->uints.input_mouse_scale;
int x_scale = input_mouse_scale;
int y_scale = input_mouse_scale;
int x = (gx->mouse[joy_idx].x_abs
int x = (gx->mouse[joy_idx].x_abs
- gx->mouse[joy_idx].x_last) * x_scale;
int y = (gx->mouse[joy_idx].y_abs
int y = (gx->mouse[joy_idx].y_abs
- gx->mouse[joy_idx].y_last) * y_scale;
switch (id)
@ -102,10 +102,10 @@ static int16_t rvl_input_state(
case RETRO_DEVICE_ID_MOUSE_Y:
return y;
case RETRO_DEVICE_ID_MOUSE_LEFT:
return gx->mouse[joy_idx].button &
return gx->mouse[joy_idx].button &
(1 << RETRO_DEVICE_ID_MOUSE_LEFT);
case RETRO_DEVICE_ID_MOUSE_RIGHT:
return gx->mouse[joy_idx].button &
return gx->mouse[joy_idx].button &
(1 << RETRO_DEVICE_ID_MOUSE_RIGHT);
default:
break;
@ -120,9 +120,11 @@ static int16_t rvl_input_state(
int16_t res_y = 0;
int16_t res_screen_x = 0;
int16_t res_screen_y = 0;
int16_t x = 0;
int16_t y = 0;
int16_t x = gx->mouse[joy_idx].x_abs;
int16_t y = gx->mouse[joy_idx].y_abs;
#if 1
/* TODO/FIXME - is this necessary? */
video_driver_get_viewport_info(&vp);
vp.x = 0;
@ -131,9 +133,7 @@ static int16_t rvl_input_state(
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
x = gx->mouse[joy_idx].x_abs;
y = gx->mouse[joy_idx].y_abs;
#endif
if (video_driver_translate_coord_viewport_wrap(&vp, x, y,
&res_x, &res_y, &res_screen_x, &res_screen_y))
@ -145,22 +145,22 @@ static int16_t rvl_input_state(
case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y:
return res_screen_y;
case RETRO_DEVICE_ID_LIGHTGUN_TRIGGER:
return gx->mouse[joy_idx].button &
return gx->mouse[joy_idx].button &
(1 << RETRO_DEVICE_ID_LIGHTGUN_TRIGGER);
case RETRO_DEVICE_ID_LIGHTGUN_AUX_A:
return gx->mouse[joy_idx].button &
return gx->mouse[joy_idx].button &
(1 << RETRO_DEVICE_ID_LIGHTGUN_AUX_A);
case RETRO_DEVICE_ID_LIGHTGUN_AUX_B:
return gx->mouse[joy_idx].button &
return gx->mouse[joy_idx].button &
(1 << RETRO_DEVICE_ID_LIGHTGUN_AUX_B);
case RETRO_DEVICE_ID_LIGHTGUN_AUX_C:
return gx->mouse[joy_idx].button &
return gx->mouse[joy_idx].button &
(1 << RETRO_DEVICE_ID_LIGHTGUN_AUX_C);
case RETRO_DEVICE_ID_LIGHTGUN_START:
return gx->mouse[joy_idx].button &
return gx->mouse[joy_idx].button &
(1 << RETRO_DEVICE_ID_LIGHTGUN_START);
case RETRO_DEVICE_ID_LIGHTGUN_SELECT:
return gx->mouse[joy_idx].button &
return gx->mouse[joy_idx].button &
(1 << RETRO_DEVICE_ID_LIGHTGUN_SELECT);
case RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN:
return !gxpad_mousevalid(joy_idx);
@ -238,7 +238,7 @@ static void rvl_input_poll(void *data)
{
gx_input_mouse_t *tmp = (gx_input_mouse_t*)realloc(
gx->mouse, count * sizeof(gx_input_mouse_t));
if (!tmp)
if (!tmp)
free(gx->mouse);
else
{
@ -260,7 +260,7 @@ static void rvl_input_poll(void *data)
gx->mouse[i].y_last = gx->mouse[i].y_abs;
gx_joypad_read_mouse(i, &gx->mouse[i].x_abs,
&gx->mouse[i].y_abs, &gx->mouse[i].button);
}
}
}
}
}

View File

@ -1200,10 +1200,10 @@ static int16_t input_overlay_device_mouse_state(input_overlay_t *ol, unsigned id
static int16_t input_overlay_lightgun_state(settings_t *settings,
input_overlay_t *ol, unsigned id)
{
int16_t edge;
unsigned rarch_id;
struct video_viewport vp;
input_overlay_pointer_state_t *ptr_st = &ol->pointer_state;
unsigned rarch_id;
int16_t edge;
switch(id)
{

View File

@ -1257,17 +1257,17 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_dingux_refresh_rate,
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_dingux_rs90_softfilter_type, MENU_ENUM_SUBLABEL_VIDEO_DINGUX_RS90_SOFTFILTER_TYPE)
#endif
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_screen_resolution, MENU_ENUM_SUBLABEL_SCREEN_RESOLUTION)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_gpu_index, MENU_ENUM_SUBLABEL_VIDEO_GPU_INDEX)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_height, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_width, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_custom_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_bias_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_X)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_bias_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_Y)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_screen_resolution, MENU_ENUM_SUBLABEL_SCREEN_RESOLUTION)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_gpu_index, MENU_ENUM_SUBLABEL_VIDEO_GPU_INDEX)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_vp_custom_height, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_vp_custom_width, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_vp_custom_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_X)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_vp_custom_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_CUSTOM_Y)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_vp_bias_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_X)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_vp_bias_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_Y)
#if defined(RARCH_MOBILE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_bias_portrait_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_viewport_bias_portrait_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_vp_bias_portrait_x, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_vp_bias_portrait_y, MENU_ENUM_SUBLABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y)
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_use_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_mitm_server, MENU_ENUM_SUBLABEL_NETPLAY_MITM_SERVER)
@ -2563,32 +2563,32 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_gpu_index);
break;
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_custom_height);
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_vp_custom_height);
break;
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_WIDTH:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_custom_width);
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_vp_custom_width);
break;
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_X:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_custom_x);
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_vp_custom_x);
break;
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_Y:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_custom_y);
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_vp_custom_y);
break;
case MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_aspect_ratio);
break;
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_X:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_bias_x);
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_vp_bias_x);
break;
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_Y:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_bias_y);
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_vp_bias_y);
break;
#if defined(RARCH_MOBILE)
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_bias_portrait_x);
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_vp_bias_portrait_x);
break;
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_bias_portrait_y);
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_vp_bias_portrait_y);
break;
#endif
case MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX:

View File

@ -208,7 +208,7 @@ typedef struct
typedef struct
{
video_viewport_t viewport; /* int alignment */
video_viewport_t vp; /* int alignment */
unsigned aspect_ratio_idx;
} rgui_video_settings_t;
@ -5857,10 +5857,10 @@ bool rgui_is_video_config_equal(
rgui_video_settings_t *config_b)
{
return (config_a->aspect_ratio_idx == config_b->aspect_ratio_idx)
&& (config_a->viewport.width == config_b->viewport.width)
&& (config_a->viewport.height == config_b->viewport.height)
&& (config_a->viewport.x == config_b->viewport.x)
&& (config_a->viewport.y == config_b->viewport.y);
&& (config_a->vp.width == config_b->vp.width)
&& (config_a->vp.height == config_b->vp.height)
&& (config_a->vp.x == config_b->vp.x)
&& (config_a->vp.y == config_b->vp.y);
}
static void rgui_get_video_config(
@ -5868,14 +5868,14 @@ static void rgui_get_video_config(
settings_t *settings,
unsigned video_aspect_ratio_idx)
{
/* Could use settings->video_viewport_custom directly,
/* Could use settings->video_vp_custom directly,
* but this seems to be the standard way of doing it... */
video_viewport_t *custom_vp = &settings->video_viewport_custom;
video_viewport_t *custom_vp = &settings->video_vp_custom;
video_settings->aspect_ratio_idx = video_aspect_ratio_idx;
video_settings->viewport.width = custom_vp->width;
video_settings->viewport.height = custom_vp->height;
video_settings->viewport.x = custom_vp->x;
video_settings->viewport.y = custom_vp->y;
video_settings->vp.width = custom_vp->width;
video_settings->vp.height = custom_vp->height;
video_settings->vp.x = custom_vp->x;
video_settings->vp.y = custom_vp->y;
}
static void rgui_set_video_config(
@ -5884,14 +5884,14 @@ static void rgui_set_video_config(
rgui_video_settings_t *video_settings,
bool delay_update)
{
/* Could use settings->video_viewport_custom directly,
/* Could use settings->video_vp_custom directly,
* but this seems to be the standard way of doing it... */
video_viewport_t *custom_vp = &settings->video_viewport_custom;
video_viewport_t *custom_vp = &settings->video_vp_custom;
settings->uints.video_aspect_ratio_idx = video_settings->aspect_ratio_idx;
custom_vp->width = video_settings->viewport.width;
custom_vp->height = video_settings->viewport.height;
custom_vp->x = video_settings->viewport.x;
custom_vp->y = video_settings->viewport.y;
custom_vp->width = video_settings->vp.width;
custom_vp->height = video_settings->vp.height;
custom_vp->x = video_settings->vp.x;
custom_vp->y = video_settings->vp.y;
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
(float)custom_vp->width / custom_vp->height;
@ -5948,14 +5948,14 @@ static void rgui_update_menu_viewport(
if (device_aspect > desired_aspect)
{
delta = (desired_aspect / device_aspect - 1.0f) / 2.0f + 0.5f;
rgui->menu_video_settings.viewport.width = (unsigned)(2.0f * (float)vp.full_width * delta);
rgui->menu_video_settings.viewport.height = vp.full_height;
rgui->menu_video_settings.vp.width = (unsigned)(2.0f * (float)vp.full_width * delta);
rgui->menu_video_settings.vp.height = vp.full_height;
}
else
{
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
rgui->menu_video_settings.viewport.height = (unsigned)(2.0f * (float)vp.full_height * delta);
rgui->menu_video_settings.viewport.width = vp.full_width;
rgui->menu_video_settings.vp.height = (unsigned)(2.0f * (float)vp.full_height * delta);
rgui->menu_video_settings.vp.width = vp.full_width;
}
#else
/* Check whether we need to perform integer scaling */
@ -5971,8 +5971,8 @@ static void rgui_update_menu_viewport(
if (scale > 0)
{
rgui->menu_video_settings.viewport.width = scale * fb_width;
rgui->menu_video_settings.viewport.height = scale * fb_height;
rgui->menu_video_settings.vp.width = scale * fb_width;
rgui->menu_video_settings.vp.height = scale * fb_height;
}
else
do_integer_scaling = false;
@ -5983,8 +5983,8 @@ static void rgui_update_menu_viewport(
* aspect ratio */
if (menu_rgui_aspect_ratio_lock == RGUI_ASPECT_RATIO_LOCK_FILL_SCREEN)
{
rgui->menu_video_settings.viewport.width = vp.full_width;
rgui->menu_video_settings.viewport.height = vp.full_height;
rgui->menu_video_settings.vp.width = vp.full_width;
rgui->menu_video_settings.vp.height = vp.full_height;
}
/* Normal non-integer aspect-ratio-correct scaling */
else if (!do_integer_scaling)
@ -5994,31 +5994,31 @@ static void rgui_update_menu_viewport(
if (aspect_ratio > display_aspect_ratio)
{
rgui->menu_video_settings.viewport.width = vp.full_width;
rgui->menu_video_settings.viewport.height = fb_height * vp.full_width / fb_width;
rgui->menu_video_settings.vp.width = vp.full_width;
rgui->menu_video_settings.vp.height = fb_height * vp.full_width / fb_width;
}
else
{
rgui->menu_video_settings.viewport.height = vp.full_height;
rgui->menu_video_settings.viewport.width = fb_width * vp.full_height / fb_height;
rgui->menu_video_settings.vp.height = vp.full_height;
rgui->menu_video_settings.vp.width = fb_width * vp.full_height / fb_height;
}
}
#endif
/* Sanity check */
if (rgui->menu_video_settings.viewport.width < 1)
rgui->menu_video_settings.viewport.width = 1;
if (rgui->menu_video_settings.viewport.height < 1)
rgui->menu_video_settings.viewport.height = 1;
if (rgui->menu_video_settings.vp.width < 1)
rgui->menu_video_settings.vp.width = 1;
if (rgui->menu_video_settings.vp.height < 1)
rgui->menu_video_settings.vp.height = 1;
}
else
{
rgui->menu_video_settings.viewport.width = 1;
rgui->menu_video_settings.viewport.height = 1;
rgui->menu_video_settings.vp.width = 1;
rgui->menu_video_settings.vp.height = 1;
}
rgui->menu_video_settings.viewport.x = (vp.full_width - rgui->menu_video_settings.viewport.width) / 2;
rgui->menu_video_settings.viewport.y = (vp.full_height - rgui->menu_video_settings.viewport.height) / 2;
rgui->menu_video_settings.vp.x = (vp.full_width - rgui->menu_video_settings.vp.width) / 2;
rgui->menu_video_settings.vp.y = (vp.full_height - rgui->menu_video_settings.vp.height) / 2;
}
static bool rgui_set_aspect_ratio(

View File

@ -4956,7 +4956,7 @@ static void setting_get_string_representation_uint_video_monitor_index(rarch_set
strlcpy(s, "0 (Auto)", len);
}
static void setting_get_string_representation_uint_custom_viewport_width(rarch_setting_t *setting,
static void setting_get_string_representation_uint_custom_vp_width(rarch_setting_t *setting,
char *s, size_t len)
{
size_t _len;
@ -4981,7 +4981,7 @@ static void setting_get_string_representation_uint_custom_viewport_width(rarch_s
*setting->value.target.unsigned_integer / geom->base_height);
}
static void setting_get_string_representation_uint_custom_viewport_height(rarch_setting_t *setting,
static void setting_get_string_representation_uint_custom_vp_height(rarch_setting_t *setting,
char *s, size_t len)
{
size_t _len;
@ -5824,14 +5824,14 @@ static int setting_action_left_input_mouse_index(
return 0;
}
static int setting_uint_action_left_custom_viewport_width(
static int setting_uint_action_left_custom_vp_width(
rarch_setting_t *setting, size_t idx, bool wraparound)
{
video_viewport_t vp;
video_driver_state_t *video_st = video_state_get_ptr();
struct retro_system_av_info *av_info = &video_st->av_info;
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
video_viewport_t *custom = &settings->video_vp_custom;
if (!settings || !av_info)
return -1;
@ -5871,14 +5871,14 @@ static int setting_uint_action_left_custom_viewport_width(
return 0;
}
static int setting_uint_action_left_custom_viewport_height(
static int setting_uint_action_left_custom_vp_height(
rarch_setting_t *setting, size_t idx, bool wraparound)
{
video_viewport_t vp;
video_driver_state_t *video_st = video_state_get_ptr();
struct retro_system_av_info *av_info = &video_st->av_info;
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
video_viewport_t *custom = &settings->video_vp_custom;
if (!settings || !av_info)
return -1;
@ -6173,14 +6173,14 @@ static int setting_uint_action_right_crt_switch_resolution_super(
return 0;
}
static int setting_uint_action_right_custom_viewport_width(
static int setting_uint_action_right_custom_vp_width(
rarch_setting_t *setting, size_t idx, bool wraparound)
{
video_viewport_t vp;
settings_t *settings = config_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr();
struct retro_system_av_info *av_info = &video_st->av_info;
video_viewport_t *custom = &settings->video_viewport_custom;
video_viewport_t *custom = &settings->video_vp_custom;
if (!settings || !av_info)
return -1;
@ -6208,14 +6208,14 @@ static int setting_uint_action_right_custom_viewport_width(
return 0;
}
static int setting_uint_action_right_custom_viewport_height(
static int setting_uint_action_right_custom_vp_height(
rarch_setting_t *setting, size_t idx, bool wraparound)
{
video_viewport_t vp;
video_driver_state_t *video_st = video_state_get_ptr();
struct retro_system_av_info *av_info = &video_st->av_info;
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
video_viewport_t *custom = &settings->video_vp_custom;
if (!settings || !av_info)
return -1;
@ -7903,13 +7903,13 @@ static int setting_action_start_input_device_reserved_device_name(rarch_setting_
return 0;
}
static int setting_action_start_custom_viewport_width(rarch_setting_t *setting)
static int setting_action_start_custom_vp_width(rarch_setting_t *setting)
{
video_viewport_t vp;
video_driver_state_t *video_st = video_state_get_ptr();
struct retro_system_av_info *av_info = &video_st->av_info;
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
video_viewport_t *custom = &settings->video_vp_custom;
if (!settings || !av_info)
return -1;
@ -7937,13 +7937,13 @@ static int setting_action_start_custom_viewport_width(rarch_setting_t *setting)
return 0;
}
static int setting_action_start_custom_viewport_height(rarch_setting_t *setting)
static int setting_action_start_custom_vp_height(rarch_setting_t *setting)
{
video_viewport_t vp;
video_driver_state_t *video_st = video_state_get_ptr();
struct retro_system_av_info *av_info = &video_st->av_info;
settings_t *settings = config_get_ptr();
video_viewport_t *custom = &settings->video_viewport_custom;
video_viewport_t *custom = &settings->video_vp_custom;
if (!settings || !av_info)
return -1;
@ -8534,7 +8534,7 @@ static void general_write_handler(rarch_setting_t *setting)
video_viewport_t vp;
video_driver_state_t *video_st = video_state_get_ptr();
struct retro_system_av_info *av_info = &video_st->av_info;
struct video_viewport *custom_vp = &settings->video_viewport_custom;
struct video_viewport *custom_vp = &settings->video_vp_custom;
video_driver_get_viewport_info(&vp);
@ -8874,7 +8874,7 @@ static void general_write_handler(rarch_setting_t *setting)
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
video_driver_state_t *video_st = video_state_get_ptr();
struct retro_system_av_info *av_info = &video_st->av_info;
video_viewport_t *custom_vp = &settings->video_viewport_custom;
video_viewport_t *custom_vp = &settings->video_vp_custom;
if (sys_info)
{
@ -9228,7 +9228,7 @@ static void general_write_handler(rarch_setting_t *setting)
/* Whenever custom viewport dimensions are
* changed, ASPECT_RATIO_CUSTOM must be
* recalculated */
video_viewport_t *custom_vp = &settings->video_viewport_custom;
video_viewport_t *custom_vp = &settings->video_vp_custom;
float default_aspect = aspectratio_lut[ASPECT_RATIO_CORE].value;
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
@ -12805,7 +12805,7 @@ static bool setting_append_list(
break;
case SETTINGS_LIST_VIDEO:
{
struct video_viewport *custom_vp = &settings->video_viewport_custom;
struct video_viewport *custom_vp = &settings->video_vp_custom;
START_GROUP(list, list_info, &group_info, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS), parent_group);
MENU_SETTINGS_LIST_CURRENT_ADD_ENUM_IDX_PTR(list, list_info, MENU_ENUM_LABEL_VIDEO_SETTINGS);
@ -13196,7 +13196,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->floats.video_viewport_bias_x,
&settings->floats.video_vp_bias_x,
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_X,
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_X,
DEFAULT_VIEWPORT_BIAS_X,
@ -13215,7 +13215,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->floats.video_viewport_bias_y,
&settings->floats.video_vp_bias_y,
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_Y,
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_Y,
DEFAULT_VIEWPORT_BIAS_Y,
@ -13235,7 +13235,7 @@ static bool setting_append_list(
#if defined(RARCH_MOBILE)
CONFIG_FLOAT(
list, list_info,
&settings->floats.video_viewport_bias_portrait_x,
&settings->floats.video_vp_bias_portrait_x,
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_X,
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_PORTRAIT_X,
DEFAULT_VIEWPORT_BIAS_PORTRAIT_X,
@ -13254,7 +13254,7 @@ static bool setting_append_list(
CONFIG_FLOAT(
list, list_info,
&settings->floats.video_viewport_bias_portrait_y,
&settings->floats.video_vp_bias_portrait_y,
MENU_ENUM_LABEL_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y,
MENU_ENUM_LABEL_VALUE_VIDEO_VIEWPORT_BIAS_PORTRAIT_Y,
DEFAULT_VIEWPORT_BIAS_PORTRAIT_Y,
@ -13411,10 +13411,10 @@ static bool setting_append_list(
menu_settings_list_current_add_range(list, list_info, 1, 9999, 1, true, true);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT);
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_custom_viewport_width;
(*list)[list_info->index - 1].action_start = &setting_action_start_custom_viewport_width;
(*list)[list_info->index - 1].action_left = &setting_uint_action_left_custom_viewport_width;
(*list)[list_info->index - 1].action_right = &setting_uint_action_right_custom_viewport_width;
&setting_get_string_representation_uint_custom_vp_width;
(*list)[list_info->index - 1].action_start = &setting_action_start_custom_vp_width;
(*list)[list_info->index - 1].action_left = &setting_uint_action_left_custom_vp_width;
(*list)[list_info->index - 1].action_right = &setting_uint_action_right_custom_vp_width;
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info,
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);
@ -13432,10 +13432,10 @@ static bool setting_append_list(
menu_settings_list_current_add_range(list, list_info, 1, 9999, 1, true, true);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ALLOW_INPUT);
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_custom_viewport_height;
(*list)[list_info->index - 1].action_start = &setting_action_start_custom_viewport_height;
(*list)[list_info->index - 1].action_left = &setting_uint_action_left_custom_viewport_height;
(*list)[list_info->index - 1].action_right = &setting_uint_action_right_custom_viewport_height;
&setting_get_string_representation_uint_custom_vp_height;
(*list)[list_info->index - 1].action_start = &setting_action_start_custom_vp_height;
(*list)[list_info->index - 1].action_left = &setting_uint_action_left_custom_vp_height;
(*list)[list_info->index - 1].action_right = &setting_uint_action_right_custom_vp_height;
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info,
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);

View File

@ -526,12 +526,12 @@ static bool take_screenshot_choice(
bool has_valid_framebuffer,
bool fullpath,
bool use_thread,
bool supports_viewport_read,
bool supports_vp_read,
bool supports_read_frame_raw,
unsigned pixel_format_type
)
{
if (supports_viewport_read)
if (supports_vp_read)
{
/* Avoid taking screenshot of GUI overlays. */
if (video_st->poke && video_st->poke->set_texture_enable)
@ -586,19 +586,19 @@ bool take_screenshot(
settings_t *settings = config_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr();
bool video_gpu_screenshot = settings->bools.video_gpu_screenshot;
bool supports_viewport_read = video_st->current_video->read_viewport
bool supports_vp_read = video_st->current_video->read_viewport
&& (video_st->current_video->viewport_info);
bool prefer_viewport_read = false;
if (supports_viewport_read)
bool prefer_vp_read = false;
if (supports_vp_read)
{
/* Use VP read screenshots if it's a HW context core
* and read_frame_raw is not implemented */
if ( video_driver_is_hw_context()
&& !video_st->current_video->read_frame_raw)
prefer_viewport_read = true;
prefer_vp_read = true;
/* Avoid GPU screenshots with savestates */
if (video_gpu_screenshot && !savestate)
prefer_viewport_read = true;
prefer_vp_read = true;
}
/* No way to infer screenshot directory. */
@ -615,7 +615,7 @@ bool take_screenshot(
has_valid_framebuffer,
fullpath,
use_thread,
prefer_viewport_read,
prefer_vp_read,
(video_st->current_video->read_frame_raw != NULL),
video_st->pix_fmt
);