hexops / mach

zig game engine & graphics toolkit
https://machengine.org
Other
3.31k stars 157 forks source link

sysgpu: vulkan `Segmentation fault` error prevents some examples from running on Wayland #1270

Open joshua-holmes opened 1 month ago

joshua-holmes commented 1 month ago

Error message when running sprite example, although, the same error message occurs glyphs and hardware-check as well:

info(gamemode): gamemode: activated
info(mach): found Vulkan backend on Discrete GPU adapter: AMD Radeon RX 6900 XT (RADV NAVI21), Vulkan driver version 24.2.2

VUID-VkShaderModuleCreateInfo-pCode-08737(ERROR / SPEC): msgNum: -1520283006 - Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08737 ] | MessageID = 0xa5625282 | vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error):
[VUID-StandaloneSpirv-OpTypeRuntimeArray-04680] Vulkan, OpTypeStruct containing an OpTypeRuntimeArray must be decorated with Block or BufferBlock.
  %_struct_12 = OpTypeStruct %_runtimearr_mat4v4float
. The Vulkan spec states: If pCode is a pointer to SPIR-V code, pCode must adhere to the validation rules described by the Validation Rules within a Module section of the SPIR-V Environment appendix (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-08737)
    Objects: 0
VUID-VkGraphicsPipelineCreateInfo-layout-07990(ERROR / SPEC): msgNum: -278545623 - Validation Error: [ VUID-VkGraphicsPipelineCreateInfo-layout-07990 ] Object 0: handle = 0x944a2c0000000039, type = VK_OBJECT_TYPE_SHADER_MODULE; Object 1: handle = 0x210d07000000003a, type = VK_OBJECT_TYPE_PIPELINE_LAYOUT; | MessageID = 0xef65bb29 | vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[0] SPIR-V (VK_SHADER_STAGE_VERTEX_BIT) uses descriptor [Set 0, Binding 2, variable "sprite_uv_transforms"] of type VK_DESCRIPTOR_TYPE_STORAGE_BUFFER but expected . The Vulkan spec states: If a resource variables is declared in a shader, and the descriptor type is not VK_DESCRIPTOR_TYPE_MUTABLE_EXT, a descriptor slot in layout must match the descriptor type (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkGraphicsPipelineCreateInfo-layout-07990)
    Objects: 2
        [0] 0x944a2c0000000039, type: 15, name: NULL
        [1] 0x210d07000000003a, type: 17, name: NULL
Segmentation fault at address 0x40
???:?:?: 0x719ed28fbc04 in ??? (libvulkan_radeon.so)
Unwind information for `libvulkan_radeon.so:0x719ed28fbc04` was not available, trace may be incomplete

???:?:?: 0x719ed28e2fc8 in ??? (libvulkan_radeon.so)
???:?:?: 0x719ed28e4c17 in ??? (libvulkan_radeon.so)
???:?:?: 0x719ed28e6567 in ??? (libvulkan_radeon.so)
???:?:?: 0x719ed28e72dd in ??? (libvulkan_radeon.so)
???:?:?: 0x719ed28e7678 in ??? (libvulkan_radeon.so)
???:?:?: 0x719ec6cc9c60 in ??? (libVkLayer_khronos_validation.so)
???:?:?: 0x719ec7021306 in ??? (libVkLayer_khronos_validation.so)
/home/josh/.cache/zig/p/1220d2b6789b71a94e692cb2f060bff4ffa4edfe196216cd573da68e74ab884eb34e/vk.zig:29220:67: 0x11fcaeb in createGraphicsPipelines (sprite)
            const result = self.dispatch.vkCreateGraphicsPipelines(
                                                                  ^
/home/josh/dev/open-source/mach/src/sysgpu/vulkan.zig:2245:44: 0x11fafc3 in init (sprite)
        _ = try vkd.createGraphicsPipelines(vk_device, .null_handle, 1, &[_]vk.GraphicsPipelineCreateInfo{.{
                                           ^
/home/josh/dev/open-source/mach/src/sysgpu/vulkan.zig:644:35: 0x11fcdb1 in createRenderPipeline (sprite)
        return RenderPipeline.init(device, desc);
                                  ^
/home/josh/dev/open-source/mach/src/sysgpu/main.zig:510:60: 0x120002a in buildPipeline (sprite)
        const render_pipeline = device.createRenderPipeline(descriptor) catch @panic("api error");
                                                           ^
/home/josh/dev/open-source/mach/src/gfx/SpritePipeline.zig:176:30: 0x1203fe1 in update (sprite)
            try buildPipeline(core, sprite_pipeline, pipeline_id, texture);
                             ^
/home/josh/dev/open-source/mach/src/module/module.zig:444:32: 0x121e762 in dispatchInternal__anon_13725 (sprite)
                .ErrorUnion => try @call(.auto, handler, args),
                               ^
/home/josh/dev/open-source/mach/src/module/module.zig:360:38: 0x12202e4 in dispatch (sprite)
            return m.dispatchInternal(stack_space, options, injectable);
                                     ^
/home/josh/dev/open-source/mach/examples/sprite/main.zig:24:27: 0x122042e in main (sprite)
    try mach.mods.dispatch(stack_space, .{});
                          ^
/home/josh/zig/0.13.0-dev.351+64ef45eb0/files/lib/std/start.zig:524:37: 0x122086e in main (sprite)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x719ed4d4ae07 in ??? (libc.so.6)
???:?:?: 0x719ed4d4aecb in ??? (libc.so.6)
???:?:?: 0x116c464 in ??? (???)
Aborted (core dumped)
RonaldZielaznicki commented 2 days ago

Would you mind checking if you can still run into this error after https://github.com/hexops/mach/pull/1289?