[UI/D3D12] Small refactoring, allow BeginSwap to return false if no surface

This commit is contained in:
Triang3l
2020-09-14 23:27:19 +03:00
parent acb1fc059f
commit dfbe36a8aa
9 changed files with 149 additions and 132 deletions

View File

@@ -200,11 +200,15 @@ void Window::OnPaint(UIEvent* e) {
io.DisplaySize = ImVec2(static_cast<float>(scaled_width()),
static_cast<float>(scaled_height()));
context_->BeginSwap();
bool can_swap = context_->BeginSwap();
if (context_->WasLost()) {
on_context_lost(e);
return;
}
if (!can_swap) {
// Surface not available.
return;
}
ImGui::NewFrame();