skyrim-community-shaders
skyrim-community-shaders copied to clipboard
Case insensitive checks
trafficstars
Shader types, so only invalidate specific shader type (e.g,. Lighting)
https://github.com/doodlum/skyrim-community-shaders/blob/056d064e2c7291f1b81d60747683b85555fd8440/src/ShaderCache.cpp#L1902-L1903
GetHumanTime(GetEta() + totalMs));
}
void UpdateListener::UpdateCache(const std::filesystem::path& filePath, SIE::ShaderCache& cache, bool& clearCache, bool& fileDone)
{
std::string extension = filePath.extension().string();
std::string parentDir = filePath.parent_path().string();
std::string shaderTypeString = filePath.stem().string();
std::chrono::time_point<std::chrono::system_clock> modifiedTime{};
auto shaderType = magic_enum::enum_cast<RE::BSShader::Type>(shaderTypeString, magic_enum::case_insensitive);
fileDone = true;
if (std::filesystem::exists(filePath))
modifiedTime = std::chrono::clock_cast<std::chrono::system_clock>(std::filesystem::last_write_time(filePath));
else // if file doesn't exist, don't do anything
return;
if (!std::filesystem::is_directory(filePath) && extension.starts_with(".hlsl") && parentDir.ends_with("Shaders") && shaderType.has_value()) { // TODO: Case insensitive checks
// Shader types, so only invalidate specific shader type (e.g,. Lighting)
cache.InsertModifiedShaderMap(shaderTypeString, modifiedTime);
cache.Clear(shaderType.value());
} else if (!std::filesystem::is_directory(filePath) && extension.starts_with(".hlsl")) { // TODO: Case insensitive checks
// all other shaders, since we don't know what is using it, clear everything
clearCache = true;
}
fileDone = false;
}
void UpdateListener::processQueue()
{
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);