summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------externals/dynarmic0
-rw-r--r--src/core/CMakeLists.txt26
-rw-r--r--src/core/core_timing.cpp53
-rw-r--r--src/core/core_timing.h53
-rw-r--r--src/core/core_timing_util.cpp63
-rw-r--r--src/core/core_timing_util.h64
-rw-r--r--src/core/hle/ipc_helpers.h8
-rw-r--r--src/core/hle/kernel/svc.cpp11
-rw-r--r--src/core/hle/kernel/thread.cpp1
-rw-r--r--src/core/hle/kernel/timer.cpp1
-rw-r--r--src/core/hle/service/audio/audout_u.cpp1
-rw-r--r--src/core/hle/service/audio/audren_u.cpp1
-rw-r--r--src/core/hle/service/friend/friend.cpp10
-rw-r--r--src/core/hle/service/friend/friend_u.cpp18
-rw-r--r--src/core/hle/service/friend/friend_u.h16
-rw-r--r--src/core/hle/service/friend/interface.cpp (renamed from src/core/hle/service/friend/friend_a.cpp)9
-rw-r--r--src/core/hle/service/friend/interface.h (renamed from src/core/hle/service/friend/friend_a.h)4
-rw-r--r--src/core/hle/service/hid/hid.cpp1
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp1
-rw-r--r--src/core/hle/service/set/set_sys.cpp19
-rw-r--r--src/core/hle/service/set/set_sys.h11
-rw-r--r--src/core/hle/service/time/time.cpp1
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp29
-rw-r--r--src/video_core/engines/maxwell_3d.cpp8
-rw-r--r--src/video_core/gpu.h2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp19
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h10
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h46
-rw-r--r--src/video_core/textures/decoders.cpp6
-rw-r--r--src/yuzu/debugger/wait_tree.cpp3
31 files changed, 277 insertions, 230 deletions
diff --git a/externals/dynarmic b/externals/dynarmic
Subproject fc6b73bd855d0b87b6d78ba859732a4616e5a85 Subproject 98e23801297167db1fd266696484a49096e734c
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 6b6efbc00..4f6c45085 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -10,6 +10,8 @@ add_library(core STATIC
10 core_cpu.h 10 core_cpu.h
11 core_timing.cpp 11 core_timing.cpp
12 core_timing.h 12 core_timing.h
13 core_timing_util.cpp
14 core_timing_util.h
13 file_sys/content_archive.cpp 15 file_sys/content_archive.cpp
14 file_sys/content_archive.h 16 file_sys/content_archive.h
15 file_sys/control_metadata.cpp 17 file_sys/control_metadata.cpp
@@ -114,26 +116,26 @@ add_library(core STATIC
114 hle/service/apm/apm.h 116 hle/service/apm/apm.h
115 hle/service/apm/interface.cpp 117 hle/service/apm/interface.cpp
116 hle/service/apm/interface.h 118 hle/service/apm/interface.h
117 hle/service/audio/audio.cpp
118 hle/service/audio/audio.h
119 hle/service/audio/audin_u.cpp 119 hle/service/audio/audin_u.cpp
120 hle/service/audio/audin_u.h 120 hle/service/audio/audin_u.h
121 hle/service/audio/audio.cpp
122 hle/service/audio/audio.h
121 hle/service/audio/audout_u.cpp 123 hle/service/audio/audout_u.cpp
122 hle/service/audio/audout_u.h 124 hle/service/audio/audout_u.h
123 hle/service/audio/audrec_u.cpp 125 hle/service/audio/audrec_u.cpp
124 hle/service/audio/audrec_u.h 126 hle/service/audio/audrec_u.h
125 hle/service/audio/audren_u.cpp 127 hle/service/audio/audren_u.cpp
126 hle/service/audio/audren_u.h
127 hle/service/audio/audren_u.cpp 128 hle/service/audio/audren_u.cpp
128 hle/service/audio/audren_u.h 129 hle/service/audio/audren_u.h
130 hle/service/audio/audren_u.h
129 hle/service/audio/codecctl.cpp 131 hle/service/audio/codecctl.cpp
130 hle/service/audio/codecctl.h 132 hle/service/audio/codecctl.h
131 hle/service/audio/hwopus.cpp 133 hle/service/audio/hwopus.cpp
132 hle/service/audio/hwopus.h 134 hle/service/audio/hwopus.h
133 hle/service/bcat/module.cpp
134 hle/service/bcat/module.h
135 hle/service/bcat/bcat.cpp 135 hle/service/bcat/bcat.cpp
136 hle/service/bcat/bcat.h 136 hle/service/bcat/bcat.h
137 hle/service/bcat/module.cpp
138 hle/service/bcat/module.h
137 hle/service/fatal/fatal.cpp 139 hle/service/fatal/fatal.cpp
138 hle/service/fatal/fatal.h 140 hle/service/fatal/fatal.h
139 hle/service/fatal/fatal_p.cpp 141 hle/service/fatal/fatal_p.cpp
@@ -146,16 +148,18 @@ add_library(core STATIC
146 hle/service/filesystem/fsp_srv.h 148 hle/service/filesystem/fsp_srv.h
147 hle/service/friend/friend.cpp 149 hle/service/friend/friend.cpp
148 hle/service/friend/friend.h 150 hle/service/friend/friend.h
149 hle/service/friend/friend_a.cpp 151 hle/service/friend/interface.cpp
150 hle/service/friend/friend_a.h 152 hle/service/friend/interface.h
151 hle/service/friend/friend_u.cpp
152 hle/service/friend/friend_u.h
153 hle/service/hid/hid.cpp 153 hle/service/hid/hid.cpp
154 hle/service/hid/hid.h 154 hle/service/hid/hid.h
155 hle/service/lm/lm.cpp 155 hle/service/lm/lm.cpp
156 hle/service/lm/lm.h 156 hle/service/lm/lm.h
157 hle/service/mm/mm_u.cpp 157 hle/service/mm/mm_u.cpp
158 hle/service/mm/mm_u.h 158 hle/service/mm/mm_u.h
159 hle/service/nfp/nfp.cpp
160 hle/service/nfp/nfp.h
161 hle/service/nfp/nfp_user.cpp
162 hle/service/nfp/nfp_user.h
159 hle/service/nifm/nifm.cpp 163 hle/service/nifm/nifm.cpp
160 hle/service/nifm/nifm.h 164 hle/service/nifm/nifm.h
161 hle/service/nifm/nifm_a.cpp 165 hle/service/nifm/nifm_a.cpp
@@ -164,10 +168,6 @@ add_library(core STATIC
164 hle/service/nifm/nifm_s.h 168 hle/service/nifm/nifm_s.h
165 hle/service/nifm/nifm_u.cpp 169 hle/service/nifm/nifm_u.cpp
166 hle/service/nifm/nifm_u.h 170 hle/service/nifm/nifm_u.h
167 hle/service/nfp/nfp.cpp
168 hle/service/nfp/nfp.h
169 hle/service/nfp/nfp_user.cpp
170 hle/service/nfp/nfp_user.h
171 hle/service/ns/ns.cpp 171 hle/service/ns/ns.cpp
172 hle/service/ns/ns.h 172 hle/service/ns/ns.h
173 hle/service/ns/pl_u.cpp 173 hle/service/ns/pl_u.cpp
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 50d1e3fc9..a1b6f96f1 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -5,17 +5,15 @@
5#include "core/core_timing.h" 5#include "core/core_timing.h"
6 6
7#include <algorithm> 7#include <algorithm>
8#include <cinttypes>
9#include <limits>
10#include <mutex> 8#include <mutex>
11#include <string> 9#include <string>
12#include <tuple> 10#include <tuple>
13#include <unordered_map> 11#include <unordered_map>
14#include <vector> 12#include <vector>
15#include "common/assert.h" 13#include "common/assert.h"
16#include "common/logging/log.h"
17#include "common/thread.h" 14#include "common/thread.h"
18#include "common/threadsafe_queue.h" 15#include "common/threadsafe_queue.h"
16#include "core/core_timing_util.h"
19 17
20namespace CoreTiming { 18namespace CoreTiming {
21 19
@@ -59,7 +57,6 @@ static u64 event_fifo_id;
59static Common::MPSCQueue<Event, false> ts_queue; 57static Common::MPSCQueue<Event, false> ts_queue;
60 58
61constexpr int MAX_SLICE_LENGTH = 20000; 59constexpr int MAX_SLICE_LENGTH = 20000;
62constexpr u64 MAX_VALUE_TO_MULTIPLY = std::numeric_limits<s64>::max() / BASE_CLOCK_RATE;
63 60
64static s64 idled_cycles; 61static s64 idled_cycles;
65 62
@@ -72,54 +69,6 @@ static EventType* ev_lost = nullptr;
72 69
73static void EmptyTimedCallback(u64 userdata, s64 cyclesLate) {} 70static void EmptyTimedCallback(u64 userdata, s64 cyclesLate) {}
74 71
75s64 usToCycles(s64 us) {
76 if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
77 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
78 return std::numeric_limits<s64>::max();
79 }
80 if (us > MAX_VALUE_TO_MULTIPLY) {
81 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
82 return BASE_CLOCK_RATE * (us / 1000000);
83 }
84 return (BASE_CLOCK_RATE * us) / 1000000;
85}
86
87s64 usToCycles(u64 us) {
88 if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
89 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
90 return std::numeric_limits<s64>::max();
91 }
92 if (us > MAX_VALUE_TO_MULTIPLY) {
93 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
94 return BASE_CLOCK_RATE * static_cast<s64>(us / 1000000);
95 }
96 return (BASE_CLOCK_RATE * static_cast<s64>(us)) / 1000000;
97}
98
99s64 nsToCycles(s64 ns) {
100 if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
101 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
102 return std::numeric_limits<s64>::max();
103 }
104 if (ns > MAX_VALUE_TO_MULTIPLY) {
105 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
106 return BASE_CLOCK_RATE * (ns / 1000000000);
107 }
108 return (BASE_CLOCK_RATE * ns) / 1000000000;
109}
110
111s64 nsToCycles(u64 ns) {
112 if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
113 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
114 return std::numeric_limits<s64>::max();
115 }
116 if (ns > MAX_VALUE_TO_MULTIPLY) {
117 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
118 return BASE_CLOCK_RATE * (static_cast<s64>(ns) / 1000000000);
119 }
120 return (BASE_CLOCK_RATE * static_cast<s64>(ns)) / 1000000000;
121}
122
123EventType* RegisterEvent(const std::string& name, TimedCallback callback) { 72EventType* RegisterEvent(const std::string& name, TimedCallback callback) {
124 // check for existing type with same name. 73 // check for existing type with same name.
125 // we want event type names to remain unique so that we can use them for serialization. 74 // we want event type names to remain unique so that we can use them for serialization.
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index dc31124a8..7fe6380ad 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -23,59 +23,6 @@
23 23
24namespace CoreTiming { 24namespace CoreTiming {
25 25
26// The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz
27// The exact value used is of course unverified.
28constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch clock speed is 1020MHz un/docked
29
30inline s64 msToCycles(int ms) {
31 // since ms is int there is no way to overflow
32 return BASE_CLOCK_RATE * static_cast<s64>(ms) / 1000;
33}
34
35inline s64 msToCycles(float ms) {
36 return static_cast<s64>(BASE_CLOCK_RATE * (0.001f) * ms);
37}
38
39inline s64 msToCycles(double ms) {
40 return static_cast<s64>(BASE_CLOCK_RATE * (0.001) * ms);
41}
42
43inline s64 usToCycles(float us) {
44 return static_cast<s64>(BASE_CLOCK_RATE * (0.000001f) * us);
45}
46
47inline s64 usToCycles(int us) {
48 return (BASE_CLOCK_RATE * static_cast<s64>(us) / 1000000);
49}
50
51s64 usToCycles(s64 us);
52
53s64 usToCycles(u64 us);
54
55inline s64 nsToCycles(float ns) {
56 return static_cast<s64>(BASE_CLOCK_RATE * (0.000000001f) * ns);
57}
58
59inline s64 nsToCycles(int ns) {
60 return BASE_CLOCK_RATE * static_cast<s64>(ns) / 1000000000;
61}
62
63s64 nsToCycles(s64 ns);
64
65s64 nsToCycles(u64 ns);
66
67inline u64 cyclesToNs(s64 cycles) {
68 return cycles * 1000000000 / BASE_CLOCK_RATE;
69}
70
71inline s64 cyclesToUs(s64 cycles) {
72 return cycles * 1000000 / BASE_CLOCK_RATE;
73}
74
75inline u64 cyclesToMs(s64 cycles) {
76 return cycles * 1000 / BASE_CLOCK_RATE;
77}
78
79/** 26/**
80 * CoreTiming begins at the boundary of timing slice -1. An initial call to Advance() is 27 * CoreTiming begins at the boundary of timing slice -1. An initial call to Advance() is
81 * required to end slice -1 and start slice 0 before the first cycle of code is executed. 28 * required to end slice -1 and start slice 0 before the first cycle of code is executed.
diff --git a/src/core/core_timing_util.cpp b/src/core/core_timing_util.cpp
new file mode 100644
index 000000000..73dea4edb
--- /dev/null
+++ b/src/core/core_timing_util.cpp
@@ -0,0 +1,63 @@
1// Copyright 2008 Dolphin Emulator Project / 2017 Citra Emulator Project
2// Licensed under GPLv2+
3// Refer to the license.txt file included.
4
5#include "core/core_timing_util.h"
6
7#include <cinttypes>
8#include <limits>
9#include "common/logging/log.h"
10
11namespace CoreTiming {
12
13constexpr u64 MAX_VALUE_TO_MULTIPLY = std::numeric_limits<s64>::max() / BASE_CLOCK_RATE;
14
15s64 usToCycles(s64 us) {
16 if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
17 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
18 return std::numeric_limits<s64>::max();
19 }
20 if (us > MAX_VALUE_TO_MULTIPLY) {
21 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
22 return BASE_CLOCK_RATE * (us / 1000000);
23 }
24 return (BASE_CLOCK_RATE * us) / 1000000;
25}
26
27s64 usToCycles(u64 us) {
28 if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
29 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
30 return std::numeric_limits<s64>::max();
31 }
32 if (us > MAX_VALUE_TO_MULTIPLY) {
33 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
34 return BASE_CLOCK_RATE * static_cast<s64>(us / 1000000);
35 }
36 return (BASE_CLOCK_RATE * static_cast<s64>(us)) / 1000000;
37}
38
39s64 nsToCycles(s64 ns) {
40 if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
41 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
42 return std::numeric_limits<s64>::max();
43 }
44 if (ns > MAX_VALUE_TO_MULTIPLY) {
45 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
46 return BASE_CLOCK_RATE * (ns / 1000000000);
47 }
48 return (BASE_CLOCK_RATE * ns) / 1000000000;
49}
50
51s64 nsToCycles(u64 ns) {
52 if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
53 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
54 return std::numeric_limits<s64>::max();
55 }
56 if (ns > MAX_VALUE_TO_MULTIPLY) {
57 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
58 return BASE_CLOCK_RATE * (static_cast<s64>(ns) / 1000000000);
59 }
60 return (BASE_CLOCK_RATE * static_cast<s64>(ns)) / 1000000000;
61}
62
63} // namespace CoreTiming
diff --git a/src/core/core_timing_util.h b/src/core/core_timing_util.h
new file mode 100644
index 000000000..5c3718782
--- /dev/null
+++ b/src/core/core_timing_util.h
@@ -0,0 +1,64 @@
1// Copyright 2008 Dolphin Emulator Project / 2017 Citra Emulator Project
2// Licensed under GPLv2+
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8
9namespace CoreTiming {
10
11// The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz
12// The exact value used is of course unverified.
13constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch clock speed is 1020MHz un/docked
14
15inline s64 msToCycles(int ms) {
16 // since ms is int there is no way to overflow
17 return BASE_CLOCK_RATE * static_cast<s64>(ms) / 1000;
18}
19
20inline s64 msToCycles(float ms) {
21 return static_cast<s64>(BASE_CLOCK_RATE * (0.001f) * ms);
22}
23
24inline s64 msToCycles(double ms) {
25 return static_cast<s64>(BASE_CLOCK_RATE * (0.001) * ms);
26}
27
28inline s64 usToCycles(float us) {
29 return static_cast<s64>(BASE_CLOCK_RATE * (0.000001f) * us);
30}
31
32inline s64 usToCycles(int us) {
33 return (BASE_CLOCK_RATE * static_cast<s64>(us) / 1000000);
34}
35
36s64 usToCycles(s64 us);
37
38s64 usToCycles(u64 us);
39
40inline s64 nsToCycles(float ns) {
41 return static_cast<s64>(BASE_CLOCK_RATE * (0.000000001f) * ns);
42}
43
44inline s64 nsToCycles(int ns) {
45 return BASE_CLOCK_RATE * static_cast<s64>(ns) / 1000000000;
46}
47
48s64 nsToCycles(s64 ns);
49
50s64 nsToCycles(u64 ns);
51
52inline u64 cyclesToNs(s64 cycles) {
53 return cycles * 1000000000 / BASE_CLOCK_RATE;
54}
55
56inline s64 cyclesToUs(s64 cycles) {
57 return cycles * 1000000 / BASE_CLOCK_RATE;
58}
59
60inline u64 cyclesToMs(s64 cycles) {
61 return cycles * 1000 / BASE_CLOCK_RATE;
62}
63
64} // namespace CoreTiming
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index f5bd27a75..7fb0da408 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -300,6 +300,14 @@ public:
300 template <typename First, typename... Other> 300 template <typename First, typename... Other>
301 void Pop(First& first_value, Other&... other_values); 301 void Pop(First& first_value, Other&... other_values);
302 302
303 template <typename T>
304 T PopEnum() {
305 static_assert(std::is_enum_v<T>, "T must be an enum type within a PopEnum call.");
306 static_assert(!std::is_convertible_v<T, int>,
307 "enum type in PopEnum must be a strongly typed enum.");
308 return static_cast<T>(Pop<std::underlying_type_t<T>>());
309 }
310
303 /** 311 /**
304 * @brief Reads the next normal parameters as a struct, by copying it 312 * @brief Reads the next normal parameters as a struct, by copying it
305 * @note: The output class must be correctly packed/padded to fit hardware layout. 313 * @note: The output class must be correctly packed/padded to fit hardware layout.
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 3e236cfd5..0b439401a 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -167,11 +167,14 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64
167 using ObjectPtr = SharedPtr<WaitObject>; 167 using ObjectPtr = SharedPtr<WaitObject>;
168 std::vector<ObjectPtr> objects(handle_count); 168 std::vector<ObjectPtr> objects(handle_count);
169 169
170 for (int i = 0; i < handle_count; ++i) { 170 for (u64 i = 0; i < handle_count; ++i) {
171 Handle handle = Memory::Read32(handles_address + i * sizeof(Handle)); 171 const Handle handle = Memory::Read32(handles_address + i * sizeof(Handle));
172 auto object = g_handle_table.Get<WaitObject>(handle); 172 const auto object = g_handle_table.Get<WaitObject>(handle);
173 if (object == nullptr) 173
174 if (object == nullptr) {
174 return ERR_INVALID_HANDLE; 175 return ERR_INVALID_HANDLE;
176 }
177
175 objects[i] = object; 178 objects[i] = object;
176 } 179 }
177 180
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index cd85c4b7c..94735c86e 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -14,6 +14,7 @@
14#include "core/arm/arm_interface.h" 14#include "core/arm/arm_interface.h"
15#include "core/core.h" 15#include "core/core.h"
16#include "core/core_timing.h" 16#include "core/core_timing.h"
17#include "core/core_timing_util.h"
17#include "core/hle/kernel/errors.h" 18#include "core/hle/kernel/errors.h"
18#include "core/hle/kernel/handle_table.h" 19#include "core/hle/kernel/handle_table.h"
19#include "core/hle/kernel/kernel.h" 20#include "core/hle/kernel/kernel.h"
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp
index 0141125e4..904a3d0a5 100644
--- a/src/core/hle/kernel/timer.cpp
+++ b/src/core/hle/kernel/timer.cpp
@@ -6,6 +6,7 @@
6#include "common/assert.h" 6#include "common/assert.h"
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/core_timing.h" 8#include "core/core_timing.h"
9#include "core/core_timing_util.h"
9#include "core/hle/kernel/handle_table.h" 10#include "core/hle/kernel/handle_table.h"
10#include "core/hle/kernel/kernel.h" 11#include "core/hle/kernel/kernel.h"
11#include "core/hle/kernel/thread.h" 12#include "core/hle/kernel/thread.h"
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 154bc12da..1dcd84d98 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -6,6 +6,7 @@
6#include <vector> 6#include <vector>
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/core_timing.h" 8#include "core/core_timing.h"
9#include "core/core_timing_util.h"
9#include "core/hle/ipc_helpers.h" 10#include "core/hle/ipc_helpers.h"
10#include "core/hle/kernel/event.h" 11#include "core/hle/kernel/event.h"
11#include "core/hle/kernel/hle_ipc.h" 12#include "core/hle/kernel/hle_ipc.h"
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index e623f4f8e..6aed9e2fa 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -7,6 +7,7 @@
7#include "common/alignment.h" 7#include "common/alignment.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/core_timing.h" 9#include "core/core_timing.h"
10#include "core/core_timing_util.h"
10#include "core/hle/ipc_helpers.h" 11#include "core/hle/ipc_helpers.h"
11#include "core/hle/kernel/event.h" 12#include "core/hle/kernel/event.h"
12#include "core/hle/kernel/hle_ipc.h" 13#include "core/hle/kernel/hle_ipc.h"
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index c98a46e05..fb4d89068 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -5,8 +5,7 @@
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/ipc_helpers.h"
7#include "core/hle/service/friend/friend.h" 7#include "core/hle/service/friend/friend.h"
8#include "core/hle/service/friend/friend_a.h" 8#include "core/hle/service/friend/interface.h"
9#include "core/hle/service/friend/friend_u.h"
10 9
11namespace Service::Friend { 10namespace Service::Friend {
12 11
@@ -21,8 +20,11 @@ Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
21 20
22void InstallInterfaces(SM::ServiceManager& service_manager) { 21void InstallInterfaces(SM::ServiceManager& service_manager) {
23 auto module = std::make_shared<Module>(); 22 auto module = std::make_shared<Module>();
24 std::make_shared<Friend_A>(module)->InstallAsService(service_manager); 23 std::make_shared<Friend>(module, "friend:a")->InstallAsService(service_manager);
25 std::make_shared<Friend_U>(module)->InstallAsService(service_manager); 24 std::make_shared<Friend>(module, "friend:m")->InstallAsService(service_manager);
25 std::make_shared<Friend>(module, "friend:s")->InstallAsService(service_manager);
26 std::make_shared<Friend>(module, "friend:u")->InstallAsService(service_manager);
27 std::make_shared<Friend>(module, "friend:v")->InstallAsService(service_manager);
26} 28}
27 29
28} // namespace Service::Friend 30} // namespace Service::Friend
diff --git a/src/core/hle/service/friend/friend_u.cpp b/src/core/hle/service/friend/friend_u.cpp
deleted file mode 100644
index 90b30883f..000000000
--- a/src/core/hle/service/friend/friend_u.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/friend/friend_u.h"
6
7namespace Service::Friend {
8
9Friend_U::Friend_U(std::shared_ptr<Module> module)
10 : Module::Interface(std::move(module), "friend:u") {
11 static const FunctionInfo functions[] = {
12 {0, &Friend_U::CreateFriendService, "CreateFriendService"},
13 {1, nullptr, "CreateNotificationService"},
14 };
15 RegisterHandlers(functions);
16}
17
18} // namespace Service::Friend
diff --git a/src/core/hle/service/friend/friend_u.h b/src/core/hle/service/friend/friend_u.h
deleted file mode 100644
index 0d953d807..000000000
--- a/src/core/hle/service/friend/friend_u.h
+++ /dev/null
@@ -1,16 +0,0 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/friend/friend.h"
8
9namespace Service::Friend {
10
11class Friend_U final : public Module::Interface {
12public:
13 explicit Friend_U(std::shared_ptr<Module> module);
14};
15
16} // namespace Service::Friend
diff --git a/src/core/hle/service/friend/friend_a.cpp b/src/core/hle/service/friend/interface.cpp
index a2cc81926..27c6a09e2 100644
--- a/src/core/hle/service/friend/friend_a.cpp
+++ b/src/core/hle/service/friend/interface.cpp
@@ -2,15 +2,16 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "core/hle/service/friend/friend_a.h" 5#include "core/hle/service/friend/interface.h"
6 6
7namespace Service::Friend { 7namespace Service::Friend {
8 8
9Friend_A::Friend_A(std::shared_ptr<Module> module) 9Friend::Friend(std::shared_ptr<Module> module, const char* name)
10 : Module::Interface(std::move(module), "friend:a") { 10 : Interface(std::move(module), name) {
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, &Friend_A::CreateFriendService, "CreateFriendService"}, 12 {0, &Friend::CreateFriendService, "CreateFriendService"},
13 {1, nullptr, "CreateNotificationService"}, 13 {1, nullptr, "CreateNotificationService"},
14 {2, nullptr, "CreateDaemonSuspendSessionService"},
14 }; 15 };
15 RegisterHandlers(functions); 16 RegisterHandlers(functions);
16} 17}
diff --git a/src/core/hle/service/friend/friend_a.h b/src/core/hle/service/friend/interface.h
index 81257583b..89dae8471 100644
--- a/src/core/hle/service/friend/friend_a.h
+++ b/src/core/hle/service/friend/interface.h
@@ -8,9 +8,9 @@
8 8
9namespace Service::Friend { 9namespace Service::Friend {
10 10
11class Friend_A final : public Module::Interface { 11class Friend final : public Module::Interface {
12public: 12public:
13 explicit Friend_A(std::shared_ptr<Module> module); 13 explicit Friend(std::shared_ptr<Module> module, const char* name);
14}; 14};
15 15
16} // namespace Service::Friend 16} // namespace Service::Friend
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 475a0a5cf..9a02ba686 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -5,6 +5,7 @@
5#include <atomic> 5#include <atomic>
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/core_timing.h" 7#include "core/core_timing.h"
8#include "core/core_timing_util.h"
8#include "core/frontend/emu_window.h" 9#include "core/frontend/emu_window.h"
9#include "core/frontend/input.h" 10#include "core/frontend/input.h"
10#include "core/hle/ipc_helpers.h" 11#include "core/hle/ipc_helpers.h"
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 1fca1743d..5344441e1 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -9,6 +9,7 @@
9#include "common/scope_exit.h" 9#include "common/scope_exit.h"
10#include "core/core.h" 10#include "core/core.h"
11#include "core/core_timing.h" 11#include "core/core_timing.h"
12#include "core/core_timing_util.h"
12#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" 13#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
13#include "core/hle/service/nvdrv/nvdrv.h" 14#include "core/hle/service/nvdrv/nvdrv.h"
14#include "core/hle/service/nvflinger/buffer_queue.h" 15#include "core/hle/service/nvflinger/buffer_queue.h"
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp
index fa85277fe..41efca31c 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/set_sys.cpp
@@ -10,13 +10,22 @@
10namespace Service::Set { 10namespace Service::Set {
11 11
12void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { 12void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) {
13
14 IPC::ResponseBuilder rb{ctx, 3}; 13 IPC::ResponseBuilder rb{ctx, 3};
15 14
16 rb.Push(RESULT_SUCCESS); 15 rb.Push(RESULT_SUCCESS);
17 rb.Push<u32>(0); 16 rb.PushEnum(color_set);
18 17
19 LOG_WARNING(Service_SET, "(STUBBED) called"); 18 LOG_DEBUG(Service_SET, "called");
19}
20
21void SET_SYS::SetColorSetId(Kernel::HLERequestContext& ctx) {
22 IPC::RequestParser rp{ctx};
23 color_set = rp.PopEnum<ColorSet>();
24
25 IPC::ResponseBuilder rb{ctx, 2};
26 rb.Push(RESULT_SUCCESS);
27
28 LOG_DEBUG(Service_SET, "called");
20} 29}
21 30
22SET_SYS::SET_SYS() : ServiceFramework("set:sys") { 31SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
@@ -44,7 +53,7 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
44 {21, nullptr, "GetEulaVersions"}, 53 {21, nullptr, "GetEulaVersions"},
45 {22, nullptr, "SetEulaVersions"}, 54 {22, nullptr, "SetEulaVersions"},
46 {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, 55 {23, &SET_SYS::GetColorSetId, "GetColorSetId"},
47 {24, nullptr, "SetColorSetId"}, 56 {24, &SET_SYS::SetColorSetId, "SetColorSetId"},
48 {25, nullptr, "GetConsoleInformationUploadFlag"}, 57 {25, nullptr, "GetConsoleInformationUploadFlag"},
49 {26, nullptr, "SetConsoleInformationUploadFlag"}, 58 {26, nullptr, "SetConsoleInformationUploadFlag"},
50 {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, 59 {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
@@ -172,4 +181,6 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
172 RegisterHandlers(functions); 181 RegisterHandlers(functions);
173} 182}
174 183
184SET_SYS::~SET_SYS() = default;
185
175} // namespace Service::Set 186} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h
index b77a97cde..f602f3c77 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/set_sys.h
@@ -11,10 +11,19 @@ namespace Service::Set {
11class SET_SYS final : public ServiceFramework<SET_SYS> { 11class SET_SYS final : public ServiceFramework<SET_SYS> {
12public: 12public:
13 explicit SET_SYS(); 13 explicit SET_SYS();
14 ~SET_SYS() = default; 14 ~SET_SYS() override;
15 15
16private: 16private:
17 /// Indicates the current theme set by the system settings
18 enum class ColorSet : u32 {
19 BasicWhite = 0,
20 BasicBlack = 1,
21 };
22
17 void GetColorSetId(Kernel::HLERequestContext& ctx); 23 void GetColorSetId(Kernel::HLERequestContext& ctx);
24 void SetColorSetId(Kernel::HLERequestContext& ctx);
25
26 ColorSet color_set = ColorSet::BasicWhite;
18}; 27};
19 28
20} // namespace Service::Set 29} // namespace Service::Set
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index 507ae95f4..f60bf7b91 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -6,6 +6,7 @@
6#include <ctime> 6#include <ctime>
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/core_timing.h" 8#include "core/core_timing.h"
9#include "core/core_timing_util.h"
9#include "core/hle/ipc_helpers.h" 10#include "core/hle/ipc_helpers.h"
10#include "core/hle/kernel/client_port.h" 11#include "core/hle/kernel/client_port.h"
11#include "core/hle/kernel/client_session.h" 12#include "core/hle/kernel/client_session.h"
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index 18bd62a08..b0277a875 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -6,7 +6,6 @@
6#include "common/common_funcs.h" 6#include "common/common_funcs.h"
7#include "common/file_util.h" 7#include "common/file_util.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "common/string_util.h"
10#include "core/file_sys/content_archive.h" 9#include "core/file_sys/content_archive.h"
11#include "core/gdbstub/gdbstub.h" 10#include "core/gdbstub/gdbstub.h"
12#include "core/hle/kernel/process.h" 11#include "core/hle/kernel/process.h"
@@ -18,34 +17,6 @@
18 17
19namespace Loader { 18namespace Loader {
20 19
21static std::string FindRomFS(const std::string& directory) {
22 std::string filepath_romfs;
23 const auto callback = [&filepath_romfs](u64*, const std::string& directory,
24 const std::string& virtual_name) -> bool {
25 const std::string physical_name = directory + virtual_name;
26 if (FileUtil::IsDirectory(physical_name)) {
27 // Skip directories
28 return true;
29 }
30
31 // Verify extension
32 const std::string extension = physical_name.substr(physical_name.find_last_of(".") + 1);
33 if (Common::ToLower(extension) != "romfs") {
34 return true;
35 }
36
37 // Found it - we are done
38 filepath_romfs = std::move(physical_name);
39 return false;
40 };
41
42 // Search the specified directory recursively, looking for the first .romfs file, which will
43 // be used for the RomFS
44 FileUtil::ForeachDirectoryEntry(nullptr, directory, callback);
45
46 return filepath_romfs;
47}
48
49AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file) 20AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file)
50 : AppLoader(std::move(file)) {} 21 : AppLoader(std::move(file)) {}
51 22
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index d7328ff39..0e205ed72 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -75,14 +75,6 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) {
75 ProcessMacroUpload(value); 75 ProcessMacroUpload(value);
76 break; 76 break;
77 } 77 }
78 case MAXWELL3D_REG_INDEX(code_address.code_address_high):
79 case MAXWELL3D_REG_INDEX(code_address.code_address_low): {
80 // Note: For some reason games (like Puyo Puyo Tetris) seem to write 0 to the CODE_ADDRESS
81 // register, we do not currently know if that's intended or a bug, so we assert it lest
82 // stuff breaks in other places (like the shader address calculation).
83 ASSERT_MSG(regs.code_address.CodeAddress() == 0, "Unexpected CODE_ADDRESS register value.");
84 break;
85 }
86 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]): 78 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]):
87 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]): 79 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]):
88 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]): 80 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]):
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 58501ca8b..e9d87efb4 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -24,6 +24,7 @@ enum class RenderTargetFormat : u32 {
24 RGBA8_UNORM = 0xD5, 24 RGBA8_UNORM = 0xD5,
25 RGBA8_SRGB = 0xD6, 25 RGBA8_SRGB = 0xD6,
26 R11G11B10_FLOAT = 0xE0, 26 R11G11B10_FLOAT = 0xE0,
27 R8_UNORM = 0xF3,
27}; 28};
28 29
29enum class DepthFormat : u32 { 30enum class DepthFormat : u32 {
@@ -33,6 +34,7 @@ enum class DepthFormat : u32 {
33 Z24_X8_UNORM = 0x15, 34 Z24_X8_UNORM = 0x15,
34 Z24_S8_UNORM = 0x16, 35 Z24_S8_UNORM = 0x16,
35 Z24_C8_UNORM = 0x18, 36 Z24_C8_UNORM = 0x18,
37 Z32_S8_X24_FLOAT = 0x19,
36}; 38};
37 39
38/// Returns the number of bytes per pixel of each rendertarget format. 40/// Returns the number of bytes per pixel of each rendertarget format.
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 5d5ad84b7..a1c47bae9 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -5,6 +5,7 @@
5#include <algorithm> 5#include <algorithm>
6#include <memory> 6#include <memory>
7#include <string> 7#include <string>
8#include <string_view>
8#include <tuple> 9#include <tuple>
9#include <utility> 10#include <utility>
10#include <glad/glad.h> 11#include <glad/glad.h>
@@ -37,11 +38,6 @@ MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255));
37MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); 38MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100));
38 39
39RasterizerOpenGL::RasterizerOpenGL() { 40RasterizerOpenGL::RasterizerOpenGL() {
40 has_ARB_buffer_storage = false;
41 has_ARB_direct_state_access = false;
42 has_ARB_separate_shader_objects = false;
43 has_ARB_vertex_attrib_binding = false;
44
45 // Create sampler objects 41 // Create sampler objects
46 for (size_t i = 0; i < texture_samplers.size(); ++i) { 42 for (size_t i = 0; i < texture_samplers.size(); ++i) {
47 texture_samplers[i].Create(); 43 texture_samplers[i].Create();
@@ -59,7 +55,8 @@ RasterizerOpenGL::RasterizerOpenGL() {
59 GLint ext_num; 55 GLint ext_num;
60 glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num); 56 glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num);
61 for (GLint i = 0; i < ext_num; i++) { 57 for (GLint i = 0; i < ext_num; i++) {
62 std::string extension{reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i))}; 58 const std::string_view extension{
59 reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i))};
63 60
64 if (extension == "GL_ARB_buffer_storage") { 61 if (extension == "GL_ARB_buffer_storage") {
65 has_ARB_buffer_storage = true; 62 has_ARB_buffer_storage = true;
@@ -110,8 +107,6 @@ RasterizerOpenGL::RasterizerOpenGL() {
110 glBindBufferBase(GL_UNIFORM_BUFFER, index, buffer.handle); 107 glBindBufferBase(GL_UNIFORM_BUFFER, index, buffer.handle);
111 } 108 }
112 109
113 accelerate_draw = AccelDraw::Disabled;
114
115 glEnable(GL_BLEND); 110 glEnable(GL_BLEND);
116 111
117 LOG_CRITICAL(Render_OpenGL, "Sync fixed function OpenGL state here!"); 112 LOG_CRITICAL(Render_OpenGL, "Sync fixed function OpenGL state here!");
@@ -694,10 +689,12 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr
694 glBindBuffer(GL_UNIFORM_BUFFER, 0); 689 glBindBuffer(GL_UNIFORM_BUFFER, 0);
695 690
696 // Now configure the bindpoint of the buffer inside the shader 691 // Now configure the bindpoint of the buffer inside the shader
697 std::string buffer_name = used_buffer.GetName(); 692 const std::string buffer_name = used_buffer.GetName();
698 GLuint index = glGetProgramResourceIndex(program, GL_UNIFORM_BLOCK, buffer_name.c_str()); 693 const GLuint index =
699 if (index != -1) 694 glGetProgramResourceIndex(program, GL_UNIFORM_BLOCK, buffer_name.c_str());
695 if (index != GL_INVALID_INDEX) {
700 glUniformBlockBinding(program, index, buffer_draw_state.bindpoint); 696 glUniformBlockBinding(program, index, buffer_draw_state.bindpoint);
697 }
701 } 698 }
702 699
703 state.Apply(); 700 state.Apply();
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index ab06e2d95..e150be58f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -135,10 +135,10 @@ private:
135 /// Syncs the blend state to match the guest state 135 /// Syncs the blend state to match the guest state
136 void SyncBlendState(); 136 void SyncBlendState();
137 137
138 bool has_ARB_buffer_storage; 138 bool has_ARB_buffer_storage = false;
139 bool has_ARB_direct_state_access; 139 bool has_ARB_direct_state_access = false;
140 bool has_ARB_separate_shader_objects; 140 bool has_ARB_separate_shader_objects = false;
141 bool has_ARB_vertex_attrib_binding; 141 bool has_ARB_vertex_attrib_binding = false;
142 142
143 OpenGLState state; 143 OpenGLState state;
144 144
@@ -167,5 +167,5 @@ private:
167 void SetupShaders(u8* buffer_ptr, GLintptr buffer_offset); 167 void SetupShaders(u8* buffer_ptr, GLintptr buffer_offset);
168 168
169 enum class AccelDraw { Disabled, Arrays, Indexed }; 169 enum class AccelDraw { Disabled, Arrays, Indexed };
170 AccelDraw accelerate_draw; 170 AccelDraw accelerate_draw = AccelDraw::Disabled;
171}; 171};
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 1d3aff97b..91ce0357b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -111,6 +111,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F 111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
112 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F 112 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F 113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
114 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
115 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
114 116
115 // DepthStencil formats 117 // DepthStencil formats
116 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 118 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
@@ -120,6 +122,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
120 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F 122 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
121 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm, 123 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm,
122 false}, // Z16 124 false}, // Z16
125 {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
126 ComponentType::Float, false}, // Z32FS8
123}}; 127}};
124 128
125static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { 129static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) {
@@ -204,9 +208,10 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
204 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, 208 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
205 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, 209 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
206 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, 210 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
207 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::Z24S8>, 211 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
212 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::Z24S8>,
208 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, 213 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
209 MortonCopy<true, PixelFormat::Z16>, 214 MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
210}; 215};
211 216
212static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), 217static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -232,10 +237,13 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
232 MortonCopy<false, PixelFormat::RGBA32F>, 237 MortonCopy<false, PixelFormat::RGBA32F>,
233 MortonCopy<false, PixelFormat::RG32F>, 238 MortonCopy<false, PixelFormat::RG32F>,
234 MortonCopy<false, PixelFormat::R32F>, 239 MortonCopy<false, PixelFormat::R32F>,
240 MortonCopy<false, PixelFormat::R16F>,
241 MortonCopy<false, PixelFormat::R16UNORM>,
235 MortonCopy<false, PixelFormat::Z24S8>, 242 MortonCopy<false, PixelFormat::Z24S8>,
236 MortonCopy<false, PixelFormat::S8Z24>, 243 MortonCopy<false, PixelFormat::S8Z24>,
237 MortonCopy<false, PixelFormat::Z32F>, 244 MortonCopy<false, PixelFormat::Z32F>,
238 MortonCopy<false, PixelFormat::Z16>, 245 MortonCopy<false, PixelFormat::Z16>,
246 MortonCopy<false, PixelFormat::Z32FS8>,
239}; 247};
240 248
241// Allocate an uninitialized texture of appropriate size and format for the surface 249// Allocate an uninitialized texture of appropriate size and format for the surface
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 800d239d9..fc864c56f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -41,14 +41,17 @@ struct SurfaceParams {
41 RGBA32F = 16, 41 RGBA32F = 16,
42 RG32F = 17, 42 RG32F = 17,
43 R32F = 18, 43 R32F = 18,
44 R16F = 19,
45 R16UNORM = 20,
44 46
45 MaxColorFormat, 47 MaxColorFormat,
46 48
47 // DepthStencil formats 49 // DepthStencil formats
48 Z24S8 = 19, 50 Z24S8 = 21,
49 S8Z24 = 20, 51 S8Z24 = 22,
50 Z32F = 21, 52 Z32F = 23,
51 Z16 = 22, 53 Z16 = 24,
54 Z32FS8 = 25,
52 55
53 MaxDepthStencilFormat, 56 MaxDepthStencilFormat,
54 57
@@ -105,10 +108,13 @@ struct SurfaceParams {
105 1, // RGBA32F 108 1, // RGBA32F
106 1, // RG32F 109 1, // RG32F
107 1, // R32F 110 1, // R32F
111 1, // R16F
112 1, // R16UNORM
108 1, // Z24S8 113 1, // Z24S8
109 1, // S8Z24 114 1, // S8Z24
110 1, // Z32F 115 1, // Z32F
111 1, // Z16 116 1, // Z16
117 1, // Z32FS8
112 }}; 118 }};
113 119
114 ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); 120 ASSERT(static_cast<size_t>(format) < compression_factor_table.size());
@@ -139,10 +145,13 @@ struct SurfaceParams {
139 128, // RGBA32F 145 128, // RGBA32F
140 64, // RG32F 146 64, // RG32F
141 32, // R32F 147 32, // R32F
148 16, // R16F
149 16, // R16UNORM
142 32, // Z24S8 150 32, // Z24S8
143 32, // S8Z24 151 32, // S8Z24
144 32, // Z32F 152 32, // Z32F
145 16, // Z16 153 16, // Z16
154 64, // Z32FS8
146 }}; 155 }};
147 156
148 ASSERT(static_cast<size_t>(format) < bpp_table.size()); 157 ASSERT(static_cast<size_t>(format) < bpp_table.size());
@@ -163,6 +172,8 @@ struct SurfaceParams {
163 return PixelFormat::Z32F; 172 return PixelFormat::Z32F;
164 case Tegra::DepthFormat::Z16_UNORM: 173 case Tegra::DepthFormat::Z16_UNORM:
165 return PixelFormat::Z16; 174 return PixelFormat::Z16;
175 case Tegra::DepthFormat::Z32_S8_X24_FLOAT:
176 return PixelFormat::Z32FS8;
166 default: 177 default:
167 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 178 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
168 UNREACHABLE(); 179 UNREACHABLE();
@@ -188,6 +199,8 @@ struct SurfaceParams {
188 return PixelFormat::R11FG11FB10F; 199 return PixelFormat::R11FG11FB10F;
189 case Tegra::RenderTargetFormat::RGBA32_UINT: 200 case Tegra::RenderTargetFormat::RGBA32_UINT:
190 return PixelFormat::RGBA32UI; 201 return PixelFormat::RGBA32UI;
202 case Tegra::RenderTargetFormat::R8_UNORM:
203 return PixelFormat::R8;
191 default: 204 default:
192 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 205 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
193 UNREACHABLE(); 206 UNREACHABLE();
@@ -226,8 +239,22 @@ struct SurfaceParams {
226 UNREACHABLE(); 239 UNREACHABLE();
227 case Tegra::Texture::TextureFormat::R32_G32: 240 case Tegra::Texture::TextureFormat::R32_G32:
228 return PixelFormat::RG32F; 241 return PixelFormat::RG32F;
242 case Tegra::Texture::TextureFormat::R16:
243 switch (component_type) {
244 case Tegra::Texture::ComponentType::FLOAT:
245 return PixelFormat::R16F;
246 case Tegra::Texture::ComponentType::UNORM:
247 return PixelFormat::R16UNORM;
248 }
249 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
250 static_cast<u32>(component_type));
251 UNREACHABLE();
229 case Tegra::Texture::TextureFormat::R32: 252 case Tegra::Texture::TextureFormat::R32:
230 return PixelFormat::R32F; 253 return PixelFormat::R32F;
254 case Tegra::Texture::TextureFormat::ZF32:
255 return PixelFormat::Z32F;
256 case Tegra::Texture::TextureFormat::Z24S8:
257 return PixelFormat::Z24S8;
231 case Tegra::Texture::TextureFormat::DXT1: 258 case Tegra::Texture::TextureFormat::DXT1:
232 return PixelFormat::DXT1; 259 return PixelFormat::DXT1;
233 case Tegra::Texture::TextureFormat::DXT23: 260 case Tegra::Texture::TextureFormat::DXT23:
@@ -290,6 +317,13 @@ struct SurfaceParams {
290 return Tegra::Texture::TextureFormat::R32_G32; 317 return Tegra::Texture::TextureFormat::R32_G32;
291 case PixelFormat::R32F: 318 case PixelFormat::R32F:
292 return Tegra::Texture::TextureFormat::R32; 319 return Tegra::Texture::TextureFormat::R32;
320 case PixelFormat::R16F:
321 case PixelFormat::R16UNORM:
322 return Tegra::Texture::TextureFormat::R16;
323 case PixelFormat::Z32F:
324 return Tegra::Texture::TextureFormat::ZF32;
325 case PixelFormat::Z24S8:
326 return Tegra::Texture::TextureFormat::Z24S8;
293 default: 327 default:
294 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 328 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
295 UNREACHABLE(); 329 UNREACHABLE();
@@ -306,6 +340,8 @@ struct SurfaceParams {
306 return Tegra::DepthFormat::Z32_FLOAT; 340 return Tegra::DepthFormat::Z32_FLOAT;
307 case PixelFormat::Z16: 341 case PixelFormat::Z16:
308 return Tegra::DepthFormat::Z16_UNORM; 342 return Tegra::DepthFormat::Z16_UNORM;
343 case PixelFormat::Z32FS8:
344 return Tegra::DepthFormat::Z32_S8_X24_FLOAT;
309 default: 345 default:
310 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 346 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
311 UNREACHABLE(); 347 UNREACHABLE();
@@ -332,6 +368,7 @@ struct SurfaceParams {
332 case Tegra::RenderTargetFormat::RGBA8_SRGB: 368 case Tegra::RenderTargetFormat::RGBA8_SRGB:
333 case Tegra::RenderTargetFormat::BGRA8_UNORM: 369 case Tegra::RenderTargetFormat::BGRA8_UNORM:
334 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 370 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
371 case Tegra::RenderTargetFormat::R8_UNORM:
335 return ComponentType::UNorm; 372 return ComponentType::UNorm;
336 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 373 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
337 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 374 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
@@ -363,6 +400,7 @@ struct SurfaceParams {
363 case Tegra::DepthFormat::Z24_S8_UNORM: 400 case Tegra::DepthFormat::Z24_S8_UNORM:
364 return ComponentType::UNorm; 401 return ComponentType::UNorm;
365 case Tegra::DepthFormat::Z32_FLOAT: 402 case Tegra::DepthFormat::Z32_FLOAT:
403 case Tegra::DepthFormat::Z32_S8_X24_FLOAT:
366 return ComponentType::Float; 404 return ComponentType::Float;
367 default: 405 default:
368 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 406 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index cda2646ad..50c5a56f6 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -66,6 +66,7 @@ u32 BytesPerPixel(TextureFormat format) {
66 case TextureFormat::A1B5G5R5: 66 case TextureFormat::A1B5G5R5:
67 case TextureFormat::B5G6R5: 67 case TextureFormat::B5G6R5:
68 case TextureFormat::G8R8: 68 case TextureFormat::G8R8:
69 case TextureFormat::R16:
69 return 2; 70 return 2;
70 case TextureFormat::R8: 71 case TextureFormat::R8:
71 return 1; 72 return 1;
@@ -89,6 +90,8 @@ static u32 DepthBytesPerPixel(DepthFormat format) {
89 case DepthFormat::Z24_S8_UNORM: 90 case DepthFormat::Z24_S8_UNORM:
90 case DepthFormat::Z32_FLOAT: 91 case DepthFormat::Z32_FLOAT:
91 return 4; 92 return 4;
93 case DepthFormat::Z32_S8_X24_FLOAT:
94 return 8;
92 default: 95 default:
93 UNIMPLEMENTED_MSG("Format not implemented"); 96 UNIMPLEMENTED_MSG("Format not implemented");
94 break; 97 break;
@@ -123,6 +126,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
123 case TextureFormat::R32_G32_B32_A32: 126 case TextureFormat::R32_G32_B32_A32:
124 case TextureFormat::R32_G32: 127 case TextureFormat::R32_G32:
125 case TextureFormat::R32: 128 case TextureFormat::R32:
129 case TextureFormat::R16:
126 case TextureFormat::BF10GF11RF11: 130 case TextureFormat::BF10GF11RF11:
127 case TextureFormat::ASTC_2D_4X4: 131 case TextureFormat::ASTC_2D_4X4:
128 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 132 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
@@ -148,6 +152,7 @@ std::vector<u8> UnswizzleDepthTexture(VAddr address, DepthFormat format, u32 wid
148 case DepthFormat::S8_Z24_UNORM: 152 case DepthFormat::S8_Z24_UNORM:
149 case DepthFormat::Z24_S8_UNORM: 153 case DepthFormat::Z24_S8_UNORM:
150 case DepthFormat::Z32_FLOAT: 154 case DepthFormat::Z32_FLOAT:
155 case DepthFormat::Z32_S8_X24_FLOAT:
151 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 156 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
152 unswizzled_data.data(), true, block_height); 157 unswizzled_data.data(), true, block_height);
153 break; 158 break;
@@ -181,6 +186,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
181 case TextureFormat::R32_G32_B32_A32: 186 case TextureFormat::R32_G32_B32_A32:
182 case TextureFormat::R32_G32: 187 case TextureFormat::R32_G32:
183 case TextureFormat::R32: 188 case TextureFormat::R32:
189 case TextureFormat::R16:
184 // TODO(Subv): For the time being just forward the same data without any decoding. 190 // TODO(Subv): For the time being just forward the same data without any decoding.
185 rgba_data = texture_data; 191 rgba_data = texture_data;
186 break; 192 break;
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp
index 8f24586ce..416cc1dfa 100644
--- a/src/yuzu/debugger/wait_tree.cpp
+++ b/src/yuzu/debugger/wait_tree.cpp
@@ -5,6 +5,7 @@
5#include "yuzu/debugger/wait_tree.h" 5#include "yuzu/debugger/wait_tree.h"
6#include "yuzu/util/util.h" 6#include "yuzu/util/util.h"
7 7
8#include "common/assert.h"
8#include "core/core.h" 9#include "core/core.h"
9#include "core/hle/kernel/event.h" 10#include "core/hle/kernel/event.h"
10#include "core/hle/kernel/handle_table.h" 11#include "core/hle/kernel/handle_table.h"
@@ -169,6 +170,8 @@ QString WaitTreeWaitObject::GetResetTypeQString(Kernel::ResetType reset_type) {
169 case Kernel::ResetType::Pulse: 170 case Kernel::ResetType::Pulse:
170 return tr("pulse"); 171 return tr("pulse");
171 } 172 }
173 UNREACHABLE();
174 return {};
172} 175}
173 176
174WaitTreeObjectList::WaitTreeObjectList( 177WaitTreeObjectList::WaitTreeObjectList(