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

Crash at start on Snapdragon X elite #222

Open
HgGamer opened this issue Dec 11, 2024 · 8 comments
Open

Crash at start on Snapdragon X elite #222

HgGamer opened this issue Dec 11, 2024 · 8 comments
Labels
type: bug Something isn't working

Comments

@HgGamer
Copy link

HgGamer commented Dec 11, 2024

Vulkan sdk is installed, vkcube is working fine.

C:\Development\blade>cargo run --example bunnymark
warning: `C:\Development\blade\.cargo\config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
warning: use of deprecated method `winit::event_loop::EventLoop::<T>::create_window`: use `ActiveEventLoop::create_window` instead
   --> examples\bunnymark\main.rs:371:29
    |
371 |     let window = event_loop.create_window(window_attributes).unwrap();
    |                             ^^^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated method `winit::event_loop::EventLoop::<T>::run`: use `EventLoop::run_app` instead
   --> examples\bunnymark\main.rs:400:10
    |
400 |         .run(|event, target| {
    |          ^^^

warning: `blade` (example "bunnymark") generated 2 warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.24s
     Running `target\debug\examples\bunnymark.exe`
DeviceInformation { is_software_emulated: false, device_name: "Qualcomm(R) Adreno(TM) X1-85 GPU", driver_name: "Qualcomm Technologies Inc. Adreno Vulkan Driver", driver_info: "Driver Build: 36a15f63c3, , 1727332442\nDate: 09/26/2024\nCompiler Version: E031.47.15.00\nDriver Branch: \n" }
thread 'main' panicked at blade-graphics\src\vulkan\pipeline.rs:601:18:
called `Result::unwrap()` on an `Err` value: ([0x0], ERROR_UNKNOWN)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\examples\bunnymark.exe` (exit code: 101)
@kvark
Copy link
Owner

kvark commented Dec 13, 2024

Interesting, thank you for the report! Could you run with validation enabled? I.e. have the validation layers installed and do "validation: true" in the context desc.

@kvark kvark added the type: bug Something isn't working label Dec 13, 2024
@HgGamer
Copy link
Author

HgGamer commented Dec 13, 2024

I changed the validation to true then false in bunnymark/main.rs:82

I still get the same output. Note, I'm not a rust developer

@segfault87
Copy link

segfault87 commented Dec 18, 2024

It looks like it fails at vkCreateGraphicsPipelines(). Most examples (except init, mini) fails at this specific call.

Thread 0, Frame 0:
vkCreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines) returns VkResult VK_ERROR_UNKNOWN (-13):
    device:                         VkDevice = 000001EFE0839220
    pipelineCache:                  VkPipelineCache = 0000000000000000
    createInfoCount:                uint32_t = 1
    pCreateInfos:                   const VkGraphicsPipelineCreateInfo* = 0000009416741790
        pCreateInfos[0]:                const VkGraphicsPipelineCreateInfo = 0000009416741790:
            sType:                          VkStructureType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO (28)
            pNext:                          const void* = VkPipelineRenderingCreateInfo
            flags:                          VkPipelineCreateFlags = 0
            stageCount:                     uint32_t = 2
            pStages:                        const VkPipelineShaderStageCreateInfo* = 00000094167401E0
                pStages[0]:                     const VkPipelineShaderStageCreateInfo = 00000094167401E0:
                    sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO (18)
                    pNext:                          const void* = NULL
                    flags:                          VkPipelineShaderStageCreateFlags = 0
                    stage:                          VkShaderStageFlagBits = 1 (VK_SHADER_STAGE_VERTEX_BIT)
                    module:                         VkShaderModule = E7E6D0000000000F
                    pName:                          const char* = "vs_main"
                    pSpecializationInfo:            const VkSpecializationInfo* = NULL
                pStages[1]:                     const VkPipelineShaderStageCreateInfo = 0000009416740210:
                    sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO (18)
                    pNext:                          const void* = NULL
                    flags:                          VkPipelineShaderStageCreateFlags = 0
                    stage:                          VkShaderStageFlagBits = 16 (VK_SHADER_STAGE_FRAGMENT_BIT)
                    module:                         VkShaderModule = D5B26F0000000010
                    pName:                          const char* = "fs_main"
                    pSpecializationInfo:            const VkSpecializationInfo* = NULL
            pVertexInputState:              const VkPipelineVertexInputStateCreateInfo* = 00000094167403C0:
                sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO (19)
                pNext:                          const void* = NULL
                flags:                          VkPipelineVertexInputStateCreateFlags = 0
                vertexBindingDescriptionCount:  uint32_t = 0
                pVertexBindingDescriptions:     const VkVertexInputBindingDescription* = 0000000000000004
                vertexAttributeDescriptionCount: uint32_t = 0
                pVertexAttributeDescriptions:   const VkVertexInputAttributeDescription* = 0000000000000004
            pInputAssemblyState:            const VkPipelineInputAssemblyStateCreateInfo* = 0000009416740450:
                sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO (20)
                pNext:                          const void* = NULL
                flags:                          VkPipelineInputAssemblyStateCreateFlags = 0
                topology:                       VkPrimitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST (3)
                primitiveRestartEnable:         VkBool32 = 0
            pTessellationState:             const VkPipelineTessellationStateCreateInfo* = NULL
            pViewportState:                 const VkPipelineViewportStateCreateInfo* = 00000094167406C0:
                sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO (22)
                pNext:                          const void* = NULL
                flags:                          VkPipelineViewportStateCreateFlags = 0
                viewportCount:                  uint32_t = 1
                pViewports:                     const VkViewport* = UNUSED
                scissorCount:                   uint32_t = 1
                pScissors:                      const VkRect2D* = UNUSED
            pRasterizationState:            const VkPipelineRasterizationStateCreateInfo* = 00000094167404B0:
                sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO (23)
                pNext:                          const void* = NULL
                flags:                          VkPipelineRasterizationStateCreateFlags = 0
                depthClampEnable:               VkBool32 = 0
                rasterizerDiscardEnable:        VkBool32 = 0
                polygonMode:                    VkPolygonMode = VK_POLYGON_MODE_FILL (0)
                cullMode:                       VkCullModeFlags = 0 (VK_CULL_MODE_NONE)
                frontFace:                      VkFrontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE (0)
                depthBiasEnable:                VkBool32 = 0
                depthBiasConstantFactor:        float = 0
                depthBiasClamp:                 float = 0
                depthBiasSlopeFactor:           float = 0
                lineWidth:                      float = 1
            pMultisampleState:              const VkPipelineMultisampleStateCreateInfo* = 0000009416740788:
                sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO (24)
                pNext:                          const void* = NULL
                flags:                          VkPipelineMultisampleStateCreateFlags = 0
                rasterizationSamples:           VkSampleCountFlagBits = 1 (VK_SAMPLE_COUNT_1_BIT)
                sampleShadingEnable:            VkBool32 = 0
                minSampleShading:               float = 0
                pSampleMask:                    const VkSampleMask* = 0000009416740780
                    pSampleMask[0]:                 const VkSampleMask = 4294967295
                alphaToCoverageEnable:          VkBool32 = 0
                alphaToOneEnable:               VkBool32 = 0
            pDepthStencilState:             const VkPipelineDepthStencilStateCreateInfo* = 0000009416740850:
                sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO (25)
                pNext:                          const void* = NULL
                flags:                          VkPipelineDepthStencilStateCreateFlags = 0
                depthTestEnable:                VkBool32 = 0
                depthWriteEnable:               VkBool32 = 0
                depthCompareOp:                 VkCompareOp = VK_COMPARE_OP_NEVER (0)
                depthBoundsTestEnable:          VkBool32 = 0
                stencilTestEnable:              VkBool32 = 0
                front:                          VkStencilOpState = 0000009416740878:
                    failOp:                         VkStencilOp = VK_STENCIL_OP_KEEP (0)
                    passOp:                         VkStencilOp = VK_STENCIL_OP_KEEP (0)
                    depthFailOp:                    VkStencilOp = VK_STENCIL_OP_KEEP (0)
                    compareOp:                      VkCompareOp = VK_COMPARE_OP_NEVER (0)
                    compareMask:                    uint32_t = 0
                    writeMask:                      uint32_t = 0
                    reference:                      uint32_t = 0
                back:                           VkStencilOpState = 0000009416740894:
                    failOp:                         VkStencilOp = VK_STENCIL_OP_KEEP (0)
                    passOp:                         VkStencilOp = VK_STENCIL_OP_KEEP (0)
                    depthFailOp:                    VkStencilOp = VK_STENCIL_OP_KEEP (0)
                    compareOp:                      VkCompareOp = VK_COMPARE_OP_NEVER (0)
                    compareMask:                    uint32_t = 0
                    writeMask:                      uint32_t = 0
                    reference:                      uint32_t = 0
                minDepthBounds:                 float = 0
                maxDepthBounds:                 float = 0
            pColorBlendState:               const VkPipelineColorBlendStateCreateInfo* = 0000009416740F80:
                sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO (26)
                pNext:                          const void* = NULL
                flags:                          VkPipelineColorBlendStateCreateFlags = 0
                logicOpEnable:                  VkBool32 = 0
                logicOp:                        VkLogicOp = VK_LOGIC_OP_CLEAR (0)
                attachmentCount:                uint32_t = 1
                pAttachments:                   const VkPipelineColorBlendAttachmentState* = 000001EFE0E89EE0
                    pAttachments[0]:                const VkPipelineColorBlendAttachmentState = 000001EFE0E89EE0:
                        blendEnable:                    VkBool32 = 1
                        srcColorBlendFactor:            VkBlendFactor = VK_BLEND_FACTOR_ONE (1)
                        dstColorBlendFactor:            VkBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA (7)
                        colorBlendOp:                   VkBlendOp = VK_BLEND_OP_ADD (0)
                        srcAlphaBlendFactor:            VkBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA (9)
                        dstAlphaBlendFactor:            VkBlendFactor = VK_BLEND_FACTOR_ONE (1)
                        alphaBlendOp:                   VkBlendOp = VK_BLEND_OP_ADD (0)
                        colorWriteMask:                 VkColorComponentFlags = 15 (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT)
                blendConstants:                 float[4] = 0000009416740FA8
                    blendConstants[0]:              float = 0
                    blendConstants[1]:              float = 0
                    blendConstants[2]:              float = 0
                    blendConstants[3]:              float = 0
            pDynamicState:                  const VkPipelineDynamicStateCreateInfo* = 0000009416740680:
                sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO (27)
                pNext:                          const void* = NULL
                flags:                          VkPipelineDynamicStateCreateFlags = 0
                dynamicStateCount:              uint32_t = 4
                pDynamicStates:                 const VkDynamicState* = 0000009416740670
                    pDynamicStates[0]:              const VkDynamicState = VK_DYNAMIC_STATE_VIEWPORT (0)
                    pDynamicStates[1]:              const VkDynamicState = VK_DYNAMIC_STATE_SCISSOR (1)
                    pDynamicStates[2]:              const VkDynamicState = VK_DYNAMIC_STATE_BLEND_CONSTANTS (4)
                    pDynamicStates[3]:              const VkDynamicState = VK_DYNAMIC_STATE_STENCIL_REFERENCE (8)
            layout:                         VkPipelineLayout = DD3A8A0000000015
            renderPass:                     VkRenderPass = 0000000000000000
            subpass:                        uint32_t = 0
            basePipelineHandle:             VkPipeline = 0000000000000000
            basePipelineIndex:              int32_t = 0
        pNext:                          VkPipelineRenderingCreateInfo = 0000009416740FF0:
            sType:                          VkStructureType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO (1000044002)
            pNext:                          const void* = NULL
            viewMask:                       uint32_t = 0
            colorAttachmentCount:           uint32_t = 1
            pColorAttachmentFormats:        const VkFormat* = 000001EFE01F3AB0
                pColorAttachmentFormats[0]:     const VkFormat = VK_FORMAT_B8G8R8A8_SRGB (50)
            depthAttachmentFormat:          VkFormat = VK_FORMAT_D32_SFLOAT_S8_UINT (130)
            stencilAttachmentFormat:        VkFormat = VK_FORMAT_D32_SFLOAT_S8_UINT (130)
    pAllocator:                     const VkAllocationCallbacks* = NULL
    pPipelines:                     VkPipeline* = 000001EFE01F3B30
        pPipelines[0]:                  VkPipeline = 0000000000000000

There's no any errors spotted by the validation layer. I guess it's something with quirks in Qualcomm's Vulkan driver on Windows. Didn't have this problem on Linux (mesa/turnip).

@kvark
Copy link
Owner

kvark commented Dec 19, 2024

It's really hard to say what part of the shader the Qualcomm's Vulkan driver doesn't like, but it looks like a driver bug to me.

@Alonely0
Copy link

It's really hard to say what part of the shader the Qualcomm's Vulkan driver doesn't like, but it looks like a driver bug to me.

I'm an experienced Rust dev w/ an X1E80100 and willing to help debug this issue further if you're interested, although I'll need guidance as I've done very little graphics development.

@kvark
Copy link
Owner

kvark commented Jan 3, 2025

I'd first change the shader into something trivia, i.e. vertex doing nothing and fragment outputting a constant color.
I assume that pipeline would be created successfully. And then I'd manually bisect the shader code (between the failing point and the successful point) to see which exact construct is making the driver to freak out.

Once we find the construct, we can work with current Naga developers to put a workaround in place in the shading translation.

@HgGamer
Copy link
Author

HgGamer commented Jan 3, 2025

After I changed the fragment part in bunnymark, it doesn't crash, and it renders a white box.
Its seems like the issue is textureSample function call

@fragment fn fs_main(vertex: VertexOutput) -> @location(0) vec4<f32> { return vec4<f32>(1.0, 1.0, 1.0, 1.0); }

@HgGamer
Copy link
Author

HgGamer commented Jan 3, 2025

After a bit of testing it seems like the crash occurs when you try to access vertex properties in fs_main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants