summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/alignment.h7
-rw-r--r--src/common/settings.h5
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.cpp2
-rw-r--r--src/core/core.cpp5
-rw-r--r--src/core/hle/kernel/k_page_table.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp17
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h13
-rw-r--r--src/core/hle/service/time/time_manager.cpp13
-rw-r--r--src/input_common/udp/client.cpp74
-rw-r--r--src/shader_recompiler/ir_opt/texture_pass.cpp3
-rw-r--r--src/video_core/dirty_flags.h3
-rw-r--r--src/video_core/query_cache.h8
-rw-r--r--src/video_core/rasterizer_accelerated.h2
-rw-r--r--src/video_core/renderer_opengl/gl_device.cpp1
-rw-r--r--src/video_core/renderer_vulkan/vk_master_semaphore.h17
-rw-r--r--src/video_core/renderer_vulkan/vk_query_cache.cpp3
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp16
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.cpp1
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.h3
-rw-r--r--src/video_core/texture_cache/texture_cache.h3
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp4
-rw-r--r--src/video_core/vulkan_common/vulkan_device.h5
-rw-r--r--src/yuzu/configuration/config.cpp7
-rw-r--r--src/yuzu/configuration/configure_system.cpp10
-rw-r--r--src/yuzu/configuration/configure_tas.ui4
-rw-r--r--src/yuzu/main.cpp2
-rw-r--r--src/yuzu_cmd/config.cpp3
27 files changed, 130 insertions, 103 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 1b56569d1..8570c7d3c 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -64,7 +64,7 @@ public:
64 using propagate_on_container_copy_assignment = std::true_type; 64 using propagate_on_container_copy_assignment = std::true_type;
65 using propagate_on_container_move_assignment = std::true_type; 65 using propagate_on_container_move_assignment = std::true_type;
66 using propagate_on_container_swap = std::true_type; 66 using propagate_on_container_swap = std::true_type;
67 using is_always_equal = std::true_type; 67 using is_always_equal = std::false_type;
68 68
69 constexpr AlignmentAllocator() noexcept = default; 69 constexpr AlignmentAllocator() noexcept = default;
70 70
@@ -83,6 +83,11 @@ public:
83 struct rebind { 83 struct rebind {
84 using other = AlignmentAllocator<T2, Align>; 84 using other = AlignmentAllocator<T2, Align>;
85 }; 85 };
86
87 template <typename T2, size_t Align2>
88 constexpr bool operator==(const AlignmentAllocator<T2, Align2>&) const noexcept {
89 return std::is_same_v<T, T2> && Align == Align2;
90 }
86}; 91};
87 92
88} // namespace Common 93} // namespace Common
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 @@
7#include <algorithm> 7#include <algorithm>
8#include <array> 8#include <array>
9#include <atomic> 9#include <atomic>
10#include <chrono>
11#include <map> 10#include <map>
12#include <optional> 11#include <optional>
13#include <string> 12#include <string>
@@ -487,9 +486,9 @@ struct Values {
487 // System 486 // System
488 Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; 487 Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"};
489 // Measured in seconds since epoch 488 // Measured in seconds since epoch
490 std::optional<std::chrono::seconds> custom_rtc; 489 std::optional<s64> custom_rtc;
491 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` 490 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc`
492 std::chrono::seconds custom_rtc_differential; 491 s64 custom_rtc_differential;
493 492
494 BasicSetting<s32> current_user{0, "current_user"}; 493 BasicSetting<s32> current_user{0, "current_user"};
495 RangedSetting<s32> language_index{1, 0, 17, "language_index"}; 494 RangedSetting<s32> language_index{1, 0, 17, "language_index"};
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
index bf27ffe71..4fd15f111 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
@@ -263,7 +263,7 @@ void ARM_Dynarmic_64::Run() {
263} 263}
264 264
265void ARM_Dynarmic_64::Step() { 265void ARM_Dynarmic_64::Step() {
266 cb->InterpreterFallback(jit->GetPC(), 1); 266 jit->Step();
267} 267}
268 268
269ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, CPUInterrupts& interrupt_handlers_, 269ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, CPUInterrupts& interrupt_handlers_,
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 {
196 cpu_manager.Initialize(); 196 cpu_manager.Initialize();
197 core_timing.Initialize([&system]() { system.RegisterHostThread(); }); 197 core_timing.Initialize([&system]() { system.RegisterHostThread(); });
198 198
199 const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( 199 const auto posix_time = std::chrono::system_clock::now().time_since_epoch();
200 std::chrono::system_clock::now().time_since_epoch()); 200 const auto current_time =
201 std::chrono::duration_cast<std::chrono::seconds>(posix_time).count();
201 Settings::values.custom_rtc_differential = 202 Settings::values.custom_rtc_differential =
202 Settings::values.custom_rtc.value_or(current_time) - current_time; 203 Settings::values.custom_rtc.value_or(current_time) - current_time;
203 204
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
363 block_manager->Update(src_addr, num_pages, KMemoryState::Normal, 363 block_manager->Update(src_addr, num_pages, KMemoryState::Normal,
364 KMemoryPermission::ReadAndWrite); 364 KMemoryPermission::ReadAndWrite);
365 365
366 system.InvalidateCpuInstructionCacheRange(dst_addr, size);
367
366 return ResultSuccess; 368 return ResultSuccess;
367} 369}
368 370
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
index 845de724d..e61261f98 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
@@ -69,8 +69,7 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
69 std::vector<Reloc> relocs(params.relocation_count); 69 std::vector<Reloc> relocs(params.relocation_count);
70 std::vector<u32> reloc_shifts(params.relocation_count); 70 std::vector<u32> reloc_shifts(params.relocation_count);
71 std::vector<SyncptIncr> syncpt_increments(params.syncpoint_count); 71 std::vector<SyncptIncr> syncpt_increments(params.syncpoint_count);
72 std::vector<SyncptIncr> wait_checks(params.syncpoint_count); 72 std::vector<u32> fence_thresholds(params.fence_count);
73 std::vector<Fence> fences(params.fence_count);
74 73
75 // Slice input into their respective buffers 74 // Slice input into their respective buffers
76 std::size_t offset = sizeof(IoctlSubmit); 75 std::size_t offset = sizeof(IoctlSubmit);
@@ -78,15 +77,13 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
78 offset += SliceVectors(input, relocs, params.relocation_count, offset); 77 offset += SliceVectors(input, relocs, params.relocation_count, offset);
79 offset += SliceVectors(input, reloc_shifts, params.relocation_count, offset); 78 offset += SliceVectors(input, reloc_shifts, params.relocation_count, offset);
80 offset += SliceVectors(input, syncpt_increments, params.syncpoint_count, offset); 79 offset += SliceVectors(input, syncpt_increments, params.syncpoint_count, offset);
81 offset += SliceVectors(input, wait_checks, params.syncpoint_count, offset); 80 offset += SliceVectors(input, fence_thresholds, params.fence_count, offset);
82 offset += SliceVectors(input, fences, params.fence_count, offset);
83 81
84 auto& gpu = system.GPU(); 82 auto& gpu = system.GPU();
85 if (gpu.UseNvdec()) { 83 if (gpu.UseNvdec()) {
86 for (std::size_t i = 0; i < syncpt_increments.size(); i++) { 84 for (std::size_t i = 0; i < syncpt_increments.size(); i++) {
87 const SyncptIncr& syncpt_incr = syncpt_increments[i]; 85 const SyncptIncr& syncpt_incr = syncpt_increments[i];
88 fences[i].id = syncpt_incr.id; 86 fence_thresholds[i] =
89 fences[i].value =
90 syncpoint_manager.IncreaseSyncpoint(syncpt_incr.id, syncpt_incr.increments); 87 syncpoint_manager.IncreaseSyncpoint(syncpt_incr.id, syncpt_incr.increments);
91 } 88 }
92 } 89 }
@@ -98,11 +95,6 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
98 cmdlist.size() * sizeof(u32)); 95 cmdlist.size() * sizeof(u32));
99 gpu.PushCommandBuffer(cmdlist); 96 gpu.PushCommandBuffer(cmdlist);
100 } 97 }
101 if (gpu.UseNvdec()) {
102 fences[0].value = syncpoint_manager.IncreaseSyncpoint(fences[0].id, 1);
103 Tegra::ChCommandHeaderList cmdlist{{(4 << 28) | fences[0].id}};
104 gpu.PushCommandBuffer(cmdlist);
105 }
106 std::memcpy(output.data(), &params, sizeof(IoctlSubmit)); 98 std::memcpy(output.data(), &params, sizeof(IoctlSubmit));
107 // Some games expect command_buffers to be written back 99 // Some games expect command_buffers to be written back
108 offset = sizeof(IoctlSubmit); 100 offset = sizeof(IoctlSubmit);
@@ -110,8 +102,7 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
110 offset += WriteVectors(output, relocs, offset); 102 offset += WriteVectors(output, relocs, offset);
111 offset += WriteVectors(output, reloc_shifts, offset); 103 offset += WriteVectors(output, reloc_shifts, offset);
112 offset += WriteVectors(output, syncpt_increments, offset); 104 offset += WriteVectors(output, syncpt_increments, offset);
113 offset += WriteVectors(output, wait_checks, offset); 105 offset += WriteVectors(output, fence_thresholds, offset);
114 offset += WriteVectors(output, fences, offset);
115 106
116 return NvResult::Success; 107 return NvResult::Success;
117} 108}
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h
index af59f00d2..ae4199b79 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h
@@ -56,19 +56,16 @@ protected:
56 s32 target{}; 56 s32 target{};
57 s32 target_offset{}; 57 s32 target_offset{};
58 }; 58 };
59 static_assert(sizeof(Reloc) == 0x10, "CommandBuffer has incorrect size"); 59 static_assert(sizeof(Reloc) == 0x10, "Reloc has incorrect size");
60 60
61 struct SyncptIncr { 61 struct SyncptIncr {
62 u32 id{}; 62 u32 id{};
63 u32 increments{}; 63 u32 increments{};
64 u32 unk0{};
65 u32 unk1{};
66 u32 unk2{};
64 }; 67 };
65 static_assert(sizeof(SyncptIncr) == 0x8, "CommandBuffer has incorrect size"); 68 static_assert(sizeof(SyncptIncr) == 0x14, "SyncptIncr has incorrect size");
66
67 struct Fence {
68 u32 id{};
69 u32 value{};
70 };
71 static_assert(sizeof(Fence) == 0x8, "CommandBuffer has incorrect size");
72 69
73 struct IoctlGetSyncpoint { 70 struct IoctlGetSyncpoint {
74 // Input 71 // Input
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 @@
13#include "core/hle/service/time/time_manager.h" 13#include "core/hle/service/time/time_manager.h"
14 14
15namespace Service::Time { 15namespace Service::Time {
16 16namespace {
17constexpr Clock::TimeSpanType standard_network_clock_accuracy{0x0009356907420000ULL}; 17constexpr Clock::TimeSpanType standard_network_clock_accuracy{0x0009356907420000ULL};
18 18
19static std::chrono::seconds GetSecondsSinceEpoch() { 19s64 GetSecondsSinceEpoch() {
20 return std::chrono::duration_cast<std::chrono::seconds>( 20 const auto time_since_epoch = std::chrono::system_clock::now().time_since_epoch();
21 std::chrono::system_clock::now().time_since_epoch()) + 21 return std::chrono::duration_cast<std::chrono::seconds>(time_since_epoch).count() +
22 Settings::values.custom_rtc_differential; 22 Settings::values.custom_rtc_differential;
23} 23}
24 24
25static s64 GetExternalRtcValue() { 25s64 GetExternalRtcValue() {
26 return GetSecondsSinceEpoch().count() + TimeManager::GetExternalTimeZoneOffset(); 26 return GetSecondsSinceEpoch() + TimeManager::GetExternalTimeZoneOffset();
27} 27}
28} // Anonymous namespace
28 29
29struct TimeManager::Impl final { 30struct TimeManager::Impl final {
30 explicit Impl(Core::System& system) 31 explicit Impl(Core::System& system)
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp
index 9b0aec797..b9512aa2e 100644
--- a/src/input_common/udp/client.cpp
+++ b/src/input_common/udp/client.cpp
@@ -471,46 +471,42 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
471 std::function<void(u16, u16, u16, u16)> data_callback) { 471 std::function<void(u16, u16, u16, u16)> data_callback) {
472 472
473 std::thread([=, this] { 473 std::thread([=, this] {
474 constexpr u16 CALIBRATION_THRESHOLD = 100;
475
476 u16 min_x{UINT16_MAX};
477 u16 min_y{UINT16_MAX};
478 u16 max_x{};
479 u16 max_y{};
480
481 Status current_status{Status::Initialized}; 474 Status current_status{Status::Initialized};
482 SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {}, 475 SocketCallback callback{
483 [&](Response::PadData data) { 476 [](Response::Version) {}, [](Response::PortInfo) {},
484 if (current_status == Status::Initialized) { 477 [&](Response::PadData data) {
485 // Receiving data means the communication is ready now 478 static constexpr u16 CALIBRATION_THRESHOLD = 100;
486 current_status = Status::Ready; 479 static constexpr u16 MAX_VALUE = UINT16_MAX;
487 status_callback(current_status); 480
488 } 481 if (current_status == Status::Initialized) {
489 if (data.touch[0].is_active == 0) { 482 // Receiving data means the communication is ready now
490 return; 483 current_status = Status::Ready;
491 } 484 status_callback(current_status);
492 LOG_DEBUG(Input, "Current touch: {} {}", data.touch[0].x, 485 }
493 data.touch[0].y); 486 const auto& touchpad_0 = data.touch[0];
494 min_x = std::min(min_x, static_cast<u16>(data.touch[0].x)); 487 if (touchpad_0.is_active == 0) {
495 min_y = std::min(min_y, static_cast<u16>(data.touch[0].y)); 488 return;
496 if (current_status == Status::Ready) { 489 }
497 // First touch - min data (min_x/min_y) 490 LOG_DEBUG(Input, "Current touch: {} {}", touchpad_0.x, touchpad_0.y);
498 current_status = Status::Stage1Completed; 491 const u16 min_x = std::min(MAX_VALUE, static_cast<u16>(touchpad_0.x));
499 status_callback(current_status); 492 const u16 min_y = std::min(MAX_VALUE, static_cast<u16>(touchpad_0.y));
500 } 493 if (current_status == Status::Ready) {
501 if (data.touch[0].x - min_x > CALIBRATION_THRESHOLD && 494 // First touch - min data (min_x/min_y)
502 data.touch[0].y - min_y > CALIBRATION_THRESHOLD) { 495 current_status = Status::Stage1Completed;
503 // Set the current position as max value and finishes 496 status_callback(current_status);
504 // configuration 497 }
505 max_x = data.touch[0].x; 498 if (touchpad_0.x - min_x > CALIBRATION_THRESHOLD &&
506 max_y = data.touch[0].y; 499 touchpad_0.y - min_y > CALIBRATION_THRESHOLD) {
507 current_status = Status::Completed; 500 // Set the current position as max value and finishes configuration
508 data_callback(min_x, min_y, max_x, max_y); 501 const u16 max_x = touchpad_0.x;
509 status_callback(current_status); 502 const u16 max_y = touchpad_0.y;
510 503 current_status = Status::Completed;
511 complete_event.Set(); 504 data_callback(min_x, min_y, max_x, max_y);
512 } 505 status_callback(current_status);
513 }}; 506
507 complete_event.Set();
508 }
509 }};
514 Socket socket{host, port, std::move(callback)}; 510 Socket socket{host, port, std::move(callback)};
515 std::thread worker_thread{SocketLoop, &socket}; 511 std::thread worker_thread{SocketLoop, &socket};
516 complete_event.Wait(); 512 complete_event.Wait();
diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp
index 44ad10d43..96c997a58 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) {
492 const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)}; 492 const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)};
493 IR::IREmitter ir{*texture_inst.block, insert_point}; 493 IR::IREmitter ir{*texture_inst.block, insert_point};
494 const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))}; 494 const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))};
495 inst->SetArg(0, ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift)); 495 inst->SetArg(0, ir.UMin(ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift),
496 ir.Imm32(DESCRIPTOR_SIZE - 1)));
496 } else { 497 } else {
497 inst->SetArg(0, IR::Value{}); 498 inst->SetArg(0, IR::Value{});
498 } 499 }
diff --git a/src/video_core/dirty_flags.h b/src/video_core/dirty_flags.h
index 504465d3f..f0d545f90 100644
--- a/src/video_core/dirty_flags.h
+++ b/src/video_core/dirty_flags.h
@@ -38,6 +38,9 @@ enum : u8 {
38 38
39 Shaders, 39 Shaders,
40 40
41 // Special entries
42 DepthBiasGlobal,
43
41 LastCommonEntry, 44 LastCommonEntry,
42}; 45};
43 46
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:
258 258
259 void AsyncFlushQuery(VAddr addr) { 259 void AsyncFlushQuery(VAddr addr) {
260 if (!uncommitted_flushes) { 260 if (!uncommitted_flushes) {
261 uncommitted_flushes = std::make_shared<std::unordered_set<VAddr>>(); 261 uncommitted_flushes = std::make_shared<std::vector<VAddr>>();
262 } 262 }
263 uncommitted_flushes->insert(addr); 263 uncommitted_flushes->push_back(addr);
264 } 264 }
265 265
266 static constexpr std::uintptr_t PAGE_SIZE = 4096; 266 static constexpr std::uintptr_t PAGE_SIZE = 4096;
@@ -276,8 +276,8 @@ private:
276 276
277 std::array<CounterStream, VideoCore::NumQueryTypes> streams; 277 std::array<CounterStream, VideoCore::NumQueryTypes> streams;
278 278
279 std::shared_ptr<std::unordered_set<VAddr>> uncommitted_flushes{}; 279 std::shared_ptr<std::vector<VAddr>> uncommitted_flushes{};
280 std::list<std::shared_ptr<std::unordered_set<VAddr>>> committed_flushes; 280 std::list<std::shared_ptr<std::vector<VAddr>>> committed_flushes;
281}; 281};
282 282
283template <class QueryCache, class HostCounter> 283template <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:
42 }; 42 };
43 static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!"); 43 static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!");
44 44
45 std::array<CacheEntry, 0x1000000> cached_pages; 45 std::array<CacheEntry, 0x2000000> cached_pages;
46 Core::Memory::Memory& cpu_memory; 46 Core::Memory::Memory& cpu_memory;
47}; 47};
48 48
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 @@
10#include <limits> 10#include <limits>
11#include <optional> 11#include <optional>
12#include <span> 12#include <span>
13#include <stdexcept>
13#include <vector> 14#include <vector>
14 15
15#include <glad/glad.h> 16#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:
21 21
22 /// Returns the current logical tick. 22 /// Returns the current logical tick.
23 [[nodiscard]] u64 CurrentTick() const noexcept { 23 [[nodiscard]] u64 CurrentTick() const noexcept {
24 return current_tick.load(std::memory_order_relaxed); 24 return current_tick.load(std::memory_order_acquire);
25 } 25 }
26 26
27 /// Returns the last known GPU tick. 27 /// Returns the last known GPU tick.
28 [[nodiscard]] u64 KnownGpuTick() const noexcept { 28 [[nodiscard]] u64 KnownGpuTick() const noexcept {
29 return gpu_tick.load(std::memory_order_relaxed); 29 return gpu_tick.load(std::memory_order_acquire);
30 } 30 }
31 31
32 /// Returns the timeline semaphore handle. 32 /// Returns the timeline semaphore handle.
@@ -41,12 +41,21 @@ public:
41 41
42 /// Advance to the logical tick and return the old one 42 /// Advance to the logical tick and return the old one
43 [[nodiscard]] u64 NextTick() noexcept { 43 [[nodiscard]] u64 NextTick() noexcept {
44 return current_tick.fetch_add(1, std::memory_order::relaxed); 44 return current_tick.fetch_add(1, std::memory_order_release);
45 } 45 }
46 46
47 /// Refresh the known GPU tick 47 /// Refresh the known GPU tick
48 void Refresh() { 48 void Refresh() {
49 gpu_tick.store(semaphore.GetCounter(), std::memory_order_relaxed); 49 u64 this_tick{};
50 u64 counter{};
51 do {
52 this_tick = gpu_tick.load(std::memory_order_acquire);
53 counter = semaphore.GetCounter();
54 if (counter < this_tick) {
55 return;
56 }
57 } while (!gpu_tick.compare_exchange_weak(this_tick, counter, std::memory_order_release,
58 std::memory_order_relaxed));
50 } 59 }
51 60
52 /// Waits for a tick to be hit on the GPU 61 /// 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 {
117 cache.GetScheduler().Wait(tick); 117 cache.GetScheduler().Wait(tick);
118 u64 data; 118 u64 data;
119 const VkResult query_result = cache.GetDevice().GetLogical().GetQueryResults( 119 const VkResult query_result = cache.GetDevice().GetLogical().GetQueryResults(
120 query.first, query.second, 1, sizeof(data), &data, sizeof(data), VK_QUERY_RESULT_64_BIT); 120 query.first, query.second, 1, sizeof(data), &data, sizeof(data),
121 VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
121 122
122 switch (query_result) { 123 switch (query_result) {
123 case VK_SUCCESS: 124 case VK_SUCCESS:
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 3bcd6d6cc..30b47a7a0 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -627,9 +627,21 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) {
627 if (!state_tracker.TouchDepthBias()) { 627 if (!state_tracker.TouchDepthBias()) {
628 return; 628 return;
629 } 629 }
630 scheduler.Record([constant = regs.polygon_offset_units, clamp = regs.polygon_offset_clamp, 630 float units = regs.polygon_offset_units / 2.0f;
631 const bool is_d24 = regs.zeta.format == Tegra::DepthFormat::S8_UINT_Z24_UNORM ||
632 regs.zeta.format == Tegra::DepthFormat::D24X8_UNORM ||
633 regs.zeta.format == Tegra::DepthFormat::D24S8_UNORM ||
634 regs.zeta.format == Tegra::DepthFormat::D24C8_UNORM;
635 if (is_d24 && !device.SupportsD24DepthBuffer()) {
636 // the base formulas can be obtained from here:
637 // https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias
638 const double rescale_factor =
639 static_cast<double>(1ULL << (32 - 24)) / (static_cast<double>(0x1.ep+127));
640 units = static_cast<float>(static_cast<double>(units) * rescale_factor);
641 }
642 scheduler.Record([constant = units, clamp = regs.polygon_offset_clamp,
631 factor = regs.polygon_offset_factor](vk::CommandBuffer cmdbuf) { 643 factor = regs.polygon_offset_factor](vk::CommandBuffer cmdbuf) {
632 cmdbuf.SetDepthBias(constant, clamp, factor / 2.0f); 644 cmdbuf.SetDepthBias(constant, clamp, factor);
633 }); 645 });
634} 646}
635 647
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
index e3b7dd61c..c00913f55 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
@@ -54,6 +54,7 @@ void SetupDirtyViewports(Tables& tables) {
54 FillBlock(tables[0], OFF(viewport_transform), NUM(viewport_transform), Viewports); 54 FillBlock(tables[0], OFF(viewport_transform), NUM(viewport_transform), Viewports);
55 FillBlock(tables[0], OFF(viewports), NUM(viewports), Viewports); 55 FillBlock(tables[0], OFF(viewports), NUM(viewports), Viewports);
56 tables[0][OFF(viewport_transform_enabled)] = Viewports; 56 tables[0][OFF(viewport_transform_enabled)] = Viewports;
57 tables[1][OFF(screen_y_control)] = Viewports;
57} 58}
58 59
59void SetupDirtyScissors(Tables& tables) { 60void SetupDirtyScissors(Tables& tables) {
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.h b/src/video_core/renderer_vulkan/vk_state_tracker.h
index d90935f52..2f2d6b31f 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.h
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.h
@@ -79,7 +79,8 @@ public:
79 } 79 }
80 80
81 bool TouchDepthBias() { 81 bool TouchDepthBias() {
82 return Exchange(Dirty::DepthBias, false); 82 return Exchange(Dirty::DepthBias, false) ||
83 Exchange(VideoCommon::Dirty::DepthBiasGlobal, false);
83 } 84 }
84 85
85 bool TouchBlendConstants() { 86 bool TouchBlendConstants() {
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 329df2e49..f70c1f764 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -221,6 +221,7 @@ void TextureCache<P>::UpdateRenderTargets(bool is_clear) {
221 BindRenderTarget(&render_targets.depth_buffer_id, FindDepthBuffer(is_clear)); 221 BindRenderTarget(&render_targets.depth_buffer_id, FindDepthBuffer(is_clear));
222 } 222 }
223 const ImageViewId depth_buffer_id = render_targets.depth_buffer_id; 223 const ImageViewId depth_buffer_id = render_targets.depth_buffer_id;
224
224 PrepareImageView(depth_buffer_id, true, is_clear && IsFullClear(depth_buffer_id)); 225 PrepareImageView(depth_buffer_id, true, is_clear && IsFullClear(depth_buffer_id));
225 226
226 for (size_t index = 0; index < NUM_RT; ++index) { 227 for (size_t index = 0; index < NUM_RT; ++index) {
@@ -230,6 +231,8 @@ void TextureCache<P>::UpdateRenderTargets(bool is_clear) {
230 maxwell3d.regs.render_area.width, 231 maxwell3d.regs.render_area.width,
231 maxwell3d.regs.render_area.height, 232 maxwell3d.regs.render_area.height,
232 }; 233 };
234
235 flags[Dirty::DepthBiasGlobal] = true;
233} 236}
234 237
235template <class P> 238template <class P>
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 6388ed2eb..0f807990c 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -623,6 +623,10 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
623 is_float16_supported = false; 623 is_float16_supported = false;
624 } 624 }
625 625
626 supports_d24_depth =
627 IsFormatSupported(VK_FORMAT_D24_UNORM_S8_UINT,
628 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT, FormatType::Optimal);
629
626 graphics_queue = logical.GetQueue(graphics_family); 630 graphics_queue = logical.GetQueue(graphics_family);
627 present_queue = logical.GetQueue(present_family); 631 present_queue = logical.GetQueue(present_family);
628} 632}
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h
index d9e74f1aa..2d5daf6cd 100644
--- a/src/video_core/vulkan_common/vulkan_device.h
+++ b/src/video_core/vulkan_common/vulkan_device.h
@@ -332,6 +332,10 @@ public:
332 return sets_per_pool; 332 return sets_per_pool;
333 } 333 }
334 334
335 bool SupportsD24DepthBuffer() const {
336 return supports_d24_depth;
337 }
338
335private: 339private:
336 /// Checks if the physical device is suitable. 340 /// Checks if the physical device is suitable.
337 void CheckSuitability(bool requires_swapchain) const; 341 void CheckSuitability(bool requires_swapchain) const;
@@ -425,6 +429,7 @@ private:
425 bool has_broken_cube_compatibility{}; ///< Has broken cube compatiblity bit 429 bool has_broken_cube_compatibility{}; ///< Has broken cube compatiblity bit
426 bool has_renderdoc{}; ///< Has RenderDoc attached 430 bool has_renderdoc{}; ///< Has RenderDoc attached
427 bool has_nsight_graphics{}; ///< Has Nsight Graphics attached 431 bool has_nsight_graphics{}; ///< Has Nsight Graphics attached
432 bool supports_d24_depth{}; ///< Supports D24 depth buffers.
428 433
429 // Telemetry parameters 434 // Telemetry parameters
430 std::string vendor_name; ///< Device's driver name. 435 std::string vendor_name; ///< Device's driver name.
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() {
918 const auto custom_rtc_enabled = 918 const auto custom_rtc_enabled =
919 ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool(); 919 ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool();
920 if (custom_rtc_enabled) { 920 if (custom_rtc_enabled) {
921 Settings::values.custom_rtc = 921 Settings::values.custom_rtc = ReadSetting(QStringLiteral("custom_rtc"), 0).toLongLong();
922 std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong());
923 } else { 922 } else {
924 Settings::values.custom_rtc = std::nullopt; 923 Settings::values.custom_rtc = std::nullopt;
925 } 924 }
@@ -1450,9 +1449,7 @@ void Config::SaveSystemValues() {
1450 WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(), 1449 WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(),
1451 false); 1450 false);
1452 WriteSetting(QStringLiteral("custom_rtc"), 1451 WriteSetting(QStringLiteral("custom_rtc"),
1453 QVariant::fromValue<long long>( 1452 QVariant::fromValue<long long>(Settings::values.custom_rtc.value_or(0)), 0);
1454 Settings::values.custom_rtc.value_or(std::chrono::seconds{}).count()),
1455 0);
1456 } 1453 }
1457 1454
1458 WriteGlobalSetting(Settings::values.sound_index); 1455 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() {
65 QStringLiteral("%1") 65 QStringLiteral("%1")
66 .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) 66 .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'})
67 .toUpper(); 67 .toUpper();
68 const auto rtc_time = Settings::values.custom_rtc.value_or( 68 const auto rtc_time = Settings::values.custom_rtc.value_or(QDateTime::currentSecsSinceEpoch());
69 std::chrono::seconds(QDateTime::currentSecsSinceEpoch()));
70 69
71 ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); 70 ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value());
72 ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() && 71 ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() &&
@@ -75,7 +74,7 @@ void ConfigureSystem::SetConfiguration() {
75 74
76 ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value()); 75 ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value());
77 ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value()); 76 ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value());
78 ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); 77 ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time));
79 78
80 if (Settings::IsConfiguringGlobal()) { 79 if (Settings::IsConfiguringGlobal()) {
81 ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue()); 80 ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue());
@@ -108,10 +107,9 @@ void ConfigureSystem::ApplyConfiguration() {
108 // to allow in-game time to be fast forwarded 107 // to allow in-game time to be fast forwarded
109 if (Settings::IsConfiguringGlobal()) { 108 if (Settings::IsConfiguringGlobal()) {
110 if (ui->custom_rtc_checkbox->isChecked()) { 109 if (ui->custom_rtc_checkbox->isChecked()) {
111 Settings::values.custom_rtc = 110 Settings::values.custom_rtc = ui->custom_rtc_edit->dateTime().toSecsSinceEpoch();
112 std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch());
113 if (system.IsPoweredOn()) { 111 if (system.IsPoweredOn()) {
114 const s64 posix_time{Settings::values.custom_rtc->count() + 112 const s64 posix_time{*Settings::values.custom_rtc +
115 Service::Time::TimeManager::GetExternalTimeZoneOffset()}; 113 Service::Time::TimeManager::GetExternalTimeZoneOffset()};
116 system.GetTimeManager().UpdateLocalSystemClockTime(posix_time); 114 system.GetTimeManager().UpdateLocalSystemClockTime(posix_time);
117 } 115 }
diff --git a/src/yuzu/configuration/configure_tas.ui b/src/yuzu/configuration/configure_tas.ui
index 6caa19031..7d44895c4 100644
--- a/src/yuzu/configuration/configure_tas.ui
+++ b/src/yuzu/configuration/configure_tas.ui
@@ -14,14 +14,14 @@
14 <item row="0" column="0" colspan="4"> 14 <item row="0" column="0" colspan="4">
15 <widget class="QLabel" name="label_1"> 15 <widget class="QLabel" name="label_1">
16 <property name="text"> 16 <property name="text">
17 <string>Reads controller input from scripts in the same format as TAS-nx scripts.&lt;br/&gt;For a more detailed explanation please consult the FAQ on the yuzu website.</string> 17 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reads controller input from scripts in the same format as TAS-nx scripts.&lt;br/&gt;For a more detailed explanation, please consult the &lt;a href=&quot;https://yuzu-emu.org/help/feature/tas/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;help page&lt;/span&gt;&lt;/a&gt; on the yuzu website.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
18 </property> 18 </property>
19 </widget> 19 </widget>
20 </item> 20 </item>
21 <item row="1" column="0" colspan="4"> 21 <item row="1" column="0" colspan="4">
22 <widget class="QLabel" name="label_2"> 22 <widget class="QLabel" name="label_2">
23 <property name="text"> 23 <property name="text">
24 <string>To check which hotkeys control the playback/recording, please refer to the Hotkey settings (General -&gt; Hotkeys).</string> 24 <string>To check which hotkeys control the playback/recording, please refer to the Hotkey settings (Configure -&gt; General -&gt; Hotkeys).</string>
25 </property> 25 </property>
26 <property name="wordWrap"> 26 <property name="wordWrap">
27 <bool>true</bool> 27 <bool>true</bool>
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) {
1666 const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)}; 1666 const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)};
1667 if (!Common::FS::CreateDirs(shader_cache_folder_path)) { 1667 if (!Common::FS::CreateDirs(shader_cache_folder_path)) {
1668 QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"), 1668 QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"),
1669 tr("Filed to create the shader cache directory for this title.")); 1669 tr("Failed to create the shader cache directory for this title."));
1670 return; 1670 return;
1671 } 1671 }
1672 const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)}; 1672 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() {
412 412
413 const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false); 413 const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false);
414 if (custom_rtc_enabled) { 414 if (custom_rtc_enabled) {
415 Settings::values.custom_rtc = 415 Settings::values.custom_rtc = sdl2_config->GetInteger("System", "custom_rtc", 0);
416 std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0));
417 } else { 416 } else {
418 Settings::values.custom_rtc = std::nullopt; 417 Settings::values.custom_rtc = std::nullopt;
419 } 418 }