21 #ifdef VKPT_DEVICE_GROUPS
25 vkpt_mgpu_global_barrier(VkCommandBuffer cmd_buf)
31 VkMemoryBarrier mem_barrier = {
32 .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
34 .srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT,
35 .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT
38 vkCmdPipelineBarrier(cmd_buf,
39 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
40 VK_DEPENDENCY_DEVICE_GROUP_BIT,
47 vkpt_mgpu_image_copy(VkCommandBuffer cmd_buf,
52 VkOffset2D src_offset,
53 VkOffset2D dst_offset,
56 VkImageSubresourceRange subresource_range = {
57 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
64 VkImageSubresourceLayers subresource_layers = {
65 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
71 VkImageCopy copy_region = {
72 .srcSubresource = subresource_layers,
73 .srcOffset.x = src_offset.x,
74 .srcOffset.y = src_offset.y,
76 .dstSubresource = subresource_layers,
77 .dstOffset.x = dst_offset.x,
78 .dstOffset.y = dst_offset.y,
80 .extent.width = size.width,
81 .extent.height = size.height,
87 VkMemoryBarrier mem_barrier = {
88 .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
90 .srcAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
91 .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
94 vkCmdPipelineBarrier(cmd_buf,
95 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
101 vkCmdCopyImage(cmd_buf,
102 qvk.images_local[src_gpu_index][src_image_index], VK_IMAGE_LAYOUT_GENERAL,
103 qvk.images_local[dst_gpu_index][dst_image_index], VK_IMAGE_LAYOUT_GENERAL,
114 VkOffset2D src_offset,
115 VkOffset2D dst_offset,
118 VkImageSubresourceRange subresource_range = {
119 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
126 VkImageSubresourceLayers subresource_layers = {
127 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
133 VkImageCopy copy_region = {
134 .srcSubresource = subresource_layers,
135 .srcOffset.x = src_offset.x,
136 .srcOffset.y = src_offset.y,
138 .dstSubresource = subresource_layers,
139 .dstOffset.x = dst_offset.x,
140 .dstOffset.y = dst_offset.y,
142 .extent.width = size.width,
143 .extent.height = size.height,
147 VkMemoryBarrier mem_barrier = {
148 .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
150 .srcAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
151 .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
154 vkCmdPipelineBarrier(cmd_buf,
155 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
161 vkCmdCopyImage(cmd_buf,
162 qvk.
images[src_image_index], VK_IMAGE_LAYOUT_GENERAL,
163 qvk.
images[dst_image_index], VK_IMAGE_LAYOUT_GENERAL,