diff options
author | german77 <juangerman-13@hotmail.com> | 2022-06-26 06:50:04 +0200 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2022-06-27 03:21:45 +0200 |
commit | b5d6194f6d23e4e715c9d6b555000c1fc4a7b419 (patch) | |
tree | c3588d170b2abd014af818c4381f2d5bd33a213b /src/video_core | |
parent | video_core: Replace VKQueryCache with QueryCache (diff) | |
download | yuzu-b5d6194f6d23e4e715c9d6b555000c1fc4a7b419.tar yuzu-b5d6194f6d23e4e715c9d6b555000c1fc4a7b419.tar.gz yuzu-b5d6194f6d23e4e715c9d6b555000c1fc4a7b419.tar.bz2 yuzu-b5d6194f6d23e4e715c9d6b555000c1fc4a7b419.tar.lz yuzu-b5d6194f6d23e4e715c9d6b555000c1fc4a7b419.tar.xz yuzu-b5d6194f6d23e4e715c9d6b555000c1fc4a7b419.tar.zst yuzu-b5d6194f6d23e4e715c9d6b555000c1fc4a7b419.zip |
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/renderer_vulkan/renderer_vulkan.h | 2 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.cpp | 3 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.h | 9 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_swapchain.cpp | 26 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_swapchain.h | 8 |
5 files changed, 23 insertions, 25 deletions
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.h b/src/video_core/renderer_vulkan/renderer_vulkan.h index bd254c45e..e7bfecb20 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.h +++ b/src/video_core/renderer_vulkan/renderer_vulkan.h @@ -71,7 +71,7 @@ private: MemoryAllocator memory_allocator; StateTracker state_tracker; Scheduler scheduler; - VKSwapchain swapchain; + Swapchain swapchain; BlitScreen blit_screen; RasterizerVulkan rasterizer; }; diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index ea0b15b78..1ec8392e1 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp @@ -120,8 +120,7 @@ struct BlitScreen::BufferData { BlitScreen::BlitScreen(Core::Memory::Memory& cpu_memory_, Core::Frontend::EmuWindow& render_window_, const Device& device_, MemoryAllocator& memory_allocator_, - VKSwapchain& swapchain_, Scheduler& scheduler_, - const ScreenInfo& screen_info_) + Swapchain& swapchain_, Scheduler& scheduler_, const ScreenInfo& screen_info_) : cpu_memory{cpu_memory_}, render_window{render_window_}, device{device_}, memory_allocator{memory_allocator_}, swapchain{swapchain_}, scheduler{scheduler_}, image_count{swapchain.GetImageCount()}, screen_info{screen_info_} { diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.h b/src/video_core/renderer_vulkan/vk_blit_screen.h index 322af27e1..b8c67bef0 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.h +++ b/src/video_core/renderer_vulkan/vk_blit_screen.h @@ -36,7 +36,7 @@ class Device; class FSR; class RasterizerVulkan; class Scheduler; -class VKSwapchain; +class Swapchain; struct ScreenInfo { VkImageView image_view{}; @@ -48,9 +48,8 @@ struct ScreenInfo { class BlitScreen { public: explicit BlitScreen(Core::Memory::Memory& cpu_memory, Core::Frontend::EmuWindow& render_window, - const Device& device, MemoryAllocator& memory_manager, - VKSwapchain& swapchain, Scheduler& scheduler, - const ScreenInfo& screen_info); + const Device& device, MemoryAllocator& memory_manager, Swapchain& swapchain, + Scheduler& scheduler, const ScreenInfo& screen_info); ~BlitScreen(); void Recreate(); @@ -108,7 +107,7 @@ private: Core::Frontend::EmuWindow& render_window; const Device& device; MemoryAllocator& memory_allocator; - VKSwapchain& swapchain; + Swapchain& swapchain; Scheduler& scheduler; const std::size_t image_count; const ScreenInfo& screen_info; diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index 68adf8be7..a0c26a72a 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp @@ -64,15 +64,15 @@ VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 wi } // Anonymous namespace -VKSwapchain::VKSwapchain(VkSurfaceKHR surface_, const Device& device_, Scheduler& scheduler_, - u32 width, u32 height, bool srgb) +Swapchain::Swapchain(VkSurfaceKHR surface_, const Device& device_, Scheduler& scheduler_, u32 width, + u32 height, bool srgb) : surface{surface_}, device{device_}, scheduler{scheduler_} { Create(width, height, srgb); } -VKSwapchain::~VKSwapchain() = default; +Swapchain::~Swapchain() = default; -void VKSwapchain::Create(u32 width, u32 height, bool srgb) { +void Swapchain::Create(u32 width, u32 height, bool srgb) { is_outdated = false; is_suboptimal = false; @@ -93,7 +93,7 @@ void VKSwapchain::Create(u32 width, u32 height, bool srgb) { resource_ticks.resize(image_count); } -void VKSwapchain::AcquireNextImage() { +void Swapchain::AcquireNextImage() { const VkResult result = device.GetLogical().AcquireNextImageKHR( *swapchain, std::numeric_limits<u64>::max(), *present_semaphores[frame_index], VK_NULL_HANDLE, &image_index); @@ -114,7 +114,7 @@ void VKSwapchain::AcquireNextImage() { resource_ticks[image_index] = scheduler.CurrentTick(); } -void VKSwapchain::Present(VkSemaphore render_semaphore) { +void Swapchain::Present(VkSemaphore render_semaphore) { const auto present_queue{device.GetPresentQueue()}; const VkPresentInfoKHR present_info{ .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, @@ -145,8 +145,8 @@ void VKSwapchain::Present(VkSemaphore render_semaphore) { } } -void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, - u32 height, bool srgb) { +void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height, + bool srgb) { const auto physical_device{device.GetPhysical()}; const auto formats{physical_device.GetSurfaceFormatsKHR(surface)}; const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)}; @@ -212,13 +212,13 @@ void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, image_view_format = srgb ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_B8G8R8A8_UNORM; } -void VKSwapchain::CreateSemaphores() { +void Swapchain::CreateSemaphores() { present_semaphores.resize(image_count); std::ranges::generate(present_semaphores, [this] { return device.GetLogical().CreateSemaphore(); }); } -void VKSwapchain::CreateImageViews() { +void Swapchain::CreateImageViews() { VkImageViewCreateInfo ci{ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .pNext = nullptr, @@ -250,7 +250,7 @@ void VKSwapchain::CreateImageViews() { } } -void VKSwapchain::Destroy() { +void Swapchain::Destroy() { frame_index = 0; present_semaphores.clear(); framebuffers.clear(); @@ -258,11 +258,11 @@ void VKSwapchain::Destroy() { swapchain.reset(); } -bool VKSwapchain::HasFpsUnlockChanged() const { +bool Swapchain::HasFpsUnlockChanged() const { return current_fps_unlocked != Settings::values.disable_fps_limit.GetValue(); } -bool VKSwapchain::NeedsPresentModeUpdate() const { +bool Swapchain::NeedsPresentModeUpdate() const { // Mailbox present mode is the ideal for all scenarios. If it is not available, // A different present mode is needed to support unlocked FPS above the monitor's refresh rate. return present_mode != VK_PRESENT_MODE_MAILBOX_KHR && HasFpsUnlockChanged(); diff --git a/src/video_core/renderer_vulkan/vk_swapchain.h b/src/video_core/renderer_vulkan/vk_swapchain.h index 6160c6a06..111b3902d 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.h +++ b/src/video_core/renderer_vulkan/vk_swapchain.h @@ -17,11 +17,11 @@ namespace Vulkan { class Device; class Scheduler; -class VKSwapchain { +class Swapchain { public: - explicit VKSwapchain(VkSurfaceKHR surface, const Device& device, Scheduler& scheduler, - u32 width, u32 height, bool srgb); - ~VKSwapchain(); + explicit Swapchain(VkSurfaceKHR surface, const Device& device, Scheduler& scheduler, u32 width, + u32 height, bool srgb); + ~Swapchain(); /// Creates (or recreates) the swapchain with a given size. void Create(u32 width, u32 height, bool srgb); |