Skip to content

Commit

Permalink
Add performance presets for Global Illum
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaldaien authored Mar 23, 2017
1 parent 7c4221a commit 7473e0b
Showing 1 changed file with 51 additions and 11 deletions.
62 changes: 51 additions & 11 deletions nier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@


sk::ParameterFactory far_factory;
iSK_INI* far_prefs = nullptr;
sk::ParameterInt* far_gi_workgroups = nullptr;
iSK_INI* far_prefs = nullptr;
wchar_t far_prefs_file [MAX_PATH] = { L'\0' };
sk::ParameterInt* far_gi_workgroups = nullptr;


// (Presumable) Size of compute shader workgroup
Expand All @@ -30,7 +31,7 @@ extern void
__stdcall
SK_SetPluginName (std::wstring name);

#define FAR_VERSION_NUM L"0.1.0"
#define FAR_VERSION_NUM L"0.1.1"
#define FAR_VERSION_STR L"FAR v " FAR_VERSION_NUM


Expand Down Expand Up @@ -176,8 +177,6 @@ SK_FAR_InitPlugin (void)

if (far_prefs == nullptr)
{
wchar_t far_prefs_file [MAX_PATH] = { L'\0' };

lstrcatW (far_prefs_file, SK_GetConfigPath ());
lstrcatW (far_prefs_file, L"FAR.ini");

Expand All @@ -192,7 +191,7 @@ SK_FAR_InitPlugin (void)
L"FAR.Lighting",
L"GlobalIlluminationWorkgroups" );

if ( far_prefs->get_section (L"FAR.Lighting").contains_key (L"GlobalIlluminationWorkgroups") )
if (far_gi_workgroups->load ())
__FAR_GlobalIllumWorkGroupSize = far_gi_workgroups->get_value ();

far_gi_workgroups->set_value (__FAR_GlobalIllumWorkGroupSize);
Expand Down Expand Up @@ -220,19 +219,60 @@ void
__stdcall
SK_FAR_ControlPanel (void)
{
if (ImGui::CollapsingHeader("NieR: Automata"))
bool changed = false;

if (ImGui::CollapsingHeader("NieR: Automata", ImGuiTreeNodeFlags_DefaultOpen))
{
if (ImGui::SliderInt ("Global Illumination Workgroup Size", &__FAR_GlobalIllumWorkGroupSize, 0, 128))
int quality = 0;

if (__FAR_GlobalIllumWorkGroupSize < 16)
quality = 0;
else if (__FAR_GlobalIllumWorkGroupSize < 32)
quality = 1;
else if (__FAR_GlobalIllumWorkGroupSize < 128)
quality = 2;
else
quality = 3;

if ( ImGui::Combo ( "Global Illumination Quality", &quality, "Off (High Performance)\0"
"Low\0"
"Medium\0"
"High (Game Default)\0\0", 4 ) )
{
if (__FAR_GlobalIllumWorkGroupSize % 16 > 0)
__FAR_GlobalIllumWorkGroupSize += 16 - (__FAR_GlobalIllumWorkGroupSize % 16);
changed = true;

switch (quality)
{
case 0:
__FAR_GlobalIllumWorkGroupSize = 0;
break;

case 1:
__FAR_GlobalIllumWorkGroupSize = 16;
break;

case 2:
__FAR_GlobalIllumWorkGroupSize = 32;
break;

default:
case 3:
__FAR_GlobalIllumWorkGroupSize = 128;
break;
}
}

far_gi_workgroups->set_value (__FAR_GlobalIllumWorkGroupSize);
far_gi_workgroups->store ();
}

if (changed)
far_prefs->write (far_prefs_file);
}

bool
__stdcall
SK_FAR_IsPlugIn (void)
{
return far_prefs != nullptr;
}
}

0 comments on commit 7473e0b

Please sign in to comment.