summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/file_sys/system_archive/mii_model.cpp2
-rw-r--r--src/core/file_sys/system_archive/shared_font.cpp2
-rw-r--r--src/core/hle/kernel/memory/memory_manager.cpp4
-rw-r--r--src/input_common/keyboard.cpp2
-rw-r--r--src/input_common/motion_emu.cpp2
-rw-r--r--src/video_core/macro/macro_jit_x64.cpp51
-rw-r--r--src/video_core/macro/macro_jit_x64.h1
-rw-r--r--src/video_core/query_cache.h10
-rw-r--r--src/video_core/renderer_vulkan/renderer_vulkan.cpp4
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp2
-rw-r--r--src/video_core/shader/memory_util.cpp4
-rw-r--r--src/video_core/shader_cache.h10
-rw-r--r--src/yuzu/CMakeLists.txt4
-rw-r--r--src/yuzu/bootmanager.cpp17
-rw-r--r--src/yuzu/configuration/configure_service.cpp6
16 files changed, 78 insertions, 47 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 47418006b..cb9ced5c9 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -606,11 +606,11 @@ endif()
606create_target_directory_groups(core) 606create_target_directory_groups(core)
607 607
608target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) 608target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)
609target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus unicorn) 609target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus unicorn zip)
610 610
611if (YUZU_ENABLE_BOXCAT) 611if (YUZU_ENABLE_BOXCAT)
612 target_compile_definitions(core PRIVATE -DYUZU_ENABLE_BOXCAT) 612 target_compile_definitions(core PRIVATE -DYUZU_ENABLE_BOXCAT)
613 target_link_libraries(core PRIVATE httplib nlohmann_json::nlohmann_json zip) 613 target_link_libraries(core PRIVATE httplib nlohmann_json::nlohmann_json)
614endif() 614endif()
615 615
616if (ENABLE_WEB_SERVICE) 616if (ENABLE_WEB_SERVICE)
diff --git a/src/core/file_sys/system_archive/mii_model.cpp b/src/core/file_sys/system_archive/mii_model.cpp
index 6a9add87c..61bb67945 100644
--- a/src/core/file_sys/system_archive/mii_model.cpp
+++ b/src/core/file_sys/system_archive/mii_model.cpp
@@ -40,7 +40,7 @@ VirtualDir MiiModel() {
40 out->AddFile(std::make_shared<ArrayVfsFile<MiiModelData::SHAPE_MID.size()>>( 40 out->AddFile(std::make_shared<ArrayVfsFile<MiiModelData::SHAPE_MID.size()>>(
41 MiiModelData::SHAPE_MID, "ShapeMid.dat")); 41 MiiModelData::SHAPE_MID, "ShapeMid.dat"));
42 42
43 return std::move(out); 43 return out;
44} 44}
45 45
46} // namespace FileSys::SystemArchive 46} // namespace FileSys::SystemArchive
diff --git a/src/core/file_sys/system_archive/shared_font.cpp b/src/core/file_sys/system_archive/shared_font.cpp
index 2c05eb42e..c5cdf7d9b 100644
--- a/src/core/file_sys/system_archive/shared_font.cpp
+++ b/src/core/file_sys/system_archive/shared_font.cpp
@@ -23,7 +23,7 @@ VirtualFile PackBFTTF(const std::array<u8, Size>& data, const std::string& name)
23 23
24 std::vector<u8> bfttf(Size + sizeof(u64)); 24 std::vector<u8> bfttf(Size + sizeof(u64));
25 25
26 u64 offset = 0; 26 size_t offset = 0;
27 Service::NS::EncryptSharedFont(vec, bfttf, offset); 27 Service::NS::EncryptSharedFont(vec, bfttf, offset);
28 return std::make_shared<VectorVfsFile>(std::move(bfttf), name); 28 return std::make_shared<VectorVfsFile>(std::move(bfttf), name);
29} 29}
diff --git a/src/core/hle/kernel/memory/memory_manager.cpp b/src/core/hle/kernel/memory/memory_manager.cpp
index 6b432e1b2..616148190 100644
--- a/src/core/hle/kernel/memory/memory_manager.cpp
+++ b/src/core/hle/kernel/memory/memory_manager.cpp
@@ -104,7 +104,7 @@ ResultCode MemoryManager::Allocate(PageLinkedList& page_list, std::size_t num_pa
104 // Ensure that we don't leave anything un-freed 104 // Ensure that we don't leave anything un-freed
105 auto group_guard = detail::ScopeExit([&] { 105 auto group_guard = detail::ScopeExit([&] {
106 for (const auto& it : page_list.Nodes()) { 106 for (const auto& it : page_list.Nodes()) {
107 const auto min_num_pages{std::min( 107 const auto min_num_pages{std::min<size_t>(
108 it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; 108 it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)};
109 chosen_manager.Free(it.GetAddress(), min_num_pages); 109 chosen_manager.Free(it.GetAddress(), min_num_pages);
110 } 110 }
@@ -165,7 +165,7 @@ ResultCode MemoryManager::Free(PageLinkedList& page_list, std::size_t num_pages,
165 165
166 // Free all of the pages 166 // Free all of the pages
167 for (const auto& it : page_list.Nodes()) { 167 for (const auto& it : page_list.Nodes()) {
168 const auto min_num_pages{std::min( 168 const auto min_num_pages{std::min<size_t>(
169 it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; 169 it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)};
170 chosen_manager.Free(it.GetAddress(), min_num_pages); 170 chosen_manager.Free(it.GetAddress(), min_num_pages);
171 } 171 }
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp
index 078374be5..afb8e6612 100644
--- a/src/input_common/keyboard.cpp
+++ b/src/input_common/keyboard.cpp
@@ -76,7 +76,7 @@ std::unique_ptr<Input::ButtonDevice> Keyboard::Create(const Common::ParamPackage
76 int key_code = params.Get("code", 0); 76 int key_code = params.Get("code", 0);
77 std::unique_ptr<KeyButton> button = std::make_unique<KeyButton>(key_button_list); 77 std::unique_ptr<KeyButton> button = std::make_unique<KeyButton>(key_button_list);
78 key_button_list->AddKeyButton(key_code, button.get()); 78 key_button_list->AddKeyButton(key_code, button.get());
79 return std::move(button); 79 return button;
80} 80}
81 81
82void Keyboard::PressKey(int key_code) { 82void Keyboard::PressKey(int key_code) {
diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp
index 868251628..d4cdf76a3 100644
--- a/src/input_common/motion_emu.cpp
+++ b/src/input_common/motion_emu.cpp
@@ -145,7 +145,7 @@ std::unique_ptr<Input::MotionDevice> MotionEmu::Create(const Common::ParamPackag
145 // Previously created device is disconnected here. Having two motion devices for 3DS is not 145 // Previously created device is disconnected here. Having two motion devices for 3DS is not
146 // expected. 146 // expected.
147 current_device = device_wrapper->device; 147 current_device = device_wrapper->device;
148 return std::move(device_wrapper); 148 return device_wrapper;
149} 149}
150 150
151void MotionEmu::BeginTilt(int x, int y) { 151void MotionEmu::BeginTilt(int x, int y) {
diff --git a/src/video_core/macro/macro_jit_x64.cpp b/src/video_core/macro/macro_jit_x64.cpp
index bee34a7c0..389b58989 100644
--- a/src/video_core/macro/macro_jit_x64.cpp
+++ b/src/video_core/macro/macro_jit_x64.cpp
@@ -54,7 +54,7 @@ void MacroJITx64Impl::Compile_ALU(Macro::Opcode opcode) {
54 const bool is_a_zero = opcode.src_a == 0; 54 const bool is_a_zero = opcode.src_a == 0;
55 const bool is_b_zero = opcode.src_b == 0; 55 const bool is_b_zero = opcode.src_b == 0;
56 const bool valid_operation = !is_a_zero && !is_b_zero; 56 const bool valid_operation = !is_a_zero && !is_b_zero;
57 const bool is_move_operation = !is_a_zero && is_b_zero; 57 [[maybe_unused]] const bool is_move_operation = !is_a_zero && is_b_zero;
58 const bool has_zero_register = is_a_zero || is_b_zero; 58 const bool has_zero_register = is_a_zero || is_b_zero;
59 const bool no_zero_reg_skip = opcode.alu_operation == Macro::ALUOperation::AddWithCarry || 59 const bool no_zero_reg_skip = opcode.alu_operation == Macro::ALUOperation::AddWithCarry ||
60 opcode.alu_operation == Macro::ALUOperation::SubtractWithBorrow; 60 opcode.alu_operation == Macro::ALUOperation::SubtractWithBorrow;
@@ -73,7 +73,6 @@ void MacroJITx64Impl::Compile_ALU(Macro::Opcode opcode) {
73 src_b = Compile_GetRegister(opcode.src_b, eax); 73 src_b = Compile_GetRegister(opcode.src_b, eax);
74 } 74 }
75 } 75 }
76 Xbyak::Label skip_carry{};
77 76
78 bool has_emitted = false; 77 bool has_emitted = false;
79 78
@@ -240,10 +239,10 @@ void MacroJITx64Impl::Compile_ExtractInsert(Macro::Opcode opcode) {
240} 239}
241 240
242void MacroJITx64Impl::Compile_ExtractShiftLeftImmediate(Macro::Opcode opcode) { 241void MacroJITx64Impl::Compile_ExtractShiftLeftImmediate(Macro::Opcode opcode) {
243 auto dst = Compile_GetRegister(opcode.src_a, eax); 242 const auto dst = Compile_GetRegister(opcode.src_a, ecx);
244 auto src = Compile_GetRegister(opcode.src_b, RESULT); 243 const auto src = Compile_GetRegister(opcode.src_b, RESULT);
245 244
246 shr(src, al); 245 shr(src, dst.cvt8());
247 if (opcode.bf_size != 0 && opcode.bf_size != 31) { 246 if (opcode.bf_size != 0 && opcode.bf_size != 31) {
248 and_(src, opcode.GetBitfieldMask()); 247 and_(src, opcode.GetBitfieldMask());
249 } else if (opcode.bf_size == 0) { 248 } else if (opcode.bf_size == 0) {
@@ -259,8 +258,8 @@ void MacroJITx64Impl::Compile_ExtractShiftLeftImmediate(Macro::Opcode opcode) {
259} 258}
260 259
261void MacroJITx64Impl::Compile_ExtractShiftLeftRegister(Macro::Opcode opcode) { 260void MacroJITx64Impl::Compile_ExtractShiftLeftRegister(Macro::Opcode opcode) {
262 auto dst = Compile_GetRegister(opcode.src_a, eax); 261 const auto dst = Compile_GetRegister(opcode.src_a, ecx);
263 auto src = Compile_GetRegister(opcode.src_b, RESULT); 262 const auto src = Compile_GetRegister(opcode.src_b, RESULT);
264 263
265 if (opcode.bf_src_bit != 0) { 264 if (opcode.bf_src_bit != 0) {
266 shr(src, opcode.bf_src_bit); 265 shr(src, opcode.bf_src_bit);
@@ -269,16 +268,9 @@ void MacroJITx64Impl::Compile_ExtractShiftLeftRegister(Macro::Opcode opcode) {
269 if (opcode.bf_size != 31) { 268 if (opcode.bf_size != 31) {
270 and_(src, opcode.GetBitfieldMask()); 269 and_(src, opcode.GetBitfieldMask());
271 } 270 }
272 shl(src, al); 271 shl(src, dst.cvt8());
273 Compile_ProcessResult(opcode.result_operation, opcode.dst);
274}
275 272
276static u32 Read(Engines::Maxwell3D* maxwell3d, u32 method) { 273 Compile_ProcessResult(opcode.result_operation, opcode.dst);
277 return maxwell3d->GetRegisterValue(method);
278}
279
280static void Send(Engines::Maxwell3D* maxwell3d, Macro::MethodAddress method_address, u32 value) {
281 maxwell3d->CallMethodFromMME(method_address.address, value);
282} 274}
283 275
284void MacroJITx64Impl::Compile_Read(Macro::Opcode opcode) { 276void MacroJITx64Impl::Compile_Read(Macro::Opcode opcode) {
@@ -298,15 +290,27 @@ void MacroJITx64Impl::Compile_Read(Macro::Opcode opcode) {
298 sub(result, opcode.immediate * -1); 290 sub(result, opcode.immediate * -1);
299 } 291 }
300 } 292 }
301 Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); 293
302 mov(Common::X64::ABI_PARAM1, qword[STATE]); 294 // Equivalent to Engines::Maxwell3D::GetRegisterValue:
303 mov(Common::X64::ABI_PARAM2, RESULT); 295 if (optimizer.enable_asserts) {
304 Common::X64::CallFarFunction(*this, &Read); 296 Xbyak::Label pass_range_check;
305 Common::X64::ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); 297 cmp(RESULT, static_cast<u32>(Engines::Maxwell3D::Regs::NUM_REGS));
306 mov(RESULT, Common::X64::ABI_RETURN.cvt32()); 298 jb(pass_range_check);
299 int3();
300 L(pass_range_check);
301 }
302 mov(rax, qword[STATE]);
303 mov(RESULT,
304 dword[rax + offsetof(Engines::Maxwell3D, regs) +
305 offsetof(Engines::Maxwell3D::Regs, reg_array) + RESULT.cvt64() * sizeof(u32)]);
306
307 Compile_ProcessResult(opcode.result_operation, opcode.dst); 307 Compile_ProcessResult(opcode.result_operation, opcode.dst);
308} 308}
309 309
310static void Send(Engines::Maxwell3D* maxwell3d, Macro::MethodAddress method_address, u32 value) {
311 maxwell3d->CallMethodFromMME(method_address.address, value);
312}
313
310void Tegra::MacroJITx64Impl::Compile_Send(Xbyak::Reg32 value) { 314void Tegra::MacroJITx64Impl::Compile_Send(Xbyak::Reg32 value) {
311 Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); 315 Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
312 mov(Common::X64::ABI_PARAM1, qword[STATE]); 316 mov(Common::X64::ABI_PARAM1, qword[STATE]);
@@ -438,6 +442,9 @@ void MacroJITx64Impl::Compile() {
438 // one if our register isn't "dirty" 442 // one if our register isn't "dirty"
439 optimizer.optimize_for_method_move = true; 443 optimizer.optimize_for_method_move = true;
440 444
445 // Enable run-time assertions in JITted code
446 optimizer.enable_asserts = false;
447
441 // Check to see if we can skip emitting certain instructions 448 // Check to see if we can skip emitting certain instructions
442 Optimizer_ScanFlags(); 449 Optimizer_ScanFlags();
443 450
diff --git a/src/video_core/macro/macro_jit_x64.h b/src/video_core/macro/macro_jit_x64.h
index 51ec090b8..a180e7428 100644
--- a/src/video_core/macro/macro_jit_x64.h
+++ b/src/video_core/macro/macro_jit_x64.h
@@ -76,6 +76,7 @@ private:
76 bool zero_reg_skip{}; 76 bool zero_reg_skip{};
77 bool skip_dummy_addimmediate{}; 77 bool skip_dummy_addimmediate{};
78 bool optimize_for_method_move{}; 78 bool optimize_for_method_move{};
79 bool enable_asserts{};
79 }; 80 };
80 OptimizerState optimizer{}; 81 OptimizerState optimizer{};
81 82
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h
index 2f75f8801..e12dab899 100644
--- a/src/video_core/query_cache.h
+++ b/src/video_core/query_cache.h
@@ -220,8 +220,8 @@ private:
220 return cache_begin < addr_end && addr_begin < cache_end; 220 return cache_begin < addr_end && addr_begin < cache_end;
221 }; 221 };
222 222
223 const u64 page_end = addr_end >> PAGE_SHIFT; 223 const u64 page_end = addr_end >> PAGE_BITS;
224 for (u64 page = addr_begin >> PAGE_SHIFT; page <= page_end; ++page) { 224 for (u64 page = addr_begin >> PAGE_BITS; page <= page_end; ++page) {
225 const auto& it = cached_queries.find(page); 225 const auto& it = cached_queries.find(page);
226 if (it == std::end(cached_queries)) { 226 if (it == std::end(cached_queries)) {
227 continue; 227 continue;
@@ -242,14 +242,14 @@ private:
242 /// Registers the passed parameters as cached and returns a pointer to the stored cached query. 242 /// Registers the passed parameters as cached and returns a pointer to the stored cached query.
243 CachedQuery* Register(VideoCore::QueryType type, VAddr cpu_addr, u8* host_ptr, bool timestamp) { 243 CachedQuery* Register(VideoCore::QueryType type, VAddr cpu_addr, u8* host_ptr, bool timestamp) {
244 rasterizer.UpdatePagesCachedCount(cpu_addr, CachedQuery::SizeInBytes(timestamp), 1); 244 rasterizer.UpdatePagesCachedCount(cpu_addr, CachedQuery::SizeInBytes(timestamp), 1);
245 const u64 page = static_cast<u64>(cpu_addr) >> PAGE_SHIFT; 245 const u64 page = static_cast<u64>(cpu_addr) >> PAGE_BITS;
246 return &cached_queries[page].emplace_back(static_cast<QueryCache&>(*this), type, cpu_addr, 246 return &cached_queries[page].emplace_back(static_cast<QueryCache&>(*this), type, cpu_addr,
247 host_ptr); 247 host_ptr);
248 } 248 }
249 249
250 /// Tries to a get a cached query. Returns nullptr on failure. 250 /// Tries to a get a cached query. Returns nullptr on failure.
251 CachedQuery* TryGet(VAddr addr) { 251 CachedQuery* TryGet(VAddr addr) {
252 const u64 page = static_cast<u64>(addr) >> PAGE_SHIFT; 252 const u64 page = static_cast<u64>(addr) >> PAGE_BITS;
253 const auto it = cached_queries.find(page); 253 const auto it = cached_queries.find(page);
254 if (it == std::end(cached_queries)) { 254 if (it == std::end(cached_queries)) {
255 return nullptr; 255 return nullptr;
@@ -268,7 +268,7 @@ private:
268 } 268 }
269 269
270 static constexpr std::uintptr_t PAGE_SIZE = 4096; 270 static constexpr std::uintptr_t PAGE_SIZE = 4096;
271 static constexpr unsigned PAGE_SHIFT = 12; 271 static constexpr unsigned PAGE_BITS = 12;
272 272
273 Core::System& system; 273 Core::System& system;
274 VideoCore::RasterizerInterface& rasterizer; 274 VideoCore::RasterizerInterface& rasterizer;
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
index 59b441943..cd9673d1f 100644
--- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp
+++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
@@ -13,6 +13,7 @@
13#include <fmt/format.h> 13#include <fmt/format.h>
14 14
15#include "common/dynamic_library.h" 15#include "common/dynamic_library.h"
16#include "common/file_util.h"
16#include "common/logging/log.h" 17#include "common/logging/log.h"
17#include "common/telemetry.h" 18#include "common/telemetry.h"
18#include "core/core.h" 19#include "core/core.h"
@@ -76,7 +77,8 @@ Common::DynamicLibrary OpenVulkanLibrary() {
76 char* libvulkan_env = getenv("LIBVULKAN_PATH"); 77 char* libvulkan_env = getenv("LIBVULKAN_PATH");
77 if (!libvulkan_env || !library.Open(libvulkan_env)) { 78 if (!libvulkan_env || !library.Open(libvulkan_env)) {
78 // Use the libvulkan.dylib from the application bundle. 79 // Use the libvulkan.dylib from the application bundle.
79 std::string filename = File::GetBundleDirectory() + "/Contents/Frameworks/libvulkan.dylib"; 80 const std::string filename =
81 FileUtil::GetBundleDirectory() + "/Contents/Frameworks/libvulkan.dylib";
80 library.Open(filename.c_str()); 82 library.Open(filename.c_str());
81 } 83 }
82#else 84#else
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 184b2238a..a77fa35c3 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -870,7 +870,7 @@ void RasterizerVulkan::BeginTransformFeedback() {
870 UNIMPLEMENTED_IF(binding.buffer_offset != 0); 870 UNIMPLEMENTED_IF(binding.buffer_offset != 0);
871 871
872 const GPUVAddr gpu_addr = binding.Address(); 872 const GPUVAddr gpu_addr = binding.Address();
873 const std::size_t size = binding.buffer_size; 873 const auto size = static_cast<VkDeviceSize>(binding.buffer_size);
874 const auto [buffer, offset] = buffer_cache.UploadMemory(gpu_addr, size, 4, true); 874 const auto [buffer, offset] = buffer_cache.UploadMemory(gpu_addr, size, 4, true);
875 875
876 scheduler.Record([buffer = buffer, offset = offset, size](vk::CommandBuffer cmdbuf) { 876 scheduler.Record([buffer = buffer, offset = offset, size](vk::CommandBuffer cmdbuf) {
diff --git a/src/video_core/shader/memory_util.cpp b/src/video_core/shader/memory_util.cpp
index 074f21691..5071c83ca 100644
--- a/src/video_core/shader/memory_util.cpp
+++ b/src/video_core/shader/memory_util.cpp
@@ -66,12 +66,12 @@ ProgramCode GetShaderCode(Tegra::MemoryManager& memory_manager, GPUVAddr gpu_add
66 66
67u64 GetUniqueIdentifier(Tegra::Engines::ShaderType shader_type, bool is_a, const ProgramCode& code, 67u64 GetUniqueIdentifier(Tegra::Engines::ShaderType shader_type, bool is_a, const ProgramCode& code,
68 const ProgramCode& code_b) { 68 const ProgramCode& code_b) {
69 u64 unique_identifier = boost::hash_value(code); 69 size_t unique_identifier = boost::hash_value(code);
70 if (is_a) { 70 if (is_a) {
71 // VertexA programs include two programs 71 // VertexA programs include two programs
72 boost::hash_combine(unique_identifier, boost::hash_value(code_b)); 72 boost::hash_combine(unique_identifier, boost::hash_value(code_b));
73 } 73 }
74 return unique_identifier; 74 return static_cast<u64>(unique_identifier);
75} 75}
76 76
77} // namespace VideoCommon::Shader 77} // namespace VideoCommon::Shader
diff --git a/src/video_core/shader_cache.h b/src/video_core/shader_cache.h
index a23c23886..2dd270e99 100644
--- a/src/video_core/shader_cache.h
+++ b/src/video_core/shader_cache.h
@@ -19,7 +19,7 @@ namespace VideoCommon {
19 19
20template <class T> 20template <class T>
21class ShaderCache { 21class ShaderCache {
22 static constexpr u64 PAGE_SHIFT = 14; 22 static constexpr u64 PAGE_BITS = 14;
23 23
24 struct Entry { 24 struct Entry {
25 VAddr addr_start; 25 VAddr addr_start;
@@ -87,8 +87,8 @@ protected:
87 const VAddr addr_end = addr + size; 87 const VAddr addr_end = addr + size;
88 Entry* const entry = NewEntry(addr, addr_end, data.get()); 88 Entry* const entry = NewEntry(addr, addr_end, data.get());
89 89
90 const u64 page_end = addr_end >> PAGE_SHIFT; 90 const u64 page_end = addr_end >> PAGE_BITS;
91 for (u64 page = addr >> PAGE_SHIFT; page <= page_end; ++page) { 91 for (u64 page = addr >> PAGE_BITS; page <= page_end; ++page) {
92 invalidation_cache[page].push_back(entry); 92 invalidation_cache[page].push_back(entry);
93 } 93 }
94 94
@@ -108,8 +108,8 @@ private:
108 /// @pre invalidation_mutex is locked 108 /// @pre invalidation_mutex is locked
109 void InvalidatePagesInRegion(VAddr addr, std::size_t size) { 109 void InvalidatePagesInRegion(VAddr addr, std::size_t size) {
110 const VAddr addr_end = addr + size; 110 const VAddr addr_end = addr + size;
111 const u64 page_end = addr_end >> PAGE_SHIFT; 111 const u64 page_end = addr_end >> PAGE_BITS;
112 for (u64 page = addr >> PAGE_SHIFT; page <= page_end; ++page) { 112 for (u64 page = addr >> PAGE_BITS; page <= page_end; ++page) {
113 const auto it = invalidation_cache.find(page); 113 const auto it = invalidation_cache.find(page);
114 if (it == invalidation_cache.end()) { 114 if (it == invalidation_cache.end()) {
115 continue; 115 continue;
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 8b9404718..75c27e39e 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -208,6 +208,10 @@ if (MSVC)
208 copy_yuzu_unicorn_deps(yuzu) 208 copy_yuzu_unicorn_deps(yuzu)
209endif() 209endif()
210 210
211if (NOT APPLE)
212 target_compile_definitions(yuzu PRIVATE HAS_OPENGL)
213endif()
214
211if (ENABLE_VULKAN) 215if (ENABLE_VULKAN)
212 target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include) 216 target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include)
213 target_compile_definitions(yuzu PRIVATE HAS_VULKAN) 217 target_compile_definitions(yuzu PRIVATE HAS_VULKAN)
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 1f5e43043..696da2137 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -8,13 +8,16 @@
8#include <QHBoxLayout> 8#include <QHBoxLayout>
9#include <QKeyEvent> 9#include <QKeyEvent>
10#include <QMessageBox> 10#include <QMessageBox>
11#include <QOffscreenSurface>
12#include <QOpenGLContext>
13#include <QPainter> 11#include <QPainter>
14#include <QScreen> 12#include <QScreen>
15#include <QStringList> 13#include <QStringList>
16#include <QWindow> 14#include <QWindow>
17 15
16#ifdef HAS_OPENGL
17#include <QOffscreenSurface>
18#include <QOpenGLContext>
19#endif
20
18#if !defined(WIN32) && HAS_VULKAN 21#if !defined(WIN32) && HAS_VULKAN
19#include <qpa/qplatformnativeinterface.h> 22#include <qpa/qplatformnativeinterface.h>
20#endif 23#endif
@@ -98,6 +101,7 @@ void EmuThread::run() {
98#endif 101#endif
99} 102}
100 103
104#ifdef HAS_OPENGL
101class OpenGLSharedContext : public Core::Frontend::GraphicsContext { 105class OpenGLSharedContext : public Core::Frontend::GraphicsContext {
102public: 106public:
103 /// Create the original context that should be shared from 107 /// Create the original context that should be shared from
@@ -183,6 +187,7 @@ private:
183 std::unique_ptr<QOffscreenSurface> offscreen_surface{}; 187 std::unique_ptr<QOffscreenSurface> offscreen_surface{};
184 QSurface* surface; 188 QSurface* surface;
185}; 189};
190#endif
186 191
187class DummyContext : public Core::Frontend::GraphicsContext {}; 192class DummyContext : public Core::Frontend::GraphicsContext {};
188 193
@@ -473,6 +478,7 @@ void GRenderWindow::resizeEvent(QResizeEvent* event) {
473} 478}
474 479
475std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedContext() const { 480std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedContext() const {
481#ifdef HAS_OPENGL
476 if (Settings::values.renderer_backend == Settings::RendererBackend::OpenGL) { 482 if (Settings::values.renderer_backend == Settings::RendererBackend::OpenGL) {
477 auto c = static_cast<OpenGLSharedContext*>(main_context.get()); 483 auto c = static_cast<OpenGLSharedContext*>(main_context.get());
478 // Bind the shared contexts to the main surface in case the backend wants to take over 484 // Bind the shared contexts to the main surface in case the backend wants to take over
@@ -480,6 +486,7 @@ std::unique_ptr<Core::Frontend::GraphicsContext> GRenderWindow::CreateSharedCont
480 return std::make_unique<OpenGLSharedContext>(c->GetShareContext(), 486 return std::make_unique<OpenGLSharedContext>(c->GetShareContext(),
481 child_widget->windowHandle()); 487 child_widget->windowHandle());
482 } 488 }
489#endif
483 return std::make_unique<DummyContext>(); 490 return std::make_unique<DummyContext>();
484} 491}
485 492
@@ -560,6 +567,7 @@ void GRenderWindow::OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal
560} 567}
561 568
562bool GRenderWindow::InitializeOpenGL() { 569bool GRenderWindow::InitializeOpenGL() {
570#ifdef HAS_OPENGL
563 // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, 571 // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground,
564 // WA_DontShowOnScreen, WA_DeleteOnClose 572 // WA_DontShowOnScreen, WA_DeleteOnClose
565 auto child = new OpenGLRenderWidget(this); 573 auto child = new OpenGLRenderWidget(this);
@@ -571,6 +579,11 @@ bool GRenderWindow::InitializeOpenGL() {
571 std::make_unique<OpenGLSharedContext>(context->GetShareContext(), child->windowHandle())); 579 std::make_unique<OpenGLSharedContext>(context->GetShareContext(), child->windowHandle()));
572 580
573 return true; 581 return true;
582#else
583 QMessageBox::warning(this, tr("OpenGL not available!"),
584 tr("yuzu has not been compiled with OpenGL support."));
585 return false;
586#endif
574} 587}
575 588
576bool GRenderWindow::InitializeVulkan() { 589bool GRenderWindow::InitializeVulkan() {
diff --git a/src/yuzu/configuration/configure_service.cpp b/src/yuzu/configuration/configure_service.cpp
index 06566e981..0de7a4f0b 100644
--- a/src/yuzu/configuration/configure_service.cpp
+++ b/src/yuzu/configuration/configure_service.cpp
@@ -68,6 +68,7 @@ void ConfigureService::SetConfiguration() {
68} 68}
69 69
70std::pair<QString, QString> ConfigureService::BCATDownloadEvents() { 70std::pair<QString, QString> ConfigureService::BCATDownloadEvents() {
71#ifdef YUZU_ENABLE_BOXCAT
71 std::optional<std::string> global; 72 std::optional<std::string> global;
72 std::map<std::string, Service::BCAT::EventStatus> map; 73 std::map<std::string, Service::BCAT::EventStatus> map;
73 const auto res = Service::BCAT::Boxcat::GetStatus(global, map); 74 const auto res = Service::BCAT::Boxcat::GetStatus(global, map);
@@ -105,7 +106,10 @@ std::pair<QString, QString> ConfigureService::BCATDownloadEvents() {
105 .arg(QString::fromStdString(key)) 106 .arg(QString::fromStdString(key))
106 .arg(FormatEventStatusString(value)); 107 .arg(FormatEventStatusString(value));
107 } 108 }
108 return {QStringLiteral("Current Boxcat Events"), std::move(out)}; 109 return {tr("Current Boxcat Events"), std::move(out)};
110#else
111 return {tr("Current Boxcat Events"), tr("There are currently no events on boxcat.")};
112#endif
109} 113}
110 114
111void ConfigureService::OnBCATImplChanged() { 115void ConfigureService::OnBCATImplChanged() {