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

Running this example freezes my pc #1

Open
NotStirred opened this issue Jun 18, 2020 · 9 comments
Open

Running this example freezes my pc #1

NotStirred opened this issue Jun 18, 2020 · 9 comments

Comments

@NotStirred
Copy link

Entire screen freezes, both monitors. Audio still plays, but there is nothing I can do except pull the plug.

It happens when I press some of the UI buttons, such as changing the type of OIT, and something else, but I'm not running it again to check

Specs: i7-8700K
8gb ddr4 ram
gtx 760ti - driver 442.59

@NotStirred
Copy link
Author

Tried with most recent driver, and still the same issue

@NBickford-NV
Copy link
Contributor

Oh gosh, that's not good! I know I've seen an issue with this sample when you toggle vsync on a system that has both an integrated and a discrete GPU (and it looks like this may be related, since the i7-8700K has integrated graphics), but I've never seen it freeze the entire screen yet. I'll hopefully be looking into this next week or so. Thank you!

Nbickford added a commit that referenced this issue Jul 24, 2020
…the bug where on Optimus devices, resizing the window with vsync enabled would cause the image displayed to freeze, while the application would continue to render internally, and hopefully fixes issue #1 as well.

To do this, we reworked how the sample manages the swapchain and blitting to the swapchain to be based on how the `vk_devide_generated_cmds` sample works. Here's a brief high-level overview of the changes this entailed:

- Instead of its own window, Sample now inherits from `AppWindowProfilerVK`.

- The sample no longer draws Dear ImGui data to the swapchain. Instead, it draws it to an intermediate texture, then blits it to the swapchain.

- In particular, this means that framebuffers including swapchain images have been removed. (I wonder if this was the cause of the swapchain bug originally).

- Introduced an additional intermediate image to which the application draws the GUI. Moving an MSAA image to the swapchain now looks like MSAA _SRGB -> 1spp _SRGB -> 1spp no color space -> swapchain.

- Make sure to re-initialize Dear ImGui's pipelines when the application's pipelines are recreated

- Use two or three command buffers per frame instead of just 1; I think this can probably be reduced back down to one or two per frame, but I'm waiting to see if this fixes issue #1 before doing so.

- Use the NVVK_CHECK macro instead of VkResult result = ...; assert(result == VK_SUCCESS).

- Use NVVK's accesses -> stages mapping to reduce the number of arguments required to pass to transitionTo from 4 to 3.

- Move some Dear ImGui logic into Sample::DoGUI

- Remove VK_USE_PLATFORM_WIN32_KHR declarations, since these are handled by shared_sources' CMake script.
@NBickford-NV
Copy link
Contributor

Hi NotStirred,

I've just pushed a large update to this sample that seems to fix some of the swapchain freezing issues we were seeing previously internally (see commit 5ec463c for many more details - my best guess is that the sample was creating framebuffers to draw the GUI directly to the swapchain's images, but this was not being updated correctly when the window resized).

When you get the chance, could you try it out (after saving your work), and see if this fixes the freezing issue you're seeing here?

Thanks!

@NotStirred
Copy link
Author

Unfortunately I no longer have the operating system I was running then, but I after testing, I got a similar "crash" though was able to recover somehow.
After running and changing the sorting method it gave this log:

/home/tom/Documents/dev/cpp/vk_order_independent_transparency/bin_x64/vk_order_independent_transparency.exe
  unhandled argument: /home/tom/Documents/dev/cpp/vk_order_independent_transparency/bin_x64/vk_order_independent_transparency.exe
_______________
Vulkan Version:
 - available:  1.2.141
 - requesting: 1.1.0
______________________
Used Instance Layers :

Used Instance Extensions :
VK_KHR_surface
VK_KHR_xcb_surface
____________________
Compatible Devices :
0: GeForce GTX 760
Physical devices found : 1
________________________
Used Device Extensions :
VK_KHR_sampler_mirror_clamp_to_edge
VK_EXT_descriptor_indexing
VK_KHR_maintenance3
VK_KHR_swapchain

DEVICE: GeForce_GTX_760
vsync: off
framebuffer: 1200 x 1016 (1 msaa)
framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU   8714;
 Timer ClearLock;	 VK      88; CPU      6; (microseconds, avg 9)
 Timer Main;	 VK    7708; CPU      4; (microseconds, avg 9)
 Timer CopyOffscreenToBackBuffer;	 VK     148; CPU      8; (microseconds, avg 9)

framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU      0;
framebuffer: 1200 x 1016 (1 msaa)
framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU   7733;
 Timer ClearLock;	 VK      87; CPU      4; (microseconds, avg 2)
 Timer Main;	 VK    6660; CPU      3; (microseconds, avg 2)
 Timer CopyOffscreenToBackBuffer;	 VK     149; CPU      6; (microseconds, avg 2)

framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU   6489;
 Timer ClearLock;	 VK      88; CPU      5; (microseconds, avg 128)
 Timer Main;	 VK    5525; CPU      3; (microseconds, avg 128)
 Timer CopyOffscreenToBackBuffer;	 VK     150; CPU      7; (microseconds, avg 128)

framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU   5848;
 Timer ClearLock;	 VK      88; CPU      4; (microseconds, avg 40)
 Timer Main;	 VK    4901; CPU      3; (microseconds, avg 40)
 Timer CopyOffscreenToBackBuffer;	 VK     147; CPU      6; (microseconds, avg 40)

Timer null;	 N/A      0; CPU   5868;
 Timer ClearLock;	 VK      88; CPU      5; (microseconds, avg 28)
 Timer Main;	 VK    4897; CPU      3; (microseconds, avg 28)
 Timer CopyOffscreenToBackBuffer;	 VK     149; CPU      7; (microseconds, avg 28)

framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU   3524;
 Timer ClearSimple;	 VK      30; CPU      3; (microseconds, avg 26)
 Timer Main;	 VK    2702; CPU      3; (microseconds, avg 26)
 Timer CopyOffscreenToBackBuffer;	 VK     146; CPU      6; (microseconds, avg 26)

Timer null;	 N/A      0; CPU   3495;
 Timer ClearSimple;	 VK      29; CPU      3; (microseconds, avg 55)
 Timer Main;	 VK    2686; CPU      3; (microseconds, avg 55)
 Timer CopyOffscreenToBackBuffer;	 VK     146; CPU      5; (microseconds, avg 55)

Timer null;	 N/A      0; CPU   3476;
 Timer ClearSimple;	 VK      29; CPU      3; (microseconds, avg 72)
 Timer Main;	 VK    2680; CPU      3; (microseconds, avg 72)
 Timer CopyOffscreenToBackBuffer;	 VK     148; CPU      6; (microseconds, avg 72)
/home/tom/Documents/dev/cpp/vk_order_independent_transparency/bin_x64/vk_order_independent_transparency.exe
  unhandled argument: /home/tom/Documents/dev/cpp/vk_order_independent_transparency/bin_x64/vk_order_independent_transparency.exe
_______________
Vulkan Version:
 - available:  1.2.141
 - requesting: 1.1.0
______________________
Used Instance Layers :

Used Instance Extensions :
VK_KHR_surface
VK_KHR_xcb_surface
____________________
Compatible Devices :
0: GeForce GTX 760
Physical devices found : 1
________________________
Used Device Extensions :
VK_KHR_sampler_mirror_clamp_to_edge
VK_EXT_descriptor_indexing
VK_KHR_maintenance3
VK_KHR_swapchain

DEVICE: GeForce_GTX_760
vsync: off
framebuffer: 1200 x 1016 (1 msaa)
framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU      0;
Timer null;	 N/A      0; CPU   8714;
 Timer ClearLock;	 VK      88; CPU      6; (microseconds, avg 9)
 Timer Main;	 VK    7708; CPU      4; (microseconds, avg 9)
 Timer CopyOffscreenToBackBuffer;	 VK     148; CPU      8; (microseconds, avg 9)

framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU      0;
framebuffer: 1200 x 1016 (1 msaa)
framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU   7733;
 Timer ClearLock;	 VK      87; CPU      4; (microseconds, avg 2)
 Timer Main;	 VK    6660; CPU      3; (microseconds, avg 2)
 Timer CopyOffscreenToBackBuffer;	 VK     149; CPU      6; (microseconds, avg 2)

framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU   6489;
 Timer ClearLock;	 VK      88; CPU      5; (microseconds, avg 128)
 Timer Main;	 VK    5525; CPU      3; (microseconds, avg 128)
 Timer CopyOffscreenToBackBuffer;	 VK     150; CPU      7; (microseconds, avg 128)

framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU   5848;
 Timer ClearLock;	 VK      88; CPU      4; (microseconds, avg 40)
 Timer Main;	 VK    4901; CPU      3; (microseconds, avg 40)
 Timer CopyOffscreenToBackBuffer;	 VK     147; CPU      6; (microseconds, avg 40)

Timer null;	 N/A      0; CPU   5868;
 Timer ClearLock;	 VK      88; CPU      5; (microseconds, avg 28)
 Timer Main;	 VK    4897; CPU      3; (microseconds, avg 28)
 Timer CopyOffscreenToBackBuffer;	 VK     149; CPU      7; (microseconds, avg 28)

framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU   3524;
 Timer ClearSimple;	 VK      30; CPU      3; (microseconds, avg 26)
 Timer Main;	 VK    2702; CPU      3; (microseconds, avg 26)
 Timer CopyOffscreenToBackBuffer;	 VK     146; CPU      6; (microseconds, avg 26)

Timer null;	 N/A      0; CPU   3495;
 Timer ClearSimple;	 VK      29; CPU      3; (microseconds, avg 55)
 Timer Main;	 VK    2686; CPU      3; (microseconds, avg 55)
 Timer CopyOffscreenToBackBuffer;	 VK     146; CPU      5; (microseconds, avg 55)

Timer null;	 N/A      0; CPU   3476;
 Timer ClearSimple;	 VK      29; CPU      3; (microseconds, avg 72)
 Timer Main;	 VK    2680; CPU      3; (microseconds, avg 72)
 Timer CopyOffscreenToBackBuffer;	 VK     148; CPU      6; (microseconds, avg 72)

framebuffer: 1200 x 1016 (1 msaa)
Timer null;	 N/A      0; CPU      0;

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

@NBickford-NV
Copy link
Contributor

OK, interesting! It should definitely be possible to debug this. Are you able to get any information about the stack when it segfaults when running it inside e.g. gdb? Also, in case it's relevant, do you happen to remember which sorting method you changed it to?

@NotStirred
Copy link
Author

I don't think what I'm currently experiencing is the same issue as I was getting before, as it now only happens with linkedlist sorting.
I can't reproduce the crash I got before which makes this whole thing even more strange

@NBickford-NV
Copy link
Contributor

Hmm, that continues to be interesting! What do the errors look like when using linkedlist sorting - and are there any signs in the debugger that anything strange is going on? (I have a suspicion of what it might be, but I'm not sure yet.)

@NBickford-NV
Copy link
Contributor

Hi NotStirred,

I've just added some pipeline barriers that were missing from all of the draw/clear functions; hopefully this fixes the problem that you're seeing (and please let me know if it does)! I should also be double-checking this on Ubuntu 18.04 LTS at the end of the week.

@questgugou
Copy link

thankyou

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

3 participants