Renderer: Handle resize events on-demand instead of polling

We now differentiate between a resize event and surface change/destroyed
event, reducing the overhead for resizes in the Vulkan backend. It is
also now now safe to change the surface multiple times if the video thread
is lagging behind.
This commit is contained in:
Stenzek
2018-01-26 16:23:24 +10:00
parent 5baf3bbe2e
commit de632fc9c8
19 changed files with 364 additions and 350 deletions

View File

@ -22,7 +22,7 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
Qt::DirectConnection);
connect(this, &RenderWidget::HandleChanged, Host::GetInstance(), &Host::SetRenderHandle,
Qt::DirectConnection);
connect(this, &RenderWidget::SizeChanged, Host::GetInstance(), &Host::UpdateSurface,
connect(this, &RenderWidget::SizeChanged, Host::GetInstance(), &Host::ResizeSurface,
Qt::DirectConnection);
emit HandleChanged((void*)winId());
@ -84,8 +84,12 @@ bool RenderWidget::event(QEvent* event)
Host::GetInstance()->SetRenderFocus(false);
break;
case QEvent::Resize:
emit SizeChanged();
{
const QResizeEvent* se = static_cast<QResizeEvent*>(event);
QSize new_size = se->size();
emit SizeChanged(new_size.width(), new_size.height());
break;
}
case QEvent::WindowStateChange:
emit StateChanged(isFullScreen());
break;