diff options
| author | 2024-01-26 22:27:34 -0500 | |
|---|---|---|
| committer | 2024-01-31 11:27:20 -0500 | |
| commit | 453091f61100effba637950dc840da41d95be477 (patch) | |
| tree | 0e1d46a7c5a354769d04b9bde090b5a9b1f02eb7 /src/video_core/renderer_vulkan | |
| parent | video_core: simplify accelerated surface fetch and crop handling between APIs (diff) | |
| download | yuzu-453091f61100effba637950dc840da41d95be477.tar.gz yuzu-453091f61100effba637950dc840da41d95be477.tar.xz yuzu-453091f61100effba637950dc840da41d95be477.zip | |
video_core: consistently account for resolution scaling when rendering
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index c21a9c8fe..24781860b 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp | |||
| @@ -152,6 +152,8 @@ void BlitScreen::Draw(RasterizerVulkan& rasterizer, const Tegra::FramebufferConf | |||
| 152 | framebuffer, framebuffer.address + framebuffer.offset, framebuffer.stride); | 152 | framebuffer, framebuffer.address + framebuffer.offset, framebuffer.stride); |
| 153 | const u32 texture_width = texture_info ? texture_info->width : framebuffer.width; | 153 | const u32 texture_width = texture_info ? texture_info->width : framebuffer.width; |
| 154 | const u32 texture_height = texture_info ? texture_info->height : framebuffer.height; | 154 | const u32 texture_height = texture_info ? texture_info->height : framebuffer.height; |
| 155 | const u32 scaled_width = texture_info ? texture_info->scaled_width : texture_width; | ||
| 156 | const u32 scaled_height = texture_info ? texture_info->scaled_height : texture_height; | ||
| 155 | const bool use_accelerated = texture_info.has_value(); | 157 | const bool use_accelerated = texture_info.has_value(); |
| 156 | 158 | ||
| 157 | RefreshResources(framebuffer); | 159 | RefreshResources(framebuffer); |
| @@ -363,8 +365,8 @@ void BlitScreen::Draw(RasterizerVulkan& rasterizer, const Tegra::FramebufferConf | |||
| 363 | if (fsr) { | 365 | if (fsr) { |
| 364 | const auto crop_rect = Tegra::NormalizeCrop(framebuffer, texture_width, texture_height); | 366 | const auto crop_rect = Tegra::NormalizeCrop(framebuffer, texture_width, texture_height); |
| 365 | const VkExtent2D fsr_input_size{ | 367 | const VkExtent2D fsr_input_size{ |
| 366 | .width = Settings::values.resolution_info.ScaleUp(texture_width), | 368 | .width = scaled_width, |
| 367 | .height = Settings::values.resolution_info.ScaleUp(texture_height), | 369 | .height = scaled_height, |
| 368 | }; | 370 | }; |
| 369 | VkImageView fsr_image_view = | 371 | VkImageView fsr_image_view = |
| 370 | fsr->Draw(scheduler, image_index, source_image_view, fsr_input_size, crop_rect); | 372 | fsr->Draw(scheduler, image_index, source_image_view, fsr_input_size, crop_rect); |
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.h b/src/video_core/renderer_vulkan/vk_blit_screen.h index 40338886a..56ac47f08 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.h +++ b/src/video_core/renderer_vulkan/vk_blit_screen.h | |||
| @@ -47,6 +47,8 @@ struct FramebufferTextureInfo { | |||
| 47 | VkImageView image_view{}; | 47 | VkImageView image_view{}; |
| 48 | u32 width{}; | 48 | u32 width{}; |
| 49 | u32 height{}; | 49 | u32 height{}; |
| 50 | u32 scaled_width{}; | ||
| 51 | u32 scaled_height{}; | ||
| 50 | }; | 52 | }; |
| 51 | 53 | ||
| 52 | class BlitScreen { | 54 | class BlitScreen { |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index e593d7225..aa0a027bb 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -788,18 +788,22 @@ std::optional<FramebufferTextureInfo> RasterizerVulkan::AccelerateDisplay( | |||
| 788 | return {}; | 788 | return {}; |
| 789 | } | 789 | } |
| 790 | std::scoped_lock lock{texture_cache.mutex}; | 790 | std::scoped_lock lock{texture_cache.mutex}; |
| 791 | ImageView* const image_view = | 791 | const auto [image_view, scaled] = |
| 792 | texture_cache.TryFindFramebufferImageView(config, framebuffer_addr); | 792 | texture_cache.TryFindFramebufferImageView(config, framebuffer_addr); |
| 793 | if (!image_view) { | 793 | if (!image_view) { |
| 794 | return {}; | 794 | return {}; |
| 795 | } | 795 | } |
| 796 | query_cache.NotifySegment(false); | 796 | query_cache.NotifySegment(false); |
| 797 | 797 | ||
| 798 | const auto& resolution = Settings::values.resolution_info; | ||
| 799 | |||
| 798 | FramebufferTextureInfo info{}; | 800 | FramebufferTextureInfo info{}; |
| 799 | info.image = image_view->ImageHandle(); | 801 | info.image = image_view->ImageHandle(); |
| 800 | info.image_view = image_view->Handle(Shader::TextureType::Color2D); | 802 | info.image_view = image_view->Handle(Shader::TextureType::Color2D); |
| 801 | info.width = image_view->size.width; | 803 | info.width = image_view->size.width; |
| 802 | info.height = image_view->size.height; | 804 | info.height = image_view->size.height; |
| 805 | info.scaled_width = scaled ? resolution.ScaleUp(info.width) : info.width; | ||
| 806 | info.scaled_height = scaled ? resolution.ScaleUp(info.height) : info.height; | ||
| 803 | return info; | 807 | return info; |
| 804 | } | 808 | } |
| 805 | 809 | ||