In Metal what is the difference between a
From what I gather from the documentation:
Packed datatypes are arrays, whereas their unpacked counter parts are structs.
Here's their usage:
packed_float4 packedFloat4; packedFloat4 = 0.0f; packedFloat4 = 1.0f; packedFloat4 = 2.0f; packedFloat4 = 3.0f; packed_float4 anotherPackedFloat4 = [0.0f, 1.0f, 2.0f, 3.0f] //array initalizer //vs. float4 f; f.x = 0; //equivalent to f.r = 0; f.y = 1; //equivalent to f.g = 1; f.z = 2; //equivalent to f.b = 2; f.w = 3; //equivalent to f.a = 3; float4 anotherFloat4 = float4(0.0f, 1.0f, 2.0f, 3.0f) //constructor call