summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PostProcessing.cpp
diff options
context:
space:
mode:
authorFilippo Tarpini <filippotarpini@hotmail.it>2023-06-08 02:54:46 +0300
committerGitHub <noreply@github.com>2023-06-08 02:54:46 +0300
commitc9e61a79b7583f6f00966d4ac58c18eed126c810 (patch)
treebc15dd326835a5cb64a54631bcbd4fd9969d21cf /Source/Core/VideoCommon/PostProcessing.cpp
parent44d93048b3544a3a1bd632a9b05623f67d587e1b (diff)
Video: Fix Post Process shader options issues
-An assert would be erroneously thrown when shaders declared an array of 4 int or float options, despite 4 being the max supported (a simple <= / < mistake) -When changing the type of a shader option (e.g. from bool to float), the serialization would be stuck appending the value from the previous option type, making the shader fail to build permanently until the cache were cleaned
Diffstat (limited to 'Source/Core/VideoCommon/PostProcessing.cpp')
-rw-r--r--Source/Core/VideoCommon/PostProcessing.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp
index 601d340b0b..c2f311376b 100644
--- a/Source/Core/VideoCommon/PostProcessing.cpp
+++ b/Source/Core/VideoCommon/PostProcessing.cpp
@@ -255,7 +255,13 @@ void PostProcessingConfiguration::LoadOptionsConfiguration()
std::string value;
ini.GetOrCreateSection(section)->Get(it.second.m_option_name, &value);
if (!value.empty())
- TryParseVector(value, &it.second.m_integer_values);
+ {
+ auto integer_values = it.second.m_integer_values;
+ if (TryParseVector(value, &integer_values))
+ {
+ it.second.m_integer_values = integer_values;
+ }
+ }
}
break;
case ConfigurationOption::OptionType::Float:
@@ -263,7 +269,13 @@ void PostProcessingConfiguration::LoadOptionsConfiguration()
std::string value;
ini.GetOrCreateSection(section)->Get(it.second.m_option_name, &value);
if (!value.empty())
- TryParseVector(value, &it.second.m_float_values);
+ {
+ auto float_values = it.second.m_float_values;
+ if (TryParseVector(value, &float_values))
+ {
+ it.second.m_float_values = float_values;
+ }
+ }
}
break;
}
@@ -664,13 +676,13 @@ void PostProcessing::FillUniformBuffer(const MathUtil::Rectangle<int>& src,
break;
case PostProcessingConfiguration::ConfigurationOption::OptionType::Integer:
- ASSERT(it.second.m_integer_values.size() < 4);
+ ASSERT(it.second.m_integer_values.size() <= 4);
std::copy_n(it.second.m_integer_values.begin(), it.second.m_integer_values.size(),
value.as_int);
break;
case PostProcessingConfiguration::ConfigurationOption::OptionType::Float:
- ASSERT(it.second.m_float_values.size() < 4);
+ ASSERT(it.second.m_float_values.size() <= 4);
std::copy_n(it.second.m_float_values.begin(), it.second.m_float_values.size(),
value.as_float);
break;