In Metal, you can pass data per vertex by adding it to the vertex data and modifying the vertex descriptor to include it. However, how can I pass data per primitive, rather than per vertex? So that if I do this CommandEncoder.drawIndexedPrimitives(type: .triangle, indexCount: 6, indexType: .uint16, indexBuffer: indices, indexBufferOffset: 0)
, each primitive rendered will have data specific to that primitive, i. e. it will be the same for three consecutive vertices? What I'm actually trying to do is I'm trying to render a scene, containing more than one texture, but only use one draw call. I pass a texture array to the fragment shader, which is sampled based on a texture ID. These texture IDs should be per primitive. Is this possible?
Make a seperate buffer, pass it to the GPU, and index it by vertex_id/3