fixes for compute

This commit is contained in:
Matthew 2026-06-14 16:53:15 +10:00
parent 2f8929d5fb
commit c65b5401ab

View File

@ -103,6 +103,7 @@ const char*[] VK_BASE_DEVICE_EXTENSIONS = [
cast(char*)VK_KHR_8BIT_STORAGE_EXTENSION_NAME,
cast(char*)VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME,
cast(char*)VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME,
cast(char*)VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME,
];
const char*[] VK_AMD_DEVICE_EXTENSIONS = [
@ -882,9 +883,9 @@ GetAspect()
}
void
PrepComputeDrawImage()
PrepComputeImage(Descriptor* desc = null)
{
Transition(g_vk.cmd, &g_vk.draw_image, IL.General);
Transition(g_vk.cmd, desc ? desc : &g_vk.draw_image, IL.General);
}
void
@ -906,19 +907,22 @@ FinishRendering()
}
void
SubmitAndPresent()
SubmitAndPresent(Descriptor* copy_image = null)
{
scope(exit)
{
g_vk.last_pipeline = null;
g_vk.frame_index = (g_vk.frame_index + 1) % FRAME_OVERLAP;
}
Descriptor* src_image = copy_image ? copy_image : &g_vk.draw_image;
VkImage image = g_vk.present_image.image.image;
VkSemaphore acquire_sem = g_vk.acquire_sem;
VkSemaphore submit_sem = g_vk.submit_sem;
Transition(g_vk.cmd, &g_vk.draw_image, IL.TransferSrc);
Transition(g_vk.cmd, g_vk.present_image_ptr, IL.TransferDst);
Transition(g_vk.cmd, src_image, IL.TransferSrc);
VkExtent2D extent = {
width: g_vk.swapchain_extent.width,
@ -926,7 +930,7 @@ SubmitAndPresent()
};
// TODO: Find out how to copy from same dimension images (pretty sure its not blitting)
Copy(g_vk.cmd, &g_vk.draw_image, image, IL.TransferDst, extent, extent);
Copy(g_vk.cmd, src_image, image, IL.TransferDst, extent, extent);
Transition(g_vk.cmd, image, IL.TransferDst, IL.PresentSrc);
@ -3571,3 +3575,4 @@ version(VULKAN_RENDERER_TEST) unittest
};
Init(build_info, 10*1000*1000, 10*1000*1000);
}