Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

MSL vertex layout reordered #21

@ltjax

Description

@ltjax

It seems that glslcc is reordering the vertex layout according to usage when transpiling to MSL:

#version 450
layout (location = 0) in vec2 Position;
layout (location = 1) in vec2 UV;
layout (location = 2) in vec4 Color;

/* uniforms and outputs here... */

void main()
{
    Frag_UV = UV;
    Frag_Color = Color;
    gl_Position = Projection * vec4(Position.xy,0,1);
}

Gives me this input in MSL:

struct main0_in
{
    float2 UV [[attribute(0)]];
    float4 Color [[attribute(1)]];
    float2 Position [[attribute(2)]];
};

The attribute order is the usage order in the code, not the original location. If I change the source's main() to:

void main()
{
    gl_Position = Projection * vec4(Position.xy,0,1);
    Frag_UV = UV;
    Frag_Color = Color;
}

I get the 'correct' order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions