Skip to content

Commit

Permalink
Merge branch 'shadps4-emu:main' into Full-BB
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolix29 authored Dec 23, 2024
2 parents 3f6386b + 400da1a commit 782bb06
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/video_core/renderer_vulkan/vk_presenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,11 @@ void Presenter::Present(Frame* frame) {
swapchain.Recreate(window.GetWidth(), window.GetHeight());
}

ImGui::Core::NewFrame();
if (!swapchain.AcquireNextImage()) {
swapchain.Recreate(window.GetWidth(), window.GetHeight());
}

swapchain.AcquireNextImage();
ImGui::Core::NewFrame();

const vk::Image swapchain_image = swapchain.Image();

Expand Down Expand Up @@ -731,7 +733,9 @@ void Presenter::Present(Frame* frame) {

// Present to swapchain.
std::scoped_lock submit_lock{Scheduler::submit_mutex};
swapchain.Present();
if (!swapchain.Present()) {
swapchain.Recreate(window.GetWidth(), window.GetHeight());
}

// Free the frame for reuse
std::scoped_lock fl{free_mutex};
Expand Down
4 changes: 3 additions & 1 deletion src/video_core/renderer_vulkan/vk_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ bool Swapchain::AcquireNextImage() {
return !needs_recreation;
}

void Swapchain::Present() {
bool Swapchain::Present() {

const vk::PresentInfoKHR present_info = {
.waitSemaphoreCount = 1,
Expand All @@ -131,6 +131,8 @@ void Swapchain::Present() {
}

frame_index = (frame_index + 1) % image_count;

return !needs_recreation;
}

void Swapchain::FindPresentFormat() {
Expand Down
2 changes: 1 addition & 1 deletion src/video_core/renderer_vulkan/vk_swapchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Swapchain {
bool AcquireNextImage();

/// Presents the current image and move to the next one
void Present();
bool Present();

vk::SurfaceKHR GetSurface() const {
return surface;
Expand Down
1 change: 1 addition & 0 deletions src/video_core/texture_cache/tile_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static vk::Format DemoteImageFormatForDetiling(vk::Format format) {
case vk::Format::eR8Unorm:
return vk::Format::eR8Uint;
case vk::Format::eR4G4B4A4UnormPack16:
case vk::Format::eB5G6R5UnormPack16:
case vk::Format::eR5G5B5A1UnormPack16:
case vk::Format::eR8G8Unorm:
case vk::Format::eR16Sfloat:
Expand Down

0 comments on commit 782bb06

Please sign in to comment.