Error when trying to create pipeline

This topic contains 1 reply, has 2 voices, and was last updated by  Bill Hollings 10 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #1393



    With the latest MoltenVK version (0.19), we’re running into two issues: this and another one where pipeline creation fails with the following error:

    [***MoltenVK ERROR***] VK_ERROR_INITIALIZATION_FAILED: Could not create render pipeline:
    Error Domain=CompilerError Code=2 “Vertex attribute in_f4Color(1) is missing from the vertex descriptor” UserInfo={NSLocalizedDescription=Vertex attribute in_f4Color(1) is missing from the vertex descriptor}.

    While we’re able to work around the first issue, we don’t understand why we’re getting the second error at all. The only thing I can think of is that there is somehow a mismatch between the vertex attribute declaration in the MSL source and the VkVertexInputAttributeDescription structure. MSL generated by MVK seems to list the attributes in the wrong order, but applies the attribute indices correctly to them.

    Here’s the source GLSL:

    layout (location = 0) in vec3 in_f3Position;
    layout (location = 1) in vec4 in_f4Color;
    layout (location = 5) in vec2 in_f2Tex0;

    which gets translated by glslang/shaderc into SPIR-V as:

    OpEntryPoint Vertex %main “main” %vOut %in_f3Position %in_f4Color %in_f2Tex0 %__1

    OpName %in_f3Position “in_f3Position”
    OpName %in_f4Color “in_f4Color”
    OpName %in_f2Tex0 “in_f2Tex0”

    OpDecorate %in_f3Position Location 0
    OpDecorate %in_f4Color Location 1
    OpDecorate %in_f2Tex0 Location 5

    %float = OpTypeFloat 32
    %v4float = OpTypeVector %float 4
    %v2float = OpTypeVector %float 2
    %v3float = OpTypeVector %float 3
    %_ptr_Input_v3float = OpTypePointer Input %v3float
    %in_f3Position = OpVariable %_ptr_Input_v3float Input
    %_ptr_Output_v4float = OpTypePointer Output %v4float
    %in_f4Color = OpVariable %_ptr_Input_v4float Input
    %_ptr_Input_v2float = OpTypePointer Input %v2float
    %in_f2Tex0 = OpVariable %_ptr_Input_v2float Input

    Here’s the MSL output by the ShaderConverter tool:

    struct main0_in
    float2 in_f2Tex0 [[attribute(5)]];
    float4 in_f4Color [[attribute(1)]];
    float3 in_f3Position [[attribute(0)]];
    vertex main0_out main0(main0_in in [[stage_in]], constant cbPerObject& _17 [[buffer(0)]], constant cbGUI& _41 [[buffer(1)]])

    Here’s the VkVertexInputAttributeDescription array:

    const VkVertexInputAttributeDescription vertexAttributeDescriptions[] =
    // location, binding, format, offset
    { 0, 0, VK_FORMAT_R32G32B32_SFLOAT, 0 },
    { 1, 0, VK_FORMAT_B8G8R8A8_UNORM, 12 },
    { 5, 0, VK_FORMAT_R32G32_SFLOAT, 16 }

    Is this a known issue?


    Bill Hollings

    No…this is not a known issue…and has not been reported before.

    Do you have a small sample app that you can submit that demonstrates the problem?

    Alternately…it has not been made public yet…but MoltenVK is transitioning to an open-source model. If you provide your GitHub user ID via our Contact form (or see the button below), we can provide you with access to the open-source MoltenVK Beta on GitHub. You will then be able to trace what is happening to your vertex attributes in the MoltenVK source code.

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘MoltenVK Support’ is closed to new topics and replies.