Merge pull request #408 from Areloch/MiscOptionsMenuFix

Fixes for AA toggle and GFX Device reporting for options menu
This commit is contained in:
Brian Roberts 2020-12-14 13:22:56 -06:00 committed by GitHub
commit 41624ecb2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 8 deletions

View file

@ -1364,6 +1364,17 @@ DefineEngineFunction( getDisplayDeviceInformation, const char*, (),,
return adapter.getName(); return adapter.getName();
} }
DefineEngineFunction(getDisplayDeviceType, GFXAdapterType, (), ,
"Get the string describing the active GFX device type.\n"
"@ingroup GFX\n")
{
if (!GFXDevice::devicePresent())
return NullDevice;
const GFXAdapter& adapter = GFX->getAdapter();
return adapter.mType;
}
DefineEngineFunction( getBestHDRFormat, GFXFormat, (),, DefineEngineFunction( getBestHDRFormat, GFXFormat, (),,
"Returns the best texture format for storage of HDR data for the active device.\n" "Returns the best texture format for storage of HDR data for the active device.\n"
"@ingroup GFX\n" ) "@ingroup GFX\n" )
@ -1388,4 +1399,4 @@ DefineEngineFunction( getBestHDRFormat, GFXFormat, (),,
DefineEngineFunction(ResetGFX, void, (), , "forces the gbuffer to be reinitialized in cases of improper/lack of buffer clears.") DefineEngineFunction(ResetGFX, void, (), , "forces the gbuffer to be reinitialized in cases of improper/lack of buffer clears.")
{ {
GFX->beginReset(); GFX->beginReset();
} }

View file

@ -37,7 +37,7 @@ function createCanvas(%windowTitle)
// Set the window title // Set the window title
if (isObject(Canvas)) if (isObject(Canvas))
{ {
Canvas.setWindowTitle(%windowTitle @ " - " @ $pref::Video::displayDevice); Canvas.setWindowTitle(%windowTitle @ " - " @ getDisplayDeviceType());
configureCanvas(); configureCanvas();
} }
else else
@ -107,7 +107,7 @@ function configureCanvas()
%resY = $pref::Video::Resolution.y; %resY = $pref::Video::Resolution.y;
%bpp = $pref::Video::BitDepth; %bpp = $pref::Video::BitDepth;
%rate = $pref::Video::RefreshRate; %rate = $pref::Video::RefreshRate;
%fsaa = $pref::Video::AA; %aa = $pref::Video::AA;
%fs = ($pref::Video::deviceMode == 2); %fs = ($pref::Video::deviceMode == 2);
echo("Accepted Mode: " NL echo("Accepted Mode: " NL
@ -115,7 +115,7 @@ function configureCanvas()
"--Screen Mode : " @ %fsLabel NL "--Screen Mode : " @ %fsLabel NL
"--Bits Per Pixel : " @ %bpp NL "--Bits Per Pixel : " @ %bpp NL
"--Refresh Rate : " @ %rate NL "--Refresh Rate : " @ %rate NL
"--FSAA Level : " @ %fsaa NL "--FSAA Level : " @ %aa NL
"--------------"); "--------------");
// Actually set the new video mode // Actually set the new video mode
@ -132,8 +132,8 @@ function configureCanvas()
// We need to parse the setting between AA modes, and then it's level // We need to parse the setting between AA modes, and then it's level
// It's formatted as AATypexAALevel // It's formatted as AATypexAALevel
// So, FXAAx4 or MLAAx2 // So, FXAAx4 or MLAAx2
if ( isObject( FXAA_PostEffect ) ) if ( isObject( FXAAPostFX ) )
FXAA_PostEffect.Enabled = ( %aa > 0 ) ? true : false; FXAAPostFX.Enabled = ( %aa > 0 ) ? true : false;
} }
function GuiCanvas::modeStrToPrefs(%this, %modeStr) function GuiCanvas::modeStrToPrefs(%this, %modeStr)

View file

@ -196,7 +196,32 @@ function OptionsMenu::populateDisplaySettingsList(%this)
OptionName.setText(""); OptionName.setText("");
OptionDescription.setText(""); OptionDescription.setText("");
OptionsMenuSettingsList.addOptionRow("Display API", "D3D11\tOpenGL", false, "", -1, -30, true, "The display API used for rendering.", $pref::Video::displayDevice); //First, lets double-check the active device is accurate. Sometimes the default value in our prefs doesn't match the active one
%displayDevice = getDisplayDeviceType();
if($changingDisplayDevice !$= "")
%displayDevice = $changingDisplayDevice;
%apiList = "";
%apiCount = GFXInit::getAdapterCount();
%apiIdx = 0;
for(%i=0; %i < %apiCount; %i++)
{
%api = GFXInit::getAdapterType(%i);
if(%api !$= "NullDevice")
{
if(%apiIdx==0)
%apiList = %api;
else
%apiList = %apiList TAB %api;
%apiIdx++;
}
}
trim(%apiList);
OptionsMenuSettingsList.addOptionRow("Display API", %apiList, false, "", -1, -30, true, "The display API used for rendering.", %displayDevice);
%numDevices = Canvas.getMonitorCount(); %numDevices = Canvas.getMonitorCount();
%devicesList = ""; %devicesList = "";
@ -246,7 +271,7 @@ function OptionsMenu::populateDisplaySettingsList(%this)
function OptionsMenu::applyDisplaySettings(%this) function OptionsMenu::applyDisplaySettings(%this)
{ {
%newDevice = OptionsMenuSettingsList.getCurrentOption(0); %newDevice = OptionsMenuSettingsList.getCurrentOption(0);
// Change the device. // Change the device.
if ( %newDevice !$= $pref::Video::displayDevice ) if ( %newDevice !$= $pref::Video::displayDevice )
@ -257,6 +282,8 @@ function OptionsMenu::applyDisplaySettings(%this)
$pref::Video::displayDevice = %newDevice; $pref::Video::displayDevice = %newDevice;
if( %newAdapter !$= getDisplayDeviceInformation() ) if( %newAdapter !$= getDisplayDeviceInformation() )
MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." ); MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." );
$changingDisplayDevice = %newDevice;
} }
updateDisplaySettings(); updateDisplaySettings();