mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 23:25:41 +00:00
PostProcessing/FX: Preserve option declaration order
This commit is contained in:
parent
bf1b023f12
commit
3282366ea7
|
@ -54,12 +54,14 @@ public:
|
|||
u32 target_height) = 0;
|
||||
|
||||
protected:
|
||||
using OptionList = std::vector<ShaderOption>;
|
||||
|
||||
static void ParseKeyValue(std::string_view line, std::string_view* key, std::string_view* value);
|
||||
|
||||
virtual void OnOptionChanged(const ShaderOption& option);
|
||||
|
||||
std::string m_name;
|
||||
std::vector<ShaderOption> m_options;
|
||||
OptionList m_options;
|
||||
};
|
||||
|
||||
} // namespace PostProcessing
|
|
@ -746,12 +746,16 @@ bool PostProcessing::ReShadeFXShader::CreateOptions(const reshadefx::module& mod
|
|||
}
|
||||
}
|
||||
|
||||
m_options.push_back(std::move(opt));
|
||||
OptionList::iterator iter = std::find_if(m_options.begin(), m_options.end(),
|
||||
[&opt](const ShaderOption& it) { return it.category == opt.category; });
|
||||
if (iter != m_options.end())
|
||||
{
|
||||
// insert at the end of this category
|
||||
while (iter != m_options.end() && iter->category == opt.category)
|
||||
++iter;
|
||||
}
|
||||
m_options.insert(iter, std::move(opt));
|
||||
}
|
||||
|
||||
// sort based on category
|
||||
std::sort(m_options.begin(), m_options.end(),
|
||||
[](const ShaderOption& lhs, const ShaderOption& rhs) { return lhs.category < rhs.category; });
|
||||
|
||||
m_uniforms_size = mod.total_uniform_size;
|
||||
DEV_LOG("{}: {} options", m_filename, m_options.size());
|
||||
|
|
Loading…
Reference in a new issue