From 6b3816398b113a58dd8ee72881de4b65a1e9c583 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Tue, 13 Jul 2021 23:22:25 +0200 Subject: [PATCH] early-access version 1875 --- README.md | 2 +- src/core/hle/service/hid/controllers/npad.cpp | 5 +++++ src/video_core/buffer_cache/buffer_cache.h | 22 ++++++++++++------- .../renderer_vulkan/vk_rasterizer.cpp | 6 +++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2d1ed838a..f9420928b 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1874. +This is the source code for early-access 1875. ## Legal Notice diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 9e7aa086b..b7f551e40 100755 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -942,6 +942,11 @@ void Controller_NPad::InitializeVibrationDevice(const DeviceHandle& vibration_de void Controller_NPad::InitializeVibrationDeviceAtIndex(std::size_t npad_index, std::size_t device_index) { + if (!Settings::values.vibration_enabled.GetValue()) { + vibration_devices_mounted[npad_index][device_index] = false; + return; + } + if (vibrations[npad_index][device_index]) { vibration_devices_mounted[npad_index][device_index] = vibrations[npad_index][device_index]->GetStatus() == 1; diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 79c0bea0e..3f86edb5e 100755 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -363,6 +363,8 @@ private: [[nodiscard]] bool HasFastUniformBufferBound(size_t stage, u32 binding_index) const noexcept; + void ClearDownload(IntervalType subtract_interval); + VideoCore::RasterizerInterface& rasterizer; Tegra::Engines::Maxwell3D& maxwell3d; Tegra::Engines::KeplerCompute& kepler_compute; @@ -514,6 +516,14 @@ void BufferCache

::DownloadMemory(VAddr cpu_addr, u64 size) { }); } +template +void BufferCache

::ClearDownload(IntervalType subtract_interval) { + uncommitted_ranges.subtract(subtract_interval); + for (auto& interval_set : committed_ranges) { + interval_set.subtract(subtract_interval); + } +} + template bool BufferCache

::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) { const std::optional cpu_src_address = gpu_memory.GpuToCpuAddress(src_address); @@ -528,10 +538,7 @@ bool BufferCache

::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am } const IntervalType subtract_interval{*cpu_dest_address, *cpu_dest_address + amount}; - uncommitted_ranges.subtract(subtract_interval); - for (auto& interval_set : committed_ranges) { - interval_set.subtract(subtract_interval); - } + ClearDownload(subtract_interval); BufferId buffer_a; BufferId buffer_b; @@ -588,10 +595,7 @@ bool BufferCache

::DMAClear(GPUVAddr dst_address, u64 amount, u32 value) { } const IntervalType subtract_interval{*cpu_dst_address, *cpu_dst_address + amount * sizeof(u32)}; - uncommitted_ranges.subtract(subtract_interval); - for (auto& interval_set : committed_ranges) { - interval_set.subtract(subtract_interval); - } + ClearDownload(subtract_interval); common_ranges.subtract(subtract_interval); const size_t size = amount * sizeof(u32); @@ -604,6 +608,7 @@ bool BufferCache

::DMAClear(GPUVAddr dst_address, u64 amount, u32 value) { auto& dest_buffer = slot_buffers[buffer]; const u32 offset = static_cast(*cpu_dst_address - dest_buffer.CpuAddr()); runtime.ClearBuffer(dest_buffer, offset, size, value); + dest_buffer.UnmarkRegionAsCpuModified(*cpu_dst_address, size); return true; } @@ -1667,6 +1672,7 @@ void BufferCache

::DownloadBufferMemory(Buffer& buffer, VAddr cpu_addr, u64 si const VAddr end_address = start_address + range_size; ForEachWrittenRange(start_address, range_size, add_download); const IntervalType subtract_interval{start_address, end_address}; + ClearDownload(subtract_interval); common_ranges.subtract(subtract_interval); }); if (total_size_bytes == 0) { diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 8ca5fca61..609f5c576 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -222,11 +222,13 @@ void RasterizerVulkan::Clear() { .height = std::min(clear_rect.rect.extent.height, render_area.height), }; - if (use_color) { + const u32 color_attachment = regs.clear_buffers.RT; + const auto attachment_aspect_mask = framebuffer->ImageRanges()[color_attachment].aspectMask; + const bool is_color_rt = (attachment_aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) != 0; + if (use_color && is_color_rt) { VkClearValue clear_value; std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color)); - const u32 color_attachment = regs.clear_buffers.RT; scheduler.Record([color_attachment, clear_value, clear_rect](vk::CommandBuffer cmdbuf) { const VkClearAttachment attachment{ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,