vk: Add extra renderpass API entry to allow generating keys with no images

This commit is contained in:
kd-11 2026-04-13 02:24:38 +03:00 committed by kd-11
parent d93f5f9f84
commit ca762d5b84
2 changed files with 25 additions and 3 deletions

View file

@ -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

View file

@ -10,7 +10,8 @@ namespace vk
u64 get_renderpass_key(const std::vector<vk::image*>& images, const std::vector<u8>& input_attachment_ids = {});
u64 get_renderpass_key(const std::vector<vk::image*>& 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);