mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-08-03 15:27:13 -04:00
Allow non-existent techniques to exist
This commit is contained in:
parent
206d38f3d7
commit
dbc732231f
@ -748,7 +748,7 @@ namespace MWRender
|
||||
return technique->isValid();
|
||||
}
|
||||
|
||||
std::shared_ptr<fx::Technique> PostProcessor::loadTechnique(const std::string& name, bool loadNextFrame)
|
||||
std::shared_ptr<fx::Technique> PostProcessor::loadTechnique(std::string_view name, bool loadNextFrame)
|
||||
{
|
||||
VFS::Path::Normalized path = fx::Technique::makeFileName(name);
|
||||
return loadTechnique(VFS::Path::NormalizedView(path), loadNextFrame);
|
||||
@ -764,11 +764,14 @@ namespace MWRender
|
||||
if (technique->getFileName() == path)
|
||||
return technique;
|
||||
|
||||
if (!mTechniqueFiles.contains(path))
|
||||
return {};
|
||||
std::string name;
|
||||
if (mTechniqueFiles.contains(path))
|
||||
name = mVFS->getStem(path);
|
||||
else
|
||||
name = path.stem();
|
||||
|
||||
auto technique = std::make_shared<fx::Technique>(*mVFS, *mRendering.getResourceSystem()->getImageManager(),
|
||||
path, mVFS->getStem(path), renderWidth(), renderHeight(), mUBO, mNormalsSupported);
|
||||
path, std::move(name), renderWidth(), renderHeight(), mUBO, mNormalsSupported);
|
||||
|
||||
technique->compile();
|
||||
|
||||
@ -805,10 +808,7 @@ namespace MWRender
|
||||
if (techniqueName.empty())
|
||||
continue;
|
||||
|
||||
auto technique = loadTechnique(techniqueName);
|
||||
if (!technique)
|
||||
continue;
|
||||
mTechniques.push_back(std::move(technique));
|
||||
mTechniques.push_back(loadTechnique(techniqueName));
|
||||
}
|
||||
|
||||
dirtyTechniques();
|
||||
@ -831,7 +831,11 @@ namespace MWRender
|
||||
void PostProcessor::toggleMode()
|
||||
{
|
||||
for (auto& technique : mTemplates)
|
||||
{
|
||||
if (technique->getStatus() == fx::Technique::Status::File_Not_exists)
|
||||
continue;
|
||||
technique->compile();
|
||||
}
|
||||
|
||||
dirtyTechniques(true);
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ namespace MWRender
|
||||
void toggleMode();
|
||||
|
||||
std::shared_ptr<fx::Technique> loadTechnique(VFS::Path::NormalizedView path, bool loadNextFrame = false);
|
||||
std::shared_ptr<fx::Technique> loadTechnique(const std::string& name, bool loadNextFrame = false);
|
||||
std::shared_ptr<fx::Technique> loadTechnique(std::string_view name, bool loadNextFrame = false);
|
||||
|
||||
TechniqueList getChain();
|
||||
|
||||
|
@ -136,6 +136,18 @@ namespace VFS::Path
|
||||
return p;
|
||||
}
|
||||
|
||||
std::string_view stem() const
|
||||
{
|
||||
std::string_view stem = mValue;
|
||||
std::size_t pos = stem.find_last_of(separator);
|
||||
if (pos != std::string_view::npos)
|
||||
stem = stem.substr(pos + 1);
|
||||
pos = stem.find_first_of(extensionSeparator);
|
||||
if (pos != std::string_view::npos)
|
||||
stem = stem.substr(0, pos);
|
||||
return stem;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string_view mValue;
|
||||
};
|
||||
@ -273,6 +285,11 @@ namespace VFS::Path
|
||||
return NormalizedView(*this).parent();
|
||||
}
|
||||
|
||||
std::string_view stem() const
|
||||
{
|
||||
return NormalizedView(*this).stem();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string mValue;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user