mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-06 09:06:20 +00:00
vulkan: Remove orphan new part 1
This commit is contained in:
parent
28819dede1
commit
e196e35669
5 changed files with 54 additions and 66 deletions
|
@ -109,41 +109,37 @@ void DrawBuffer(HLE::Libs::Graphics::VideoOutVulkanImage* image) {
|
|||
window_ctx->is_window_hidden = false;
|
||||
}
|
||||
|
||||
window_ctx->swapchain->current_index = static_cast<u32>(-1);
|
||||
window_ctx->swapchain.current_index = static_cast<u32>(-1);
|
||||
|
||||
auto result = vkAcquireNextImageKHR(window_ctx->m_graphic_ctx.m_device, window_ctx->swapchain->swapchain, UINT64_MAX, nullptr,
|
||||
window_ctx->swapchain->present_complete_fence, &window_ctx->swapchain->current_index);
|
||||
auto result = vkAcquireNextImageKHR(window_ctx->m_graphic_ctx.m_device, window_ctx->swapchain.swapchain, UINT64_MAX, nullptr,
|
||||
window_ctx->swapchain.present_complete_fence, &window_ctx->swapchain.current_index);
|
||||
|
||||
if (result != VK_SUCCESS) {
|
||||
fmt::print("Can't aquireNextImage\n");
|
||||
std::exit(0);
|
||||
}
|
||||
if (window_ctx->swapchain->current_index == static_cast<u32>(-1)) {
|
||||
if (window_ctx->swapchain.current_index == static_cast<u32>(-1)) {
|
||||
fmt::print("Unsupported:swapchain current index is -1\n");
|
||||
std::exit(0);
|
||||
}
|
||||
|
||||
do {
|
||||
result = vkWaitForFences(window_ctx->m_graphic_ctx.m_device, 1, &window_ctx->swapchain->present_complete_fence, VK_TRUE, 100000000);
|
||||
result = vkWaitForFences(window_ctx->m_graphic_ctx.m_device, 1, &window_ctx->swapchain.present_complete_fence, VK_TRUE, 100000000);
|
||||
} while (result == VK_TIMEOUT);
|
||||
if (result != VK_SUCCESS) {
|
||||
fmt::print("vkWaitForFences is not success\n");
|
||||
std::exit(0);
|
||||
}
|
||||
|
||||
vkResetFences(window_ctx->m_graphic_ctx.m_device, 1, &window_ctx->swapchain->present_complete_fence);
|
||||
vkResetFences(window_ctx->m_graphic_ctx.m_device, 1, &window_ctx->swapchain.present_complete_fence);
|
||||
|
||||
auto* blt_src_image = image;
|
||||
auto* blt_dst_image = window_ctx->swapchain;
|
||||
auto blt_src_image = image;
|
||||
auto blt_dst_image = window_ctx->swapchain;
|
||||
|
||||
if (blt_src_image == nullptr) {
|
||||
fmt::print("blt_src_image is null\n");
|
||||
std::exit(0);
|
||||
}
|
||||
if (blt_dst_image == nullptr) {
|
||||
fmt::print("blt_dst_image is null\n");
|
||||
std::exit(0);
|
||||
}
|
||||
|
||||
GPU::CommandBuffer buffer(10);
|
||||
|
||||
|
@ -151,7 +147,7 @@ void DrawBuffer(HLE::Libs::Graphics::VideoOutVulkanImage* image) {
|
|||
|
||||
buffer.begin();
|
||||
|
||||
Graphics::Vulkan::vulkanBlitImage(&buffer, blt_src_image, blt_dst_image);
|
||||
Graphics::Vulkan::vulkanBlitImage(&buffer, blt_src_image, &blt_dst_image);
|
||||
|
||||
VkImageMemoryBarrier pre_present_barrier{};
|
||||
pre_present_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
|
@ -167,7 +163,7 @@ void DrawBuffer(HLE::Libs::Graphics::VideoOutVulkanImage* image) {
|
|||
pre_present_barrier.subresourceRange.levelCount = 1;
|
||||
pre_present_barrier.subresourceRange.baseArrayLayer = 0;
|
||||
pre_present_barrier.subresourceRange.layerCount = 1;
|
||||
pre_present_barrier.image = window_ctx->swapchain->swapchain_images[window_ctx->swapchain->current_index];
|
||||
pre_present_barrier.image = window_ctx->swapchain.swapchain_images[window_ctx->swapchain.current_index];
|
||||
vkCmdPipelineBarrier(vk_buffer, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1,
|
||||
&pre_present_barrier);
|
||||
|
||||
|
@ -178,8 +174,8 @@ void DrawBuffer(HLE::Libs::Graphics::VideoOutVulkanImage* image) {
|
|||
present.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
|
||||
present.pNext = nullptr;
|
||||
present.swapchainCount = 1;
|
||||
present.pSwapchains = &window_ctx->swapchain->swapchain;
|
||||
present.pImageIndices = &window_ctx->swapchain->current_index;
|
||||
present.pSwapchains = &window_ctx->swapchain.swapchain;
|
||||
present.pImageIndices = &window_ctx->swapchain.current_index;
|
||||
present.pWaitSemaphores = &buffer.getPool()->semaphores[buffer.getIndex()];
|
||||
present.waitSemaphoreCount = 1;
|
||||
present.pResults = nullptr;
|
||||
|
@ -223,4 +219,4 @@ void keyboardEvent(SDL_Event* event) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace Emu
|
||||
} // namespace Emu
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue