|
|
@ -58,10 +58,9 @@ const char *vulkan_strerror(VkResult err) {
|
|
|
|
#undef ERR_STR
|
|
|
|
#undef ERR_STR
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void vulkan_change_layout_queue(VkCommandBuffer cb, VkImage img,
|
|
|
|
void vulkan_change_layout(VkCommandBuffer cb, VkImage img,
|
|
|
|
VkImageLayout ol, VkPipelineStageFlags srcs, VkAccessFlags srca,
|
|
|
|
VkImageLayout ol, VkPipelineStageFlags srcs, VkAccessFlags srca,
|
|
|
|
VkImageLayout nl, VkPipelineStageFlags dsts, VkAccessFlags dsta,
|
|
|
|
VkImageLayout nl, VkPipelineStageFlags dsts, VkAccessFlags dsta) {
|
|
|
|
uint32_t src_family, uint32_t dst_family) {
|
|
|
|
|
|
|
|
VkImageMemoryBarrier barrier = {
|
|
|
|
VkImageMemoryBarrier barrier = {
|
|
|
|
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
|
|
|
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
|
|
|
.oldLayout = ol,
|
|
|
|
.oldLayout = ol,
|
|
|
@ -72,20 +71,12 @@ void vulkan_change_layout_queue(VkCommandBuffer cb, VkImage img,
|
|
|
|
.subresourceRange.levelCount = 1,
|
|
|
|
.subresourceRange.levelCount = 1,
|
|
|
|
.srcAccessMask = srca,
|
|
|
|
.srcAccessMask = srca,
|
|
|
|
.dstAccessMask = dsta,
|
|
|
|
.dstAccessMask = dsta,
|
|
|
|
.srcQueueFamilyIndex = src_family,
|
|
|
|
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
|
|
.dstQueueFamilyIndex = dst_family,
|
|
|
|
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
vkCmdPipelineBarrier(cb, srcs, dsts, 0, 0, NULL, 0, NULL, 1, &barrier);
|
|
|
|
vkCmdPipelineBarrier(cb, srcs, dsts, 0, 0, NULL, 0, NULL, 1, &barrier);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void vulkan_change_layout(VkCommandBuffer cb, VkImage img,
|
|
|
|
|
|
|
|
VkImageLayout ol, VkPipelineStageFlags srcs, VkAccessFlags srca,
|
|
|
|
|
|
|
|
VkImageLayout nl, VkPipelineStageFlags dsts, VkAccessFlags dsta) {
|
|
|
|
|
|
|
|
vulkan_change_layout_queue(cb, img, ol, srcs, srca, nl, dsts, dsta,
|
|
|
|
|
|
|
|
VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool vulkan_has_extension(size_t count, const char **exts, const char *find) {
|
|
|
|
bool vulkan_has_extension(size_t count, const char **exts, const char *find) {
|
|
|
|
for (unsigned i = 0; i < count; ++i) {
|
|
|
|
for (unsigned i = 0; i < count; ++i) {
|
|
|
|
if (strcmp(exts[i], find) == 0) {
|
|
|
|
if (strcmp(exts[i], find) == 0) {
|
|
|
|