early-access version 4019

This commit is contained in:
pineappleEA 2023-12-14 07:35:48 +01:00
parent 81955276bf
commit 20b067fbf4
4 changed files with 15 additions and 14 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 4018. This is the source code for early-access 4019.
## Legal Notice ## Legal Notice

View file

@ -102,8 +102,8 @@ PresentManager::PresentManager(const vk::Instance& instance_,
memory_allocator{memory_allocator_}, scheduler{scheduler_}, swapchain{swapchain_}, memory_allocator{memory_allocator_}, scheduler{scheduler_}, swapchain{swapchain_},
surface{surface_}, blit_supported{CanBlitToSwapchain(device.GetPhysical(), surface{surface_}, blit_supported{CanBlitToSwapchain(device.GetPhysical(),
swapchain.GetImageViewFormat())}, swapchain.GetImageViewFormat())},
use_present_thread{Settings::values.async_presentation.GetValue()}, use_present_thread{Settings::values.async_presentation.GetValue()} {
image_count{swapchain.GetImageCount()} { SetImageCount();
auto& dld = device.GetLogical(); auto& dld = device.GetLogical();
cmdpool = dld.CreateCommandPool({ cmdpool = dld.CreateCommandPool({
@ -165,12 +165,6 @@ void PresentManager::Present(Frame* frame) {
return; return;
} }
{
// If we have run too far ahead of command processing, wait.
std::unique_lock lock{queue_mutex};
frame_cv.wait(lock, [&] { return present_queue.size() < FRAMES_IN_FLIGHT - 1; });
}
scheduler.Record([this, frame](vk::CommandBuffer) { scheduler.Record([this, frame](vk::CommandBuffer) {
std::unique_lock lock{queue_mutex}; std::unique_lock lock{queue_mutex};
present_queue.push(frame); present_queue.push(frame);
@ -298,6 +292,13 @@ void PresentManager::RecreateSwapchain(Frame* frame) {
image_count = swapchain.GetImageCount(); image_count = swapchain.GetImageCount();
} }
void PresentManager::SetImageCount() {
// We cannot have more than 5 images in flight at any given time.
// FRAMES_IN_FLIGHT is 7, and the cache TICKS_TO_DESTROY is 6.
// Mali drivers will give us 6.
image_count = std::min<size_t>(swapchain.GetImageCount(), 5);
}
void PresentManager::CopyToSwapchain(Frame* frame) { void PresentManager::CopyToSwapchain(Frame* frame) {
bool requires_recreation = false; bool requires_recreation = false;

View file

@ -22,10 +22,6 @@ class Device;
class Scheduler; class Scheduler;
class Swapchain; class Swapchain;
// This should be plenty for the vast majority of cases. Most desktop platforms only
// provide up to 3 swapchain images.
constexpr size_t FRAMES_IN_FLIGHT = 7;
struct Frame { struct Frame {
u32 width; u32 width;
u32 height; u32 height;
@ -66,6 +62,8 @@ private:
void RecreateSwapchain(Frame* frame); void RecreateSwapchain(Frame* frame);
void SetImageCount();
private: private:
const vk::Instance& instance; const vk::Instance& instance;
Core::Frontend::EmuWindow& render_window; Core::Frontend::EmuWindow& render_window;

View file

@ -5,7 +5,6 @@
#include <array> #include <array>
#include "video_core/renderer_vulkan/vk_present_manager.h"
#include "video_core/vulkan_common/vulkan_wrapper.h" #include "video_core/vulkan_common/vulkan_wrapper.h"
namespace Vulkan { namespace Vulkan {
@ -30,6 +29,9 @@ struct DescriptorUpdateEntry {
}; };
class UpdateDescriptorQueue final { class UpdateDescriptorQueue final {
// This should be plenty for the vast majority of cases. Most desktop platforms only
// provide up to 3 swapchain images.
static constexpr size_t FRAMES_IN_FLIGHT = 7;
static constexpr size_t FRAME_PAYLOAD_SIZE = 0x20000; static constexpr size_t FRAME_PAYLOAD_SIZE = 0x20000;
static constexpr size_t PAYLOAD_SIZE = FRAME_PAYLOAD_SIZE * FRAMES_IN_FLIGHT; static constexpr size_t PAYLOAD_SIZE = FRAME_PAYLOAD_SIZE * FRAMES_IN_FLIGHT;