summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------externals/dynarmic0
-rw-r--r--src/core/CMakeLists.txt26
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.cpp4
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.h2
-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/file_sys/partition_filesystem.cpp6
-rw-r--r--src/core/hle/ipc_helpers.h42
-rw-r--r--src/core/hle/kernel/hle_ipc.h2
-rw-r--r--src/core/hle/kernel/mutex.cpp2
-rw-r--r--src/core/hle/kernel/svc.cpp15
-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/acc/acc.cpp2
-rw-r--r--src/core/hle/service/apm/interface.h3
-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/service.h2
-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/core/loader/elf.cpp2
-rw-r--r--src/core/loader/loader.h2
-rw-r--r--src/core/tracer/recorder.h2
-rw-r--r--src/video_core/engines/maxwell_3d.cpp8
-rw-r--r--src/video_core/gpu.cpp2
-rw-r--r--src/video_core/gpu.h4
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp28
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h15
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp27
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h101
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp4
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h5
-rw-r--r--src/video_core/textures/decoders.cpp13
-rw-r--r--src/video_core/textures/texture.h8
-rw-r--r--src/yuzu/debugger/wait_tree.cpp3
46 files changed, 405 insertions, 281 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 028095ff9..833605475 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/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp
index d23adb28a..57b8634b9 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic.cpp
@@ -102,8 +102,8 @@ public:
102 u64 tpidr_el0 = 0; 102 u64 tpidr_el0 = 0;
103}; 103};
104 104
105std::unique_ptr<Dynarmic::A64::Jit> ARM_Dynarmic::MakeJit() { 105std::unique_ptr<Dynarmic::A64::Jit> ARM_Dynarmic::MakeJit() const {
106 const auto page_table = Core::CurrentProcess()->vm_manager.page_table.pointers.data(); 106 auto** const page_table = Core::CurrentProcess()->vm_manager.page_table.pointers.data();
107 107
108 Dynarmic::A64::UserConfig config; 108 Dynarmic::A64::UserConfig config;
109 109
diff --git a/src/core/arm/dynarmic/arm_dynarmic.h b/src/core/arm/dynarmic/arm_dynarmic.h
index 350f61fd2..14c072601 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.h
+++ b/src/core/arm/dynarmic/arm_dynarmic.h
@@ -50,7 +50,7 @@ public:
50 void PageTableChanged() override; 50 void PageTableChanged() override;
51 51
52private: 52private:
53 std::unique_ptr<Dynarmic::A64::Jit> MakeJit(); 53 std::unique_ptr<Dynarmic::A64::Jit> MakeJit() const;
54 54
55 friend class ARM_Dynarmic_Callbacks; 55 friend class ARM_Dynarmic_Callbacks;
56 std::unique_ptr<ARM_Dynarmic_Callbacks> cb; 56 std::unique_ptr<ARM_Dynarmic_Callbacks> cb;
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/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp
index 8d2bd9f6b..521e21078 100644
--- a/src/core/file_sys/partition_filesystem.cpp
+++ b/src/core/file_sys/partition_filesystem.cpp
@@ -65,8 +65,8 @@ PartitionFilesystem::PartitionFilesystem(std::shared_ptr<VfsFile> file) {
65 std::string name( 65 std::string name(
66 reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset])); 66 reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset]));
67 67
68 pfs_files.emplace_back( 68 pfs_files.emplace_back(std::make_shared<OffsetVfsFile>(
69 std::make_shared<OffsetVfsFile>(file, entry.size, content_offset + entry.offset, name)); 69 file, entry.size, content_offset + entry.offset, std::move(name)));
70 } 70 }
71 71
72 status = Loader::ResultStatus::Success; 72 status = Loader::ResultStatus::Success;
@@ -109,7 +109,7 @@ bool PartitionFilesystem::ReplaceFileWithSubdirectory(VirtualFile file, VirtualD
109 return false; 109 return false;
110 110
111 const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter); 111 const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter);
112 pfs_files[offset] = pfs_files.back(); 112 pfs_files[offset] = std::move(pfs_files.back());
113 pfs_files.pop_back(); 113 pfs_files.pop_back();
114 114
115 pfs_dirs.emplace_back(std::move(dir)); 115 pfs_dirs.emplace_back(std::move(dir));
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index 8b5b06f31..7fb0da408 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -25,9 +25,9 @@ protected:
25 ptrdiff_t index = 0; 25 ptrdiff_t index = 0;
26 26
27public: 27public:
28 RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {} 28 explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {}
29 29
30 RequestHelperBase(Kernel::HLERequestContext& context) 30 explicit RequestHelperBase(Kernel::HLERequestContext& context)
31 : context(&context), cmdbuf(context.CommandBuffer()) {} 31 : context(&context), cmdbuf(context.CommandBuffer()) {}
32 32
33 void Skip(unsigned size_in_words, bool set_to_null) { 33 void Skip(unsigned size_in_words, bool set_to_null) {
@@ -56,13 +56,6 @@ public:
56 56
57class ResponseBuilder : public RequestHelperBase { 57class ResponseBuilder : public RequestHelperBase {
58public: 58public:
59 ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {}
60
61 u32 normal_params_size{};
62 u32 num_handles_to_copy{};
63 u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent
64 std::ptrdiff_t datapayload_index{};
65
66 /// Flags used for customizing the behavior of ResponseBuilder 59 /// Flags used for customizing the behavior of ResponseBuilder
67 enum class Flags : u32 { 60 enum class Flags : u32 {
68 None = 0, 61 None = 0,
@@ -71,9 +64,11 @@ public:
71 AlwaysMoveHandles = 1, 64 AlwaysMoveHandles = 1,
72 }; 65 };
73 66
74 ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size, 67 explicit ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {}
75 u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0, 68
76 Flags flags = Flags::None) 69 explicit ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size,
70 u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0,
71 Flags flags = Flags::None)
77 72
78 : RequestHelperBase(context), normal_params_size(normal_params_size), 73 : RequestHelperBase(context), normal_params_size(normal_params_size),
79 num_handles_to_copy(num_handles_to_copy), num_objects_to_move(num_objects_to_move) { 74 num_handles_to_copy(num_handles_to_copy), num_objects_to_move(num_objects_to_move) {
@@ -206,6 +201,12 @@ public:
206 201
207 template <typename... O> 202 template <typename... O>
208 void PushCopyObjects(Kernel::SharedPtr<O>... pointers); 203 void PushCopyObjects(Kernel::SharedPtr<O>... pointers);
204
205private:
206 u32 normal_params_size{};
207 u32 num_handles_to_copy{};
208 u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent
209 std::ptrdiff_t datapayload_index{};
209}; 210};
210 211
211/// Push /// 212/// Push ///
@@ -273,9 +274,9 @@ inline void ResponseBuilder::PushMoveObjects(Kernel::SharedPtr<O>... pointers) {
273 274
274class RequestParser : public RequestHelperBase { 275class RequestParser : public RequestHelperBase {
275public: 276public:
276 RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {} 277 explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {}
277 278
278 RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) { 279 explicit RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) {
279 ASSERT_MSG(context.GetDataPayloadOffset(), "context is incomplete"); 280 ASSERT_MSG(context.GetDataPayloadOffset(), "context is incomplete");
280 Skip(context.GetDataPayloadOffset(), false); 281 Skip(context.GetDataPayloadOffset(), false);
281 // Skip the u64 command id, it's already stored in the context 282 // Skip the u64 command id, it's already stored in the context
@@ -285,8 +286,9 @@ public:
285 286
286 ResponseBuilder MakeBuilder(u32 normal_params_size, u32 num_handles_to_copy, 287 ResponseBuilder MakeBuilder(u32 normal_params_size, u32 num_handles_to_copy,
287 u32 num_handles_to_move, 288 u32 num_handles_to_move,
288 ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) { 289 ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) const {
289 return {*context, normal_params_size, num_handles_to_copy, num_handles_to_move, flags}; 290 return ResponseBuilder{*context, normal_params_size, num_handles_to_copy,
291 num_handles_to_move, flags};
290 } 292 }
291 293
292 template <typename T> 294 template <typename T>
@@ -298,6 +300,14 @@ public:
298 template <typename First, typename... Other> 300 template <typename First, typename... Other>
299 void Pop(First& first_value, Other&... other_values); 301 void Pop(First& first_value, Other&... other_values);
300 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
301 /** 311 /**
302 * @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
303 * @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/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 01b805df8..84727f748 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -91,7 +91,7 @@ protected:
91 */ 91 */
92class HLERequestContext { 92class HLERequestContext {
93public: 93public:
94 HLERequestContext(SharedPtr<Kernel::ServerSession> session); 94 explicit HLERequestContext(SharedPtr<ServerSession> session);
95 ~HLERequestContext(); 95 ~HLERequestContext();
96 96
97 /// Returns a pointer to the IPC command buffer for this request. 97 /// Returns a pointer to the IPC command buffer for this request.
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index 3f1de3258..feb7b88d2 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -19,7 +19,7 @@ namespace Kernel {
19/// Returns the number of threads that are waiting for a mutex, and the highest priority one among 19/// Returns the number of threads that are waiting for a mutex, and the highest priority one among
20/// those. 20/// those.
21static std::pair<SharedPtr<Thread>, u32> GetHighestPriorityMutexWaitingThread( 21static std::pair<SharedPtr<Thread>, u32> GetHighestPriorityMutexWaitingThread(
22 SharedPtr<Thread> current_thread, VAddr mutex_addr) { 22 const SharedPtr<Thread>& current_thread, VAddr mutex_addr) {
23 23
24 SharedPtr<Thread> highest_priority_thread; 24 SharedPtr<Thread> highest_priority_thread;
25 u32 num_waiters = 0; 25 u32 num_waiters = 0;
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 7b41c9cfd..0b439401a 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -40,7 +40,9 @@ static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
40} 40}
41 41
42static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) { 42static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) {
43 LOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr); 43 LOG_WARNING(Kernel_SVC,
44 "(STUBBED) called, addr=0x{:X}, size=0x{:X}, state0=0x{:X}, state1=0x{:X}", addr,
45 size, state0, state1);
44 return RESULT_SUCCESS; 46 return RESULT_SUCCESS;
45} 47}
46 48
@@ -165,11 +167,14 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64
165 using ObjectPtr = SharedPtr<WaitObject>; 167 using ObjectPtr = SharedPtr<WaitObject>;
166 std::vector<ObjectPtr> objects(handle_count); 168 std::vector<ObjectPtr> objects(handle_count);
167 169
168 for (int i = 0; i < handle_count; ++i) { 170 for (u64 i = 0; i < handle_count; ++i) {
169 Handle handle = Memory::Read32(handles_address + i * sizeof(Handle)); 171 const Handle handle = Memory::Read32(handles_address + i * sizeof(Handle));
170 auto object = g_handle_table.Get<WaitObject>(handle); 172 const auto object = g_handle_table.Get<WaitObject>(handle);
171 if (object == nullptr) 173
174 if (object == nullptr) {
172 return ERR_INVALID_HANDLE; 175 return ERR_INVALID_HANDLE;
176 }
177
173 objects[i] = object; 178 objects[i] = object;
174 } 179 }
175 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/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 3e1c2c0a0..0b158e015 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -35,7 +35,7 @@ static constexpr u128 DEFAULT_USER_ID{1ull, 0ull};
35 35
36class IProfile final : public ServiceFramework<IProfile> { 36class IProfile final : public ServiceFramework<IProfile> {
37public: 37public:
38 IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) { 38 explicit IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) {
39 static const FunctionInfo functions[] = { 39 static const FunctionInfo functions[] = {
40 {0, nullptr, "Get"}, 40 {0, nullptr, "Get"},
41 {1, &IProfile::GetBase, "GetBase"}, 41 {1, &IProfile::GetBase, "GetBase"},
diff --git a/src/core/hle/service/apm/interface.h b/src/core/hle/service/apm/interface.h
index 85258a666..fa68c7d93 100644
--- a/src/core/hle/service/apm/interface.h
+++ b/src/core/hle/service/apm/interface.h
@@ -19,7 +19,4 @@ private:
19 std::shared_ptr<Module> apm; 19 std::shared_ptr<Module> apm;
20}; 20};
21 21
22/// Registers all AM services with the specified service manager.
23void InstallInterfaces(SM::ServiceManager& service_manager);
24
25} // namespace Service::APM 22} // namespace Service::APM
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/service.h b/src/core/hle/service/service.h
index fee841d46..180f22703 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -146,7 +146,7 @@ protected:
146 * @param max_sessions Maximum number of sessions that can be 146 * @param max_sessions Maximum number of sessions that can be
147 * connected to this service at the same time. 147 * connected to this service at the same time.
148 */ 148 */
149 ServiceFramework(const char* service_name, u32 max_sessions = DefaultMaxSessions) 149 explicit ServiceFramework(const char* service_name, u32 max_sessions = DefaultMaxSessions)
150 : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} 150 : ServiceFrameworkBase(service_name, max_sessions, Invoker) {}
151 151
152 /// Registers handlers in the service. 152 /// Registers handlers in the service.
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 e32c088e8..37b58bb77 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/core/loader/elf.cpp b/src/core/loader/elf.cpp
index 4bfd5f536..352938dcb 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -190,7 +190,7 @@ private:
190 u32 entryPoint; 190 u32 entryPoint;
191 191
192public: 192public:
193 ElfReader(void* ptr); 193 explicit ElfReader(void* ptr);
194 194
195 u32 Read32(int off) const { 195 u32 Read32(int off) const {
196 return base32[off >> 2]; 196 return base32[off >> 2];
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 6f517ca8c..fbf11e5d0 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -79,7 +79,7 @@ enum class ResultStatus {
79/// Interface for loading an application 79/// Interface for loading an application
80class AppLoader : NonCopyable { 80class AppLoader : NonCopyable {
81public: 81public:
82 AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} 82 explicit AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {}
83 virtual ~AppLoader() {} 83 virtual ~AppLoader() {}
84 84
85 /** 85 /**
diff --git a/src/core/tracer/recorder.h b/src/core/tracer/recorder.h
index 629c2f6d2..e1cefd5fe 100644
--- a/src/core/tracer/recorder.h
+++ b/src/core/tracer/recorder.h
@@ -32,7 +32,7 @@ public:
32 * Recorder constructor 32 * Recorder constructor
33 * @param initial_state Initial recorder state 33 * @param initial_state Initial recorder state
34 */ 34 */
35 Recorder(const InitialState& initial_state); 35 explicit Recorder(const InitialState& initial_state);
36 36
37 /// Finish recording of this Citrace and save it using the given filename. 37 /// Finish recording of this Citrace and save it using the given filename.
38 void Finish(const std::string& filename); 38 void Finish(const std::string& filename);
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.cpp b/src/video_core/gpu.cpp
index a003bc9e3..60c49d672 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -35,9 +35,11 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
35 case RenderTargetFormat::RGBA32_FLOAT: 35 case RenderTargetFormat::RGBA32_FLOAT:
36 return 16; 36 return 16;
37 case RenderTargetFormat::RGBA16_FLOAT: 37 case RenderTargetFormat::RGBA16_FLOAT:
38 case RenderTargetFormat::RG32_FLOAT:
38 return 8; 39 return 8;
39 case RenderTargetFormat::RGBA8_UNORM: 40 case RenderTargetFormat::RGBA8_UNORM:
40 case RenderTargetFormat::RGB10_A2_UNORM: 41 case RenderTargetFormat::RGB10_A2_UNORM:
42 case RenderTargetFormat::BGRA8_UNORM:
41 return 4; 43 return 4;
42 default: 44 default:
43 UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); 45 UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format));
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index a32148ecd..e9d87efb4 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -18,10 +18,13 @@ enum class RenderTargetFormat : u32 {
18 RGBA32_FLOAT = 0xC0, 18 RGBA32_FLOAT = 0xC0,
19 RGBA32_UINT = 0xC2, 19 RGBA32_UINT = 0xC2,
20 RGBA16_FLOAT = 0xCA, 20 RGBA16_FLOAT = 0xCA,
21 RG32_FLOAT = 0xCB,
22 BGRA8_UNORM = 0xCF,
21 RGB10_A2_UNORM = 0xD1, 23 RGB10_A2_UNORM = 0xD1,
22 RGBA8_UNORM = 0xD5, 24 RGBA8_UNORM = 0xD5,
23 RGBA8_SRGB = 0xD6, 25 RGBA8_SRGB = 0xD6,
24 R11G11B10_FLOAT = 0xE0, 26 R11G11B10_FLOAT = 0xE0,
27 R8_UNORM = 0xF3,
25}; 28};
26 29
27enum class DepthFormat : u32 { 30enum class DepthFormat : u32 {
@@ -31,6 +34,7 @@ enum class DepthFormat : u32 {
31 Z24_X8_UNORM = 0x15, 34 Z24_X8_UNORM = 0x15,
32 Z24_S8_UNORM = 0x16, 35 Z24_S8_UNORM = 0x16,
33 Z24_C8_UNORM = 0x18, 36 Z24_C8_UNORM = 0x18,
37 Z32_S8_X24_FLOAT = 0x19,
34}; 38};
35 39
36/// 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 56d9c575b..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!");
@@ -601,7 +596,6 @@ void RasterizerOpenGL::SamplerInfo::Create() {
601 sampler.Create(); 596 sampler.Create();
602 mag_filter = min_filter = Tegra::Texture::TextureFilter::Linear; 597 mag_filter = min_filter = Tegra::Texture::TextureFilter::Linear;
603 wrap_u = wrap_v = Tegra::Texture::WrapMode::Wrap; 598 wrap_u = wrap_v = Tegra::Texture::WrapMode::Wrap;
604 border_color_r = border_color_g = border_color_b = border_color_a = 0;
605 599
606 // default is GL_LINEAR_MIPMAP_LINEAR 600 // default is GL_LINEAR_MIPMAP_LINEAR
607 glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 601 glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -630,8 +624,12 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr
630 } 624 }
631 625
632 if (wrap_u == Tegra::Texture::WrapMode::Border || wrap_v == Tegra::Texture::WrapMode::Border) { 626 if (wrap_u == Tegra::Texture::WrapMode::Border || wrap_v == Tegra::Texture::WrapMode::Border) {
633 // TODO(Subv): Implement border color 627 const GLvec4 new_border_color = {{config.border_color_r, config.border_color_g,
634 ASSERT(false); 628 config.border_color_b, config.border_color_a}};
629 if (border_color != new_border_color) {
630 border_color = new_border_color;
631 glSamplerParameterfv(s, GL_TEXTURE_BORDER_COLOR, border_color.data());
632 }
635 } 633 }
636} 634}
637 635
@@ -691,10 +689,12 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr
691 glBindBuffer(GL_UNIFORM_BUFFER, 0); 689 glBindBuffer(GL_UNIFORM_BUFFER, 0);
692 690
693 // Now configure the bindpoint of the buffer inside the shader 691 // Now configure the bindpoint of the buffer inside the shader
694 std::string buffer_name = used_buffer.GetName(); 692 const std::string buffer_name = used_buffer.GetName();
695 GLuint index = glGetProgramResourceIndex(program, GL_UNIFORM_BLOCK, buffer_name.c_str()); 693 const GLuint index =
696 if (index != -1) 694 glGetProgramResourceIndex(program, GL_UNIFORM_BLOCK, buffer_name.c_str());
695 if (index != GL_INVALID_INDEX) {
697 glUniformBlockBinding(program, index, buffer_draw_state.bindpoint); 696 glUniformBlockBinding(program, index, buffer_draw_state.bindpoint);
697 }
698 } 698 }
699 699
700 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 c406142e4..e150be58f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -77,10 +77,7 @@ private:
77 Tegra::Texture::TextureFilter min_filter; 77 Tegra::Texture::TextureFilter min_filter;
78 Tegra::Texture::WrapMode wrap_u; 78 Tegra::Texture::WrapMode wrap_u;
79 Tegra::Texture::WrapMode wrap_v; 79 Tegra::Texture::WrapMode wrap_v;
80 u32 border_color_r; 80 GLvec4 border_color;
81 u32 border_color_g;
82 u32 border_color_b;
83 u32 border_color_a;
84 }; 81 };
85 82
86 /// Configures the color and depth framebuffer states and returns the dirty <Color, Depth> 83 /// Configures the color and depth framebuffer states and returns the dirty <Color, Depth>
@@ -138,10 +135,10 @@ private:
138 /// Syncs the blend state to match the guest state 135 /// Syncs the blend state to match the guest state
139 void SyncBlendState(); 136 void SyncBlendState();
140 137
141 bool has_ARB_buffer_storage; 138 bool has_ARB_buffer_storage = false;
142 bool has_ARB_direct_state_access; 139 bool has_ARB_direct_state_access = false;
143 bool has_ARB_separate_shader_objects; 140 bool has_ARB_separate_shader_objects = false;
144 bool has_ARB_vertex_attrib_binding; 141 bool has_ARB_vertex_attrib_binding = false;
145 142
146 OpenGLState state; 143 OpenGLState state;
147 144
@@ -170,5 +167,5 @@ private:
170 void SetupShaders(u8* buffer_ptr, GLintptr buffer_offset); 167 void SetupShaders(u8* buffer_ptr, GLintptr buffer_offset);
171 168
172 enum class AccelDraw { Disabled, Arrays, Indexed }; 169 enum class AccelDraw { Disabled, Arrays, Indexed };
173 AccelDraw accelerate_draw; 170 AccelDraw accelerate_draw = AccelDraw::Disabled;
174}; 171};
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 28f0bc379..91ce0357b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -38,7 +38,8 @@ struct FormatTuple {
38 params.addr = config.tic.Address(); 38 params.addr = config.tic.Address();
39 params.is_tiled = config.tic.IsTiled(); 39 params.is_tiled = config.tic.IsTiled();
40 params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0, 40 params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0,
41 params.pixel_format = PixelFormatFromTextureFormat(config.tic.format); 41 params.pixel_format =
42 PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value());
42 params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); 43 params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value());
43 params.type = GetFormatType(params.pixel_format); 44 params.type = GetFormatType(params.pixel_format);
44 params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format)); 45 params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format));
@@ -106,6 +107,12 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
106 true}, // BC7U 107 true}, // BC7U
107 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 108 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
108 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 109 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8
110 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
112 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
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
109 116
110 // DepthStencil formats 117 // DepthStencil formats
111 {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,
@@ -115,6 +122,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
115 {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
116 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm, 123 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm,
117 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
118}}; 127}};
119 128
120static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { 129static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) {
@@ -197,9 +206,12 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
197 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, 206 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>,
198 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, 207 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>,
199 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, 208 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
200 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::Z24S8>, 209 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
210 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
211 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
212 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::Z24S8>,
201 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, 213 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
202 MortonCopy<true, PixelFormat::Z16>, 214 MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
203}; 215};
204 216
205static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), 217static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -213,7 +225,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
213 MortonCopy<false, PixelFormat::RGBA16F>, 225 MortonCopy<false, PixelFormat::RGBA16F>,
214 MortonCopy<false, PixelFormat::R11FG11FB10F>, 226 MortonCopy<false, PixelFormat::R11FG11FB10F>,
215 MortonCopy<false, PixelFormat::RGBA32UI>, 227 MortonCopy<false, PixelFormat::RGBA32UI>,
216 // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1/BC7U formats is not yet supported 228 // TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/BC7U/ASTC_2D_4X4 formats is not supported
217 nullptr, 229 nullptr,
218 nullptr, 230 nullptr,
219 nullptr, 231 nullptr,
@@ -221,10 +233,17 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
221 nullptr, 233 nullptr,
222 nullptr, 234 nullptr,
223 MortonCopy<false, PixelFormat::G8R8>, 235 MortonCopy<false, PixelFormat::G8R8>,
236 MortonCopy<false, PixelFormat::BGRA8>,
237 MortonCopy<false, PixelFormat::RGBA32F>,
238 MortonCopy<false, PixelFormat::RG32F>,
239 MortonCopy<false, PixelFormat::R32F>,
240 MortonCopy<false, PixelFormat::R16F>,
241 MortonCopy<false, PixelFormat::R16UNORM>,
224 MortonCopy<false, PixelFormat::Z24S8>, 242 MortonCopy<false, PixelFormat::Z24S8>,
225 MortonCopy<false, PixelFormat::S8Z24>, 243 MortonCopy<false, PixelFormat::S8Z24>,
226 MortonCopy<false, PixelFormat::Z32F>, 244 MortonCopy<false, PixelFormat::Z32F>,
227 MortonCopy<false, PixelFormat::Z16>, 245 MortonCopy<false, PixelFormat::Z16>,
246 MortonCopy<false, PixelFormat::Z32FS8>,
228}; 247};
229 248
230// 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 b084c4db4..fc864c56f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -37,14 +37,21 @@ struct SurfaceParams {
37 BC7U = 12, 37 BC7U = 12,
38 ASTC_2D_4X4 = 13, 38 ASTC_2D_4X4 = 13,
39 G8R8 = 14, 39 G8R8 = 14,
40 BGRA8 = 15,
41 RGBA32F = 16,
42 RG32F = 17,
43 R32F = 18,
44 R16F = 19,
45 R16UNORM = 20,
40 46
41 MaxColorFormat, 47 MaxColorFormat,
42 48
43 // DepthStencil formats 49 // DepthStencil formats
44 Z24S8 = 15, 50 Z24S8 = 21,
45 S8Z24 = 16, 51 S8Z24 = 22,
46 Z32F = 17, 52 Z32F = 23,
47 Z16 = 18, 53 Z16 = 24,
54 Z32FS8 = 25,
48 55
49 MaxDepthStencilFormat, 56 MaxDepthStencilFormat,
50 57
@@ -97,10 +104,17 @@ struct SurfaceParams {
97 4, // BC7U 104 4, // BC7U
98 4, // ASTC_2D_4X4 105 4, // ASTC_2D_4X4
99 1, // G8R8 106 1, // G8R8
107 1, // BGRA8
108 1, // RGBA32F
109 1, // RG32F
110 1, // R32F
111 1, // R16F
112 1, // R16UNORM
100 1, // Z24S8 113 1, // Z24S8
101 1, // S8Z24 114 1, // S8Z24
102 1, // Z32F 115 1, // Z32F
103 1, // Z16 116 1, // Z16
117 1, // Z32FS8
104 }}; 118 }};
105 119
106 ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); 120 ASSERT(static_cast<size_t>(format) < compression_factor_table.size());
@@ -127,10 +141,17 @@ struct SurfaceParams {
127 128, // BC7U 141 128, // BC7U
128 32, // ASTC_2D_4X4 142 32, // ASTC_2D_4X4
129 16, // G8R8 143 16, // G8R8
144 32, // BGRA8
145 128, // RGBA32F
146 64, // RG32F
147 32, // R32F
148 16, // R16F
149 16, // R16UNORM
130 32, // Z24S8 150 32, // Z24S8
131 32, // S8Z24 151 32, // S8Z24
132 32, // Z32F 152 32, // Z32F
133 16, // Z16 153 16, // Z16
154 64, // Z32FS8
134 }}; 155 }};
135 156
136 ASSERT(static_cast<size_t>(format) < bpp_table.size()); 157 ASSERT(static_cast<size_t>(format) < bpp_table.size());
@@ -151,6 +172,8 @@ struct SurfaceParams {
151 return PixelFormat::Z32F; 172 return PixelFormat::Z32F;
152 case Tegra::DepthFormat::Z16_UNORM: 173 case Tegra::DepthFormat::Z16_UNORM:
153 return PixelFormat::Z16; 174 return PixelFormat::Z16;
175 case Tegra::DepthFormat::Z32_S8_X24_FLOAT:
176 return PixelFormat::Z32FS8;
154 default: 177 default:
155 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 178 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
156 UNREACHABLE(); 179 UNREACHABLE();
@@ -162,21 +185,30 @@ struct SurfaceParams {
162 case Tegra::RenderTargetFormat::RGBA8_UNORM: 185 case Tegra::RenderTargetFormat::RGBA8_UNORM:
163 case Tegra::RenderTargetFormat::RGBA8_SRGB: 186 case Tegra::RenderTargetFormat::RGBA8_SRGB:
164 return PixelFormat::ABGR8; 187 return PixelFormat::ABGR8;
188 case Tegra::RenderTargetFormat::BGRA8_UNORM:
189 return PixelFormat::BGRA8;
165 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 190 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
166 return PixelFormat::A2B10G10R10; 191 return PixelFormat::A2B10G10R10;
167 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 192 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
168 return PixelFormat::RGBA16F; 193 return PixelFormat::RGBA16F;
194 case Tegra::RenderTargetFormat::RGBA32_FLOAT:
195 return PixelFormat::RGBA32F;
196 case Tegra::RenderTargetFormat::RG32_FLOAT:
197 return PixelFormat::RG32F;
169 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 198 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
170 return PixelFormat::R11FG11FB10F; 199 return PixelFormat::R11FG11FB10F;
171 case Tegra::RenderTargetFormat::RGBA32_UINT: 200 case Tegra::RenderTargetFormat::RGBA32_UINT:
172 return PixelFormat::RGBA32UI; 201 return PixelFormat::RGBA32UI;
202 case Tegra::RenderTargetFormat::R8_UNORM:
203 return PixelFormat::R8;
173 default: 204 default:
174 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 205 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
175 UNREACHABLE(); 206 UNREACHABLE();
176 } 207 }
177 } 208 }
178 209
179 static PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format) { 210 static PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
211 Tegra::Texture::ComponentType component_type) {
180 // TODO(Subv): Properly implement this 212 // TODO(Subv): Properly implement this
181 switch (format) { 213 switch (format) {
182 case Tegra::Texture::TextureFormat::A8R8G8B8: 214 case Tegra::Texture::TextureFormat::A8R8G8B8:
@@ -196,7 +228,33 @@ struct SurfaceParams {
196 case Tegra::Texture::TextureFormat::BF10GF11RF11: 228 case Tegra::Texture::TextureFormat::BF10GF11RF11:
197 return PixelFormat::R11FG11FB10F; 229 return PixelFormat::R11FG11FB10F;
198 case Tegra::Texture::TextureFormat::R32_G32_B32_A32: 230 case Tegra::Texture::TextureFormat::R32_G32_B32_A32:
199 return PixelFormat::RGBA32UI; 231 switch (component_type) {
232 case Tegra::Texture::ComponentType::FLOAT:
233 return PixelFormat::RGBA32F;
234 case Tegra::Texture::ComponentType::UINT:
235 return PixelFormat::RGBA32UI;
236 }
237 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
238 static_cast<u32>(component_type));
239 UNREACHABLE();
240 case Tegra::Texture::TextureFormat::R32_G32:
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();
252 case Tegra::Texture::TextureFormat::R32:
253 return PixelFormat::R32F;
254 case Tegra::Texture::TextureFormat::ZF32:
255 return PixelFormat::Z32F;
256 case Tegra::Texture::TextureFormat::Z24S8:
257 return PixelFormat::Z24S8;
200 case Tegra::Texture::TextureFormat::DXT1: 258 case Tegra::Texture::TextureFormat::DXT1:
201 return PixelFormat::DXT1; 259 return PixelFormat::DXT1;
202 case Tegra::Texture::TextureFormat::DXT23: 260 case Tegra::Texture::TextureFormat::DXT23:
@@ -210,7 +268,8 @@ struct SurfaceParams {
210 case Tegra::Texture::TextureFormat::ASTC_2D_4X4: 268 case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
211 return PixelFormat::ASTC_2D_4X4; 269 return PixelFormat::ASTC_2D_4X4;
212 default: 270 default:
213 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 271 LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}",
272 static_cast<u32>(format), static_cast<u32>(component_type));
214 UNREACHABLE(); 273 UNREACHABLE();
215 } 274 }
216 } 275 }
@@ -248,7 +307,25 @@ struct SurfaceParams {
248 return Tegra::Texture::TextureFormat::BC7U; 307 return Tegra::Texture::TextureFormat::BC7U;
249 case PixelFormat::ASTC_2D_4X4: 308 case PixelFormat::ASTC_2D_4X4:
250 return Tegra::Texture::TextureFormat::ASTC_2D_4X4; 309 return Tegra::Texture::TextureFormat::ASTC_2D_4X4;
310 case PixelFormat::BGRA8:
311 // TODO(bunnei): This is fine for unswizzling (since we just need the right component
312 // sizes), but could be a bug if we used this function in different ways.
313 return Tegra::Texture::TextureFormat::A8R8G8B8;
314 case PixelFormat::RGBA32F:
315 return Tegra::Texture::TextureFormat::R32_G32_B32_A32;
316 case PixelFormat::RG32F:
317 return Tegra::Texture::TextureFormat::R32_G32;
318 case PixelFormat::R32F:
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;
251 default: 327 default:
328 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
252 UNREACHABLE(); 329 UNREACHABLE();
253 } 330 }
254 } 331 }
@@ -263,7 +340,10 @@ struct SurfaceParams {
263 return Tegra::DepthFormat::Z32_FLOAT; 340 return Tegra::DepthFormat::Z32_FLOAT;
264 case PixelFormat::Z16: 341 case PixelFormat::Z16:
265 return Tegra::DepthFormat::Z16_UNORM; 342 return Tegra::DepthFormat::Z16_UNORM;
343 case PixelFormat::Z32FS8:
344 return Tegra::DepthFormat::Z32_S8_X24_FLOAT;
266 default: 345 default:
346 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
267 UNREACHABLE(); 347 UNREACHABLE();
268 } 348 }
269 } 349 }
@@ -273,6 +353,8 @@ struct SurfaceParams {
273 switch (type) { 353 switch (type) {
274 case Tegra::Texture::ComponentType::UNORM: 354 case Tegra::Texture::ComponentType::UNORM:
275 return ComponentType::UNorm; 355 return ComponentType::UNorm;
356 case Tegra::Texture::ComponentType::FLOAT:
357 return ComponentType::Float;
276 default: 358 default:
277 LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); 359 LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type));
278 UNREACHABLE(); 360 UNREACHABLE();
@@ -284,10 +366,14 @@ struct SurfaceParams {
284 switch (format) { 366 switch (format) {
285 case Tegra::RenderTargetFormat::RGBA8_UNORM: 367 case Tegra::RenderTargetFormat::RGBA8_UNORM:
286 case Tegra::RenderTargetFormat::RGBA8_SRGB: 368 case Tegra::RenderTargetFormat::RGBA8_SRGB:
369 case Tegra::RenderTargetFormat::BGRA8_UNORM:
287 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 370 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
371 case Tegra::RenderTargetFormat::R8_UNORM:
288 return ComponentType::UNorm; 372 return ComponentType::UNorm;
289 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 373 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
290 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 374 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
375 case Tegra::RenderTargetFormat::RGBA32_FLOAT:
376 case Tegra::RenderTargetFormat::RG32_FLOAT:
291 return ComponentType::Float; 377 return ComponentType::Float;
292 case Tegra::RenderTargetFormat::RGBA32_UINT: 378 case Tegra::RenderTargetFormat::RGBA32_UINT:
293 return ComponentType::UInt; 379 return ComponentType::UInt;
@@ -314,6 +400,7 @@ struct SurfaceParams {
314 case Tegra::DepthFormat::Z24_S8_UNORM: 400 case Tegra::DepthFormat::Z24_S8_UNORM:
315 return ComponentType::UNorm; 401 return ComponentType::UNorm;
316 case Tegra::DepthFormat::Z32_FLOAT: 402 case Tegra::DepthFormat::Z32_FLOAT:
403 case Tegra::DepthFormat::Z32_S8_X24_FLOAT:
317 return ComponentType::Float; 404 return ComponentType::Float;
318 default: 405 default:
319 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/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index d4b1a6f33..acf067050 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -756,8 +756,8 @@ private:
756 } 756 }
757 } 757 }
758 758
759 std::string WriteTexsInstruction(const Instruction& instr, const std::string& coord, 759 void WriteTexsInstruction(const Instruction& instr, const std::string& coord,
760 const std::string& texture) { 760 const std::string& texture) {
761 // Add an extra scope and declare the texture coords inside to prevent 761 // Add an extra scope and declare the texture coords inside to prevent
762 // overwriting them in case they are used as outputs of the texs instruction. 762 // overwriting them in case they are used as outputs of the texs instruction.
763 shader.AddLine('{'); 763 shader.AddLine('{');
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
index e19c3b280..16b1bd606 100644
--- a/src/video_core/renderer_opengl/maxwell_to_gl.h
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -56,6 +56,9 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
56 return {}; 56 return {};
57 } 57 }
58 58
59 case Maxwell::VertexAttribute::Type::UnsignedInt:
60 return GL_UNSIGNED_INT;
61
59 case Maxwell::VertexAttribute::Type::Float: 62 case Maxwell::VertexAttribute::Type::Float:
60 return GL_FLOAT; 63 return GL_FLOAT;
61 } 64 }
@@ -112,6 +115,8 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
112 return GL_MIRRORED_REPEAT; 115 return GL_MIRRORED_REPEAT;
113 case Tegra::Texture::WrapMode::ClampToEdge: 116 case Tegra::Texture::WrapMode::ClampToEdge:
114 return GL_CLAMP_TO_EDGE; 117 return GL_CLAMP_TO_EDGE;
118 case Tegra::Texture::WrapMode::Border:
119 return GL_CLAMP_TO_BORDER;
115 case Tegra::Texture::WrapMode::ClampOGL: 120 case Tegra::Texture::WrapMode::ClampOGL:
116 // TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use 121 // TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use
117 // GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to 122 // GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index a3e67d105..50c5a56f6 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -61,10 +61,12 @@ u32 BytesPerPixel(TextureFormat format) {
61 case TextureFormat::A8R8G8B8: 61 case TextureFormat::A8R8G8B8:
62 case TextureFormat::A2B10G10R10: 62 case TextureFormat::A2B10G10R10:
63 case TextureFormat::BF10GF11RF11: 63 case TextureFormat::BF10GF11RF11:
64 case TextureFormat::R32:
64 return 4; 65 return 4;
65 case TextureFormat::A1B5G5R5: 66 case TextureFormat::A1B5G5R5:
66 case TextureFormat::B5G6R5: 67 case TextureFormat::B5G6R5:
67 case TextureFormat::G8R8: 68 case TextureFormat::G8R8:
69 case TextureFormat::R16:
68 return 2; 70 return 2;
69 case TextureFormat::R8: 71 case TextureFormat::R8:
70 return 1; 72 return 1;
@@ -72,6 +74,8 @@ u32 BytesPerPixel(TextureFormat format) {
72 return 8; 74 return 8;
73 case TextureFormat::R32_G32_B32_A32: 75 case TextureFormat::R32_G32_B32_A32:
74 return 16; 76 return 16;
77 case TextureFormat::R32_G32:
78 return 8;
75 default: 79 default:
76 UNIMPLEMENTED_MSG("Format not implemented"); 80 UNIMPLEMENTED_MSG("Format not implemented");
77 break; 81 break;
@@ -86,6 +90,8 @@ static u32 DepthBytesPerPixel(DepthFormat format) {
86 case DepthFormat::Z24_S8_UNORM: 90 case DepthFormat::Z24_S8_UNORM:
87 case DepthFormat::Z32_FLOAT: 91 case DepthFormat::Z32_FLOAT:
88 return 4; 92 return 4;
93 case DepthFormat::Z32_S8_X24_FLOAT:
94 return 8;
89 default: 95 default:
90 UNIMPLEMENTED_MSG("Format not implemented"); 96 UNIMPLEMENTED_MSG("Format not implemented");
91 break; 97 break;
@@ -118,6 +124,9 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
118 case TextureFormat::G8R8: 124 case TextureFormat::G8R8:
119 case TextureFormat::R16_G16_B16_A16: 125 case TextureFormat::R16_G16_B16_A16:
120 case TextureFormat::R32_G32_B32_A32: 126 case TextureFormat::R32_G32_B32_A32:
127 case TextureFormat::R32_G32:
128 case TextureFormat::R32:
129 case TextureFormat::R16:
121 case TextureFormat::BF10GF11RF11: 130 case TextureFormat::BF10GF11RF11:
122 case TextureFormat::ASTC_2D_4X4: 131 case TextureFormat::ASTC_2D_4X4:
123 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 132 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
@@ -143,6 +152,7 @@ std::vector<u8> UnswizzleDepthTexture(VAddr address, DepthFormat format, u32 wid
143 case DepthFormat::S8_Z24_UNORM: 152 case DepthFormat::S8_Z24_UNORM:
144 case DepthFormat::Z24_S8_UNORM: 153 case DepthFormat::Z24_S8_UNORM:
145 case DepthFormat::Z32_FLOAT: 154 case DepthFormat::Z32_FLOAT:
155 case DepthFormat::Z32_S8_X24_FLOAT:
146 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 156 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
147 unswizzled_data.data(), true, block_height); 157 unswizzled_data.data(), true, block_height);
148 break; 158 break;
@@ -174,6 +184,9 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
174 case TextureFormat::G8R8: 184 case TextureFormat::G8R8:
175 case TextureFormat::BF10GF11RF11: 185 case TextureFormat::BF10GF11RF11:
176 case TextureFormat::R32_G32_B32_A32: 186 case TextureFormat::R32_G32_B32_A32:
187 case TextureFormat::R32_G32:
188 case TextureFormat::R32:
189 case TextureFormat::R16:
177 // 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.
178 rgba_data = texture_data; 191 rgba_data = texture_data;
179 break; 192 break;
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h
index d1c755033..c6bd2f4b9 100644
--- a/src/video_core/textures/texture.h
+++ b/src/video_core/textures/texture.h
@@ -242,10 +242,10 @@ struct TSCEntry {
242 BitField<6, 2, TextureMipmapFilter> mip_filter; 242 BitField<6, 2, TextureMipmapFilter> mip_filter;
243 }; 243 };
244 INSERT_PADDING_BYTES(8); 244 INSERT_PADDING_BYTES(8);
245 u32 border_color_r; 245 float border_color_r;
246 u32 border_color_g; 246 float border_color_g;
247 u32 border_color_b; 247 float border_color_b;
248 u32 border_color_a; 248 float border_color_a;
249}; 249};
250static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size"); 250static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size");
251 251
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(