godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.99k stars 21.16k forks source link

Godot editor hangs on opening a menu on Linux using wayland #78487

Closed somebody1121 closed 1 year ago

somebody1121 commented 1 year ago

Godot version

v4.1.beta.custom_build [d7af287ce]

System information

EndeavourOS Linux, KDE plasma Wayland

Issue description

When opening any menu or hovering above nodes or properties the editor just freezes. The console doesn't print anything when this happens. On X11 works fine. It doesn't matter if its a new project or an old one. On the beta 2 also works as normal, so it's a regression between beta 2 and now.

Steps to reproduce

Using Wayland, create a new project and open any menu and the editor freezes.

Minimal reproduction project

N/A

Riteo commented 1 year ago

Sounds like YAXI (Yet Another XWayland Issue).

Notice that we don't have a native backend yet (see #57025), so you're actually using XWayland, which is known to have issues with Godot.

I'm working on a backend myself but there are a few annoying blockers which are slowly getting solved, especially HiDPI. I'm currently refactoring the whole thing and trying to implement multiple windows again with a new approach.

In the meantime, either switch to an X11 client or use single window mode, which is accessible from the editor's settings or by running the godot binary from the terminal with the --single-window switch.

quinnyo commented 1 year ago

I bisected my way to find that commit 81c3864306 (merged #78235) introduced this.

It seems to be related to the Vulkan API version or the mesa/AMD vulkan driver. On my system I could try three driver/renderer combinations, only the vulkan with the mesa driver case has the issue:

I tested with a AMD Radeon RX 5600 XT on sway, Arch Linux (linux-zen 6.3.9).

_Note: You can select vulkan drivers using the VK_ICD_FILENAME environment variable. e.g. if you have radv and amdvlk installed, to run godot with the amdvlk driver:_ % env VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_icd32.json:/usr/share/vulkan/icd.d/amd_icd64.json ./godot.linuxbsd.etc...

Note: you can run the editor using opengl (by starting the editor with --rendering-driver opengl3) and work on your project even if your project is set to use one of the vulkan rendering methods.

akien-mga commented 1 year ago

CC @jpcerrone @bruvzg @clayjohn

clayjohn commented 1 year ago

@quinnyo Can you please test out a build with the following diff?

diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 3feed2b109..37de978536 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -1817,6 +1817,7 @@ Error VulkanContext::_update_swap_chain(Window *window) {

        if (window->width == 0 || window->height == 0) {
                free(presentModes);
+               window->current_buffer = 0;
                // Likely window minimized, no swapchain created.
                return OK;
        }
quinnyo commented 1 year ago

@clayjohn I tried it, no change. I set a breakpoint on that line (1820) and it never triggered.

Ed: some additional notes/observations:

quinnyo commented 1 year ago

Running with --gpu-validation, I get the following error/s when the issue occurs

ERROR: VALIDATION - Message Id Number: -945112042 | Message Id Name: VUID-VkPresentInfoKHR-pImageIndices-01296
    Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01296 ] Object 0: handle = 0x394d900000004a3b, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0xc7aabc16 | vkQueuePresentKHR: pSwapchains[1] image at index 0 was not acquired from the swapchain. The Vulkan spec states: Each element of pImageIndices must be the index of a presentable image acquired from the swapchain specified by the corresponding element of the pSwapchains array, and the presented image subresource must be in the VK_IMAGE_LAYOUT_PRESENT_SRC_KHR layout at the time the operation is executed on a VkDevice (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-VkPresentInfoKHR-pImageIndices-01296)
    Objects - 1
        Object[0] - VK_OBJECT_TYPE_SWAPCHAIN_KHR, Handle 4129114763043031611
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)
ERROR: VALIDATION - Message Id Number: -1391585802 | Message Id Name: VUID-vkAcquireNextImageKHR-surface-07783
    Validation Error: [ VUID-vkAcquireNextImageKHR-surface-07783 ] Object 0: handle = 0x394d900000004a3b, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0xad0e15f6 | vkAcquireNextImageKHR: Application has already previously acquired 4294967295 images from swapchain. Only 1 is available to be acquired using a timeout of UINT64_MAX (given the swapchain has 3, and VkSurfaceCapabilitiesKHR::minImageCount is 3). The Vulkan spec states: If forward progress cannot be guaranteed for the surface used to create the swapchain member of pAcquireInfo, the timeout member of pAcquireInfo must not be UINT64_MAX (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-surface-07783)
    Objects - 1
        Object[0] - VK_OBJECT_TYPE_SWAPCHAIN_KHR, Handle 4129114763043031611
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

The full log for reference:

Complete log

``` Godot Engine v4.1.rc.custom_build.950f4c3b4 - https://godotengine.org TextServer: Added interface "Dummy" TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)" Xshape 1.1 detected. Xinerama 1.1 detected. Xrandr 1.6 detected. Xrender 0.11 detected. Xinput 2.2 detected. XInput: Refreshing devices. XInput: Absolute pointing device: xwayland-pointer:42 XInput: No touch devices found. VULKAN: Found instance extension VK_KHR_device_group_creation VULKAN: Found instance extension VK_KHR_display VULKAN: Found instance extension VK_KHR_external_fence_capabilities VULKAN: Found instance extension VK_KHR_external_memory_capabilities VULKAN: Found instance extension VK_KHR_external_semaphore_capabilities VULKAN: Found instance extension VK_KHR_get_display_properties2 VULKAN: Found instance extension VK_KHR_get_physical_device_properties2 VULKAN: Found instance extension VK_KHR_get_surface_capabilities2 VULKAN: Found instance extension VK_KHR_surface VULKAN: Found instance extension VK_KHR_surface_protected_capabilities VULKAN: Found instance extension VK_KHR_wayland_surface VULKAN: Found instance extension VK_KHR_xcb_surface VULKAN: Found instance extension VK_KHR_xlib_surface VULKAN: Found instance extension VK_EXT_acquire_drm_display VULKAN: Found instance extension VK_EXT_acquire_xlib_display VULKAN: Found instance extension VK_EXT_debug_report VULKAN: Found instance extension VK_EXT_debug_utils VULKAN: Found instance extension VK_EXT_direct_mode_display VULKAN: Found instance extension VK_EXT_display_surface_counter VULKAN: Found instance extension VK_EXT_surface_maintenance1 VULKAN: Found instance extension VK_EXT_swapchain_colorspace VULKAN: Found instance extension VK_KHR_portability_enumeration VULKAN: Found instance extension VK_LUNARG_direct_driver_loading Vulkan devices: #0: AMD AMD Radeon RX 5600 XT (RADV NAVI10) - Supported, Discrete Vulkan API 1.3.246 - Forward+ - Using Vulkan Device #0: AMD - AMD Radeon RX 5600 XT (RADV NAVI10) VULKAN: Found device extension VK_KHR_8bit_storage VULKAN: Found device extension VK_KHR_16bit_storage VULKAN: Found device extension VK_KHR_bind_memory2 VULKAN: Found device extension VK_KHR_buffer_device_address VULKAN: Found device extension VK_KHR_copy_commands2 VULKAN: Found device extension VK_KHR_create_renderpass2 VULKAN: Found device extension VK_KHR_dedicated_allocation VULKAN: Found device extension VK_KHR_deferred_host_operations VULKAN: Found device extension VK_KHR_depth_stencil_resolve VULKAN: Found device extension VK_KHR_descriptor_update_template VULKAN: Found device extension VK_KHR_device_group VULKAN: Found device extension VK_KHR_draw_indirect_count VULKAN: Found device extension VK_KHR_driver_properties VULKAN: Found device extension VK_KHR_dynamic_rendering VULKAN: Found device extension VK_KHR_external_fence VULKAN: Found device extension VK_KHR_external_fence_fd VULKAN: Found device extension VK_KHR_external_memory VULKAN: Found device extension VK_KHR_external_memory_fd VULKAN: Found device extension VK_KHR_external_semaphore VULKAN: Found device extension VK_KHR_external_semaphore_fd VULKAN: Found device extension VK_KHR_format_feature_flags2 VULKAN: Found device extension VK_KHR_get_memory_requirements2 VULKAN: Found device extension VK_KHR_global_priority VULKAN: Found device extension VK_KHR_image_format_list VULKAN: Found device extension VK_KHR_imageless_framebuffer VULKAN: Found device extension VK_KHR_incremental_present VULKAN: Found device extension VK_KHR_maintenance1 VULKAN: Found device extension VK_KHR_maintenance2 VULKAN: Found device extension VK_KHR_maintenance3 VULKAN: Found device extension VK_KHR_maintenance4 VULKAN: Found device extension VK_KHR_map_memory2 VULKAN: Found device extension VK_KHR_multiview VULKAN: Found device extension VK_KHR_pipeline_executable_properties VULKAN: Found device extension VK_KHR_pipeline_library VULKAN: Found device extension VK_KHR_present_id VULKAN: Found device extension VK_KHR_present_wait VULKAN: Found device extension VK_KHR_push_descriptor VULKAN: Found device extension VK_KHR_relaxed_block_layout VULKAN: Found device extension VK_KHR_sampler_mirror_clamp_to_edge VULKAN: Found device extension VK_KHR_sampler_ycbcr_conversion VULKAN: Found device extension VK_KHR_separate_depth_stencil_layouts VULKAN: Found device extension VK_KHR_shader_atomic_int64 VULKAN: Found device extension VK_KHR_shader_clock VULKAN: Found device extension VK_KHR_shader_draw_parameters VULKAN: Found device extension VK_KHR_shader_float16_int8 VULKAN: Found device extension VK_KHR_shader_float_controls VULKAN: Found device extension VK_KHR_shader_integer_dot_product VULKAN: Found device extension VK_KHR_shader_non_semantic_info VULKAN: Found device extension VK_KHR_shader_subgroup_extended_types VULKAN: Found device extension VK_KHR_shader_subgroup_uniform_control_flow VULKAN: Found device extension VK_KHR_shader_terminate_invocation VULKAN: Found device extension VK_KHR_spirv_1_4 VULKAN: Found device extension VK_KHR_storage_buffer_storage_class VULKAN: Found device extension VK_KHR_swapchain VULKAN: Found device extension VK_KHR_swapchain_mutable_format VULKAN: Found device extension VK_KHR_synchronization2 VULKAN: Found device extension VK_KHR_timeline_semaphore VULKAN: Found device extension VK_KHR_uniform_buffer_standard_layout VULKAN: Found device extension VK_KHR_variable_pointers VULKAN: Found device extension VK_KHR_vulkan_memory_model VULKAN: Found device extension VK_KHR_workgroup_memory_explicit_layout VULKAN: Found device extension VK_KHR_zero_initialize_workgroup_memory VULKAN: Found device extension VK_EXT_4444_formats VULKAN: Found device extension VK_EXT_attachment_feedback_loop_layout VULKAN: Found device extension VK_EXT_border_color_swizzle VULKAN: Found device extension VK_EXT_buffer_device_address VULKAN: Found device extension VK_EXT_calibrated_timestamps VULKAN: Found device extension VK_EXT_color_write_enable VULKAN: Found device extension VK_EXT_conditional_rendering VULKAN: Found device extension VK_EXT_conservative_rasterization VULKAN: Found device extension VK_EXT_custom_border_color VULKAN: Found device extension VK_EXT_depth_clip_control VULKAN: Found device extension VK_EXT_depth_clip_enable VULKAN: Found device extension VK_EXT_depth_range_unrestricted VULKAN: Found device extension VK_EXT_descriptor_buffer VULKAN: Found device extension VK_EXT_descriptor_indexing VULKAN: Found device extension VK_EXT_discard_rectangles VULKAN: Found device extension VK_EXT_display_control VULKAN: Found device extension VK_EXT_extended_dynamic_state VULKAN: Found device extension VK_EXT_extended_dynamic_state2 VULKAN: Found device extension VK_EXT_extended_dynamic_state3 VULKAN: Found device extension VK_EXT_external_memory_dma_buf VULKAN: Found device extension VK_EXT_external_memory_host VULKAN: Found device extension VK_EXT_global_priority VULKAN: Found device extension VK_EXT_global_priority_query VULKAN: Found device extension VK_EXT_graphics_pipeline_library VULKAN: Found device extension VK_EXT_host_query_reset VULKAN: Found device extension VK_EXT_image_2d_view_of_3d VULKAN: Found device extension VK_EXT_image_drm_format_modifier VULKAN: Found device extension VK_EXT_image_robustness VULKAN: Found device extension VK_EXT_image_sliced_view_of_3d VULKAN: Found device extension VK_EXT_image_view_min_lod VULKAN: Found device extension VK_EXT_index_type_uint8 VULKAN: Found device extension VK_EXT_inline_uniform_block VULKAN: Found device extension VK_EXT_line_rasterization VULKAN: Found device extension VK_EXT_load_store_op_none VULKAN: Found device extension VK_EXT_memory_budget VULKAN: Found device extension VK_EXT_memory_priority VULKAN: Found device extension VK_EXT_multi_draw VULKAN: Found device extension VK_EXT_mutable_descriptor_type VULKAN: Found device extension VK_EXT_non_seamless_cube_map VULKAN: Found device extension VK_EXT_pci_bus_info VULKAN: Found device extension VK_EXT_physical_device_drm VULKAN: Found device extension VK_EXT_pipeline_creation_cache_control VULKAN: Found device extension VK_EXT_pipeline_creation_feedback VULKAN: Found device extension VK_EXT_post_depth_coverage VULKAN: Found device extension VK_EXT_primitive_topology_list_restart VULKAN: Found device extension VK_EXT_primitives_generated_query VULKAN: Found device extension VK_EXT_private_data VULKAN: Found device extension VK_EXT_provoking_vertex VULKAN: Found device extension VK_EXT_queue_family_foreign VULKAN: Found device extension VK_EXT_robustness2 VULKAN: Found device extension VK_EXT_sampler_filter_minmax VULKAN: Found device extension VK_EXT_scalar_block_layout VULKAN: Found device extension VK_EXT_separate_stencil_usage VULKAN: Found device extension VK_EXT_shader_atomic_float VULKAN: Found device extension VK_EXT_shader_atomic_float2 VULKAN: Found device extension VK_EXT_shader_demote_to_helper_invocation VULKAN: Found device extension VK_EXT_shader_image_atomic_int64 VULKAN: Found device extension VK_EXT_shader_module_identifier VULKAN: Found device extension VK_EXT_shader_stencil_export VULKAN: Found device extension VK_EXT_shader_subgroup_ballot VULKAN: Found device extension VK_EXT_shader_subgroup_vote VULKAN: Found device extension VK_EXT_shader_viewport_index_layer VULKAN: Found device extension VK_EXT_subgroup_size_control VULKAN: Found device extension VK_EXT_swapchain_maintenance1 VULKAN: Found device extension VK_EXT_texel_buffer_alignment VULKAN: Found device extension VK_EXT_transform_feedback VULKAN: Found device extension VK_EXT_vertex_attribute_divisor VULKAN: Found device extension VK_EXT_vertex_input_dynamic_state VULKAN: Found device extension VK_EXT_ycbcr_image_arrays VULKAN: Found device extension VK_AMD_buffer_marker VULKAN: Found device extension VK_AMD_device_coherent_memory VULKAN: Found device extension VK_AMD_draw_indirect_count VULKAN: Found device extension VK_AMD_gcn_shader VULKAN: Found device extension VK_AMD_gpu_shader_half_float VULKAN: Found device extension VK_AMD_gpu_shader_int16 VULKAN: Found device extension VK_AMD_memory_overallocation_behavior VULKAN: Found device extension VK_AMD_mixed_attachment_samples VULKAN: Found device extension VK_AMD_shader_ballot VULKAN: Found device extension VK_AMD_shader_core_properties VULKAN: Found device extension VK_AMD_shader_core_properties2 VULKAN: Found device extension VK_AMD_shader_early_and_late_fragment_tests VULKAN: Found device extension VK_AMD_shader_explicit_vertex_parameter VULKAN: Found device extension VK_AMD_shader_fragment_mask VULKAN: Found device extension VK_AMD_shader_image_load_store_lod VULKAN: Found device extension VK_AMD_shader_trinary_minmax VULKAN: Found device extension VK_AMD_texture_gather_bias_lod VULKAN: Found device extension VK_GOOGLE_decorate_string VULKAN: Found device extension VK_GOOGLE_hlsl_functionality1 VULKAN: Found device extension VK_GOOGLE_user_type VULKAN: Found device extension VK_INTEL_shader_integer_functions2 VULKAN: Found device extension VK_NV_compute_shader_derivatives VULKAN: Found device extension VK_VALVE_mutable_descriptor_type Optional extension VK_KHR_fragment_shading_rate not found Optional extension VK_GOOGLE_display_timing not found - Vulkan Variable Rate Shading not supported - Vulkan multiview supported: max view count: 8 max instances: 2147483647 - Vulkan subgroup: size: 64 stages: STAGE_VERTEX, STAGE_TESSELLATION_CONTROL, STAGE_TESSELLATION_EVALUATION, STAGE_GEOMETRY, STAGE_FRAGMENT, STAGE_COMPUTE supported ops: FEATURE_BASIC, FEATURE_VOTE, FEATURE_ARITHMETIC, FEATURE_BALLOT, FEATURE_SHUFFLE, FEATURE_SHUFFLE_RELATIVE, FEATURE_CLUSTERED, FEATURE_QUAD quad operations in all stages WARNING: Invalid pipelines cache header. at: _load_pipeline_cache (drivers/vulkan/rendering_device_vulkan.cpp:9026) Startup PSO cache (0.0 MiB) ScreenSaver: DBus 1.14.8 detected. PortalDesktop: DBus 1.14.8 detected. Using "default" pen tablet driver... Creating VMA small objects pool for memory type index 0 Shader 'CanvasSdfShaderRD' SHA256: 7aeb3bf403a8b7a86002d9d47cf009f0229259f364208efb4c5c908608508d5a Shader 'SkeletonShaderRD' SHA256: 7c519f5cb496231f54c2f82398a3ae1e4869754c79d1a03a0658929ee1162b5e Shader 'SortShaderRD' SHA256: b32ca4bbc3b3460961c705bcb68909ad8fbe95c5724419d66285834263bd42a2 Shader 'ParticlesShaderRD' SHA256: cb362da8a6d505df2e157f40cf3abcb9bdc05e5d99fbba2aebfa6ca71dd216e0 Shader 'ParticlesCopyShaderRD' SHA256: 7c5d6dd1648416520eef70115b3e6f2a4e73d84f670f1cbdff0f45ee0bc1ed72 Shader 'CanvasShaderRD' SHA256: 8ff332bb289b4c872009a3e67eff7b1b09c48afa85c765efde3e067fc018d037 Shader 'CanvasOcclusionShaderRD' SHA256: 469d4156ee8ec2b2fed1d4c39587973cba100de3c56839a1c8b31bce6e1d1d08 Shader 'ClusterRenderShaderRD' SHA256: f6a2cdb22af1158f53d67eca8e75a67c34771a3e07d51dd5a09931f539e67394 Shader 'ClusterStoreShaderRD' SHA256: 90403dda023ec781c0b7b6e4969bd3bb93e773accd5b84779534b32ff4556f22 Shader 'ClusterDebugShaderRD' SHA256: 5cdfedcfc134bcf0f3524463cf2160f134e43fbd6a84b2b03992e98878421982 Shader 'SceneForwardClusteredShaderRD' SHA256: 2cf4946b988f7acd773e715bb79ffd78644fa8e201872ba8c024b05d4aae9f93 Shader 'ResolveShaderRD' SHA256: 54b654e979aac0477a036b54c8e2fdeb5ba19a00e82bd56d105d601fb290777c Shader 'TaaResolveShaderRD' SHA256: cde1ad6e862dd270e911d059f8490719d84799ccdb4f7d7d35a4f0bb12a165cf Shader 'SsEffectsDownsampleShaderRD' SHA256: bea8043f02bab15958e21ac50762f3949fa7f749c4049efa5694f1b5b4eb24bf Shader 'SsilShaderRD' SHA256: 3864dd71f81cf5bb9b0f716bc520ffe0c34abd1d6ec07687a245176a183366f9 Shader 'SsilImportanceMapShaderRD' SHA256: 94a0c514a37963b2c706b408a00a78660f6cecb6e8f55aee511100839ea11302 Shader 'SsilBlurShaderRD' SHA256: ee67ed2c94e20284f3bf0b9028329c5699ca08914bd3a803cb63f0de7bc9ba52 Shader 'SsilInterleaveShaderRD' SHA256: 891de9ec656d5fdfab02ed51fcfe61f7662206b409c04159d4323dc15f895c5b Shader 'SsaoShaderRD' SHA256: f538caca7b9ba38a8b168668e82addbb6cd28cb83aaf0f949411e4fb71ec7cc4 Shader 'SsaoImportanceMapShaderRD' SHA256: efc9af8ed33a87d3860543fd2d364aedbd066fa8c5809956edc5909a80eaebaf Shader 'SsaoBlurShaderRD' SHA256: 30cfb9b4a443e03573cddd95546d829db1234f7922cd9e0af689518cce37b590 Shader 'SsaoInterleaveShaderRD' SHA256: d2cd03d33f53597abb42bcdb826e39ce855dce165e4183d0a159015b52ee16c0 Shader 'ScreenSpaceReflectionScaleShaderRD' SHA256: b032d2fe4c8726be9b2af8dcbe0ea6b8034a2bf9cb1e3e1a9934b2306b81ca5b Shader 'ScreenSpaceReflectionShaderRD' SHA256: 9d5cd75c8907102a4f334685e77eecd943192290d3af618aa57efeed07615ba1 Shader 'ScreenSpaceReflectionFilterShaderRD' SHA256: d612281d03802bae617605deac94d303d14f5131d29fbaa05f697b569a548ce9 Shader 'SubsurfaceScatteringShaderRD' SHA256: 754d417ed6ef3a51b7b3ca261b5c71466fa19196d4759af7583345d92d7a592f Shader 'SkyShaderRD' SHA256: afb34b55177802725f48c7a53ba876b3cca7a8cfbf4ead95aefbd16ed83f68e6 Shader 'VoxelGiShaderRD' SHA256: 5c40511a11d154b3b7ef2d5ed4df157b90d88a1697854b852fa88a3c58eb70ab Shader 'VoxelGiDebugShaderRD' SHA256: 191fda06b0c0398db6300b46e866712fb2a22db7f81c902882742624aeca7fef Shader 'SdfgiPreprocessShaderRD' SHA256: e706b0548edfd19d8aaffa8cb604b02b4d32faa37cb5f2eeedb84f9a1ed7c395 Shader 'SdfgiDirectLightShaderRD' SHA256: d5e552d22ffaa205f63dba2b9c031cdaa19432c487f2b711a0d8e2d47e42806d Shader 'SdfgiIntegrateShaderRD' SHA256: 6e452ae061a267254d0f83131c4565872b9d667b7a2f6962eb15994d9f83191d Shader 'GiShaderRD' SHA256: e1159671a506923e99a8f1f81956c6a964d9500ca615628bb34059e96a6a3288 Shader 'SdfgiDebugShaderRD' SHA256: 8459bdc9419a337314490fe56ff0609cb34f6154477c29a5d8aa35148041b226 Shader 'SdfgiDebugProbesShaderRD' SHA256: ed149cb9a3670710fa4e11da614639d8bf6fa36ab6f95bb3238b78e3960d7aaa Shader 'VolumetricFogShaderRD' SHA256: 6ee03f95c0edc1d8f5903c5ab0cd655479e35fca38a96dc0437edeca0e0c12a5 Shader 'VolumetricFogProcessShaderRD' SHA256: bce32ea074f264e989ad4e7da2ca16647f8f5bde8126563451124da95500b2c2 Shader 'BokehDofShaderRD' SHA256: 991648340360e599716c7b1da2458afcfdb327ac94a96a85d7c7a10d81997b13 Shader 'CopyShaderRD' SHA256: f11e0191dde2cae4ee7d1bf0c16732136925327aed4650346f8196fae8ff9084 Shader 'CopyToFbShaderRD' SHA256: cef72d536a32496a26de02b7284db0bc41e4881d4d8fd024a65d4b2b3277f019 Shader 'CubeToDpShaderRD' SHA256: 0f7b081d5a945d793140b19004c8ac9f6195967f419234f7e6ea4d4224747fad Shader 'CubemapDownsamplerShaderRD' SHA256: ad5772f8195e9a195632fd3105e61730703d8521e4e6def4df96ca617b5a7f8a Shader 'CubemapFilterShaderRD' SHA256: acb9e63d30d146c210c152935c1c5ac72b2d614260b828db9c5e9333ecf8cc92 Shader 'CubemapRoughnessShaderRD' SHA256: e1c58761755ad15d33fcf90ba8608dd0d48c9dcfbc125a1534a67207a9285ce6 Shader 'SpecularMergeShaderRD' SHA256: 0b4d619b53245ee9e1468b4e28a3f64d7bb09d433dac0ed3f1fd4a0db4b16148 Shader 'LuminanceReduceShaderRD' SHA256: 2003431526080cdd936b240c450e740ddde08ec96157f2e9e76aa9734d881910 Shader 'TonemapShaderRD' SHA256: 8170790c7186f7ed8851aad9c53f4600e7dee3b1c9be18b21d982f8b52478d75 Shader 'FsrUpscaleShaderRD' SHA256: 22851d531b9d77fcde044ff845626afd72b2bcf5a6cdf3b63e3ae429954f0823 Shader 'BlitShaderRD' SHA256: 673c3d87a2195ecb28339da46625b1138a2cb4cbdfb0587fa42ad0d9ed56acad JoypadLinux: udev enabled and loaded successfully. PulseAudio 16.1.0 detected. PulseAudio: context other PulseAudio: context other PulseAudio: context other PulseAudio: context ready PulseAudio: Detecting channels for device: real-speakers PulseAudio: detected 2 output channels PulseAudio: audio buffer frames: 512 calculated output latency: 11ms TextServer: Primary interface set to: "ICU / HarfBuzz / Graphite (Built-in)". CORE API HASH: 970884900 EDITOR API HASH: 2187630558 Regenerating editor help cache Class 'EditorPropertyNameProcessor' is not exposed, skipping. Class 'FramebufferCacheRD' is not exposed, skipping. Class 'GDScriptEditorTranslationParserPlugin' is not exposed, skipping. Class 'GDScriptNativeClass' is not exposed, skipping. Class 'GLTFDocumentExtensionPhysics' is not exposed, skipping. Class 'GLTFDocumentExtensionTextureWebP' is not exposed, skipping. Class 'GodotPhysicsServer2D' is not exposed, skipping. Class 'GodotPhysicsServer3D' is not exposed, skipping. Class 'IPUnix' is not exposed, skipping. Class 'MovieWriterMJPEG' is not exposed, skipping. Class 'MovieWriterPNGWAV' is not exposed, skipping. Class 'ResourceFormatImporterSaver' is not exposed, skipping. Class 'ResourceImporterMP3' is not exposed, skipping. Class 'ResourceImporterOggVorbis' is not exposed, skipping. Class 'SceneCacheInterface' is not exposed, skipping. Class 'SceneRPCInterface' is not exposed, skipping. Class 'SceneReplicationInterface' is not exposed, skipping. Class 'UniformSetCacheRD' is not exposed, skipping. EditorSettings: Load OK! Loaded system CA certificates Creating VMA small objects pool for memory type index 5 EditorSettings: Save OK! XInput: Refreshing devices. XInput: Absolute pointing device: xwayland-pointer:42 XInput: No touch devices found. Vulkan: Early suboptimal swapchain, recreating. ERROR: VALIDATION - Message Id Number: -945112042 | Message Id Name: VUID-VkPresentInfoKHR-pImageIndices-01296 Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01296 ] Object 0: handle = 0x394d900000004a3b, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0xc7aabc16 | vkQueuePresentKHR: pSwapchains[1] image at index 0 was not acquired from the swapchain. The Vulkan spec states: Each element of pImageIndices must be the index of a presentable image acquired from the swapchain specified by the corresponding element of the pSwapchains array, and the presented image subresource must be in the VK_IMAGE_LAYOUT_PRESENT_SRC_KHR layout at the time the operation is executed on a VkDevice (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-VkPresentInfoKHR-pImageIndices-01296) Objects - 1 Object[0] - VK_OBJECT_TYPE_SWAPCHAIN_KHR, Handle 4129114763043031611 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267) ERROR: VALIDATION - Message Id Number: -1391585802 | Message Id Name: VUID-vkAcquireNextImageKHR-surface-07783 Validation Error: [ VUID-vkAcquireNextImageKHR-surface-07783 ] Object 0: handle = 0x394d900000004a3b, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0xad0e15f6 | vkAcquireNextImageKHR: Application has already previously acquired 4294967295 images from swapchain. Only 1 is available to be acquired using a timeout of UINT64_MAX (given the swapchain has 3, and VkSurfaceCapabilitiesKHR::minImageCount is 3). The Vulkan spec states: If forward progress cannot be guaranteed for the surface used to create the swapchain member of pAcquireInfo, the timeout member of pAcquireInfo must not be UINT64_MAX (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-surface-07783) Objects - 1 Object[0] - VK_OBJECT_TYPE_SWAPCHAIN_KHR, Handle 4129114763043031611 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267) ```

Riteo commented 1 year ago

BTW @clayjohn just for your interest, @quinnyo is right, null extents aren't supported with Mesa's Wayland WSI and from what I got told neither the X11 WSI.

quinnyo commented 1 year ago

Just adding a note to make it unambiguous that I have only tested/reproduced this on a system configured as I described above. That is to say I have not confirmed that this is (or is not) wayland/xwayland specific, as I have not tested it on e.g. Xorg.

clayjohn commented 1 year ago

BTW @clayjohn just for your interest, @quinnyo is right, null extents aren't supported with Mesa's Wayland WSI and from what I got told neither the X11 WSI.

Are you saying the issue is relating to creating a swapchain with null extents? Because that part of the codebase didn't change in https://github.com/godotengine/godot/commit/81c386430658ea738c0738ff8a66230f1bdba30e. The only difference with https://github.com/godotengine/godot/commit/81c386430658ea738c0738ff8a66230f1bdba30e is that we skip the call to fpAcquireNextImageKHR() after recreating the swapchain.

@quinnyo Thanks for testing. Can you try again with the following diff instead?

diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 3feed2b109..1b66a2c410 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -2159,6 +2159,8 @@ Error VulkanContext::_update_swap_chain(Window *window) {

        // Reset current buffer.
        window->current_buffer = 0;
+       fpAcquireNextImageKHR(device, w->swapchain, UINT64_MAX,
+                       w->image_acquired_semaphores[frame_index], VK_NULL_HANDLE, &w->current_buffer);

        return OK;
 }
Riteo commented 1 year ago

@clayjohn

Are you saying the issue is relating to creating a swapchain with null extents?

Not idea. I've seen that you sent a patch changing that part of the code though and wanted to let you know that it will never be called.

quinnyo commented 1 year ago

@clayjohn with the w changed to window that patch does seem to fix it (I can open and navigate/use popup menus) but has also introduced there are also endless vulkan validation errors:

ed: can confirm I am seeing no Vulkan validation errors without the patch on c83f912bcb (except for when opening a menu, as mentioned previously)

Initial errors when editor opens

ERROR: VALIDATION - Message Id Number: 1629488792 | Message Id Name: VUID-vkAcquireNextImageKHR-semaphore-parameter Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-parameter ] Object 0: handle = 0x563fd309d570, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x61200698 | Invalid VkSemaphore Object 0x563fd309d570. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE, semaphore must be a valid VkSemaphore handle (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-parameter) Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 94832123565424 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

ERROR: VALIDATION - Message Id Number: 1567320034 | Message Id Name: UNASSIGNED-Threading-Info Validation Error: [ UNASSIGNED-Threading-Info ] Object 0: handle = 0x563fd309d570, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0x5d6b67e2 | Couldn't find VkSemaphore Object 0x563fd309d570. This should not happen and may indicate a bug in the application. Objects - 1 Object[0] - VK_OBJECT_TYPE_SEMAPHORE, Handle 94832123565424 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

ERROR: [snip - duplicate of prev]

[snip - shader hashes, pulseaudio, etc.]

ERROR: VALIDATION - Message Id Number: -1391585802 | Message Id Name: VUID-vkAcquireNextImageKHR-surface-07783 Validation Error: [ VUID-vkAcquireNextImageKHR-surface-07783 ] Object 0: handle = 0xcb3ee80000000007, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0xad0e15f6 | vkAcquireNextImageKHR: Application has already previously acquired 1 image from swapchain. Only 1 is available to be acquired using a timeout of UINT64_MAX (given the swapchain has 3, and VkSurfaceCapabilitiesKHR::minImageCount is 3). The Vulkan spec states: If forward progress cannot be guaranteed for the surface used to create the swapchain member of pAcquireInfo, the timeout member of pAcquireInfo must not be UINT64_MAX (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-surface-07783) Objects - 1 Object[0] - VK_OBJECT_TYPE_SWAPCHAIN_KHR, Handle -3801345948756475897 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

[snip - godot --verbose is verbose godot]

ERROR: VALIDATION - Message Id Number: -370888023 | Message Id Name: VUID-vkAcquireNextImageKHR-semaphore-01286 Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01286 ] Object 0: handle = 0xd175b40000000013, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0xe9e4b2a9 | vkAcquireNextImageKHR: Semaphore must not be currently signaled. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE it must be unsignaled (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-01286) Objects - 1 Object[0] - VK_OBJECT_TYPE_SEMAPHORE, Handle -3353576435414466541 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

ERROR: VALIDATION - Message Id Number: -370888023 | Message Id Name: VUID-vkAcquireNextImageKHR-semaphore-01286 Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01286 ] Object 0: handle = 0xd175b40000000013, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0xe9e4b2a9 | vkAcquireNextImageKHR: Semaphore must not be currently signaled. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE it must be unsignaled (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-01286) Objects - 1 Object[0] - VK_OBJECT_TYPE_SEMAPHORE, Handle -3353576435414466541 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

ERROR: VALIDATION - Message Id Number: -1391585802 | Message Id Name: VUID-vkAcquireNextImageKHR-surface-07783 Validation Error: [ VUID-vkAcquireNextImageKHR-surface-07783 ] Object 0: handle = 0xa962d0000003b2a, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0xad0e15f6 | vkAcquireNextImageKHR: Application has already previously acquired 1 image from swapchain. Only 1 is available to be acquired using a timeout of UINT64_MAX (given the swapchain has 3, and VkSurfaceCapabilitiesKHR::minImageCount is 3). The Vulkan spec states: If forward progress cannot be guaranteed for the surface used to create the swapchain member of pAcquireInfo, the timeout member of pAcquireInfo must not be UINT64_MAX (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-surface-07783) Objects - 1 Object[0] - VK_OBJECT_TYPE_SWAPCHAIN_KHR, Handle 762846664909142826 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

endless error (repeats forever)

ERROR: VALIDATION - Message Id Number: -1391585802 | Message Id Name: VUID-vkAcquireNextImageKHR-surface-07783 Validation Error: [ VUID-vkAcquireNextImageKHR-surface-07783 ] Object 0: handle = 0xa962d0000003b2a, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0xad0e15f6 | vkAcquireNextImageKHR: Application has already previously acquired 1 image from swapchain. Only 1 is available to be acquired using a timeout of UINT64_MAX (given the swapchain has 3, and VkSurfaceCapabilitiesKHR::minImageCount is 3). The Vulkan spec states: If forward progress cannot be guaranteed for the surface used to create the swapchain member of pAcquireInfo, the timeout member of pAcquireInfo must not be UINT64_MAX (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-surface-07783) Objects - 1 Object[0] - VK_OBJECT_TYPE_SWAPCHAIN_KHR, Handle 762846664909142826 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

errors when opening a menu

ERROR: VALIDATION - Message Id Number: 1629488792 | Message Id Name: VUID-vkAcquireNextImageKHR-semaphore-parameter Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-parameter ] Object 0: handle = 0x563fd309d570, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x61200698 | Invalid VkSemaphore Object 0xa058ddff50c8d300. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE, semaphore must be a valid VkSemaphore handle (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-parameter) Objects - 1 Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 94832123565424 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

ERROR: VALIDATION - Message Id Number: 1567320034 | Message Id Name: UNASSIGNED-Threading-Info Validation Error: [ UNASSIGNED-Threading-Info ] Object 0: handle = 0xa058ddff50c8d300, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0x5d6b67e2 | Couldn't find VkSemaphore Object 0xa058ddff50c8d300. This should not happen and may indicate a bug in the application. Objects - 1 Object[0] - VK_OBJECT_TYPE_SEMAPHORE, Handle -6892515141048806656 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

ERROR: VALIDATION - Message Id Number: 1567320034 | Message Id Name: UNASSIGNED-Threading-Info Validation Error: [ UNASSIGNED-Threading-Info ] Object 0: handle = 0xa058ddff50c8d300, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0x5d6b67e2 | Couldn't find VkSemaphore Object 0xa058ddff50c8d300. This should not happen and may indicate a bug in the application. Objects - 1 Object[0] - VK_OBJECT_TYPE_SEMAPHORE, Handle -6892515141048806656 at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

clayjohn commented 1 year ago

Okay, so my working theory is that when using Wayland, the first image in the swapchain does not have an id of (0). Accordingly, after recreating the swap chain we have to call fpAcquireNextImageKHR(). When we first start the program, we are just fine defaulting to a current_buffer of 0, but I guess thats because we know that fpAcquireNextImageKHR() will get called before we need to render to the swapchain anyway.

That being said, on Windows, we can't call fpAcquireNextImageKHR() after destroying the swapchain because it causes a hang (but apparently assuming the first image is at index 0 is okay). On Wayland, we can't call fpAcquireNextImageKHR() unnecessarily either and we can't assume the first index is at 0.

Therefore, I suggest we go with a solution suggested by @jpcerrone earlier and just return a different error in the case that we choose not to recreate the swapchain because it has 0 size. Then, if that is the case, we return and skip the call to fpAcquireNextImageKHR(). Otherwise, if we just recreated a valid swapchain, then we can go ahead with the call to fpAcquireNextImageKHR() and continue rendering.

The diff for that:

diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 3feed2b109..22d024cdab 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -1818,7 +1818,7 @@ Error VulkanContext::_update_swap_chain(Window *window) {
        if (window->width == 0 || window->height == 0) {
                free(presentModes);
                // Likely window minimized, no swapchain created.
-               return OK;
+               return ERR_SKIP;
        }
        // The FIFO present mode is guaranteed by the spec to be supported
        // and to have no tearing.  It's a great default present mode to use.
@@ -2275,8 +2275,10 @@ Error VulkanContext::prepare_buffers() {
                                // Swapchain is not as optimal as it could be, but the platform's
                                // presentation engine will still present the image correctly.
                                print_verbose("Vulkan: Early suboptimal swapchain, recreating.");
-                               _update_swap_chain(w);
-                               break;
+                               Error err = _update_swap_chain(w);
+                               if (err == ERR_SKIP) {
+                                       break;
+                               }
                        } else if (err != VK_SUCCESS) {
                                ERR_BREAK_MSG(err != VK_SUCCESS, "Vulkan: Did not create swapchain successfully. Error code: " + String(string_VkResult(err)));
                        } else {

@quinnyo Do you mind trying out another diff? I will test this on Windows to ensure it does not cause a regression

edit: tested on PopOS with X11 and it works fine. Tested on Windows and I can confirm that the diff does not reintroduce https://github.com/godotengine/godot/issues/77790

quinnyo commented 1 year ago

@clayjohn with that one it behaves correctly from user point of view, but with one vulkan validation error every time a menu is first focussed:

Vulkan: Early suboptimal swapchain, recreating.
ERROR: VALIDATION - Message Id Number: -370888023 | Message Id Name: VUID-vkAcquireNextImageKHR-semaphore-01286
    Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01286 ] Object 0: handle = 0xfee4cf0000004ab1, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0xe9e4b2a9 | vkAcquireNextImageKHR: Semaphore must not be currently signaled. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE it must be unsignaled (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-01286)
    Objects - 1
        Object[0] - VK_OBJECT_TYPE_SEMAPHORE, Handle -79711294478857551
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:267)

Let me know if there's anything else I can do!

akien-mga commented 1 year ago

Moving to 4.2 milestone as we won't have time to finalize and properly test a bugfix before the 4.1 release. But this stays high on the priority list and should be fixed shortly after release for the 4.1.1 patch release.

Angular-Angel commented 1 year ago

When I try and load my project from 4.1 in a fresh build of 4.2 master, on Xubuuntu, with the voxel tools plugin, after confirming that I want to update the project from 4.1 to 4.2, the editor crashes, giving me:

Godot Engine v4.2.dev.custom_build.29c21e020 - https://godotengine.org
OpenGL API 3.3.0 NVIDIA 525.125.06 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce GTX 1050 Ti

Project is missing: /home/angle/Documents/Programming/GodotEngine/Projects/4.0/Advanced Movement System Godot (AMSG) Template/project.godot
Editing project: /home/angle/Documents/Programming/GodotEngine/Projects/4.0/Omnicraft
Godot Engine v4.2.dev.custom_build.29c21e020 - https://godotengine.org
Vulkan API 1.3.224 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1050 Ti
WARNING: Invalid pipelines cache header.
     at: _load_pipeline_cache (drivers/vulkan/rendering_device_vulkan.cpp:9071)

And when I searched that error in the issues, this issue came up, so I'm posting it here in hopes that it's relevant.

Edit: I get the same behavior trying to open other projects - except the line about the invalid pipeline is actually very unreliable, shows up like one time in 10 maybe. :/

RockyMadio commented 1 year ago

Caching shaders of a Godot 3.5 on the Steamdeck also results alot of lag. On my windows 10 machine, I have a custom shader caching system that flashes materials after the .tscn of a scene has been loaded. Even when the shader folder in AppData is flushed, it is restored pretty quick and the game runs smoothly.

However, on the Steamdeck, the results does not seem like that, even when the game has seen various materials earlier, it still has to lag everytime new element arrives into the scene, or when player simply just runs around . The game is exported as Linux and transfered to the Steamdeck as Devmode.

I came here via this https://github.com/godotengine/godot/issues/80054

frankhuurman commented 3 days ago

I didn't experience this problem before but I do have it now every once in a while on v4.3.official.stable(on Ubuntu 24.04.1), I came here via this issue: https://github.com/godotengine/godot/issues/79102 which is exactly the problem I'm having as well.

Every once in a while when I save my scene it gets stuck at the saving thumbnail part.