diff options
Diffstat (limited to 'src')
117 files changed, 831 insertions, 260 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 6ffc612e7..d1ec8ff08 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -172,5 +172,5 @@ endif() | |||
| 172 | 172 | ||
| 173 | create_target_directory_groups(common) | 173 | create_target_directory_groups(common) |
| 174 | 174 | ||
| 175 | target_link_libraries(common PUBLIC Boost::boost fmt microprofile) | 175 | target_link_libraries(common PUBLIC Boost::boost fmt::fmt microprofile) |
| 176 | target_link_libraries(common PRIVATE lz4_static libzstd_static) | 176 | target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd) |
diff --git a/src/common/uuid.h b/src/common/uuid.h index f6ad064fb..4d3af8cec 100644 --- a/src/common/uuid.h +++ b/src/common/uuid.h | |||
| @@ -40,6 +40,11 @@ struct UUID { | |||
| 40 | uuid = INVALID_UUID; | 40 | uuid = INVALID_UUID; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | // TODO(ogniK): Properly generate a Nintendo ID | ||
| 44 | constexpr u64 GetNintendoID() const { | ||
| 45 | return uuid[0]; | ||
| 46 | } | ||
| 47 | |||
| 43 | std::string Format() const; | 48 | std::string Format() const; |
| 44 | std::string FormatSwitch() const; | 49 | std::string FormatSwitch() const; |
| 45 | }; | 50 | }; |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 8546d3602..47418006b 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -606,11 +606,11 @@ endif() | |||
| 606 | create_target_directory_groups(core) | 606 | create_target_directory_groups(core) |
| 607 | 607 | ||
| 608 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) | 608 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) |
| 609 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt json-headers mbedtls opus unicorn) | 609 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus unicorn) |
| 610 | 610 | ||
| 611 | if (YUZU_ENABLE_BOXCAT) | 611 | if (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 json-headers zip) | 613 | target_link_libraries(core PRIVATE httplib nlohmann_json::nlohmann_json zip) |
| 614 | endif() | 614 | endif() |
| 615 | 615 | ||
| 616 | if (ENABLE_WEB_SERVICE) | 616 | if (ENABLE_WEB_SERVICE) |
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index e441a27fc..35448b576 100644 --- a/src/core/hle/kernel/handle_table.cpp +++ b/src/core/hle/kernel/handle_table.cpp | |||
| @@ -30,6 +30,7 @@ HandleTable::~HandleTable() = default; | |||
| 30 | 30 | ||
| 31 | ResultCode HandleTable::SetSize(s32 handle_table_size) { | 31 | ResultCode HandleTable::SetSize(s32 handle_table_size) { |
| 32 | if (static_cast<u32>(handle_table_size) > MAX_COUNT) { | 32 | if (static_cast<u32>(handle_table_size) > MAX_COUNT) { |
| 33 | LOG_ERROR(Kernel, "Handle table size {} is greater than {}", handle_table_size, MAX_COUNT); | ||
| 33 | return ERR_OUT_OF_MEMORY; | 34 | return ERR_OUT_OF_MEMORY; |
| 34 | } | 35 | } |
| 35 | 36 | ||
| @@ -80,6 +81,7 @@ ResultVal<Handle> HandleTable::Duplicate(Handle handle) { | |||
| 80 | 81 | ||
| 81 | ResultCode HandleTable::Close(Handle handle) { | 82 | ResultCode HandleTable::Close(Handle handle) { |
| 82 | if (!IsValid(handle)) { | 83 | if (!IsValid(handle)) { |
| 84 | LOG_ERROR(Kernel, "Handle is not valid! handle={:08X}", handle); | ||
| 83 | return ERR_INVALID_HANDLE; | 85 | return ERR_INVALID_HANDLE; |
| 84 | } | 86 | } |
| 85 | 87 | ||
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 91d94025c..ba0eac4c2 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | #include "common/common_funcs.h" | 13 | #include "common/common_funcs.h" |
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "common/logging/log.h" | 15 | #include "common/logging/log.h" |
| 16 | #include "core/core.h" | ||
| 17 | #include "core/hle/ipc_helpers.h" | 16 | #include "core/hle/ipc_helpers.h" |
| 18 | #include "core/hle/kernel/handle_table.h" | 17 | #include "core/hle/kernel/handle_table.h" |
| 19 | #include "core/hle/kernel/hle_ipc.h" | 18 | #include "core/hle/kernel/hle_ipc.h" |
| @@ -57,7 +56,6 @@ std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread( | |||
| 57 | return true; | 56 | return true; |
| 58 | }); | 57 | }); |
| 59 | 58 | ||
| 60 | auto& kernel = Core::System::GetInstance().Kernel(); | ||
| 61 | if (!writable_event) { | 59 | if (!writable_event) { |
| 62 | // Create event if not provided | 60 | // Create event if not provided |
| 63 | const auto pair = WritableEvent::CreateEventPair(kernel, "HLE Pause Event: " + reason); | 61 | const auto pair = WritableEvent::CreateEventPair(kernel, "HLE Pause Event: " + reason); |
| @@ -79,9 +77,11 @@ std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread( | |||
| 79 | return writable_event; | 77 | return writable_event; |
| 80 | } | 78 | } |
| 81 | 79 | ||
| 82 | HLERequestContext::HLERequestContext(std::shared_ptr<Kernel::ServerSession> server_session, | 80 | HLERequestContext::HLERequestContext(KernelCore& kernel, Core::Memory::Memory& memory, |
| 81 | std::shared_ptr<ServerSession> server_session, | ||
| 83 | std::shared_ptr<Thread> thread) | 82 | std::shared_ptr<Thread> thread) |
| 84 | : server_session(std::move(server_session)), thread(std::move(thread)) { | 83 | : server_session(std::move(server_session)), |
| 84 | thread(std::move(thread)), kernel{kernel}, memory{memory} { | ||
| 85 | cmd_buf[0] = 0; | 85 | cmd_buf[0] = 0; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| @@ -216,7 +216,6 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const HandleTabl | |||
| 216 | ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& thread) { | 216 | ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& thread) { |
| 217 | auto& owner_process = *thread.GetOwnerProcess(); | 217 | auto& owner_process = *thread.GetOwnerProcess(); |
| 218 | auto& handle_table = owner_process.GetHandleTable(); | 218 | auto& handle_table = owner_process.GetHandleTable(); |
| 219 | auto& memory = Core::System::GetInstance().Memory(); | ||
| 220 | 219 | ||
| 221 | std::array<u32, IPC::COMMAND_BUFFER_LENGTH> dst_cmdbuf; | 220 | std::array<u32, IPC::COMMAND_BUFFER_LENGTH> dst_cmdbuf; |
| 222 | memory.ReadBlock(owner_process, thread.GetTLSAddress(), dst_cmdbuf.data(), | 221 | memory.ReadBlock(owner_process, thread.GetTLSAddress(), dst_cmdbuf.data(), |
| @@ -286,7 +285,6 @@ std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { | |||
| 286 | std::vector<u8> buffer; | 285 | std::vector<u8> buffer; |
| 287 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && | 286 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && |
| 288 | BufferDescriptorA()[buffer_index].Size()}; | 287 | BufferDescriptorA()[buffer_index].Size()}; |
| 289 | auto& memory = Core::System::GetInstance().Memory(); | ||
| 290 | 288 | ||
| 291 | if (is_buffer_a) { | 289 | if (is_buffer_a) { |
| 292 | ASSERT_MSG(BufferDescriptorA().size() > buffer_index, | 290 | ASSERT_MSG(BufferDescriptorA().size() > buffer_index, |
| @@ -319,7 +317,6 @@ std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, | |||
| 319 | size = buffer_size; // TODO(bunnei): This needs to be HW tested | 317 | size = buffer_size; // TODO(bunnei): This needs to be HW tested |
| 320 | } | 318 | } |
| 321 | 319 | ||
| 322 | auto& memory = Core::System::GetInstance().Memory(); | ||
| 323 | if (is_buffer_b) { | 320 | if (is_buffer_b) { |
| 324 | ASSERT_MSG(BufferDescriptorB().size() > buffer_index, | 321 | ASSERT_MSG(BufferDescriptorB().size() > buffer_index, |
| 325 | "BufferDescriptorB invalid buffer_index {}", buffer_index); | 322 | "BufferDescriptorB invalid buffer_index {}", buffer_index); |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index af3330297..b31673928 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -19,6 +19,10 @@ | |||
| 19 | 19 | ||
| 20 | union ResultCode; | 20 | union ResultCode; |
| 21 | 21 | ||
| 22 | namespace Core::Memory { | ||
| 23 | class Memory; | ||
| 24 | } | ||
| 25 | |||
| 22 | namespace Service { | 26 | namespace Service { |
| 23 | class ServiceFrameworkBase; | 27 | class ServiceFrameworkBase; |
| 24 | } | 28 | } |
| @@ -28,6 +32,7 @@ namespace Kernel { | |||
| 28 | class Domain; | 32 | class Domain; |
| 29 | class HandleTable; | 33 | class HandleTable; |
| 30 | class HLERequestContext; | 34 | class HLERequestContext; |
| 35 | class KernelCore; | ||
| 31 | class Process; | 36 | class Process; |
| 32 | class ServerSession; | 37 | class ServerSession; |
| 33 | class Thread; | 38 | class Thread; |
| @@ -98,7 +103,8 @@ protected: | |||
| 98 | */ | 103 | */ |
| 99 | class HLERequestContext { | 104 | class HLERequestContext { |
| 100 | public: | 105 | public: |
| 101 | explicit HLERequestContext(std::shared_ptr<ServerSession> session, | 106 | explicit HLERequestContext(KernelCore& kernel, Core::Memory::Memory& memory, |
| 107 | std::shared_ptr<ServerSession> session, | ||
| 102 | std::shared_ptr<Thread> thread); | 108 | std::shared_ptr<Thread> thread); |
| 103 | ~HLERequestContext(); | 109 | ~HLERequestContext(); |
| 104 | 110 | ||
| @@ -305,6 +311,9 @@ private: | |||
| 305 | 311 | ||
| 306 | std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers; | 312 | std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers; |
| 307 | bool is_thread_waiting{}; | 313 | bool is_thread_waiting{}; |
| 314 | |||
| 315 | KernelCore& kernel; | ||
| 316 | Core::Memory::Memory& memory; | ||
| 308 | }; | 317 | }; |
| 309 | 318 | ||
| 310 | } // namespace Kernel | 319 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/memory/address_space_info.cpp b/src/core/hle/kernel/memory/address_space_info.cpp index 27fae05e7..a523a2502 100644 --- a/src/core/hle/kernel/memory/address_space_info.cpp +++ b/src/core/hle/kernel/memory/address_space_info.cpp | |||
| @@ -2,8 +2,8 @@ | |||
| 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 | // This file references various implementation details from Atmosphère, an open-source firmware for | 5 | // This file references various implementation details from Atmosphere, an open-source firmware for |
| 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphère-NX. | 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphere-NX. |
| 7 | 7 | ||
| 8 | #include <array> | 8 | #include <array> |
| 9 | 9 | ||
| @@ -49,18 +49,18 @@ constexpr bool IsAllowedIndexForAddress(std::size_t index) { | |||
| 49 | return index < std::size(AddressSpaceInfos) && AddressSpaceInfos[index].GetAddress() != Invalid; | 49 | return index < std::size(AddressSpaceInfos) && AddressSpaceInfos[index].GetAddress() != Invalid; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | constexpr std::size_t | 52 | constexpr std::array<std::size_t, static_cast<std::size_t>(AddressSpaceInfo::Type::Count)> |
| 53 | AddressSpaceIndices32Bit[static_cast<std::size_t>(AddressSpaceInfo::Type::Count)]{ | 53 | AddressSpaceIndices32Bit{ |
| 54 | 0, 1, 0, 2, 0, 3, | 54 | 0, 1, 0, 2, 0, 3, |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | constexpr std::size_t | 57 | constexpr std::array<std::size_t, static_cast<std::size_t>(AddressSpaceInfo::Type::Count)> |
| 58 | AddressSpaceIndices36Bit[static_cast<std::size_t>(AddressSpaceInfo::Type::Count)]{ | 58 | AddressSpaceIndices36Bit{ |
| 59 | 4, 5, 4, 6, 4, 7, | 59 | 4, 5, 4, 6, 4, 7, |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | constexpr std::size_t | 62 | constexpr std::array<std::size_t, static_cast<std::size_t>(AddressSpaceInfo::Type::Count)> |
| 63 | AddressSpaceIndices39Bit[static_cast<std::size_t>(AddressSpaceInfo::Type::Count)]{ | 63 | AddressSpaceIndices39Bit{ |
| 64 | 9, 8, 8, 10, 12, 11, | 64 | 9, 8, 8, 10, 12, 11, |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
diff --git a/src/core/hle/kernel/memory/address_space_info.h b/src/core/hle/kernel/memory/address_space_info.h index cc9a6421e..c479890be 100644 --- a/src/core/hle/kernel/memory/address_space_info.h +++ b/src/core/hle/kernel/memory/address_space_info.h | |||
| @@ -2,12 +2,11 @@ | |||
| 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 | // This file references various implementation details from Atmosphère, an open-source firmware for | 5 | // This file references various implementation details from Atmosphere, an open-source firmware for |
| 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphère-NX. | 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphere-NX. |
| 7 | 7 | ||
| 8 | #pragma once | 8 | #pragma once |
| 9 | 9 | ||
| 10 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 12 | 11 | ||
| 13 | namespace Kernel::Memory { | 12 | namespace Kernel::Memory { |
diff --git a/src/core/hle/kernel/memory/memory_block.h b/src/core/hle/kernel/memory/memory_block.h index 9db1f7b39..9d7839d08 100644 --- a/src/core/hle/kernel/memory/memory_block.h +++ b/src/core/hle/kernel/memory/memory_block.h | |||
| @@ -2,8 +2,8 @@ | |||
| 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 | // This file references various implementation details from Atmosphère, an open-source firmware for | 5 | // This file references various implementation details from Atmosphere, an open-source firmware for |
| 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphère-NX. | 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphere-NX. |
| 7 | 7 | ||
| 8 | #pragma once | 8 | #pragma once |
| 9 | 9 | ||
diff --git a/src/core/hle/kernel/memory/memory_block_manager.cpp b/src/core/hle/kernel/memory/memory_block_manager.cpp index 900395c37..0732fa5a1 100644 --- a/src/core/hle/kernel/memory/memory_block_manager.cpp +++ b/src/core/hle/kernel/memory/memory_block_manager.cpp | |||
| @@ -67,7 +67,6 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState p | |||
| 67 | MemoryPermission prev_perm, MemoryAttribute prev_attribute, | 67 | MemoryPermission prev_perm, MemoryAttribute prev_attribute, |
| 68 | MemoryState state, MemoryPermission perm, | 68 | MemoryState state, MemoryPermission perm, |
| 69 | MemoryAttribute attribute) { | 69 | MemoryAttribute attribute) { |
| 70 | const std::size_t prev_count{memory_block_tree.size()}; | ||
| 71 | const VAddr end_addr{addr + num_pages * PageSize}; | 70 | const VAddr end_addr{addr + num_pages * PageSize}; |
| 72 | iterator node{memory_block_tree.begin()}; | 71 | iterator node{memory_block_tree.begin()}; |
| 73 | 72 | ||
| @@ -109,7 +108,6 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState p | |||
| 109 | 108 | ||
| 110 | void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState state, | 109 | void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState state, |
| 111 | MemoryPermission perm, MemoryAttribute attribute) { | 110 | MemoryPermission perm, MemoryAttribute attribute) { |
| 112 | const std::size_t prev_count{memory_block_tree.size()}; | ||
| 113 | const VAddr end_addr{addr + num_pages * PageSize}; | 111 | const VAddr end_addr{addr + num_pages * PageSize}; |
| 114 | iterator node{memory_block_tree.begin()}; | 112 | iterator node{memory_block_tree.begin()}; |
| 115 | 113 | ||
| @@ -145,7 +143,6 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState s | |||
| 145 | 143 | ||
| 146 | void MemoryBlockManager::UpdateLock(VAddr addr, std::size_t num_pages, LockFunc&& lock_func, | 144 | void MemoryBlockManager::UpdateLock(VAddr addr, std::size_t num_pages, LockFunc&& lock_func, |
| 147 | MemoryPermission perm) { | 145 | MemoryPermission perm) { |
| 148 | const std::size_t prev_count{memory_block_tree.size()}; | ||
| 149 | const VAddr end_addr{addr + num_pages * PageSize}; | 146 | const VAddr end_addr{addr + num_pages * PageSize}; |
| 150 | iterator node{memory_block_tree.begin()}; | 147 | iterator node{memory_block_tree.begin()}; |
| 151 | 148 | ||
diff --git a/src/core/hle/kernel/memory/memory_block_manager.h b/src/core/hle/kernel/memory/memory_block_manager.h index 9451b5df6..6e1d41075 100644 --- a/src/core/hle/kernel/memory/memory_block_manager.h +++ b/src/core/hle/kernel/memory/memory_block_manager.h | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <list> | 8 | #include <list> |
| 9 | #include <memory> | ||
| 10 | 9 | ||
| 11 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/memory/memory_block.h" | 11 | #include "core/hle/kernel/memory/memory_block.h" |
diff --git a/src/core/hle/kernel/memory/memory_manager.cpp b/src/core/hle/kernel/memory/memory_manager.cpp index 3cd4f9e85..6b432e1b2 100644 --- a/src/core/hle/kernel/memory/memory_manager.cpp +++ b/src/core/hle/kernel/memory/memory_manager.cpp | |||
| @@ -104,9 +104,9 @@ 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 num_pages{std::min( | 107 | const auto min_num_pages{std::min( |
| 108 | it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; | 108 | it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; |
| 109 | chosen_manager.Free(it.GetAddress(), num_pages); | 109 | chosen_manager.Free(it.GetAddress(), min_num_pages); |
| 110 | } | 110 | } |
| 111 | }); | 111 | }); |
| 112 | 112 | ||
| @@ -165,9 +165,9 @@ 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 num_pages{std::min( | 168 | const auto min_num_pages{std::min( |
| 169 | it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; | 169 | it.GetNumPages(), (chosen_manager.GetEndAddress() - it.GetAddress()) / PageSize)}; |
| 170 | chosen_manager.Free(it.GetAddress(), num_pages); | 170 | chosen_manager.Free(it.GetAddress(), min_num_pages); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | return RESULT_SUCCESS; | 173 | return RESULT_SUCCESS; |
diff --git a/src/core/hle/kernel/memory/memory_manager.h b/src/core/hle/kernel/memory/memory_manager.h index b078d7a5e..3cf444857 100644 --- a/src/core/hle/kernel/memory/memory_manager.h +++ b/src/core/hle/kernel/memory/memory_manager.h | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <mutex> | 8 | #include <mutex> |
| 9 | 9 | ||
| 10 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/memory/page_heap.h" | 11 | #include "core/hle/kernel/memory/page_heap.h" |
| 13 | #include "core/hle/result.h" | 12 | #include "core/hle/result.h" |
diff --git a/src/core/hle/kernel/memory/page_heap.cpp b/src/core/hle/kernel/memory/page_heap.cpp index efcbb3cad..0ab1f7205 100644 --- a/src/core/hle/kernel/memory/page_heap.cpp +++ b/src/core/hle/kernel/memory/page_heap.cpp | |||
| @@ -2,8 +2,8 @@ | |||
| 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 | // This file references various implementation details from Atmosphère, an open-source firmware for | 5 | // This file references various implementation details from Atmosphere, an open-source firmware for |
| 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphère-NX. | 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphere-NX. |
| 7 | 7 | ||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/kernel/memory/page_heap.h" | 9 | #include "core/hle/kernel/memory/page_heap.h" |
diff --git a/src/core/hle/kernel/memory/page_heap.h b/src/core/hle/kernel/memory/page_heap.h index 380c3f5a1..22b0de860 100644 --- a/src/core/hle/kernel/memory/page_heap.h +++ b/src/core/hle/kernel/memory/page_heap.h | |||
| @@ -2,8 +2,8 @@ | |||
| 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 | // This file references various implementation details from Atmosphère, an open-source firmware for | 5 | // This file references various implementation details from Atmosphere, an open-source firmware for |
| 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphère-NX. | 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphere-NX. |
| 7 | 7 | ||
| 8 | #pragma once | 8 | #pragma once |
| 9 | 9 | ||
diff --git a/src/core/hle/kernel/memory/page_linked_list.h b/src/core/hle/kernel/memory/page_linked_list.h index 0668d00c6..45dc13eaf 100644 --- a/src/core/hle/kernel/memory/page_linked_list.h +++ b/src/core/hle/kernel/memory/page_linked_list.h | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <list> | 7 | #include <list> |
| 8 | 8 | ||
| 9 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 10 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/memory/memory_types.h" | 11 | #include "core/hle/kernel/memory/memory_types.h" |
| 13 | #include "core/hle/result.h" | 12 | #include "core/hle/result.h" |
diff --git a/src/core/hle/kernel/memory/page_table.cpp b/src/core/hle/kernel/memory/page_table.cpp index 3281611f8..5d6aac00f 100644 --- a/src/core/hle/kernel/memory/page_table.cpp +++ b/src/core/hle/kernel/memory/page_table.cpp | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "common/scope_exit.h" | 7 | #include "common/scope_exit.h" |
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/device_memory.h" | ||
| 10 | #include "core/hle/kernel/errors.h" | 9 | #include "core/hle/kernel/errors.h" |
| 11 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/kernel.h" |
| 12 | #include "core/hle/kernel/memory/address_space_info.h" | 11 | #include "core/hle/kernel/memory/address_space_info.h" |
diff --git a/src/core/hle/kernel/memory/page_table.h b/src/core/hle/kernel/memory/page_table.h index a867aa050..ce0d38849 100644 --- a/src/core/hle/kernel/memory/page_table.h +++ b/src/core/hle/kernel/memory/page_table.h | |||
| @@ -4,16 +4,15 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <list> | ||
| 8 | #include <memory> | 7 | #include <memory> |
| 9 | #include <mutex> | 8 | #include <mutex> |
| 10 | 9 | ||
| 11 | #include "common/common_funcs.h" | ||
| 12 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 13 | #include "common/page_table.h" | 11 | #include "common/page_table.h" |
| 14 | #include "core/file_sys/program_metadata.h" | 12 | #include "core/file_sys/program_metadata.h" |
| 15 | #include "core/hle/kernel/memory/memory_block.h" | 13 | #include "core/hle/kernel/memory/memory_block.h" |
| 16 | #include "core/hle/kernel/memory/memory_manager.h" | 14 | #include "core/hle/kernel/memory/memory_manager.h" |
| 15 | #include "core/hle/result.h" | ||
| 17 | 16 | ||
| 18 | namespace Core { | 17 | namespace Core { |
| 19 | class System; | 18 | class System; |
diff --git a/src/core/hle/kernel/memory/slab_heap.h b/src/core/hle/kernel/memory/slab_heap.h index be95fc3f7..465eaddb3 100644 --- a/src/core/hle/kernel/memory/slab_heap.h +++ b/src/core/hle/kernel/memory/slab_heap.h | |||
| @@ -2,15 +2,14 @@ | |||
| 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 | // This file references various implementation details from Atmosphère, an open-source firmware for | 5 | // This file references various implementation details from Atmosphere, an open-source firmware for |
| 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphère-NX. | 6 | // the Nintendo Switch. Copyright 2018-2020 Atmosphere-NX. |
| 7 | 7 | ||
| 8 | #pragma once | 8 | #pragma once |
| 9 | 9 | ||
| 10 | #include <atomic> | 10 | #include <atomic> |
| 11 | 11 | ||
| 12 | #include "common/assert.h" | 12 | #include "common/assert.h" |
| 13 | #include "common/common_funcs.h" | ||
| 14 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 15 | 14 | ||
| 16 | namespace Kernel::Memory { | 15 | namespace Kernel::Memory { |
diff --git a/src/core/hle/kernel/memory/system_control.cpp b/src/core/hle/kernel/memory/system_control.cpp index 9cae3c6cb..2f98e9c4c 100644 --- a/src/core/hle/kernel/memory/system_control.cpp +++ b/src/core/hle/kernel/memory/system_control.cpp | |||
| @@ -2,8 +2,6 @@ | |||
| 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 | #pragma once | ||
| 6 | |||
| 7 | #include <random> | 5 | #include <random> |
| 8 | 6 | ||
| 9 | #include "core/hle/kernel/memory/system_control.h" | 7 | #include "core/hle/kernel/memory/system_control.h" |
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index eff4e45b0..7869eb32b 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <vector> | 7 | #include <vector> |
| 8 | 8 | ||
| 9 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 10 | #include "common/logging/log.h" | ||
| 10 | #include "core/core.h" | 11 | #include "core/core.h" |
| 11 | #include "core/hle/kernel/errors.h" | 12 | #include "core/hle/kernel/errors.h" |
| 12 | #include "core/hle/kernel/handle_table.h" | 13 | #include "core/hle/kernel/handle_table.h" |
| @@ -67,6 +68,7 @@ ResultCode Mutex::TryAcquire(VAddr address, Handle holding_thread_handle, | |||
| 67 | Handle requesting_thread_handle) { | 68 | Handle requesting_thread_handle) { |
| 68 | // The mutex address must be 4-byte aligned | 69 | // The mutex address must be 4-byte aligned |
| 69 | if ((address % sizeof(u32)) != 0) { | 70 | if ((address % sizeof(u32)) != 0) { |
| 71 | LOG_ERROR(Kernel, "Address is not 4-byte aligned! address={:016X}", address); | ||
| 70 | return ERR_INVALID_ADDRESS; | 72 | return ERR_INVALID_ADDRESS; |
| 71 | } | 73 | } |
| 72 | 74 | ||
| @@ -88,6 +90,8 @@ ResultCode Mutex::TryAcquire(VAddr address, Handle holding_thread_handle, | |||
| 88 | } | 90 | } |
| 89 | 91 | ||
| 90 | if (holding_thread == nullptr) { | 92 | if (holding_thread == nullptr) { |
| 93 | LOG_ERROR(Kernel, "Holding thread does not exist! thread_handle={:08X}", | ||
| 94 | holding_thread_handle); | ||
| 91 | return ERR_INVALID_HANDLE; | 95 | return ERR_INVALID_HANDLE; |
| 92 | } | 96 | } |
| 93 | 97 | ||
| @@ -109,6 +113,7 @@ ResultCode Mutex::TryAcquire(VAddr address, Handle holding_thread_handle, | |||
| 109 | ResultCode Mutex::Release(VAddr address) { | 113 | ResultCode Mutex::Release(VAddr address) { |
| 110 | // The mutex address must be 4-byte aligned | 114 | // The mutex address must be 4-byte aligned |
| 111 | if ((address % sizeof(u32)) != 0) { | 115 | if ((address % sizeof(u32)) != 0) { |
| 116 | LOG_ERROR(Kernel, "Address is not 4-byte aligned! address={:016X}", address); | ||
| 112 | return ERR_INVALID_ADDRESS; | 117 | return ERR_INVALID_ADDRESS; |
| 113 | } | 118 | } |
| 114 | 119 | ||
diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index 48e5ae682..63880f13d 100644 --- a/src/core/hle/kernel/process_capability.cpp +++ b/src/core/hle/kernel/process_capability.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/bit_util.h" | 5 | #include "common/bit_util.h" |
| 6 | #include "common/logging/log.h" | ||
| 6 | #include "core/hle/kernel/errors.h" | 7 | #include "core/hle/kernel/errors.h" |
| 7 | #include "core/hle/kernel/handle_table.h" | 8 | #include "core/hle/kernel/handle_table.h" |
| 8 | #include "core/hle/kernel/memory/page_table.h" | 9 | #include "core/hle/kernel/memory/page_table.h" |
| @@ -119,22 +120,30 @@ ResultCode ProcessCapabilities::ParseCapabilities(const u32* capabilities, | |||
| 119 | // The MapPhysical type uses two descriptor flags for its parameters. | 120 | // The MapPhysical type uses two descriptor flags for its parameters. |
| 120 | // If there's only one, then there's a problem. | 121 | // If there's only one, then there's a problem. |
| 121 | if (i >= num_capabilities) { | 122 | if (i >= num_capabilities) { |
| 123 | LOG_ERROR(Kernel, "Invalid combination! i={}", i); | ||
| 122 | return ERR_INVALID_COMBINATION; | 124 | return ERR_INVALID_COMBINATION; |
| 123 | } | 125 | } |
| 124 | 126 | ||
| 125 | const auto size_flags = capabilities[i]; | 127 | const auto size_flags = capabilities[i]; |
| 126 | if (GetCapabilityType(size_flags) != CapabilityType::MapPhysical) { | 128 | if (GetCapabilityType(size_flags) != CapabilityType::MapPhysical) { |
| 129 | LOG_ERROR(Kernel, "Invalid capability type! size_flags={}", size_flags); | ||
| 127 | return ERR_INVALID_COMBINATION; | 130 | return ERR_INVALID_COMBINATION; |
| 128 | } | 131 | } |
| 129 | 132 | ||
| 130 | const auto result = HandleMapPhysicalFlags(descriptor, size_flags, page_table); | 133 | const auto result = HandleMapPhysicalFlags(descriptor, size_flags, page_table); |
| 131 | if (result.IsError()) { | 134 | if (result.IsError()) { |
| 135 | LOG_ERROR(Kernel, "Failed to map physical flags! descriptor={}, size_flags={}", | ||
| 136 | descriptor, size_flags); | ||
| 132 | return result; | 137 | return result; |
| 133 | } | 138 | } |
| 134 | } else { | 139 | } else { |
| 135 | const auto result = | 140 | const auto result = |
| 136 | ParseSingleFlagCapability(set_flags, set_svc_bits, descriptor, page_table); | 141 | ParseSingleFlagCapability(set_flags, set_svc_bits, descriptor, page_table); |
| 137 | if (result.IsError()) { | 142 | if (result.IsError()) { |
| 143 | LOG_ERROR( | ||
| 144 | Kernel, | ||
| 145 | "Failed to parse capability flag! set_flags={}, set_svc_bits={}, descriptor={}", | ||
| 146 | set_flags, set_svc_bits, descriptor); | ||
| 138 | return result; | 147 | return result; |
| 139 | } | 148 | } |
| 140 | } | 149 | } |
| @@ -162,6 +171,9 @@ ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& s | |||
| 162 | const u32 flag_length = GetFlagBitOffset(type); | 171 | const u32 flag_length = GetFlagBitOffset(type); |
| 163 | const u32 set_flag = 1U << flag_length; | 172 | const u32 set_flag = 1U << flag_length; |
| 164 | if ((set_flag & set_flags & InitializeOnceMask) != 0) { | 173 | if ((set_flag & set_flags & InitializeOnceMask) != 0) { |
| 174 | LOG_ERROR(Kernel, | ||
| 175 | "Attempted to initialize flags that may only be initialized once. set_flags={}", | ||
| 176 | set_flags); | ||
| 165 | return ERR_INVALID_COMBINATION; | 177 | return ERR_INVALID_COMBINATION; |
| 166 | } | 178 | } |
| 167 | set_flags |= set_flag; | 179 | set_flags |= set_flag; |
| @@ -187,6 +199,7 @@ ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& s | |||
| 187 | break; | 199 | break; |
| 188 | } | 200 | } |
| 189 | 201 | ||
| 202 | LOG_ERROR(Kernel, "Invalid capability type! type={}", static_cast<u32>(type)); | ||
| 190 | return ERR_INVALID_CAPABILITY_DESCRIPTOR; | 203 | return ERR_INVALID_CAPABILITY_DESCRIPTOR; |
| 191 | } | 204 | } |
| 192 | 205 | ||
| @@ -208,23 +221,31 @@ void ProcessCapabilities::Clear() { | |||
| 208 | 221 | ||
| 209 | ResultCode ProcessCapabilities::HandlePriorityCoreNumFlags(u32 flags) { | 222 | ResultCode ProcessCapabilities::HandlePriorityCoreNumFlags(u32 flags) { |
| 210 | if (priority_mask != 0 || core_mask != 0) { | 223 | if (priority_mask != 0 || core_mask != 0) { |
| 224 | LOG_ERROR(Kernel, "Core or priority mask are not zero! priority_mask={}, core_mask={}", | ||
| 225 | priority_mask, core_mask); | ||
| 211 | return ERR_INVALID_CAPABILITY_DESCRIPTOR; | 226 | return ERR_INVALID_CAPABILITY_DESCRIPTOR; |
| 212 | } | 227 | } |
| 213 | 228 | ||
| 214 | const u32 core_num_min = (flags >> 16) & 0xFF; | 229 | const u32 core_num_min = (flags >> 16) & 0xFF; |
| 215 | const u32 core_num_max = (flags >> 24) & 0xFF; | 230 | const u32 core_num_max = (flags >> 24) & 0xFF; |
| 216 | if (core_num_min > core_num_max) { | 231 | if (core_num_min > core_num_max) { |
| 232 | LOG_ERROR(Kernel, "Core min is greater than core max! core_num_min={}, core_num_max={}", | ||
| 233 | core_num_min, core_num_max); | ||
| 217 | return ERR_INVALID_COMBINATION; | 234 | return ERR_INVALID_COMBINATION; |
| 218 | } | 235 | } |
| 219 | 236 | ||
| 220 | const u32 priority_min = (flags >> 10) & 0x3F; | 237 | const u32 priority_min = (flags >> 10) & 0x3F; |
| 221 | const u32 priority_max = (flags >> 4) & 0x3F; | 238 | const u32 priority_max = (flags >> 4) & 0x3F; |
| 222 | if (priority_min > priority_max) { | 239 | if (priority_min > priority_max) { |
| 240 | LOG_ERROR(Kernel, | ||
| 241 | "Priority min is greater than priority max! priority_min={}, priority_max={}", | ||
| 242 | core_num_min, priority_max); | ||
| 223 | return ERR_INVALID_COMBINATION; | 243 | return ERR_INVALID_COMBINATION; |
| 224 | } | 244 | } |
| 225 | 245 | ||
| 226 | // The switch only has 4 usable cores. | 246 | // The switch only has 4 usable cores. |
| 227 | if (core_num_max >= 4) { | 247 | if (core_num_max >= 4) { |
| 248 | LOG_ERROR(Kernel, "Invalid max cores specified! core_num_max={}", core_num_max); | ||
| 228 | return ERR_INVALID_PROCESSOR_ID; | 249 | return ERR_INVALID_PROCESSOR_ID; |
| 229 | } | 250 | } |
| 230 | 251 | ||
| @@ -259,6 +280,7 @@ ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags) | |||
| 259 | } | 280 | } |
| 260 | 281 | ||
| 261 | if (svc_number >= svc_capabilities.size()) { | 282 | if (svc_number >= svc_capabilities.size()) { |
| 283 | LOG_ERROR(Kernel, "Process svc capability is out of range! svc_number={}", svc_number); | ||
| 262 | return ERR_OUT_OF_RANGE; | 284 | return ERR_OUT_OF_RANGE; |
| 263 | } | 285 | } |
| 264 | 286 | ||
| @@ -295,6 +317,8 @@ ResultCode ProcessCapabilities::HandleInterruptFlags(u32 flags) { | |||
| 295 | // emulate that, it's sufficient to mark every interrupt as defined. | 317 | // emulate that, it's sufficient to mark every interrupt as defined. |
| 296 | 318 | ||
| 297 | if (interrupt >= interrupt_capabilities.size()) { | 319 | if (interrupt >= interrupt_capabilities.size()) { |
| 320 | LOG_ERROR(Kernel, "Process interrupt capability is out of range! svc_number={}", | ||
| 321 | interrupt); | ||
| 298 | return ERR_OUT_OF_RANGE; | 322 | return ERR_OUT_OF_RANGE; |
| 299 | } | 323 | } |
| 300 | 324 | ||
| @@ -307,6 +331,7 @@ ResultCode ProcessCapabilities::HandleInterruptFlags(u32 flags) { | |||
| 307 | ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) { | 331 | ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) { |
| 308 | const u32 reserved = flags >> 17; | 332 | const u32 reserved = flags >> 17; |
| 309 | if (reserved != 0) { | 333 | if (reserved != 0) { |
| 334 | LOG_ERROR(Kernel, "Reserved value is non-zero! reserved={}", reserved); | ||
| 310 | return ERR_RESERVED_VALUE; | 335 | return ERR_RESERVED_VALUE; |
| 311 | } | 336 | } |
| 312 | 337 | ||
| @@ -324,6 +349,9 @@ ResultCode ProcessCapabilities::HandleKernelVersionFlags(u32 flags) { | |||
| 324 | const u32 major_version = kernel_version >> 19; | 349 | const u32 major_version = kernel_version >> 19; |
| 325 | 350 | ||
| 326 | if (major_version != 0 || flags < 0x80000) { | 351 | if (major_version != 0 || flags < 0x80000) { |
| 352 | LOG_ERROR(Kernel, | ||
| 353 | "Kernel version is non zero or flags are too small! major_version={}, flags={}", | ||
| 354 | major_version, flags); | ||
| 327 | return ERR_INVALID_CAPABILITY_DESCRIPTOR; | 355 | return ERR_INVALID_CAPABILITY_DESCRIPTOR; |
| 328 | } | 356 | } |
| 329 | 357 | ||
| @@ -334,6 +362,7 @@ ResultCode ProcessCapabilities::HandleKernelVersionFlags(u32 flags) { | |||
| 334 | ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) { | 362 | ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) { |
| 335 | const u32 reserved = flags >> 26; | 363 | const u32 reserved = flags >> 26; |
| 336 | if (reserved != 0) { | 364 | if (reserved != 0) { |
| 365 | LOG_ERROR(Kernel, "Reserved value is non-zero! reserved={}", reserved); | ||
| 337 | return ERR_RESERVED_VALUE; | 366 | return ERR_RESERVED_VALUE; |
| 338 | } | 367 | } |
| 339 | 368 | ||
| @@ -344,6 +373,7 @@ ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) { | |||
| 344 | ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) { | 373 | ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) { |
| 345 | const u32 reserved = flags >> 19; | 374 | const u32 reserved = flags >> 19; |
| 346 | if (reserved != 0) { | 375 | if (reserved != 0) { |
| 376 | LOG_ERROR(Kernel, "Reserved value is non-zero! reserved={}", reserved); | ||
| 347 | return ERR_RESERVED_VALUE; | 377 | return ERR_RESERVED_VALUE; |
| 348 | } | 378 | } |
| 349 | 379 | ||
diff --git a/src/core/hle/kernel/readable_event.cpp b/src/core/hle/kernel/readable_event.cpp index 9d3d3a81b..00860fcbd 100644 --- a/src/core/hle/kernel/readable_event.cpp +++ b/src/core/hle/kernel/readable_event.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "common/logging/log.h" | ||
| 7 | #include "core/hle/kernel/errors.h" | 8 | #include "core/hle/kernel/errors.h" |
| 8 | #include "core/hle/kernel/object.h" | 9 | #include "core/hle/kernel/object.h" |
| 9 | #include "core/hle/kernel/readable_event.h" | 10 | #include "core/hle/kernel/readable_event.h" |
| @@ -23,10 +24,12 @@ void ReadableEvent::Acquire(Thread* thread) { | |||
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | void ReadableEvent::Signal() { | 26 | void ReadableEvent::Signal() { |
| 26 | if (!is_signaled) { | 27 | if (is_signaled) { |
| 27 | is_signaled = true; | 28 | return; |
| 28 | SynchronizationObject::Signal(); | 29 | } |
| 29 | }; | 30 | |
| 31 | is_signaled = true; | ||
| 32 | SynchronizationObject::Signal(); | ||
| 30 | } | 33 | } |
| 31 | 34 | ||
| 32 | void ReadableEvent::Clear() { | 35 | void ReadableEvent::Clear() { |
| @@ -35,6 +38,8 @@ void ReadableEvent::Clear() { | |||
| 35 | 38 | ||
| 36 | ResultCode ReadableEvent::Reset() { | 39 | ResultCode ReadableEvent::Reset() { |
| 37 | if (!is_signaled) { | 40 | if (!is_signaled) { |
| 41 | LOG_ERROR(Kernel, "Handle is not signaled! object_id={}, object_type={}, object_name={}", | ||
| 42 | GetObjectId(), GetTypeName(), GetName()); | ||
| 38 | return ERR_INVALID_STATE; | 43 | return ERR_INVALID_STATE; |
| 39 | } | 44 | } |
| 40 | 45 | ||
diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp index 96e5b9892..d9beaa3a4 100644 --- a/src/core/hle/kernel/resource_limit.cpp +++ b/src/core/hle/kernel/resource_limit.cpp | |||
| @@ -69,6 +69,8 @@ ResultCode ResourceLimit::SetLimitValue(ResourceType resource, s64 value) { | |||
| 69 | limit[index] = value; | 69 | limit[index] = value; |
| 70 | return RESULT_SUCCESS; | 70 | return RESULT_SUCCESS; |
| 71 | } else { | 71 | } else { |
| 72 | LOG_ERROR(Kernel, "Limit value is too large! resource={}, value={}, index={}", | ||
| 73 | static_cast<u32>(resource), value, index); | ||
| 72 | return ERR_INVALID_STATE; | 74 | return ERR_INVALID_STATE; |
| 73 | } | 75 | } |
| 74 | } | 76 | } |
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 0f102ca44..25438b86b 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp | |||
| @@ -137,8 +137,8 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con | |||
| 137 | ResultCode ServerSession::QueueSyncRequest(std::shared_ptr<Thread> thread, | 137 | ResultCode ServerSession::QueueSyncRequest(std::shared_ptr<Thread> thread, |
| 138 | Core::Memory::Memory& memory) { | 138 | Core::Memory::Memory& memory) { |
| 139 | u32* cmd_buf{reinterpret_cast<u32*>(memory.GetPointer(thread->GetTLSAddress()))}; | 139 | u32* cmd_buf{reinterpret_cast<u32*>(memory.GetPointer(thread->GetTLSAddress()))}; |
| 140 | std::shared_ptr<Kernel::HLERequestContext> context{ | 140 | auto context = |
| 141 | std::make_shared<Kernel::HLERequestContext>(SharedFrom(this), std::move(thread))}; | 141 | std::make_shared<HLERequestContext>(kernel, memory, SharedFrom(this), std::move(thread)); |
| 142 | 142 | ||
| 143 | context->PopulateFromIncomingCommandBuffer(kernel.CurrentProcess()->GetHandleTable(), cmd_buf); | 143 | context->PopulateFromIncomingCommandBuffer(kernel.CurrentProcess()->GetHandleTable(), cmd_buf); |
| 144 | request_queue.Push(std::move(context)); | 144 | request_queue.Push(std::move(context)); |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 41ef2caf6..4ae4529f5 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -685,6 +685,8 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha | |||
| 685 | case GetInfoType::TotalPhysicalMemoryAvailableWithoutSystemResource: | 685 | case GetInfoType::TotalPhysicalMemoryAvailableWithoutSystemResource: |
| 686 | case GetInfoType::TotalPhysicalMemoryUsedWithoutSystemResource: { | 686 | case GetInfoType::TotalPhysicalMemoryUsedWithoutSystemResource: { |
| 687 | if (info_sub_id != 0) { | 687 | if (info_sub_id != 0) { |
| 688 | LOG_ERROR(Kernel_SVC, "Info sub id is non zero! info_id={}, info_sub_id={}", info_id, | ||
| 689 | info_sub_id); | ||
| 688 | return ERR_INVALID_ENUM_VALUE; | 690 | return ERR_INVALID_ENUM_VALUE; |
| 689 | } | 691 | } |
| 690 | 692 | ||
| @@ -692,6 +694,8 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha | |||
| 692 | system.Kernel().CurrentProcess()->GetHandleTable(); | 694 | system.Kernel().CurrentProcess()->GetHandleTable(); |
| 693 | const auto process = current_process_handle_table.Get<Process>(static_cast<Handle>(handle)); | 695 | const auto process = current_process_handle_table.Get<Process>(static_cast<Handle>(handle)); |
| 694 | if (!process) { | 696 | if (!process) { |
| 697 | LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}", | ||
| 698 | info_id, info_sub_id, handle); | ||
| 695 | return ERR_INVALID_HANDLE; | 699 | return ERR_INVALID_HANDLE; |
| 696 | } | 700 | } |
| 697 | 701 | ||
| @@ -783,10 +787,13 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha | |||
| 783 | 787 | ||
| 784 | case GetInfoType::RegisterResourceLimit: { | 788 | case GetInfoType::RegisterResourceLimit: { |
| 785 | if (handle != 0) { | 789 | if (handle != 0) { |
| 790 | LOG_ERROR(Kernel, "Handle is non zero! handle={:08X}", handle); | ||
| 786 | return ERR_INVALID_HANDLE; | 791 | return ERR_INVALID_HANDLE; |
| 787 | } | 792 | } |
| 788 | 793 | ||
| 789 | if (info_sub_id != 0) { | 794 | if (info_sub_id != 0) { |
| 795 | LOG_ERROR(Kernel, "Info sub id is non zero! info_id={}, info_sub_id={}", info_id, | ||
| 796 | info_sub_id); | ||
| 790 | return ERR_INVALID_COMBINATION; | 797 | return ERR_INVALID_COMBINATION; |
| 791 | } | 798 | } |
| 792 | 799 | ||
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index a919750a6..db7f379ac 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -423,6 +423,8 @@ ResultCode Thread::SetCoreAndAffinityMask(s32 new_core, u64 new_affinity_mask) { | |||
| 423 | if (new_core == THREADPROCESSORID_DONT_UPDATE) { | 423 | if (new_core == THREADPROCESSORID_DONT_UPDATE) { |
| 424 | new_core = use_override ? ideal_core_override : ideal_core; | 424 | new_core = use_override ? ideal_core_override : ideal_core; |
| 425 | if ((new_affinity_mask & (1ULL << new_core)) == 0) { | 425 | if ((new_affinity_mask & (1ULL << new_core)) == 0) { |
| 426 | LOG_ERROR(Kernel, "New affinity mask is incorrect! new_core={}, new_affinity_mask={}", | ||
| 427 | new_core, new_affinity_mask); | ||
| 426 | return ERR_INVALID_COMBINATION; | 428 | return ERR_INVALID_COMBINATION; |
| 427 | } | 429 | } |
| 428 | } | 430 | } |
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 9a7992f58..630a8b048 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -228,7 +228,8 @@ public: | |||
| 228 | 228 | ||
| 229 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { | 229 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { |
| 230 | public: | 230 | public: |
| 231 | IManagerForApplication() : ServiceFramework("IManagerForApplication") { | 231 | explicit IManagerForApplication(Common::UUID user_id) |
| 232 | : ServiceFramework("IManagerForApplication"), user_id(user_id) { | ||
| 232 | // clang-format off | 233 | // clang-format off |
| 233 | static const FunctionInfo functions[] = { | 234 | static const FunctionInfo functions[] = { |
| 234 | {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, | 235 | {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, |
| @@ -254,12 +255,14 @@ private: | |||
| 254 | } | 255 | } |
| 255 | 256 | ||
| 256 | void GetAccountId(Kernel::HLERequestContext& ctx) { | 257 | void GetAccountId(Kernel::HLERequestContext& ctx) { |
| 257 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 258 | LOG_DEBUG(Service_ACC, "called"); |
| 258 | // Should return a nintendo account ID | 259 | |
| 259 | IPC::ResponseBuilder rb{ctx, 4}; | 260 | IPC::ResponseBuilder rb{ctx, 4}; |
| 260 | rb.Push(RESULT_SUCCESS); | 261 | rb.Push(RESULT_SUCCESS); |
| 261 | rb.PushRaw<u64>(1); | 262 | rb.PushRaw<u64>(user_id.GetNintendoID()); |
| 262 | } | 263 | } |
| 264 | |||
| 265 | Common::UUID user_id; | ||
| 263 | }; | 266 | }; |
| 264 | 267 | ||
| 265 | void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { | 268 | void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { |
| @@ -382,7 +385,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo | |||
| 382 | LOG_DEBUG(Service_ACC, "called"); | 385 | LOG_DEBUG(Service_ACC, "called"); |
| 383 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 386 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 384 | rb.Push(RESULT_SUCCESS); | 387 | rb.Push(RESULT_SUCCESS); |
| 385 | rb.PushIpcInterface<IManagerForApplication>(); | 388 | rb.PushIpcInterface<IManagerForApplication>(profile_manager->GetLastOpenedUser()); |
| 386 | } | 389 | } |
| 387 | 390 | ||
| 388 | void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { | 391 | void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 9450de6e9..4df74c4f9 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -1335,12 +1335,23 @@ void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) { | |||
| 1335 | } | 1335 | } |
| 1336 | 1336 | ||
| 1337 | void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { | 1337 | void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { |
| 1338 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 1338 | LOG_DEBUG(Service_AM, "called"); |
| 1339 | |||
| 1340 | std::array<u8, 0x10> version_string{}; | ||
| 1341 | |||
| 1342 | FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()}; | ||
| 1343 | const auto res = pm.GetControlMetadata(); | ||
| 1344 | if (res.first != nullptr) { | ||
| 1345 | const auto& version = res.first->GetVersionString(); | ||
| 1346 | std::copy(version.begin(), version.end(), version_string.begin()); | ||
| 1347 | } else { | ||
| 1348 | constexpr u128 default_version = {1, 0}; | ||
| 1349 | std::memcpy(version_string.data(), default_version.data(), sizeof(u128)); | ||
| 1350 | } | ||
| 1339 | 1351 | ||
| 1340 | IPC::ResponseBuilder rb{ctx, 6}; | 1352 | IPC::ResponseBuilder rb{ctx, 6}; |
| 1341 | rb.Push(RESULT_SUCCESS); | 1353 | rb.Push(RESULT_SUCCESS); |
| 1342 | rb.Push<u64>(1); | 1354 | rb.PushRaw(version_string); |
| 1343 | rb.Push<u64>(0); | ||
| 1344 | } | 1355 | } |
| 1345 | 1356 | ||
| 1346 | void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { | 1357 | void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { |
| @@ -1514,14 +1525,15 @@ void InstallInterfaces(SM::ServiceManager& service_manager, | |||
| 1514 | std::make_shared<TCAP>()->InstallAsService(service_manager); | 1525 | std::make_shared<TCAP>()->InstallAsService(service_manager); |
| 1515 | } | 1526 | } |
| 1516 | 1527 | ||
| 1517 | IHomeMenuFunctions::IHomeMenuFunctions() : ServiceFramework("IHomeMenuFunctions") { | 1528 | IHomeMenuFunctions::IHomeMenuFunctions(Kernel::KernelCore& kernel) |
| 1529 | : ServiceFramework("IHomeMenuFunctions"), kernel(kernel) { | ||
| 1518 | // clang-format off | 1530 | // clang-format off |
| 1519 | static const FunctionInfo functions[] = { | 1531 | static const FunctionInfo functions[] = { |
| 1520 | {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, | 1532 | {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, |
| 1521 | {11, nullptr, "LockForeground"}, | 1533 | {11, nullptr, "LockForeground"}, |
| 1522 | {12, nullptr, "UnlockForeground"}, | 1534 | {12, nullptr, "UnlockForeground"}, |
| 1523 | {20, nullptr, "PopFromGeneralChannel"}, | 1535 | {20, nullptr, "PopFromGeneralChannel"}, |
| 1524 | {21, nullptr, "GetPopFromGeneralChannelEvent"}, | 1536 | {21, &IHomeMenuFunctions::GetPopFromGeneralChannelEvent, "GetPopFromGeneralChannelEvent"}, |
| 1525 | {30, nullptr, "GetHomeButtonWriterLockAccessor"}, | 1537 | {30, nullptr, "GetHomeButtonWriterLockAccessor"}, |
| 1526 | {31, nullptr, "GetWriterLockAccessorEx"}, | 1538 | {31, nullptr, "GetWriterLockAccessorEx"}, |
| 1527 | {100, nullptr, "PopRequestLaunchApplicationForDebug"}, | 1539 | {100, nullptr, "PopRequestLaunchApplicationForDebug"}, |
| @@ -1531,6 +1543,9 @@ IHomeMenuFunctions::IHomeMenuFunctions() : ServiceFramework("IHomeMenuFunctions" | |||
| 1531 | // clang-format on | 1543 | // clang-format on |
| 1532 | 1544 | ||
| 1533 | RegisterHandlers(functions); | 1545 | RegisterHandlers(functions); |
| 1546 | |||
| 1547 | pop_from_general_channel_event = Kernel::WritableEvent::CreateEventPair( | ||
| 1548 | kernel, "IHomeMenuFunctions:PopFromGeneralChannelEvent"); | ||
| 1534 | } | 1549 | } |
| 1535 | 1550 | ||
| 1536 | IHomeMenuFunctions::~IHomeMenuFunctions() = default; | 1551 | IHomeMenuFunctions::~IHomeMenuFunctions() = default; |
| @@ -1542,6 +1557,14 @@ void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) | |||
| 1542 | rb.Push(RESULT_SUCCESS); | 1557 | rb.Push(RESULT_SUCCESS); |
| 1543 | } | 1558 | } |
| 1544 | 1559 | ||
| 1560 | void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx) { | ||
| 1561 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 1562 | |||
| 1563 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 1564 | rb.Push(RESULT_SUCCESS); | ||
| 1565 | rb.PushCopyObjects(pop_from_general_channel_event.readable); | ||
| 1566 | } | ||
| 1567 | |||
| 1545 | IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { | 1568 | IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { |
| 1546 | // clang-format off | 1569 | // clang-format off |
| 1547 | static const FunctionInfo functions[] = { | 1570 | static const FunctionInfo functions[] = { |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index dfa701d73..469f7f814 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -292,11 +292,15 @@ private: | |||
| 292 | 292 | ||
| 293 | class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { | 293 | class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { |
| 294 | public: | 294 | public: |
| 295 | IHomeMenuFunctions(); | 295 | explicit IHomeMenuFunctions(Kernel::KernelCore& kernel); |
| 296 | ~IHomeMenuFunctions() override; | 296 | ~IHomeMenuFunctions() override; |
| 297 | 297 | ||
| 298 | private: | 298 | private: |
| 299 | void RequestToGetForeground(Kernel::HLERequestContext& ctx); | 299 | void RequestToGetForeground(Kernel::HLERequestContext& ctx); |
| 300 | void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx); | ||
| 301 | |||
| 302 | Kernel::EventPair pop_from_general_channel_event; | ||
| 303 | Kernel::KernelCore& kernel; | ||
| 300 | }; | 304 | }; |
| 301 | 305 | ||
| 302 | class IGlobalStateController final : public ServiceFramework<IGlobalStateController> { | 306 | class IGlobalStateController final : public ServiceFramework<IGlobalStateController> { |
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index e454b77d8..9df286d17 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp | |||
| @@ -202,7 +202,7 @@ private: | |||
| 202 | 202 | ||
| 203 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 203 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 204 | rb.Push(RESULT_SUCCESS); | 204 | rb.Push(RESULT_SUCCESS); |
| 205 | rb.PushIpcInterface<IHomeMenuFunctions>(); | 205 | rb.PushIpcInterface<IHomeMenuFunctions>(system.Kernel()); |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | void GetGlobalStateController(Kernel::HLERequestContext& ctx) { | 208 | void GetGlobalStateController(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp index d7f1d348d..3e2299426 100644 --- a/src/core/hle/service/audio/audin_u.cpp +++ b/src/core/hle/service/audio/audin_u.cpp | |||
| @@ -2,6 +2,9 @@ | |||
| 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 "common/logging/log.h" | ||
| 6 | #include "core/hle/ipc_helpers.h" | ||
| 7 | #include "core/hle/kernel/hle_ipc.h" | ||
| 5 | #include "core/hle/service/audio/audin_u.h" | 8 | #include "core/hle/service/audio/audin_u.h" |
| 6 | 9 | ||
| 7 | namespace Service::Audio { | 10 | namespace Service::Audio { |
| @@ -36,11 +39,12 @@ public: | |||
| 36 | AudInU::AudInU() : ServiceFramework("audin:u") { | 39 | AudInU::AudInU() : ServiceFramework("audin:u") { |
| 37 | // clang-format off | 40 | // clang-format off |
| 38 | static const FunctionInfo functions[] = { | 41 | static const FunctionInfo functions[] = { |
| 39 | {0, nullptr, "ListAudioIns"}, | 42 | {0, &AudInU::ListAudioIns, "ListAudioIns"}, |
| 40 | {1, nullptr, "OpenAudioIn"}, | 43 | {1, &AudInU::OpenAudioIn, "OpenAudioIn"}, |
| 41 | {2, nullptr, "Unknown"}, | 44 | {2, &AudInU::ListAudioIns, "ListAudioInsAuto"}, |
| 42 | {3, nullptr, "OpenAudioInAuto"}, | 45 | {3, &AudInU::OpenAudioIn, "OpenAudioInAuto"}, |
| 43 | {4, nullptr, "ListAudioInsAuto"}, | 46 | {4, &AudInU::ListAudioInsAutoFiltered, "ListAudioInsAutoFiltered"}, |
| 47 | {5, &AudInU::OpenAudioInProtocolSpecified, "OpenAudioInProtocolSpecified"}, | ||
| 44 | }; | 48 | }; |
| 45 | // clang-format on | 49 | // clang-format on |
| 46 | 50 | ||
| @@ -49,4 +53,60 @@ AudInU::AudInU() : ServiceFramework("audin:u") { | |||
| 49 | 53 | ||
| 50 | AudInU::~AudInU() = default; | 54 | AudInU::~AudInU() = default; |
| 51 | 55 | ||
| 56 | void AudInU::ListAudioIns(Kernel::HLERequestContext& ctx) { | ||
| 57 | LOG_DEBUG(Service_Audio, "called"); | ||
| 58 | const std::size_t count = ctx.GetWriteBufferSize() / sizeof(AudioInDeviceName); | ||
| 59 | |||
| 60 | const std::size_t device_count = std::min(count, audio_device_names.size()); | ||
| 61 | std::vector<AudioInDeviceName> device_names; | ||
| 62 | device_names.reserve(device_count); | ||
| 63 | |||
| 64 | for (std::size_t i = 0; i < device_count; i++) { | ||
| 65 | const auto& device_name = audio_device_names[i]; | ||
| 66 | auto& entry = device_names.emplace_back(); | ||
| 67 | device_name.copy(entry.data(), device_name.size()); | ||
| 68 | } | ||
| 69 | |||
| 70 | ctx.WriteBuffer(device_names); | ||
| 71 | |||
| 72 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 73 | rb.Push(RESULT_SUCCESS); | ||
| 74 | rb.Push(static_cast<u32>(device_names.size())); | ||
| 75 | } | ||
| 76 | |||
| 77 | void AudInU::ListAudioInsAutoFiltered(Kernel::HLERequestContext& ctx) { | ||
| 78 | LOG_DEBUG(Service_Audio, "called"); | ||
| 79 | constexpr u32 device_count = 0; | ||
| 80 | |||
| 81 | // Since we don't actually use any other audio input devices, we return 0 devices. Filtered | ||
| 82 | // device listing just omits the default input device | ||
| 83 | |||
| 84 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 85 | rb.Push(RESULT_SUCCESS); | ||
| 86 | rb.Push(static_cast<u32>(device_count)); | ||
| 87 | } | ||
| 88 | |||
| 89 | void AudInU::OpenInOutImpl(Kernel::HLERequestContext& ctx) { | ||
| 90 | AudInOutParams params{}; | ||
| 91 | params.channel_count = 2; | ||
| 92 | params.sample_format = SampleFormat::PCM16; | ||
| 93 | params.sample_rate = 48000; | ||
| 94 | params.state = State::Started; | ||
| 95 | |||
| 96 | IPC::ResponseBuilder rb{ctx, 6, 0, 1}; | ||
| 97 | rb.Push(RESULT_SUCCESS); | ||
| 98 | rb.PushRaw<AudInOutParams>(params); | ||
| 99 | rb.PushIpcInterface<IAudioIn>(); | ||
| 100 | } | ||
| 101 | |||
| 102 | void AudInU::OpenAudioIn(Kernel::HLERequestContext& ctx) { | ||
| 103 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | ||
| 104 | OpenInOutImpl(ctx); | ||
| 105 | } | ||
| 106 | |||
| 107 | void AudInU::OpenAudioInProtocolSpecified(Kernel::HLERequestContext& ctx) { | ||
| 108 | LOG_WARNING(Service_Audio, "(STUBBED) called"); | ||
| 109 | OpenInOutImpl(ctx); | ||
| 110 | } | ||
| 111 | |||
| 52 | } // namespace Service::Audio | 112 | } // namespace Service::Audio |
diff --git a/src/core/hle/service/audio/audin_u.h b/src/core/hle/service/audio/audin_u.h index 0538b9560..a599f4a64 100644 --- a/src/core/hle/service/audio/audin_u.h +++ b/src/core/hle/service/audio/audin_u.h | |||
| @@ -16,6 +16,35 @@ class AudInU final : public ServiceFramework<AudInU> { | |||
| 16 | public: | 16 | public: |
| 17 | explicit AudInU(); | 17 | explicit AudInU(); |
| 18 | ~AudInU() override; | 18 | ~AudInU() override; |
| 19 | |||
| 20 | private: | ||
| 21 | enum class SampleFormat : u32_le { | ||
| 22 | PCM16 = 2, | ||
| 23 | }; | ||
| 24 | |||
| 25 | enum class State : u32_le { | ||
| 26 | Started = 0, | ||
| 27 | Stopped = 1, | ||
| 28 | }; | ||
| 29 | |||
| 30 | struct AudInOutParams { | ||
| 31 | u32_le sample_rate{}; | ||
| 32 | u32_le channel_count{}; | ||
| 33 | SampleFormat sample_format{}; | ||
| 34 | State state{}; | ||
| 35 | }; | ||
| 36 | static_assert(sizeof(AudInOutParams) == 0x10, "AudInOutParams is an invalid size"); | ||
| 37 | |||
| 38 | using AudioInDeviceName = std::array<char, 256>; | ||
| 39 | static constexpr std::array<std::string_view, 1> audio_device_names{{ | ||
| 40 | "BuiltInHeadset", | ||
| 41 | }}; | ||
| 42 | |||
| 43 | void ListAudioIns(Kernel::HLERequestContext& ctx); | ||
| 44 | void ListAudioInsAutoFiltered(Kernel::HLERequestContext& ctx); | ||
| 45 | void OpenInOutImpl(Kernel::HLERequestContext& ctx); | ||
| 46 | void OpenAudioIn(Kernel::HLERequestContext& ctx); | ||
| 47 | void OpenAudioInProtocolSpecified(Kernel::HLERequestContext& ctx); | ||
| 19 | }; | 48 | }; |
| 20 | 49 | ||
| 21 | } // namespace Service::Audio | 50 | } // namespace Service::Audio |
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 5febe8fc1..d29e78d7e 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp | |||
| @@ -4,8 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #include <fmt/ostream.h> | 5 | #include <fmt/ostream.h> |
| 6 | #include <httplib.h> | 6 | #include <httplib.h> |
| 7 | #include <json.hpp> | ||
| 8 | #include <mbedtls/sha256.h> | 7 | #include <mbedtls/sha256.h> |
| 8 | #include <nlohmann/json.hpp> | ||
| 9 | #include "common/hex_util.h" | 9 | #include "common/hex_util.h" |
| 10 | #include "common/logging/backend.h" | 10 | #include "common/logging/backend.h" |
| 11 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5559587e3..c84cb1483 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -157,7 +157,7 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) { | |||
| 157 | {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"}, | 157 | {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"}, |
| 158 | {21, &Hid::ActivateMouse, "ActivateMouse"}, | 158 | {21, &Hid::ActivateMouse, "ActivateMouse"}, |
| 159 | {31, &Hid::ActivateKeyboard, "ActivateKeyboard"}, | 159 | {31, &Hid::ActivateKeyboard, "ActivateKeyboard"}, |
| 160 | {32, nullptr, "SendKeyboardLockKeyEvent"}, | 160 | {32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, |
| 161 | {40, nullptr, "AcquireXpadIdEventHandle"}, | 161 | {40, nullptr, "AcquireXpadIdEventHandle"}, |
| 162 | {41, nullptr, "ReleaseXpadIdEventHandle"}, | 162 | {41, nullptr, "ReleaseXpadIdEventHandle"}, |
| 163 | {51, &Hid::ActivateXpad, "ActivateXpad"}, | 163 | {51, &Hid::ActivateXpad, "ActivateXpad"}, |
| @@ -871,6 +871,15 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { | |||
| 871 | rb.Push(RESULT_SUCCESS); | 871 | rb.Push(RESULT_SUCCESS); |
| 872 | } | 872 | } |
| 873 | 873 | ||
| 874 | void Hid::SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx) { | ||
| 875 | IPC::RequestParser rp{ctx}; | ||
| 876 | const auto flags{rp.Pop<u32>()}; | ||
| 877 | LOG_WARNING(Service_HID, "(STUBBED) called. flags={}", flags); | ||
| 878 | |||
| 879 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 880 | rb.Push(RESULT_SUCCESS); | ||
| 881 | } | ||
| 882 | |||
| 874 | class HidDbg final : public ServiceFramework<HidDbg> { | 883 | class HidDbg final : public ServiceFramework<HidDbg> { |
| 875 | public: | 884 | public: |
| 876 | explicit HidDbg() : ServiceFramework{"hid:dbg"} { | 885 | explicit HidDbg() : ServiceFramework{"hid:dbg"} { |
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 23552efb1..c8ed4ad8b 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -130,6 +130,7 @@ private: | |||
| 130 | void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); | 130 | void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); |
| 131 | void StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx); | 131 | void StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx); |
| 132 | void InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx); | 132 | void InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx); |
| 133 | void SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx); | ||
| 133 | 134 | ||
| 134 | std::shared_ptr<IAppletResource> applet_resource; | 135 | std::shared_ptr<IAppletResource> applet_resource; |
| 135 | Core::System& system; | 136 | Core::System& system; |
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 558cbe6d7..76cfa5a17 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp | |||
| @@ -4,11 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | #include <ctime> | 5 | #include <ctime> |
| 6 | #include <fstream> | 6 | #include <fstream> |
| 7 | #include <iomanip> | ||
| 7 | 8 | ||
| 8 | #include <fmt/chrono.h> | 9 | #include <fmt/chrono.h> |
| 9 | #include <fmt/format.h> | 10 | #include <fmt/format.h> |
| 10 | #include <fmt/ostream.h> | 11 | #include <fmt/ostream.h> |
| 11 | #include <json.hpp> | 12 | #include <nlohmann/json.hpp> |
| 12 | 13 | ||
| 13 | #include "common/file_util.h" | 14 | #include "common/file_util.h" |
| 14 | #include "common/hex_util.h" | 15 | #include "common/hex_util.h" |
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index cd6c257f5..2b0bdc4d3 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -96,6 +96,7 @@ void LogSettings() { | |||
| 96 | LogSetting("Renderer_UseAsynchronousGpuEmulation", | 96 | LogSetting("Renderer_UseAsynchronousGpuEmulation", |
| 97 | Settings::values.use_asynchronous_gpu_emulation); | 97 | Settings::values.use_asynchronous_gpu_emulation); |
| 98 | LogSetting("Renderer_UseVsync", Settings::values.use_vsync); | 98 | LogSetting("Renderer_UseVsync", Settings::values.use_vsync); |
| 99 | LogSetting("Renderer_AnisotropicFilteringLevel", Settings::values.max_anisotropy); | ||
| 99 | LogSetting("Audio_OutputEngine", Settings::values.sink_id); | 100 | LogSetting("Audio_OutputEngine", Settings::values.sink_id); |
| 100 | LogSetting("Audio_EnableAudioStretching", Settings::values.enable_audio_stretching); | 101 | LogSetting("Audio_EnableAudioStretching", Settings::values.enable_audio_stretching); |
| 101 | LogSetting("Audio_OutputDevice", Settings::values.audio_device_id); | 102 | LogSetting("Audio_OutputDevice", Settings::values.audio_device_id); |
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index c98c848cf..95e351e24 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -18,7 +18,9 @@ namespace InputCommon { | |||
| 18 | 18 | ||
| 19 | static std::shared_ptr<Keyboard> keyboard; | 19 | static std::shared_ptr<Keyboard> keyboard; |
| 20 | static std::shared_ptr<MotionEmu> motion_emu; | 20 | static std::shared_ptr<MotionEmu> motion_emu; |
| 21 | #ifdef HAVE_SDL2 | ||
| 21 | static std::unique_ptr<SDL::State> sdl; | 22 | static std::unique_ptr<SDL::State> sdl; |
| 23 | #endif | ||
| 22 | static std::unique_ptr<CemuhookUDP::State> udp; | 24 | static std::unique_ptr<CemuhookUDP::State> udp; |
| 23 | 25 | ||
| 24 | void Init() { | 26 | void Init() { |
| @@ -29,7 +31,9 @@ void Init() { | |||
| 29 | motion_emu = std::make_shared<MotionEmu>(); | 31 | motion_emu = std::make_shared<MotionEmu>(); |
| 30 | Input::RegisterFactory<Input::MotionDevice>("motion_emu", motion_emu); | 32 | Input::RegisterFactory<Input::MotionDevice>("motion_emu", motion_emu); |
| 31 | 33 | ||
| 34 | #ifdef HAVE_SDL2 | ||
| 32 | sdl = SDL::Init(); | 35 | sdl = SDL::Init(); |
| 36 | #endif | ||
| 33 | 37 | ||
| 34 | udp = CemuhookUDP::Init(); | 38 | udp = CemuhookUDP::Init(); |
| 35 | } | 39 | } |
| @@ -40,7 +44,9 @@ void Shutdown() { | |||
| 40 | Input::UnregisterFactory<Input::AnalogDevice>("analog_from_button"); | 44 | Input::UnregisterFactory<Input::AnalogDevice>("analog_from_button"); |
| 41 | Input::UnregisterFactory<Input::MotionDevice>("motion_emu"); | 45 | Input::UnregisterFactory<Input::MotionDevice>("motion_emu"); |
| 42 | motion_emu.reset(); | 46 | motion_emu.reset(); |
| 47 | #ifdef HAVE_SDL2 | ||
| 43 | sdl.reset(); | 48 | sdl.reset(); |
| 49 | #endif | ||
| 44 | udp.reset(); | 50 | udp.reset(); |
| 45 | } | 51 | } |
| 46 | 52 | ||
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index ff53282c9..d23c53843 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -8,6 +8,7 @@ add_library(video_core STATIC | |||
| 8 | dma_pusher.h | 8 | dma_pusher.h |
| 9 | engines/const_buffer_engine_interface.h | 9 | engines/const_buffer_engine_interface.h |
| 10 | engines/const_buffer_info.h | 10 | engines/const_buffer_info.h |
| 11 | engines/engine_interface.h | ||
| 11 | engines/engine_upload.cpp | 12 | engines/engine_upload.cpp |
| 12 | engines/engine_upload.h | 13 | engines/engine_upload.h |
| 13 | engines/fermi_2d.cpp | 14 | engines/fermi_2d.cpp |
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 510f11089..56e570994 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 8 | #include <list> | 7 | #include <list> |
| 9 | #include <memory> | 8 | #include <memory> |
| 10 | #include <mutex> | 9 | #include <mutex> |
| @@ -89,10 +88,6 @@ public: | |||
| 89 | map->MarkAsWritten(true); | 88 | map->MarkAsWritten(true); |
| 90 | MarkRegionAsWritten(map->GetStart(), map->GetEnd() - 1); | 89 | MarkRegionAsWritten(map->GetStart(), map->GetEnd() - 1); |
| 91 | } | 90 | } |
| 92 | } else { | ||
| 93 | if (map->IsWritten()) { | ||
| 94 | WriteBarrier(); | ||
| 95 | } | ||
| 96 | } | 91 | } |
| 97 | 92 | ||
| 98 | return {ToHandle(block), static_cast<u64>(block->GetOffset(cpu_addr))}; | 93 | return {ToHandle(block), static_cast<u64>(block->GetOffset(cpu_addr))}; |
| @@ -254,8 +249,6 @@ protected: | |||
| 254 | 249 | ||
| 255 | virtual BufferType ToHandle(const OwnerBuffer& storage) = 0; | 250 | virtual BufferType ToHandle(const OwnerBuffer& storage) = 0; |
| 256 | 251 | ||
| 257 | virtual void WriteBarrier() = 0; | ||
| 258 | |||
| 259 | virtual OwnerBuffer CreateBlock(VAddr cpu_addr, std::size_t size) = 0; | 252 | virtual OwnerBuffer CreateBlock(VAddr cpu_addr, std::size_t size) = 0; |
| 260 | 253 | ||
| 261 | virtual void UploadBlockData(const OwnerBuffer& buffer, std::size_t offset, std::size_t size, | 254 | virtual void UploadBlockData(const OwnerBuffer& buffer, std::size_t offset, std::size_t size, |
diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index 16311f05e..bdc023d54 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp | |||
| @@ -27,6 +27,8 @@ void DmaPusher::DispatchCalls() { | |||
| 27 | 27 | ||
| 28 | dma_pushbuffer_subindex = 0; | 28 | dma_pushbuffer_subindex = 0; |
| 29 | 29 | ||
| 30 | dma_state.is_last_call = true; | ||
| 31 | |||
| 30 | while (system.IsPoweredOn()) { | 32 | while (system.IsPoweredOn()) { |
| 31 | if (!Step()) { | 33 | if (!Step()) { |
| 32 | break; | 34 | break; |
| @@ -82,9 +84,11 @@ bool DmaPusher::Step() { | |||
| 82 | index); | 84 | index); |
| 83 | CallMultiMethod(&command_header.argument, max_write); | 85 | CallMultiMethod(&command_header.argument, max_write); |
| 84 | dma_state.method_count -= max_write; | 86 | dma_state.method_count -= max_write; |
| 87 | dma_state.is_last_call = true; | ||
| 85 | index += max_write; | 88 | index += max_write; |
| 86 | continue; | 89 | continue; |
| 87 | } else { | 90 | } else { |
| 91 | dma_state.is_last_call = dma_state.method_count <= 1; | ||
| 88 | CallMethod(command_header.argument); | 92 | CallMethod(command_header.argument); |
| 89 | } | 93 | } |
| 90 | 94 | ||
| @@ -144,12 +148,22 @@ void DmaPusher::SetState(const CommandHeader& command_header) { | |||
| 144 | } | 148 | } |
| 145 | 149 | ||
| 146 | void DmaPusher::CallMethod(u32 argument) const { | 150 | void DmaPusher::CallMethod(u32 argument) const { |
| 147 | gpu.CallMethod({dma_state.method, argument, dma_state.subchannel, dma_state.method_count}); | 151 | if (dma_state.method < non_puller_methods) { |
| 152 | gpu.CallMethod({dma_state.method, argument, dma_state.subchannel, dma_state.method_count}); | ||
| 153 | } else { | ||
| 154 | subchannels[dma_state.subchannel]->CallMethod(dma_state.method, argument, | ||
| 155 | dma_state.is_last_call); | ||
| 156 | } | ||
| 148 | } | 157 | } |
| 149 | 158 | ||
| 150 | void DmaPusher::CallMultiMethod(const u32* base_start, u32 num_methods) const { | 159 | void DmaPusher::CallMultiMethod(const u32* base_start, u32 num_methods) const { |
| 151 | gpu.CallMultiMethod(dma_state.method, dma_state.subchannel, base_start, num_methods, | 160 | if (dma_state.method < non_puller_methods) { |
| 152 | dma_state.method_count); | 161 | gpu.CallMultiMethod(dma_state.method, dma_state.subchannel, base_start, num_methods, |
| 162 | dma_state.method_count); | ||
| 163 | } else { | ||
| 164 | subchannels[dma_state.subchannel]->CallMultiMethod(dma_state.method, base_start, | ||
| 165 | num_methods, dma_state.method_count); | ||
| 166 | } | ||
| 153 | } | 167 | } |
| 154 | 168 | ||
| 155 | } // namespace Tegra | 169 | } // namespace Tegra |
diff --git a/src/video_core/dma_pusher.h b/src/video_core/dma_pusher.h index 6cef71306..e8b714e94 100644 --- a/src/video_core/dma_pusher.h +++ b/src/video_core/dma_pusher.h | |||
| @@ -4,11 +4,13 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 7 | #include <vector> | 8 | #include <vector> |
| 8 | #include <queue> | 9 | #include <queue> |
| 9 | 10 | ||
| 10 | #include "common/bit_field.h" | 11 | #include "common/bit_field.h" |
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "video_core/engines/engine_interface.h" | ||
| 12 | 14 | ||
| 13 | namespace Core { | 15 | namespace Core { |
| 14 | class System; | 16 | class System; |
| @@ -69,7 +71,13 @@ public: | |||
| 69 | 71 | ||
| 70 | void DispatchCalls(); | 72 | void DispatchCalls(); |
| 71 | 73 | ||
| 74 | void BindSubchannel(Tegra::Engines::EngineInterface* engine, u32 subchannel_id) { | ||
| 75 | subchannels[subchannel_id] = engine; | ||
| 76 | } | ||
| 77 | |||
| 72 | private: | 78 | private: |
| 79 | static constexpr u32 non_puller_methods = 0x40; | ||
| 80 | static constexpr u32 max_subchannels = 8; | ||
| 73 | bool Step(); | 81 | bool Step(); |
| 74 | 82 | ||
| 75 | void SetState(const CommandHeader& command_header); | 83 | void SetState(const CommandHeader& command_header); |
| @@ -88,6 +96,7 @@ private: | |||
| 88 | u32 method_count; ///< Current method count | 96 | u32 method_count; ///< Current method count |
| 89 | u32 length_pending; ///< Large NI command length pending | 97 | u32 length_pending; ///< Large NI command length pending |
| 90 | bool non_incrementing; ///< Current command's NI flag | 98 | bool non_incrementing; ///< Current command's NI flag |
| 99 | bool is_last_call; | ||
| 91 | }; | 100 | }; |
| 92 | 101 | ||
| 93 | DmaState dma_state{}; | 102 | DmaState dma_state{}; |
| @@ -96,6 +105,8 @@ private: | |||
| 96 | GPUVAddr dma_mget{}; ///< main pushbuffer last read address | 105 | GPUVAddr dma_mget{}; ///< main pushbuffer last read address |
| 97 | bool ib_enable{true}; ///< IB mode enabled | 106 | bool ib_enable{true}; ///< IB mode enabled |
| 98 | 107 | ||
| 108 | std::array<Tegra::Engines::EngineInterface*, max_subchannels> subchannels{}; | ||
| 109 | |||
| 99 | GPU& gpu; | 110 | GPU& gpu; |
| 100 | Core::System& system; | 111 | Core::System& system; |
| 101 | }; | 112 | }; |
diff --git a/src/video_core/engines/engine_interface.h b/src/video_core/engines/engine_interface.h new file mode 100644 index 000000000..18a9db7e6 --- /dev/null +++ b/src/video_core/engines/engine_interface.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | // Copyright 2020 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <type_traits> | ||
| 8 | #include "common/common_types.h" | ||
| 9 | |||
| 10 | namespace Tegra::Engines { | ||
| 11 | |||
| 12 | class EngineInterface { | ||
| 13 | public: | ||
| 14 | /// Write the value to the register identified by method. | ||
| 15 | virtual void CallMethod(u32 method, u32 method_argument, bool is_last_call) = 0; | ||
| 16 | |||
| 17 | /// Write multiple values to the register identified by method. | ||
| 18 | virtual void CallMultiMethod(u32 method, const u32* base_start, u32 amount, | ||
| 19 | u32 methods_pending) = 0; | ||
| 20 | }; | ||
| 21 | |||
| 22 | } // namespace Tegra::Engines | ||
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp index 8a47614d2..ff10ff40d 100644 --- a/src/video_core/engines/fermi_2d.cpp +++ b/src/video_core/engines/fermi_2d.cpp | |||
| @@ -12,13 +12,13 @@ namespace Tegra::Engines { | |||
| 12 | 12 | ||
| 13 | Fermi2D::Fermi2D(VideoCore::RasterizerInterface& rasterizer) : rasterizer{rasterizer} {} | 13 | Fermi2D::Fermi2D(VideoCore::RasterizerInterface& rasterizer) : rasterizer{rasterizer} {} |
| 14 | 14 | ||
| 15 | void Fermi2D::CallMethod(const GPU::MethodCall& method_call) { | 15 | void Fermi2D::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 16 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | 16 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 17 | "Invalid Fermi2D register, increase the size of the Regs structure"); | 17 | "Invalid Fermi2D register, increase the size of the Regs structure"); |
| 18 | 18 | ||
| 19 | regs.reg_array[method_call.method] = method_call.argument; | 19 | regs.reg_array[method] = method_argument; |
| 20 | 20 | ||
| 21 | switch (method_call.method) { | 21 | switch (method) { |
| 22 | // Trigger the surface copy on the last register write. This is blit_src_y, but this is 64-bit, | 22 | // Trigger the surface copy on the last register write. This is blit_src_y, but this is 64-bit, |
| 23 | // so trigger on the second 32-bit write. | 23 | // so trigger on the second 32-bit write. |
| 24 | case FERMI2D_REG_INDEX(blit_src_y) + 1: { | 24 | case FERMI2D_REG_INDEX(blit_src_y) + 1: { |
| @@ -30,7 +30,7 @@ void Fermi2D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 30 | 30 | ||
| 31 | void Fermi2D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) { | 31 | void Fermi2D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) { |
| 32 | for (std::size_t i = 0; i < amount; i++) { | 32 | for (std::size_t i = 0; i < amount; i++) { |
| 33 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 33 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| 36 | 36 | ||
diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h index 939a5966d..8f37d053f 100644 --- a/src/video_core/engines/fermi_2d.h +++ b/src/video_core/engines/fermi_2d.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "common/common_funcs.h" | 10 | #include "common/common_funcs.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "common/math_util.h" | 12 | #include "common/math_util.h" |
| 13 | #include "video_core/engines/engine_interface.h" | ||
| 13 | #include "video_core/gpu.h" | 14 | #include "video_core/gpu.h" |
| 14 | 15 | ||
| 15 | namespace Tegra { | 16 | namespace Tegra { |
| @@ -31,16 +32,17 @@ namespace Tegra::Engines { | |||
| 31 | #define FERMI2D_REG_INDEX(field_name) \ | 32 | #define FERMI2D_REG_INDEX(field_name) \ |
| 32 | (offsetof(Tegra::Engines::Fermi2D::Regs, field_name) / sizeof(u32)) | 33 | (offsetof(Tegra::Engines::Fermi2D::Regs, field_name) / sizeof(u32)) |
| 33 | 34 | ||
| 34 | class Fermi2D final { | 35 | class Fermi2D final : public EngineInterface { |
| 35 | public: | 36 | public: |
| 36 | explicit Fermi2D(VideoCore::RasterizerInterface& rasterizer); | 37 | explicit Fermi2D(VideoCore::RasterizerInterface& rasterizer); |
| 37 | ~Fermi2D() = default; | 38 | ~Fermi2D() = default; |
| 38 | 39 | ||
| 39 | /// Write the value to the register identified by method. | 40 | /// Write the value to the register identified by method. |
| 40 | void CallMethod(const GPU::MethodCall& method_call); | 41 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 41 | 42 | ||
| 42 | /// Write multiple values to the register identified by method. | 43 | /// Write multiple values to the register identified by method. |
| 43 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 44 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 45 | u32 methods_pending) override; | ||
| 44 | 46 | ||
| 45 | enum class Origin : u32 { | 47 | enum class Origin : u32 { |
| 46 | Center = 0, | 48 | Center = 0, |
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp index 00a12175f..f6237fc6a 100644 --- a/src/video_core/engines/kepler_compute.cpp +++ b/src/video_core/engines/kepler_compute.cpp | |||
| @@ -24,20 +24,19 @@ KeplerCompute::KeplerCompute(Core::System& system, VideoCore::RasterizerInterfac | |||
| 24 | 24 | ||
| 25 | KeplerCompute::~KeplerCompute() = default; | 25 | KeplerCompute::~KeplerCompute() = default; |
| 26 | 26 | ||
| 27 | void KeplerCompute::CallMethod(const GPU::MethodCall& method_call) { | 27 | void KeplerCompute::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 28 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | 28 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 29 | "Invalid KeplerCompute register, increase the size of the Regs structure"); | 29 | "Invalid KeplerCompute register, increase the size of the Regs structure"); |
| 30 | 30 | ||
| 31 | regs.reg_array[method_call.method] = method_call.argument; | 31 | regs.reg_array[method] = method_argument; |
| 32 | 32 | ||
| 33 | switch (method_call.method) { | 33 | switch (method) { |
| 34 | case KEPLER_COMPUTE_REG_INDEX(exec_upload): { | 34 | case KEPLER_COMPUTE_REG_INDEX(exec_upload): { |
| 35 | upload_state.ProcessExec(regs.exec_upload.linear != 0); | 35 | upload_state.ProcessExec(regs.exec_upload.linear != 0); |
| 36 | break; | 36 | break; |
| 37 | } | 37 | } |
| 38 | case KEPLER_COMPUTE_REG_INDEX(data_upload): { | 38 | case KEPLER_COMPUTE_REG_INDEX(data_upload): { |
| 39 | const bool is_last_call = method_call.IsLastCall(); | 39 | upload_state.ProcessData(method_argument, is_last_call); |
| 40 | upload_state.ProcessData(method_call.argument, is_last_call); | ||
| 41 | if (is_last_call) { | 40 | if (is_last_call) { |
| 42 | system.GPU().Maxwell3D().OnMemoryWrite(); | 41 | system.GPU().Maxwell3D().OnMemoryWrite(); |
| 43 | } | 42 | } |
| @@ -54,7 +53,7 @@ void KeplerCompute::CallMethod(const GPU::MethodCall& method_call) { | |||
| 54 | void KeplerCompute::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | 53 | void KeplerCompute::CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 55 | u32 methods_pending) { | 54 | u32 methods_pending) { |
| 56 | for (std::size_t i = 0; i < amount; i++) { | 55 | for (std::size_t i = 0; i < amount; i++) { |
| 57 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 56 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 58 | } | 57 | } |
| 59 | } | 58 | } |
| 60 | 59 | ||
diff --git a/src/video_core/engines/kepler_compute.h b/src/video_core/engines/kepler_compute.h index fe55fdfd0..18ceedfaf 100644 --- a/src/video_core/engines/kepler_compute.h +++ b/src/video_core/engines/kepler_compute.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "video_core/engines/const_buffer_engine_interface.h" | 13 | #include "video_core/engines/const_buffer_engine_interface.h" |
| 14 | #include "video_core/engines/engine_interface.h" | ||
| 14 | #include "video_core/engines/engine_upload.h" | 15 | #include "video_core/engines/engine_upload.h" |
| 15 | #include "video_core/engines/shader_type.h" | 16 | #include "video_core/engines/shader_type.h" |
| 16 | #include "video_core/gpu.h" | 17 | #include "video_core/gpu.h" |
| @@ -39,7 +40,7 @@ namespace Tegra::Engines { | |||
| 39 | #define KEPLER_COMPUTE_REG_INDEX(field_name) \ | 40 | #define KEPLER_COMPUTE_REG_INDEX(field_name) \ |
| 40 | (offsetof(Tegra::Engines::KeplerCompute::Regs, field_name) / sizeof(u32)) | 41 | (offsetof(Tegra::Engines::KeplerCompute::Regs, field_name) / sizeof(u32)) |
| 41 | 42 | ||
| 42 | class KeplerCompute final : public ConstBufferEngineInterface { | 43 | class KeplerCompute final : public ConstBufferEngineInterface, public EngineInterface { |
| 43 | public: | 44 | public: |
| 44 | explicit KeplerCompute(Core::System& system, VideoCore::RasterizerInterface& rasterizer, | 45 | explicit KeplerCompute(Core::System& system, VideoCore::RasterizerInterface& rasterizer, |
| 45 | MemoryManager& memory_manager); | 46 | MemoryManager& memory_manager); |
| @@ -200,10 +201,11 @@ public: | |||
| 200 | "KeplerCompute LaunchParams has wrong size"); | 201 | "KeplerCompute LaunchParams has wrong size"); |
| 201 | 202 | ||
| 202 | /// Write the value to the register identified by method. | 203 | /// Write the value to the register identified by method. |
| 203 | void CallMethod(const GPU::MethodCall& method_call); | 204 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 204 | 205 | ||
| 205 | /// Write multiple values to the register identified by method. | 206 | /// Write multiple values to the register identified by method. |
| 206 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 207 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 208 | u32 methods_pending) override; | ||
| 207 | 209 | ||
| 208 | Texture::FullTextureInfo GetTexture(std::size_t offset) const; | 210 | Texture::FullTextureInfo GetTexture(std::size_t offset) const; |
| 209 | 211 | ||
diff --git a/src/video_core/engines/kepler_memory.cpp b/src/video_core/engines/kepler_memory.cpp index 586ff15dc..dc71b2eec 100644 --- a/src/video_core/engines/kepler_memory.cpp +++ b/src/video_core/engines/kepler_memory.cpp | |||
| @@ -19,20 +19,19 @@ KeplerMemory::KeplerMemory(Core::System& system, MemoryManager& memory_manager) | |||
| 19 | 19 | ||
| 20 | KeplerMemory::~KeplerMemory() = default; | 20 | KeplerMemory::~KeplerMemory() = default; |
| 21 | 21 | ||
| 22 | void KeplerMemory::CallMethod(const GPU::MethodCall& method_call) { | 22 | void KeplerMemory::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 23 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | 23 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 24 | "Invalid KeplerMemory register, increase the size of the Regs structure"); | 24 | "Invalid KeplerMemory register, increase the size of the Regs structure"); |
| 25 | 25 | ||
| 26 | regs.reg_array[method_call.method] = method_call.argument; | 26 | regs.reg_array[method] = method_argument; |
| 27 | 27 | ||
| 28 | switch (method_call.method) { | 28 | switch (method) { |
| 29 | case KEPLERMEMORY_REG_INDEX(exec): { | 29 | case KEPLERMEMORY_REG_INDEX(exec): { |
| 30 | upload_state.ProcessExec(regs.exec.linear != 0); | 30 | upload_state.ProcessExec(regs.exec.linear != 0); |
| 31 | break; | 31 | break; |
| 32 | } | 32 | } |
| 33 | case KEPLERMEMORY_REG_INDEX(data): { | 33 | case KEPLERMEMORY_REG_INDEX(data): { |
| 34 | const bool is_last_call = method_call.IsLastCall(); | 34 | upload_state.ProcessData(method_argument, is_last_call); |
| 35 | upload_state.ProcessData(method_call.argument, is_last_call); | ||
| 36 | if (is_last_call) { | 35 | if (is_last_call) { |
| 37 | system.GPU().Maxwell3D().OnMemoryWrite(); | 36 | system.GPU().Maxwell3D().OnMemoryWrite(); |
| 38 | } | 37 | } |
| @@ -44,7 +43,7 @@ void KeplerMemory::CallMethod(const GPU::MethodCall& method_call) { | |||
| 44 | void KeplerMemory::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | 43 | void KeplerMemory::CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 45 | u32 methods_pending) { | 44 | u32 methods_pending) { |
| 46 | for (std::size_t i = 0; i < amount; i++) { | 45 | for (std::size_t i = 0; i < amount; i++) { |
| 47 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 46 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 48 | } | 47 | } |
| 49 | } | 48 | } |
| 50 | 49 | ||
diff --git a/src/video_core/engines/kepler_memory.h b/src/video_core/engines/kepler_memory.h index bb26fb030..5b7f71a00 100644 --- a/src/video_core/engines/kepler_memory.h +++ b/src/video_core/engines/kepler_memory.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "common/bit_field.h" | 10 | #include "common/bit_field.h" |
| 11 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "video_core/engines/engine_interface.h" | ||
| 13 | #include "video_core/engines/engine_upload.h" | 14 | #include "video_core/engines/engine_upload.h" |
| 14 | #include "video_core/gpu.h" | 15 | #include "video_core/gpu.h" |
| 15 | 16 | ||
| @@ -32,16 +33,17 @@ namespace Tegra::Engines { | |||
| 32 | #define KEPLERMEMORY_REG_INDEX(field_name) \ | 33 | #define KEPLERMEMORY_REG_INDEX(field_name) \ |
| 33 | (offsetof(Tegra::Engines::KeplerMemory::Regs, field_name) / sizeof(u32)) | 34 | (offsetof(Tegra::Engines::KeplerMemory::Regs, field_name) / sizeof(u32)) |
| 34 | 35 | ||
| 35 | class KeplerMemory final { | 36 | class KeplerMemory final : public EngineInterface { |
| 36 | public: | 37 | public: |
| 37 | KeplerMemory(Core::System& system, MemoryManager& memory_manager); | 38 | KeplerMemory(Core::System& system, MemoryManager& memory_manager); |
| 38 | ~KeplerMemory(); | 39 | ~KeplerMemory(); |
| 39 | 40 | ||
| 40 | /// Write the value to the register identified by method. | 41 | /// Write the value to the register identified by method. |
| 41 | void CallMethod(const GPU::MethodCall& method_call); | 42 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 42 | 43 | ||
| 43 | /// Write multiple values to the register identified by method. | 44 | /// Write multiple values to the register identified by method. |
| 44 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 45 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 46 | u32 methods_pending) override; | ||
| 45 | 47 | ||
| 46 | struct Regs { | 48 | struct Regs { |
| 47 | static constexpr size_t NUM_REGS = 0x7F; | 49 | static constexpr size_t NUM_REGS = 0x7F; |
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 39e3b66a2..024c9e43b 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -44,6 +44,12 @@ void Maxwell3D::InitializeRegisterDefaults() { | |||
| 44 | viewport.depth_range_near = 0.0f; | 44 | viewport.depth_range_near = 0.0f; |
| 45 | viewport.depth_range_far = 1.0f; | 45 | viewport.depth_range_far = 1.0f; |
| 46 | } | 46 | } |
| 47 | for (auto& viewport : regs.viewport_transform) { | ||
| 48 | viewport.swizzle.x.Assign(Regs::ViewportSwizzle::PositiveX); | ||
| 49 | viewport.swizzle.y.Assign(Regs::ViewportSwizzle::PositiveY); | ||
| 50 | viewport.swizzle.z.Assign(Regs::ViewportSwizzle::PositiveZ); | ||
| 51 | viewport.swizzle.w.Assign(Regs::ViewportSwizzle::PositiveW); | ||
| 52 | } | ||
| 47 | 53 | ||
| 48 | // Doom and Bomberman seems to use the uninitialized registers and just enable blend | 54 | // Doom and Bomberman seems to use the uninitialized registers and just enable blend |
| 49 | // so initialize blend registers with sane values | 55 | // so initialize blend registers with sane values |
| @@ -125,12 +131,10 @@ void Maxwell3D::CallMacroMethod(u32 method, std::size_t num_parameters, const u3 | |||
| 125 | } | 131 | } |
| 126 | } | 132 | } |
| 127 | 133 | ||
| 128 | void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | 134 | void Maxwell3D::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 129 | const u32 method = method_call.method; | ||
| 130 | |||
| 131 | if (method == cb_data_state.current) { | 135 | if (method == cb_data_state.current) { |
| 132 | regs.reg_array[method] = method_call.argument; | 136 | regs.reg_array[method] = method_argument; |
| 133 | ProcessCBData(method_call.argument); | 137 | ProcessCBData(method_argument); |
| 134 | return; | 138 | return; |
| 135 | } else if (cb_data_state.current != null_cb_data) { | 139 | } else if (cb_data_state.current != null_cb_data) { |
| 136 | FinishCBData(); | 140 | FinishCBData(); |
| @@ -153,10 +157,10 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 153 | executing_macro = method; | 157 | executing_macro = method; |
| 154 | } | 158 | } |
| 155 | 159 | ||
| 156 | macro_params.push_back(method_call.argument); | 160 | macro_params.push_back(method_argument); |
| 157 | 161 | ||
| 158 | // Call the macro when there are no more parameters in the command buffer | 162 | // Call the macro when there are no more parameters in the command buffer |
| 159 | if (method_call.IsLastCall()) { | 163 | if (is_last_call) { |
| 160 | CallMacroMethod(executing_macro, macro_params.size(), macro_params.data()); | 164 | CallMacroMethod(executing_macro, macro_params.size(), macro_params.data()); |
| 161 | macro_params.clear(); | 165 | macro_params.clear(); |
| 162 | } | 166 | } |
| @@ -166,7 +170,7 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 166 | ASSERT_MSG(method < Regs::NUM_REGS, | 170 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 167 | "Invalid Maxwell3D register, increase the size of the Regs structure"); | 171 | "Invalid Maxwell3D register, increase the size of the Regs structure"); |
| 168 | 172 | ||
| 169 | u32 arg = method_call.argument; | 173 | u32 arg = method_argument; |
| 170 | // Keep track of the register value in shadow_state when requested. | 174 | // Keep track of the register value in shadow_state when requested. |
| 171 | if (shadow_state.shadow_ram_control == Regs::ShadowRamControl::Track || | 175 | if (shadow_state.shadow_ram_control == Regs::ShadowRamControl::Track || |
| 172 | shadow_state.shadow_ram_control == Regs::ShadowRamControl::TrackWithFilter) { | 176 | shadow_state.shadow_ram_control == Regs::ShadowRamControl::TrackWithFilter) { |
| @@ -184,8 +188,12 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 184 | } | 188 | } |
| 185 | 189 | ||
| 186 | switch (method) { | 190 | switch (method) { |
| 191 | case MAXWELL3D_REG_INDEX(wait_for_idle): { | ||
| 192 | rasterizer.WaitForIdle(); | ||
| 193 | break; | ||
| 194 | } | ||
| 187 | case MAXWELL3D_REG_INDEX(shadow_ram_control): { | 195 | case MAXWELL3D_REG_INDEX(shadow_ram_control): { |
| 188 | shadow_state.shadow_ram_control = static_cast<Regs::ShadowRamControl>(method_call.argument); | 196 | shadow_state.shadow_ram_control = static_cast<Regs::ShadowRamControl>(method_argument); |
| 189 | break; | 197 | break; |
| 190 | } | 198 | } |
| 191 | case MAXWELL3D_REG_INDEX(macros.data): { | 199 | case MAXWELL3D_REG_INDEX(macros.data): { |
| @@ -268,7 +276,6 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 268 | break; | 276 | break; |
| 269 | } | 277 | } |
| 270 | case MAXWELL3D_REG_INDEX(data_upload): { | 278 | case MAXWELL3D_REG_INDEX(data_upload): { |
| 271 | const bool is_last_call = method_call.IsLastCall(); | ||
| 272 | upload_state.ProcessData(arg, is_last_call); | 279 | upload_state.ProcessData(arg, is_last_call); |
| 273 | if (is_last_call) { | 280 | if (is_last_call) { |
| 274 | OnMemoryWrite(); | 281 | OnMemoryWrite(); |
| @@ -326,7 +333,7 @@ void Maxwell3D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | |||
| 326 | } | 333 | } |
| 327 | default: { | 334 | default: { |
| 328 | for (std::size_t i = 0; i < amount; i++) { | 335 | for (std::size_t i = 0; i < amount; i++) { |
| 329 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 336 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 330 | } | 337 | } |
| 331 | } | 338 | } |
| 332 | } | 339 | } |
| @@ -356,16 +363,15 @@ void Maxwell3D::StepInstance(const MMEDrawMode expected_mode, const u32 count) { | |||
| 356 | StepInstance(expected_mode, count); | 363 | StepInstance(expected_mode, count); |
| 357 | } | 364 | } |
| 358 | 365 | ||
| 359 | void Maxwell3D::CallMethodFromMME(const GPU::MethodCall& method_call) { | 366 | void Maxwell3D::CallMethodFromMME(u32 method, u32 method_argument) { |
| 360 | const u32 method = method_call.method; | ||
| 361 | if (mme_inline[method]) { | 367 | if (mme_inline[method]) { |
| 362 | regs.reg_array[method] = method_call.argument; | 368 | regs.reg_array[method] = method_argument; |
| 363 | if (method == MAXWELL3D_REG_INDEX(vertex_buffer.count) || | 369 | if (method == MAXWELL3D_REG_INDEX(vertex_buffer.count) || |
| 364 | method == MAXWELL3D_REG_INDEX(index_array.count)) { | 370 | method == MAXWELL3D_REG_INDEX(index_array.count)) { |
| 365 | const MMEDrawMode expected_mode = method == MAXWELL3D_REG_INDEX(vertex_buffer.count) | 371 | const MMEDrawMode expected_mode = method == MAXWELL3D_REG_INDEX(vertex_buffer.count) |
| 366 | ? MMEDrawMode::Array | 372 | ? MMEDrawMode::Array |
| 367 | : MMEDrawMode::Indexed; | 373 | : MMEDrawMode::Indexed; |
| 368 | StepInstance(expected_mode, method_call.argument); | 374 | StepInstance(expected_mode, method_argument); |
| 369 | } else if (method == MAXWELL3D_REG_INDEX(draw.vertex_begin_gl)) { | 375 | } else if (method == MAXWELL3D_REG_INDEX(draw.vertex_begin_gl)) { |
| 370 | mme_draw.instance_mode = | 376 | mme_draw.instance_mode = |
| 371 | (regs.draw.instance_next != 0) || (regs.draw.instance_cont != 0); | 377 | (regs.draw.instance_next != 0) || (regs.draw.instance_cont != 0); |
| @@ -377,7 +383,7 @@ void Maxwell3D::CallMethodFromMME(const GPU::MethodCall& method_call) { | |||
| 377 | if (mme_draw.current_mode != MMEDrawMode::Undefined) { | 383 | if (mme_draw.current_mode != MMEDrawMode::Undefined) { |
| 378 | FlushMMEInlineDraw(); | 384 | FlushMMEInlineDraw(); |
| 379 | } | 385 | } |
| 380 | CallMethod(method_call); | 386 | CallMethod(method, method_argument, true); |
| 381 | } | 387 | } |
| 382 | } | 388 | } |
| 383 | 389 | ||
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 5e522e0d2..05dd6b39b 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include "common/math_util.h" | 19 | #include "common/math_util.h" |
| 20 | #include "video_core/engines/const_buffer_engine_interface.h" | 20 | #include "video_core/engines/const_buffer_engine_interface.h" |
| 21 | #include "video_core/engines/const_buffer_info.h" | 21 | #include "video_core/engines/const_buffer_info.h" |
| 22 | #include "video_core/engines/engine_interface.h" | ||
| 22 | #include "video_core/engines/engine_upload.h" | 23 | #include "video_core/engines/engine_upload.h" |
| 23 | #include "video_core/engines/shader_type.h" | 24 | #include "video_core/engines/shader_type.h" |
| 24 | #include "video_core/gpu.h" | 25 | #include "video_core/gpu.h" |
| @@ -48,7 +49,7 @@ namespace Tegra::Engines { | |||
| 48 | #define MAXWELL3D_REG_INDEX(field_name) \ | 49 | #define MAXWELL3D_REG_INDEX(field_name) \ |
| 49 | (offsetof(Tegra::Engines::Maxwell3D::Regs, field_name) / sizeof(u32)) | 50 | (offsetof(Tegra::Engines::Maxwell3D::Regs, field_name) / sizeof(u32)) |
| 50 | 51 | ||
| 51 | class Maxwell3D final : public ConstBufferEngineInterface { | 52 | class Maxwell3D final : public ConstBufferEngineInterface, public EngineInterface { |
| 52 | public: | 53 | public: |
| 53 | explicit Maxwell3D(Core::System& system, VideoCore::RasterizerInterface& rasterizer, | 54 | explicit Maxwell3D(Core::System& system, VideoCore::RasterizerInterface& rasterizer, |
| 54 | MemoryManager& memory_manager); | 55 | MemoryManager& memory_manager); |
| @@ -575,6 +576,17 @@ public: | |||
| 575 | Replay = 3, | 576 | Replay = 3, |
| 576 | }; | 577 | }; |
| 577 | 578 | ||
| 579 | enum class ViewportSwizzle : u32 { | ||
| 580 | PositiveX = 0, | ||
| 581 | NegativeX = 1, | ||
| 582 | PositiveY = 2, | ||
| 583 | NegativeY = 3, | ||
| 584 | PositiveZ = 4, | ||
| 585 | NegativeZ = 5, | ||
| 586 | PositiveW = 6, | ||
| 587 | NegativeW = 7, | ||
| 588 | }; | ||
| 589 | |||
| 578 | struct RenderTargetConfig { | 590 | struct RenderTargetConfig { |
| 579 | u32 address_high; | 591 | u32 address_high; |
| 580 | u32 address_low; | 592 | u32 address_low; |
| @@ -618,7 +630,14 @@ public: | |||
| 618 | f32 translate_x; | 630 | f32 translate_x; |
| 619 | f32 translate_y; | 631 | f32 translate_y; |
| 620 | f32 translate_z; | 632 | f32 translate_z; |
| 621 | INSERT_UNION_PADDING_WORDS(2); | 633 | union { |
| 634 | u32 raw; | ||
| 635 | BitField<0, 3, ViewportSwizzle> x; | ||
| 636 | BitField<4, 3, ViewportSwizzle> y; | ||
| 637 | BitField<8, 3, ViewportSwizzle> z; | ||
| 638 | BitField<12, 3, ViewportSwizzle> w; | ||
| 639 | } swizzle; | ||
| 640 | INSERT_UNION_PADDING_WORDS(1); | ||
| 622 | 641 | ||
| 623 | Common::Rectangle<f32> GetRect() const { | 642 | Common::Rectangle<f32> GetRect() const { |
| 624 | return { | 643 | return { |
| @@ -709,7 +728,9 @@ public: | |||
| 709 | 728 | ||
| 710 | union { | 729 | union { |
| 711 | struct { | 730 | struct { |
| 712 | INSERT_UNION_PADDING_WORDS(0x45); | 731 | INSERT_UNION_PADDING_WORDS(0x44); |
| 732 | |||
| 733 | u32 wait_for_idle; | ||
| 713 | 734 | ||
| 714 | struct { | 735 | struct { |
| 715 | u32 upload_address; | 736 | u32 upload_address; |
| @@ -1358,13 +1379,14 @@ public: | |||
| 1358 | u32 GetRegisterValue(u32 method) const; | 1379 | u32 GetRegisterValue(u32 method) const; |
| 1359 | 1380 | ||
| 1360 | /// Write the value to the register identified by method. | 1381 | /// Write the value to the register identified by method. |
| 1361 | void CallMethod(const GPU::MethodCall& method_call); | 1382 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 1362 | 1383 | ||
| 1363 | /// Write multiple values to the register identified by method. | 1384 | /// Write multiple values to the register identified by method. |
| 1364 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 1385 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 1386 | u32 methods_pending) override; | ||
| 1365 | 1387 | ||
| 1366 | /// Write the value to the register identified by method. | 1388 | /// Write the value to the register identified by method. |
| 1367 | void CallMethodFromMME(const GPU::MethodCall& method_call); | 1389 | void CallMethodFromMME(u32 method, u32 method_argument); |
| 1368 | 1390 | ||
| 1369 | void FlushMMEInlineDraw(); | 1391 | void FlushMMEInlineDraw(); |
| 1370 | 1392 | ||
| @@ -1536,6 +1558,7 @@ private: | |||
| 1536 | static_assert(offsetof(Maxwell3D::Regs, field_name) == position * 4, \ | 1558 | static_assert(offsetof(Maxwell3D::Regs, field_name) == position * 4, \ |
| 1537 | "Field " #field_name " has invalid position") | 1559 | "Field " #field_name " has invalid position") |
| 1538 | 1560 | ||
| 1561 | ASSERT_REG_POSITION(wait_for_idle, 0x44); | ||
| 1539 | ASSERT_REG_POSITION(macros, 0x45); | 1562 | ASSERT_REG_POSITION(macros, 0x45); |
| 1540 | ASSERT_REG_POSITION(shadow_ram_control, 0x49); | 1563 | ASSERT_REG_POSITION(shadow_ram_control, 0x49); |
| 1541 | ASSERT_REG_POSITION(upload, 0x60); | 1564 | ASSERT_REG_POSITION(upload, 0x60); |
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 6630005b0..01d7df405 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -17,16 +17,16 @@ namespace Tegra::Engines { | |||
| 17 | MaxwellDMA::MaxwellDMA(Core::System& system, MemoryManager& memory_manager) | 17 | MaxwellDMA::MaxwellDMA(Core::System& system, MemoryManager& memory_manager) |
| 18 | : system{system}, memory_manager{memory_manager} {} | 18 | : system{system}, memory_manager{memory_manager} {} |
| 19 | 19 | ||
| 20 | void MaxwellDMA::CallMethod(const GPU::MethodCall& method_call) { | 20 | void MaxwellDMA::CallMethod(u32 method, u32 method_argument, bool is_last_call) { |
| 21 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | 21 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 22 | "Invalid MaxwellDMA register, increase the size of the Regs structure"); | 22 | "Invalid MaxwellDMA register, increase the size of the Regs structure"); |
| 23 | 23 | ||
| 24 | regs.reg_array[method_call.method] = method_call.argument; | 24 | regs.reg_array[method] = method_argument; |
| 25 | 25 | ||
| 26 | #define MAXWELLDMA_REG_INDEX(field_name) \ | 26 | #define MAXWELLDMA_REG_INDEX(field_name) \ |
| 27 | (offsetof(Tegra::Engines::MaxwellDMA::Regs, field_name) / sizeof(u32)) | 27 | (offsetof(Tegra::Engines::MaxwellDMA::Regs, field_name) / sizeof(u32)) |
| 28 | 28 | ||
| 29 | switch (method_call.method) { | 29 | switch (method) { |
| 30 | case MAXWELLDMA_REG_INDEX(exec): { | 30 | case MAXWELLDMA_REG_INDEX(exec): { |
| 31 | HandleCopy(); | 31 | HandleCopy(); |
| 32 | break; | 32 | break; |
| @@ -39,7 +39,7 @@ void MaxwellDMA::CallMethod(const GPU::MethodCall& method_call) { | |||
| 39 | void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | 39 | void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 40 | u32 methods_pending) { | 40 | u32 methods_pending) { |
| 41 | for (std::size_t i = 0; i < amount; i++) { | 41 | for (std::size_t i = 0; i < amount; i++) { |
| 42 | CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)}); | 42 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); |
| 43 | } | 43 | } |
| 44 | } | 44 | } |
| 45 | 45 | ||
| @@ -90,7 +90,47 @@ void MaxwellDMA::HandleCopy() { | |||
| 90 | ASSERT(regs.exec.enable_2d == 1); | 90 | ASSERT(regs.exec.enable_2d == 1); |
| 91 | 91 | ||
| 92 | if (regs.exec.is_dst_linear && !regs.exec.is_src_linear) { | 92 | if (regs.exec.is_dst_linear && !regs.exec.is_src_linear) { |
| 93 | |||
| 93 | ASSERT(regs.src_params.BlockDepth() == 0); | 94 | ASSERT(regs.src_params.BlockDepth() == 0); |
| 95 | // Optimized path for micro copies. | ||
| 96 | if (regs.dst_pitch * regs.y_count < Texture::GetGOBSize() && regs.dst_pitch <= 64) { | ||
| 97 | const u32 bytes_per_pixel = regs.dst_pitch / regs.x_count; | ||
| 98 | const std::size_t src_size = Texture::GetGOBSize(); | ||
| 99 | const std::size_t dst_size = regs.dst_pitch * regs.y_count; | ||
| 100 | u32 pos_x = regs.src_params.pos_x; | ||
| 101 | u32 pos_y = regs.src_params.pos_y; | ||
| 102 | const u64 offset = | ||
| 103 | Texture::GetGOBOffset(regs.src_params.size_x, regs.src_params.size_y, pos_x, pos_y, | ||
| 104 | regs.src_params.BlockDepth(), bytes_per_pixel); | ||
| 105 | const u32 x_in_gob = 64 / bytes_per_pixel; | ||
| 106 | pos_x = pos_x % x_in_gob; | ||
| 107 | pos_y = pos_y % 8; | ||
| 108 | |||
| 109 | if (read_buffer.size() < src_size) { | ||
| 110 | read_buffer.resize(src_size); | ||
| 111 | } | ||
| 112 | |||
| 113 | if (write_buffer.size() < dst_size) { | ||
| 114 | write_buffer.resize(dst_size); | ||
| 115 | } | ||
| 116 | |||
| 117 | if (Settings::IsGPULevelExtreme()) { | ||
| 118 | memory_manager.ReadBlock(source + offset, read_buffer.data(), src_size); | ||
| 119 | memory_manager.ReadBlock(dest, write_buffer.data(), dst_size); | ||
| 120 | } else { | ||
| 121 | memory_manager.ReadBlockUnsafe(source + offset, read_buffer.data(), src_size); | ||
| 122 | memory_manager.ReadBlockUnsafe(dest, write_buffer.data(), dst_size); | ||
| 123 | } | ||
| 124 | |||
| 125 | Texture::UnswizzleSubrect(regs.x_count, regs.y_count, regs.dst_pitch, | ||
| 126 | regs.src_params.size_x, bytes_per_pixel, read_buffer.data(), | ||
| 127 | write_buffer.data(), regs.src_params.BlockHeight(), pos_x, | ||
| 128 | pos_y); | ||
| 129 | |||
| 130 | memory_manager.WriteBlock(dest, write_buffer.data(), dst_size); | ||
| 131 | |||
| 132 | return; | ||
| 133 | } | ||
| 94 | // If the input is tiled and the output is linear, deswizzle the input and copy it over. | 134 | // If the input is tiled and the output is linear, deswizzle the input and copy it over. |
| 95 | const u32 bytes_per_pixel = regs.dst_pitch / regs.x_count; | 135 | const u32 bytes_per_pixel = regs.dst_pitch / regs.x_count; |
| 96 | const std::size_t src_size = Texture::CalculateSize( | 136 | const std::size_t src_size = Texture::CalculateSize( |
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h index c43ed8194..502dd8509 100644 --- a/src/video_core/engines/maxwell_dma.h +++ b/src/video_core/engines/maxwell_dma.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "common/bit_field.h" | 10 | #include "common/bit_field.h" |
| 11 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "video_core/engines/engine_interface.h" | ||
| 13 | #include "video_core/gpu.h" | 14 | #include "video_core/gpu.h" |
| 14 | 15 | ||
| 15 | namespace Core { | 16 | namespace Core { |
| @@ -27,16 +28,17 @@ namespace Tegra::Engines { | |||
| 27 | * https://github.com/envytools/envytools/blob/master/rnndb/fifo/gk104_copy.xml | 28 | * https://github.com/envytools/envytools/blob/master/rnndb/fifo/gk104_copy.xml |
| 28 | */ | 29 | */ |
| 29 | 30 | ||
| 30 | class MaxwellDMA final { | 31 | class MaxwellDMA final : public EngineInterface { |
| 31 | public: | 32 | public: |
| 32 | explicit MaxwellDMA(Core::System& system, MemoryManager& memory_manager); | 33 | explicit MaxwellDMA(Core::System& system, MemoryManager& memory_manager); |
| 33 | ~MaxwellDMA() = default; | 34 | ~MaxwellDMA() = default; |
| 34 | 35 | ||
| 35 | /// Write the value to the register identified by method. | 36 | /// Write the value to the register identified by method. |
| 36 | void CallMethod(const GPU::MethodCall& method_call); | 37 | void CallMethod(u32 method, u32 method_argument, bool is_last_call) override; |
| 37 | 38 | ||
| 38 | /// Write multiple values to the register identified by method. | 39 | /// Write multiple values to the register identified by method. |
| 39 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending); | 40 | void CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 41 | u32 methods_pending) override; | ||
| 40 | 42 | ||
| 41 | struct Regs { | 43 | struct Regs { |
| 42 | static constexpr std::size_t NUM_REGS = 0x1D6; | 44 | static constexpr std::size_t NUM_REGS = 0x1D6; |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index b87fd873d..8eb017f65 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -299,19 +299,21 @@ void GPU::CallEngineMethod(const MethodCall& method_call) { | |||
| 299 | 299 | ||
| 300 | switch (engine) { | 300 | switch (engine) { |
| 301 | case EngineID::FERMI_TWOD_A: | 301 | case EngineID::FERMI_TWOD_A: |
| 302 | fermi_2d->CallMethod(method_call); | 302 | fermi_2d->CallMethod(method_call.method, method_call.argument, method_call.IsLastCall()); |
| 303 | break; | 303 | break; |
| 304 | case EngineID::MAXWELL_B: | 304 | case EngineID::MAXWELL_B: |
| 305 | maxwell_3d->CallMethod(method_call); | 305 | maxwell_3d->CallMethod(method_call.method, method_call.argument, method_call.IsLastCall()); |
| 306 | break; | 306 | break; |
| 307 | case EngineID::KEPLER_COMPUTE_B: | 307 | case EngineID::KEPLER_COMPUTE_B: |
| 308 | kepler_compute->CallMethod(method_call); | 308 | kepler_compute->CallMethod(method_call.method, method_call.argument, |
| 309 | method_call.IsLastCall()); | ||
| 309 | break; | 310 | break; |
| 310 | case EngineID::MAXWELL_DMA_COPY_A: | 311 | case EngineID::MAXWELL_DMA_COPY_A: |
| 311 | maxwell_dma->CallMethod(method_call); | 312 | maxwell_dma->CallMethod(method_call.method, method_call.argument, method_call.IsLastCall()); |
| 312 | break; | 313 | break; |
| 313 | case EngineID::KEPLER_INLINE_TO_MEMORY_B: | 314 | case EngineID::KEPLER_INLINE_TO_MEMORY_B: |
| 314 | kepler_memory->CallMethod(method_call); | 315 | kepler_memory->CallMethod(method_call.method, method_call.argument, |
| 316 | method_call.IsLastCall()); | ||
| 315 | break; | 317 | break; |
| 316 | default: | 318 | default: |
| 317 | UNIMPLEMENTED_MSG("Unimplemented engine"); | 319 | UNIMPLEMENTED_MSG("Unimplemented engine"); |
| @@ -347,7 +349,27 @@ void GPU::ProcessBindMethod(const MethodCall& method_call) { | |||
| 347 | // Bind the current subchannel to the desired engine id. | 349 | // Bind the current subchannel to the desired engine id. |
| 348 | LOG_DEBUG(HW_GPU, "Binding subchannel {} to engine {}", method_call.subchannel, | 350 | LOG_DEBUG(HW_GPU, "Binding subchannel {} to engine {}", method_call.subchannel, |
| 349 | method_call.argument); | 351 | method_call.argument); |
| 350 | bound_engines[method_call.subchannel] = static_cast<EngineID>(method_call.argument); | 352 | const auto engine_id = static_cast<EngineID>(method_call.argument); |
| 353 | bound_engines[method_call.subchannel] = static_cast<EngineID>(engine_id); | ||
| 354 | switch (engine_id) { | ||
| 355 | case EngineID::FERMI_TWOD_A: | ||
| 356 | dma_pusher->BindSubchannel(fermi_2d.get(), method_call.subchannel); | ||
| 357 | break; | ||
| 358 | case EngineID::MAXWELL_B: | ||
| 359 | dma_pusher->BindSubchannel(maxwell_3d.get(), method_call.subchannel); | ||
| 360 | break; | ||
| 361 | case EngineID::KEPLER_COMPUTE_B: | ||
| 362 | dma_pusher->BindSubchannel(kepler_compute.get(), method_call.subchannel); | ||
| 363 | break; | ||
| 364 | case EngineID::MAXWELL_DMA_COPY_A: | ||
| 365 | dma_pusher->BindSubchannel(maxwell_dma.get(), method_call.subchannel); | ||
| 366 | break; | ||
| 367 | case EngineID::KEPLER_INLINE_TO_MEMORY_B: | ||
| 368 | dma_pusher->BindSubchannel(kepler_memory.get(), method_call.subchannel); | ||
| 369 | break; | ||
| 370 | default: | ||
| 371 | UNIMPLEMENTED_MSG("Unimplemented engine {:04X}", static_cast<u32>(engine_id)); | ||
| 372 | } | ||
| 351 | } | 373 | } |
| 352 | 374 | ||
| 353 | void GPU::ProcessSemaphoreTriggerMethod() { | 375 | void GPU::ProcessSemaphoreTriggerMethod() { |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index dd51c95b7..a1b4c305c 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -68,6 +68,7 @@ enum class RenderTargetFormat : u32 { | |||
| 68 | BGR5A1_UNORM = 0xE9, | 68 | BGR5A1_UNORM = 0xE9, |
| 69 | RG8_UNORM = 0xEA, | 69 | RG8_UNORM = 0xEA, |
| 70 | RG8_SNORM = 0xEB, | 70 | RG8_SNORM = 0xEB, |
| 71 | RG8_UINT = 0xED, | ||
| 71 | R16_UNORM = 0xEE, | 72 | R16_UNORM = 0xEE, |
| 72 | R16_SNORM = 0xEF, | 73 | R16_SNORM = 0xEF, |
| 73 | R16_SINT = 0xF0, | 74 | R16_SINT = 0xF0, |
diff --git a/src/video_core/macro_interpreter.cpp b/src/video_core/macro_interpreter.cpp index 42031d80a..947364928 100644 --- a/src/video_core/macro_interpreter.cpp +++ b/src/video_core/macro_interpreter.cpp | |||
| @@ -328,7 +328,7 @@ void MacroInterpreter::SetMethodAddress(u32 address) { | |||
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | void MacroInterpreter::Send(u32 value) { | 330 | void MacroInterpreter::Send(u32 value) { |
| 331 | maxwell3d.CallMethodFromMME({method_address.address, value}); | 331 | maxwell3d.CallMethodFromMME(method_address.address, value); |
| 332 | // Increment the method address by the method increment. | 332 | // Increment the method address by the method increment. |
| 333 | method_address.address.Assign(method_address.address.Value() + | 333 | method_address.address.Assign(method_address.address.Value() + |
| 334 | method_address.increment.Value()); | 334 | method_address.increment.Value()); |
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp index 6d522c318..836b25c1d 100644 --- a/src/video_core/morton.cpp +++ b/src/video_core/morton.cpp | |||
| @@ -83,6 +83,7 @@ static constexpr ConversionArray morton_to_linear_fns = { | |||
| 83 | MortonCopy<true, PixelFormat::RGBA8_SRGB>, | 83 | MortonCopy<true, PixelFormat::RGBA8_SRGB>, |
| 84 | MortonCopy<true, PixelFormat::RG8U>, | 84 | MortonCopy<true, PixelFormat::RG8U>, |
| 85 | MortonCopy<true, PixelFormat::RG8S>, | 85 | MortonCopy<true, PixelFormat::RG8S>, |
| 86 | MortonCopy<true, PixelFormat::RG8UI>, | ||
| 86 | MortonCopy<true, PixelFormat::RG32UI>, | 87 | MortonCopy<true, PixelFormat::RG32UI>, |
| 87 | MortonCopy<true, PixelFormat::RGBX16F>, | 88 | MortonCopy<true, PixelFormat::RGBX16F>, |
| 88 | MortonCopy<true, PixelFormat::R32UI>, | 89 | MortonCopy<true, PixelFormat::R32UI>, |
| @@ -166,6 +167,7 @@ static constexpr ConversionArray linear_to_morton_fns = { | |||
| 166 | MortonCopy<false, PixelFormat::RGBA8_SRGB>, | 167 | MortonCopy<false, PixelFormat::RGBA8_SRGB>, |
| 167 | MortonCopy<false, PixelFormat::RG8U>, | 168 | MortonCopy<false, PixelFormat::RG8U>, |
| 168 | MortonCopy<false, PixelFormat::RG8S>, | 169 | MortonCopy<false, PixelFormat::RG8S>, |
| 170 | MortonCopy<false, PixelFormat::RG8UI>, | ||
| 169 | MortonCopy<false, PixelFormat::RG32UI>, | 171 | MortonCopy<false, PixelFormat::RG32UI>, |
| 170 | MortonCopy<false, PixelFormat::RGBX16F>, | 172 | MortonCopy<false, PixelFormat::RGBX16F>, |
| 171 | MortonCopy<false, PixelFormat::R32UI>, | 173 | MortonCopy<false, PixelFormat::R32UI>, |
diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index 603f61952..3cbdac8e7 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h | |||
| @@ -80,6 +80,9 @@ public: | |||
| 80 | /// and invalidated | 80 | /// and invalidated |
| 81 | virtual void FlushAndInvalidateRegion(VAddr addr, u64 size) = 0; | 81 | virtual void FlushAndInvalidateRegion(VAddr addr, u64 size) = 0; |
| 82 | 82 | ||
| 83 | /// Notify the host renderer to wait for previous primitive and compute operations. | ||
| 84 | virtual void WaitForIdle() = 0; | ||
| 85 | |||
| 83 | /// Notify the rasterizer to send all written commands to the host GPU. | 86 | /// Notify the rasterizer to send all written commands to the host GPU. |
| 84 | virtual void FlushCommands() = 0; | 87 | virtual void FlushCommands() = 0; |
| 85 | 88 | ||
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index 4efce0de7..d2cab50bd 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp | |||
| @@ -51,10 +51,6 @@ Buffer OGLBufferCache::CreateBlock(VAddr cpu_addr, std::size_t size) { | |||
| 51 | return std::make_shared<CachedBufferBlock>(cpu_addr, size); | 51 | return std::make_shared<CachedBufferBlock>(cpu_addr, size); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | void OGLBufferCache::WriteBarrier() { | ||
| 55 | glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT); | ||
| 56 | } | ||
| 57 | |||
| 58 | GLuint OGLBufferCache::ToHandle(const Buffer& buffer) { | 54 | GLuint OGLBufferCache::ToHandle(const Buffer& buffer) { |
| 59 | return buffer->GetHandle(); | 55 | return buffer->GetHandle(); |
| 60 | } | 56 | } |
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index a74817857..a9e86cfc7 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h | |||
| @@ -59,8 +59,6 @@ protected: | |||
| 59 | 59 | ||
| 60 | GLuint ToHandle(const Buffer& buffer) override; | 60 | GLuint ToHandle(const Buffer& buffer) override; |
| 61 | 61 | ||
| 62 | void WriteBarrier() override; | ||
| 63 | |||
| 64 | void UploadBlockData(const Buffer& buffer, std::size_t offset, std::size_t size, | 62 | void UploadBlockData(const Buffer& buffer, std::size_t offset, std::size_t size, |
| 65 | const u8* data) override; | 63 | const u8* data) override; |
| 66 | 64 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 725b4c32d..69dcf952f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -746,6 +746,17 @@ void RasterizerOpenGL::FlushAndInvalidateRegion(VAddr addr, u64 size) { | |||
| 746 | InvalidateRegion(addr, size); | 746 | InvalidateRegion(addr, size); |
| 747 | } | 747 | } |
| 748 | 748 | ||
| 749 | void RasterizerOpenGL::WaitForIdle() { | ||
| 750 | // Place a barrier on everything that is not framebuffer related. | ||
| 751 | // This is related to another flag that is not currently implemented. | ||
| 752 | glMemoryBarrier(GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT | GL_ELEMENT_ARRAY_BARRIER_BIT | | ||
| 753 | GL_UNIFORM_BARRIER_BIT | GL_TEXTURE_FETCH_BARRIER_BIT | | ||
| 754 | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_COMMAND_BARRIER_BIT | | ||
| 755 | GL_PIXEL_BUFFER_BARRIER_BIT | GL_TEXTURE_UPDATE_BARRIER_BIT | | ||
| 756 | GL_BUFFER_UPDATE_BARRIER_BIT | GL_TRANSFORM_FEEDBACK_BARRIER_BIT | | ||
| 757 | GL_SHADER_STORAGE_BARRIER_BIT | GL_QUERY_BUFFER_BARRIER_BIT); | ||
| 758 | } | ||
| 759 | |||
| 749 | void RasterizerOpenGL::FlushCommands() { | 760 | void RasterizerOpenGL::FlushCommands() { |
| 750 | // Only flush when we have commands queued to OpenGL. | 761 | // Only flush when we have commands queued to OpenGL. |
| 751 | if (num_queued_commands == 0) { | 762 | if (num_queued_commands == 0) { |
| @@ -1008,6 +1019,14 @@ void RasterizerOpenGL::SyncViewport() { | |||
| 1008 | const GLdouble near_depth = src.translate_z - src.scale_z * reduce_z; | 1019 | const GLdouble near_depth = src.translate_z - src.scale_z * reduce_z; |
| 1009 | const GLdouble far_depth = src.translate_z + src.scale_z; | 1020 | const GLdouble far_depth = src.translate_z + src.scale_z; |
| 1010 | glDepthRangeIndexed(static_cast<GLuint>(i), near_depth, far_depth); | 1021 | glDepthRangeIndexed(static_cast<GLuint>(i), near_depth, far_depth); |
| 1022 | |||
| 1023 | if (!GLAD_GL_NV_viewport_swizzle) { | ||
| 1024 | continue; | ||
| 1025 | } | ||
| 1026 | glViewportSwizzleNV(static_cast<GLuint>(i), MaxwellToGL::ViewportSwizzle(src.swizzle.x), | ||
| 1027 | MaxwellToGL::ViewportSwizzle(src.swizzle.y), | ||
| 1028 | MaxwellToGL::ViewportSwizzle(src.swizzle.z), | ||
| 1029 | MaxwellToGL::ViewportSwizzle(src.swizzle.w)); | ||
| 1011 | } | 1030 | } |
| 1012 | } | 1031 | } |
| 1013 | } | 1032 | } |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 87249fb6f..b94c65907 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -75,6 +75,7 @@ public: | |||
| 75 | void SignalSyncPoint(u32 value) override; | 75 | void SignalSyncPoint(u32 value) override; |
| 76 | void ReleaseFences() override; | 76 | void ReleaseFences() override; |
| 77 | void FlushAndInvalidateRegion(VAddr addr, u64 size) override; | 77 | void FlushAndInvalidateRegion(VAddr addr, u64 size) override; |
| 78 | void WaitForIdle() override; | ||
| 78 | void FlushCommands() override; | 79 | void FlushCommands() override; |
| 79 | void TickFrame() override; | 80 | void TickFrame() override; |
| 80 | bool AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, | 81 | bool AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 2729d1265..94fbd2a22 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -83,6 +83,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format | |||
| 83 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // RGBA8_SRGB | 83 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // RGBA8_SRGB |
| 84 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // RG8U | 84 | {GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // RG8U |
| 85 | {GL_RG8_SNORM, GL_RG, GL_BYTE}, // RG8S | 85 | {GL_RG8_SNORM, GL_RG, GL_BYTE}, // RG8S |
| 86 | {GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG8UI | ||
| 86 | {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG32UI | 87 | {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG32UI |
| 87 | {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // RGBX16F | 88 | {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // RGBX16F |
| 88 | {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32UI | 89 | {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32UI |
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 2c0c77c28..994ae98eb 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h | |||
| @@ -503,5 +503,10 @@ inline GLenum PolygonMode(Maxwell::PolygonMode polygon_mode) { | |||
| 503 | return GL_FILL; | 503 | return GL_FILL; |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | inline GLenum ViewportSwizzle(Maxwell::ViewportSwizzle swizzle) { | ||
| 507 | // Enumeration order matches register order. We can convert it arithmetically. | ||
| 508 | return GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV + static_cast<GLenum>(swizzle); | ||
| 509 | } | ||
| 510 | |||
| 506 | } // namespace MaxwellToGL | 511 | } // namespace MaxwellToGL |
| 507 | } // namespace OpenGL | 512 | } // namespace OpenGL |
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp index 7b01adf7f..568744e3c 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 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 <algorithm> | ||
| 5 | #include <cstring> | 6 | #include <cstring> |
| 6 | #include <tuple> | 7 | #include <tuple> |
| 7 | 8 | ||
| @@ -102,6 +103,12 @@ void FixedPipelineState::ColorBlending::Fill(const Maxwell& regs) noexcept { | |||
| 102 | } | 103 | } |
| 103 | } | 104 | } |
| 104 | 105 | ||
| 106 | void FixedPipelineState::ViewportSwizzles::Fill(const Maxwell& regs) noexcept { | ||
| 107 | const auto& transform = regs.viewport_transform; | ||
| 108 | std::transform(transform.begin(), transform.end(), swizzles.begin(), | ||
| 109 | [](const auto& viewport) { return static_cast<u16>(viewport.swizzle.raw); }); | ||
| 110 | } | ||
| 111 | |||
| 105 | void FixedPipelineState::BlendingAttachment::Fill(const Maxwell& regs, std::size_t index) { | 112 | void FixedPipelineState::BlendingAttachment::Fill(const Maxwell& regs, std::size_t index) { |
| 106 | const auto& mask = regs.color_mask[regs.color_mask_common ? 0 : index]; | 113 | const auto& mask = regs.color_mask[regs.color_mask_common ? 0 : index]; |
| 107 | 114 | ||
| @@ -145,6 +152,7 @@ void FixedPipelineState::Fill(const Maxwell& regs) { | |||
| 145 | rasterizer.Fill(regs); | 152 | rasterizer.Fill(regs); |
| 146 | depth_stencil.Fill(regs); | 153 | depth_stencil.Fill(regs); |
| 147 | color_blending.Fill(regs); | 154 | color_blending.Fill(regs); |
| 155 | viewport_swizzles.Fill(regs); | ||
| 148 | } | 156 | } |
| 149 | 157 | ||
| 150 | std::size_t FixedPipelineState::Hash() const noexcept { | 158 | std::size_t FixedPipelineState::Hash() const noexcept { |
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h index cbf55dda3..31a6398f2 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h | |||
| @@ -234,10 +234,17 @@ struct FixedPipelineState { | |||
| 234 | void Fill(const Maxwell& regs) noexcept; | 234 | void Fill(const Maxwell& regs) noexcept; |
| 235 | }; | 235 | }; |
| 236 | 236 | ||
| 237 | struct ViewportSwizzles { | ||
| 238 | std::array<u16, Maxwell::NumViewports> swizzles; | ||
| 239 | |||
| 240 | void Fill(const Maxwell& regs) noexcept; | ||
| 241 | }; | ||
| 242 | |||
| 237 | VertexInput vertex_input; | 243 | VertexInput vertex_input; |
| 238 | Rasterizer rasterizer; | 244 | Rasterizer rasterizer; |
| 239 | DepthStencil depth_stencil; | 245 | DepthStencil depth_stencil; |
| 240 | ColorBlending color_blending; | 246 | ColorBlending color_blending; |
| 247 | ViewportSwizzles viewport_swizzles; | ||
| 241 | 248 | ||
| 242 | void Fill(const Maxwell& regs); | 249 | void Fill(const Maxwell& regs); |
| 243 | 250 | ||
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index 8681b821f..12be691a5 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp | |||
| @@ -160,6 +160,7 @@ struct FormatTuple { | |||
| 160 | {VK_FORMAT_R8G8B8A8_SRGB, Attachable}, // RGBA8_SRGB | 160 | {VK_FORMAT_R8G8B8A8_SRGB, Attachable}, // RGBA8_SRGB |
| 161 | {VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // RG8U | 161 | {VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // RG8U |
| 162 | {VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // RG8S | 162 | {VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // RG8S |
| 163 | {VK_FORMAT_R8G8_UINT, Attachable | Storage}, // RG8UI | ||
| 163 | {VK_FORMAT_R32G32_UINT, Attachable | Storage}, // RG32UI | 164 | {VK_FORMAT_R32G32_UINT, Attachable | Storage}, // RG32UI |
| 164 | {VK_FORMAT_UNDEFINED}, // RGBX16F | 165 | {VK_FORMAT_UNDEFINED}, // RGBX16F |
| 165 | {VK_FORMAT_R32_UINT, Attachable | Storage}, // R32UI | 166 | {VK_FORMAT_R32_UINT, Attachable | Storage}, // R32UI |
| @@ -345,8 +346,6 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib | |||
| 345 | break; | 346 | break; |
| 346 | case Maxwell::VertexAttribute::Type::SignedInt: | 347 | case Maxwell::VertexAttribute::Type::SignedInt: |
| 347 | switch (size) { | 348 | switch (size) { |
| 348 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: | ||
| 349 | return VK_FORMAT_R16G16B16A16_SINT; | ||
| 350 | case Maxwell::VertexAttribute::Size::Size_8: | 349 | case Maxwell::VertexAttribute::Size::Size_8: |
| 351 | return VK_FORMAT_R8_SINT; | 350 | return VK_FORMAT_R8_SINT; |
| 352 | case Maxwell::VertexAttribute::Size::Size_8_8: | 351 | case Maxwell::VertexAttribute::Size::Size_8_8: |
| @@ -355,8 +354,22 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib | |||
| 355 | return VK_FORMAT_R8G8B8_SINT; | 354 | return VK_FORMAT_R8G8B8_SINT; |
| 356 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: | 355 | case Maxwell::VertexAttribute::Size::Size_8_8_8_8: |
| 357 | return VK_FORMAT_R8G8B8A8_SINT; | 356 | return VK_FORMAT_R8G8B8A8_SINT; |
| 357 | case Maxwell::VertexAttribute::Size::Size_16: | ||
| 358 | return VK_FORMAT_R16_SINT; | ||
| 359 | case Maxwell::VertexAttribute::Size::Size_16_16: | ||
| 360 | return VK_FORMAT_R16G16_SINT; | ||
| 361 | case Maxwell::VertexAttribute::Size::Size_16_16_16: | ||
| 362 | return VK_FORMAT_R16G16B16_SINT; | ||
| 363 | case Maxwell::VertexAttribute::Size::Size_16_16_16_16: | ||
| 364 | return VK_FORMAT_R16G16B16A16_SINT; | ||
| 358 | case Maxwell::VertexAttribute::Size::Size_32: | 365 | case Maxwell::VertexAttribute::Size::Size_32: |
| 359 | return VK_FORMAT_R32_SINT; | 366 | return VK_FORMAT_R32_SINT; |
| 367 | case Maxwell::VertexAttribute::Size::Size_32_32: | ||
| 368 | return VK_FORMAT_R32G32_SINT; | ||
| 369 | case Maxwell::VertexAttribute::Size::Size_32_32_32: | ||
| 370 | return VK_FORMAT_R32G32B32_SINT; | ||
| 371 | case Maxwell::VertexAttribute::Size::Size_32_32_32_32: | ||
| 372 | return VK_FORMAT_R32G32B32A32_SINT; | ||
| 360 | default: | 373 | default: |
| 361 | break; | 374 | break; |
| 362 | } | 375 | } |
| @@ -672,4 +685,27 @@ VkComponentSwizzle SwizzleSource(Tegra::Texture::SwizzleSource swizzle) { | |||
| 672 | return {}; | 685 | return {}; |
| 673 | } | 686 | } |
| 674 | 687 | ||
| 688 | VkViewportCoordinateSwizzleNV ViewportSwizzle(Maxwell::ViewportSwizzle swizzle) { | ||
| 689 | switch (swizzle) { | ||
| 690 | case Maxwell::ViewportSwizzle::PositiveX: | ||
| 691 | return VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV; | ||
| 692 | case Maxwell::ViewportSwizzle::NegativeX: | ||
| 693 | return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV; | ||
| 694 | case Maxwell::ViewportSwizzle::PositiveY: | ||
| 695 | return VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV; | ||
| 696 | case Maxwell::ViewportSwizzle::NegativeY: | ||
| 697 | return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV; | ||
| 698 | case Maxwell::ViewportSwizzle::PositiveZ: | ||
| 699 | return VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV; | ||
| 700 | case Maxwell::ViewportSwizzle::NegativeZ: | ||
| 701 | return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV; | ||
| 702 | case Maxwell::ViewportSwizzle::PositiveW: | ||
| 703 | return VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV; | ||
| 704 | case Maxwell::ViewportSwizzle::NegativeW: | ||
| 705 | return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV; | ||
| 706 | } | ||
| 707 | UNREACHABLE_MSG("Invalid swizzle={}", static_cast<int>(swizzle)); | ||
| 708 | return {}; | ||
| 709 | } | ||
| 710 | |||
| 675 | } // namespace Vulkan::MaxwellToVK | 711 | } // namespace Vulkan::MaxwellToVK |
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.h b/src/video_core/renderer_vulkan/maxwell_to_vk.h index 81bce4c6c..7e213452f 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.h +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.h | |||
| @@ -59,4 +59,6 @@ VkCullModeFlags CullFace(Maxwell::CullFace cull_face); | |||
| 59 | 59 | ||
| 60 | VkComponentSwizzle SwizzleSource(Tegra::Texture::SwizzleSource swizzle); | 60 | VkComponentSwizzle SwizzleSource(Tegra::Texture::SwizzleSource swizzle); |
| 61 | 61 | ||
| 62 | VkViewportCoordinateSwizzleNV ViewportSwizzle(Maxwell::ViewportSwizzle swizzle); | ||
| 63 | |||
| 62 | } // namespace Vulkan::MaxwellToVK | 64 | } // namespace Vulkan::MaxwellToVK |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 04532f8f8..59b441943 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -12,15 +12,12 @@ | |||
| 12 | 12 | ||
| 13 | #include <fmt/format.h> | 13 | #include <fmt/format.h> |
| 14 | 14 | ||
| 15 | #include "common/assert.h" | ||
| 16 | #include "common/dynamic_library.h" | 15 | #include "common/dynamic_library.h" |
| 17 | #include "common/logging/log.h" | 16 | #include "common/logging/log.h" |
| 18 | #include "common/telemetry.h" | 17 | #include "common/telemetry.h" |
| 19 | #include "core/core.h" | 18 | #include "core/core.h" |
| 20 | #include "core/core_timing.h" | 19 | #include "core/core_timing.h" |
| 21 | #include "core/frontend/emu_window.h" | 20 | #include "core/frontend/emu_window.h" |
| 22 | #include "core/memory.h" | ||
| 23 | #include "core/perf_stats.h" | ||
| 24 | #include "core/settings.h" | 21 | #include "core/settings.h" |
| 25 | #include "core/telemetry_session.h" | 22 | #include "core/telemetry_session.h" |
| 26 | #include "video_core/gpu.h" | 23 | #include "video_core/gpu.h" |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.h b/src/video_core/renderer_vulkan/renderer_vulkan.h index 18270909b..522b5bff8 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.h +++ b/src/video_core/renderer_vulkan/renderer_vulkan.h | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <optional> | ||
| 9 | #include <string> | 8 | #include <string> |
| 10 | #include <vector> | 9 | #include <vector> |
| 11 | 10 | ||
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.h b/src/video_core/renderer_vulkan/vk_blit_screen.h index 5eb544aea..243640fab 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.h +++ b/src/video_core/renderer_vulkan/vk_blit_screen.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 8 | #include <memory> | 7 | #include <memory> |
| 9 | #include <tuple> | 8 | #include <tuple> |
| 10 | 9 | ||
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index 81e1de2be..5b494da8c 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp | |||
| @@ -5,11 +5,7 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cstring> | 6 | #include <cstring> |
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <optional> | ||
| 9 | #include <tuple> | ||
| 10 | 8 | ||
| 11 | #include "common/assert.h" | ||
| 12 | #include "common/bit_util.h" | ||
| 13 | #include "core/core.h" | 9 | #include "core/core.h" |
| 14 | #include "video_core/renderer_vulkan/vk_buffer_cache.h" | 10 | #include "video_core/renderer_vulkan/vk_buffer_cache.h" |
| 15 | #include "video_core/renderer_vulkan/vk_device.h" | 11 | #include "video_core/renderer_vulkan/vk_device.h" |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index 3cd2e2774..a54583e7d 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h | |||
| @@ -5,14 +5,11 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <unordered_map> | ||
| 9 | #include <vector> | ||
| 10 | 8 | ||
| 11 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 12 | #include "video_core/buffer_cache/buffer_cache.h" | 10 | #include "video_core/buffer_cache/buffer_cache.h" |
| 13 | #include "video_core/rasterizer_cache.h" | 11 | #include "video_core/rasterizer_cache.h" |
| 14 | #include "video_core/renderer_vulkan/vk_memory_manager.h" | 12 | #include "video_core/renderer_vulkan/vk_memory_manager.h" |
| 15 | #include "video_core/renderer_vulkan/vk_resource_manager.h" | ||
| 16 | #include "video_core/renderer_vulkan/vk_staging_buffer_pool.h" | 13 | #include "video_core/renderer_vulkan/vk_staging_buffer_pool.h" |
| 17 | #include "video_core/renderer_vulkan/vk_stream_buffer.h" | 14 | #include "video_core/renderer_vulkan/vk_stream_buffer.h" |
| 18 | #include "video_core/renderer_vulkan/wrapper.h" | 15 | #include "video_core/renderer_vulkan/wrapper.h" |
| @@ -55,8 +52,6 @@ public: | |||
| 55 | protected: | 52 | protected: |
| 56 | VkBuffer ToHandle(const Buffer& buffer) override; | 53 | VkBuffer ToHandle(const Buffer& buffer) override; |
| 57 | 54 | ||
| 58 | void WriteBarrier() override {} | ||
| 59 | |||
| 60 | Buffer CreateBlock(VAddr cpu_addr, std::size_t size) override; | 55 | Buffer CreateBlock(VAddr cpu_addr, std::size_t size) override; |
| 61 | 56 | ||
| 62 | void UploadBlockData(const Buffer& buffer, std::size_t offset, std::size_t size, | 57 | void UploadBlockData(const Buffer& buffer, std::size_t offset, std::size_t size, |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp index 7b0268033..da71e710c 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | #include <optional> | 7 | #include <optional> |
| 8 | #include <utility> | 8 | #include <utility> |
| 9 | #include <vector> | 9 | |
| 10 | #include "common/alignment.h" | 10 | #include "common/alignment.h" |
| 11 | #include "common/assert.h" | 11 | #include "common/assert.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.h b/src/video_core/renderer_vulkan/vk_compute_pass.h index 26bf834de..230b526bc 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.h +++ b/src/video_core/renderer_vulkan/vk_compute_pass.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <optional> | 7 | #include <optional> |
| 8 | #include <utility> | 8 | #include <utility> |
| 9 | #include <vector> | 9 | |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "video_core/engines/maxwell_3d.h" | 11 | #include "video_core/engines/maxwell_3d.h" |
| 12 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" | 12 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp index 52566bb79..8e1b46277 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp | |||
| @@ -2,14 +2,12 @@ | |||
| 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 <memory> | ||
| 6 | #include <vector> | 5 | #include <vector> |
| 7 | 6 | ||
| 8 | #include "video_core/renderer_vulkan/vk_compute_pipeline.h" | 7 | #include "video_core/renderer_vulkan/vk_compute_pipeline.h" |
| 9 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" | 8 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" |
| 10 | #include "video_core/renderer_vulkan/vk_device.h" | 9 | #include "video_core/renderer_vulkan/vk_device.h" |
| 11 | #include "video_core/renderer_vulkan/vk_pipeline_cache.h" | 10 | #include "video_core/renderer_vulkan/vk_pipeline_cache.h" |
| 12 | #include "video_core/renderer_vulkan/vk_resource_manager.h" | ||
| 13 | #include "video_core/renderer_vulkan/vk_scheduler.h" | 11 | #include "video_core/renderer_vulkan/vk_scheduler.h" |
| 14 | #include "video_core/renderer_vulkan/vk_shader_decompiler.h" | 12 | #include "video_core/renderer_vulkan/vk_shader_decompiler.h" |
| 15 | #include "video_core/renderer_vulkan/vk_update_descriptor.h" | 13 | #include "video_core/renderer_vulkan/vk_update_descriptor.h" |
diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.h b/src/video_core/renderer_vulkan/vk_compute_pipeline.h index 33b9af29e..6e2f22a4a 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.h +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.h | |||
| @@ -4,8 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | ||
| 8 | |||
| 9 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 10 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" | 8 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" |
| 11 | #include "video_core/renderer_vulkan/vk_shader_decompiler.h" | 9 | #include "video_core/renderer_vulkan/vk_shader_decompiler.h" |
diff --git a/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp b/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp index e9d528aa6..890fd52cf 100644 --- a/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_descriptor_pool.cpp | |||
| @@ -2,7 +2,6 @@ | |||
| 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 <memory> | ||
| 6 | #include <vector> | 5 | #include <vector> |
| 7 | 6 | ||
| 8 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
diff --git a/src/video_core/renderer_vulkan/vk_descriptor_pool.h b/src/video_core/renderer_vulkan/vk_descriptor_pool.h index ab40c70f0..9efa66bef 100644 --- a/src/video_core/renderer_vulkan/vk_descriptor_pool.h +++ b/src/video_core/renderer_vulkan/vk_descriptor_pool.h | |||
| @@ -4,10 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | ||
| 8 | #include <vector> | 7 | #include <vector> |
| 9 | 8 | ||
| 10 | #include "common/common_types.h" | ||
| 11 | #include "video_core/renderer_vulkan/vk_resource_manager.h" | 9 | #include "video_core/renderer_vulkan/vk_resource_manager.h" |
| 12 | #include "video_core/renderer_vulkan/wrapper.h" | 10 | #include "video_core/renderer_vulkan/wrapper.h" |
| 13 | 11 | ||
diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp index e90c76492..f0c491d00 100644 --- a/src/video_core/renderer_vulkan/vk_device.cpp +++ b/src/video_core/renderer_vulkan/vk_device.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include <bitset> | 5 | #include <bitset> |
| 6 | #include <chrono> | 6 | #include <chrono> |
| 7 | #include <cstdlib> | ||
| 8 | #include <optional> | 7 | #include <optional> |
| 9 | #include <string_view> | 8 | #include <string_view> |
| 10 | #include <thread> | 9 | #include <thread> |
| @@ -95,6 +94,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties( | |||
| 95 | VK_FORMAT_R8G8B8A8_SRGB, | 94 | VK_FORMAT_R8G8B8A8_SRGB, |
| 96 | VK_FORMAT_R8G8_UNORM, | 95 | VK_FORMAT_R8G8_UNORM, |
| 97 | VK_FORMAT_R8G8_SNORM, | 96 | VK_FORMAT_R8G8_SNORM, |
| 97 | VK_FORMAT_R8G8_UINT, | ||
| 98 | VK_FORMAT_R8_UNORM, | 98 | VK_FORMAT_R8_UNORM, |
| 99 | VK_FORMAT_R8_UINT, | 99 | VK_FORMAT_R8_UINT, |
| 100 | VK_FORMAT_B10G11R11_UFLOAT_PACK32, | 100 | VK_FORMAT_B10G11R11_UFLOAT_PACK32, |
| @@ -261,6 +261,10 @@ bool VKDevice::Create() { | |||
| 261 | LOG_INFO(Render_Vulkan, "Device doesn't support float16 natively"); | 261 | LOG_INFO(Render_Vulkan, "Device doesn't support float16 natively"); |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | if (!nv_viewport_swizzle) { | ||
| 265 | LOG_INFO(Render_Vulkan, "Device doesn't support viewport swizzles"); | ||
| 266 | } | ||
| 267 | |||
| 264 | VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR std430_layout; | 268 | VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR std430_layout; |
| 265 | if (khr_uniform_buffer_standard_layout) { | 269 | if (khr_uniform_buffer_standard_layout) { |
| 266 | std430_layout.sType = | 270 | std430_layout.sType = |
| @@ -294,6 +298,17 @@ bool VKDevice::Create() { | |||
| 294 | LOG_INFO(Render_Vulkan, "Device doesn't support transform feedbacks"); | 298 | LOG_INFO(Render_Vulkan, "Device doesn't support transform feedbacks"); |
| 295 | } | 299 | } |
| 296 | 300 | ||
| 301 | VkPhysicalDeviceCustomBorderColorFeaturesEXT custom_border; | ||
| 302 | if (ext_custom_border_color) { | ||
| 303 | custom_border.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; | ||
| 304 | custom_border.pNext = nullptr; | ||
| 305 | custom_border.customBorderColors = VK_TRUE; | ||
| 306 | custom_border.customBorderColorWithoutFormat = VK_TRUE; | ||
| 307 | SetNext(next, custom_border); | ||
| 308 | } else { | ||
| 309 | LOG_INFO(Render_Vulkan, "Device doesn't support custom border colors"); | ||
| 310 | } | ||
| 311 | |||
| 297 | if (!ext_depth_range_unrestricted) { | 312 | if (!ext_depth_range_unrestricted) { |
| 298 | LOG_INFO(Render_Vulkan, "Device doesn't support depth range unrestricted"); | 313 | LOG_INFO(Render_Vulkan, "Device doesn't support depth range unrestricted"); |
| 299 | } | 314 | } |
| @@ -521,7 +536,9 @@ std::vector<const char*> VKDevice::LoadExtensions() { | |||
| 521 | bool has_khr_shader_float16_int8{}; | 536 | bool has_khr_shader_float16_int8{}; |
| 522 | bool has_ext_subgroup_size_control{}; | 537 | bool has_ext_subgroup_size_control{}; |
| 523 | bool has_ext_transform_feedback{}; | 538 | bool has_ext_transform_feedback{}; |
| 539 | bool has_ext_custom_border_color{}; | ||
| 524 | for (const auto& extension : physical.EnumerateDeviceExtensionProperties()) { | 540 | for (const auto& extension : physical.EnumerateDeviceExtensionProperties()) { |
| 541 | Test(extension, nv_viewport_swizzle, VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME, true); | ||
| 525 | Test(extension, khr_uniform_buffer_standard_layout, | 542 | Test(extension, khr_uniform_buffer_standard_layout, |
| 526 | VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME, true); | 543 | VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME, true); |
| 527 | Test(extension, has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, | 544 | Test(extension, has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, |
| @@ -535,6 +552,8 @@ std::vector<const char*> VKDevice::LoadExtensions() { | |||
| 535 | false); | 552 | false); |
| 536 | Test(extension, has_ext_transform_feedback, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, | 553 | Test(extension, has_ext_transform_feedback, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, |
| 537 | false); | 554 | false); |
| 555 | Test(extension, has_ext_custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, | ||
| 556 | false); | ||
| 538 | if (Settings::values.renderer_debug) { | 557 | if (Settings::values.renderer_debug) { |
| 539 | Test(extension, nv_device_diagnostics_config, | 558 | Test(extension, nv_device_diagnostics_config, |
| 540 | VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME, true); | 559 | VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME, true); |
| @@ -607,6 +626,19 @@ std::vector<const char*> VKDevice::LoadExtensions() { | |||
| 607 | } | 626 | } |
| 608 | } | 627 | } |
| 609 | 628 | ||
| 629 | if (has_ext_custom_border_color) { | ||
| 630 | VkPhysicalDeviceCustomBorderColorFeaturesEXT border_features; | ||
| 631 | border_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; | ||
| 632 | border_features.pNext = nullptr; | ||
| 633 | features.pNext = &border_features; | ||
| 634 | physical.GetFeatures2KHR(features); | ||
| 635 | |||
| 636 | if (border_features.customBorderColors && border_features.customBorderColorWithoutFormat) { | ||
| 637 | extensions.push_back(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME); | ||
| 638 | ext_custom_border_color = true; | ||
| 639 | } | ||
| 640 | } | ||
| 641 | |||
| 610 | return extensions; | 642 | return extensions; |
| 611 | } | 643 | } |
| 612 | 644 | ||
diff --git a/src/video_core/renderer_vulkan/vk_device.h b/src/video_core/renderer_vulkan/vk_device.h index c8640762d..6b9227b09 100644 --- a/src/video_core/renderer_vulkan/vk_device.h +++ b/src/video_core/renderer_vulkan/vk_device.h | |||
| @@ -147,6 +147,11 @@ public: | |||
| 147 | return is_formatless_image_load_supported; | 147 | return is_formatless_image_load_supported; |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | /// Returns true if the device supports VK_NV_viewport_swizzle. | ||
| 151 | bool IsNvViewportSwizzleSupported() const { | ||
| 152 | return nv_viewport_swizzle; | ||
| 153 | } | ||
| 154 | |||
| 150 | /// Returns true if the device supports VK_EXT_scalar_block_layout. | 155 | /// Returns true if the device supports VK_EXT_scalar_block_layout. |
| 151 | bool IsKhrUniformBufferStandardLayoutSupported() const { | 156 | bool IsKhrUniformBufferStandardLayoutSupported() const { |
| 152 | return khr_uniform_buffer_standard_layout; | 157 | return khr_uniform_buffer_standard_layout; |
| @@ -172,6 +177,11 @@ public: | |||
| 172 | return ext_transform_feedback; | 177 | return ext_transform_feedback; |
| 173 | } | 178 | } |
| 174 | 179 | ||
| 180 | /// Returns true if the device supports VK_EXT_custom_border_color. | ||
| 181 | bool IsExtCustomBorderColorSupported() const { | ||
| 182 | return ext_custom_border_color; | ||
| 183 | } | ||
| 184 | |||
| 175 | /// Returns the vendor name reported from Vulkan. | 185 | /// Returns the vendor name reported from Vulkan. |
| 176 | std::string_view GetVendorName() const { | 186 | std::string_view GetVendorName() const { |
| 177 | return vendor_name; | 187 | return vendor_name; |
| @@ -222,11 +232,13 @@ private: | |||
| 222 | bool is_float16_supported{}; ///< Support for float16 arithmetics. | 232 | bool is_float16_supported{}; ///< Support for float16 arithmetics. |
| 223 | bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest. | 233 | bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest. |
| 224 | bool is_formatless_image_load_supported{}; ///< Support for shader image read without format. | 234 | bool is_formatless_image_load_supported{}; ///< Support for shader image read without format. |
| 235 | bool nv_viewport_swizzle{}; ///< Support for VK_NV_viewport_swizzle. | ||
| 225 | bool khr_uniform_buffer_standard_layout{}; ///< Support for std430 on UBOs. | 236 | bool khr_uniform_buffer_standard_layout{}; ///< Support for std430 on UBOs. |
| 226 | bool ext_index_type_uint8{}; ///< Support for VK_EXT_index_type_uint8. | 237 | bool ext_index_type_uint8{}; ///< Support for VK_EXT_index_type_uint8. |
| 227 | bool ext_depth_range_unrestricted{}; ///< Support for VK_EXT_depth_range_unrestricted. | 238 | bool ext_depth_range_unrestricted{}; ///< Support for VK_EXT_depth_range_unrestricted. |
| 228 | bool ext_shader_viewport_index_layer{}; ///< Support for VK_EXT_shader_viewport_index_layer. | 239 | bool ext_shader_viewport_index_layer{}; ///< Support for VK_EXT_shader_viewport_index_layer. |
| 229 | bool ext_transform_feedback{}; ///< Support for VK_EXT_transform_feedback. | 240 | bool ext_transform_feedback{}; ///< Support for VK_EXT_transform_feedback. |
| 241 | bool ext_custom_border_color{}; ///< Support for VK_EXT_custom_border_color. | ||
| 230 | bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. | 242 | bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. |
| 231 | 243 | ||
| 232 | // Telemetry parameters | 244 | // Telemetry parameters |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index b39b81b48..69b6bba00 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -2,11 +2,11 @@ | |||
| 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 <algorithm> | ||
| 5 | #include <array> | 6 | #include <array> |
| 6 | #include <cstring> | 7 | #include <cstring> |
| 7 | #include <vector> | 8 | #include <vector> |
| 8 | 9 | ||
| 9 | #include "common/assert.h" | ||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/microprofile.h" | 11 | #include "common/microprofile.h" |
| 12 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" | 12 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" |
| @@ -51,6 +51,23 @@ bool SupportsPrimitiveRestart(VkPrimitiveTopology topology) { | |||
| 51 | topology) == std::end(unsupported_topologies); | 51 | topology) == std::end(unsupported_topologies); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | VkViewportSwizzleNV UnpackViewportSwizzle(u16 swizzle) { | ||
| 55 | union { | ||
| 56 | u32 raw; | ||
| 57 | BitField<0, 3, Maxwell::ViewportSwizzle> x; | ||
| 58 | BitField<4, 3, Maxwell::ViewportSwizzle> y; | ||
| 59 | BitField<8, 3, Maxwell::ViewportSwizzle> z; | ||
| 60 | BitField<12, 3, Maxwell::ViewportSwizzle> w; | ||
| 61 | } const unpacked{swizzle}; | ||
| 62 | |||
| 63 | VkViewportSwizzleNV result; | ||
| 64 | result.x = MaxwellToVK::ViewportSwizzle(unpacked.x); | ||
| 65 | result.y = MaxwellToVK::ViewportSwizzle(unpacked.y); | ||
| 66 | result.z = MaxwellToVK::ViewportSwizzle(unpacked.z); | ||
| 67 | result.w = MaxwellToVK::ViewportSwizzle(unpacked.w); | ||
| 68 | return result; | ||
| 69 | } | ||
| 70 | |||
| 54 | } // Anonymous namespace | 71 | } // Anonymous namespace |
| 55 | 72 | ||
| 56 | VKGraphicsPipeline::VKGraphicsPipeline(const VKDevice& device, VKScheduler& scheduler, | 73 | VKGraphicsPipeline::VKGraphicsPipeline(const VKDevice& device, VKScheduler& scheduler, |
| @@ -163,6 +180,7 @@ vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpa | |||
| 163 | const auto& ds = fixed_state.depth_stencil; | 180 | const auto& ds = fixed_state.depth_stencil; |
| 164 | const auto& cd = fixed_state.color_blending; | 181 | const auto& cd = fixed_state.color_blending; |
| 165 | const auto& rs = fixed_state.rasterizer; | 182 | const auto& rs = fixed_state.rasterizer; |
| 183 | const auto& viewport_swizzles = fixed_state.viewport_swizzles.swizzles; | ||
| 166 | 184 | ||
| 167 | std::vector<VkVertexInputBindingDescription> vertex_bindings; | 185 | std::vector<VkVertexInputBindingDescription> vertex_bindings; |
| 168 | std::vector<VkVertexInputBindingDivisorDescriptionEXT> vertex_binding_divisors; | 186 | std::vector<VkVertexInputBindingDivisorDescriptionEXT> vertex_binding_divisors; |
| @@ -245,6 +263,19 @@ vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpa | |||
| 245 | viewport_ci.scissorCount = Maxwell::NumViewports; | 263 | viewport_ci.scissorCount = Maxwell::NumViewports; |
| 246 | viewport_ci.pScissors = nullptr; | 264 | viewport_ci.pScissors = nullptr; |
| 247 | 265 | ||
| 266 | std::array<VkViewportSwizzleNV, Maxwell::NumViewports> swizzles; | ||
| 267 | std::transform(viewport_swizzles.begin(), viewport_swizzles.end(), swizzles.begin(), | ||
| 268 | UnpackViewportSwizzle); | ||
| 269 | VkPipelineViewportSwizzleStateCreateInfoNV swizzle_ci; | ||
| 270 | swizzle_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV; | ||
| 271 | swizzle_ci.pNext = nullptr; | ||
| 272 | swizzle_ci.flags = 0; | ||
| 273 | swizzle_ci.viewportCount = Maxwell::NumViewports; | ||
| 274 | swizzle_ci.pViewportSwizzles = swizzles.data(); | ||
| 275 | if (device.IsNvViewportSwizzleSupported()) { | ||
| 276 | viewport_ci.pNext = &swizzle_ci; | ||
| 277 | } | ||
| 278 | |||
| 248 | VkPipelineRasterizationStateCreateInfo rasterization_ci; | 279 | VkPipelineRasterizationStateCreateInfo rasterization_ci; |
| 249 | rasterization_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; | 280 | rasterization_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; |
| 250 | rasterization_ci.pNext = nullptr; | 281 | rasterization_ci.pNext = nullptr; |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h index 7aba70960..a1d699a6c 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h | |||
| @@ -5,16 +5,13 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <memory> | ||
| 9 | #include <optional> | 8 | #include <optional> |
| 10 | #include <unordered_map> | ||
| 11 | #include <vector> | 9 | #include <vector> |
| 12 | 10 | ||
| 13 | #include "video_core/engines/maxwell_3d.h" | 11 | #include "video_core/engines/maxwell_3d.h" |
| 14 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" | 12 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" |
| 15 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" | 13 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" |
| 16 | #include "video_core/renderer_vulkan/vk_renderpass_cache.h" | 14 | #include "video_core/renderer_vulkan/vk_renderpass_cache.h" |
| 17 | #include "video_core/renderer_vulkan/vk_resource_manager.h" | ||
| 18 | #include "video_core/renderer_vulkan/vk_shader_decompiler.h" | 15 | #include "video_core/renderer_vulkan/vk_shader_decompiler.h" |
| 19 | #include "video_core/renderer_vulkan/wrapper.h" | 16 | #include "video_core/renderer_vulkan/wrapper.h" |
| 20 | 17 | ||
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 8fbd63dbc..fe45ed269 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include "video_core/renderer_vulkan/vk_pipeline_cache.h" | 22 | #include "video_core/renderer_vulkan/vk_pipeline_cache.h" |
| 23 | #include "video_core/renderer_vulkan/vk_rasterizer.h" | 23 | #include "video_core/renderer_vulkan/vk_rasterizer.h" |
| 24 | #include "video_core/renderer_vulkan/vk_renderpass_cache.h" | 24 | #include "video_core/renderer_vulkan/vk_renderpass_cache.h" |
| 25 | #include "video_core/renderer_vulkan/vk_resource_manager.h" | ||
| 26 | #include "video_core/renderer_vulkan/vk_scheduler.h" | 25 | #include "video_core/renderer_vulkan/vk_scheduler.h" |
| 27 | #include "video_core/renderer_vulkan/vk_update_descriptor.h" | 26 | #include "video_core/renderer_vulkan/vk_update_descriptor.h" |
| 28 | #include "video_core/renderer_vulkan/wrapper.h" | 27 | #include "video_core/renderer_vulkan/wrapper.h" |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.h b/src/video_core/renderer_vulkan/vk_pipeline_cache.h index ebddafb73..0b5796fef 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.h | |||
| @@ -21,13 +21,11 @@ | |||
| 21 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" | 21 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" |
| 22 | #include "video_core/renderer_vulkan/vk_graphics_pipeline.h" | 22 | #include "video_core/renderer_vulkan/vk_graphics_pipeline.h" |
| 23 | #include "video_core/renderer_vulkan/vk_renderpass_cache.h" | 23 | #include "video_core/renderer_vulkan/vk_renderpass_cache.h" |
| 24 | #include "video_core/renderer_vulkan/vk_resource_manager.h" | ||
| 25 | #include "video_core/renderer_vulkan/vk_shader_decompiler.h" | 24 | #include "video_core/renderer_vulkan/vk_shader_decompiler.h" |
| 26 | #include "video_core/renderer_vulkan/wrapper.h" | 25 | #include "video_core/renderer_vulkan/wrapper.h" |
| 27 | #include "video_core/shader/memory_util.h" | 26 | #include "video_core/shader/memory_util.h" |
| 28 | #include "video_core/shader/registry.h" | 27 | #include "video_core/shader/registry.h" |
| 29 | #include "video_core/shader/shader_ir.h" | 28 | #include "video_core/shader/shader_ir.h" |
| 30 | #include "video_core/surface.h" | ||
| 31 | 29 | ||
| 32 | namespace Core { | 30 | namespace Core { |
| 33 | class System; | 31 | class System; |
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index 813f7c162..bc91c48cc 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cstddef> | 6 | #include <cstddef> |
| 7 | #include <cstdint> | ||
| 8 | #include <utility> | 7 | #include <utility> |
| 9 | #include <vector> | 8 | #include <vector> |
| 10 | 9 | ||
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.h b/src/video_core/renderer_vulkan/vk_query_cache.h index b63784f4b..40119e6d3 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.h +++ b/src/video_core/renderer_vulkan/vk_query_cache.h | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <cstddef> | 7 | #include <cstddef> |
| 8 | #include <cstdint> | ||
| 9 | #include <memory> | 8 | #include <memory> |
| 10 | #include <utility> | 9 | #include <utility> |
| 11 | #include <vector> | 10 | #include <vector> |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index ccfd0e670..8b009fc22 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -9,14 +9,12 @@ | |||
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | 10 | ||
| 11 | #include <boost/container/static_vector.hpp> | 11 | #include <boost/container/static_vector.hpp> |
| 12 | #include <boost/functional/hash.hpp> | ||
| 13 | 12 | ||
| 14 | #include "common/alignment.h" | 13 | #include "common/alignment.h" |
| 15 | #include "common/assert.h" | 14 | #include "common/assert.h" |
| 16 | #include "common/logging/log.h" | 15 | #include "common/logging/log.h" |
| 17 | #include "common/microprofile.h" | 16 | #include "common/microprofile.h" |
| 18 | #include "core/core.h" | 17 | #include "core/core.h" |
| 19 | #include "core/memory.h" | ||
| 20 | #include "core/settings.h" | 18 | #include "core/settings.h" |
| 21 | #include "video_core/engines/kepler_compute.h" | 19 | #include "video_core/engines/kepler_compute.h" |
| 22 | #include "video_core/engines/maxwell_3d.h" | 20 | #include "video_core/engines/maxwell_3d.h" |
| @@ -301,7 +299,7 @@ RasterizerVulkan::RasterizerVulkan(Core::System& system, Core::Frontend::EmuWind | |||
| 301 | buffer_cache(*this, system, device, memory_manager, scheduler, staging_pool), | 299 | buffer_cache(*this, system, device, memory_manager, scheduler, staging_pool), |
| 302 | sampler_cache(device), | 300 | sampler_cache(device), |
| 303 | fence_manager(system, *this, device, scheduler, texture_cache, buffer_cache, query_cache), | 301 | fence_manager(system, *this, device, scheduler, texture_cache, buffer_cache, query_cache), |
| 304 | query_cache(system, *this, device, scheduler) { | 302 | query_cache(system, *this, device, scheduler), wfi_event{device.GetLogical().CreateEvent()} { |
| 305 | scheduler.SetQueryCache(query_cache); | 303 | scheduler.SetQueryCache(query_cache); |
| 306 | } | 304 | } |
| 307 | 305 | ||
| @@ -575,6 +573,26 @@ void RasterizerVulkan::FlushAndInvalidateRegion(VAddr addr, u64 size) { | |||
| 575 | InvalidateRegion(addr, size); | 573 | InvalidateRegion(addr, size); |
| 576 | } | 574 | } |
| 577 | 575 | ||
| 576 | void RasterizerVulkan::WaitForIdle() { | ||
| 577 | // Everything but wait pixel operations. This intentionally includes FRAGMENT_SHADER_BIT because | ||
| 578 | // fragment shaders can still write storage buffers. | ||
| 579 | VkPipelineStageFlags flags = | ||
| 580 | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT | | ||
| 581 | VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | | ||
| 582 | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | | ||
| 583 | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | | ||
| 584 | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT; | ||
| 585 | if (device.IsExtTransformFeedbackSupported()) { | ||
| 586 | flags |= VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT; | ||
| 587 | } | ||
| 588 | |||
| 589 | scheduler.RequestOutsideRenderPassOperationContext(); | ||
| 590 | scheduler.Record([event = *wfi_event, flags](vk::CommandBuffer cmdbuf) { | ||
| 591 | cmdbuf.SetEvent(event, flags); | ||
| 592 | cmdbuf.WaitEvents(event, flags, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, {}, {}, {}); | ||
| 593 | }); | ||
| 594 | } | ||
| 595 | |||
| 578 | void RasterizerVulkan::FlushCommands() { | 596 | void RasterizerVulkan::FlushCommands() { |
| 579 | if (draw_counter > 0) { | 597 | if (draw_counter > 0) { |
| 580 | draw_counter = 0; | 598 | draw_counter = 0; |
| @@ -895,6 +913,9 @@ void RasterizerVulkan::SetupVertexArrays(FixedPipelineState::VertexInput& vertex | |||
| 895 | 913 | ||
| 896 | void RasterizerVulkan::SetupIndexBuffer(BufferBindings& buffer_bindings, DrawParameters& params, | 914 | void RasterizerVulkan::SetupIndexBuffer(BufferBindings& buffer_bindings, DrawParameters& params, |
| 897 | bool is_indexed) { | 915 | bool is_indexed) { |
| 916 | if (params.num_vertices == 0) { | ||
| 917 | return; | ||
| 918 | } | ||
| 898 | const auto& regs = system.GPU().Maxwell3D().regs; | 919 | const auto& regs = system.GPU().Maxwell3D().regs; |
| 899 | switch (regs.draw.topology) { | 920 | switch (regs.draw.topology) { |
| 900 | case Maxwell::PrimitiveTopology::Quads: { | 921 | case Maxwell::PrimitiveTopology::Quads: { |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index d41a7929e..0ed0e48c6 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | #include <boost/functional/hash.hpp> | 14 | #include <boost/functional/hash.hpp> |
| 15 | 15 | ||
| 16 | #include "common/common_types.h" | 16 | #include "common/common_types.h" |
| 17 | #include "video_core/memory_manager.h" | ||
| 18 | #include "video_core/rasterizer_accelerated.h" | 17 | #include "video_core/rasterizer_accelerated.h" |
| 19 | #include "video_core/rasterizer_interface.h" | 18 | #include "video_core/rasterizer_interface.h" |
| 20 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" | 19 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" |
| @@ -127,6 +126,7 @@ public: | |||
| 127 | void SignalSyncPoint(u32 value) override; | 126 | void SignalSyncPoint(u32 value) override; |
| 128 | void ReleaseFences() override; | 127 | void ReleaseFences() override; |
| 129 | void FlushAndInvalidateRegion(VAddr addr, u64 size) override; | 128 | void FlushAndInvalidateRegion(VAddr addr, u64 size) override; |
| 129 | void WaitForIdle() override; | ||
| 130 | void FlushCommands() override; | 130 | void FlushCommands() override; |
| 131 | void TickFrame() override; | 131 | void TickFrame() override; |
| 132 | bool AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, | 132 | bool AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, |
| @@ -276,6 +276,7 @@ private: | |||
| 276 | 276 | ||
| 277 | vk::Buffer default_buffer; | 277 | vk::Buffer default_buffer; |
| 278 | VKMemoryCommit default_buffer_commit; | 278 | VKMemoryCommit default_buffer_commit; |
| 279 | vk::Event wfi_event; | ||
| 279 | 280 | ||
| 280 | std::array<View, Maxwell::NumRenderTargets> color_attachments; | 281 | std::array<View, Maxwell::NumRenderTargets> color_attachments; |
| 281 | View zeta_attachment; | 282 | View zeta_attachment; |
diff --git a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp index 07bbcf520..e6f2fa553 100644 --- a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp | |||
| @@ -2,11 +2,8 @@ | |||
| 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 <cstring> | ||
| 6 | #include <optional> | ||
| 7 | #include <unordered_map> | 5 | #include <unordered_map> |
| 8 | 6 | ||
| 9 | #include "common/assert.h" | ||
| 10 | #include "video_core/renderer_vulkan/maxwell_to_vk.h" | 7 | #include "video_core/renderer_vulkan/maxwell_to_vk.h" |
| 11 | #include "video_core/renderer_vulkan/vk_sampler_cache.h" | 8 | #include "video_core/renderer_vulkan/vk_sampler_cache.h" |
| 12 | #include "video_core/renderer_vulkan/wrapper.h" | 9 | #include "video_core/renderer_vulkan/wrapper.h" |
| @@ -42,9 +39,18 @@ VKSamplerCache::VKSamplerCache(const VKDevice& device) : device{device} {} | |||
| 42 | VKSamplerCache::~VKSamplerCache() = default; | 39 | VKSamplerCache::~VKSamplerCache() = default; |
| 43 | 40 | ||
| 44 | vk::Sampler VKSamplerCache::CreateSampler(const Tegra::Texture::TSCEntry& tsc) const { | 41 | vk::Sampler VKSamplerCache::CreateSampler(const Tegra::Texture::TSCEntry& tsc) const { |
| 42 | const bool arbitrary_borders = device.IsExtCustomBorderColorSupported(); | ||
| 43 | const std::array color = tsc.GetBorderColor(); | ||
| 44 | |||
| 45 | VkSamplerCustomBorderColorCreateInfoEXT border; | ||
| 46 | border.sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT; | ||
| 47 | border.pNext = nullptr; | ||
| 48 | border.format = VK_FORMAT_UNDEFINED; | ||
| 49 | std::memcpy(&border.customBorderColor, color.data(), sizeof(color)); | ||
| 50 | |||
| 45 | VkSamplerCreateInfo ci; | 51 | VkSamplerCreateInfo ci; |
| 46 | ci.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; | 52 | ci.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; |
| 47 | ci.pNext = nullptr; | 53 | ci.pNext = arbitrary_borders ? &border : nullptr; |
| 48 | ci.flags = 0; | 54 | ci.flags = 0; |
| 49 | ci.magFilter = MaxwellToVK::Sampler::Filter(tsc.mag_filter); | 55 | ci.magFilter = MaxwellToVK::Sampler::Filter(tsc.mag_filter); |
| 50 | ci.minFilter = MaxwellToVK::Sampler::Filter(tsc.min_filter); | 56 | ci.minFilter = MaxwellToVK::Sampler::Filter(tsc.min_filter); |
| @@ -59,7 +65,7 @@ vk::Sampler VKSamplerCache::CreateSampler(const Tegra::Texture::TSCEntry& tsc) c | |||
| 59 | ci.compareOp = MaxwellToVK::Sampler::DepthCompareFunction(tsc.depth_compare_func); | 65 | ci.compareOp = MaxwellToVK::Sampler::DepthCompareFunction(tsc.depth_compare_func); |
| 60 | ci.minLod = tsc.GetMinLod(); | 66 | ci.minLod = tsc.GetMinLod(); |
| 61 | ci.maxLod = tsc.GetMaxLod(); | 67 | ci.maxLod = tsc.GetMaxLod(); |
| 62 | ci.borderColor = ConvertBorderColor(tsc.GetBorderColor()); | 68 | ci.borderColor = arbitrary_borders ? VK_BORDER_COLOR_INT_CUSTOM_EXT : ConvertBorderColor(color); |
| 63 | ci.unnormalizedCoordinates = VK_FALSE; | 69 | ci.unnormalizedCoordinates = VK_FALSE; |
| 64 | return device.GetLogical().CreateSampler(ci); | 70 | return device.GetLogical().CreateSampler(ci); |
| 65 | } | 71 | } |
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.cpp b/src/video_core/renderer_vulkan/vk_scheduler.cpp index ae7ba3eb5..82ec9180e 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.cpp +++ b/src/video_core/renderer_vulkan/vk_scheduler.cpp | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include <thread> | 8 | #include <thread> |
| 9 | #include <utility> | 9 | #include <utility> |
| 10 | 10 | ||
| 11 | #include "common/assert.h" | ||
| 12 | #include "common/microprofile.h" | 11 | #include "common/microprofile.h" |
| 13 | #include "video_core/renderer_vulkan/vk_device.h" | 12 | #include "video_core/renderer_vulkan/vk_device.h" |
| 14 | #include "video_core/renderer_vulkan/vk_query_cache.h" | 13 | #include "video_core/renderer_vulkan/vk_query_cache.h" |
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.h b/src/video_core/renderer_vulkan/vk_scheduler.h index 82a8adc69..970a65566 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.h +++ b/src/video_core/renderer_vulkan/vk_scheduler.h | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <atomic> | 7 | #include <atomic> |
| 8 | #include <condition_variable> | 8 | #include <condition_variable> |
| 9 | #include <memory> | 9 | #include <memory> |
| 10 | #include <optional> | ||
| 11 | #include <stack> | 10 | #include <stack> |
| 12 | #include <thread> | 11 | #include <thread> |
| 13 | #include <utility> | 12 | #include <utility> |
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.h b/src/video_core/renderer_vulkan/vk_shader_decompiler.h index ffea4709e..f4c05ac3c 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.h +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.h | |||
| @@ -5,11 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <bitset> | ||
| 9 | #include <memory> | ||
| 10 | #include <set> | 8 | #include <set> |
| 11 | #include <type_traits> | ||
| 12 | #include <utility> | ||
| 13 | #include <vector> | 9 | #include <vector> |
| 14 | 10 | ||
| 15 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
diff --git a/src/video_core/renderer_vulkan/vk_shader_util.cpp b/src/video_core/renderer_vulkan/vk_shader_util.cpp index 784839327..112df9c71 100644 --- a/src/video_core/renderer_vulkan/vk_shader_util.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_util.cpp | |||
| @@ -4,8 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <cstring> | 5 | #include <cstring> |
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | #include <vector> | 7 | |
| 8 | #include "common/alignment.h" | ||
| 9 | #include "common/assert.h" | 8 | #include "common/assert.h" |
| 10 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 11 | #include "video_core/renderer_vulkan/vk_device.h" | 10 | #include "video_core/renderer_vulkan/vk_device.h" |
diff --git a/src/video_core/renderer_vulkan/vk_shader_util.h b/src/video_core/renderer_vulkan/vk_shader_util.h index be38d6697..d1d3f3cae 100644 --- a/src/video_core/renderer_vulkan/vk_shader_util.h +++ b/src/video_core/renderer_vulkan/vk_shader_util.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <vector> | ||
| 8 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 9 | #include "video_core/renderer_vulkan/wrapper.h" | 8 | #include "video_core/renderer_vulkan/wrapper.h" |
| 10 | 9 | ||
diff --git a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h index faf6418fd..3c4901437 100644 --- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h +++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h | |||
| @@ -5,8 +5,6 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <climits> | 7 | #include <climits> |
| 8 | #include <unordered_map> | ||
| 9 | #include <utility> | ||
| 10 | #include <vector> | 8 | #include <vector> |
| 11 | 9 | ||
| 12 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index de4c23120..55f43e61b 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -10,11 +10,9 @@ | |||
| 10 | #include <variant> | 10 | #include <variant> |
| 11 | #include <vector> | 11 | #include <vector> |
| 12 | 12 | ||
| 13 | #include "common/alignment.h" | ||
| 14 | #include "common/assert.h" | 13 | #include "common/assert.h" |
| 15 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 16 | #include "core/core.h" | 15 | #include "core/core.h" |
| 17 | #include "core/memory.h" | ||
| 18 | #include "video_core/engines/maxwell_3d.h" | 16 | #include "video_core/engines/maxwell_3d.h" |
| 19 | #include "video_core/morton.h" | 17 | #include "video_core/morton.h" |
| 20 | #include "video_core/renderer_vulkan/maxwell_to_vk.h" | 18 | #include "video_core/renderer_vulkan/maxwell_to_vk.h" |
| @@ -26,7 +24,6 @@ | |||
| 26 | #include "video_core/renderer_vulkan/vk_texture_cache.h" | 24 | #include "video_core/renderer_vulkan/vk_texture_cache.h" |
| 27 | #include "video_core/renderer_vulkan/wrapper.h" | 25 | #include "video_core/renderer_vulkan/wrapper.h" |
| 28 | #include "video_core/surface.h" | 26 | #include "video_core/surface.h" |
| 29 | #include "video_core/textures/convert.h" | ||
| 30 | 27 | ||
| 31 | namespace Vulkan { | 28 | namespace Vulkan { |
| 32 | 29 | ||
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 115595f28..f211ccb1e 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -7,19 +7,13 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <unordered_map> | 8 | #include <unordered_map> |
| 9 | 9 | ||
| 10 | #include "common/assert.h" | ||
| 11 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 12 | #include "common/logging/log.h" | ||
| 13 | #include "common/math_util.h" | ||
| 14 | #include "video_core/gpu.h" | ||
| 15 | #include "video_core/rasterizer_cache.h" | ||
| 16 | #include "video_core/renderer_vulkan/vk_image.h" | 11 | #include "video_core/renderer_vulkan/vk_image.h" |
| 17 | #include "video_core/renderer_vulkan/vk_memory_manager.h" | 12 | #include "video_core/renderer_vulkan/vk_memory_manager.h" |
| 18 | #include "video_core/renderer_vulkan/vk_scheduler.h" | 13 | #include "video_core/renderer_vulkan/vk_scheduler.h" |
| 19 | #include "video_core/renderer_vulkan/wrapper.h" | 14 | #include "video_core/renderer_vulkan/wrapper.h" |
| 20 | #include "video_core/texture_cache/surface_base.h" | 15 | #include "video_core/texture_cache/surface_base.h" |
| 21 | #include "video_core/texture_cache/texture_cache.h" | 16 | #include "video_core/texture_cache/texture_cache.h" |
| 22 | #include "video_core/textures/decoders.h" | ||
| 23 | 17 | ||
| 24 | namespace Core { | 18 | namespace Core { |
| 25 | class System; | 19 | class System; |
diff --git a/src/video_core/renderer_vulkan/vk_update_descriptor.h b/src/video_core/renderer_vulkan/vk_update_descriptor.h index 6ba2c9997..cc7e3dff4 100644 --- a/src/video_core/renderer_vulkan/vk_update_descriptor.h +++ b/src/video_core/renderer_vulkan/vk_update_descriptor.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <type_traits> | ||
| 8 | #include <variant> | 7 | #include <variant> |
| 9 | #include <boost/container/static_vector.hpp> | 8 | #include <boost/container/static_vector.hpp> |
| 10 | 9 | ||
diff --git a/src/video_core/renderer_vulkan/wrapper.cpp b/src/video_core/renderer_vulkan/wrapper.cpp index 7f5bc1404..2ce9b0626 100644 --- a/src/video_core/renderer_vulkan/wrapper.cpp +++ b/src/video_core/renderer_vulkan/wrapper.cpp | |||
| @@ -87,6 +87,7 @@ void Load(VkDevice device, DeviceDispatch& dld) noexcept { | |||
| 87 | X(vkCmdSetStencilReference); | 87 | X(vkCmdSetStencilReference); |
| 88 | X(vkCmdSetStencilWriteMask); | 88 | X(vkCmdSetStencilWriteMask); |
| 89 | X(vkCmdSetViewport); | 89 | X(vkCmdSetViewport); |
| 90 | X(vkCmdWaitEvents); | ||
| 90 | X(vkCreateBuffer); | 91 | X(vkCreateBuffer); |
| 91 | X(vkCreateBufferView); | 92 | X(vkCreateBufferView); |
| 92 | X(vkCreateCommandPool); | 93 | X(vkCreateCommandPool); |
diff --git a/src/video_core/renderer_vulkan/wrapper.h b/src/video_core/renderer_vulkan/wrapper.h index bda16a2cb..98937a77a 100644 --- a/src/video_core/renderer_vulkan/wrapper.h +++ b/src/video_core/renderer_vulkan/wrapper.h | |||
| @@ -205,6 +205,7 @@ struct DeviceDispatch : public InstanceDispatch { | |||
| 205 | PFN_vkCmdSetStencilReference vkCmdSetStencilReference; | 205 | PFN_vkCmdSetStencilReference vkCmdSetStencilReference; |
| 206 | PFN_vkCmdSetStencilWriteMask vkCmdSetStencilWriteMask; | 206 | PFN_vkCmdSetStencilWriteMask vkCmdSetStencilWriteMask; |
| 207 | PFN_vkCmdSetViewport vkCmdSetViewport; | 207 | PFN_vkCmdSetViewport vkCmdSetViewport; |
| 208 | PFN_vkCmdWaitEvents vkCmdWaitEvents; | ||
| 208 | PFN_vkCreateBuffer vkCreateBuffer; | 209 | PFN_vkCreateBuffer vkCreateBuffer; |
| 209 | PFN_vkCreateBufferView vkCreateBufferView; | 210 | PFN_vkCreateBufferView vkCreateBufferView; |
| 210 | PFN_vkCreateCommandPool vkCreateCommandPool; | 211 | PFN_vkCreateCommandPool vkCreateCommandPool; |
| @@ -958,6 +959,15 @@ public: | |||
| 958 | dld->vkCmdSetEvent(handle, event, stage_flags); | 959 | dld->vkCmdSetEvent(handle, event, stage_flags); |
| 959 | } | 960 | } |
| 960 | 961 | ||
| 962 | void WaitEvents(Span<VkEvent> events, VkPipelineStageFlags src_stage_mask, | ||
| 963 | VkPipelineStageFlags dst_stage_mask, Span<VkMemoryBarrier> memory_barriers, | ||
| 964 | Span<VkBufferMemoryBarrier> buffer_barriers, | ||
| 965 | Span<VkImageMemoryBarrier> image_barriers) const noexcept { | ||
| 966 | dld->vkCmdWaitEvents(handle, events.size(), events.data(), src_stage_mask, dst_stage_mask, | ||
| 967 | memory_barriers.size(), memory_barriers.data(), buffer_barriers.size(), | ||
| 968 | buffer_barriers.data(), image_barriers.size(), image_barriers.data()); | ||
| 969 | } | ||
| 970 | |||
| 961 | void BindTransformFeedbackBuffersEXT(u32 first, u32 count, const VkBuffer* buffers, | 971 | void BindTransformFeedbackBuffersEXT(u32 first, u32 count, const VkBuffer* buffers, |
| 962 | const VkDeviceSize* offsets, | 972 | const VkDeviceSize* offsets, |
| 963 | const VkDeviceSize* sizes) const noexcept { | 973 | const VkDeviceSize* sizes) const noexcept { |
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index cc7181229..bbe93903c 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -145,6 +145,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) | |||
| 145 | return PixelFormat::RG8U; | 145 | return PixelFormat::RG8U; |
| 146 | case Tegra::RenderTargetFormat::RG8_SNORM: | 146 | case Tegra::RenderTargetFormat::RG8_SNORM: |
| 147 | return PixelFormat::RG8S; | 147 | return PixelFormat::RG8S; |
| 148 | case Tegra::RenderTargetFormat::RG8_UINT: | ||
| 149 | return PixelFormat::RG8UI; | ||
| 148 | case Tegra::RenderTargetFormat::R16_FLOAT: | 150 | case Tegra::RenderTargetFormat::R16_FLOAT: |
| 149 | return PixelFormat::R16F; | 151 | return PixelFormat::R16F; |
| 150 | case Tegra::RenderTargetFormat::R16_UNORM: | 152 | case Tegra::RenderTargetFormat::R16_UNORM: |
diff --git a/src/video_core/surface.h b/src/video_core/surface.h index e0acd44d3..6da6a1b97 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h | |||
| @@ -57,51 +57,52 @@ enum class PixelFormat { | |||
| 57 | RGBA8_SRGB = 39, | 57 | RGBA8_SRGB = 39, |
| 58 | RG8U = 40, | 58 | RG8U = 40, |
| 59 | RG8S = 41, | 59 | RG8S = 41, |
| 60 | RG32UI = 42, | 60 | RG8UI = 42, |
| 61 | RGBX16F = 43, | 61 | RG32UI = 43, |
| 62 | R32UI = 44, | 62 | RGBX16F = 44, |
| 63 | R32I = 45, | 63 | R32UI = 45, |
| 64 | ASTC_2D_8X8 = 46, | 64 | R32I = 46, |
| 65 | ASTC_2D_8X5 = 47, | 65 | ASTC_2D_8X8 = 47, |
| 66 | ASTC_2D_5X4 = 48, | 66 | ASTC_2D_8X5 = 48, |
| 67 | BGRA8_SRGB = 49, | 67 | ASTC_2D_5X4 = 49, |
| 68 | DXT1_SRGB = 50, | 68 | BGRA8_SRGB = 50, |
| 69 | DXT23_SRGB = 51, | 69 | DXT1_SRGB = 51, |
| 70 | DXT45_SRGB = 52, | 70 | DXT23_SRGB = 52, |
| 71 | BC7U_SRGB = 53, | 71 | DXT45_SRGB = 53, |
| 72 | R4G4B4A4U = 54, | 72 | BC7U_SRGB = 54, |
| 73 | ASTC_2D_4X4_SRGB = 55, | 73 | R4G4B4A4U = 55, |
| 74 | ASTC_2D_8X8_SRGB = 56, | 74 | ASTC_2D_4X4_SRGB = 56, |
| 75 | ASTC_2D_8X5_SRGB = 57, | 75 | ASTC_2D_8X8_SRGB = 57, |
| 76 | ASTC_2D_5X4_SRGB = 58, | 76 | ASTC_2D_8X5_SRGB = 58, |
| 77 | ASTC_2D_5X5 = 59, | 77 | ASTC_2D_5X4_SRGB = 59, |
| 78 | ASTC_2D_5X5_SRGB = 60, | 78 | ASTC_2D_5X5 = 60, |
| 79 | ASTC_2D_10X8 = 61, | 79 | ASTC_2D_5X5_SRGB = 61, |
| 80 | ASTC_2D_10X8_SRGB = 62, | 80 | ASTC_2D_10X8 = 62, |
| 81 | ASTC_2D_6X6 = 63, | 81 | ASTC_2D_10X8_SRGB = 63, |
| 82 | ASTC_2D_6X6_SRGB = 64, | 82 | ASTC_2D_6X6 = 64, |
| 83 | ASTC_2D_10X10 = 65, | 83 | ASTC_2D_6X6_SRGB = 65, |
| 84 | ASTC_2D_10X10_SRGB = 66, | 84 | ASTC_2D_10X10 = 66, |
| 85 | ASTC_2D_12X12 = 67, | 85 | ASTC_2D_10X10_SRGB = 67, |
| 86 | ASTC_2D_12X12_SRGB = 68, | 86 | ASTC_2D_12X12 = 68, |
| 87 | ASTC_2D_8X6 = 69, | 87 | ASTC_2D_12X12_SRGB = 69, |
| 88 | ASTC_2D_8X6_SRGB = 70, | 88 | ASTC_2D_8X6 = 70, |
| 89 | ASTC_2D_6X5 = 71, | 89 | ASTC_2D_8X6_SRGB = 71, |
| 90 | ASTC_2D_6X5_SRGB = 72, | 90 | ASTC_2D_6X5 = 72, |
| 91 | E5B9G9R9F = 73, | 91 | ASTC_2D_6X5_SRGB = 73, |
| 92 | E5B9G9R9F = 74, | ||
| 92 | 93 | ||
| 93 | MaxColorFormat, | 94 | MaxColorFormat, |
| 94 | 95 | ||
| 95 | // Depth formats | 96 | // Depth formats |
| 96 | Z32F = 74, | 97 | Z32F = 75, |
| 97 | Z16 = 75, | 98 | Z16 = 76, |
| 98 | 99 | ||
| 99 | MaxDepthFormat, | 100 | MaxDepthFormat, |
| 100 | 101 | ||
| 101 | // DepthStencil formats | 102 | // DepthStencil formats |
| 102 | Z24S8 = 76, | 103 | Z24S8 = 77, |
| 103 | S8Z24 = 77, | 104 | S8Z24 = 78, |
| 104 | Z32FS8 = 78, | 105 | Z32FS8 = 79, |
| 105 | 106 | ||
| 106 | MaxDepthStencilFormat, | 107 | MaxDepthStencilFormat, |
| 107 | 108 | ||
| @@ -171,6 +172,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{ | |||
| 171 | 0, // RGBA8_SRGB | 172 | 0, // RGBA8_SRGB |
| 172 | 0, // RG8U | 173 | 0, // RG8U |
| 173 | 0, // RG8S | 174 | 0, // RG8S |
| 175 | 0, // RG8UI | ||
| 174 | 0, // RG32UI | 176 | 0, // RG32UI |
| 175 | 0, // RGBX16F | 177 | 0, // RGBX16F |
| 176 | 0, // R32UI | 178 | 0, // R32UI |
| @@ -269,6 +271,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{ | |||
| 269 | 1, // RGBA8_SRGB | 271 | 1, // RGBA8_SRGB |
| 270 | 1, // RG8U | 272 | 1, // RG8U |
| 271 | 1, // RG8S | 273 | 1, // RG8S |
| 274 | 1, // RG8UI | ||
| 272 | 1, // RG32UI | 275 | 1, // RG32UI |
| 273 | 1, // RGBX16F | 276 | 1, // RGBX16F |
| 274 | 1, // R32UI | 277 | 1, // R32UI |
| @@ -359,6 +362,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{ | |||
| 359 | 1, // RGBA8_SRGB | 362 | 1, // RGBA8_SRGB |
| 360 | 1, // RG8U | 363 | 1, // RG8U |
| 361 | 1, // RG8S | 364 | 1, // RG8S |
| 365 | 1, // RG8UI | ||
| 362 | 1, // RG32UI | 366 | 1, // RG32UI |
| 363 | 1, // RGBX16F | 367 | 1, // RGBX16F |
| 364 | 1, // R32UI | 368 | 1, // R32UI |
| @@ -449,6 +453,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{ | |||
| 449 | 32, // RGBA8_SRGB | 453 | 32, // RGBA8_SRGB |
| 450 | 16, // RG8U | 454 | 16, // RG8U |
| 451 | 16, // RG8S | 455 | 16, // RG8S |
| 456 | 16, // RG8UI | ||
| 452 | 64, // RG32UI | 457 | 64, // RG32UI |
| 453 | 64, // RGBX16F | 458 | 64, // RGBX16F |
| 454 | 32, // R32UI | 459 | 32, // R32UI |
diff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cpp index 25d2ee2e8..7032e0059 100644 --- a/src/video_core/texture_cache/format_lookup_table.cpp +++ b/src/video_core/texture_cache/format_lookup_table.cpp | |||
| @@ -41,7 +41,7 @@ struct Table { | |||
| 41 | ComponentType alpha_component; | 41 | ComponentType alpha_component; |
| 42 | bool is_srgb; | 42 | bool is_srgb; |
| 43 | }; | 43 | }; |
| 44 | constexpr std::array<Table, 76> DefinitionTable = {{ | 44 | constexpr std::array<Table, 77> DefinitionTable = {{ |
| 45 | {TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U}, | 45 | {TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U}, |
| 46 | {TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S}, | 46 | {TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S}, |
| 47 | {TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI}, | 47 | {TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI}, |
| @@ -60,6 +60,7 @@ constexpr std::array<Table, 76> DefinitionTable = {{ | |||
| 60 | 60 | ||
| 61 | {TextureFormat::G8R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG8U}, | 61 | {TextureFormat::G8R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG8U}, |
| 62 | {TextureFormat::G8R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG8S}, | 62 | {TextureFormat::G8R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG8S}, |
| 63 | {TextureFormat::G8R8, C, UINT, UINT, UINT, UINT, PixelFormat::RG8UI}, | ||
| 63 | 64 | ||
| 64 | {TextureFormat::R16_G16_B16_A16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RGBA16S}, | 65 | {TextureFormat::R16_G16_B16_A16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RGBA16S}, |
| 65 | {TextureFormat::R16_G16_B16_A16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA16U}, | 66 | {TextureFormat::R16_G16_B16_A16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA16U}, |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index fae8638ec..548e4c3fe 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -382,4 +382,18 @@ std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height | |||
| 382 | } | 382 | } |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | u64 GetGOBOffset(u32 width, u32 height, u32 dst_x, u32 dst_y, u32 block_height, | ||
| 386 | u32 bytes_per_pixel) { | ||
| 387 | auto div_ceil = [](const u32 x, const u32 y) { return ((x + y - 1) / y); }; | ||
| 388 | const u32 gobs_in_block = 1 << block_height; | ||
| 389 | const u32 y_blocks = gob_size_y << block_height; | ||
| 390 | const u32 x_per_gob = gob_size_x / bytes_per_pixel; | ||
| 391 | const u32 x_blocks = div_ceil(width, x_per_gob); | ||
| 392 | const u32 block_size = gob_size * gobs_in_block; | ||
| 393 | const u32 stride = block_size * x_blocks; | ||
| 394 | const u32 base = (dst_y / y_blocks) * stride + (dst_x / x_per_gob) * block_size; | ||
| 395 | const u32 relative_y = dst_y % y_blocks; | ||
| 396 | return base + (relative_y / gob_size_y) * gob_size; | ||
| 397 | } | ||
| 398 | |||
| 385 | } // namespace Tegra::Texture | 399 | } // namespace Tegra::Texture |
diff --git a/src/video_core/textures/decoders.h b/src/video_core/textures/decoders.h index 9f2d6d308..06f3ebf87 100644 --- a/src/video_core/textures/decoders.h +++ b/src/video_core/textures/decoders.h | |||
| @@ -59,4 +59,8 @@ void UnswizzleSubrect(u32 subrect_width, u32 subrect_height, u32 dest_pitch, u32 | |||
| 59 | void SwizzleKepler(u32 width, u32 height, u32 dst_x, u32 dst_y, u32 block_height, | 59 | void SwizzleKepler(u32 width, u32 height, u32 dst_x, u32 dst_y, u32 block_height, |
| 60 | std::size_t copy_size, const u8* source_data, u8* swizzle_data); | 60 | std::size_t copy_size, const u8* source_data, u8* swizzle_data); |
| 61 | 61 | ||
| 62 | /// Obtains the offset of the gob for positions 'dst_x' & 'dst_y' | ||
| 63 | u64 GetGOBOffset(u32 width, u32 height, u32 dst_x, u32 dst_y, u32 block_height, | ||
| 64 | u32 bytes_per_pixel); | ||
| 65 | |||
| 62 | } // namespace Tegra::Texture | 66 | } // namespace Tegra::Texture |
diff --git a/src/web_service/CMakeLists.txt b/src/web_service/CMakeLists.txt index 0c9bb0d55..06ab7c59d 100644 --- a/src/web_service/CMakeLists.txt +++ b/src/web_service/CMakeLists.txt | |||
| @@ -8,4 +8,4 @@ add_library(web_service STATIC | |||
| 8 | ) | 8 | ) |
| 9 | 9 | ||
| 10 | create_target_directory_groups(web_service) | 10 | create_target_directory_groups(web_service) |
| 11 | target_link_libraries(web_service PRIVATE common json-headers httplib lurlparser) | 11 | target_link_libraries(web_service PRIVATE common nlohmann_json::nlohmann_json httplib lurlparser) |
diff --git a/src/web_service/telemetry_json.cpp b/src/web_service/telemetry_json.cpp index 7538389bf..7a480e33c 100644 --- a/src/web_service/telemetry_json.cpp +++ b/src/web_service/telemetry_json.cpp | |||
| @@ -2,7 +2,7 @@ | |||
| 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 <json.hpp> | 5 | #include <nlohmann/json.hpp> |
| 6 | #include "common/detached_tasks.h" | 6 | #include "common/detached_tasks.h" |
| 7 | #include "common/web_result.h" | 7 | #include "common/web_result.h" |
| 8 | #include "web_service/telemetry_json.h" | 8 | #include "web_service/telemetry_json.h" |
diff --git a/src/web_service/verify_login.cpp b/src/web_service/verify_login.cpp index ca4b43b93..bfaa5b70a 100644 --- a/src/web_service/verify_login.cpp +++ b/src/web_service/verify_login.cpp | |||
| @@ -2,7 +2,7 @@ | |||
| 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 <json.hpp> | 5 | #include <nlohmann/json.hpp> |
| 6 | #include "common/web_result.h" | 6 | #include "common/web_result.h" |
| 7 | #include "web_service/verify_login.h" | 7 | #include "web_service/verify_login.h" |
| 8 | #include "web_service/web_backend.h" | 8 | #include "web_service/web_backend.h" |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 1cac2f942..3d759f77b 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -292,6 +292,8 @@ GRenderWindow::GRenderWindow(GMainWindow* parent_, EmuThread* emu_thread_) | |||
| 292 | setLayout(layout); | 292 | setLayout(layout); |
| 293 | InputCommon::Init(); | 293 | InputCommon::Init(); |
| 294 | 294 | ||
| 295 | this->setMouseTracking(true); | ||
| 296 | |||
| 295 | connect(this, &GRenderWindow::FirstFrameDisplayed, parent_, &GMainWindow::OnLoadComplete); | 297 | connect(this, &GRenderWindow::FirstFrameDisplayed, parent_, &GMainWindow::OnLoadComplete); |
| 296 | } | 298 | } |
| 297 | 299 | ||
| @@ -385,6 +387,7 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) { | |||
| 385 | } else if (event->button() == Qt::RightButton) { | 387 | } else if (event->button() == Qt::RightButton) { |
| 386 | InputCommon::GetMotionEmu()->BeginTilt(pos.x(), pos.y()); | 388 | InputCommon::GetMotionEmu()->BeginTilt(pos.x(), pos.y()); |
| 387 | } | 389 | } |
| 390 | QWidget::mousePressEvent(event); | ||
| 388 | } | 391 | } |
| 389 | 392 | ||
| 390 | void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { | 393 | void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { |
| @@ -397,6 +400,7 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { | |||
| 397 | const auto [x, y] = ScaleTouch(pos); | 400 | const auto [x, y] = ScaleTouch(pos); |
| 398 | this->TouchMoved(x, y); | 401 | this->TouchMoved(x, y); |
| 399 | InputCommon::GetMotionEmu()->Tilt(pos.x(), pos.y()); | 402 | InputCommon::GetMotionEmu()->Tilt(pos.x(), pos.y()); |
| 403 | QWidget::mouseMoveEvent(event); | ||
| 400 | } | 404 | } |
| 401 | 405 | ||
| 402 | void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { | 406 | void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index a44eed047..75c6cf20b 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -743,6 +743,8 @@ void Config::ReadUIValues() { | |||
| 743 | UISettings::values.profile_index = ReadSetting(QStringLiteral("profileIndex"), 0).toUInt(); | 743 | UISettings::values.profile_index = ReadSetting(QStringLiteral("profileIndex"), 0).toUInt(); |
| 744 | UISettings::values.pause_when_in_background = | 744 | UISettings::values.pause_when_in_background = |
| 745 | ReadSetting(QStringLiteral("pauseWhenInBackground"), false).toBool(); | 745 | ReadSetting(QStringLiteral("pauseWhenInBackground"), false).toBool(); |
| 746 | UISettings::values.hide_mouse = | ||
| 747 | ReadSetting(QStringLiteral("hideInactiveMouse"), false).toBool(); | ||
| 746 | 748 | ||
| 747 | ApplyDefaultProfileIfInputInvalid(); | 749 | ApplyDefaultProfileIfInputInvalid(); |
| 748 | 750 | ||
| @@ -1169,6 +1171,7 @@ void Config::SaveUIValues() { | |||
| 1169 | WriteSetting(QStringLiteral("profileIndex"), UISettings::values.profile_index, 0); | 1171 | WriteSetting(QStringLiteral("profileIndex"), UISettings::values.profile_index, 0); |
| 1170 | WriteSetting(QStringLiteral("pauseWhenInBackground"), | 1172 | WriteSetting(QStringLiteral("pauseWhenInBackground"), |
| 1171 | UISettings::values.pause_when_in_background, false); | 1173 | UISettings::values.pause_when_in_background, false); |
| 1174 | WriteSetting(QStringLiteral("hideInactiveMouse"), UISettings::values.hide_mouse, false); | ||
| 1172 | 1175 | ||
| 1173 | qt_config->endGroup(); | 1176 | qt_config->endGroup(); |
| 1174 | } | 1177 | } |
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 5ef927114..cb95423e0 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -26,6 +26,7 @@ void ConfigureGeneral::SetConfiguration() { | |||
| 26 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); | 26 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); |
| 27 | ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot); | 27 | ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot); |
| 28 | ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background); | 28 | ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background); |
| 29 | ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse); | ||
| 29 | 30 | ||
| 30 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); | 31 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); |
| 31 | ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); | 32 | ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); |
| @@ -36,6 +37,7 @@ void ConfigureGeneral::ApplyConfiguration() { | |||
| 36 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); | 37 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); |
| 37 | UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); | 38 | UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); |
| 38 | UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); | 39 | UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); |
| 40 | UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked(); | ||
| 39 | 41 | ||
| 40 | Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); | 42 | Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); |
| 41 | Settings::values.frame_limit = ui->frame_limit->value(); | 43 | Settings::values.frame_limit = ui->frame_limit->value(); |
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index 857119bb3..fc3b7e65a 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui | |||
| @@ -72,6 +72,13 @@ | |||
| 72 | </property> | 72 | </property> |
| 73 | </widget> | 73 | </widget> |
| 74 | </item> | 74 | </item> |
| 75 | <item> | ||
| 76 | <widget class="QCheckBox" name="toggle_hide_mouse"> | ||
| 77 | <property name="text"> | ||
| 78 | <string>Hide mouse on inactivity</string> | ||
| 79 | </property> | ||
| 80 | </widget> | ||
| 81 | </item> | ||
| 75 | </layout> | 82 | </layout> |
| 76 | </item> | 83 | </item> |
| 77 | </layout> | 84 | </layout> |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index b44b4276c..86e8a1d49 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -135,6 +135,8 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; | |||
| 135 | } | 135 | } |
| 136 | #endif | 136 | #endif |
| 137 | 137 | ||
| 138 | constexpr int default_mouse_timeout = 2500; | ||
| 139 | |||
| 138 | constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000; | 140 | constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000; |
| 139 | 141 | ||
| 140 | /** | 142 | /** |
| @@ -236,6 +238,14 @@ GMainWindow::GMainWindow() | |||
| 236 | // Show one-time "callout" messages to the user | 238 | // Show one-time "callout" messages to the user |
| 237 | ShowTelemetryCallout(); | 239 | ShowTelemetryCallout(); |
| 238 | 240 | ||
| 241 | // make sure menubar has the arrow cursor instead of inheriting from this | ||
| 242 | ui.menubar->setCursor(QCursor()); | ||
| 243 | statusBar()->setCursor(QCursor()); | ||
| 244 | |||
| 245 | mouse_hide_timer.setInterval(default_mouse_timeout); | ||
| 246 | connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor); | ||
| 247 | connect(ui.menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor); | ||
| 248 | |||
| 239 | QStringList args = QApplication::arguments(); | 249 | QStringList args = QApplication::arguments(); |
| 240 | if (args.length() >= 2) { | 250 | if (args.length() >= 2) { |
| 241 | BootGame(args[1]); | 251 | BootGame(args[1]); |
| @@ -1012,6 +1022,12 @@ void GMainWindow::BootGame(const QString& filename) { | |||
| 1012 | async_status_button->setDisabled(true); | 1022 | async_status_button->setDisabled(true); |
| 1013 | renderer_status_button->setDisabled(true); | 1023 | renderer_status_button->setDisabled(true); |
| 1014 | 1024 | ||
| 1025 | if (UISettings::values.hide_mouse) { | ||
| 1026 | mouse_hide_timer.start(); | ||
| 1027 | setMouseTracking(true); | ||
| 1028 | ui.centralwidget->setMouseTracking(true); | ||
| 1029 | } | ||
| 1030 | |||
| 1015 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 1031 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); |
| 1016 | 1032 | ||
| 1017 | std::string title_name; | 1033 | std::string title_name; |
| @@ -1080,6 +1096,9 @@ void GMainWindow::ShutdownGame() { | |||
| 1080 | game_list->show(); | 1096 | game_list->show(); |
| 1081 | game_list->setFilterFocus(); | 1097 | game_list->setFilterFocus(); |
| 1082 | 1098 | ||
| 1099 | setMouseTracking(false); | ||
| 1100 | ui.centralwidget->setMouseTracking(false); | ||
| 1101 | |||
| 1083 | UpdateWindowTitle(); | 1102 | UpdateWindowTitle(); |
| 1084 | 1103 | ||
| 1085 | // Disable status bar updates | 1104 | // Disable status bar updates |
| @@ -1837,6 +1856,15 @@ void GMainWindow::OnConfigure() { | |||
| 1837 | 1856 | ||
| 1838 | config->Save(); | 1857 | config->Save(); |
| 1839 | 1858 | ||
| 1859 | if (UISettings::values.hide_mouse && emulation_running) { | ||
| 1860 | setMouseTracking(true); | ||
| 1861 | ui.centralwidget->setMouseTracking(true); | ||
| 1862 | mouse_hide_timer.start(); | ||
| 1863 | } else { | ||
| 1864 | setMouseTracking(false); | ||
| 1865 | ui.centralwidget->setMouseTracking(false); | ||
| 1866 | } | ||
| 1867 | |||
| 1840 | dock_status_button->setChecked(Settings::values.use_docked_mode); | 1868 | dock_status_button->setChecked(Settings::values.use_docked_mode); |
| 1841 | async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); | 1869 | async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); |
| 1842 | #ifdef HAS_VULKAN | 1870 | #ifdef HAS_VULKAN |
| @@ -1970,6 +1998,30 @@ void GMainWindow::UpdateStatusBar() { | |||
| 1970 | emu_frametime_label->setVisible(true); | 1998 | emu_frametime_label->setVisible(true); |
| 1971 | } | 1999 | } |
| 1972 | 2000 | ||
| 2001 | void GMainWindow::HideMouseCursor() { | ||
| 2002 | if (emu_thread == nullptr || UISettings::values.hide_mouse == false) { | ||
| 2003 | mouse_hide_timer.stop(); | ||
| 2004 | ShowMouseCursor(); | ||
| 2005 | return; | ||
| 2006 | } | ||
| 2007 | setCursor(QCursor(Qt::BlankCursor)); | ||
| 2008 | } | ||
| 2009 | |||
| 2010 | void GMainWindow::ShowMouseCursor() { | ||
| 2011 | unsetCursor(); | ||
| 2012 | if (emu_thread != nullptr && UISettings::values.hide_mouse) { | ||
| 2013 | mouse_hide_timer.start(); | ||
| 2014 | } | ||
| 2015 | } | ||
| 2016 | |||
| 2017 | void GMainWindow::mouseMoveEvent(QMouseEvent* event) { | ||
| 2018 | ShowMouseCursor(); | ||
| 2019 | } | ||
| 2020 | |||
| 2021 | void GMainWindow::mousePressEvent(QMouseEvent* event) { | ||
| 2022 | ShowMouseCursor(); | ||
| 2023 | } | ||
| 2024 | |||
| 1973 | void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) { | 2025 | void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) { |
| 1974 | QMessageBox::StandardButton answer; | 2026 | QMessageBox::StandardButton answer; |
| 1975 | QString status_message; | 2027 | QString status_message; |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 0b750689d..60b17c54a 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -216,6 +216,8 @@ private: | |||
| 216 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); | 216 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); |
| 217 | void UpdateWindowTitle(const QString& title_name = {}); | 217 | void UpdateWindowTitle(const QString& title_name = {}); |
| 218 | void UpdateStatusBar(); | 218 | void UpdateStatusBar(); |
| 219 | void HideMouseCursor(); | ||
| 220 | void ShowMouseCursor(); | ||
| 219 | 221 | ||
| 220 | Ui::MainWindow ui; | 222 | Ui::MainWindow ui; |
| 221 | 223 | ||
| @@ -244,6 +246,7 @@ private: | |||
| 244 | QString game_path; | 246 | QString game_path; |
| 245 | 247 | ||
| 246 | bool auto_paused = false; | 248 | bool auto_paused = false; |
| 249 | QTimer mouse_hide_timer; | ||
| 247 | 250 | ||
| 248 | // FS | 251 | // FS |
| 249 | std::shared_ptr<FileSys::VfsFilesystem> vfs; | 252 | std::shared_ptr<FileSys::VfsFilesystem> vfs; |
| @@ -265,4 +268,6 @@ protected: | |||
| 265 | void dropEvent(QDropEvent* event) override; | 268 | void dropEvent(QDropEvent* event) override; |
| 266 | void dragEnterEvent(QDragEnterEvent* event) override; | 269 | void dragEnterEvent(QDragEnterEvent* event) override; |
| 267 | void dragMoveEvent(QDragMoveEvent* event) override; | 270 | void dragMoveEvent(QDragMoveEvent* event) override; |
| 271 | void mouseMoveEvent(QMouseEvent* event) override; | ||
| 272 | void mousePressEvent(QMouseEvent* event) override; | ||
| 268 | }; | 273 | }; |
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index a675ecf4d..830932d45 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -59,6 +59,7 @@ struct Values { | |||
| 59 | bool confirm_before_closing; | 59 | bool confirm_before_closing; |
| 60 | bool first_start; | 60 | bool first_start; |
| 61 | bool pause_when_in_background; | 61 | bool pause_when_in_background; |
| 62 | bool hide_mouse; | ||
| 62 | 63 | ||
| 63 | bool select_user_on_boot; | 64 | bool select_user_on_boot; |
| 64 | 65 | ||