diff options
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 2 | ||||
m--------- | externals/Vulkan-Headers | 0 | ||||
-rw-r--r-- | src/common/range_map.h | 6 | ||||
-rw-r--r-- | src/core/hle/kernel/k_address_arbiter.cpp | 68 | ||||
-rw-r--r-- | src/core/hle/kernel/k_condition_variable.cpp | 27 | ||||
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 32 | ||||
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 4 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 41 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.h | 1 | ||||
-rw-r--r-- | src/tests/common/range_map.cpp | 20 | ||||
-rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 2 | ||||
-rw-r--r-- | src/video_core/memory_manager.cpp | 34 | ||||
-rw-r--r-- | src/video_core/memory_manager.h | 12 | ||||
-rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 2 | ||||
-rw-r--r-- | src/video_core/vulkan_common/vulkan_wrapper.cpp | 2 |
15 files changed, 153 insertions, 100 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a6c43f401..561eaafb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,7 +222,7 @@ find_package(ZLIB 1.2 REQUIRED) find_package(zstd 1.5 REQUIRED) if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS) - find_package(Vulkan 1.3.238 REQUIRED) + find_package(Vulkan 1.3.246 REQUIRED) endif() if (ENABLE_LIBUSB) diff --git a/externals/Vulkan-Headers b/externals/Vulkan-Headers -Subproject 00671c64ba5c488ade22ad572a0ef81d5e64c80 +Subproject 63af1cf1ee906ba4dcd5a324bdd0201d4f4bfd1 diff --git a/src/common/range_map.h b/src/common/range_map.h index 79c7ef547..ab73993e3 100644 --- a/src/common/range_map.h +++ b/src/common/range_map.h @@ -38,12 +38,12 @@ public: Map(address, address_end, null_value); } - [[nodiscard]] size_t GetContinousSizeFrom(KeyTBase address) const { + [[nodiscard]] size_t GetContinuousSizeFrom(KeyTBase address) const { const KeyT new_address = static_cast<KeyT>(address); if (new_address < 0) { return 0; } - return ContinousSizeInternal(new_address); + return ContinuousSizeInternal(new_address); } [[nodiscard]] ValueT GetValueAt(KeyT address) const { @@ -59,7 +59,7 @@ private: using IteratorType = typename MapType::iterator; using ConstIteratorType = typename MapType::const_iterator; - size_t ContinousSizeInternal(KeyT address) const { + size_t ContinuousSizeInternal(KeyT address) const { const auto it = GetFirstElementBeforeOrOn(address); if (it == container.end() || it->second == null_value) { return 0; diff --git a/src/core/hle/kernel/k_address_arbiter.cpp b/src/core/hle/kernel/k_address_arbiter.cpp index 08c254028..78d43d729 100644 --- a/src/core/hle/kernel/k_address_arbiter.cpp +++ b/src/core/hle/kernel/k_address_arbiter.cpp @@ -35,24 +35,30 @@ bool DecrementIfLessThan(Core::System& system, s32* out, KProcessAddress address // TODO(bunnei): We should call CanAccessAtomic(..) here. - // Load the value from the address. - const s32 current_value = - static_cast<s32>(monitor.ExclusiveRead32(current_core, GetInteger(address))); - - // Compare it to the desired one. - if (current_value < value) { - // If less than, we want to try to decrement. - const s32 decrement_value = current_value - 1; + s32 current_value{}; + + while (true) { + // Load the value from the address. + current_value = + static_cast<s32>(monitor.ExclusiveRead32(current_core, GetInteger(address))); + + // Compare it to the desired one. + if (current_value < value) { + // If less than, we want to try to decrement. + const s32 decrement_value = current_value - 1; + + // Decrement and try to store. + if (monitor.ExclusiveWrite32(current_core, GetInteger(address), + static_cast<u32>(decrement_value))) { + break; + } - // Decrement and try to store. - if (!monitor.ExclusiveWrite32(current_core, GetInteger(address), - static_cast<u32>(decrement_value))) { // If we failed to store, try again. - DecrementIfLessThan(system, out, address, value); + } else { + // Otherwise, clear our exclusive hold and finish + monitor.ClearExclusive(current_core); + break; } - } else { - // Otherwise, clear our exclusive hold and finish - monitor.ClearExclusive(current_core); } // We're done. @@ -70,23 +76,29 @@ bool UpdateIfEqual(Core::System& system, s32* out, KProcessAddress address, s32 // TODO(bunnei): We should call CanAccessAtomic(..) here. - // Load the value from the address. - const s32 current_value = - static_cast<s32>(monitor.ExclusiveRead32(current_core, GetInteger(address))); + s32 current_value{}; - // Compare it to the desired one. - if (current_value == value) { - // If equal, we want to try to write the new value. + // Load the value from the address. + while (true) { + current_value = + static_cast<s32>(monitor.ExclusiveRead32(current_core, GetInteger(address))); + + // Compare it to the desired one. + if (current_value == value) { + // If equal, we want to try to write the new value. + + // Try to store. + if (monitor.ExclusiveWrite32(current_core, GetInteger(address), + static_cast<u32>(new_value))) { + break; + } - // Try to store. - if (!monitor.ExclusiveWrite32(current_core, GetInteger(address), - static_cast<u32>(new_value))) { // If we failed to store, try again. - UpdateIfEqual(system, out, address, value, new_value); + } else { + // Otherwise, clear our exclusive hold and finish. + monitor.ClearExclusive(current_core); + break; } - } else { - // Otherwise, clear our exclusive hold and finish. - monitor.ClearExclusive(current_core); } // We're done. diff --git a/src/core/hle/kernel/k_condition_variable.cpp b/src/core/hle/kernel/k_condition_variable.cpp index 73017cf99..efbac0e6a 100644 --- a/src/core/hle/kernel/k_condition_variable.cpp +++ b/src/core/hle/kernel/k_condition_variable.cpp @@ -33,21 +33,26 @@ bool UpdateLockAtomic(Core::System& system, u32* out, KProcessAddress address, u auto& monitor = system.Monitor(); const auto current_core = system.Kernel().CurrentPhysicalCoreIndex(); - // Load the value from the address. - const auto expected = monitor.ExclusiveRead32(current_core, GetInteger(address)); + u32 expected{}; - // Orr in the new mask. - u32 value = expected | new_orr_mask; + while (true) { + // Load the value from the address. + expected = monitor.ExclusiveRead32(current_core, GetInteger(address)); - // If the value is zero, use the if_zero value, otherwise use the newly orr'd value. - if (!expected) { - value = if_zero; - } + // Orr in the new mask. + u32 value = expected | new_orr_mask; + + // If the value is zero, use the if_zero value, otherwise use the newly orr'd value. + if (!expected) { + value = if_zero; + } + + // Try to store. + if (monitor.ExclusiveWrite32(current_core, GetInteger(address), value)) { + break; + } - // Try to store. - if (!monitor.ExclusiveWrite32(current_core, GetInteger(address), value)) { // If we failed to store, try again. - return UpdateLockAtomic(system, out, address, if_zero, new_orr_mask); } // We're done. diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 21bd7b0c5..b070327ec 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -819,12 +819,12 @@ Controller_NPad::NpadCommunicationMode Controller_NPad::GetNpadCommunicationMode return communication_mode; } -Result Controller_NPad::SetNpadMode(Core::HID::NpadIdType npad_id, - NpadJoyDeviceType npad_device_type, - NpadJoyAssignmentMode assignment_mode) { +bool Controller_NPad::SetNpadMode(Core::HID::NpadIdType& new_npad_id, Core::HID::NpadIdType npad_id, + NpadJoyDeviceType npad_device_type, + NpadJoyAssignmentMode assignment_mode) { if (!IsNpadIdValid(npad_id)) { LOG_ERROR(Service_HID, "Invalid NpadIdType npad_id:{}", npad_id); - return InvalidNpadId; + return false; } auto& controller = GetControllerFromNpadIdType(npad_id); @@ -833,7 +833,7 @@ Result Controller_NPad::SetNpadMode(Core::HID::NpadIdType npad_id, } if (!controller.device->IsConnected()) { - return ResultSuccess; + return false; } if (assignment_mode == NpadJoyAssignmentMode::Dual) { @@ -842,52 +842,52 @@ Result Controller_NPad::SetNpadMode(Core::HID::NpadIdType npad_id, controller.is_dual_left_connected = true; controller.is_dual_right_connected = false; UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_id, true); - return ResultSuccess; + return false; } if (controller.device->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconRight) { DisconnectNpad(npad_id); controller.is_dual_left_connected = false; controller.is_dual_right_connected = true; UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_id, true); - return ResultSuccess; + return false; } - return ResultSuccess; + return false; } // This is for NpadJoyAssignmentMode::Single // Only JoyconDual get affected by this function if (controller.device->GetNpadStyleIndex() != Core::HID::NpadStyleIndex::JoyconDual) { - return ResultSuccess; + return false; } if (controller.is_dual_left_connected && !controller.is_dual_right_connected) { DisconnectNpad(npad_id); UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconLeft, npad_id, true); - return ResultSuccess; + return false; } if (!controller.is_dual_left_connected && controller.is_dual_right_connected) { DisconnectNpad(npad_id); UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconRight, npad_id, true); - return ResultSuccess; + return false; } // We have two controllers connected to the same npad_id we need to split them - const auto npad_id_2 = hid_core.GetFirstDisconnectedNpadId(); - auto& controller_2 = GetControllerFromNpadIdType(npad_id_2); + new_npad_id = hid_core.GetFirstDisconnectedNpadId(); + auto& controller_2 = GetControllerFromNpadIdType(new_npad_id); DisconnectNpad(npad_id); if (npad_device_type == NpadJoyDeviceType::Left) { UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconLeft, npad_id, true); controller_2.is_dual_left_connected = false; controller_2.is_dual_right_connected = true; - UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_id_2, true); + UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, new_npad_id, true); } else { UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconRight, npad_id, true); controller_2.is_dual_left_connected = true; controller_2.is_dual_right_connected = false; - UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_id_2, true); + UpdateControllerAt(Core::HID::NpadStyleIndex::JoyconDual, new_npad_id, true); } - return ResultSuccess; + return true; } bool Controller_NPad::VibrateControllerAtIndex(Core::HID::NpadIdType npad_id, diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index a5998c453..9cfe298f1 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -102,8 +102,8 @@ public: void SetNpadCommunicationMode(NpadCommunicationMode communication_mode_); NpadCommunicationMode GetNpadCommunicationMode() const; - Result SetNpadMode(Core::HID::NpadIdType npad_id, NpadJoyDeviceType npad_device_type, - NpadJoyAssignmentMode assignment_mode); + bool SetNpadMode(Core::HID::NpadIdType& new_npad_id, Core::HID::NpadIdType npad_id, + NpadJoyDeviceType npad_device_type, NpadJoyAssignmentMode assignment_mode); bool VibrateControllerAtIndex(Core::HID::NpadIdType npad_id, std::size_t device_index, const Core::HID::VibrationValue& vibration_value); diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 4529ad643..87e7b864a 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -302,7 +302,7 @@ Hid::Hid(Core::System& system_) {130, &Hid::SwapNpadAssignment, "SwapNpadAssignment"}, {131, &Hid::IsUnintendedHomeButtonInputProtectionEnabled, "IsUnintendedHomeButtonInputProtectionEnabled"}, {132, &Hid::EnableUnintendedHomeButtonInputProtection, "EnableUnintendedHomeButtonInputProtection"}, - {133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"}, + {133, &Hid::SetNpadJoyAssignmentModeSingleWithDestination, "SetNpadJoyAssignmentModeSingleWithDestination"}, {134, &Hid::SetNpadAnalogStickUseCenterClamp, "SetNpadAnalogStickUseCenterClamp"}, {135, &Hid::SetNpadCaptureButtonAssignment, "SetNpadCaptureButtonAssignment"}, {136, &Hid::ClearNpadCaptureButtonAssignment, "ClearNpadCaptureButtonAssignment"}, @@ -1180,8 +1180,10 @@ void Hid::SetNpadJoyAssignmentModeSingleByDefault(HLERequestContext& ctx) { const auto parameters{rp.PopRaw<Parameters>()}; + Core::HID::NpadIdType new_npad_id{}; auto& controller = GetAppletResource()->GetController<Controller_NPad>(HidController::NPad); - controller.SetNpadMode(parameters.npad_id, Controller_NPad::NpadJoyDeviceType::Left, + controller.SetNpadMode(new_npad_id, parameters.npad_id, + Controller_NPad::NpadJoyDeviceType::Left, Controller_NPad::NpadJoyAssignmentMode::Single); LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id, @@ -1203,8 +1205,9 @@ void Hid::SetNpadJoyAssignmentModeSingle(HLERequestContext& ctx) { const auto parameters{rp.PopRaw<Parameters>()}; + Core::HID::NpadIdType new_npad_id{}; auto& controller = GetAppletResource()->GetController<Controller_NPad>(HidController::NPad); - controller.SetNpadMode(parameters.npad_id, parameters.npad_joy_device_type, + controller.SetNpadMode(new_npad_id, parameters.npad_id, parameters.npad_joy_device_type, Controller_NPad::NpadJoyAssignmentMode::Single); LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}", @@ -1226,8 +1229,10 @@ void Hid::SetNpadJoyAssignmentModeDual(HLERequestContext& ctx) { const auto parameters{rp.PopRaw<Parameters>()}; + Core::HID::NpadIdType new_npad_id{}; auto& controller = GetAppletResource()->GetController<Controller_NPad>(HidController::NPad); - controller.SetNpadMode(parameters.npad_id, {}, Controller_NPad::NpadJoyAssignmentMode::Dual); + controller.SetNpadMode(new_npad_id, parameters.npad_id, {}, + Controller_NPad::NpadJoyAssignmentMode::Dual); LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id, parameters.applet_resource_user_id); @@ -1369,6 +1374,34 @@ void Hid::EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx) { rb.Push(result); } +void Hid::SetNpadJoyAssignmentModeSingleWithDestination(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + struct Parameters { + Core::HID::NpadIdType npad_id; + INSERT_PADDING_WORDS_NOINIT(1); + u64 applet_resource_user_id; + Controller_NPad::NpadJoyDeviceType npad_joy_device_type; + }; + static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); + + const auto parameters{rp.PopRaw<Parameters>()}; + + Core::HID::NpadIdType new_npad_id{}; + auto& controller = GetAppletResource()->GetController<Controller_NPad>(HidController::NPad); + const auto is_reassigned = + controller.SetNpadMode(new_npad_id, parameters.npad_id, parameters.npad_joy_device_type, + Controller_NPad::NpadJoyAssignmentMode::Single); + + LOG_INFO(Service_HID, "called, npad_id={}, applet_resource_user_id={}, npad_joy_device_type={}", + parameters.npad_id, parameters.applet_resource_user_id, + parameters.npad_joy_device_type); + + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(ResultSuccess); + rb.Push(is_reassigned); + rb.PushEnum(new_npad_id); +} + void Hid::SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; struct Parameters { diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index c69e5f3fb..f247b83c2 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -151,6 +151,7 @@ private: void SwapNpadAssignment(HLERequestContext& ctx); void IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx); void EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx); + void SetNpadJoyAssignmentModeSingleWithDestination(HLERequestContext& ctx); void SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx); void SetNpadCaptureButtonAssignment(HLERequestContext& ctx); void ClearNpadCaptureButtonAssignment(HLERequestContext& ctx); diff --git a/src/tests/common/range_map.cpp b/src/tests/common/range_map.cpp index d301ac5f6..faaefd49f 100644 --- a/src/tests/common/range_map.cpp +++ b/src/tests/common/range_map.cpp @@ -21,9 +21,9 @@ TEST_CASE("Range Map: Setup", "[video_core]") { my_map.Map(4000, 4500, MappedEnum::Valid_2); my_map.Map(4200, 4400, MappedEnum::Valid_2); my_map.Map(4200, 4400, MappedEnum::Valid_1); - REQUIRE(my_map.GetContinousSizeFrom(4200) == 200); - REQUIRE(my_map.GetContinousSizeFrom(3000) == 200); - REQUIRE(my_map.GetContinousSizeFrom(2900) == 0); + REQUIRE(my_map.GetContinuousSizeFrom(4200) == 200); + REQUIRE(my_map.GetContinuousSizeFrom(3000) == 200); + REQUIRE(my_map.GetContinuousSizeFrom(2900) == 0); REQUIRE(my_map.GetValueAt(2900) == MappedEnum::Invalid); REQUIRE(my_map.GetValueAt(3100) == MappedEnum::Valid_1); @@ -38,20 +38,20 @@ TEST_CASE("Range Map: Setup", "[video_core]") { my_map.Unmap(0, 6000); for (u64 address = 0; address < 10000; address += 1000) { - REQUIRE(my_map.GetContinousSizeFrom(address) == 0); + REQUIRE(my_map.GetContinuousSizeFrom(address) == 0); } my_map.Map(1000, 3000, MappedEnum::Valid_1); my_map.Map(4000, 5000, MappedEnum::Valid_1); my_map.Map(2500, 4100, MappedEnum::Valid_1); - REQUIRE(my_map.GetContinousSizeFrom(1000) == 4000); + REQUIRE(my_map.GetContinuousSizeFrom(1000) == 4000); my_map.Map(1000, 3000, MappedEnum::Valid_1); my_map.Map(4000, 5000, MappedEnum::Valid_2); my_map.Map(2500, 4100, MappedEnum::Valid_3); - REQUIRE(my_map.GetContinousSizeFrom(1000) == 1500); - REQUIRE(my_map.GetContinousSizeFrom(2500) == 1600); - REQUIRE(my_map.GetContinousSizeFrom(4100) == 900); + REQUIRE(my_map.GetContinuousSizeFrom(1000) == 1500); + REQUIRE(my_map.GetContinuousSizeFrom(2500) == 1600); + REQUIRE(my_map.GetContinuousSizeFrom(4100) == 900); REQUIRE(my_map.GetValueAt(900) == MappedEnum::Invalid); REQUIRE(my_map.GetValueAt(1000) == MappedEnum::Valid_1); REQUIRE(my_map.GetValueAt(2500) == MappedEnum::Valid_3); @@ -59,8 +59,8 @@ TEST_CASE("Range Map: Setup", "[video_core]") { REQUIRE(my_map.GetValueAt(5000) == MappedEnum::Invalid); my_map.Map(2000, 6000, MappedEnum::Valid_3); - REQUIRE(my_map.GetContinousSizeFrom(1000) == 1000); - REQUIRE(my_map.GetContinousSizeFrom(3000) == 3000); + REQUIRE(my_map.GetContinuousSizeFrom(1000) == 1000); + REQUIRE(my_map.GetContinuousSizeFrom(3000) == 3000); REQUIRE(my_map.GetValueAt(1000) == MappedEnum::Valid_1); REQUIRE(my_map.GetValueAt(1999) == MappedEnum::Valid_1); REQUIRE(my_map.GetValueAt(1500) == MappedEnum::Valid_1); diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 1f656ffa8..abdc593df 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -1442,7 +1442,7 @@ void BufferCache<P>::UpdateVertexBuffer(u32 index) { } if (!gpu_memory->IsWithinGPUAddressRange(gpu_addr_end)) { address_size = - static_cast<u32>(gpu_memory->MaxContinousRange(gpu_addr_begin, address_size)); + static_cast<u32>(gpu_memory->MaxContinuousRange(gpu_addr_begin, address_size)); } const u32 size = address_size; // TODO: Analyze stride and number of vertices vertex_buffers[index] = Binding{ diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index 015a7d3c1..01fb5b546 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -43,7 +43,7 @@ MemoryManager::MemoryManager(Core::System& system_, u64 address_space_bits_, u64 big_entries.resize(big_page_table_size / 32, 0); big_page_table_cpu.resize(big_page_table_size); - big_page_continous.resize(big_page_table_size / continous_bits, 0); + big_page_continuous.resize(big_page_table_size / continuous_bits, 0); entries.resize(page_table_size / 32, 0); } @@ -85,17 +85,17 @@ PTEKind MemoryManager::GetPageKind(GPUVAddr gpu_addr) const { return kind_map.GetValueAt(gpu_addr); } -inline bool MemoryManager::IsBigPageContinous(size_t big_page_index) const { - const u64 entry_mask = big_page_continous[big_page_index / continous_bits]; - const size_t sub_index = big_page_index % continous_bits; +inline bool MemoryManager::IsBigPageContinuous(size_t big_page_index) const { + const u64 entry_mask = big_page_continuous[big_page_index / continuous_bits]; + const size_t sub_index = big_page_index % continuous_bits; return ((entry_mask >> sub_index) & 0x1ULL) != 0; } -inline void MemoryManager::SetBigPageContinous(size_t big_page_index, bool value) { - const u64 continous_mask = big_page_continous[big_page_index / continous_bits]; - const size_t sub_index = big_page_index % continous_bits; - big_page_continous[big_page_index / continous_bits] = - (~(1ULL << sub_index) & continous_mask) | (value ? 1ULL << sub_index : 0); +inline void MemoryManager::SetBigPageContinuous(size_t big_page_index, bool value) { + const u64 continuous_mask = big_page_continuous[big_page_index / continuous_bits]; + const size_t sub_index = big_page_index % continuous_bits; + big_page_continuous[big_page_index / continuous_bits] = + (~(1ULL << sub_index) & continuous_mask) | (value ? 1ULL << sub_index : 0); } template <MemoryManager::EntryType entry_type> @@ -140,7 +140,7 @@ GPUVAddr MemoryManager::BigPageTableOp(GPUVAddr gpu_addr, [[maybe_unused]] VAddr const auto index = PageEntryIndex<true>(current_gpu_addr); const u32 sub_value = static_cast<u32>(current_cpu_addr >> cpu_page_bits); big_page_table_cpu[index] = sub_value; - const bool is_continous = ([&] { + const bool is_continuous = ([&] { uintptr_t base_ptr{ reinterpret_cast<uintptr_t>(memory.GetPointerSilent(current_cpu_addr))}; if (base_ptr == 0) { @@ -156,7 +156,7 @@ GPUVAddr MemoryManager::BigPageTableOp(GPUVAddr gpu_addr, [[maybe_unused]] VAddr } return true; })(); - SetBigPageContinous(index, is_continous); + SetBigPageContinuous(index, is_continuous); } remaining_size -= big_page_size; } @@ -378,7 +378,7 @@ void MemoryManager::ReadBlockImpl(GPUVAddr gpu_src_addr, void* dest_buffer, std: if constexpr (is_safe) { rasterizer->FlushRegion(cpu_addr_base, copy_amount, which); } - if (!IsBigPageContinous(page_index)) [[unlikely]] { + if (!IsBigPageContinuous(page_index)) [[unlikely]] { memory.ReadBlockUnsafe(cpu_addr_base, dest_buffer, copy_amount); } else { u8* physical = memory.GetPointer(cpu_addr_base); @@ -427,7 +427,7 @@ void MemoryManager::WriteBlockImpl(GPUVAddr gpu_dest_addr, const void* src_buffe if constexpr (is_safe) { rasterizer->InvalidateRegion(cpu_addr_base, copy_amount, which); } - if (!IsBigPageContinous(page_index)) [[unlikely]] { + if (!IsBigPageContinuous(page_index)) [[unlikely]] { memory.WriteBlockUnsafe(cpu_addr_base, src_buffer, copy_amount); } else { u8* physical = memory.GetPointer(cpu_addr_base); @@ -512,7 +512,7 @@ bool MemoryManager::IsMemoryDirty(GPUVAddr gpu_addr, size_t size, return result; } -size_t MemoryManager::MaxContinousRange(GPUVAddr gpu_addr, size_t size) const { +size_t MemoryManager::MaxContinuousRange(GPUVAddr gpu_addr, size_t size) const { std::optional<VAddr> old_page_addr{}; size_t range_so_far = 0; bool result{false}; @@ -553,7 +553,7 @@ size_t MemoryManager::MaxContinousRange(GPUVAddr gpu_addr, size_t size) const { } size_t MemoryManager::GetMemoryLayoutSize(GPUVAddr gpu_addr, size_t max_size) const { - return kind_map.GetContinousSizeFrom(gpu_addr); + return kind_map.GetContinuousSizeFrom(gpu_addr); } void MemoryManager::InvalidateRegion(GPUVAddr gpu_addr, size_t size, @@ -594,7 +594,7 @@ void MemoryManager::CopyBlock(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_addr, std bool MemoryManager::IsGranularRange(GPUVAddr gpu_addr, std::size_t size) const { if (GetEntry<true>(gpu_addr) == EntryType::Mapped) [[likely]] { size_t page_index = gpu_addr >> big_page_bits; - if (IsBigPageContinous(page_index)) [[likely]] { + if (IsBigPageContinuous(page_index)) [[likely]] { const std::size_t page{(page_index & big_page_mask) + size}; return page <= big_page_size; } @@ -608,7 +608,7 @@ bool MemoryManager::IsGranularRange(GPUVAddr gpu_addr, std::size_t size) const { return page <= Core::Memory::YUZU_PAGESIZE; } -bool MemoryManager::IsContinousRange(GPUVAddr gpu_addr, std::size_t size) const { +bool MemoryManager::IsContinuousRange(GPUVAddr gpu_addr, std::size_t size) const { std::optional<VAddr> old_page_addr{}; bool result{true}; auto fail = [&]([[maybe_unused]] std::size_t page_index, [[maybe_unused]] std::size_t offset, diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index 51ae2de68..fbbe856c4 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h @@ -94,7 +94,7 @@ public: /** * Checks if a gpu region is mapped by a single range of cpu addresses. */ - [[nodiscard]] bool IsContinousRange(GPUVAddr gpu_addr, std::size_t size) const; + [[nodiscard]] bool IsContinuousRange(GPUVAddr gpu_addr, std::size_t size) const; /** * Checks if a gpu region is mapped entirely. @@ -123,7 +123,7 @@ public: bool IsMemoryDirty(GPUVAddr gpu_addr, size_t size, VideoCommon::CacheType which = VideoCommon::CacheType::All) const; - size_t MaxContinousRange(GPUVAddr gpu_addr, size_t size) const; + size_t MaxContinuousRange(GPUVAddr gpu_addr, size_t size) const; bool IsWithinGPUAddressRange(GPUVAddr gpu_addr) const { return gpu_addr < address_space_size; @@ -158,8 +158,8 @@ private: } } - inline bool IsBigPageContinous(size_t big_page_index) const; - inline void SetBigPageContinous(size_t big_page_index, bool value); + inline bool IsBigPageContinuous(size_t big_page_index) const; + inline void SetBigPageContinuous(size_t big_page_index, bool value); template <bool is_gpu_address> void GetSubmappedRangeImpl( @@ -213,10 +213,10 @@ private: Common::RangeMap<GPUVAddr, PTEKind> kind_map; Common::VirtualBuffer<u32> big_page_table_cpu; - std::vector<u64> big_page_continous; + std::vector<u64> big_page_continuous; std::vector<std::pair<VAddr, std::size_t>> page_stash{}; - static constexpr size_t continous_bits = 64; + static constexpr size_t continuous_bits = 64; const size_t unique_identifier; std::unique_ptr<VideoCommon::InvalidationAccumulator> accumulator; diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 858449af8..63821d496 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -1269,7 +1269,7 @@ ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, VA const ImageId new_image_id = slot_images.insert(runtime, new_info, gpu_addr, cpu_addr); Image& new_image = slot_images[new_image_id]; - if (!gpu_memory->IsContinousRange(new_image.gpu_addr, new_image.guest_size_bytes)) { + if (!gpu_memory->IsContinuousRange(new_image.gpu_addr, new_image.guest_size_bytes)) { new_image.flags |= ImageFlagBits::Sparse; } diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index 486d4dfaf..336f53700 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp @@ -375,6 +375,8 @@ const char* ToString(VkResult result) noexcept { return "VK_RESULT_MAX_ENUM"; case VkResult::VK_ERROR_COMPRESSION_EXHAUSTED_EXT: return "VK_ERROR_COMPRESSION_EXHAUSTED_EXT"; + case VkResult::VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT: + return "VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT"; } return "Unknown"; } |