From 1d866e0d6142b65e0c216e84e95bfbf9751a6a86 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sun, 5 Mar 2023 17:19:00 +0100 Subject: [PATCH] early-access version 3437 --- README.md | 2 +- src/common/steady_clock.h | 2 ++ src/common/wall_clock.cpp | 5 ++--- src/common/windows/timer_resolution.h | 2 ++ .../renderer_vulkan/vk_rasterizer.cpp | 8 +++++++- src/video_core/texture_cache/image_info.cpp | 6 ++---- src/video_core/texture_cache/util.cpp | 19 +++++++------------ 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9ac11a9a9..746fef605 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3436. +This is the source code for early-access 3437. ## Legal Notice diff --git a/src/common/steady_clock.h b/src/common/steady_clock.h index 2cd7a6cee..9497cf865 100755 --- a/src/common/steady_clock.h +++ b/src/common/steady_clock.h @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + #include #include "common/common_types.h" diff --git a/src/common/wall_clock.cpp b/src/common/wall_clock.cpp index 6371635bf..2d906e900 100755 --- a/src/common/wall_clock.cpp +++ b/src/common/wall_clock.cpp @@ -15,9 +15,8 @@ namespace Common { class StandardWallClock final : public WallClock { public: explicit StandardWallClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequency_) - : WallClock{emulated_cpu_frequency_, emulated_clock_frequency_, false} { - start_time = SteadyClock::Now(); - } + : WallClock{emulated_cpu_frequency_, emulated_clock_frequency_, false}, + start_time{SteadyClock::Now()} {} std::chrono::nanoseconds GetTimeNS() override { return SteadyClock::Now() - start_time; diff --git a/src/common/windows/timer_resolution.h b/src/common/windows/timer_resolution.h index 894f7a059..e1e50a62d 100755 --- a/src/common/windows/timer_resolution.h +++ b/src/common/windows/timer_resolution.h @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + #include namespace Common::Windows { diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 5f61d0c33..e04658d41 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -787,7 +787,7 @@ bool AccelerateDMA::ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info, const bool is_rescaled = image->IsRescaled(); if (is_rescaled) { - image->ScaleDown(true); + image->ScaleDown(); } VkImageSubresourceLayers subresources{ .aspectMask = image->AspectMask(), @@ -879,6 +879,9 @@ bool AccelerateDMA::ImageToBuffer(const Tegra::DMA::ImageCopy& copy_info, cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, WRITE_BARRIER, nullptr, post_barriers); }); + if (is_rescaled) { + image->ScaleUp(true); + } return true; } @@ -989,6 +992,9 @@ bool AccelerateDMA::BufferToImage(const Tegra::DMA::ImageCopy& copy_info, cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, nullptr, nullptr, post_barriers); }); + if (is_rescaled) { + image->ScaleUp(); + } return true; } diff --git a/src/video_core/texture_cache/image_info.cpp b/src/video_core/texture_cache/image_info.cpp index cb4876489..9804a7f9a 100755 --- a/src/video_core/texture_cache/image_info.cpp +++ b/src/video_core/texture_cache/image_info.cpp @@ -216,8 +216,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept { .height = config.height, .depth = 1, }; - rescaleable = block.depth == 0; - rescaleable &= size.height > 256; + rescaleable = block.depth == 0 && size.height > 256; downscaleable = size.height > 512; } } @@ -260,8 +259,7 @@ ImageInfo::ImageInfo(const Tegra::DMA::ImageOperand& config) noexcept { resources.layers = 1; layer_stride = CalculateLayerStride(*this); maybe_unaligned_layer_stride = CalculateLayerSize(*this); - rescaleable = block.depth == 0; - rescaleable &= size.height > 256; + rescaleable = block.depth == 0 && size.height > 256; downscaleable = size.height > 512; } diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index df344d235..bba5f8228 100755 --- a/src/video_core/texture_cache/util.cpp +++ b/src/video_core/texture_cache/util.cpp @@ -1125,10 +1125,9 @@ std::optional FindSubresource(const ImageInfo& candidate, const // Format checking is relaxed, but we still have to check for matching bytes per block. // This avoids creating a view for blits on UE4 titles where formats with different bytes // per block are aliased. - if (BytesPerBlock(existing.format) != BytesPerBlock(candidate.format)) { - if (False(options & RelaxedOptions::FormatBpp)) { - return std::nullopt; - } + if (BytesPerBlock(existing.format) != BytesPerBlock(candidate.format) && + False(options & RelaxedOptions::FormatBpp)) { + return std::nullopt; } } else { // Format comaptibility is not relaxed, ensure we are creating a view on a compatible format @@ -1142,10 +1141,8 @@ std::optional FindSubresource(const ImageInfo& candidate, const if (existing.type != candidate.type) { return std::nullopt; } - if (False(options & RelaxedOptions::Samples)) { - if (existing.num_samples != candidate.num_samples) { - return std::nullopt; - } + if (False(options & RelaxedOptions::Samples) && existing.num_samples != candidate.num_samples) { + return std::nullopt; } if (existing.resources.levels < candidate.resources.levels + base->level) { return std::nullopt; @@ -1155,10 +1152,8 @@ std::optional FindSubresource(const ImageInfo& candidate, const if (mip_depth < candidate.size.depth + base->layer) { return std::nullopt; } - } else { - if (existing.resources.layers < candidate.resources.layers + base->layer) { - return std::nullopt; - } + } else if (existing.resources.layers < candidate.resources.layers + base->layer) { + return std::nullopt; } const bool strict_size = False(options & RelaxedOptions::Size); if (!IsBlockLinearSizeCompatible(existing, candidate, base->level, 0, strict_size)) {