Skip to content

Commit

Permalink
Merge branch 'sensiblechain' into 'master'
Browse files Browse the repository at this point in the history
Handle weird post-processing chains gracefully (#8295)

Closes #8295

See merge request OpenMW/openmw!4509
  • Loading branch information
psi29a committed Jan 12, 2025
2 parents 73161e6 + 383876a commit ec43849
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
Bug #8231: AGOP doesn't like NiCollisionSwitch
Bug #8237: Non-bipedal creatures should *not* use spellcast equip/unequip animations
Bug #8252: Plugin dependencies are not required to be loaded
Bug #8295: Post-processing chain is case-sensitive
Feature #1415: Infinite fall failsafe
Feature #2566: Handle NAM9 records for manual cell references
Feature #3501: OpenMW-CS: Instance Editing - Shortcuts for axial locking
Expand Down
10 changes: 7 additions & 3 deletions apps/openmw/mwrender/postprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,14 +762,18 @@ namespace MWRender
if (Misc::StringUtils::ciEqual(technique->getName(), name))
return technique;

std::string realName = name;
auto fileIter = mTechniqueFileMap.find(name);
if (fileIter != mTechniqueFileMap.end())
realName = fileIter->first;

auto technique = std::make_shared<fx::Technique>(*mVFS, *mRendering.getResourceSystem()->getImageManager(),
name, renderWidth(), renderHeight(), mUBO, mNormalsSupported);
std::move(realName), renderWidth(), renderHeight(), mUBO, mNormalsSupported);

technique->compile();

if (technique->getStatus() != fx::Technique::Status::File_Not_exists)
technique->setLastModificationTime(
std::filesystem::last_write_time(mTechniqueFileMap[technique->getName()]));
technique->setLastModificationTime(std::filesystem::last_write_time(fileIter->second));

if (loadNextFrame)
{
Expand Down
4 changes: 3 additions & 1 deletion apps/openmw/mwrender/postprocessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <components/debug/debuglog.hpp>
#include <components/fx/stateupdater.hpp>
#include <components/fx/technique.hpp>
#include <components/misc/strings/algorithm.hpp>

#include "pingpongcanvas.hpp"
#include "transparentpass.hpp"
Expand Down Expand Up @@ -229,7 +230,8 @@ namespace MWRender
TechniqueList mQueuedTemplates;
TechniqueList mInternalTechniques;

std::unordered_map<std::string, std::filesystem::path> mTechniqueFileMap;
std::unordered_map<std::string, std::filesystem::path, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual>
mTechniqueFileMap;

RenderingManager& mRendering;
osgViewer::Viewer* mViewer;
Expand Down
8 changes: 8 additions & 0 deletions components/fx/technique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ namespace fx
{
clear();

if (std::ranges::count(mFilePath.value(), '/') > 1)
{
Log(Debug::Error) << "Could not load technique, invalid location '" << mFilePath << "'";

mStatus = Status::File_Not_exists;
return false;
}

if (!mVFS.exists(mFilePath))
{
Log(Debug::Error) << "Could not load technique, file does not exist '" << mFilePath << "'";
Expand Down

0 comments on commit ec43849

Please sign in to comment.