From ca762d5b84558ae927238a9f007d24be2e87a333 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Mon, 13 Apr 2026 02:24:38 +0300 Subject: [PATCH] vk: Add extra renderpass API entry to allow generating keys with no images --- rpcs3/Emu/RSX/VK/VKRenderPass.cpp | 25 +++++++++++++++++++++++-- rpcs3/Emu/RSX/VK/VKRenderPass.h | 3 ++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/VKRenderPass.cpp b/rpcs3/Emu/RSX/VK/VKRenderPass.cpp index c9fe0665d9..0f6ef23458 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderPass.cpp +++ b/rpcs3/Emu/RSX/VK/VKRenderPass.cpp @@ -203,10 +203,10 @@ namespace vk return key.encoded; } - u64 get_renderpass_key(VkFormat surface_format) + u64 get_renderpass_key(VkFormat surface_format, u8 sample_count) { renderpass_key_blob key(0); - key.sample_count = 1; + key.sample_count = sample_count; switch (surface_format) { @@ -226,6 +226,27 @@ namespace vk return key.encoded; } + u64 get_renderpass_key(VkFormat color_format, VkFormat depth_format, u8 sample_count) + { + renderpass_key_blob key(0); + key.sample_count = sample_count; + + u32 image_index = 0; + if (color_format != VK_FORMAT_UNDEFINED) + { + key.set_format(color_format); + key.set_layout(image_index++, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); + } + + if (depth_format != VK_FORMAT_UNDEFINED) + { + key.set_format(depth_format); + key.set_layout(image_index++, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); + } + + return key.encoded; + } + VkRenderPass get_renderpass(VkDevice dev, u64 renderpass_key) { // 99.999% of checks will go through this block once on-disk shader cache has loaded diff --git a/rpcs3/Emu/RSX/VK/VKRenderPass.h b/rpcs3/Emu/RSX/VK/VKRenderPass.h index 6b6718ef29..5c23e749df 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderPass.h +++ b/rpcs3/Emu/RSX/VK/VKRenderPass.h @@ -10,7 +10,8 @@ namespace vk u64 get_renderpass_key(const std::vector& images, const std::vector& input_attachment_ids = {}); u64 get_renderpass_key(const std::vector& images, u64 previous_key); - u64 get_renderpass_key(VkFormat surface_format); + u64 get_renderpass_key(VkFormat surface_format, u8 sample_count = 1); + u64 get_renderpass_key(VkFormat color_format, VkFormat depth_format, u8 sample_count = 1); VkRenderPass get_renderpass(VkDevice dev, u64 renderpass_key); void clear_renderpass_cache(VkDevice dev);