mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
render/vulkan: use initializers for VkImageMemoryBarrier
This commit is contained in:
parent
79aea58834
commit
56326c7998
1 changed files with 57 additions and 47 deletions
|
@ -853,30 +853,35 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// acquire
|
// acquire
|
||||||
acquire_barriers[idx].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
acquire_barriers[idx] = (VkImageMemoryBarrier){
|
||||||
acquire_barriers[idx].srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
|
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||||
acquire_barriers[idx].dstQueueFamilyIndex = renderer->dev->queue_family;
|
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT,
|
||||||
acquire_barriers[idx].image = texture->image;
|
.dstQueueFamilyIndex = renderer->dev->queue_family,
|
||||||
acquire_barriers[idx].oldLayout = src_layout;
|
.image = texture->image,
|
||||||
acquire_barriers[idx].newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
.oldLayout = src_layout,
|
||||||
acquire_barriers[idx].srcAccessMask = 0u; // ignored anyways
|
.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||||
acquire_barriers[idx].dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
|
.srcAccessMask = 0, // ignored anyways
|
||||||
acquire_barriers[idx].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
|
||||||
acquire_barriers[idx].subresourceRange.layerCount = 1;
|
.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
acquire_barriers[idx].subresourceRange.levelCount = 1;
|
.subresourceRange.layerCount = 1,
|
||||||
|
.subresourceRange.levelCount = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
// release
|
||||||
|
release_barriers[idx] = (VkImageMemoryBarrier){
|
||||||
|
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||||
|
.srcQueueFamilyIndex = renderer->dev->queue_family,
|
||||||
|
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT,
|
||||||
|
.image = texture->image,
|
||||||
|
.oldLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||||
|
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||||
|
.srcAccessMask = VK_ACCESS_SHADER_READ_BIT,
|
||||||
|
.dstAccessMask = 0, // ignored anyways
|
||||||
|
.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
.subresourceRange.layerCount = 1,
|
||||||
|
.subresourceRange.levelCount = 1,
|
||||||
|
};
|
||||||
|
|
||||||
// releaes
|
|
||||||
release_barriers[idx].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
|
||||||
release_barriers[idx].srcQueueFamilyIndex = renderer->dev->queue_family;
|
|
||||||
release_barriers[idx].dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
|
|
||||||
release_barriers[idx].image = texture->image;
|
|
||||||
release_barriers[idx].oldLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
|
||||||
release_barriers[idx].newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
|
||||||
release_barriers[idx].srcAccessMask = VK_ACCESS_SHADER_READ_BIT;
|
|
||||||
release_barriers[idx].dstAccessMask = 0u; // ignored anyways
|
|
||||||
release_barriers[idx].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
|
||||||
release_barriers[idx].subresourceRange.layerCount = 1;
|
|
||||||
release_barriers[idx].subresourceRange.levelCount = 1;
|
|
||||||
++idx;
|
++idx;
|
||||||
|
|
||||||
wl_list_remove(&texture->foreign_link);
|
wl_list_remove(&texture->foreign_link);
|
||||||
|
@ -891,32 +896,37 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// acquire render buffer before rendering
|
// acquire render buffer before rendering
|
||||||
acquire_barriers[idx].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
acquire_barriers[idx] = (VkImageMemoryBarrier){
|
||||||
acquire_barriers[idx].srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
|
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||||
acquire_barriers[idx].dstQueueFamilyIndex = renderer->dev->queue_family;
|
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT,
|
||||||
acquire_barriers[idx].image = renderer->current_render_buffer->image;
|
.dstQueueFamilyIndex = renderer->dev->queue_family,
|
||||||
acquire_barriers[idx].oldLayout = src_layout;
|
.image = renderer->current_render_buffer->image,
|
||||||
acquire_barriers[idx].newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
.oldLayout = src_layout,
|
||||||
acquire_barriers[idx].srcAccessMask = 0u; // ignored anyways
|
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||||
acquire_barriers[idx].dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
.srcAccessMask = 0, // ignored anyways
|
||||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||||
acquire_barriers[idx].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
|
||||||
acquire_barriers[idx].subresourceRange.layerCount = 1;
|
.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
acquire_barriers[idx].subresourceRange.levelCount = 1;
|
.subresourceRange.layerCount = 1,
|
||||||
|
.subresourceRange.levelCount = 1,
|
||||||
|
};
|
||||||
|
|
||||||
// release render buffer after rendering
|
// release render buffer after rendering
|
||||||
release_barriers[idx].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
release_barriers[idx] = (VkImageMemoryBarrier){
|
||||||
release_barriers[idx].srcQueueFamilyIndex = renderer->dev->queue_family;
|
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||||
release_barriers[idx].dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
|
.srcQueueFamilyIndex = renderer->dev->queue_family,
|
||||||
release_barriers[idx].image = renderer->current_render_buffer->image;
|
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT,
|
||||||
release_barriers[idx].oldLayout = VK_IMAGE_LAYOUT_GENERAL;
|
.image = renderer->current_render_buffer->image,
|
||||||
release_barriers[idx].newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
.oldLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||||
release_barriers[idx].srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||||
release_barriers[idx].dstAccessMask = 0u; // ignored anyways
|
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
|
||||||
release_barriers[idx].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
.dstAccessMask = 0, // ignored anyways
|
||||||
release_barriers[idx].subresourceRange.layerCount = 1;
|
.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
release_barriers[idx].subresourceRange.levelCount = 1;
|
.subresourceRange.layerCount = 1,
|
||||||
|
.subresourceRange.levelCount = 1,
|
||||||
|
};
|
||||||
|
|
||||||
++idx;
|
++idx;
|
||||||
|
|
||||||
vkCmdPipelineBarrier(pre_cb, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
vkCmdPipelineBarrier(pre_cb, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
||||||
|
|
Loading…
Reference in a new issue