"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/vulkan/overlay-layer/overlay.cpp" between
mesa-20.0.0-rc2.tar.xz and mesa-20.0.0-rc3.tar.xz

About: Mesa is an open-source implementation of the OpenGL specification - a system for rendering interactive 3D graphics (main library code). Release candidate.

overlay.cpp  (mesa-20.0.0-rc2.tar.xz):overlay.cpp  (mesa-20.0.0-rc3.tar.xz)
skipping to change at line 1320 skipping to change at line 1320
// Draw // Draw
device_data->vtable.CmdDrawIndexed(draw->command_buffer, pcmd->ElemC ount, 1, idx_offset, vtx_offset, 0); device_data->vtable.CmdDrawIndexed(draw->command_buffer, pcmd->ElemC ount, 1, idx_offset, vtx_offset, 0);
idx_offset += pcmd->ElemCount; idx_offset += pcmd->ElemCount;
} }
vtx_offset += cmd_list->VtxBuffer.Size; vtx_offset += cmd_list->VtxBuffer.Size;
} }
device_data->vtable.CmdEndRenderPass(draw->command_buffer); device_data->vtable.CmdEndRenderPass(draw->command_buffer);
/* Bounce the image to display back to present layout. */ if (device_data->graphic_queue->family_index != present_queue->family_index)
imb.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; {
imb.pNext = nullptr; /* Transfer the image back to the present queue family
imb.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; * image layout was already changed to present by the render pass
imb.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; */
imb.oldLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; imb.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
imb.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; imb.pNext = nullptr;
imb.image = data->images[image_index]; imb.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
imb.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; imb.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
imb.subresourceRange.baseMipLevel = 0; imb.oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
imb.subresourceRange.levelCount = 1; imb.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
imb.subresourceRange.baseArrayLayer = 0; imb.image = data->images[image_index];
imb.subresourceRange.layerCount = 1; imb.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
imb.srcQueueFamilyIndex = device_data->graphic_queue->family_index; imb.subresourceRange.baseMipLevel = 0;
imb.dstQueueFamilyIndex = present_queue->family_index; imb.subresourceRange.levelCount = 1;
device_data->vtable.CmdPipelineBarrier(draw->command_buffer, imb.subresourceRange.baseArrayLayer = 0;
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, imb.subresourceRange.layerCount = 1;
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, imb.srcQueueFamilyIndex = device_data->graphic_queue->family_index;
0, /* dependency flags */ imb.dstQueueFamilyIndex = present_queue->family_index;
0, nullptr, /* memory barriers */ device_data->vtable.CmdPipelineBarrier(draw->command_buffer,
0, nullptr, /* buffer memory barriers VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
*/ VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
1, &imb); /* image memory barriers * 0, /* dependency flags */
/ 0, nullptr, /* memory barriers */
0, nullptr, /* buffer memory barrie
rs */
1, &imb); /* image memory barrier
s */
}
device_data->vtable.EndCommandBuffer(draw->command_buffer); device_data->vtable.EndCommandBuffer(draw->command_buffer);
VkPipelineStageFlags *stages_wait = (VkPipelineStageFlags*) malloc(sizeof(VkP
ipelineStageFlags) * n_wait_semaphores);
for (unsigned i = 0; i < n_wait_semaphores; i++)
{
// wait in the fragment stage until the swapchain image is ready
stages_wait[i] = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
}
VkSubmitInfo submit_info = {}; VkSubmitInfo submit_info = {};
VkPipelineStageFlags stage_wait = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
submit_info.commandBufferCount = 1; submit_info.commandBufferCount = 1;
submit_info.pCommandBuffers = &draw->command_buffer; submit_info.pCommandBuffers = &draw->command_buffer;
submit_info.pWaitDstStageMask = &stage_wait; submit_info.pWaitDstStageMask = stages_wait;
submit_info.waitSemaphoreCount = n_wait_semaphores; submit_info.waitSemaphoreCount = n_wait_semaphores;
submit_info.pWaitSemaphores = wait_semaphores; submit_info.pWaitSemaphores = wait_semaphores;
submit_info.signalSemaphoreCount = 1; submit_info.signalSemaphoreCount = 1;
submit_info.pSignalSemaphores = &draw->semaphore; submit_info.pSignalSemaphores = &draw->semaphore;
device_data->vtable.QueueSubmit(device_data->graphic_queue->queue, 1, &submit _info, draw->fence); device_data->vtable.QueueSubmit(device_data->graphic_queue->queue, 1, &submit _info, draw->fence);
free(stages_wait);
return draw; return draw;
} }
static const uint32_t overlay_vert_spv[] = { static const uint32_t overlay_vert_spv[] = {
#include "overlay.vert.spv.h" #include "overlay.vert.spv.h"
}; };
static const uint32_t overlay_frag_spv[] = { static const uint32_t overlay_frag_spv[] = {
#include "overlay.frag.spv.h" #include "overlay.frag.spv.h"
}; };
skipping to change at line 1891 skipping to change at line 1904
* semaphores to wait on. If we don't do that the presented picture might * semaphores to wait on. If we don't do that the presented picture might
* be have incomplete overlay drawings. * be have incomplete overlay drawings.
*/ */
VkResult result = VK_SUCCESS; VkResult result = VK_SUCCESS;
if (instance_data->params.no_display) { if (instance_data->params.no_display) {
for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) { for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
VkSwapchainKHR swapchain = pPresentInfo->pSwapchains[i]; VkSwapchainKHR swapchain = pPresentInfo->pSwapchains[i];
struct swapchain_data *swapchain_data = struct swapchain_data *swapchain_data =
FIND(struct swapchain_data, swapchain); FIND(struct swapchain_data, swapchain);
uint32_t image_index = pPresentInfo->pImageIndices[i];
before_present(swapchain_data, before_present(swapchain_data,
queue_data, queue_data,
pPresentInfo->pWaitSemaphores, pPresentInfo->pWaitSemaphores,
pPresentInfo->waitSemaphoreCount, pPresentInfo->waitSemaphoreCount,
pPresentInfo->pImageIndices[i]); image_index);
VkPresentInfoKHR present_info = *pPresentInfo; VkPresentInfoKHR present_info = *pPresentInfo;
present_info.swapchainCount = 1; present_info.swapchainCount = 1;
present_info.pSwapchains = &swapchain; present_info.pSwapchains = &swapchain;
present_info.pImageIndices = &image_index;
uint64_t ts0 = os_time_get(); uint64_t ts0 = os_time_get();
result = queue_data->device->vtable.QueuePresentKHR(queue, &present_inf o); result = queue_data->device->vtable.QueuePresentKHR(queue, &present_inf o);
uint64_t ts1 = os_time_get(); uint64_t ts1 = os_time_get();
swapchain_data->frame_stats.stats[OVERLAY_PARAM_ENABLED_present_timing] += ts1 - ts0; swapchain_data->frame_stats.stats[OVERLAY_PARAM_ENABLED_present_timing] += ts1 - ts0;
} }
} else { } else {
for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) { for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
VkSwapchainKHR swapchain = pPresentInfo->pSwapchains[i]; VkSwapchainKHR swapchain = pPresentInfo->pSwapchains[i];
struct swapchain_data *swapchain_data = struct swapchain_data *swapchain_data =
FIND(struct swapchain_data, swapchain); FIND(struct swapchain_data, swapchain);
uint32_t image_index = pPresentInfo->pImageIndices[i];
VkPresentInfoKHR present_info = *pPresentInfo; VkPresentInfoKHR present_info = *pPresentInfo;
present_info.swapchainCount = 1; present_info.swapchainCount = 1;
present_info.pSwapchains = &swapchain; present_info.pSwapchains = &swapchain;
present_info.pImageIndices = &image_index;
uint32_t image_index = pPresentInfo->pImageIndices[i];
struct overlay_draw *draw = before_present(swapchain_data, struct overlay_draw *draw = before_present(swapchain_data,
queue_data, queue_data,
pPresentInfo->pWaitSemaphore s, pPresentInfo->pWaitSemaphore s,
pPresentInfo->waitSemaphoreC ount, pPresentInfo->waitSemaphoreC ount,
image_index); image_index);
/* Because the submission of the overlay draw waits on the semaphores /* Because the submission of the overlay draw waits on the semaphores
* handed for present, we don't need to have this present operation * handed for present, we don't need to have this present operation
* wait on them as well, we can just wait on the overlay submission * wait on them as well, we can just wait on the overlay submission
 End of changes. 10 change blocks. 
29 lines changed or deleted 48 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)