diff --git a/src/xenia/gpu/vulkan/vulkan_graphics_system.cc b/src/xenia/gpu/vulkan/vulkan_graphics_system.cc index 74ec57849..27b2ff073 100644 --- a/src/xenia/gpu/vulkan/vulkan_graphics_system.cc +++ b/src/xenia/gpu/vulkan/vulkan_graphics_system.cc @@ -19,14 +19,14 @@ #include "xenia/gpu/vulkan/vulkan_command_processor.h" #include "xenia/gpu/vulkan/vulkan_gpu_flags.h" #include "xenia/ui/vulkan/vulkan_provider.h" +#include "xenia/ui/vulkan/vulkan_swap_chain.h" #include "xenia/ui/window.h" namespace xe { namespace gpu { namespace vulkan { -VulkanGraphicsSystem::VulkanGraphicsSystem() = default; - +VulkanGraphicsSystem::VulkanGraphicsSystem() {} VulkanGraphicsSystem::~VulkanGraphicsSystem() = default; X_STATUS VulkanGraphicsSystem::Setup(cpu::Processor* processor, @@ -74,12 +74,25 @@ void VulkanGraphicsSystem::Swap(xe::ui::UIEvent* e) { return; } - // Blit the frontbuffer. - // display_context_->blitter()->BlitTexture2D( - // static_cast(swap_state.front_buffer_texture), - // Rect2D(0, 0, swap_state.width, swap_state.height), - // Rect2D(0, 0, target_window_->width(), target_window_->height()), - // GL_LINEAR, false); + auto swap_chain = display_context_->swap_chain(); + auto copy_cmd_buffer = swap_chain->copy_cmd_buffer(); + + VkImageBlit region; + region.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}; + region.srcOffsets[0] = {0, 0, 0}; + region.srcOffsets[1] = {static_cast(swap_state.width), + static_cast(swap_state.height), 1}; + + region.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}; + region.dstOffsets[0] = {0, 0, 0}; + region.dstOffsets[1] = {static_cast(swap_chain->surface_width()), + static_cast(swap_chain->surface_height()), + 1}; + vkCmdBlitImage(copy_cmd_buffer, + reinterpret_cast(swap_state.front_buffer_texture), + VK_IMAGE_LAYOUT_GENERAL, swap_chain->surface_image(), + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion, + VK_FILTER_LINEAR); } } // namespace vulkan