main: Add FSR command line option and shortcut.

This commit is contained in:
Georg Lehmann 2021-12-28 22:06:55 +01:00 committed by Joshie
parent 6cfe2fe09c
commit ead46a2db0
4 changed files with 14 additions and 0 deletions

View file

@ -37,6 +37,7 @@ const struct option *gamescope_options = (struct option[]){
{ "output-width", required_argument, nullptr, 'W' },
{ "output-height", required_argument, nullptr, 'H' },
{ "nearest-neighbor-filter", no_argument, nullptr, 'n' },
{ "fsr-upscaling", no_argument, nullptr, 'U' },
// nested mode options
{ "nested-unfocused-refresh", required_argument, nullptr, 'o' },
@ -85,6 +86,7 @@ const char usage[] =
" -W, --output-width output width\n"
" -H, --output-height output height\n"
" -n, --nearest-neighbor-filter use nearest neighbor filtering\n"
" -U --fsr-upscaling use AMD FidelityFX™ Super Resolution 1.0 for upscaling"
" --cursor path to default cursor image\n"
" -R, --ready-fd notify FD when ready\n"
" -T, --stats-path write statistics to path\n"
@ -116,6 +118,7 @@ const char usage[] =
"Keyboard shortcuts:\n"
" Super + F toggle fullscreen\n"
" Super + N toggle nearest neighbour filtering\n"
" Super + U toggle FSR upscaling\n"
" Super + S take a screenshot\n"
"";
@ -135,6 +138,7 @@ bool g_bFullscreen = false;
bool g_bIsNested = false;
bool g_bFilterGameWindow = true;
bool g_fsrUpscale = false;
bool g_bBorderlessOutputWindow = false;
@ -253,6 +257,9 @@ int main(int argc, char **argv)
case 'O':
g_sOutputName = optarg;
break;
case 'U':
g_fsrUpscale = true;
break;
case 0: // long options without a short option
opt_name = gamescope_options[opt_index].name;
if (strcmp(opt_name, "help") == 0) {

View file

@ -22,6 +22,8 @@ extern bool g_bFullscreen;
extern bool g_bFilterGameWindow;
extern bool g_fsrUpscale;
extern bool g_bBorderlessOutputWindow;
extern bool g_bNiceCap;

View file

@ -152,6 +152,9 @@ void inputSDLThreadRun( void )
case KEY_N:
g_bFilterGameWindow = !g_bFilterGameWindow;
break;
case KEY_U:
g_fsrUpscale = !g_fsrUpscale;
break;
case KEY_S:
take_screenshot();
break;

View file

@ -1506,6 +1506,8 @@ paint_all()
}
// Just draw focused window as normal, be it Steam or the game
paint_window(w, w, &composite, &pipeline, global_focus.cursor, PaintWindowFlag::BasePlane | PaintWindowFlag::DrawBorders, 1.0f);
composite.useFSRLayer0 = g_fsrUpscale;
}
update_touch_scaling( &composite );
}