packed float no more supported in Xcode 9 (iOS 11)

It seems that the Metal compiler is breaking compatibility with iOS 9 and earlier metal shader


This declaration (for a vertex declaration) was valid in iOS 9


struct VS_INPUT {

packed_float2 TexCoord [[attribute(8)]];

packed_float3 Vertex [[attribute(0)]];

};



Now produces an error:


error: type 'packed_float2' (aka 'packed_vec<float, 2>') is not valid for attribute 'attribute'


Even settings Metal Language version 1.0 or 1.1


So what is the solution ?

Replies

Using a packed type with the [[attribute(n)]] qualifier has never worked. The error in previous versions of Xcode would only be triggered if you used you VS_INPUT as with the [[stage_in]] qualifier in a vertex function argument. However, there's no reason to use the [[attribute(n)]] unless you're using VS_INPUT with with the [[stage_in]] qualifier in a vertex functioh argument.


Perhaps you're unnecessarily using the [[attribute(n)]]qualifier? What happens if you remove them form VS_INPUT?