Comments (6)
Added two callbacks in the main function to solve the issue, although just one should be enough.
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+Vulkan example", nullptr, nullptr);
if (!glfwVulkanSupported())
{
printf("GLFW: Vulkan Not Supported\n");
return 1;
}
glfwSetWindowSizeCallback(window, [](GLFWwindow* window, int width, int height){g_SwapChainRebuild = true;});
glfwSetFramebufferSizeCallback(window, [](GLFWwindow* window, int width, int height){g_SwapChainRebuild = true;});
from imgui.
More info on the issue:
"(VK_SUBOPTIMAL_KHR happens only on X11/XCB or/and xWayland)
In Wayland resize logic completely different from other WM, and way too many platforms to support if you rly care about crossplatform. (and Wayland has too many features that I left untested, I have no idea how application will react to those WM features(exampel I was talking about “zoom” part of screen, what application do in this case how it rendered… no idea))"
https://community.khronos.org/t/vk-suboptimal-khr-is-it-safe-to-use-it-as-window-resize-detection/107848/5
from imgui.
I am wondering if we could simply fix it by changing:
// Resize swap chain?
if (g_SwapChainRebuild)
{
int width, height;
glfwGetFramebufferSize(window, &width, &height);
if (width > 0 && height > 0)
{
ImGui_ImplVulkan_SetMinImageCount(g_MinImageCount);
ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, &g_MainWindowData, g_QueueFamily, g_Allocator, width, height, g_MinImageCount);
g_MainWindowData.FrameIndex = 0;
g_SwapChainRebuild = false;
}
}
to
// Resize swap chain?
int fb_width, fb_height;
glfwGetFramebufferSize(window, &fb_width, &fb_height);
if (g_SwapChainRebuild || g_MainWindowData.Width != fb_width || g_MainWindowData.Height != fb_height)
if (fb_width > 0 && fb_height > 0)
{
ImGui_ImplVulkan_SetMinImageCount(g_MinImageCount);
ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, &g_MainWindowData, g_QueueFamily, g_Allocator, fb_width, fb_height, g_MinImageCount);
g_MainWindowData.FrameIndex = 0;
g_SwapChainRebuild = false;
}
Could you test it?
Can you already see if things works correctly on your system with the SDL+Vulkan example?
Thank you!
from imgui.
Hi,
I've tested it and it worked perfectly.
Unfortunately, for SDL I am unable to get SDL.h to install on my system. I have two potential packages that provide the header but none of them actually install it.
from imgui.
Pushed fixes as a47bfb1 and 7538ca6
Looking at equivalent SDL example it seemed clear the same thing would happen.
If you get around to install SDL please verify it before and after 🙏
from imgui.
For SDL the problem does not exist.
SDL does not open a Wayland native window but an X window.
The flag is raised for VK_ERROR_OUT_OF_DATE_KHR during resize
from imgui.
Related Issues (20)
- How can I set the default window dock position and size if they are not present inside imgui.ini ? HOT 5
- Combo widgets' contents don't render after being rotated and translated by a shader HOT 3
- Win32 DirectX11 app resize resizes ImGui window HOT 1
- GLFW backend: PrevWndProc != NULL assertion fails on Windows HOT 2
- Unexpected output from DrawList->PathArcTo HOT 2
- SetKeyboardFocusHere(-1) not working as expected with InputTextMultiline
- TabBar - Common Style
- WebGPU backend causes crash after window resize HOT 1
- Table drawing Horizontal Scrollbar too far below HOT 3
- Vertical Misalignment when using different size fonts with AlignTextToFramePadding HOT 3
- ImDrawList's PushClipRect not inherited by child window HOT 3
- How can I set FULL window transparency HOT 1
- Detecting a mouse click HOT 6
- How to get resizable child in window? HOT 8
- CMake Support HOT 1
- I want know where is ImGuiLayout HOT 3
- Question: How to load state of docked windows HOT 11
- Locked on 62 / 63 fps in dx11 without Vsync HOT 1
- Change cursor when hand whenTextLink is hovered - Common Style HOT 1
- Touchpad tap to click not captured when io.ConfigInputTrickleEventQueue is false HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.