Skip to content

Commit 07d1e3f

Browse files
committed
Fix vulkan window resize
1 parent c50069a commit 07d1e3f

File tree

6 files changed

+9
-2
lines changed

6 files changed

+9
-2
lines changed

Framework/Core/Interfaces/RendererInterface.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace UImGui
2222
static const FString& getDriverVersion() noexcept;
2323
private:
2424
friend class RendererInternal;
25+
friend class WindowInternal;
2526
friend class WebGPUTexture;
2627
friend class Texture;
2728

Framework/Renderer/Renderer.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace UImGui
2727
friend class WebGPURenderer;
2828
friend class Texture;
2929
friend class WebGPUTexture;
30+
friend class WindowInternal;
3031

3132
static void tick(void* rendererInstance) noexcept;
3233

Framework/Renderer/Vulkan/Components/VKDraw.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,12 @@ void UImGui::VKDraw::ImGuiDraw(void* drawData) noexcept
117117
}
118118

119119
result = vkAcquireNextImageKHR(device->device, window.Swapchain, UINT64_MAX, imageAcquired, VK_NULL_HANDLE, &window.FrameIndex);
120-
if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR)
120+
if (bRebuildSwapchain || result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR)
121121
{
122122
bRebuildSwapchain = true;
123123
ImGuiPreDraw();
124124
return;
125125
}
126-
ImGuiPreDraw();
127126

128127
result = vkResetFences(device->device, 1, &fd->Fence);
129128
if (result != VK_SUCCESS)

Framework/Renderer/Vulkan/Components/VKDraw.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ namespace UImGui
2020
void ImGuiPreDraw() noexcept;
2121
void ImGuiDraw(void* drawData) noexcept;
2222
private:
23+
friend class WindowInternal;
24+
2325
VKInstance* instance = nullptr;
2426
VKDevice* device = nullptr;
2527

Framework/Renderer/Vulkan/VulkanRenderer.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ namespace UImGui
2222
virtual void ImGuiInit() noexcept override;
2323
virtual void ImGuiRenderData() noexcept override;
2424
private:
25+
friend class WindowInternal;
26+
2527
#ifndef __EMSCRIPTEN__
2628
VKInstance instance{};
2729
VKDevice device{ instance };

Framework/Renderer/Window/Callbacks.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ void UImGui::WindowInternal::framebufferSizeCallback(GLFWwindow* window, const i
3737

3838
if (!Renderer::data().bVulkan)
3939
glViewport(0, 0, width, height);
40+
else
41+
Renderer::get().vulkan.draw.bRebuildSwapchain = true;
4042

4143
for (auto& a : windowInst->windowResizeCallbackList)
4244
a(width, height);

0 commit comments

Comments
 (0)