I remember back in OpenGL ES that the framework really appreciated it if the data for each verticie was a power of 2 bits. However I see no such claim for Metal and am wondering if it makes any difference at all here.
Secondly I am wondering if I need to use a float3 for the position of each verticie since the 1.0 can be assumed for each one. Perhaps I can use the slot usually for the z component to store something else?
There is chapter about types and alignment of these guys in Metal docs. Judging from posts on this forum many people have problems with that. If you follow the rules outlined there (for example both float3 and float4 are aligned to 16-Byte boundary) carefully in both host code (Swift/ObjC) and in Metal shaders, you can have any data layout you want. This is because (unlike OpenGL) you simply get a pointer to the buffer where data is stored and you pull it out yourself. So Metal doesn’t have to “understand” what your’re doing. To answer specific question about float3 vectors: Yeah, you can use .z for Whatever you want and then load only .xy inshader and set .z to constant. But note that alignment of float3 is 16 bytes, so you’re wasting 4 bytes anyway. To keep it simple you can use float4, put 1.0 in .z and extra data in .w If you’re after efficient packing, do float2 coordinates for all vertices first, and then put extra data after that - or in another buffer. Again: you have to be careful here and understand C-style data layout rules well, or else it is going to be frustrating task.