godlikepanos / anki-3d-engine

AnKi 3D Engine - Vulkan backend, modern renderer, scripting, physics and more
http://www.anki3d.org
Other
1.35k stars 87 forks source link

Screen Tearing on Ubuntu+GTX760 #59

Closed aabbtree77 closed 4 years ago

aabbtree77 commented 4 years ago

Thank you for your great work, your engine stands out in the open source space as you have a volumetric lighting, the Vulkan backend, 2M lines of 3rd party crapola bundled so well, and you also dissect the rendered frame in your blog, I sure wish you continue well improving this fine code.

However, I have a few minor annoyances, and frankly I am not sure if this my old GTX760 card, or something with an engine. When I run sponza and simple_scene, I get a slightly jerky rendering when rotating a view. It's like some small square block of the screen is being delayed for a split second, sometimes it's the whole line of these blocks, albeit quite narrow, so the effect is rather mild. And this is mostly visible when rotating around z axis that runs vertically, when using the left and right arrow keys. The more sudden rotation, the stronger the discontinuity. The two other rotations run smoother, esp. the rotation with up and down arrow keys, that one is almost as it should be, almost. This takes place in the simple_scene as well, so it's probably not related to the scene's complexity and the 2GB limit of my GPU.

Also in sponza there is one narrow line between two different textures that gets blinking if you come close and look into it from a right angle. So it must be some continuous redrawing with different colors of overlapping textures. This is one is a very minor issue.

Finally, when sponza starts, it does not get lit instantly, but the left side becomes proper after a second or so. This is not a speed of light as it should be :). And when one walks close to the walls they look dark, but upon a slight turn towards the walls they become brighter, this is a bit unphysical, albeit smooth. It's akin to a gradual revealing.

I suspect it might be very hard to fix those things since you do not have my GPU to reproduce the bug which may not even be such a very big bug, esp. if things run smoothly in your case with newer cards, but if you have some suggestions where I should look into the code and what tools to use for GPU debugging on Ubuntu, I would greatly appreciate it. I mostly want to learn how the game engines/Vulkan work and help afterwards hopefully. The most tempting "least resistance" option for me is to head towards UE4, but I like your project a lot too.

godlikepanos commented 4 years ago

Hello and thanks for looking into AnKi.

  1. I don't think I've seen this square block issue you are referring to. It would be useful if I could see a video of it (or maybe a screenshot). Maybe that will give me some ideas.

  2. Haven't seen this line issue as well. Maybe a screenshot will give me some ideas.

  3. This is a "known issue". It's the global illumination probes getting updated. I want to fix that at some point.

If you have the time and provide me with some videos and/or screenshots I could take a look further and hopefully unblock you.

Thanks.

aabbtree77 commented 4 years ago

It's a weird thing, I start the default Ubuntu screen cast to record a video (ctrl+alt+shift+R), run sponza, and the discontinuities disappear. The video gets recorded and no bug there to be seen as it should be. However, when I run sponza alone without that video recorder in the background, the same abrupt lines/small displaced blocks appear for a short time during the rotations. So that video recorder somehow puts a pressure on the card and sponza runs smoothly, but otherwise "the bug" persists on my machine.

So I suspect it's all due to some Ubuntu processes and my driver system rather than a bug in your code. I suggest we close this issue.

BTW, it would be nice to be able to take screen shots directly in a rendering program/record videos since it runs full screen and then any key press just exits with

[W][VK ][7faf41f33b40] Swapchain is out of date. Will wait for the queue and create a new one (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:788 endFrame) [W][VK ][7faf41f33b40] Swapchain is out of date. Will wait for the queue and create a new one (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:728 acquireNextPresentableTexture) [F][VK ][7faf41f33b40] Vulkan function failed (VkResult: VK_ERROR_OUT_OF_DATE_KHR): vkAcquireNextImageKHR(m_device, m_crntSwapchain->m_swapchain, UINT64_MAX, frame.m_acquireSemaphore->getHandle(), fence->getHandle(), &imageIdx) (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:738 acquireNextPresentableTexture) Aborted (core dumped)

So this is not really a bug in your code, I just put it here to show you what happens when I press the screenshot button, or any key more or less except those of the movement control allowed by the program.

I also tried to take some snapshots every ten seconds with a Linux program called scrot by placing this in bash and sourcing it in some background:

while true do scrot -cd 10 done

But I get only black windows, despite that scrot takes the screenshots of the desktop programs than run in some gnome gui modes. Anyway, these seem to be my own problems with Ubuntu, I wish you all the best with your titanic efforts here.

aabbtree77 commented 4 years ago

Let us keep this issue open for a while because this problem persists on my machine and I believe this could be related to the engine code somehow. Setting things up anew with Ubuntu 20.04 and newer drivers did not improve much. Let me explain more this problem.

I now believe that this issue is best described as "screen tearing". It's mild, but the line appears and below/above there is a frame or its part delayed/displaced. It manifests itself also like some pixelization/aliasing/line blinking effect as well, but the latter is usually only for some sharp line artifacts, and here it's tearing more, not just a line.

Everything happens only during the movement/rotations for a short time, but it's annoying and killing quality/experience. It's observable in all the other demos; tearing is less pronounced for physics_playground, but it's also visible when moving around those Blender monkeys fast, slightly less so with the wall. The faster I move/rotate, the more pronounced the effect.

I now see that you have added the screen shot taking ability, but I am not able to capture this as a screen shot because it's a dynamic phenomenon. The frames in motion captured with a screen shot are always alright or blurred very heavily, but never with those splitting lines that I can see during the motion. Please note that I am able to take screen shots with Print Screen, but not with some external program such as Scrot which shows only black images. Also, there is no GUI mode so that I could exit from the full screen and resize windows while the scene is running.

Anyway, I was reading that this could be related to some frame rate mismatch between a monitor and a GPU, people report some issues that are solvable with G-sync and similar tech-based newer monitors, but I believe this is not the case here.

What I have tried is this:

  1. Ran sponza with some other codes based on OpenGL, it's not ideal (stuttering) a bit, but never tearing frames or tiny parts of frames like here.
  2. Ran sponza from Vulkan tests by Sascha Willems. It's not ideal, despite showing 800 fps, as there is a mild stuttering, a very tiny jumping between the frames so to speak, not really an error/glitch/artifact, but not the quality one would expect, lacking some motion smoothness. Anyway, in this case there is no tearing that is observable with anki. Though these examples ran in a GUI mode so to speak, not full screen.

So what could be the culprit here? It's something around anki and GTX760 clearly, could this be some low memory issue here, that 2GB of VRAM is not enough for anki in this scene, or something related to Kepler architecture or some temporal filtering setting? I understand that you do not observe this effect on the newer cards. I have tried enabling FXAA via nvidia-settings "Antialiasing Settings", that did not help. The OpenGL setting "Sync to VBlank" also does not change a thing.

godlikepanos commented 4 years ago

Hi again. Thanks for taking the time to describe your issue in that detail. I believe what you are seeing in AnKi is the fact that AnKi by default has vsync off. To verify this, is it possible to run the sponza sample with the following cmd line arguments -cfg gr_vsync 1?

aabbtree77 commented 4 years ago

That did not help unfortunately. It looks as something related to "vsync" indeed as the effect is identical to the one described here

https://www.sapphirenation.net/enhanced-sync-overview

It is visible only if I move/change viewpoint, the faster the stronger the tearing. It is possible to move very slowly without such an effect at all, but it takes an effort to move so slowly. The tearing is also rather mild, much smaller than in the photos in the link, but it's always moving and annoying enough.

The splitting (horizontal) line is also not necessarily single, there can be a few of them nearby making a narrow band of some kind of shifted squares, and it also always moves from top to bottom. So sponza starts, everything is good. I start moving, the tearing line or a few of them appears at the top and then moves to the middle in a second and to the bottom and then again appears at the top and so on. It's also more pronounced if I turn from left to right rather from top to bottom. The band is not very wide, like a few pixels wide line, but it could be a centimetre or two if I move faster.

After I run the program I can see in the command line some information:

tokyo@tokyo-Z87-DS3H:~/anki/samples/sponza$ /home/tokyo/anki/build/bin/sponza -cfg gr_vsync 1
[I][CORE][7f9ce4fd4180] Using settings dir "/home/tokyo/.anki" (/home/tokyo/anki/src/anki/core/App.cpp:501 initDirs)
[I][CORE][7f9ce4fd4180] Initializing application (version 0.1, optimized, NO dbg symbols, NO extra checks, compiler gcc 9.3.0, build date Aug 13 2020, commit 7ea6e3eb) (/home/tokyo/anki/src/anki/core/App.cpp:336 initInternal)
[I][CORE][7f9ce4fd4180] Number of main threads: 4 (/home/tokyo/anki/src/anki/core/App.cpp:355 initInternal)
[I][CORE][7f9ce4fd4180] Creating SDL window. SDL version 2.0 (/home/tokyo/anki/src/anki/core/NativeWindowSdl.cpp:39 init)
[I][CORE][7f9ce4fd4180] SDL window created (/home/tokyo/anki/src/anki/core/NativeWindowSdl.cpp:105 init)
[I][VK  ][7f9ce4fd4180] Initializing Vulkan backend (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:104 initInternal)
[I][VK  ][7f9ce4fd4180] Found the following instance extensions: (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:277 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_device_group_creation (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_display (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_external_fence_capabilities (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_external_memory_capabilities (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_external_semaphore_capabilities (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_get_display_properties2 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_get_physical_device_properties2 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_get_surface_capabilities2 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_surface (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_surface_protected_capabilities (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_xcb_surface (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_xlib_surface (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_EXT_acquire_xlib_display (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_EXT_debug_report (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_EXT_debug_utils (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_EXT_direct_mode_display (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_EXT_display_surface_counter (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_wayland_surface (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:280 initInstance)
[I][VK  ][7f9ce4fd4180] Will enable the following instance extensions: (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:321 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_surface (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:324 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_xcb_surface (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:324 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_KHR_xlib_surface (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:324 initInstance)
[I][VK  ][7f9ce4fd4180]     VK_EXT_debug_report (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:324 initInstance)
[I][VK  ][7f9ce4fd4180] Number of physical devices: 1 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:373 initInstance)
[I][VK  ][7f9ce4fd4180] GPU is GeForce GTX 760. Vendor identified as NVIDIA (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:404 initInstance)
[I][VK  ][7f9ce4fd4180] Robust buffer access is disabled (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:410 initInstance)
[I][VK  ][7f9ce4fd4180] Number of queue families: 2 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:433 initDevice)
[I][VK  ][7f9ce4fd4180] Found the following device extensions: (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:491 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_8bit_storage (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_16bit_storage (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_bind_memory2 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_create_renderpass2 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_dedicated_allocation (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_depth_stencil_resolve (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_descriptor_update_template (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_device_group (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_draw_indirect_count (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_driver_properties (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_external_fence (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_external_fence_fd (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_external_memory (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_external_memory_fd (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_external_semaphore (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_external_semaphore_fd (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_get_memory_requirements2 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_image_format_list (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_imageless_framebuffer (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_maintenance1 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_maintenance2 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_maintenance3 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_multiview (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_pipeline_executable_properties (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_push_descriptor (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_relaxed_block_layout (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_sampler_mirror_clamp_to_edge (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_sampler_ycbcr_conversion (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_shader_draw_parameters (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_shader_float16_int8 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_shader_float_controls (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_storage_buffer_storage_class (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_swapchain (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_swapchain_mutable_format (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_timeline_semaphore (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_uniform_buffer_standard_layout (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_variable_pointers (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_buffer_device_address (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_calibrated_timestamps (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_conditional_rendering (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_depth_clip_enable (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_depth_range_unrestricted (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_descriptor_indexing (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_discard_rectangles (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_display_control (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_global_priority (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_host_query_reset (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_index_type_uint8 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_inline_uniform_block (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_line_rasterization (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_memory_budget (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_pci_bus_info (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_pipeline_creation_feedback (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_scalar_block_layout (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_separate_stencil_usage (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_shader_demote_to_helper_invocation (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_shader_subgroup_ballot (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_shader_subgroup_vote (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_subgroup_size_control (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_texel_buffer_alignment (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_transform_feedback (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_vertex_attribute_divisor (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_EXT_ycbcr_image_arrays (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_NV_dedicated_allocation (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_NV_dedicated_allocation_image_aliasing (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_NV_device_diagnostic_checkpoints (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_NV_shader_sm_builtins (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_NV_shader_subgroup_partitioned (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_NVX_device_generated_commands (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_NVX_multiview_per_view_attributes (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:494 initDevice)
[I][VK  ][7f9ce4fd4180] Will enable the following device extensions: (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:613 initDevice)
[I][VK  ][7f9ce4fd4180]     VK_KHR_swapchain (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:616 initDevice)
[I][VK  ][7f9ce4fd4180] Created a swapchain. Image count: 3, present mode: 3, size: 1920x1080, vsync: 1 (/home/tokyo/anki/src/anki/gr/vulkan/SwapchainFactory.cpp:172 initInternal)
[I][VK  ][7f9ce4fd4180] Will load 177168 bytes of pipeline cache (/home/tokyo/anki/src/anki/gr/vulkan/PipelineCache.cpp:63 init)
[I][VK  ][7f9ce4fd4180] Vulkan memory info: (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:669 initMemory)
[I][VK  ][7f9ce4fd4180]     Heap 0 size 2147483648 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:672 initMemory)
[I][VK  ][7f9ce4fd4180]     Heap 1 size 12553586688 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:672 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 0 points to heap 1, flags 00000000000000000000000000000000 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 1 points to heap 1, flags 00000000000000000000000000000000 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 2 points to heap 1, flags 00000000000000000000000000000000 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 3 points to heap 1, flags 00000000000000000000000000000000 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 4 points to heap 1, flags 00000000000000000000000000000000 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 5 points to heap 1, flags 00000000000000000000000000000000 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 6 points to heap 1, flags 00000000000000000000000000000000 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 7 points to heap 0, flags 00000000000000000000000000000001 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 8 points to heap 0, flags 00000000000000000000000000000001 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 9 points to heap 1, flags 00000000000000000000000000000110 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180]     Mem type 10 points to heap 1, flags 00000000000000000000000000001110 (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:676 initMemory)
[I][VK  ][7f9ce4fd4180] Initializing memory manager (/home/tokyo/anki/src/anki/gr/vulkan/GpuMemoryManager.cpp:201 init)
[I][VK  ][7f9ce4fd4180]     GPU mem class. Chunk size: 16384, slotSize: 256, allocsPerChunk 64 (/home/tokyo/anki/src/anki/gr/vulkan/GpuMemoryManager.cpp:204 init)
[I][VK  ][7f9ce4fd4180]     GPU mem class. Chunk size: 262144, slotSize: 4096, allocsPerChunk 64 (/home/tokyo/anki/src/anki/gr/vulkan/GpuMemoryManager.cpp:204 init)
[I][VK  ][7f9ce4fd4180]     GPU mem class. Chunk size: 8388608, slotSize: 131072, allocsPerChunk 64 (/home/tokyo/anki/src/anki/gr/vulkan/GpuMemoryManager.cpp:204 init)
[I][VK  ][7f9ce4fd4180]     GPU mem class. Chunk size: 67108864, slotSize: 1048576, allocsPerChunk 64 (/home/tokyo/anki/src/anki/gr/vulkan/GpuMemoryManager.cpp:204 init)
[I][VK  ][7f9ce4fd4180]     GPU mem class. Chunk size: 134217728, slotSize: 16777216, allocsPerChunk 8 (/home/tokyo/anki/src/anki/gr/vulkan/GpuMemoryManager.cpp:204 init)
[I][VK  ][7f9ce4fd4180]     GPU mem class. Chunk size: 268435456, slotSize: 67108864, allocsPerChunk 4 (/home/tokyo/anki/src/anki/gr/vulkan/GpuMemoryManager.cpp:204 init)
[I][VK  ][7f9ce4fd4180]     GPU mem class. Chunk size: 268435456, slotSize: 134217728, allocsPerChunk 2 (/home/tokyo/anki/src/anki/gr/vulkan/GpuMemoryManager.cpp:204 init)
[I][VK  ][7f9ce4fd4180] R8G8B8 Images are not supported. Will workaround this (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:142 initInternal)
[I][VK  ][7f9ce4fd4180] S8 Images are not supported. Will workaround this (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:162 initInternal)
[I][VK  ][7f9ce4fd4180] D24S8 Images are supported (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:188 initInternal)
[I][RSRC][7f9ce4fd4180] Added new data path "/home/tokyo/anki" that contains 19456 files (/home/tokyo/anki/src/anki/resource/ResourceFilesystem.cpp:354 addNewPath)
[I][RSRC][7f9ce4fd4180] Added new data path "/home/tokyo/anki/samples/sponza" that contains 226 files (/home/tokyo/anki/src/anki/resource/ResourceFilesystem.cpp:354 addNewPath)
[I][RSRC][7f9ce4fd4180] Will use 384MB of memory for transfer scratch (/home/tokyo/anki/src/anki/resource/TransferGpuAllocator.cpp:105 init)
[I][CORE][7f9ce4fd4180] Compiling shader programs (/home/tokyo/anki/src/anki/core/App.cpp:708 compileAllShaders)
[I][CORE][7f9ce4fd4180] Compiled 0 shader programs (/home/tokyo/anki/src/anki/core/App.cpp:857 compileAllShaders)
[I][R   ][7f9ce4fd4180] Initializing main renderer (/home/tokyo/anki/src/anki/renderer/MainRenderer.cpp:36 init)
[I][R   ][7f9ce4fd4180] Initializing offscreen renderer. Size 1920x1080 (/home/tokyo/anki/src/anki/renderer/Renderer.cpp:83 initInternal)
[I][R   ][7f9ce4fd4180] Initializing volumetric lighting accumulation. Size 128x104x108 (/home/tokyo/anki/src/anki/renderer/VolumetricLightingAccumulation.cpp:38 init)
[W][RSRC][7f9ce4fd4180] File does not contain the requested compression (/home/tokyo/anki/src/anki/resource/ImageLoader.cpp:407 loadAnkiTexture)
[I][R   ][7f9ce4fd4180] Initializing global illumination (/home/tokyo/anki/src/anki/renderer/GlobalIllumination.cpp:102 init)
[I][R   ][7f9ce4fd4180] Initializing image reflections (/home/tokyo/anki/src/anki/renderer/ProbeReflections.cpp:33 init)
[W][RSRC][7f9ce4fd4180] File does not contain the requested compression (/home/tokyo/anki/src/anki/resource/ImageLoader.cpp:407 loadAnkiTexture)
[I][R   ][7f9ce4fd4180] Initializing g-buffer pass (/home/tokyo/anki/src/anki/renderer/GBuffer.cpp:23 init)
[I][R   ][7f9ce4fd4180] Initializing GBufferPost pass (/home/tokyo/anki/src/anki/renderer/GBufferPost.cpp:31 initInternal)
[I][R   ][7f9ce4fd4180] Initializing shadowmapping (/home/tokyo/anki/src/anki/renderer/ShadowMapping.cpp:48 init)
[I][R   ][7f9ce4fd4180]     Scratch size 3072x512. atlas size 2048x2048 (/home/tokyo/anki/src/anki/renderer/ShadowMapping.cpp:56 init)
[I][R   ][7f9ce4fd4180] Initializing volumetric fog. Size 128x104x108 (/home/tokyo/anki/src/anki/renderer/VolumetricFog.cpp:31 init)
[I][R   ][7f9ce4fd4180] Initializing light stage (/home/tokyo/anki/src/anki/renderer/LightShading.cpp:37 init)
[I][R   ][7f9ce4fd4180] Initializing depth downscale passes (/home/tokyo/anki/src/anki/renderer/DepthDownscale.cpp:78 init)
[I][R   ][7f9ce4fd4180] Initializing HiZ. Mip count 3, last mip size 240x135 (/home/tokyo/anki/src/anki/renderer/DepthDownscale.cpp:31 initInternal)
[I][R   ][7f9ce4fd4180] Initializing forward shading (/home/tokyo/anki/src/anki/renderer/ForwardShading.cpp:25 init)
[I][R   ][7f9ce4fd4180] Initializing lens flare pass (/home/tokyo/anki/src/anki/renderer/LensFlare.cpp:23 init)
[I][R   ][7f9ce4fd4180] Initializing SSAO. Size 960x540 (/home/tokyo/anki/src/anki/renderer/Ssao.cpp:99 init)
[W][RSRC][7f9ce4fd4180] File does not contain the requested compression (/home/tokyo/anki/src/anki/resource/ImageLoader.cpp:407 loadAnkiTexture)
[I][R   ][7f9ce4fd4180] Initializing dowscale blur (passCount: 5) (/home/tokyo/anki/src/anki/renderer/DownscaleBlur.cpp:32 initInternal)
[I][R   ][7f9ce4fd4180] Initializing SSR pass (1920x1080) (/home/tokyo/anki/src/anki/renderer/Ssr.cpp:36 initInternal)
[I][R   ][7f9ce4fd4180] Initializing SSGI pass (/home/tokyo/anki/src/anki/renderer/Ssgi.cpp:39 initInternal)
[I][R   ][7f9ce4fd4180] Initializing tonemapping (input 120x67) (/home/tokyo/anki/src/anki/renderer/Tonemapping.cpp:29 initInternal)
[I][R   ][7f9ce4fd4180] Initializing TAA (/home/tokyo/anki/src/anki/renderer/TemporalAA.cpp:26 init)
[I][R   ][7f9ce4fd4180] Initializing bloom passes (/home/tokyo/anki/src/anki/renderer/Bloom.h:28 init)
[W][RSRC][7f9ce4fd4180] File does not contain the requested compression (/home/tokyo/anki/src/anki/resource/ImageLoader.cpp:407 loadAnkiTexture)
[I][R   ][7f9ce4fd4180] Initializing shadow resolve pass. Size 960x540 (/home/tokyo/anki/src/anki/renderer/ShadowmapsResolve.cpp:36 initInternal)
[I][R   ][7f9ce4fd4180] Main renderer initialized. Rendering size 1920x1080 (/home/tokyo/anki/src/anki/renderer/MainRenderer.cpp:73 init)
[I][SCRI][7f9ce4fd4180] Initializing scripting engine... (/home/tokyo/anki/src/anki/script/ScriptManager.cpp:24 init)
[I][CORE][7f9ce4fd4180] Application initialized (/home/tokyo/anki/src/anki/core/App.cpp:480 initInternal)
[I][CORE][7f9ce4fd4180] Entering main loop (/home/tokyo/anki/src/anki/core/App.cpp:547 mainLoop)
[W][VK  ][7f9ce4fd4180] Swapchain is out of date. Will wait for the queue and create a new one (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:825 endFrame)
[I][VK  ][7f9ce4fd4180] Created a swapchain. Image count: 3, present mode: 3, size: 1920x1080, vsync: 1 (/home/tokyo/anki/src/anki/gr/vulkan/SwapchainFactory.cpp:172 initInternal)
[I][GR  ][7f9ce4fd4180] Cleaned 6 render targets (/home/tokyo/anki/src/anki/gr/RenderGraph.cpp:1390 periodicCleanup)
[I][GR  ][7f9ce4fd4180] Cleaned 7 render targets (/home/tokyo/anki/src/anki/gr/RenderGraph.cpp:1390 periodicCleanup)
[I][SCRI][7f9ce4fd4180] Destroying scripting engine... (/home/tokyo/anki/src/anki/script/ScriptManager.cpp:19 ~ScriptManager)
[I][R   ][7f9ce4fd4180] Destroying main renderer (/home/tokyo/anki/src/anki/renderer/MainRenderer.cpp:29 ~MainRenderer)
[I][VK  ][7f9ce4fd4180] Dumped 177168 bytes of the pipeline cache (/home/tokyo/anki/src/anki/gr/vulkan/PipelineCache.cpp:110 destroyInternal)
[I][N/A ][7f9ce4fd4180] Bye!! (/home/tokyo/anki/samples/sponza/Main.cpp:46 main)
tokyo@tokyo-Z87-DS3H:~/anki/samples/sponza$ 

This takes place in simple_scene too.

godlikepanos commented 4 years ago

That is very weird. When I try vsync I can't spot any screen tearing. But I'm having an AMD card. nVidia doesn't have as good integration as AMD on Linux and vsync is always a pain to make it work. Maybe you can check this guide https://www.techticity.com/howto/how-to-fix-nvidia-vsync-on-linux-with-proprietary-drivers/ or this https://wiki.archlinux.org/index.php/NVIDIA/Troubleshooting

Have you tried another piece of Vulkan content that has vsync enabled? You mentioned Sascha Willems sponza. Is this it https://github.com/SaschaWillems/VulkanSponza/? From what I see you could hack the create() method to enable vsync: https://github.com/SaschaWillems/VulkanSponza/blob/master/base/vulkanswapchain.hpp. Is it possible to try that?

aabbtree77 commented 4 years ago

The links were very useful and this single command essentially solved the problem: nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"

godlikepanos commented 4 years ago

Good to hear. Please let me know if there are other problems.