There are, of course, several ways to do something. The vertex descriptor is used only for one of them.
For example, a vertex function can be declared as follows:
vertex MyVertexOut vertex_func(device const float3 *positions [[buffer(0)]],
device const float2 *texCoords [[buffer(1)]],
uint vid [[vertex_id]])
{
}
, , .
:
struct MyVertexIn
{
float3 position;
float2 texCoord;
};
vertex MyVertexOut vertex_func(device const MyVertexIn *vertexes [[buffer(0)]],
uint vid [[vertex_id]])
{
}
, , MyVertexIn
.
. .
:
struct MyVertexIn
{
float3 position [[attribute(0)]];
float2 texCoord [[attribute(1)]];
};
vertex MyVertexOut vertex_func(MyVertexIn vertex [[stage_in]])
{
}
attribute(n)
stage_in
. , . , . . , , position
float3
, ( ) half3
( ), Metal .
, , . , , ( , ), , ( ). Etc.
, . , .