Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shader Preset - Wildcard Replacement in Paths on Load #15023

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions gfx/video_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2019,20 +2019,30 @@ bool video_driver_supports_read_frame_raw(void)
return false;
}

void video_driver_set_viewport_core(void)
/* Get aspect ratio (DAR) requested by the core */
float video_driver_get_core_aspect(void)
{
video_driver_state_t *video_st = &video_driver_st;
struct retro_game_geometry *geom = &video_st->av_info.geometry;
float out_aspect = 0;

if (!geom || geom->base_width <= 0.0f || geom->base_height <= 0.0f)
return;
return out_aspect;

/* Fallback to 1:1 pixel ratio if none provided */
if (geom->aspect_ratio > 0.0f)
aspectratio_lut[ASPECT_RATIO_CORE].value = geom->aspect_ratio;
out_aspect = geom->aspect_ratio;
else
aspectratio_lut[ASPECT_RATIO_CORE].value =
(float)geom->base_width / geom->base_height;
out_aspect = (float)geom->base_width / geom->base_height;

return out_aspect;
}

void video_driver_set_viewport_core(void)
{
float core_aspect = video_driver_get_core_aspect();
if (core_aspect != 0)
aspectratio_lut[ASPECT_RATIO_CORE].value = core_aspect;
}

void video_driver_set_rgba(void)
Expand Down
2 changes: 2 additions & 0 deletions gfx/video_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,8 @@ bool video_driver_prefer_viewport_read(void);

bool video_driver_supports_read_frame_raw(void);

float video_driver_get_core_aspect(void);

void video_driver_set_viewport_core(void);

void video_driver_reset_custom_viewport(settings_t *settings);
Expand Down