1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-03 18:13:06 +00:00

Merge branch 'no_null_shader' into 'master'

Fix invalid deletion of shaders during iteration (#7587)

See merge request OpenMW/openmw!4731
This commit is contained in:
psi29a 2025-07-02 21:45:02 +00:00
commit 75b4682cd7
2 changed files with 10 additions and 15 deletions

View file

@ -301,7 +301,7 @@ namespace MWGui
auto technique = processor->loadTechnique(name);
if (!technique || technique->getStatus() == fx::Technique::Status::File_Not_exists)
if (technique->getStatus() == fx::Technique::Status::File_Not_exists)
return;
while (mConfigArea->getChildCount() > 0)
@ -432,9 +432,6 @@ namespace MWGui
{
auto technique = processor->loadTechnique(name);
if (!technique)
continue;
if (!technique->getHidden() && !processor->isTechniqueEnabled(technique))
{
std::string lowerName = Utf8Stream::lowerCaseUtf8(name);

View file

@ -348,7 +348,7 @@ namespace MWRender
for (auto& technique : mTechniques)
{
if (!technique || technique->getStatus() == fx::Technique::Status::File_Not_exists)
if (technique->getStatus() == fx::Technique::Status::File_Not_exists)
continue;
const auto lastWriteTime = std::filesystem::last_write_time(mTechniqueFileMap[technique->getName()]);
@ -570,7 +570,7 @@ namespace MWRender
for (const auto& technique : mTechniques)
{
if (!technique || !technique->isValid())
if (!technique->isValid())
continue;
if (technique->getGLSLVersion() > mGLSLVersion)
@ -712,7 +712,7 @@ namespace MWRender
PostProcessor::Status PostProcessor::enableTechnique(
std::shared_ptr<fx::Technique> technique, std::optional<int> location)
{
if (!technique || technique->getLocked() || (location.has_value() && location.value() < 0))
if (technique->getLocked() || (location.has_value() && location.value() < 0))
return Status_Error;
disableTechnique(technique, false);
@ -727,7 +727,7 @@ namespace MWRender
PostProcessor::Status PostProcessor::disableTechnique(std::shared_ptr<fx::Technique> technique, bool dirty)
{
if (!technique || technique->getLocked())
if (technique->getLocked())
return Status_Error;
auto it = std::find(mTechniques.begin(), mTechniques.end(), technique);
@ -743,9 +743,6 @@ namespace MWRender
bool PostProcessor::isTechniqueEnabled(const std::shared_ptr<fx::Technique>& technique) const
{
if (!technique)
return false;
if (auto it = std::find(mTechniques.begin(), mTechniques.end(), technique); it == mTechniques.end())
return false;
@ -817,7 +814,7 @@ namespace MWRender
for (const auto& technique : mTechniques)
{
if (!technique || technique->getDynamic() || technique->getInternal())
if (technique->getDynamic() || technique->getInternal())
continue;
chain.push_back(technique->getName());
}
@ -835,9 +832,10 @@ namespace MWRender
void PostProcessor::disableDynamicShaders()
{
for (auto& technique : mTechniques)
if (technique && technique->getDynamic())
disableTechnique(technique);
auto erased = std::erase_if(mTechniques, [](const auto& technique) { return technique->getDynamic(); });
if (erased)
dirtyTechniques();
}
int PostProcessor::renderWidth() const