Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vulkan] example-07-callback does not work well with a tiling wm. #3304

Open
mcourteaux opened this issue Jun 5, 2024 · 0 comments
Open

Comments

@mcourteaux
Copy link
Contributor

Describe the bug
This issue seems related to frame buffers not following nicely the window size.

Starting in Vulkan (with Debug) crashes with:

../../../src/renderer_vk.cpp (683): BGFX ---E-          RenderPass, Validation, 0: Validation Error: [ VUID-VkRenderPassBeginInfo-pNext-02852 ] Object 0: handle = 0xd10d270000000018, type = VK_OBJECT_TYPE_RENDER_PASS; Object 1: handle = 0x27d60e0000000019, type = VK_OBJECT_TYPE_FRAMEBUFFER; | MessageID = 0xdb2c5767 | vkCmdBeginRenderPass(): pRenderPassBegin->renderArea offset.x (0) + extent.width (1280) is greater than framebuffer width (621). The Vulkan spec states: If the pNext chain does not contain VkDeviceGroupRenderPassBeginInfo or its deviceRenderAreaCount member is equal to 0, renderArea.offset.x + renderArea.extent.width must be less than or equal to VkFramebufferCreateInfo::width the framebuffer was created with (https://vulkan.lunarg.com/doc/view/1.3.280.0/linux/1.3-extensions/vkspec.html#VUID-VkRenderPassBeginInfo-pNext-02852)
../../../src/renderer_vk.cpp (683): BGFX ---E-          RenderPass, Validation, 0: Validation Error: [ VUID-VkRenderPassBeginInfo-pNext-02852 ] Object 0: handle = 0xd10d270000000018, type = VK_OBJECT_TYPE_RENDER_PASS; Object 1: handle = 0x27d60e0000000019, type = VK_OBJECT_TYPE_FRAMEBUFFER; | MessageID = 0xdb2c5767 | vkCmdBeginRenderPass(): pRenderPassBegin->renderArea offset.x (0) + extent.width (1280) is greater than framebuffer width (621). The Vulkan spec states: If the pNext chain does not contain VkDeviceGroupRenderPassBeginInfo or its deviceRenderAreaCount member is equal to 0, renderArea.offset.x + renderArea.extent.width must be less than or equal to VkFramebufferCreateInfo::width the framebuffer was created with (https://vulkan.lunarg.com/doc/view/1.3.280.0/linux/1.3-extensions/vkspec.html#VUID-VkRenderPassBeginInfo-pNext-02852)
vkObject(0): ALLOC 0x14e0e4b0 of 424 byte(s)
vkObject(0): ALLOC 0x14e0fe20 of 2552 byte(s)
../../../src/bgfx.cpp(57): ALLOC 0x14e0fdf0 of 32 byte(s)
../../../src/renderer_vk.cpp(3766): ALLOC 0x14e20d20 of 15166 byte(s)
../../../src/renderer_vk.cpp(583): FREE 0x14e0e4b0
../../../src/renderer_vk.cpp(3778): FREE 0x14e20d20
vkCommand(0): ALLOC 0x14d52250 of 24 byte(s)
../../../src/renderer_vk.cpp(583): FREE 0x14d52250
../../../src/renderer_vk.cpp(7969): ASSERT VK_SUCCESS == vkresult -> vkWaitForFences(device, 1, &m_completedFence, 1U, (18446744073709551615UL)); VK error 0xfffffffc: VK_ERROR_DEVICE_LOST
Fatal error: 0x00000000: vkWaitForFences(device, 1, &m_completedFence, 1U, (18446744073709551615UL)); VK error 0xfffffffc: VK_ERROR_DEVICE_LOSTzsh: IOT instruction (core dumped)  ../../.build/linux64_gcc/bin/example-07-callbackDebug

Notice that the validation mechanism is complaining about unmatched resolutions.
Starting in OpenGL works for a bit, but you can see that the resolution is wrong:

image

After about 5, the resolution adjusts and I see (note that the updated resolution happened together with the printing of the line I marked in the yellow rectangle):

image

Afterwards quitting the example app crashes it with segfault:

image


Looking at the code, it seems that this 5 seconds is not random:

bool update() override
{
bool exit = false;
// 5 second 60Hz video
if (m_frame < 300)
{
++m_frame;
}
else
{
m_reset &= ~BGFX_RESET_CAPTURE;
exit = entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState);
imguiBeginFrame(m_mouseState.m_mx
, m_mouseState.m_my
, (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
| (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
, m_mouseState.m_mz
, uint16_t(m_width)
, uint16_t(m_height)
);
showExampleDialog(this);
imguiEndFrame();
}

I believe the problem to be originating from the fact that the app is not processing events, and therefore not seeing the correct frame size yet. I suspect most people never see this issue, as the app probably gets initialized with the correct resolution and then does 5 seconds of not listening to events, but as I'm using a tiling window manager, the app doesn't get to choose it's resolution at startup. Vulkan says:

pRenderPassBegin->renderArea offset.x (0) + extent.width (1280) is greater than framebuffer width (621). The Vulkan spec states: If the pNext chain does not contain VkDeviceGroupRenderPassBeginInfo or its deviceRenderAreaCount member is equal to 0, renderArea.offset.x + renderArea.extent.width must be less than or equal to VkFramebufferCreateInfo::width the framebuffer was created with (https://vulkan.lunarg.com/doc/view/1.3.280.0/linux/1.3-extensions/vkspec.html#VUID-VkRenderPassBeginInfo-pNext-02852)

You can tell that OpenGL just ignores the window size and just does its thing regarding the first 5 seconds. Vulkan crashes badly with a device lost error.

Looking at the recording with OpenGL, I see:

image

So, it's like the backbuffer actually has the full resolution, but is just not rendered too completely.

@mcourteaux mcourteaux changed the title example-07-callback does not work well with a tiling wm. [vulkan] example-07-callback does not work well with a tiling wm. Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant