I use Vulcan and GLFW to work in full screen mode. There is a problem - when you exit the application or simply switch to the desktop, the unpleasant effect of “flashing” occurs - first you see the desktop, then for a split second the application screen again, then the desktop again. It looks awful and wonders if it is possible to fix it. Filmed as it happens:

https://www.youtube.com/watch?v=LrPo0KeOPsg

Update:

glfwInit(); glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan 12", glfwGetPrimaryMonitor(), nullptr); VkGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipelineInfo.stageCount = 2; pipelineInfo.pStages = shaderStages; pipelineInfo.pVertexInputState = &vertexInputInfo; pipelineInfo.pInputAssemblyState = &inputAssembly; pipelineInfo.pViewportState = &viewportState; pipelineInfo.pRasterizationState = &rasterizer; pipelineInfo.pMultisampleState = &multisampling; pipelineInfo.pColorBlendState = &colorBlending; pipelineInfo.layout = pipelineLayout; pipelineInfo.renderPass = renderPass; pipelineInfo.subpass = 0; pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; 

What is spinning in the frame:

 void drawFrame() { uint32_t imageIndex; VkResult result = vkAcquireNextImageKHR(device, swapChain, std::numeric_limits<uint64_t>::max(), imageAvailableSemaphore, VK_NULL_HANDLE, &imageIndex); if (result == VK_ERROR_OUT_OF_DATE_KHR) { recreateSwapChain(); return; } else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) { throw std::runtime_error("failed to acquire swap chain image!"); } VkSubmitInfo submitInfo = {}; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; VkSemaphore waitSemaphores[] = { imageAvailableSemaphore }; VkPipelineStageFlags waitStages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT }; submitInfo.waitSemaphoreCount = 1; submitInfo.pWaitSemaphores = waitSemaphores; submitInfo.pWaitDstStageMask = waitStages; submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = &commandBuffers[imageIndex]; VkSemaphore signalSemaphores[] = { renderFinishedSemaphore }; submitInfo.signalSemaphoreCount = 1; submitInfo.pSignalSemaphores = signalSemaphores; if (vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE) != VK_SUCCESS) { throw std::runtime_error("failed to submit draw command buffer!"); } VkPresentInfoKHR presentInfo = {}; presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; presentInfo.waitSemaphoreCount = 1; presentInfo.pWaitSemaphores = signalSemaphores; VkSwapchainKHR swapChains[] = { swapChain }; presentInfo.swapchainCount = 1; presentInfo.pSwapchains = swapChains; presentInfo.pImageIndices = &imageIndex; result = vkQueuePresentKHR(presentQueue, &presentInfo); if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR) { recreateSwapChain(); } else if (result != VK_SUCCESS) { throw std::runtime_error("failed to present swap chain image!"); } } 

Volcano code in this lesson: http://vulkanapi.ru/2016/11/14/vulkan-api-%d1%83%d1%80%d0%be%d0%ba-29-%d1%80%d0% b5% d0% bd% d0% b4% d0% b5% d1% 80% d0% b8% d0% bd% d0% b3-% d0% b8-% d0% bf% d1% 80% d0% b5% d0% b4% d1% 81% d1% 82% d0% b0% d0% b2% d0% bb% d0% b5% d0% bd% d0% b8% d0% b5-hello-wo /

  • 2
    There is a suspicion that any question on Vulkan runs the risk of never being answered. Without the code it is impossible to say where the problem is, and nobody reads the giant foot wrappers in hundreds of lines. Lay out the GLFW initialization code (along with glfwWindowHint and all the interesting ones), the frame drawing code (what is spinning in the loop) and the VkGraphicsPipelineCreateInfo initialization code, VkGraphicsPipelineCreateInfo possible, cutting out all the uninteresting parts (like sType fields) - m9_psy
  • m9_psy, regarding and GLFW - everything is standard there, from the basic manuals. Updated the first post. By the way, I noticed an interesting thing - if the left program for capturing video from the screen is running (just running, and not capturing) - then there is no blinking, everything works as it should. - MikeNew

0