mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
parent
1d9b89122f
commit
ce26c8a9e6
2 changed files with 24 additions and 12 deletions
|
|
@ -26,27 +26,31 @@ LsContext::LsContext(const Hooks::DeviceInfo& info, VkSwapchainKHR swapchain,
|
|||
: swapchain(swapchain), swapchainImages(swapchainImages),
|
||||
extent(extent) {
|
||||
// get updated configuration
|
||||
const auto& conf = Config::activeConf;
|
||||
auto& conf = Config::activeConf;
|
||||
if (!conf.valid->load(std::memory_order_relaxed)) {
|
||||
std::cerr << "lsfg-vk: Configuration is no longer valid, rereading...\n";
|
||||
|
||||
const bool wasPerformance = conf.performance;
|
||||
std::cerr << "lsfg-vk: Rereading configuration, as it is no longer valid.\n";
|
||||
|
||||
// reread configuration
|
||||
const std::string file = Utils::getConfigFile();
|
||||
const std::string name = Utils::getProcessName();
|
||||
try {
|
||||
const std::string file = Utils::getConfigFile();
|
||||
Config::updateConfig(file);
|
||||
const std::string name = Utils::getProcessName();
|
||||
Config::activeConf = Config::getConfig(name);
|
||||
conf = Config::getConfig(name);
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "lsfg-vk: Failed to update configuration, continuing using old:\n";
|
||||
std::cerr << "- " << e.what() << '\n';
|
||||
}
|
||||
|
||||
if (wasPerformance && !Config::activeConf.performance)
|
||||
LSFG_3_1P::finalize();
|
||||
if (!wasPerformance && Config::activeConf.performance)
|
||||
LSFG_3_1::finalize();
|
||||
LSFG_3_1P::finalize();
|
||||
LSFG_3_1::finalize();
|
||||
|
||||
// print config
|
||||
std::cerr << "lsfg-vk: Reloaded configuration for " << name << ":\n";
|
||||
if (!conf.dll.empty()) std::cerr << " Using DLL from: " << conf.dll << '\n';
|
||||
std::cerr << " Multiplier: " << conf.multiplier << '\n';
|
||||
std::cerr << " Flow Scale: " << conf.flowScale << '\n';
|
||||
std::cerr << " Performance Mode: " << (conf.performance ? "Enabled" : "Disabled") << '\n';
|
||||
std::cerr << " HDR Mode: " << (conf.hdr ? "Enabled" : "Disabled") << '\n';
|
||||
}
|
||||
// we could take the format from the swapchain,
|
||||
// but honestly this is safer.
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
#include "hooks.hpp"
|
||||
#include "common/exception.hpp"
|
||||
#include "config/config.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
#include "context.hpp"
|
||||
#include "layer.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -248,6 +250,12 @@ namespace {
|
|||
std::vector<VkSemaphore> semaphores(pPresentInfo->waitSemaphoreCount);
|
||||
std::copy_n(pPresentInfo->pWaitSemaphores, semaphores.size(), semaphores.data());
|
||||
|
||||
// ensure config is valid
|
||||
auto& conf = Config::activeConf;
|
||||
if (!conf.valid->load(std::memory_order_relaxed))
|
||||
return VK_ERROR_OUT_OF_DATE_KHR;
|
||||
|
||||
// present the swapchain
|
||||
res = swapchain.present(deviceInfo, pPresentInfo->pNext,
|
||||
queue, semaphores, *pPresentInfo->pImageIndices);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue