Reputation: 418
I'm trying to write vertex descriptor for my vertex shader which takes following struct as stage_in input.
struct VertexIn {
float2x2 foo;
}
vertex float4 vertexShader(const VertexIn in [[stage_in]]) {...}
Now when defining vertex descriptor's attribute what should be the MTLVertexFormat?
vertexDescriptor.attributes[0].format = ???
I went through the documentation, I didn't find any enum case for Matrices. Is it fine if say set format as float2
and give size 2 * size of float2
?
Upvotes: 2
Views: 147
Reputation: 10137
According The Metal Feature Set Tables:
You can declare only one argument of the vertex, fragment, or kernel function with the [[stage_in]]
attribute. For a user-defined structure declared with the [[stage_in]]
attribute, the members of the structure can be:
You cannot use the stage_in
attribute to declare members of the structure that are packed vectors, matrices, structures, bitfields, references or pointers to a type, or arrays of scalars, vectors, or matrices.
Upvotes: 2