diff options
| author | MrPurple666 <mrpurple666@noreply.localhost> | 2025-05-18 17:45:32 +0000 |
|---|---|---|
| committer | CamilleLaVey <camillelavey@noreply.localhost> | 2025-05-18 17:45:32 +0000 |
| commit | ce5d5d2aff50f9ce8159d609824eb2391bed9ef2 (patch) | |
| tree | 9d61c37db089ef8fed4fb9feda62f665aeebecd4 /src/video_core/renderer_vulkan/renderer_vulkan.h | |
| parent | 049cc54f4c3c1c4c38f4b308fca37e507a32f35f (diff) | |
THIS NEEDS TO BE CHECKED BEFORE MERGE: RAII fix, initial MSAA, some fixes for memory misallocation (#116)
• MSAA Fixes: Fixes upload/download for MSAA textures using temporary non-MSAA images. Ensures compatibility with color formats and adds fallbacks for depth/stencil.
• Memory fix misallocation: Adds checks for null/zero-length operations in memory management and improves cleanup to avoid crashes (Related to crash issues due to misallocation, RP5 and 865)
• Vulkan Initialization (RAII): this almost rewrites the way vulkan initializes to avoid crashes, using a correct order now (thanks @crueter for the initial fix)
•Please check before merging:
- Test MSAA workflows (especially color/depth transitions and low memory cases).
- Verify memory operations (e.g., unmapping zero-length regions).
- Check Vulkan object lifetimes and platform-specific behavior.
- Check others plataforms beyond android
Why is everything in one PR? Otherwise, this is all a big fix, by checking the points above we can create a branch for each one and check them by themselves. I'm not standing still while I'm away, I'm just out of time for now.
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/116
Co-authored-by: MrPurple666 <mrpurple666@noreply.localhost>
Co-committed-by: MrPurple666 <mrpurple666@noreply.localhost>
Diffstat (limited to 'src/video_core/renderer_vulkan/renderer_vulkan.h')
| -rw-r--r-- | src/video_core/renderer_vulkan/renderer_vulkan.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.h b/src/video_core/renderer_vulkan/renderer_vulkan.h index c1e6d5db7f..ec4215253f 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.h +++ b/src/video_core/renderer_vulkan/renderer_vulkan.h @@ -76,32 +76,37 @@ private: std::shared_ptr<Common::DynamicLibrary> library; vk::InstanceDispatch dld; - // Keep original handles for compatibility with existing code - vk::Instance instance; - // RAII wrapper for instance - ManagedInstance managed_instance; + // Order of member variables determines destruction order (reverse of declaration) + // Critical Vulkan resources should be declared in proper dependency order + // Base Vulkan instance, debugging, and surface + vk::Instance 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 and core resources Device device; MemoryAllocator memory_allocator; StateTracker state_tracker; Scheduler scheduler; Swapchain swapchain; PresentManager present_manager; + + // Rendering components BlitScreen blit_swapchain; BlitScreen blit_capture; BlitScreen blit_applet; RasterizerVulkan rasterizer; - std::optional<TurboMode> turbo_mode; + // Optional components + std::optional<TurboMode> turbo_mode; Frame applet_frame; + + // RAII wrappers - must be destroyed before their raw handles + // so they are declared after to be destroyed first + ManagedInstance managed_instance; + ManagedDebugUtilsMessenger managed_debug_messenger; + ManagedSurface managed_surface; }; } // namespace Vulkan |
