Skip to content

Commit

Permalink
Minor clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
iota97 committed Jun 14, 2020
1 parent 16864cc commit c82265b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,8 +1202,8 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {

auto postShaderChain = iniFile.GetOrCreateSection("PostShaderList")->ToMap();
vPostShaderNames.clear();
for (auto it = postShaderChain.begin(), end = postShaderChain.end(); it != end; ++it) {
vPostShaderNames.push_back(it->second); // Push by order not number
for (auto it : postShaderChain) {
vPostShaderNames.push_back(it.second);
}
if (vPostShaderNames.empty())
vPostShaderNames.push_back("Off");
Expand Down Expand Up @@ -1624,8 +1624,8 @@ bool Config::loadGameConfig(const std::string &pGameId, const std::string &title

auto postShaderChain = iniFile.GetOrCreateSection("PostShaderList")->ToMap();
vPostShaderNames.clear();
for (auto it = postShaderChain.begin(), end = postShaderChain.end(); it != end; ++it) {
vPostShaderNames.push_back(it->second); // Push by order not number
for (auto it : postShaderChain) {
vPostShaderNames.push_back(it.second);
}
if (vPostShaderNames.empty())
vPostShaderNames.push_back("Off");
Expand Down Expand Up @@ -1662,8 +1662,8 @@ void Config::unloadGameConfig() {

auto postShaderChain = iniFile.GetOrCreateSection("PostShaderList")->ToMap();
vPostShaderNames.clear();
for (auto it = postShaderChain.begin(), end = postShaderChain.end(); it != end; ++it) {
vPostShaderNames.push_back(it->second); // Push by order not number
for (auto it : postShaderChain) {
vPostShaderNames.push_back(it.second);
}
if (vPostShaderNames.empty())
vPostShaderNames.push_back("Off");
Expand Down
2 changes: 1 addition & 1 deletion Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ struct Config {
bool bFragmentTestCache;
int iSplineBezierQuality; // 0 = low , 1 = Intermediate , 2 = High
bool bHardwareTessellation;
std::vector<std::string> vPostShaderNames; // Off for off or chain end.
std::vector<std::string> vPostShaderNames; // Off for chain end (only Off for no shader)
std::map<std::string, float> mPostShaderSetting;
bool bGfxDebugOutput;
bool bGfxDebugSplitSubmit;
Expand Down
6 changes: 3 additions & 3 deletions GPU/Common/PostShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ std::vector<const ShaderInfo *> GetPostShaderChain(const std::string &name) {

std::vector<const ShaderInfo *> GetFullPostShadersChain(const std::vector<std::string> &names) {
std::vector<const ShaderInfo *> fullChain;
for (int i = 0; i < names.size(); ++i) {
if (names[i] == "Off")
for (auto shaderName : names) {
if (shaderName == "Off")
break;
auto shaderChain = GetPostShaderChain(names[i]);
auto shaderChain = GetPostShaderChain(shaderName);
fullChain.insert(fullChain.end(), shaderChain.begin(), shaderChain.end());
}
return fullChain;
Expand Down
2 changes: 1 addition & 1 deletion UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void GameSettingsScreen::CreateViews() {

std::vector<std::string> alreadyAddedShader;
for (int i = 0; i < g_Config.vPostShaderNames.size() && i < ARRAY_SIZE(shaderNames_); ++i) {
// Vector pointer get invalidated on resize, cache them here
// Vector pointer get invalidated on resize, cache name to have always a valid reference for drawing
shaderNames_[i] = g_Config.vPostShaderNames[i];
postProcChoice_ = graphicsSettings->Add(new ChoiceWithValueDisplay(&shaderNames_[i], StringFromFormat("%s #%d", gr->T("Postprocessing Shader"), i + 1), &PostShaderTranslateName));
postProcChoice_->OnClick.Add([=](EventParams &e) {
Expand Down

0 comments on commit c82265b

Please sign in to comment.