qt: Fix fullscreen and resize issues on macOS. (#47)

* qt: Fix bugged macOS full screen transition.

* renderer/vulkan: Fix swapchain recreation destroying in-use semaphore.
This commit is contained in:
Steveice10 2023-08-07 03:18:35 -07:00 committed by GPUCode
parent 59549a2eb6
commit 89226eea2a
2 changed files with 18 additions and 14 deletions

View file

@ -229,20 +229,10 @@ class RenderWidget : public QWidget {
public:
RenderWidget(GRenderWindow* parent) : QWidget(parent) {
setMouseTracking(true);
}
virtual ~RenderWidget() = default;
virtual void Present() {}
void paintEvent(QPaintEvent* event) override {
Present();
update();
}
std::pair<unsigned, unsigned> GetSize() const {
return std::make_pair(width(), height());
}
virtual ~RenderWidget() = default;
};
#ifdef HAS_OPENGL
@ -262,7 +252,7 @@ public:
context = std::move(context_);
}
void Present() override {
void Present() {
if (!isVisible()) {
return;
}
@ -278,6 +268,11 @@ public:
glFinish();
}
void paintEvent(QPaintEvent* event) override {
Present();
update();
}
QPaintEngine* paintEngine() const override {
return nullptr;
}
@ -309,7 +304,7 @@ struct SoftwareRenderWidget : public RenderWidget {
explicit SoftwareRenderWidget(GRenderWindow* parent, Core::System& system_)
: RenderWidget(parent), system(system_) {}
void Present() override {
void Present() {
if (!isVisible()) {
return;
}
@ -339,6 +334,11 @@ struct SoftwareRenderWidget : public RenderWidget {
painter.end();
}
void paintEvent(QPaintEvent* event) override {
Present();
update();
}
QImage LoadFramebuffer(VideoCore::ScreenId screen_id) {
const auto& renderer = static_cast<SwRenderer::RendererSoftware&>(system.Renderer());
const auto& info = renderer.Screen(screen_id);

View file

@ -330,7 +330,11 @@ void PresentWindow::NotifySurfaceChanged() {
}
void PresentWindow::CopyToSwapchain(Frame* frame) {
const auto recreate_swapchain = [&] { swapchain.Create(frame->width, frame->height, surface); };
const auto recreate_swapchain = [&] {
std::scoped_lock submit_lock{scheduler.submit_mutex};
graphics_queue.waitIdle();
swapchain.Create(frame->width, frame->height, surface);
};
#ifdef ANDROID
std::unique_lock lock{recreate_surface_mutex};