MCPcopy Create free account
hub / github.com/InoriRus/Kyty / WindowDrawBuffer

Function WindowDrawBuffer

source/emulator/src/Graphics/Window.cpp:2326–2416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2324}
2325
2326void WindowDrawBuffer(VideoOutVulkanImage* image)
2327{
2328 KYTY_PROFILER_FUNCTION();
2329
2330 EXIT_IF(image == nullptr);
2331 EXIT_IF(g_window_ctx == nullptr);
2332 EXIT_IF(g_window_ctx->swapchain == nullptr);
2333
2334 if (g_window_ctx->window_hidden)
2335 {
2336 WindowUpdateIcon();
2337
2338 SDL_ShowWindow(g_window_ctx->window);
2339
2340 g_window_ctx->window_hidden = false;
2341 }
2342
2343 g_window_ctx->swapchain->current_index = static_cast<uint32_t>(-1);
2344
2345 auto result = vkAcquireNextImageKHR(g_window_ctx->graphic_ctx.device, g_window_ctx->swapchain->swapchain, UINT64_MAX,
2346 /*g_window_ctx->swapchain->present_complete_semaphore*/ nullptr,
2347 g_window_ctx->swapchain->present_complete_fence, &g_window_ctx->swapchain->current_index);
2348
2349 EXIT_NOT_IMPLEMENTED(result != VK_SUCCESS);
2350 EXIT_NOT_IMPLEMENTED(g_window_ctx->swapchain->current_index == static_cast<uint32_t>(-1));
2351
2352 do
2353 {
2354 result = vkWaitForFences(g_window_ctx->graphic_ctx.device, 1, &g_window_ctx->swapchain->present_complete_fence, VK_TRUE, 100000000);
2355 } while (result == VK_TIMEOUT);
2356 EXIT_NOT_IMPLEMENTED(result != VK_SUCCESS);
2357
2358 vkResetFences(g_window_ctx->graphic_ctx.device, 1, &g_window_ctx->swapchain->present_complete_fence);
2359
2360 auto* blt_src_image = image;
2361 auto* blt_dst_image = g_window_ctx->swapchain;
2362
2363 EXIT_IF(blt_src_image == nullptr);
2364 EXIT_IF(blt_dst_image == nullptr);
2365
2366 CommandBuffer buffer(GraphicContext::QUEUE_PRESENT);
2367 // buffer.SetQueue(GraphicContext::QUEUE_PRESENT);
2368
2369 EXIT_NOT_IMPLEMENTED(buffer.IsInvalid());
2370
2371 auto* vk_buffer = buffer.GetPool()->buffers[buffer.GetIndex()];
2372
2373 buffer.Begin();
2374
2375 UtilBlitImage(&buffer, blt_src_image, blt_dst_image);
2376
2377 VkImageMemoryBarrier pre_present_barrier {};
2378 pre_present_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
2379 pre_present_barrier.pNext = nullptr;
2380 pre_present_barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
2381 pre_present_barrier.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT;
2382 pre_present_barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
2383 pre_present_barrier.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;

Callers 1

FlipMethod · 0.85

Calls 10

WindowUpdateIconFunction · 0.85
SDL_ShowWindowFunction · 0.85
UtilBlitImageFunction · 0.85
WindowUpdateTitleFunction · 0.85
ExecuteWithSemaphoreMethod · 0.80
IsInvalidMethod · 0.45
GetPoolMethod · 0.45
GetIndexMethod · 0.45
BeginMethod · 0.45
EndMethod · 0.45

Tested by

no test coverage detected