diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/settings.h | 5 | ||||
-rw-r--r-- | src/core/core.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/kernel/k_page_table.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/time/time_manager.cpp | 13 | ||||
-rw-r--r-- | src/shader_recompiler/ir_opt/texture_pass.cpp | 3 | ||||
-rw-r--r-- | src/video_core/query_cache.h | 8 | ||||
-rw-r--r-- | src/video_core/rasterizer_accelerated.h | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_device.cpp | 1 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_master_semaphore.h | 17 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_query_cache.cpp | 3 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 7 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 10 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 2 | ||||
-rw-r--r-- | src/yuzu_cmd/config.cpp | 3 |
14 files changed, 45 insertions, 36 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 402339443..9ff4cf85d 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -7,7 +7,6 @@ #include <algorithm> #include <array> #include <atomic> -#include <chrono> #include <map> #include <optional> #include <string> @@ -487,9 +486,9 @@ struct Values { // System Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; // Measured in seconds since epoch - std::optional<std::chrono::seconds> custom_rtc; + std::optional<s64> custom_rtc; // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` - std::chrono::seconds custom_rtc_differential; + s64 custom_rtc_differential; BasicSetting<s32> current_user{0, "current_user"}; RangedSetting<s32> language_index{1, 0, 17, "language_index"}; diff --git a/src/core/core.cpp b/src/core/core.cpp index 3042d611b..3c75f42ae 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -196,8 +196,9 @@ struct System::Impl { cpu_manager.Initialize(); core_timing.Initialize([&system]() { system.RegisterHostThread(); }); - const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::system_clock::now().time_since_epoch()); + const auto posix_time = std::chrono::system_clock::now().time_since_epoch(); + const auto current_time = + std::chrono::duration_cast<std::chrono::seconds>(posix_time).count(); Settings::values.custom_rtc_differential = Settings::values.custom_rtc.value_or(current_time) - current_time; diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp index 701268545..5e0b620c2 100644 --- a/src/core/hle/kernel/k_page_table.cpp +++ b/src/core/hle/kernel/k_page_table.cpp @@ -363,6 +363,8 @@ ResultCode KPageTable::UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, st block_manager->Update(src_addr, num_pages, KMemoryState::Normal, KMemoryPermission::ReadAndWrite); + system.InvalidateCpuInstructionCacheRange(dst_addr, size); + return ResultSuccess; } diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp index 4bbc606a1..9c4c960ef 100644 --- a/src/core/hle/service/time/time_manager.cpp +++ b/src/core/hle/service/time/time_manager.cpp @@ -13,18 +13,19 @@ #include "core/hle/service/time/time_manager.h" namespace Service::Time { - +namespace { constexpr Clock::TimeSpanType standard_network_clock_accuracy{0x0009356907420000ULL}; -static std::chrono::seconds GetSecondsSinceEpoch() { - return std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::system_clock::now().time_since_epoch()) + +s64 GetSecondsSinceEpoch() { + const auto time_since_epoch = std::chrono::system_clock::now().time_since_epoch(); + return std::chrono::duration_cast<std::chrono::seconds>(time_since_epoch).count() + Settings::values.custom_rtc_differential; } -static s64 GetExternalRtcValue() { - return GetSecondsSinceEpoch().count() + TimeManager::GetExternalTimeZoneOffset(); +s64 GetExternalRtcValue() { + return GetSecondsSinceEpoch() + TimeManager::GetExternalTimeZoneOffset(); } +} // Anonymous namespace struct TimeManager::Impl final { explicit Impl(Core::System& system) diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp index 44ad10d43..225c238fb 100644 --- a/src/shader_recompiler/ir_opt/texture_pass.cpp +++ b/src/shader_recompiler/ir_opt/texture_pass.cpp @@ -492,7 +492,8 @@ void TexturePass(Environment& env, IR::Program& program) { const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)}; IR::IREmitter ir{*texture_inst.block, insert_point}; const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))}; - inst->SetArg(0, ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift)); + inst->SetArg(0, ir.SMin(ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift), + ir.Imm32(DESCRIPTOR_SIZE - 1))); } else { inst->SetArg(0, IR::Value{}); } diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index 73231061a..392f82eb7 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h @@ -258,9 +258,9 @@ private: void AsyncFlushQuery(VAddr addr) { if (!uncommitted_flushes) { - uncommitted_flushes = std::make_shared<std::unordered_set<VAddr>>(); + uncommitted_flushes = std::make_shared<std::vector<VAddr>>(); } - uncommitted_flushes->insert(addr); + uncommitted_flushes->push_back(addr); } static constexpr std::uintptr_t PAGE_SIZE = 4096; @@ -276,8 +276,8 @@ private: std::array<CounterStream, VideoCore::NumQueryTypes> streams; - std::shared_ptr<std::unordered_set<VAddr>> uncommitted_flushes{}; - std::list<std::shared_ptr<std::unordered_set<VAddr>>> committed_flushes; + std::shared_ptr<std::vector<VAddr>> uncommitted_flushes{}; + std::list<std::shared_ptr<std::vector<VAddr>>> committed_flushes; }; template <class QueryCache, class HostCounter> diff --git a/src/video_core/rasterizer_accelerated.h b/src/video_core/rasterizer_accelerated.h index ea879bfdd..249644e50 100644 --- a/src/video_core/rasterizer_accelerated.h +++ b/src/video_core/rasterizer_accelerated.h @@ -42,7 +42,7 @@ private: }; static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!"); - std::array<CacheEntry, 0x1000000> cached_pages; + std::array<CacheEntry, 0x2000000> cached_pages; Core::Memory::Memory& cpu_memory; }; diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index 9692b8e94..1e1d1d020 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp @@ -10,6 +10,7 @@ #include <limits> #include <optional> #include <span> +#include <stdexcept> #include <vector> #include <glad/glad.h> diff --git a/src/video_core/renderer_vulkan/vk_master_semaphore.h b/src/video_core/renderer_vulkan/vk_master_semaphore.h index 4f8688118..0886b7da8 100644 --- a/src/video_core/renderer_vulkan/vk_master_semaphore.h +++ b/src/video_core/renderer_vulkan/vk_master_semaphore.h @@ -21,12 +21,12 @@ public: /// Returns the current logical tick. [[nodiscard]] u64 CurrentTick() const noexcept { - return current_tick.load(std::memory_order_relaxed); + return current_tick.load(std::memory_order_acquire); } /// Returns the last known GPU tick. [[nodiscard]] u64 KnownGpuTick() const noexcept { - return gpu_tick.load(std::memory_order_relaxed); + return gpu_tick.load(std::memory_order_acquire); } /// Returns the timeline semaphore handle. @@ -41,12 +41,21 @@ public: /// Advance to the logical tick and return the old one [[nodiscard]] u64 NextTick() noexcept { - return current_tick.fetch_add(1, std::memory_order::relaxed); + return current_tick.fetch_add(1, std::memory_order_release); } /// Refresh the known GPU tick void Refresh() { - gpu_tick.store(semaphore.GetCounter(), std::memory_order_relaxed); + u64 this_tick{}; + u64 counter{}; + do { + this_tick = gpu_tick.load(std::memory_order_acquire); + counter = semaphore.GetCounter(); + if (counter < this_tick) { + return; + } + } while (!gpu_tick.compare_exchange_weak(this_tick, counter, std::memory_order_release, + std::memory_order_relaxed)); } /// Waits for a tick to be hit on the GPU diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index c9cb32d71..259cba156 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp @@ -117,7 +117,8 @@ u64 HostCounter::BlockingQuery() const { cache.GetScheduler().Wait(tick); u64 data; const VkResult query_result = cache.GetDevice().GetLogical().GetQueryResults( - query.first, query.second, 1, sizeof(data), &data, sizeof(data), VK_QUERY_RESULT_64_BIT); + query.first, query.second, 1, sizeof(data), &data, sizeof(data), + VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); switch (query_result) { case VK_SUCCESS: diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 30a864135..faea5dda1 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -918,8 +918,7 @@ void Config::ReadSystemValues() { const auto custom_rtc_enabled = ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool(); if (custom_rtc_enabled) { - Settings::values.custom_rtc = - std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong()); + Settings::values.custom_rtc = ReadSetting(QStringLiteral("custom_rtc"), 0).toLongLong(); } else { Settings::values.custom_rtc = std::nullopt; } @@ -1450,9 +1449,7 @@ void Config::SaveSystemValues() { WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(), false); WriteSetting(QStringLiteral("custom_rtc"), - QVariant::fromValue<long long>( - Settings::values.custom_rtc.value_or(std::chrono::seconds{}).count()), - 0); + QVariant::fromValue<long long>(Settings::values.custom_rtc.value_or(0)), 0); } WriteGlobalSetting(Settings::values.sound_index); diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index eea45f8ea..56c762d64 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -65,8 +65,7 @@ void ConfigureSystem::SetConfiguration() { QStringLiteral("%1") .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) .toUpper(); - const auto rtc_time = Settings::values.custom_rtc.value_or( - std::chrono::seconds(QDateTime::currentSecsSinceEpoch())); + const auto rtc_time = Settings::values.custom_rtc.value_or(QDateTime::currentSecsSinceEpoch()); ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() && @@ -75,7 +74,7 @@ void ConfigureSystem::SetConfiguration() { ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value()); ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value()); - ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); + ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time)); if (Settings::IsConfiguringGlobal()) { ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue()); @@ -108,10 +107,9 @@ void ConfigureSystem::ApplyConfiguration() { // to allow in-game time to be fast forwarded if (Settings::IsConfiguringGlobal()) { if (ui->custom_rtc_checkbox->isChecked()) { - Settings::values.custom_rtc = - std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()); + Settings::values.custom_rtc = ui->custom_rtc_edit->dateTime().toSecsSinceEpoch(); if (system.IsPoweredOn()) { - const s64 posix_time{Settings::values.custom_rtc->count() + + const s64 posix_time{*Settings::values.custom_rtc + Service::Time::TimeManager::GetExternalTimeZoneOffset()}; system.GetTimeManager().UpdateLocalSystemClockTime(posix_time); } diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index fdcd423d7..2af582fe5 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1666,7 +1666,7 @@ void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) { const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)}; if (!Common::FS::CreateDirs(shader_cache_folder_path)) { QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"), - tr("Filed to create the shader cache directory for this title.")); + tr("Failed to create the shader cache directory for this title.")); return; } const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)}; diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 8ca20679a..0b8fde691 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -412,8 +412,7 @@ void Config::ReadValues() { const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false); if (custom_rtc_enabled) { - Settings::values.custom_rtc = - std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0)); + Settings::values.custom_rtc = sdl2_config->GetInteger("System", "custom_rtc", 0); } else { Settings::values.custom_rtc = std::nullopt; } |