mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-23 09:58:58 +02:00
[vk] Unify RAII in Vulkan (#2679)
This PR consolidates Vulkan RAII on video_core/vulkan_common/vulkan_wrapper.h’s vk::Handle and remove the unused duplicate src/video_core/vulkan_common/vulkan_raii.h, reducing confusion and maintenance. Swapchain now uses RAII‑managed per‑image semaphores and clears them in Destroy(), providing correct present synchronization and automatic cleanup. Expected result: simpler lifetimes, fewer leak risks, and more stable presentation with negligible overhead. Co-authored-by: Ribbit <ribbit@placeholder.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2679 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: Ribbit <ribbit@eden-emu.dev> Co-committed-by: Ribbit <ribbit@eden-emu.dev>
This commit is contained in:
parent
acd7d792a3
commit
db65f10768
35 changed files with 42 additions and 353 deletions
|
|
@ -164,15 +164,6 @@ try
|
|||
PresentFiltersForAppletCapture)
|
||||
, rasterizer(render_window, gpu, device_memory, device, memory_allocator, state_tracker, scheduler) {
|
||||
|
||||
// Initialize RAII wrappers after creating the main objects
|
||||
if (Settings::values.enable_raii.GetValue()) {
|
||||
managed_instance = MakeManagedInstance(instance, dld);
|
||||
if (Settings::values.renderer_debug) {
|
||||
managed_debug_messenger = MakeManagedDebugUtilsMessenger(debug_messenger, instance, dld);
|
||||
}
|
||||
managed_surface = MakeManagedSurface(surface, instance, dld);
|
||||
}
|
||||
|
||||
if (Settings::values.renderer_force_max_clock.GetValue() && device.ShouldBoostClocks()) {
|
||||
turbo_mode.emplace(instance, dld);
|
||||
scheduler.RegisterOnSubmit([this] { turbo_mode->QueueSubmitted(); });
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
|
@ -20,7 +23,6 @@
|
|||
#include "video_core/vulkan_common/vulkan_device.h"
|
||||
#include "video_core/vulkan_common/vulkan_memory_allocator.h"
|
||||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
||||
#include "video_core/vulkan_common/vulkan_raii.h"
|
||||
|
||||
namespace Core::Memory {
|
||||
class Memory;
|
||||
|
|
@ -78,16 +80,10 @@ private:
|
|||
|
||||
// Keep original handles for compatibility with existing code
|
||||
vk::Instance instance;
|
||||
// RAII wrapper for instance
|
||||
ManagedInstance managed_instance;
|
||||
|
||||
vk::DebugUtilsMessenger debug_messenger;
|
||||
// RAII wrapper for debug messenger
|
||||
ManagedDebugUtilsMessenger managed_debug_messenger;
|
||||
|
||||
vk::SurfaceKHR surface;
|
||||
// RAII wrapper for surface
|
||||
ManagedSurface managed_surface;
|
||||
|
||||
Device device;
|
||||
MemoryAllocator memory_allocator;
|
||||
|
|
|
|||
|
|
@ -351,6 +351,7 @@ void Swapchain::CreateSemaphores() {
|
|||
void Swapchain::Destroy() {
|
||||
frame_index = 0;
|
||||
present_semaphores.clear();
|
||||
render_semaphores.clear();
|
||||
swapchain.reset();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue